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AS,OD1BZC,OAAOvB,eAAiBE,EAAQK,YAChCgB,OAAOf,UAAYN,EAAQM,UAC3Be,OAAOC,cAAgB,KACvBD,OAAOE,aAAe","sources":["webpack://project/./node_modules/js-cookie/dist/js.cookie.mjs","webpack://project/./web/app/themes/aifs-parent-theme/js/src/__headerScripts/controller.js","webpack://project/./web/app/themes/aifs-parent-theme/js/src/__headerScripts/gtmDataLayer.js"],"sourcesContent":["/*! js-cookie v3.0.5 | MIT */\n/* eslint-disable no-var */\nfunction assign (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n target[key] = source[key];\n }\n }\n return target\n}\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\nvar defaultConverter = {\n read: function (value) {\n if (value[0] === '\"') {\n value = value.slice(1, -1);\n }\n return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n },\n write: function (value) {\n return encodeURIComponent(value).replace(\n /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n decodeURIComponent\n )\n }\n};\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\n\nfunction init (converter, defaultAttributes) {\n function set (name, value, attributes) {\n if (typeof document === 'undefined') {\n return\n }\n\n attributes = assign({}, defaultAttributes, attributes);\n\n if (typeof attributes.expires === 'number') {\n attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n }\n if (attributes.expires) {\n attributes.expires = attributes.expires.toUTCString();\n }\n\n name = encodeURIComponent(name)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n\n var stringifiedAttributes = '';\n for (var attributeName in attributes) {\n if (!attributes[attributeName]) {\n continue\n }\n\n stringifiedAttributes += '; ' + attributeName;\n\n if (attributes[attributeName] === true) {\n continue\n }\n\n // Considers RFC 6265 section 5.2:\n // ...\n // 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n // character:\n // Consume the characters of the unparsed-attributes up to,\n // not including, the first %x3B (\";\") character.\n // ...\n stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n }\n\n return (document.cookie =\n name + '=' + converter.write(value, name) + stringifiedAttributes)\n }\n\n function get (name) {\n if (typeof document === 'undefined' || (arguments.length && !name)) {\n return\n }\n\n // To prevent the for loop in the first place assign an empty array\n // in case there are no cookies at all.\n var cookies = document.cookie ? document.cookie.split('; ') : [];\n var jar = {};\n for (var i = 0; i < cookies.length; i++) {\n var parts = cookies[i].split('=');\n var value = parts.slice(1).join('=');\n\n try {\n var found = decodeURIComponent(parts[0]);\n jar[found] = converter.read(value, found);\n\n if (name === found) {\n break\n }\n } catch (e) {}\n }\n\n return name ? jar[name] : jar\n }\n\n return Object.create(\n {\n set,\n get,\n remove: function (name, attributes) {\n set(\n name,\n '',\n assign({}, attributes, {\n expires: -1\n })\n );\n },\n withAttributes: function (attributes) {\n return init(this.converter, assign({}, this.attributes, attributes))\n },\n withConverter: function (converter) {\n return init(assign({}, this.converter, converter), this.attributes)\n }\n },\n {\n attributes: { value: Object.freeze(defaultAttributes) },\n converter: { value: Object.freeze(converter) }\n }\n )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n/* eslint-enable no-var */\n\nexport { api as default };\n","import getGtmDatalayer from './gtmDataLayer';\n\n// GLOBAL APP CONTROLLER\nconst controller = {\n\tinit() {\n\t\tconst gtmData = getGtmDatalayer();\n\t\twindow.gtmEnvironment = gtmData.environment;\n\t\twindow.dataLayer = gtmData.dataLayer;\n\t\twindow.onbeforeprint = null;\n\t\twindow.onafterprint = null;\n\t},\n};\nexport default controller;\n","import Cookies from 'js-cookie';\n\nconst getGtmDatalayer = () => {\n\tconst gtmEnvironment =\n\t\tlocation.host === 'www.aifsabroad.com' ? 'production' : 'staging';\n\tconst currentDate = new Date().toLocaleString('en-US', {\n\t\ttimeZone: 'America/New_York',\n\t});\n\tconst isInternalNetwork = false;\n\tconst gtmApplicationStatus =\n\t\tCookies.get('College-GTM-applicationStatus') || false;\n\tconst gtmConsultStatus = Cookies.get('College-GTM-consultstatus') || false;\n\tconst gtmContactId = Cookies.get('College-GTM-userid') || false;\n\tconst gtmRifStatus = Cookies.get('College-GTM-rifstatus') || false;\n\tconst titleElement = document.getElementsByTagName('title')[0];\n\n\treturn {\n\t\tenvironment: gtmEnvironment,\n\t\tdataLayer: [\n\t\t\t{\n\t\t\t\t'site.environment': gtmEnvironment,\n\t\t\t\tvisitor: {\n\t\t\t\t\tisLoggedIn: false,\n\t\t\t\t\tapplicationStatus: gtmApplicationStatus,\n\t\t\t\t\tconsultStatus: gtmConsultStatus,\n\t\t\t\t\tuserId: gtmContactId,\n\t\t\t\t\trifStatus: gtmRifStatus,\n\t\t\t\t\tisInternalNetworkRequest: isInternalNetwork,\n\t\t\t\t},\n\t\t\t\tpage: {\n\t\t\t\t\ttitle: titleElement.textContent,\n\t\t\t\t\tserverTime: currentDate,\n\t\t\t\t\tprogram: '',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n};\n\nexport default getGtmDatalayer;\n"],"names":["target","i","arguments","length","source","key","api","init","converter","defaultAttributes","set","name","value","attributes","document","expires","Date","now","toUTCString","encodeURIComponent","replace","decodeURIComponent","escape","stringifiedAttributes","attributeName","split","cookie","write","Object","create","get","cookies","jar","parts","slice","join","found","read","e","remove","withAttributes","this","withConverter","freeze","path","gtmEnvironment","currentDate","gtmData","location","host","toLocaleString","timeZone","environment","dataLayer","visitor","isLoggedIn","applicationStatus","Cookies","consultStatus","userId","rifStatus","isInternalNetworkRequest","page","title","getElementsByTagName","textContent","serverTime","program","window","onbeforeprint","onafterprint"],"sourceRoot":""}