/*! Tags - Tue, 12 Mar 2024 16:58:14 GMT */ "use strict";(self.webpackChunkom_api_js=self.webpackChunkom_api_js||[]).push([[28],{882:function(t,e,i){i.r(e),i.d(e,{default:function(){return h}});var a=i(7624),s=i(7075),r=i(3446),o=i(2888);function n(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var a=i.call(t,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class h{constructor(t){n(this,"promises",(t=>{let e=[],i="loaded"===window[a.GLOBAL_OM].scripts.geolocation.status,s=this.parse(t);return!i&&this.hasLocationTags(s)&&e.push(this.C.defaults.Scripts.geolocation()),new Promise((t=>{e.length||t(),Promise.all(e).then((()=>{this.all(),t()}))}))})),n(this,"parse",(t=>{let e=/\{\{(.*?)\}\}/g;return t.match(e)?t.match(e).map((t=>t.split("|")[0])):null})),n(this,"hasLocationTags",(t=>this.valid(t,this.locationTags))),n(this,"hasDateTags",(t=>this.valid(t,this.dateTags))),n(this,"all",(()=>{this.geolocation(),this.dates(),this.journeys(),this.campaignData()})),n(this,"geolocation",(()=>{let t=window[a.GLOBAL_OM].scripts.geolocation;"loaded"===t.status&&(0,o.each)(t.data.original,((t,e)=>{let i=[];switch(t){case"country_name":i=["country"];break;case"country_iso":i=["country_code"];break;case"region_name":i=["region","state","province","territory"];break;case"zip_code":i=["zip","postal_code"];break;default:i=(0,o.inArray)(t,this.locationTags)?[t]:[]}i.forEach((t=>this.set(t,e)))}))})),n(this,"dates",(()=>{try{const t=new Date;this.set("day",new Intl.DateTimeFormat("en-US",{weekday:"long"}).format(t)),this.set("month",new Intl.DateTimeFormat("en-US",{month:"long"}).format(t)),this.set("year",new Intl.DateTimeFormat("en-US",{year:"numeric"}).format(t)),this.set("date",new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric"}).format(t))}catch(t){s.Z.debug("warn","Date tags can not be initialized for the following reason:",{e:t})}})),n(this,"journeys",(()=>{this.set("page_url",window.location.href),this.set("referer_url",(0,o.referrer)()),this.set("referrer_url",(0,o.referrer)()),this.set("pages_visited",r.Z.get("omSessionPageviews")),this.set("time_on_site",Math.round(((0,o.currentTime)()-r.Z.get("omSessionStart"))/1e3)),this.set("visit_timestamp",r.Z.get("omSessionStart")),this.set("page_title",document.title)})),n(this,"campaignData",(()=>{this.set("cn",this.C.data.name),this.set("campaign_name",this.C.data.name)})),n(this,"fields",(t=>{this.C.Form.getFieldNames().forEach((e=>{if(void 0!==t[e]&&0!!t&&0(0,o.inArray)(t.replace("{{","").replace("}}",""),e))).length)),n(this,"set",((t,e)=>{window[a.GLOBAL_OM].custom[t]=e})),this.C=t,this.locationTags=["country","country_code","zip","postal_code","region_code","region","state","territory","province","city","town","latitude","longitude"],this.dateTags=["day","month","year","date"],this.init()}init(){(0,o.trigger)(document,"Tags.init",{Campaign:this.C}),this.geolocation(),this.dates()}}}}]);