{"version":3,"sources":["webpack:///cif-parser/webpack/universalModuleDefinition","webpack:///cif-parser/webpack/bootstrap 5a7a19a6d1b6a0c8aa7b","webpack:///cif-parser/./src/index.js"],"names":[],"mappings":"AAAA,cACA,2BACA,uCACA,sCACA,IACA,aACA,2CAEA,gBACA,GAAC,mBACD,kBCTA,cAMA,IACA,iBAGA,mBACA,CACA,IACA,KAIA,2CAGA,aAGA,OACA,OAIA,IAzBA,eA4BA,MAGA,mBAA2C,CAAc,QAGzD,qBACA,GACA,kCACA,CACA,gBACA,cAGA,OAGA,iBACA,YACA,qBAA2B,UAA0B,UACrD,YAAiC,CAAe,QAChD,EAEA,aADA,QAIA,mBAAsD,wCAA+D,SAGrH,MAGA,0BChEA,aA+HA,EAAO,QACH,CAAO,MA7HQ,WACf,CAkE+B,eAC3B,IAAkB,OAAd,KAAO,GAEP,QACA,MACA,KAAI,EACJ,EAAO,EAAI,EACP,QAAW,KAAG,MACV,UAAQ,KAIZ,MAGJ,WAAI,GAA4B,KAAS,QAAQ,KAEjD,IAAO,EAAI,EAAO,QACd,IAAI,GAAM,CAAC,EAAI,GAAK,EACpB,UACI,CADA,OAGJ,QAAa,MACb,KAAI,GAAS,EAAQ,OACjB,KAEJ,QACH,GACD,CACH,MACG,QAAO,EAAO,IAAM,EAAO,GAAK,EAAc,EAAO,GAAG,QAAU,EAEzE,EAED,CAAuB,aAEnB,CAEH,SAFW,EAAM,QAAQ,QACtB,aAGJ,CAA4B,aACxB,QAAI,GACJ,GAAI,EACJ,EAAO,EAAkB,EAAQ,GAAG,QAChC,KACK,GADD,GAAc,EAAQ,GAC1B,UAAS,EAAI,EAAG,EAAI,EAAQ,OACxB,OAAY,KACR,cAGR,SACA,KACH,GACD,CACH,QACJ,IA1HyB,GAClB,EAAQ,EAAM,MAClB,WACA,KACA,KAAmB,KAJG,aAMtB,eAAiB,4CAAO,SACpB,MAAI,EAAK,MAEF,UAAI,EAAK,MACZ,aACA,OAAS,EAAS,QAAU,EACzB,QAAI,EAAK,MAER,YAAS,EAAS,OAAS,IAAM,IAAM,EAEvC,SAAS,EAAS,QAAU,EAI5B,YAEJ,QACa,EAAS,OAAS,IAD3B,EAAK,MACL,QAAiC,IAAM,EAAK,QAAQ,IAAK,MAE9B,OAAM,IAAM,EAGlD,iBA5BqB,oEA8BtB,KAAK,GAAI,GAAI,EAAG,EAAI,EAAS,OAAQ,IACjC,KAKK,MALD,EAAgB,KACpB,IAAI,EACJ,EACA,KACA,KACA,KAAS,EAAI,EAAG,EAAI,EAAK,OACjB,MAAO,EACX,UAAa,GAAT,MACA,IADgB,KAEZ,KACI,OAAO,KAAK,EAEhB,kBAAQ,EAET,GACH,IADO,MAGC,UAAO,KAAK,EACZ,gBAEA,MAEJ,OAAQ,EAGhB,KAMJ,IANQ,KAOX,MAED,CAEA","file":"cif-parser.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cifParser\"] = factory();\n\telse\n\t\troot[\"cifParser\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5a7a19a6d1b6a0c8aa7b","'use strict';\n\n\nfunction cifParser(value) {\n    let lines = value.split(/[\\r\\n]+/);\n    let result = {};\n    let newLines = [];\n    let inLoopHeader = false;\n\n    for (let line of lines) {\n        if (line.match(/^ *#/)) { // a comment\n\n        } else if (line.match(/^ *loop_/)) {\n            inLoopHeader = true;\n            newLines[newLines.length] = line.trim();\n        } else if (line.match(/^ *_/)) {\n            if (inLoopHeader) {\n                newLines[newLines.length - 1] += ' ' + line.trim();\n            } else {\n                newLines[newLines.length] = line.trim();\n            }\n        } else {\n            if (inLoopHeader) {\n                inLoopHeader = false;\n            }\n            if (line.match(/^ *;/)) {\n                newLines[newLines.length - 1] += ' ' + line.replace(';', \"'\").trim();\n            } else {\n                newLines[newLines.length - 1] += ' ' + line.trim();\n            }\n        }\n    }\n\n    for (let i = 0; i < newLines.length; i++) {\n        var line = newLines[i] + ' ';\n        var begin = 0;\n        var inQuote = false;\n        var escaped = false;\n        var fields = [];\n        for (var j = 0; j < line.length; j++) {\n            var char = line.charAt(j);\n            if (char === ' ' || char === '\\t') {\n                if (!inQuote) {\n                    if (begin < j) {\n                        fields.push(line.substring(begin, j));\n                    }\n                    begin = j + 1;\n                }\n            } else if (char === \"'\") {\n                if (!escaped) {\n                    if (inQuote) { // the end of the Quote\n                        fields.push(line.substring(begin, j));\n                        inQuote = false;\n                    } else {\n                        inQuote = true;\n                    }\n                    begin = j + 1;\n                }\n            }\n            if (char === '\\\\') {\n                escaped = true;\n            } else {\n                escaped = false;\n            }\n        }\n        processFields(fields, result);\n    }\n\n    return result;\n\n    function processFields(fields, result) {\n        if (fields[0] === 'loop_') {\n            // it is an array of object\n            var headers = [];\n            var lines = [];\n            var i = 1;\n            while (i < fields.length) {\n                if (fields[i].match(/^_/)) {\n                    headers.push(fields[i]);\n                } else {\n                    break;\n                }\n                i++;\n            }\n\n            var common = getCommonBeginning(headers).replace(/_$/, '');\n\n            while (i < fields.length) {\n                var pos = (i - 1) % headers.length;\n                if (pos === 0) {\n                    var line = {};\n                }\n                line[headers[pos]] = fields[i];\n                if (pos === (headers.length - 1)) {\n                    lines.push(line);\n                }\n                i++;\n            }\n            result[common] = lines;\n        } else {\n            result[fields[0]] = fields[1] ? unescapeValue(fields[1].trim()) : fields[1];\n        }\n    }\n\n    function unescapeValue(value) {\n\n        value = value.replace(/\\\\'e/g, 'Ã©');\n        return value;\n    }\n\n    function getCommonBeginning(strings) {\n        var common = '';\n        var currentPosition = 0;\n        while (currentPosition < strings[0].length) {\n            var currentChar = strings[0].charAt(currentPosition);\n            for (var i = 1; i < strings.length; i++) {\n                if (strings[i].charAt(currentPosition) !== currentChar) {\n                    return common;\n                }\n            }\n            common += currentChar;\n            currentPosition++;\n        }\n        return common;\n    }\n}\n\nmodule.exports = {\n    parse: cifParser\n};\n\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js"],"sourceRoot":""}