UNPKG

@zephr/browser

Version:
2 lines (1 loc) 34.4 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).zephrBrowser={})}(this,function(e){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){var t={exports:{}};return e(t,t.exports),t.exports}var r=function(e){return e&&e.Math===Math&&e},o=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(e){return!0}},c=!i(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),a=!i(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),s=Function.prototype,u=s.call,l=a&&s.bind.bind(u,u),f=a?l:function(e){return function(){return u.apply(e,arguments)}},p="object"==typeof document&&document.all,d=void 0===p&&void 0!==p?function(e){return"function"==typeof e||e===p}:function(e){return"function"==typeof e},m=function(e){return null==e},h=TypeError,y=function(e){if(m(e))throw new h("Can't call method on "+e);return e},g=Object,v=function(e){return g(y(e))},b=f({}.hasOwnProperty),w=Object.hasOwn||function(e,t){return b(v(e),t)},O=Function.prototype,S=c&&Object.getOwnPropertyDescriptor,I=w(O,"name"),C={EXISTS:I,PROPER:I&&"something"===function(){}.name,CONFIGURABLE:I&&(!c||c&&S(O,"name").configurable)},E=Object.defineProperty,T=function(e,t){try{E(o,e,{value:t,configurable:!0,writable:!0})}catch(n){o[e]=t}return t},x=n(function(e){var t="__core-js_shared__",n=e.exports=o[t]||T(t,{});(n.versions||(n.versions=[])).push({version:"3.36.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",source:"https://github.com/zloirock/core-js"})}),P=f(Function.toString);d(x.inspectSource)||(x.inspectSource=function(e){return P(e)});var j,A,L=x.inspectSource,D=o.WeakMap,R=d(D)&&/native code/.test(String(D)),_=function(e){return"object"==typeof e?null!==e:d(e)},F=o.document,k=_(F)&&_(F.createElement),N=function(e){return k?F.createElement(e):{}},z=!c&&!i(function(){return 7!==Object.defineProperty(N("div"),"a",{get:function(){return 7}}).a}),M=c&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),U=String,Z=TypeError,H=function(e){if(_(e))return e;throw new Z(U(e)+" is not an object")},W=Function.prototype.call,$=a?W.bind(W):function(){return W.apply(W,arguments)},G=function(e){return d(e)?e:void 0},B=function(e,t){return arguments.length<2?G(o[e]):o[e]&&o[e][t]},K=f({}.isPrototypeOf),V="undefined"!=typeof navigator&&String(navigator.userAgent)||"",q=o.process,Y=o.Deno,X=q&&q.versions||Y&&Y.version,J=X&&X.v8;J&&(A=(j=J.split("."))[0]>0&&j[0]<4?1:+(j[0]+j[1])),!A&&V&&(!(j=V.match(/Edge\/(\d+)/))||j[1]>=74)&&(j=V.match(/Chrome\/(\d+)/))&&(A=+j[1]);var Q,ee,te,ne=A,re=o.String,oe=!!Object.getOwnPropertySymbols&&!i(function(){var e=Symbol("symbol detection");return!re(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ne&&ne<41}),ie=oe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ce=Object,ae=ie?function(e){return"symbol"==typeof e}:function(e){var t=B("Symbol");return d(t)&&K(t.prototype,ce(e))},se=String,ue=TypeError,le=function(e){if(d(e))return e;throw new ue(function(e){try{return se(e)}catch(e){return"Object"}}(e)+" is not a function")},fe=function(e,t){var n=e[t];return m(n)?void 0:le(n)},pe=TypeError,de=function(e,t){return x[e]||(x[e]=t||{})},me=0,he=Math.random(),ye=f(1..toString),ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ye(++me+he,36)},ve=o.Symbol,be=de("wks"),we=ie?ve.for||ve:ve&&ve.withoutSetter||ge,Oe=function(e){return w(be,e)||(be[e]=oe&&w(ve,e)?ve[e]:we("Symbol."+e)),be[e]},Se=TypeError,Ie=Oe("toPrimitive"),Ce=function(e){var t=function(e,t){if(!_(e)||ae(e))return e;var n,r=fe(e,Ie);if(r){if(void 0===t&&(t="default"),n=$(r,e,t),!_(n)||ae(n))return n;throw new Se("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,r;if("string"===t&&d(n=e.toString)&&!_(r=$(n,e)))return r;if(d(n=e.valueOf)&&!_(r=$(n,e)))return r;if("string"!==t&&d(n=e.toString)&&!_(r=$(n,e)))return r;throw new pe("Can't convert object to primitive value")}(e,t)}(e,"string");return ae(t)?t:t+""},Ee=TypeError,Te=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Pe={f:c?M?function(e,t,n){if(H(e),t=Ce(t),H(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var r=xe(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return Te(e,t,n)}:Te:function(e,t,n){if(H(e),t=Ce(t),H(n),z)try{return Te(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new Ee("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},je=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ae=c?function(e,t,n){return Pe.f(e,t,je(1,n))}:function(e,t,n){return e[t]=n,e},Le=de("keys"),De=function(e){return Le[e]||(Le[e]=ge(e))},Re={},_e="Object already initialized",Fe=o.TypeError;if(R||x.state){var ke=x.state||(x.state=new(0,o.WeakMap));ke.get=ke.get,ke.has=ke.has,ke.set=ke.set,Q=function(e,t){if(ke.has(e))throw new Fe(_e);return t.facade=e,ke.set(e,t),t},ee=function(e){return ke.get(e)||{}},te=function(e){return ke.has(e)}}else{var Ne=De("state");Re[Ne]=!0,Q=function(e,t){if(w(e,Ne))throw new Fe(_e);return t.facade=e,Ae(e,Ne,t),t},ee=function(e){return w(e,Ne)?e[Ne]:{}},te=function(e){return w(e,Ne)}}var ze,Me,Ue,Ze={set:Q,get:ee,has:te,enforce:function(e){return te(e)?ee(e):Q(e,{})},getterFor:function(e){return function(t){var n;if(!_(t)||(n=ee(t)).type!==e)throw new Fe("Incompatible receiver, "+e+" required");return n}}},He=n(function(e){var t=C.CONFIGURABLE,n=Ze.enforce,r=Ze.get,o=String,a=Object.defineProperty,s=f("".slice),u=f("".replace),l=f([].join),p=c&&!i(function(){return 8!==a(function(){},"length",{value:8}).length}),m=String(String).split("String"),h=e.exports=function(e,r,i){"Symbol("===s(o(r),0,7)&&(r="["+u(o(r),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(r="get "+r),i&&i.setter&&(r="set "+r),(!w(e,"name")||t&&e.name!==r)&&(c?a(e,"name",{value:r,configurable:!0}):e.name=r),p&&i&&w(i,"arity")&&e.length!==i.arity&&a(e,"length",{value:i.arity});try{i&&w(i,"constructor")&&i.constructor?c&&a(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var f=n(e);return w(f,"source")||(f.source=l(m,"string"==typeof r?r:"")),e};Function.prototype.toString=h(function(){return d(this)&&r(this).source||L(this)},"toString")}),We=function(){var e=H(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},$e=o.RegExp,Ge=$e.prototype;c&&i(function(){var e=!0;try{$e(".","d")}catch(t){e=!1}var t={},n="",r=e?"dgimsy":"gimsy",o=function(e,r){Object.defineProperty(t,e,{get:function(){return n+=r,!0}})},i={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var c in e&&(i.hasIndices="d"),i)o(c,i[c]);return Object.getOwnPropertyDescriptor(Ge,"flags").get.call(t)!==r||n!==r})&&(ze=Ge,Me="flags",(Ue={configurable:!0,get:We}).get&&He(Ue.get,Me,{getter:!0}),Ue.set&&He(Ue.set,Me,{setter:!0}),Pe.f(ze,Me,Ue));var Be,Ke={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Ve=N("span").classList,qe=Ve&&Ve.constructor&&Ve.constructor.prototype,Ye=qe===Object.prototype?void 0:qe,Xe=f({}.toString),Je=f("".slice),Qe=function(e){return Je(Xe(e),8,-1)},et=Object,tt=f("".split),nt=i(function(){return!et("z").propertyIsEnumerable(0)})?function(e){return"String"===Qe(e)?tt(e,""):et(e)}:et,rt=function(e){return nt(y(e))},ot=Math.ceil,it=Math.floor,ct=Math.trunc||function(e){var t=+e;return(t>0?it:ot)(t)},at=function(e){var t=+e;return t!=t||0===t?0:ct(t)},st=Math.max,ut=Math.min,lt=Math.min,ft=function(e){var t=at(e);return t>0?lt(t,9007199254740991):0},pt=function(e){return function(t,n,r){var o=rt(t),i=ft(o.length);if(0===i)return!e&&-1;var c,a=function(e,t){var n=at(e);return n<0?st(n+t,0):ut(n,t)}(r,i);if(e&&n!=n){for(;i>a;)if((c=o[a++])!=c)return!0}else for(;i>a;a++)if((e||a in o)&&o[a]===n)return e||a||0;return!e&&-1}},dt=(pt(!0),pt(!1)),mt=f([].push),ht=function(e,t){var n,r=rt(e),o=0,i=[];for(n in r)!w(Re,n)&&w(r,n)&&mt(i,n);for(;t.length>o;)w(r,n=t[o++])&&(~dt(i,n)||mt(i,n));return i},yt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],gt=Object.keys||function(e){return ht(e,yt)},vt=c&&!M?Object.defineProperties:function(e,t){H(e);for(var n,r=rt(t),o=gt(t),i=o.length,c=0;i>c;)Pe.f(e,n=o[c++],r[n]);return e},bt={f:vt},wt=B("document","documentElement"),Ot=De("IE_PROTO"),St=function(){},It=function(e){return"<script>"+e+"<\/script>"},Ct=function(e){e.write(It("")),e.close();var t=e.parentWindow.Object;return e=null,t},Et=function(){try{Be=new ActiveXObject("htmlfile")}catch(e){}var e,t;Et="undefined"!=typeof document?document.domain&&Be?Ct(Be):((t=N("iframe")).style.display="none",wt.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(It("document.F=Object")),e.close(),e.F):Ct(Be);for(var n=yt.length;n--;)delete Et.prototype[yt[n]];return Et()};Re[Ot]=!0;var Tt=Object.create||function(e,t){var n;return null!==e?(St.prototype=H(e),n=new St,St.prototype=null,n[Ot]=e):n=Et(),void 0===t?n:bt.f(n,t)},xt=Pe.f,Pt=Oe("unscopables"),jt=Array.prototype;void 0===jt[Pt]&&xt(jt,Pt,{configurable:!0,value:Tt(null)});var At,Lt,Dt,Rt=function(e){jt[Pt][e]=!0},_t={},Ft={}.propertyIsEnumerable,kt=Object.getOwnPropertyDescriptor,Nt=kt&&!Ft.call({1:2},1)?function(e){var t=kt(this,e);return!!t&&t.enumerable}:Ft,zt={f:Nt},Mt=Object.getOwnPropertyDescriptor,Ut={f:c?Mt:function(e,t){if(e=rt(e),t=Ce(t),z)try{return Mt(e,t)}catch(e){}if(w(e,t))return je(!$(zt.f,e,t),e[t])}},Zt=function(e,t,n,r){r||(r={});var o=r.enumerable,i=void 0!==r.name?r.name:t;if(d(n)&&He(n,i,r),r.global)o?e[t]=n:T(t,n);else{try{r.unsafe?e[t]&&(o=!0):delete e[t]}catch(e){}o?e[t]=n:Pe.f(e,t,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return e},Ht=yt.concat("length","prototype"),Wt={f:Object.getOwnPropertyNames||function(e){return ht(e,Ht)}},$t={f:Object.getOwnPropertySymbols},Gt=f([].concat),Bt=B("Reflect","ownKeys")||function(e){var t=Wt.f(H(e)),n=$t.f;return n?Gt(t,n(e)):t},Kt=function(e,t,n){for(var r=Bt(t),o=Pe.f,i=Ut.f,c=0;c<r.length;c++){var a=r[c];w(e,a)||n&&w(n,a)||o(e,a,i(t,a))}},Vt=/#|\.prototype\./,qt=function(e,t){var n=Xt[Yt(e)];return n===Qt||n!==Jt&&(d(t)?i(t):!!t)},Yt=qt.normalize=function(e){return String(e).replace(Vt,".").toLowerCase()},Xt=qt.data={},Jt=qt.NATIVE="N",Qt=qt.POLYFILL="P",en=qt,tn=Ut.f,nn=function(e,t){var n,r,i,c,a,s=e.target,u=e.global,l=e.stat;if(n=u?o:l?o[s]||T(s,{}):o[s]&&o[s].prototype)for(r in t){if(c=t[r],i=e.dontCallGetSet?(a=tn(n,r))&&a.value:n[r],!en(u?r:s+(l?".":"#")+r,e.forced)&&void 0!==i){if(typeof c==typeof i)continue;Kt(c,i)}(e.sham||i&&i.sham)&&Ae(c,"sham",!0),Zt(n,r,c,e)}},rn=!i(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),on=De("IE_PROTO"),cn=Object,an=cn.prototype,sn=rn?cn.getPrototypeOf:function(e){var t=v(e);if(w(t,on))return t[on];var n=t.constructor;return d(n)&&t instanceof n?n.prototype:t instanceof cn?an:null},un=Oe("iterator"),ln=!1;[].keys&&("next"in(Dt=[].keys())?(Lt=sn(sn(Dt)))!==Object.prototype&&(At=Lt):ln=!0);var fn=!_(At)||i(function(){var e={};return At[un].call(e)!==e});fn&&(At={}),d(At[un])||Zt(At,un,function(){return this});var pn={IteratorPrototype:At,BUGGY_SAFARI_ITERATORS:ln},dn=Pe.f,mn=Oe("toStringTag"),hn=function(e,t,n){e&&!n&&(e=e.prototype),e&&!w(e,mn)&&dn(e,mn,{configurable:!0,value:t})},yn=pn.IteratorPrototype,gn=function(){return this},vn=String,bn=TypeError,wn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=function(e,t,n){try{return f(le(Object.getOwnPropertyDescriptor(e,"__proto__").set))}catch(e){}}(Object.prototype))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return y(n),function(e){if(function(e){return _(e)||null===e}(e))return e;throw new bn("Can't set "+vn(e)+" as a prototype")}(r),_(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0),On=C.PROPER,Sn=C.CONFIGURABLE,In=pn.IteratorPrototype,Cn=pn.BUGGY_SAFARI_ITERATORS,En=Oe("iterator"),Tn="keys",xn="values",Pn="entries",jn=function(){return this},An=function(e,t){return{value:e,done:t}},Ln=Pe.f,Dn="Array Iterator",Rn=Ze.set,_n=Ze.getterFor(Dn),Fn=function(e,t,n,r,o,i,c){!function(e,t,n,r){var o="Array Iterator";e.prototype=Tt(yn,{next:je(1,function(){var e=_n(this),t=e.target,n=e.index++;if(!t||n>=t.length)return e.target=void 0,An(void 0,!0);switch(e.kind){case"keys":return An(n,!1);case"values":return An(t[n],!1)}return An([n,t[n]],!1)})}),hn(e,o,!1),_t[o]=gn}(n);var a,s,u,l=function(e){if(e===o&&h)return h;if(!Cn&&e&&e in p)return p[e];switch(e){case Tn:case xn:case Pn:return function(){return new n(this,e)}}return function(){return new n(this)}},f=!1,p=e.prototype,m=p[En]||p["@@iterator"]||p.values,h=!Cn&&m||l(o),y=p.entries||m;if(y&&(a=sn(y.call(new e)))!==Object.prototype&&a.next&&(sn(a)!==In&&(wn?wn(a,In):d(a[En])||Zt(a,En,jn)),hn(a,"Array Iterator",!0)),On&&m&&m.name!==xn&&(Sn?Ae(p,"name",xn):(f=!0,h=function(){return $(m,this)})),void(s={values:l(xn),keys:l(Tn),entries:l(Pn)}))for(u in s)(Cn||f||!(u in p))&&Zt(p,u,s[u]);else nn({target:"Array",proto:!0,forced:Cn||f},s);return p[En]!==h&&Zt(p,En,h,{name:o}),_t.Array=h,s}(Array,0,function(e,t){Rn(this,{type:Dn,target:rt(e),index:0,kind:t})},0,"values"),kn=_t.Arguments=_t.Array;if(Rt("keys"),Rt("values"),Rt("entries"),c&&"values"!==kn.name)try{Ln(kn,"name",{value:"values"})}catch(e){}var Nn=Oe("iterator"),zn=Fn.values,Mn=function(e,t){if(e){if(e[Nn]!==zn)try{Ae(e,Nn,zn)}catch(t){e[Nn]=zn}if(hn(e,t,!0),Ke[t])for(var n in Fn)if(e[n]!==Fn[n])try{Ae(e,n,Fn[n])}catch(t){e[n]=Fn[n]}}};for(var Un in Ke)Mn(o[Un]&&o[Un].prototype,Un);Mn(Ye,"DOMTokenList"),Rt("flat");const Zn={transform:{concat:e=>e.map(e=>Wn(e)),zoned:e=>({type:"Zone",id:e.zoneId,contents:e.transformations.map(e=>Wn(e))}),form:e=>({type:"Form",formId:e}),paymentForm:e=>({type:"PaymentForm",formId:e}),resource:e=>({type:"UIComponent",componentId:e}),parameterisedResource:e=>({type:"UIComponent",componentId:e}),url:e=>({type:"HostedUIComponent",url:e}),componentTemplate:e=>({type:"ComponentTemplate",componentId:e}),parameterisedComponentTemplate:e=>({type:"ComponentTemplate",componentId:e}),truncate:e=>({type:"Truncate",truncateLength:Number(e),style:"nostyle"}),truncateWithStyle:(e,t)=>({type:"Truncate",truncateLength:Number(e),style:t}),outcomeTracker:(e,t,n,r)=>({type:"OutcomeTracker",featureId:e,featureLabel:t,outcomeId:n,outcomeLabel:r}),remove:()=>({type:"Remove"})}},Hn={type:"LeavePristine"},Wn=e=>{const t=e.trim().length?e:"blaize.transform.remove()";return new Function("blaize,leave_pristine",'"use strict";return ('+t+");")(Zn,Hn)};function $n(e,t){let n;switch(t){case"fadeout":const t=document.createElement("div");t.style.position="absolute",t.style.height="100%",t.style.width="100%",t.style.bottom="0",t.style.backgroundImage="linear-gradient(0deg, #fff 0%, rgba(255, 255, 255, 0) 100%)",e.appendChild(t),n=document.createElement("div"),n.style.position="relative",n.appendChild(e);break;case"linebreak":const r=document.createElement("hr");r.style.border="1px solid #ebebeb",e.appendChild(r),n=e;break;default:n=e}return n}var Gn=Function.prototype,Bn=Gn.apply,Kn=Gn.call,Vn="object"==typeof Reflect&&Reflect.apply||(a?Kn.bind(Bn):function(){return Kn.apply(Bn,arguments)}),qn={};qn[Oe("toStringTag")]="z";var Yn,Xn,Jn="[object z]"===String(qn),Qn=Oe("toStringTag"),er=Object,tr="Arguments"===Qe(function(){return arguments}()),nr=Jn?Qe:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=er(e),Qn))?n:tr?Qe(t):"Object"===(r=Qe(t))&&d(t.callee)?"Arguments":r},rr=String,or=function(e){if("Symbol"===nr(e))throw new TypeError("Cannot convert a Symbol value to a string");return rr(e)},ir=o.RegExp,cr=i(function(){var e=ir("a","y");return e.lastIndex=2,null!==e.exec("abcd")}),ar=cr||i(function(){return!ir("a","y").sticky}),sr={BROKEN_CARET:cr||i(function(){var e=ir("^r","gy");return e.lastIndex=2,null!==e.exec("str")}),MISSED_STICKY:ar,UNSUPPORTED_Y:cr},ur=o.RegExp,lr=i(function(){var e=ur(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}),fr=o.RegExp,pr=i(function(){var e=fr("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}),dr=Ze.get,mr=de("native-string-replace",String.prototype.replace),hr=RegExp.prototype.exec,yr=hr,gr=f("".charAt),vr=f("".indexOf),br=f("".replace),wr=f("".slice),Or=(Xn=/b*/g,$(hr,Yn=/a/,"a"),$(hr,Xn,"a"),0!==Yn.lastIndex||0!==Xn.lastIndex),Sr=sr.BROKEN_CARET,Ir=void 0!==/()??/.exec("")[1];(Or||Ir||Sr||lr||pr)&&(yr=function(e){var t,n,r,o,i,c,a,s=this,u=dr(s),l=or(e),f=u.raw;if(f)return f.lastIndex=s.lastIndex,t=$(yr,f,l),s.lastIndex=f.lastIndex,t;var p=u.groups,d=Sr&&s.sticky,m=$(We,s),h=s.source,y=0,g=l;if(d&&(m=br(m,"y",""),-1===vr(m,"g")&&(m+="g"),g=wr(l,s.lastIndex),s.lastIndex>0&&(!s.multiline||s.multiline&&"\n"!==gr(l,s.lastIndex-1))&&(h="(?: "+h+")",g=" "+g,y++),n=new RegExp("^(?:"+h+")",m)),Ir&&(n=new RegExp("^"+h+"$(?!\\s)",m)),Or&&(r=s.lastIndex),o=$(hr,d?n:s,g),d?o?(o.input=wr(o.input,y),o[0]=wr(o[0],y),o.index=s.lastIndex,s.lastIndex+=o[0].length):s.lastIndex=0:Or&&o&&(s.lastIndex=s.global?o.index+o[0].length:r),Ir&&o&&o.length>1&&$(mr,o[0],n,function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(o[i]=void 0)}),o&&p)for(o.groups=c=Tt(null),i=0;i<p.length;i++)c[(a=p[i])[0]]=o[a[1]];return o});var Cr=yr;nn({target:"RegExp",proto:!0,forced:/./.exec!==Cr},{exec:Cr}),Oe("species");var Er=RegExp.prototype,Tr=f("".charAt),xr=f("".charCodeAt),Pr=f("".slice),jr=function(e){return function(t,n){var r,o,i=or(y(t)),c=at(n),a=i.length;return c<0||c>=a?e?"":void 0:(r=xr(i,c))<55296||r>56319||c+1===a||(o=xr(i,c+1))<56320||o>57343?e?Tr(i,c):r:e?Pr(i,c,c+2):o-56320+(r-55296<<10)+65536}},Ar=(jr(!1),jr(!0)),Lr=function(e,t,n){return t+(n?Ar(e,t).length:1)},Dr=Math.floor,Rr=f("".charAt),_r=f("".replace),Fr=f("".slice),kr=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Nr=/\$([$&'`]|\d{1,2})/g,zr=function(e,t,n,r,o,i){var c=n+e.length,a=r.length,s=Nr;return void 0!==o&&(o=v(o),s=kr),_r(i,s,function(i,s){var u;switch(Rr(s,0)){case"$":return"$";case"&":return e;case"`":return Fr(t,0,n);case"'":return Fr(t,c);case"<":u=o[Fr(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>a){var f=Dr(l/10);return 0===f?i:f<=a?void 0===r[f-1]?Rr(s,1):r[f-1]+Rr(s,1):i}u=r[l-1]}return void 0===u?"":u})},Mr=TypeError,Ur=function(e,t){var n=e.exec;if(d(n)){var r=$(n,e,t);return null!==r&&H(r),r}if("RegExp"===Qe(e))return $(Cr,e,t);throw new Mr("RegExp#exec called on incompatible receiver")},Zr=Oe("replace"),Hr=Math.max,Wr=Math.min,$r=f([].concat),Gr=f([].push),Br=f("".indexOf),Kr=f("".slice),Vr="$0"==="a".replace(/./,"$0"),qr=!!/./[Zr]&&""===/./[Zr]("a","$0");!function(e,t,n,r){var o=Oe(e),c=!i(function(){var t={};return t[o]=function(){return 7},7!==""[e](t)}),a=c&&!i(function(){var e=!1,t=/a/;return t.exec=function(){return e=!0,null},t[o](""),!e});if(!c||!a||n){var s=/./[o],u=function(e,t,n){var r=qr?"$":"$0";return[function(e,n){var r=y(this),o=m(e)?void 0:fe(e,Zr);return o?$(o,e,r,n):$(t,or(r),e,n)},function(e,n){var o,i,a,u,l,f=H(this),p=or(e);if("string"==typeof n&&-1===Br(n,r)&&-1===Br(n,"$<")){var m=(o=t,a=p,u=n,(l=(i=f).exec)===Cr||l===Er.exec?c?{done:!0,value:$(s,i,a,u)}:{done:!0,value:$(o,a,i,u)}:{done:!1});if(m.done)return m.value}var h=d(n);h||(n=or(n));var y,g=f.global;g&&(y=f.unicode,f.lastIndex=0);for(var v,b=[];null!==(v=Ur(f,p))&&(Gr(b,v),g);)""===or(v[0])&&(f.lastIndex=Lr(p,ft(f.lastIndex),y));for(var w,O="",S=0,I=0;I<b.length;I++){for(var C,E=or((v=b[I])[0]),T=Hr(Wr(at(v.index),p.length),0),x=[],P=1;P<v.length;P++)Gr(x,void 0===(w=v[P])?w:String(w));var j=v.groups;if(h){var A=$r([E],x,T,p);void 0!==j&&Gr(A,j),C=or(Vn(n,void 0,A))}else C=zr(E,p,T,x,j,n);T>=S&&(O+=Kr(p,S,T)+C,S=T+E.length)}return O+Kr(p,S)}]}(0,""[e]);Zt(String.prototype,e,u[0]),Zt(Er,o,u[1])}}("replace",0,!!i(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})||!Vr||qr);const Yr=/<[^>]*>|[^<>]+/g,Xr=/^[\p{Alpha}|\p{N}]$/u;class Jr{constructor(e,t,n){this.text=e,this.type=t,this.isSentenceEnd=n}}const Qr=Object.freeze({WORD:0,PUNCTUATION:1,WHITESPACE:2});function eo(e){return-1!==e.search(">[^<>]+<")}const to=Object.freeze(["script","style","noscript","template","iframe","svg","canvas"]);function no(e){return to.some(t=>{const n=e.indexOf("<"+t)>=0,r=e.indexOf("</"+t)>=0;return n?!r:r})}const ro=Object.freeze({LOCALE_AWARE_TRUNCATION:!1}),oo=()=>Intl&&"Segmenter"in Intl,io=e=>{let t;return"function"==typeof Event?t=new Event(e):(t=document.createEvent("Event"),t.initEvent(e,!0,!0)),t},co=function(e){e&&console.log(...[].slice.call(arguments,1))},ao=e=>{const t=(new DOMParser).parseFromString(e,"text/html"),n=[...Array.from(t.head.childNodes),...Array.from(t.body.childNodes)];if(!n.length)return document.createTextNode(e);const r=document.createDocumentFragment();return n.forEach(e=>r.appendChild(e)),so(r),r},so=e=>{const t=e.querySelectorAll("script");t.length&&Array.from(t).map(e=>{const t=document.createElement("script");Array.from(e.attributes).forEach(e=>{t.setAttribute(e.name,e.value)}),t.innerHTML=e.innerHTML,e.parentNode.appendChild(t),e.parentNode.removeChild(e)})},uo=(e,t,n,r)=>{switch(t.type){case"LeavePristine":return e;case"Truncate":return r.LOCALE_AWARE_TRUNCATION&&oo()?function(e,t){var n;const r=(null==(n=document.documentElement)?void 0:n.lang)||"en",o=2*t.truncateLength,i=function(e,t){var n;void 0===t&&(t="en");const r=(null!=(n=null==e?void 0:e.outerHTML)?n:e.nodeValue).trim(),o=new Intl.Segmenter(t,{granularity:"sentence"}),i=new Intl.Segmenter(t,{granularity:"word"}),c=[],a=r.match(Yr).map(e=>e.startsWith("<")?"".padStart(e.length):e).join("").replace(/\n/g,""),s=Array.from(o.segment(a));let u=0,l=0;for(const e of s){let t=e.segment.trimStart();const n=e.segment.length-t.length;t=t.trimEnd();const o=e.segment.length-(n+t.length);if(n>0){const e=r.substring(u,u+n);c.push(new Jr(e,e.trim().length>0?Qr.WORD:Qr.WHITESPACE,!1))}u=l+n,l=u+t.length;const a=r.substring(u,l),s=Array.from(i.segment(t));let p=0,d=0;for(const[e,n]of s.entries()){p=d,d=p+n.segment.length;const r=a.substring(p,d);c.push(new Jr(r,0===(f=r).trim().length?Qr.WHITESPACE:1!==f.length||Xr.test(f)?Qr.WORD:Qr.PUNCTUATION,t.length>1&&e===s.length-1))}if(o>0){const e=r.substring(l,l+o);c.push(new Jr(e,e.trim().length>0?Qr.WORD:Qr.WHITESPACE,!1)),l+=o}}var f;return c}(e,r);if(t.truncateLength>=i.length)return e;let c=0,a=!1,s=!1,u=0,l=0;for(const e of i){if(l++,e.type===Qr.WHITESPACE&&!e.isSentenceEnd)continue;const n=e.text.trim();if(s&&n.indexOf("</")>=0&&no(n)?s=!1:n.indexOf("<")>=0&&no(n)&&(s=!0),s)continue;const r=a,i=n.lastIndexOf("<"),f=n.lastIndexOf(">");if(i>=0&&(a=!0),f>=0&&(a=!1),-1!==i&&-1!==f&&i>f&&(a=!0),r&&f===n.length-1||0===i&&f===n.length-1)a=!1;else if(!a){if(c>0&&e.type===Qr.WORD)break;(e.type===Qr.WORD||e.isSentenceEnd)&&(e.type===Qr.WORD&&u++,(u===o||u>=t.truncateLength&&e.isSentenceEnd)&&(c=l))}}if(l===i.length)return e;l=c>0?c:l;let f=i.slice(0,l).map(e=>e.text).join("");return u===o&&(f+="..."),$n((new DOMParser).parseFromString(f,"text/html").body.children[0],t.style)}(e,t):function(e,t){const n=2*t.truncateLength,r=e.outerHTML.trim().split(/\s+/);if(t.truncateLength>=r.length)return e;let o=0,i=!1,c=0,a=0;for(const e of r){a++;const r=i,s=e.lastIndexOf("<"),u=e.lastIndexOf(">");if(s>=0&&(i=!0),u>=0&&(i=!1),-1!==s&&-1!==u&&s>u&&(i=!0),r&&u===e.length-1&&!eo(e)||0===s&&u===e.length-1)i=!1;else if(!i){if(o>0)break;c++,(c>=t.truncateLength&&e.includes(".")||c===n)&&(o=a)}}if(a===r.length)return e;a=o>0?o:a;let s=r.slice(0,a).join(" ");return c===n&&(s+="...\n"),$n((new DOMParser).parseFromString(s,"text/html").body.children[0],t.style)}(e,t);case"OutcomeTracker":(e=>{window.Zephr||(window.Zephr={}),window.Zephr.outcomes||(window.Zephr.outcomes={}),window.Zephr.outcomes[e.featureId]={featureLabel:e.featureLabel,outcomeId:e.outcomeId,outcomeLabel:e.outcomeLabel}})(t);break;case"Form":return((e,t)=>{if(t.forms&&t.forms[e.formId])return ao(t.forms[e.formId]);console.error("Form not found.")})(t,n);case"PaymentForm":return((e,t)=>{if(t.paymentForms&&t.paymentForms[e.formId])return ao(t.paymentForms[e.formId]);console.error("Payment form not found.")})(t,n);case"UIComponent":return((e,t)=>{if(t.uiComponents&&t.uiComponents[e.componentId])return ao(t.uiComponents[e.componentId]);console.error("UI component not found.")})(t,n);case"HostedUIComponent":return((e,t)=>{if(t.hostedUiComponents&&t.hostedUiComponents[e.url])return ao(t.hostedUiComponents[e.url]);console.error("Hosted UI component not found.")})(t,n);case"ComponentTemplate":return((e,t)=>{if(t.componentTemplates&&t.componentTemplates[e.componentId])return ao(t.componentTemplates[e.componentId]);console.error("Component template not found.")})(t,n);case"Remove":break;case"Zone":const o=t.contents.map(t=>uo(e,t,n,r));return((e,t,n)=>{if(!n.uiComponents||!n.uiComponents[e])return void console.error("Zone not found.");const r=ao(n.uiComponents[e]),o=r.getElementById("zephr-zone-"+e.toLowerCase());return t.forEach(e=>o.appendChild(e)),r})(t.id,o,n);default:console.error("No matching outcome type "+t.type)}};function lo(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}const fo="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function po(e,t,n){if(!e.s){if(n instanceof mo){if(!n.s)return void(n.o=po.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(po.bind(null,e,t),po.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}const mo=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{po(r,1,e(this.v))}catch(e){po(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?po(r,1,t?t(o):o):n?po(r,1,n(o)):po(r,2,o)}catch(e){po(r,2,e)}},r},e}();function ho(e){return e instanceof mo&&1&e.s}class yo{constructor(e,t){this.cdnApi=e||"",this.fetcher=t||null}fetchLiveFeatures(){try{const e=this;return Promise.resolve(lo(function(){return Promise.resolve(e._fetcher(e.cdnApi+"/zephr/features",{method:"GET",headers:{Accept:"application/json"}}).then(e=>e.json()))},function(){return Promise.reject(new Error("Live features endpoint failed."))}))}catch(e){return Promise.reject(e)}}fetchDecisions(e,t){let{jwt:n,customData:r={}}=void 0===t?{customData:{}}:t;try{const t=this,o=e.map(e=>e.id);return Promise.resolve(lo(function(){return Promise.resolve(t._fetcher(t.cdnApi+"/zephr/feature-decisions",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...n&&{Authorization:"Bearer "+n}},body:JSON.stringify({path:document.location.pathname+document.location.search+document.location.hash,referer:document.referrer,featureIds:o,customData:r})}).then(e=>e.json()))},function(){return Promise.reject(new Error("Feature decisions endpoint failed."))}))}catch(e){return Promise.reject(e)}}executeDecisions(e,t,n,r){try{const o=this;function i(){t.accessDetails&&(window.Zephr||(window.Zephr={}),window.Zephr.accessDetails?window.Zephr.accessDetails=o._mergeAccessDetails(window.Zephr.accessDetails,t.accessDetails):window.Zephr.accessDetails=t.accessDetails),n&&(e=>{const t=e.datalayerName;t in window||(window[t]=[]);const n={},r=[];e.includeOutcomes&&window.Zephr.outcomes&&(n.zephrOutcomes=window.Zephr.outcomes,e.outcomesAsEvents&&Object.keys(window.Zephr.outcomes||[]).forEach(function(e){const t={event:"zephr-outcome-"+e,featureId:e,featureLabel:window.Zephr.outcomes[e].featureLabel,outcomeId:window.Zephr.outcomes[e].outcomeId,outcomeLabel:window.Zephr.outcomes[e].outcomeLabel};r.push(t)})),window.Zephr&&window.Zephr.accessDetails&&(Object.keys(window.Zephr.accessDetails.trials||{}).forEach(function(t){const r=window.Zephr.accessDetails.trials[t];if(r.reportInDataLayer){const t=r.totalCredits-r.remainingCredits;e.groupFields&&!n.zephrTrials&&(n.zephrTrials={});const o=e.groupFields?n.zephrTrials:n;r.dataLayerCreditsUsedKey&&(o[r.dataLayerCreditsUsedKey]=t),r.dataLayerCreditsRemainingKey&&(o[r.dataLayerCreditsRemainingKey]=r.remainingCredits)}}),(window.Zephr.accessDetails.trialTrackingDetails||[]).forEach(function(t){const r=(window.Zephr.accessDetails["credits"===t.entitlementType?"credits":"meters"]||{})[t.entitlementId];r&&(e.groupFields&&!n.zephrTrials&&(n.zephrTrials={}),t.creditsRemainingKey&&(e.groupFields?n.zephrTrials[t.creditsRemainingKey]=r.remainingCredits:n[t.creditsRemainingKey]=r.remainingCredits),t.creditsUsedKey&&(e.groupFields?n.zephrTrials[t.creditsUsedKey]=r.totalCredits-r.remainingCredits:n[t.creditsUsedKey]=r.totalCredits-r.remainingCredits))})),Object.keys(n).length&&(n.event="zephr-pageview",r.unshift(n)),r.length&&(r.forEach(function(e){window[t].push(e)}),document.dispatchEvent(io("zephr.dataLayerReady")))})(n)}const c=function(e,t,n){if("function"==typeof e[fo]){var r,o,i,c=e[fo]();if(function e(n){try{for(;!(r=c.next()).done;)if((n=t(r.value))&&n.then){if(!ho(n))return void n.then(e,i||(i=po.bind(null,o=new mo,2)));n=n.v}o?po(o,1,n):o=n}catch(e){po(o||(o=new mo),2,e)}}(),c.return){var a=function(e){try{r.done||c.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var s=[],u=0;u<e.length;u++)s.push(e[u]);return function(e,t,n){var r,o,i=-1;return function n(c){try{for(;++i<e.length;)if((c=t(i))&&c.then){if(!ho(c))return void c.then(n,o||(o=po.bind(null,r=new mo,2)));c=c.v}r?po(r,1,c):r=c}catch(e){po(r||(r=new mo),2,e)}}(),r}(s,function(e){return t(s[e])})}(e,function(e){function n(){!function(e,t,n,r){void 0===n&&(n={}),void 0===r&&(r=ro),e.forEach(e=>{const o=e.parentNode,i=Array.from(o.children).indexOf(e),c=o.removeChild(e),a=t.map(e=>uo(c,e,n,r)).filter(Boolean),s=document.createDocumentFragment();a.forEach(e=>s.appendChild(e)),i<o.children.length?o.insertBefore(s,o.children[i]):o.appendChild(s)})}(a,c,t.resources||{},o._mergeDefaultFlags(t.flags))}const i=(t.featureResults||{})[e.id];if(!i)return;const c=(e=>[Wn(e)].flat())(i),a=o.selectFeatureNodes(e),s=c.some(e=>"Truncate"===e.type),u=function(){if(r.automaticPolyfills&&s&&!oo())return Promise.resolve(function(e){try{const t=function(t,n){try{var r=Promise.resolve(fetch(e).then(e=>e.text()).then(e=>new Function(e)())).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(t){console.error("Error fetching and executing script from "+e+":",t)});return Promise.resolve(t&&t.then?t.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}("https://assets.zephr.com/zephr-browser/1.9.1/polyfill-intl-segmenter.umd.js")).then(function(){})}();return u&&u.then?u.then(n):n()});return Promise.resolve(c&&c.then?c.then(i):i())}catch(a){return Promise.reject(a)}}_fetcher(e,t){return this.fetcher?this.fetcher(e,t):window.fetch(e,t)}_mergeAccessDetails(e,t){var n,r;return{...e,...t,authenticated:t.authenticated,accessDecisions:{...e.accessDecisions,...t.accessDecisions},entitlements:this._mergeCreditData(e.entitlements,t.entitlements),credits:this._mergeCreditData(e.credits,t.credits),meters:this._mergeCreditData(e.meters,t.meters),trials:this._mergeCreditData(null!=(n=e.trials)?n:{},null!=(r=t.trials)?r:{})}}_mergeCreditData(e,t){var n={...e,...t};for(const[r,o]of Object.entries(e)){const e=t[r];if(e){const t=n[r];this._eitherHasProperty(o,e,"decrementedInDecision")&&(t.decrementedInDecision=!(!o.decrementedInDecision&&!e.decrementedInDecision)),this._eitherHasProperty(o,e,"usedInDecision")&&(t.usedInDecision=!(!o.usedInDecision&&!e.usedInDecision)),this._eitherHasProperty(o,e,"remainingCredits")&&(t.remainingCredits=this._minOrNumber(o.remainingCredits,e.remainingCredits)),this._eitherHasProperty(o,e,"totalCredits")&&(t.totalCredits=this._minOrNumber(o.totalCredits,e.totalCredits))}}return n}_eitherHasProperty(e,t,n){return e&&e.hasOwnProperty(n)||t&&t.hasOwnProperty(n)}_minOrNumber(e,t){const n="number"==typeof e,r="number"==typeof t;return n&&r?Math.min(e,t):n?e:r?t:void 0}_mergeDefaultFlags(e){return void 0===e&&(e={}),{...ro,...e}}findFeatures(e){return Array.isArray(e)&&e.length?e.filter(e=>"COMMENT_TAG"!==e.targetType&&null!==document.querySelector(e.cssSelector)):[]}selectFeatureNodes(e){return document.querySelectorAll(e.cssSelector)}}const go=(e,t)=>new yo(e,t);e.createInstance=go,e.run=function(e){try{const t=e&&e.debug||localStorage&&localStorage.getItem("zephrBrowserDebug");let n="",r={automaticPolyfills:!0};"string"==typeof e?n=e:"object"==typeof e&&(r={...r,...e},n=e.cdnApi||"");const o=go(n,null==e?void 0:e.fetcher);return Promise.resolve(o.fetchLiveFeatures()).then(function(e){function n(){return document.dispatchEvent(io("zephr.browserDecisionsFinished")),o}let i,c;Array.isArray(e)?i=e:(i=e.features,c=e.datalayerOutcomesConfig),co(t,"Live Features:",i);const a=o.findFeatures(i),s=function(){if(a.length)return co(t,"Features on page:",a),Promise.resolve(o.fetchDecisions(a,r)).then(function(e){co(t,"Decisions:",e);const n=performance.now();return Promise.resolve(o.executeDecisions(a,e,c,r)).then(function(){co(t,"Decision execution finished: took "+(performance.now()-n)+" ms")})});co(t,"No features found on page.")}();return s&&s.then?s.then(n):n()})}catch(e){return Promise.reject(e)}}});