{"version":3,"sources":["jsdelivr-header.js","/npm/@gorillabot-labs/sticky-query-params@1.1.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,YAAc,QAAQ,gBAEtB,kBAAoB,MACpB,iBAAmB,CAAC,aAAc,eAAgB,aAAc,WAAY,eAwBlF,SAAS,gBAAgB,GACrB,MAAO,CAAC,kBAAmB,GAAQ,KAAK,IAC5C,CAEA,SAAS,4BAA4B,GACjC,MAAM,EAAwB,GACxB,EAAW,SAAS,qBAAqB,KAE/C,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,OAAQ,IAAK,CACtC,MAAM,EAAO,EAAS,IAEa,IAA/B,EAAK,KAAK,QAAQ,IAClB,EAAsB,KAAK,EAEnC,CAEA,OAAO,CACX,CAEA,SAAS,uBAAuB,GAC5B,MAAM,EAAY,YAAY,SAAS,EAAK,MAE5C,iBAAiB,SAAQ,SAAU,GAC/B,MAAM,EAAoB,OAAO,aAAa,QAAQ,gBAAgB,IAElE,IACA,EAAU,MAAM,GAAU,EAElC,IAEA,EAAK,KAAO,YAAY,aAAa,EACzC,CArDA,OAAO,IAAM,CACT,YAAa,WAET,OAAO,UAAY,OAAO,WAAa,CAAC,EAExC,MAAM,EAAS,YAAY,MAAM,OAAO,SAAS,QAQjD,GANA,iBAAiB,SAAQ,SAAU,GAC3B,EAAO,IACP,OAAO,aAAa,QAAQ,gBAAgB,GAAS,EAAO,GAEpE,KAEI,OAAO,UAAU,iBAIjB,MAAM,IAAI,MAAM,gGAHQ,4BAA4B,UAAU,kBAC9C,QAAQ,uBAIhC","file":"/npm/@gorillabot-labs/sticky-query-params@1.1.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@gorillabot-labs/sticky-query-params@1.1.0/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 queryString = require('query-string');\n\nconst DEFAULT_NAMESPACE = \"sqp\"\nconst VALID_UTM_PARAMS = [\"utm_source\", \"utm_campaign\", \"utm_medium\", \"utm_term\", \"utm_content\"]\n\nwindow.sqp = {\n    stickParams: function () {\n        // Init our config in case people forget to do so\n        window.sqpConfig = window.sqpConfig || {}\n\n        const params = queryString.parse(window.location.search)\n\n        VALID_UTM_PARAMS.forEach(function (utmKey) {\n            if (params[utmKey]) {\n                window.localStorage.setItem(__getStorageKey(utmKey), params[utmKey])\n            }\n        })\n\n        if (window.sqpConfig.conversionDomain) {\n            const conversionLinks = __findConversionDomainLinks(sqpConfig.conversionDomain)\n            conversionLinks.forEach(__appendUtmQueryParams)\n        } else {\n            throw new Error(\"Unable to find conversionDomain in window.sqpConfig. Please double check setup instructions.\")\n        }\n    }\n};\n\nfunction __getStorageKey(utmKey) {\n    return [DEFAULT_NAMESPACE, utmKey].join(\".\")\n}\n\nfunction __findConversionDomainLinks(domain) {\n    const conversionDomainLinks = []\n    const allLinks = document.getElementsByTagName(\"a\");\n\n    for (let i = 0; i < allLinks.length; i++) {\n        const link = allLinks[i]\n\n        if (link.href.indexOf(domain) !== -1) {\n            conversionDomainLinks.push(link)\n        }\n    }\n\n    return conversionDomainLinks\n}\n\nfunction __appendUtmQueryParams(link) {\n    const parsedUrl = queryString.parseUrl(link.href)\n\n    VALID_UTM_PARAMS.forEach(function (utmKey) {\n        const utmValueInStorage = window.localStorage.getItem(__getStorageKey(utmKey))\n\n        if (utmValueInStorage) {\n            parsedUrl.query[utmKey] = utmValueInStorage\n        }\n    })\n\n    link.href = queryString.stringifyUrl(parsedUrl)\n}\n"]}