/*! Tags - Wed, 16 Apr 2025 23:03:24 GMT */ "use strict";(self.webpackChunkom_api_js=self.webpackChunkom_api_js||[]).push([[27],{4308:function(t,e,a){a.r(e),a.d(e,{default:function(){return r}});var s=a(1441),i=a(187),o=a(2e3),n=a(3824);class r{constructor(t){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,n.trigger)(document,"Tags.init",{Campaign:this.C}),this.geolocation(),this.dates()}promises=t=>{let e=[],a="loaded"===window[s.GLOBAL_OM].scripts.geolocation.status,i=this.parse(t);return!a&&this.hasLocationTags(i)&&e.push(this.C.defaults.Scripts.geolocation()),new Promise((t=>{e.length||t(),Promise.all(e).then((()=>{this.all(),t()})).catch((()=>{}))}))};parse=t=>{let e=/\{\{(.*?)\}\}/g;return t.match(e)?t.match(e).map((t=>t.split("|")[0])):null};hasLocationTags=t=>this.valid(t,this.locationTags);hasDateTags=t=>this.valid(t,this.dateTags);all=()=>{this.geolocation(),this.dates(),this.journeys(),this.campaignData()};geolocation=()=>{let t=window[s.GLOBAL_OM].scripts.geolocation;"loaded"===t.status&&(0,n.each)(t.data.original,((t,e)=>{let a=[];switch(t){case"country_name":a=["country"];break;case"country_iso":a=["country_code"];break;case"region_name":a=["region","state","province","territory"];break;case"zip_code":a=["zip","postal_code"];break;default:a=(0,n.inArray)(t,this.locationTags)?[t]:[]}a.forEach((t=>this.set(t,e)))}))};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){i.A.debug("warn","Date tags can not be initialized for the following reason:",{e:t})}};journeys=()=>{this.set("page_url",window.location.href),this.set("referer_url",(0,n.referrer)()),this.set("referrer_url",(0,n.referrer)()),this.set("pages_visited",o.A.get("omSessionPageviews")),this.set("time_on_site",Math.round(((0,n.currentTime)()-o.A.get("omSessionStart"))/1e3)),this.set("visit_timestamp",o.A.get("omSessionStart")),this.set("page_title",document.title)};campaignData=()=>{this.set("cn",this.C.data.name),this.set("campaign_name",this.C.data.name)};fields=t=>{this.C.Form.getFieldNames().forEach((e=>{if(void 0!==t[e]&&0!!t&&0(0,n.inArray)(t.replace("{{","").replace("}}",""),e))).length;set=(t,e)=>{window[s.GLOBAL_OM].custom[t]=e}}}}]);