{"version":3,"names":["window","define","_exports","_pluginApi","Object","defineProperty","value","default","require","getObjectForTheme","name","after","initialize","withPluginApi","api","decorateCooked","$elem","find","each","a","$","this","href","attr","startsWith","includes","location","host","document","addEventListener","createTopicBtn","getElementById","innerWidth","spanElement","querySelector","textContent","strictCountries","loadAndInitConsent","css","createElement","rel","head","appendChild","script","type","src","onload","CookieConsent","run","revision","guiOptions","consentModal","layout","position","preferencesModal","categories","necessary","enabled","readOnly","functionality","analytics","ads","onConsent","applyConsent","onChange","language","translations","en","title","description","acceptAllBtn","acceptNecessaryBtn","showPreferencesBtn","savePreferencesBtn","closeIconLabel","sections","linkedCategory","acceptedCategory","querySelectorAll","forEach","el","dataset","loadAnalytics","loadAds","analyticsLoaded","console","log","adsLoaded","adsense","async","crossOrigin","amazonAds","shopifyAds","customAdNetwork","innerHTML","fetch","then","res","json","data","country_code","catch"],"sourceRoot":"theme-1/","sources":["discourse/initializers/theme-field-89-common-html-script-1.js","_html/common/head_tag_1.js","_html/common/head_tag_2.js"],"sourcesContent":["if ('define' in window) {\ndefine(\"discourse/theme-1/discourse/initializers/theme-field-89-common-html-script-1\", [\"exports\", \"discourse/lib/plugin-api\"], function (_exports, _pluginApi) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const settings = require(\"discourse/lib/theme-settings-store\").getObjectForTheme(1);\n  const themePrefix = key => `theme_translations.1.${key}`;\n  var _default = _exports.default = {\n    name: \"theme-field-89-common-html-script-1\",\n    after: \"inject-objects\",\n    initialize() {\n      (0, _pluginApi.withPluginApi)(\"0.8\", api => {\n        api.decorateCooked($elem => {\n          $elem.find('a').each(function () {\n            var a = $(this);\n            var href = a.attr('href');\n            if (href && href.startsWith('http') && !href.includes(window.location.host)) {\n              a.attr('target', '_blank');\n              a.attr('rel', 'noopener noreferrer');\n            }\n          });\n        });\n      });\n    }\n  };\n});\n}\n","\n    document.addEventListener(\"DOMContentLoaded\", function () {\n        // Wait for the button to load\n        let createTopicBtn = document.getElementById(\"create-topic\");\n\n        if (createTopicBtn) {\n            let screenWidth = window.innerWidth;\n\n            // Check if mobile view (below 768px)\n            if (screenWidth < 768) {\n                let spanElement = createTopicBtn.querySelector(\"span\");\n                \n                if (spanElement) {\n                    spanElement.textContent = \"Ask a Question\"; // Change the button text\n                }\n            }\n        }\n    });\n\n","\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n\n    /***********************\n     * 1. REGION CONTROL\n     ***********************/\n    const strictCountries = [\n        'AT','BE','BG','HR','CY','CZ','DK','EE','FI',\n        'FR','DE','GR','HU','IE','IT','LV','LT','LU','MT',\n        'NL','PL','PT','RO','SK','SI','ES','SE','GB'\n    ];\n\n    /***********************\n     * 2. LOAD & INIT CONSENT\n     ***********************/\n    function loadAndInitConsent() {\n        // Load the CSS required for the banner to be visible\n        let css = document.createElement('link');\n        css.rel = 'stylesheet';\n        css.href = 'https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.css';\n        document.head.appendChild(css);\n\n        // Load the JS library\n        let script = document.createElement('script');\n        script.type = 'module';\n        script.src = 'https://cdn.jsdelivr.net/gh/orestbida/cookieconsent@3.1.0/dist/cookieconsent.umd.js';\n        \n        // ONLY run the configuration AFTER the script has finished loading\n        script.onload = function() {\n            CookieConsent.run({\n\n                revision: 1, \n\n                guiOptions: {\n                    consentModal: {\n                        layout: 'box',\n                        position: 'bottom right'\n                    },\n                    preferencesModal: {\n                        layout: 'box'\n                    }\n                },\n\n                categories: {\n                    necessary: { enabled: true, readOnly: true },\n                    functionality: { enabled: false },\n                    analytics: { enabled: false },\n                    ads: { enabled: false }\n                },\n\n                /***********************\n                 * 3. CONSENT HANDLERS\n                 ***********************/\n                onConsent: () => applyConsent(),\n                onChange: () => applyConsent(),\n\n                /***********************\n                 * 4. UI TEXT \n                 ***********************/\n                language: {\n                    default: 'en',\n                    translations: {\n                        en: {\n                            consentModal: {\n                                title: 'Privacy First. Community Always.',\n                                description: `\n                                    Complaint Hub uses essential cookies to run securely.\n                                    Optional cookies help improve experience, analytics, and show relevant ads.\n                                    <br><br>\n                                    <a href=\"/privacy\" target=\"_blank\">Read Privacy Policy</a>\n                                `,\n                                acceptAllBtn: 'Accept All',\n                                acceptNecessaryBtn: 'Reject Optional',\n                                showPreferencesBtn: 'Customize'\n                            },\n                            preferencesModal: {\n                                title: 'Manage Your Privacy',\n                                savePreferencesBtn: 'Save Preferences',\n                                closeIconLabel: 'Close',\n                                sections: [\n                                    {\n                                        title: 'Essential Cookies',\n                                        description: 'Required for login, security, and complaint system functionality.',\n                                        linkedCategory: 'necessary'\n                                    },\n                                    {\n                                        title: 'Functionality',\n                                        description: 'Enable embedded media and enhanced community features.',\n                                        linkedCategory: 'functionality'\n                                    },\n                                    {\n                                        title: 'Analytics',\n                                        description: 'Help us improve Complaint Hub using anonymized usage insights.',\n                                        linkedCategory: 'analytics'\n                                    },\n                                    {\n                                        title: 'Advertisements',\n                                        description: 'Used to display relevant ads that support the platform.',\n                                        linkedCategory: 'ads'\n                                    }\n                                ]\n                            }\n                        }\n                    }\n                }\n            });\n        };\n        document.head.appendChild(script);\n    }\n\n    /***********************\n     * 5. APPLY CONSENT\n     ***********************/\n    function applyConsent() {\n        if (CookieConsent.acceptedCategory('functionality')) enableEmbeds();\n        if (CookieConsent.acceptedCategory('analytics')) loadAnalytics();\n        if (CookieConsent.acceptedCategory('ads')) loadAds();\n    }\n\n    /***********************\n     * 6. SERVICES\n     ***********************/\n    function enableEmbeds() {\n        document.querySelectorAll('[data-embed]').forEach(el => {\n            if (!el.src) el.src = el.dataset.src;\n        });\n    }\n\n    function loadAnalytics() {\n        if (!window.analyticsLoaded) {\n            window.analyticsLoaded = true;\n            console.log(\"Complaint Hub Analytics Enabled\");\n        }\n    }\n\n  function loadAds() {\n        if (!window.adsLoaded) {\n            window.adsLoaded = true;\n\n            console.log(\"Complaint Hub: Initializing Ad Networks...\");\n\n            // 1. Google AdSense (Example)\n            const adsense = document.createElement('script');\n            adsense.src = \"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXX\";\n            adsense.async = true;\n            adsense.crossOrigin = \"anonymous\";\n            document.head.appendChild(adsense);\n\n            // 2. Amazon Ads (Example)\n            const amazonAds = document.createElement('script');\n            // Replace with your actual Amazon ad script URL\n            amazonAds.src = \"https://z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=XXXX\"; \n            amazonAds.async = true;\n            document.head.appendChild(amazonAds);\n\n            // 3. Shopify Tracking/Ads (Example)\n            const shopifyAds = document.createElement('script');\n            // Replace with your actual Shopify network script\n            shopifyAds.src = \"https://cdn.shopify.com/s/trekkie.storefront.min.js\"; \n            shopifyAds.async = true;\n            document.head.appendChild(shopifyAds);\n\n            // 4. Custom Inline Script (If a network gives you raw code instead of a URL)\n            const customAdNetwork = document.createElement('script');\n            customAdNetwork.innerHTML = `\n                // Your custom ad network javascript goes here\n                window.myCustomAdNetwork = true;\n                console.log(\"Custom ads loaded\");\n            `;\n            document.head.appendChild(customAdNetwork);\n\n        }\n    }\n\n\n  /***********************\n     * 7. GEO SAFE LOAD (FIXED FOR ADS)\n     ***********************/\n    fetch('https://ipapi.co/json/')\n        .then(res => res.json())\n        .then(data => {\n            // Check if the user is in a strict country (EU/India)\n            if (strictCountries.includes(data.country_code)) {\n                loadAndInitConsent(); \n            } else {\n                console.log(\"Non-strict region detected. Skipping banner and loading ads directly.\");\n                // User is in USA, Canada, etc. Load everything immediately!\n                loadAnalytics();\n                loadAds(); \n            }\n        })\n        .catch(() => {\n            // Fallback: If the IP check fails, show the banner just to be safe.\n            loadAndInitConsent(); \n        });\n\n});\n\n"],"mappings":"AAAI,WAAYA,QAChBC,OAAO,+EAAgF,CAAC,UAAW,6BAA6B,SAAUC,EAAUC,GAClJ;AAEAC,OAAOC,eAAeH,EAAU,aAAc,CAC5CI,OAAO,IAETJ,EAASK,aAAU;AACFC,QAAQ,sCAAsCC,kBAAkB;AAElEP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