{"version":3,"sources":["vendor/init.js"],"sourcesContent":["/**\n * Copyright IBM Corp. 2024, 2026\n * SPDX-License-Identifier: BUSL-1.1\n */\n\n(function(doc, appName) {\n  const fs = new Map(\n    Object.entries(JSON.parse(doc.querySelector(`[data-${appName}-fs]`).textContent))\n  );\n  const appendScript = function(src) {\n    var $script = doc.createElement('script');\n    $script.src = src;\n    doc.body.appendChild($script);\n  };\n\n  // polyfills\n  if (!('TextDecoder' in window)) {\n    appendScript(fs.get(`${['text-encoding', 'encoding-indexes'].join('/')}.js`));\n    appendScript(fs.get(`${['text-encoding', 'encoding'].join('/')}.js`));\n  }\n  if (!(window.CSS && window.CSS.escape)) {\n    appendScript(fs.get(`${['css.escape', 'css.escape'].join('/')}.js`));\n  }\n\n  try {\n    const $appMeta = doc.querySelector(`[name=\"${appName}/config/environment\"]`);\n    // pick out the operatorConfig from our application/json script tag\n    const operatorConfig = JSON.parse(doc.querySelector(`[data-${appName}-config]`).textContent);\n    // pick out the ember config from its meta tag\n    const emberConfig = JSON.parse(decodeURIComponent($appMeta.getAttribute('content')));\n\n    // rootURL is a special variable that requires settings before ember\n    // boots via ember's HTML metadata tag, the variable is equivalent to\n    // the -ui-content-path Consul flag (or `ui_config { content_path = \"\"}`)\n    // There will potentially be one or two more 'pre-init' variables that we need.\n    // Anything not 'pre-init' should use ui_config.\n    // Check the value to make sure its there and a string\n    const rootURL =\n      typeof operatorConfig.ContentPath !== 'string' ? '' : operatorConfig.ContentPath;\n    if (rootURL.length > 0) {\n      emberConfig.rootURL = rootURL;\n    }\n    $appMeta.setAttribute('content', encodeURIComponent(JSON.stringify(emberConfig)));\n  } catch (e) {\n    throw new Error(`Unable to parse ${appName} settings: ${e.message}`);\n  }\n})(document, 'consul-ui');\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;","file":"init.js"}