{"version":3,"sources":["jsdelivr-header.js","/npm/ethical-scripts-frontend@0.0.5/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,oECNA,IAAA,MAAA,QAAA,QACA,IAAA,QAAA,MACA,OAAA,QAAA,S,uCACA,6BAAA,QAAA,kC,wEAEA,IAAM,KAAM,EAAA,6BAAA,gBACN,WAAa,+CACb,WAAA,gJAGiD,IAHjD,mDAMA,aAAe,SAAC,GAAD,wGAGY,KAAK,UAAU,GAH3B,QAMf,eAAiB,WAAgB,IAAf,EAAe,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAA,GAAP,GACtB,GAAc,QAAQ,IAAI,UAAY,sBAAwB,MAC9D,EAAS,WAAa,EACtB,EAAS,aAAa,GAC5B,MAAO,CACH,QAAA,QAAA,cAAA,UAAQ,IAAI,IAAI,wBAAyB,CAAE,OAAQ,KACnD,QAAA,QAAA,cAAA,UAAQ,IAAI,IAAI,IAAK,IACrB,QAAA,QAAA,cAAA,UAAQ,IAAI,IAAI,wBAAyB,CAAE,OAAQ,cAE1D,E,gBAEc","file":"/npm/ethical-scripts-frontend@0.0.5/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/ethical-scripts-frontend@0.0.5/dist/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","import { join } from 'path'\nimport { readFileSync } from 'fs'\nimport React from 'react'\nimport { getAppPrefix } from 'ethical-utility-resolve-module'\n\nconst app = getAppPrefix()\nconst scriptPath = '/node_modules/ethical-scripts-frontend/dist/'\nconst initScript = `\n    window.require\n        .load('module?exclude=' + window.require.ids.toString())\n        .then(() => setTimeout(() => window.require('${app}'), 0))\n        .catch(e => console.error(e))\n`\nconst beforeScript = (state) => (`\n    window.global = window\n    window.process = { env: {} }\n    window.state = JSON.parse('${JSON.stringify(state)}')\n`)\n\nconst getInitScripts = (state = {}) => {\n    const scriptName = (process.env.NODE_ENV || 'NODE_ENV_UNDEFINED') + '.js'\n    const script = scriptPath + scriptName\n    const before = beforeScript(state)\n    return [\n        <script key='0' dangerouslySetInnerHTML={{ __html: before }} />,\n        <script key='1' src={script} />,\n        <script key='2' dangerouslySetInnerHTML={{ __html: initScript }} />\n    ]\n}\n\nexport default getInitScripts\n"]}