{"version":3,"sources":["jsdelivr-header.js","/npm/ts-umd-global@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,GAAK,QAAQ,MAOnB,SAAS,QAAQ,EAAM,GACnB,GAAG,EAAM,GACT,MAAM,GACN,IAAI,EAAM,EACd,CASA,SAAS,GAAG,EAAM,GACd,EAAO,GAAG,OACV,MACM,EADK,GAAG,aAAa,EAAM,SAE5B,QAAQ,qBAAsB,8BAC9B,QAAQ,mCAAoC,8BACpC,cAAsB,uCACX,6FAIxB,GAAG,cAAc,EAAM,EAC3B,CAMA,SAAS,MAAM,GACX,EAAO,GAAG,WACV,MAAM,EAAQ,GAAG,aAAa,EAAM,SAC9B,EAAS,eACT,EAAQ,EAAM,QAAQ,GAAU,GAChC,EAAW,GAAG,EAAM,MAAM,EAAG,UAAc,EAAM,MAAM,KAC7D,GAAG,cAAc,EAAM,EAC3B,CAOA,SAAS,IAAI,EAAM,GACf,EAAO,GAAG,SACV,MAAM,EAAM,GAAG,aAAa,EAAM,SAClC,GAAG,cAAc,EAAM,EAAM,uBAAuB,OACxD,CA5CA,QAAQ,QAAU,QAClB,OAAO,QAAU","file":"/npm/ts-umd-global@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ts-umd-global@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const fs = require(\"fs\");\r\n\r\n/**\r\n * Rewrites .js, .js.map, .d.ts with UMD global support\r\n * @param {string} path Path without extension\r\n * @param {string} namespace Namespace to use\r\n */\r\nfunction rewrite(path, namespace) {\r\n    js(path, namespace);\r\n    jsmap(path);\r\n    dts(path, namespace);\r\n}\r\nrewrite.default = rewrite;\r\nmodule.exports = rewrite;\r\n\r\n/**\r\n * Rewrites .js with UMD global support\r\n * @param {string} path Path without extension\r\n * @param {string} namespace Namespace to use\r\n */\r\nfunction js(path, namespace) {\r\n    path = `${path}.js`;\r\n    const js = fs.readFileSync(path, \"utf-8\");\r\n    const injected = js\r\n        .replace(\"function (factory)\", \"function (global, factory)\")\r\n        .replace(\"})(function (require, exports) {\", `    else {\r\n        global.${namespace} = global.${namespace} || {};\r\n        var leaf = global.${namespace};\r\n        factory(global.require, leaf);\r\n    }\r\n})(this, function (require, exports) {`);\r\n    fs.writeFileSync(path, injected);\r\n}\r\n\r\n/**\r\n * Rewrites .js.map with UMD global support\r\n * @param {string} path Path without extension\r\n */\r\nfunction jsmap(path) {\r\n    path = `${path}.js.map`;\r\n    const jsmap = fs.readFileSync(path, \"utf-8\");\r\n    const marker = '\"mappings\":\"';\r\n    const index = jsmap.indexOf(marker) + marker.length;\r\n    const injected = `${jsmap.slice(0, index)};;;;;${jsmap.slice(index)}`;\r\n    fs.writeFileSync(path, injected);\r\n}\r\n\r\n/**\r\n * Rewrites .d.ts with UMD global support\r\n * @param {string} path Path without extension\r\n * @param {string} namespace Namespace to use\r\n */\r\nfunction dts(path, namespace) {\r\n    path = `${path}.d.ts`;\r\n    const dts = fs.readFileSync(path, \"utf-8\");\r\n    fs.writeFileSync(path, dts + `export as namespace ${namespace};\\n`);\r\n}\r\n"]}