import{c as f}from"./call-bind-aBC2DkHY.js";import{a3 as k}from"./vue-DcZzRy5G.js";import"./url-search-params-polyfill-Bf53zCcD.js";import{r as q}from"./vue-router-D8_sTCmw.js";var b={},P={};Object.defineProperty(P,"__esModule",{value:!0});P.DEFAULT_CONFIG=void 0;P.DEFAULT_CONFIG={enabled:!0,debug:!1,trackOnNextTick:!1,loadScript:!0,defer:!1,compatibility:!1};var E={},p={},T=f&&f.__assign||function(){return T=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},T.apply(this,arguments)};Object.defineProperty(p,"__esModule",{value:!0});p.hasScript=p.loadScript=void 0;function A(r,e){var t,i,n;e===void 0&&(e={});var a=document,u=a.createElement("script");if(window.dataLayer=(t=window.dataLayer)!==null&&t!==void 0?t:[],(i=window.dataLayer)===null||i===void 0||i.push({event:"gtm.js","gtm.start":new Date().getTime()}),!!r){u.async=!e.defer,u.defer=!!(e.defer||e.compatibility),e.nonce&&(u.nonce=e.nonce);var l=new URLSearchParams(T({id:r},(n=e.queryParams)!==null&&n!==void 0?n:{}));u.src="https://www.googletagmanager.com/gtm.js?"+l,a.body.appendChild(u)}}p.loadScript=A;function I(){return Array.from(document.getElementsByTagName("script")).some(function(r){return r.src.includes("googletagmanager.com/gtm.js")})}p.hasScript=I;var h=f&&f.__assign||function(){return h=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},h.apply(this,arguments)},F=f&&f.__rest||function(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t};Object.defineProperty(E,"__esModule",{value:!0});var N=P,S=p,C=function(){function r(e,t){t===void 0&&(t=N.DEFAULT_CONFIG),this.id=e,this.options=t,this.isInBrowserContext=function(){return typeof window<"u"}}return r.prototype.enabled=function(){var e;return(e=this.options.enabled)!==null&&e!==void 0?e:!0},r.prototype.enable=function(e){var t=this;e===void 0&&(e=!0),this.options.enabled=e,this.isInBrowserContext()&&e&&!S.hasScript()&&this.options.loadScript&&(Array.isArray(this.id)?this.id.forEach(function(i){typeof i=="string"?S.loadScript(i,{defer:t.options.defer,compatibility:t.options.compatibility,queryParams:t.options.queryParams}):S.loadScript(i.id,{defer:t.options.defer,compatibility:t.options.compatibility,queryParams:i.queryParams})}):S.loadScript(this.id,{defer:this.options.defer,compatibility:this.options.compatibility,queryParams:this.options.queryParams}))},r.prototype.debugEnabled=function(){var e;return(e=this.options.debug)!==null&&e!==void 0?e:!1},r.prototype.debug=function(e){this.options.debug=e},r.prototype.dataLayer=function(){var e;return this.isInBrowserContext()&&this.options.enabled?window.dataLayer=(e=window.dataLayer)!==null&&e!==void 0?e:[]:!1},r.prototype.trackView=function(e,t,i){var n;if(i===void 0&&(i={}),this.options.debug&&console.log("[VueGtm]: Dispatching TrackView",{screenName:e,path:t}),this.isInBrowserContext()&&this.options.enabled){var a=window.dataLayer=(n=window.dataLayer)!==null&&n!==void 0?n:[];a.push(h(h({},i),{event:"content-view","content-name":t,"content-view-name":e}))}},r.prototype.trackEvent=function(e){var t;e===void 0&&(e={});var i=e.event,n=e.category,a=n===void 0?null:n,u=e.action,l=u===void 0?null:u,d=e.label,o=d===void 0?null:d,s=e.value,v=s===void 0?null:s,g=e.noninteraction,w=g===void 0?!1:g,y=F(e,["event","category","action","label","value","noninteraction"]);if(this.options.debug&&console.log("[VueGtm]: Dispatching event",h({event:i,category:a,action:l,label:o,value:v},y)),this.isInBrowserContext()&&this.options.enabled){var O=window.dataLayer=(t=window.dataLayer)!==null&&t!==void 0?t:[];O.push(h({event:i??"interaction",target:a,action:l,"target-properties":o,value:v,"interaction-type":w},y))}},r}();E.default=C;var m=f&&f.__assign||function(){return m=Object.assign||function(r){for(var e,t=1,i=arguments.length;t<i;t++){e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},m.apply(this,arguments)},V=f&&f.__awaiter||function(r,e,t,i){function n(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function l(s){try{o(i.next(s))}catch(v){u(v)}}function d(s){try{o(i.throw(s))}catch(v){u(v)}}function o(s){s.done?a(s.value):n(s.value).then(l,d)}o((i=i.apply(r,e||[])).next())})},D=f&&f.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,u;return u={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function l(o){return function(s){return d([o,s])}}function d(o){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(a=o[0]&2?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return t.label++,{value:o[1],done:!1};case 5:t.label++,n=o[1],o=[0];continue;case 7:o=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){t.label=o[1];break}if(o[0]===6&&t.label<a[1]){t.label=a[1],a=o;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(o);break}a[2]&&t.ops.pop(),t.trys.pop();continue}o=e.call(r,t)}catch(s){o=[6,s],n=0}finally{i=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},M=f&&f.__values||function(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(b,"__esModule",{value:!0});b.useGtm=b.createGtm=void 0;var $=k,B=P,R=E,G=p,c,U=/^GTM-[0-9A-Z]+$/;function x(r){if(typeof r!="string"||!U.test(r))throw new Error("GTM-ID '"+r+"' is not valid")}function j(r,e){var t,i;if(e===void 0&&(e={id:""}),Array.isArray(e.id))try{for(var n=M(e.id),a=n.next();!a.done;a=n.next()){var u=a.value;x(typeof u=="string"?u:u.id)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}else x(e.id);e=m(m({},B.DEFAULT_CONFIG),e),c=new R.default(e.id,e),r.config.globalProperties.$gtm=c,e.vueRouter&&W(r,e.vueRouter,e.ignoredViews,e.trackOnNextTick),c.options.enabled&&c.options.loadScript&&(Array.isArray(e.id)?e.id.forEach(function(l){if(typeof l=="string")G.loadScript(l,e);else{var d=m({},e);l.queryParams!=null&&(d.queryParams=m(m({},d.queryParams),l.queryParams)),G.loadScript(l.id,d)}}):G.loadScript(e.id,e)),r.provide("gtm",e)}function W(r,e,t,i){return t===void 0&&(t=[]),V(this,void 0,void 0,function(){var n;return D(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,Promise.resolve().then(function(){return q()})];case 1:return n=a.sent(),[3,3];case 2:return a.sent(),console.warn("[VueGtm]: You tried to register 'vueRouter' for vue-gtm, but 'vue-router' was not found."),[2];case 3:return t=t.map(function(u){return u.toLowerCase()}),e.afterEach(function(u,l,d){var o,s,v,g,w;if(!(typeof u.name!="string"||t.indexOf(u.name.toLowerCase())!==-1)){var y=u.meta&&typeof u.meta.gtm=="string"&&u.meta.gtm?u.meta.gtm:u.name;n.isNavigationFailure(d,n.NavigationFailureType.aborted)?c!=null&&c.debugEnabled()&&console.log("[VueGtm]: '"+y+"' not tracked due to navigation aborted"):n.isNavigationFailure(d,n.NavigationFailureType.cancelled)&&c!=null&&c.debugEnabled()&&console.log("[VueGtm]: '"+y+"' not tracked due to navigation cancelled");var O=(s=(o=u.meta)===null||o===void 0?void 0:o.gtmAdditionalEventData)!==null&&s!==void 0?s:{},L=(w=(g=(v=e.options)===null||v===void 0?void 0:v.history)===null||g===void 0?void 0:g.base)!==null&&w!==void 0?w:"",_=L;_.endsWith("/")||(_+="/"),_+=u.fullPath.startsWith("/")?u.fullPath.substr(1):u.fullPath,i?$.nextTick(function(){c==null||c.trackView(y,_,O)}):c==null||c.trackView(y,_,O)}}),[2]}})})}function Y(r){return{install:function(e){return j(e,r)}}}b.createGtm=Y;var Z={install:j},X=b.default=Z;function z(){return c}b.useGtm=z;export{X as d};
