{"version":3,"file":"main.hEID2H.js","sources":["theme-28/virtual:theme","theme-28/discourse/api-initializers/theme-initializer.gjs","theme-28/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(28);\n\nexport function themePrefix(key) {\n  return `theme_translations.28.${key}`;\n}\n","import { apiInitializer } from \"discourse/lib/api\";\n\nconst CONFIG = {\n  gtmId: \"GTM-M3KWR2J\",\n  qaFlags: [\"hubspotqa\", \"hubspotmig.hspot-prod-us.discourse.cloud\"],\n  injectedMarker: \"data-hs-compliance-injected\",\n  scripts: {\n    compliance: {\n      qa:   \"https://www.hubspot.com/wt-assets/static-files/compliance/next/index.js\",\n      prod: \"https://www.hubspot.com/wt-assets/static-files/compliance/index.js\",\n    },\n    helpers: {\n      qa:   \"https://www.hubspot.com/wt-assets/static-files/global-scripts/next/compliance-script-helpers/index.js\",\n      prod: \"https://www.hubspot.com/wt-assets/static-files/global-scripts/latest/compliance-script-helpers/index.js\",\n    },\n  },\n};\n\nconst isQaMode = () => {\n  try {\n    return CONFIG.qaFlags.some((flag) => window.location.hostname.includes(flag));\n  } catch {\n    return false;\n  }\n};\n\nconst GEAR_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n  <circle cx=\"12\" cy=\"12\" r=\"3\"/>\n  <path d=\"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z\"/>\n</svg>`;\n\nconst injectComplianceStyles = () => {\n  if (document.getElementById(\"hs-compliance-styles\")) return;\n\n  const style = document.createElement(\"style\");\n  style.id = \"hs-compliance-styles\";\n  style.textContent = `\n    li.hs-footer-cookie-settings svg[data-hs-gear] {\n      height: 1em;\n      width: 1em;\n      flex-shrink: 0;\n      outline: currentcolor;\n      color: var(--d-sidebar-link-icon-color);\n      padding-right: 4px;\n    }\n    li.hs-footer-cookie-settings .footer__legal-link svg {\n      display: none;\n    }\n    .hs-footer-cookie-settings.sidebar-section-link-wrapper, .hs-opt-out-settings.sidebar-section-link-wrapper  {\n      padding-left: 6px;\n    }\n    .sidebar-section-link-wrapper a {\n      justify-content: start;\n    }\n  `;\n  document.head.appendChild(style);\n};\n\nconst customiseLinkElements = (api) => {\n  setTimeout(() => {\n    injectComplianceStyles();\n\n    const cookieEl = document.querySelector(\"li.hs-footer-cookie-settings\");\n    if (cookieEl) {\n      cookieEl.classList.add(\"sidebar-section-link-wrapper\");\n      const anchor = cookieEl.querySelector(\"a\");\n      if (anchor && !anchor.querySelector(\"svg[data-hs-gear]\")) {\n        const tmp = document.createElement(\"span\");\n        tmp.innerHTML = GEAR_SVG;\n        const svg = tmp.firstElementChild;\n        svg.setAttribute(\"data-hs-gear\", \"true\");\n        anchor.insertBefore(svg, anchor.firstChild);\n      }\n    }\n\n    const optOutEl = document.querySelector(\"li.hs-opt-out-settings\");\n    if (optOutEl) {\n      optOutEl.classList.add(\"sidebar-section-link-wrapper\");\n    }\n    \n    const appEvents = api.container.lookup(\"service:app-events\");\n    const listItemSize = document.querySelectorAll('#compliance-universal-container ul > li').length - 1;  \n    appEvents.trigger(\"cookie-banner:loaded\", listItemSize);\n\n  }, 300);\n};\n\nconst injectHelpersScript = (api) => {\n  const qa = isQaMode();\n  const src = qa ? CONFIG.scripts.helpers.qa : CONFIG.scripts.helpers.prod;\n  const linkSelectors = \"#compliance-universal-container ul > li:last-child|tempClass;#sidebar-section-content-privacy > li:last-child|sidebar-section-link sidebar-row;\";\n  // test\n  const script = document.createElement(\"script\");\n  script.src = qa ? `${src}?${Date.now()}` : src;\n  script.type = \"text/javascript\";\n  script.defer = true;\n  script.setAttribute(\"data-hs-compliance-sibling\", linkSelectors);\n  script.setAttribute(\"data-hs-compliance-link-classes\", \"sidebar-section-link sidebar-row\");\n  script.addEventListener(\"load\", () => {    \n    customiseLinkElements(api);\n  });\n  document.head.appendChild(script);\n};\n\nconst injectComplianceScript = (api) => {\n  const { scripts, gtmId, injectedMarker } = CONFIG;\n\n  if (document.querySelector(`script[${injectedMarker}]`)) return;\n\n  const script = document.createElement(\"script\");\n  script.src = isQaMode() ? scripts.compliance.qa : scripts.compliance.prod;\n  script.type = \"text/javascript\";\n  script.defer = true;\n  script.setAttribute(injectedMarker, \"true\");\n  script.setAttribute(\"data-external-hs-domain\", \"true\");\n  if (gtmId) script.setAttribute(\"data-gtm-id\", gtmId);\n  script.addEventListener(\"load\", () => injectHelpersScript(api));\n  document.head.appendChild(script);\n};\n\nexport default apiInitializer((api) => {\n  try {\n    setTimeout(() => {\n      injectComplianceScript(api);\n      api.onPageChange(() => injectComplianceScript(api));\n    }, 500);\n  } catch (error) {\n    console.error(\"[HubSpot Compliance] Failed to inject compliance script:\", error);\n  }\n});","import * as Mod1 from \"./discourse/api-initializers/theme-initializer\";\nconst compatModules = {\n  \"discourse/api-initializers/theme-initializer\": Mod1,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["getObjectForTheme","CONFIG","gtmId","qaFlags","injectedMarker","scripts","compliance","qa","prod","helpers","isQaMode","some","flag","window","location","hostname","includes","customiseLinkElements","api","setTimeout","injectComplianceStyles","document","getElementById","style","createElement","id","textContent","head","appendChild","cookieEl","querySelector","classList","add","anchor","tmp","innerHTML","svg","firstElementChild","setAttribute","insertBefore","firstChild","optOutEl","appEvents","container","lookup","listItemSize","querySelectorAll","length","trigger","injectComplianceScript","script","src","type","defer","addEventListener","Date","now","injectHelpersScript","themeInitializer","apiInitializer","onPageChange","error","console","compatModules"],"mappings":";AAEwBA,EAAkB;;ACA1C,MAAMC,EAAS,CACbC,MAAO,cACPC,QAAS,CAAC,YAAa,4CACvBC,eAAgB,8BAChBC,QAAS,CACPC,WAAY,CACVC,GAAM,0EACNC,KAAM,sEAERC,QAAS,CACPF,GAAM,wGACNC,KAAM,6GAKNE,EAAWA,KACf,IACE,OAAOT,EAAOE,QAAQQ,KAAMC,GAASC,OAAOC,SAASC,SAASC,SAASJ,GACzE,CAAE,MACA,OAAO,CACT,GAmCIK,EAAyBC,IAC7BC,WAAW,KA5BkBC,MAC7B,GAAIC,SAASC,eAAe,wBAAyB;AAErD,MAAMC,EAAQF,SAASG,cAAc;AACrCD,EAAME,GAAK,uBACXF,EAAMG,YAAc,qiBAmBpBL,SAASM,KAAKC,YAAYL,IAKxBH;AAEA,MAAMS,EAAWR,SAASS,cAAc;AACxC,GAAID,EAAU,CACZA,EAASE,UAAUC,IAAI;AACvB,MAAMC,EAASJ,EAASC,cAAc;AACtC,GAAIG,IAAWA,EAAOH,cAAc,qBAAsB,CACxD,MAAMI,EAAMb,SAASG,cAAc;AACnCU,EAAIC,UA1CK;AA2CT,MAAMC,EAAMF,EAAIG;AAChBD,EAAIE,aAAa,eAAgB,QACjCL,EAAOM,aAAaH,EAAKH,EAAOO,WAClC,CACF,CAEA,MAAMC,EAAWpB,SAASS,cAAc;AACpCW,GACFA,EAASV,UAAUC,IAAI;AAGzB,MA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