@froomle/frontend-sdk 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-R3QWQW4H.js +5 -0
- package/dist/froomle.global.js +3 -3
- package/dist/index.d.ts +16 -6
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZB7K2NNI.js +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var l=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let s=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(s=r(),r=null),s},set:function(n){r!=null&&(s=r(),r=null),s=n}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new Ae(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let s=e();s[u.init]&&s[u.init](),Object.setPrototypeOf(r.prototype,s.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};l.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;l.globals={};l.new=Symbol();l.init=Symbol();l.fid=0;var Ae=l.global("$hxClasses")["genes._Register.ArrayIterator"]=class ze extends l.inherits(){[l.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return ze}};Ae.prototype.array=null;Ae.prototype.current=null;var Jt=l.$global,Ce=l.global("$hxClasses")["haxe.ValueException"]=class We extends l.inherits(()=>S,!0){[l.new](e,t,r){super[l.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return S}get __class__(){return We}};Ce.prototype.value=null;var Qt=l.$global,S=l.global("$hxClasses")["haxe.Exception"]=class ye extends l.inherits(()=>Error,!0){[l.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ye?e:e instanceof Error?new ye(e.message,null,e):new Ce(e,null,e)}static thrown(e){return e instanceof ye?e.get_native():e instanceof Error?e:new Ce(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ye}};S.prototype.native=null;S.prototype.__skipStack=null;S.prototype.__nativeException=null;S.prototype.__previousException=null;var er=l.$global,I=l.global("$hxClasses").Std=class Ke{static string(e){return be.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static random(e){return e<=0?0:Math.floor(Math.random()*e)}static get __name__(){return"Std"}get __class__(){return Ke}};Object.defineProperty(String.prototype,"__class__",{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,It={},Et={},Ct=Number,kt=Boolean,qt={},St={};var It,Et,Ct,kt,qt,St;var ir=l.$global,be=l.global("$hxClasses")["js.Boot"]=class G{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let r=G.__nativeClassName(e);return r!=null?G.__resolveNativeClass(r):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let g=l.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],f=g._hx_name;return g.__params__?(t=t+" ",f+"("+(function(_){var c;let y=[];{let b=0,p=g.__params__;for(;b<p.length;){let q=p[b];b=b+1,y.push(G.__string_rec(e[q],t))}}return c=y,c})(this).join(",")+")"):f}if(e instanceof Array){let m="[";t+=" ";let g=0,f=e.length;for(;g<f;){let _=g++;m+=(_>0?",":"")+G.__string_rec(e[_],t)}return m+="]",m}let s;try{s=e.toString}catch{return"???"}if(s!=null&&s!=Object.toString&&typeof s=="function"){let m=e.toString();if(m!="[object Object]")return m}let n=`{
|
|
2
|
+
`;t+=" ";let i=e.hasOwnProperty!=null,a=null;for(a in e)i&&!e.hasOwnProperty(a)||a=="prototype"||a=="__class__"||a=="__super__"||a=="__interfaces__"||a=="__properties__"||(n.length!=2&&(n+=`,
|
|
3
|
+
`),n+=t+a+" : "+G.__string_rec(e[a],t));return t=t.substring(1),n+=`
|
|
4
|
+
`+t+"}",n;break;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let s=0,n=r.length;for(;s<n;){let i=s++,a=r[i];if(a==t||G.__interfLoop(a,t))return!0}}return G.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case"$hxCoreType__Bool":return typeof e=="boolean";case"$hxCoreType__Dynamic":return e!=null;case"$hxCoreType__Float":return typeof e=="number";case"$hxCoreType__Int":return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(G.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&G.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t=="$hxCoreType__Class"&&e.__name__!=null||t=="$hxCoreType__Enum"&&e.__ename__!=null?!0:e.__enum__!=null?l.global("$hxEnums")[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?G.__interfLoop(G.getClass(e),t):!1}static __cast(e,t){if(e==null||G.__instanceof(e,t))return e;throw S.thrown("Cannot cast "+I.string(e)+" to "+I.string(t))}static __nativeClassName(e){let t=G.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return G.__nativeClassName(e)!=null}static __resolveNativeClass(e){return l.$global[e]}static get __name__(){return"js.Boot"}get __class__(){return G}};be.__toStr={}.toString;var ur=l.$global,$e=l.global("$hxClasses")["js.Browser"]=class Qe{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw S.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return Qe}};var gr=l.$global,Y=l.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};Y.__constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds,Y.Custom];Y.__empty_constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds];var dr=l.$global,te=l.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};te.__constructs__=[te.UTF8,te.RawNative];te.__empty_constructs__=[te.UTF8,te.RawNative];var wr=l.$global,me=l.global("$hxClasses")["haxe.io.Bytes"]=class Fe extends l.inherits(){[l.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw S.thrown(Y.OutsideBounds);r==null&&(r=te.UTF8);let s="",n=this.b,i=e,a=e+t;switch(r._hx_index){case 0:let m=e>0;for(;i<a;){let g=n[i++];if(g<128){if(g==0)break;s+=String.fromCodePoint(g)}else if(g<224){let f=(g&63)<<6|n[i++]&127;s+=String.fromCodePoint(f)}else if(g<240){let f=n[i++],_=(g&31)<<12|(f&127)<<6|n[i++]&127;s+=String.fromCodePoint(_)}else{let f=n[i++],_=n[i++],c=(g&15)<<18|(f&127)<<12|(_&127)<<6|n[i++]&127;s+=String.fromCodePoint(c)}}break;case 1:for(;i<a;){let g=n[i++]|n[i++]<<8;s+=String.fromCodePoint(g)}break}return s}static ofData(e){let t=e.hxBytes;return t!=null?t:new Fe(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Fe}};me.prototype.length=null;me.prototype.b=null;var Er=l.$global,Z=l.global("$hxClasses")["haxe.http.HttpBase"]=class Xe extends l.inherits(){[l.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=l.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,s=this.headers.length;for(;r<s;){let n=r++;if(this.headers[n].name==e){this.headers[n]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return l.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,te.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return Xe}};Z.prototype.url=null;Z.prototype.responseBytes=null;Z.prototype.responseAsString=null;Z.prototype.postData=null;Z.prototype.postBytes=null;Z.prototype.headers=null;Z.prototype.params=null;Z.prototype.emptyOnData=null;var qr=l.$global,ke=l.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Ye extends l.inherits(){[l.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Ye}};ke.prototype.map=null;ke.prototype.keys=null;var Pr=l.$global,Oe=function(){};Oe.__isInterface__=!0;var Fr=l.$global,qe=l.global("$hxClasses")["genes.util.EsMap"]=class ve extends l.inherits(){[l.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return ve.adaptIterator(this.inst.keys())}iterator(){return ve.adaptIterator(this.inst.values())}toString(){let e=[],t=ve.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+I.string(r)+" => "+I.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,s=function(){let n=e.next();t=n.value,r=n.done};return{hasNext:function(){return r==null&&s(),!r},next:function(){r==null&&s();let n=t;return s(),n}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return ve}};qe.prototype.inst=null;var Vr=l.$global,Ze=l.global("$hxClasses")["haxe.ds.StringMap"]=class Be extends l.inherits(qe){[l.new](){super[l.new]()}copy(){let e=new Be;return e.inst=new Map(this.inst),e}keyValueIterator(){return new ke(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Oe]}static get __super__(){return qe}get __class__(){return Be}};var Mr=l.$global,N=l.global("$hxClasses").HxOverrides=class et{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return et}};typeof performance!="undefined"&&typeof performance.now=="function"&&(N.now=performance.now.bind(performance));var Wr=l.$global,ae=l.global("$hxClasses").StringTools=class Se{static isSpace(e,t){let r=N.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&Se.isSpace(e,r);)++r;return r>0?N.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&Se.isSpace(e,t-r-1);)++r;return r>0?N.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return Se}};var Xr=l.$global,tt=l.global("$hxClasses").Lambda=class rt{static exists(e,t){let r=l.getIterator(e);for(;r.hasNext();){let s=r.next();if(t(s))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return rt}};var nn=l.$global,we=l.global("$hxClasses").EReg=class nt extends l.inherits(){[l.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw S.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw S.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:N.substr(e,0,t+r));let s=this.r.m!=null;return s&&(this.r.s=e),s}else{let s=this.match(r<0?N.substr(e,t,null):N.substr(e,t,r));return s&&(this.r.s=e,this.r.m.index+=t),s}}map(e,t){let r=0,s="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){s+=I.string(N.substr(e,r,null));break}let n=this.matchedPos();s+=I.string(N.substr(e,r,n.pos-r)),s+=I.string(t(this)),n.len==0?(s+=I.string(N.substr(e,n.pos,1)),r=n.pos+1):r=n.pos+n.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(s+=I.string(N.substr(e,r,null))),s}static get __name__(){return"EReg"}get __class__(){return nt}};we.prototype.r=null;var pn=l.$global,ue=l.global("$hxClasses")["haxe.http.HttpJs"]=class st extends l.inherits(Z){[l.new](e){this.async=!0,this.withCredentials=!1,super[l.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=$e.createXMLHttpRequest(),r=this,s=function(f){if(t.readyState!=4)return;let _;try{_=t.status}catch{_=null}if(_==0&&$e.get_supported()&&l.$global.location!=null){let c=l.$global.location.protocol.toLowerCase();new we("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(c)&&(_=t.response!=null?200:404)}if(_==null&&(_=null),_!=null&&r.onStatus(_),_!=null&&_>=200&&_<400){r.req=null;let c=t.getAllResponseHeaders().split(`\r
|
|
5
|
+
`),y=[],b=0,p=c;for(;b<p.length;){let x=p[b];++b,x!=""&&y.push(x)}c=y;let q=new Ze;r.responseHeaders=q;let d=0;for(;d<c.length;){let x=c[d];++d;let k=x.split(": "),D=k.shift(),V=k.length==1?k[0]:k.join(": ");V=ae.ltrim(ae.rtrim(V)),r.responseHeaders.inst.set(D,V)}r.success(me.ofData(t.response))}else if(_==null||_==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(_==null){r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}else switch(_){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=s);let n,i=this.postData,a=this.postBytes;if(i==null)if(a==null)n=null;else{let f=a;n=new Blob([f.b.bufferValue])}else a==null?n=i:n=null;if(n!=null)e=!0;else{let f=0,_=this.params;for(;f<_.length;){let c=_[f];++f,n==null?n="":n=(n==null?"null":I.string(n))+"&";let y=c.name,b=(n==null?"null":I.string(n))+encodeURIComponent(y)+"=",p=c.value;n=b+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(n!=null){let f=this.url.split("?").length<=1;t.open("GET",this.url+(f?"?":"&")+(n==null?"null":I.string(n)),this.async),n=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(f){let _=S.caught(f).unwrap();this.req=null,this.onError(_.toString());return}t.withCredentials=this.withCredentials,!tt.exists(this.headers,function(f){return f.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let m=0,g=this.headers;for(;m<g.length;){let f=g[m];++m,t.setRequestHeader(f.name,f.value)}t.send(n),this.async||s(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return Z}get __class__(){return st}};ue.prototype.async=null;ue.prototype.withCredentials=null;ue.prototype.responseHeaders=null;ue.prototype.req=null;var bn=l.$global,He=l.global("$hxClasses").Type=class it{static createInstance(e,t){let r=Function.prototype.bind.apply(e,[null].concat(t));return new r}static get __name__(){return"Type"}get __class__(){return it}};var xn=l.$global,R=l.global("$hxClasses").Reflect=class lt{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let s;return e.__properties__?(r=e.__properties__["get_"+t],s=r):s=!1,s?e[r]():e[t]}}static setProperty(e,t,r){let s,n;e.__properties__?(s=e.__properties__["set_"+t],n=s):n=!1,n?e[s](r):e[t]=r}static fields(e){let t=[];if(e!=null){let s=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&s.call(e,r)&&t.push(r)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return"Reflect"}get __class__(){return lt}};var Dn=l.$global,Ue=l.global("$hxClasses")["internal.http.FetchHttp"]=class ot extends l.inherits(ue){[l.new](e){this.responseStatus=0,super[l.new](e)}request(e){let t=l.$global,r=t.fetch,s=t.Headers,n=t.URLSearchParams;if(r==null){this.onError("Fetch API not found.");return}let i=He.createInstance(s,[]),a=0,m=this.headers;for(;a<m.length;){let p=m[a];++a,i.append(p.name,p.value)}let g=e?"POST":"GET",f=null;if(e)if(this.postData!=null)f=this.postData;else{f=He.createInstance(n,[]);let p=0,q=this.params;for(;p<q.length;){let d=q[p];++p,f.append(d.name,d.value)}}let _={method:g,headers:i,body:f},c=this,y=r(this.url,_).then(function(p){if(c.responseStatus=p.status,c.onStatus(p.status),p.ok)return p.text();throw S.thrown("HTTP Error: "+I.string(p.status))}).then(function(p){c.onData(p)}),b=R.field(y,"catch");b!=null&&b.apply(y,[function(p){c.onError(I.string(p))}])}static get __name__(){return"internal.http.FetchHttp"}static get __super__(){return ue}get __class__(){return ot}};Ue.prototype.responseStatus=null;var $n=l.$global,Le=l.global("$hxClasses")["internal.data.UUID"]=class at{static randomHexChar(){return"0123456789abcdef".charAt(I.random(16))}static v4(){let e="",t=0;for(;t<36;)switch(t++){case 14:e+="4";break;case 19:e+=I.string("0123456789abcdef".charAt(8+I.random(4)));break;case 8:case 13:case 18:case 23:e+="-";break;default:e+=I.string("0123456789abcdef".charAt(I.random(16)))}return e}static get __name__(){return"internal.data.UUID"}get __class__(){return at}};Le.HEX="0123456789abcdef";var Bn=l.$global,ge=function(){};ge.__isInterface__=!0;var fe=function(){};fe.__isInterface__=!0;var _e=function(){};_e.__isInterface__=!0;var zn=l.$global,o=l.global("$hxClasses")["internal.RecoBackendV2"]=class v extends l.inherits(){[l.new](){}static _requestUri(){return(v._safe_request?"https://":"http://")+v._req_domain+"/api/"+v._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:v._page_visit,channel:v._channel};if(v._consent>=2&&v._history.length>0&&(t.histories=v._buildHistories()),v._consent<2){let a=v.noConsentBody(),m=0,g=R.fields(a);for(;m<g.length;){let f=g[m];++m,t[f]=R.field(a,f)}}else v._user_id!=null&&(t.user_id=v._user_id),t.device_id=v._device_id;let r=0,s=v._others;for(;r<s.length;){let a=s[r];++r,t[a.key]=a.value}let n=R.field(t,"context_item"),i=R.field(t,"context_item_type");return n!=null&&I.string(n)!=""&&(i==null||I.string(i)=="")&&(t.context_item_type="article"),t}static _buildHistories(){return{pageviews:v._history}}static requestsToLists(e){let t=[],r="",s=[],n=0,i=[],a=function(c,y,b){r=c,s=y,n=0,i=b},m=function(c){let y=[];if(c==null)return y;let b=0;for(;b<c.length;){let p=c[b];++b,!(p==null||p.key==null||p.key=="")&&y.push({key:p.key,value:p.value})}return y},g=function(c,y){if(c==null&&y==null)return!0;if(c==null||y==null||c.length!=y.length)return!1;let b=new Array(c.length),p=0,q=c.length;for(;p<q;){let O=p++;b[O]=JSON.stringify(c[O])}let d=b,x=new Array(y.length),k=0,D=y.length;for(;k<D;){let O=k++;x[O]=JSON.stringify(y[O])}let V=x;d.sort(R.compare),V.sort(R.compare);let $=0,F=d.length;for(;$<F;){let O=$++;if(d[O]!=V[O])return!1}return!0},f=function(){let c={limit:n,list_name:r,list_size:n},y=0;for(;y<s.length;){let p=s[y];++y;let q=p.value;q instanceof Array||(q=[q]),c[p.key]=q}let b=0;for(;b<i.length;){let p=i[b];++b,c[p.key]=p.value}t.push(c)},_=0;for(;_<e.length;){let c=e[_];++_;let y=m(c.filters),b=c.others!=null?c.others:[];if(r==""){a(c.list,y,b),n+=1;continue}else(r!=c.list||!g(s,y)||!g(i,b))&&(f(),a(c.list,y,b));n+=1}return n!=0&&f(),t}static _requestRecos(e){let t=null,r=new Promise(function(c,y){t=c}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r,i=null,a=new Ue(v._requestUri());a.setHeader("Content-Type","application/json");let m=v.buildRequestBody(e),g=JSON.stringify(m);a.setPostData(g),a.onError=function(c){throw S.thrown("HTTP Request Error: "+c)};try{a.request(!0)}catch(c){let y=S.caught(c).unwrap();throw S.thrown("Failed to execute synchronous request: "+I.string(y)+g)}let f=function(c){let y=JSON.parse(c),b=de.fromRequestData(y),p=n;p._isFinished||(p._result=b,p._isFinished=!0,p._resolve(b))},_=a.get_responseData();return _!=null?f(_):a.onData=f,n}static getOrder(e,t,r){let s={list_name:e,limit:r.length,list_size:r.length},n={};R.setProperty(n,t,r),R.setProperty(s,"order",n);let i=null,a=new Promise(function(_,c){i=_}),m=a;m._resolve=i,m._isFinished=!1,m._result=null;let g=a,f;return v.getRawRecommendations([s]).then(function(_){let c=[],y=_.lists()[0].items;if(y instanceof Array){let p=0,q=y;for(;p<q.length;){let d=q[p];++p;let x=d.get("categories");x!=null&&c.push(x)}}let b=g;b._isFinished||(b._result=c,b._isFinished=!0,b._resolve(c))}),g}static getRawRecommendations(e){return v._requestRecos(e)}static addHistories(e,t){if(t==null&&(t="article"),e==null||e.length==0)return;let r=t!=null&&t!=""?t:"article",s=0;for(;s<e.length;){let n=e[s];if(++s,typeof n=="string"){let _=I.string(n);_!=""&&v._history.push({id:_,item_type:r});continue}let i=n,a=R.field(i,"id");if(a==null)continue;let m=I.string(a);if(m=="")continue;let g=R.field(i,"item_type");(g==null||I.string(g)=="")&&(g=R.field(i,"itemType"));let f=g!=null&&I.string(g)!=""?I.string(g):r;v._history.push({id:m,item_type:f})}}static setOthers(e,t){let r=0,s=v._others;for(;r<s.length;){let n=s[r];if(++r,n.key==e){n.value=t;return}}v._others.push({key:e,value:t})}static setConsent(e){e>2&&(e=2),v._consent=e,e==2&&v.getDeviceId()=="no-consent"&&v.setDeviceId(Le.v4())}static setChannel(e){v._channel=e}static setPageVisit(e){v._page_visit=e}static setEnvironment(e){v._environment=e}static setDeviceId(e){v._device_id=e}static setUserId(e){v._user_id=e}static setRequestDomain(e){v._req_domain=e}static setSafeRequest(e){v._safe_request=e}static setContextItem(e){v.setOthers("context_item",e)}static setContextItemType(e){v.setOthers("context_item_type",e)}static getRequestDomain(){return v._req_domain}static getSafeRequest(){return v._safe_request}static getEnvironment(){return v._environment}static getPageVisit(){return v._page_visit}static getUserId(){return v._user_id}static getDeviceId(){return v._device_id}static getConsent(){return v._consent}static getChannel(){return v._channel}static getOthers(e){let t=0,r=v._others;for(;t<r.length;){let s=r[t];if(++t,e==s.key)return s.value}return null}static getContextItem(){return v.getOthers("context_item")}static getContextItemType(){return v.getOthers("context_item_type")}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return v}};o._environment=null;o._device_id="no-consent";o._user_id=null;o._consent=0;o._req_domain="europe-west1.froomle.com";o._page_visit=null;o._channel="www-desktop";o._safe_request=!0;o._history=[];o._others=[];var de=l.global("$hxClasses")["internal._RecommendationsInternal"]=class Ve extends l.inherits(){[l.new](e,t,r,s,n){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=s,this._lists=n}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n=0,i=s.items;for(;n<i.length;){let a=i[n];++n,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let s=r[t];if(++t,s.list_name==e)return s}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n={limit:s.limit,list_key:s.list_key,list_name:s.list_name,list_size:s.list_size,items:[]},i=0,a=s.items;for(;i<a.length;){let m=a[i];++i,n.items.push(be.__cast(m,re).getData())}e.lists.push(n)}return JSON.stringify(e)}static fromRequestData(e){let t=R.getProperty(e,"lists"),r=[],s=0;for(;s<t.length;){let n=t[s];++s;let i=R.getProperty(n,"items"),a=[],m=0;for(;m<i.length;){let f=i[m];++m,R.setProperty(f,"request_id",R.getProperty(e,"request_id")),R.setProperty(f,"user_group",R.getProperty(e,"user_group")),a.push(new re(f))}let g=new ce({limit:R.getProperty(n,"limit"),list_key:R.getProperty(n,"list_key"),list_name:R.getProperty(n,"list_name"),list_size:R.getProperty(n,"list_size"),items:a,request_id:R.getProperty(e,"request_id")});r.push(g)}return new Ve(R.getProperty(e,"device_id"),R.getProperty(e,"request_id"),R.getProperty(e,"user_group"),R.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[ge]}get __class__(){return Ve}};de.prototype.request_id=null;de.prototype.user_group=null;de.prototype.user_id=null;de.prototype.device_id=null;de.prototype._lists=null;var ce=l.global("$hxClasses")["internal._RecommendationsListInternal"]=class ut extends l.inherits(){[l.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size,this.request_id=e.request_id}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[fe]}get __class__(){return ut}};ce.prototype.limit=null;ce.prototype.list_key=null;ce.prototype.list_name=null;ce.prototype.list_size=null;ce.prototype.items=null;ce.prototype.request_id=null;var re=l.global("$hxClasses")["internal._RecommendationItemInternal"]=class ct extends l.inherits(){[l.new](e){this.Id=R.getProperty(e,"item_id"),this.RequestId=R.getProperty(e,"request_id"),this.UserGroup=R.getProperty(e,"user_group"),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[_e]}get __class__(){return ct}};re.prototype.Id=null;re.prototype.RequestId=null;re.prototype.UserGroup=null;re.prototype._data=null;var Qn=l.$global,je=function(){};je.__isInterface__=!0;var es=l.$global,xe=l.global("$hxClasses")["internal.js.JSFroomleDomTree"]=class De extends l.inherits(){[l.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let r=new DOMParser().parseFromString(e,"text/html"),s=new De;return s.root=r.documentElement,s}static fromDocument(e){let t=new De;return t.root=e.documentElement,t}static get __name__(){return"internal.js.JSFroomleDomTree"}static get __interfaces__(){return[je]}get __class__(){return De}};xe.prototype.root=null;var cs=l.$global,oe=l.global("$hxClasses")["internal.domHandler.DomDomDom"]=class ne extends l.inherits(){[l.new](){}static _fillRecoTargets(e){let t=null,r=new Promise(function(h,w){t=h}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;if(e==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}let i=[],a=new Array,m=e.querySelectorAll("*"),g=0,f=m.length;for(;g<f;){let h=g++,w=m.item(h);w instanceof HTMLElement&&a.push(w)}let _=a;_.push(e);let c=0;for(;c<_.length;){let h=_[c];++c;let w=0,E=new Array,C=0,P=h.attributes;for(;C<P.length;){let H=P[C];++C,E.push({name:H.name,value:H.value})}let j=E;for(;w<j.length;){let H=j[w];++w,H.name=="data-froomle-reco"&&i.push(h)}}let y=[],b=0;for(;b<i.length;){let h=i[b];++b;let w=h.getAttribute("data-froomle-request-id"),E=h.getAttribute("data-froomle-id"),C=w!=null&&w!="",P=E!=null&&E!="";!C&&!P&&y.push(h)}if(y.length<1){let h=null,w=new Promise(function(C,P){h=C}),E=w;return E._resolve=h,E._isFinished=!1,E._result=null,w}let p=[],q=[],d="",x=[],k=[],D=[],V=function(h,w){if(h.length!=w.length)return!1;let E=new Array(h.length),C=0,P=h.length;for(;C<P;){let T=C++;E[T]=JSON.stringify(h[T])}let j=E,H=new Array(w.length),J=0,K=w.length;for(;J<K;){let T=J++;H[T]=JSON.stringify(w[T])}let W=H;j.sort(R.compare),W.sort(R.compare);let z=0,M=j.length;for(;z<M;){let T=z++;if(j[T]!=W[T])return!1}return!0},$=function(){let h={list_name:d,list_size:k.length,limit:k.length},w=0;for(;w<x.length;){let C=x[w];if(++w,C!=null&&C.key!=null&&C.key!=""){let P=C.value;P instanceof Array||(P=[P]),R.setProperty(h,C.key,P)}}let E=0;for(;E<D.length;){let C=D[E];++E,R.setProperty(h,C.key,C.value)}p.push(h),q.push(k)},F=function(h,w,E,C){d=h,x=w,k=[C],D=E},O=0;for(;O<y.length;){let h=y[O];++O;let w=function(H){let J=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let U=M[z];++z,W.push({name:U.name,value:U.value})}let T=W;for(;K<T.length;){let U=T[K];if(++K,U.name.startsWith("data-froomle-reco-filter-")){let X=N.substr(U.name,25,null),ie=U.value;J.push({key:X,value:ie})}}return J},E=function(H){let J=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let U=M[z];++z,W.push({name:U.name,value:U.value})}let T=W;for(;K<T.length;){let U=T[K];if(++K,U.name.startsWith("data-froomle-variable-")){let X=N.substr(U.name,22,null),ie=U.value;J.push({key:X,value:ie})}}return J},C=h.getAttribute("data-froomle-reco"),P=w(h),j=E(h);if(d==""){F(C,P,j,h);continue}else if(C==d&&V(x,P)&&V(D,j)){k.push(h);continue}else{$(),F(C,P,j,h);continue}}d!=""&&$();let B;if(o.getPageVisit()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else if(o.getEnvironment()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else try{B=o.getRawRecommendations(p)}catch{let w=n;return w._isFinished||(w._result=!1,w._isFinished=!0,w._resolve(!1)),n}return B.then(function(h){let w=h.lists(),E=w.length,C=0,P=E;for(;C<P;){let H=C++,J=w[H],K=J.items.length!=q[H].length,W=J.items.length,z=0,M=W;for(;z<M;){let T=z++,U=J.items[T],X=q[H][T];ne._fillParameters(X,U,h.request_id)}}let j=n;j._isFinished||(j._result=!0,j._isFinished=!0,j._resolve(!0))}),n}static getAttrByPath(e,t,r){r==null&&(r="fgh");try{t=new we("\\\\[(\\\\w+)\\\\]","g").map(t,function(g){return"."+g.matched(1)}),t=ae.replace(t,"[","."),t=ae.replace(t,"]",""),N.cca(t,0)==46&&(t=N.substr(t,1,null));let n=t.split("."),i=e.get(n[0]),a=1,m=n.length;for(;a<m;){let g=a++;if(i==null)return null;i instanceof Array&&I.parseInt(n[g])!=null?i=i[I.parseInt(n[g])]:i=R.field(i,n[g])}return i}catch{return r}}static _buildHistories(e){let t=[],r=new Array,s=e.querySelectorAll("[data-froomle-id]"),n=0,i=s.length;for(;n<i;){let g=n++,f=s.item(g);f instanceof HTMLElement&&r.push(f)}let a=r,m=0;for(;m<a.length;){let g=a[m];++m,t.push(g.getAttribute("data-froomle-id"))}o.addHistories(t)}static fillParam(e,t,r,s,n){n==null&&(n="");try{let i=ne.getAttrByPath(s,r,n);if(t=="inner"){e.textContent=i;let a=e.textContent}else e.setAttribute(t,i)}catch{}}static _fillParameters(e,t,r){e.setAttribute("data-froomle-id",t.get("item_id")),e.setAttribute("data-froomle-request-id",r);let s=t.get("item_type");s!=null&&I.string(s)!=""&&e.setAttribute("data-froomle-item-type",I.string(s)),t.UserGroup!=null&&t.UserGroup!=""&&e.setAttribute("data-froomle-user-group",t.UserGroup);let n=new Array,i=e.querySelectorAll("*"),a=0,m=i.length;for(;a<m;){let _=a++,c=i.item(_);c instanceof HTMLElement&&n.push(c)}let g=n,f=0;for(;f<g.length;){let _=g[f];++f;let c=0,y=new Array,b=0,p=_.attributes;for(;b<p.length;){let d=p[b];++b,y.push({name:d.name,value:d.value})}let q=y;for(;c<q.length;){let d=q[c];if(++c,d.name.startsWith("data-froomle-param-")){let x=ae.replace(d.name,"data-froomle-param-",""),k=d.value;ne.fillParam(_,x,k,t)}}}}static _orderElements(e){let t=function(d,x,k){let D=[],V=new Array,$=0,F=d.childNodes;for(;$<F.length;){let E=F[$];++$,V.push(E)}let O=V,B=0;for(;B<O.length;){let E=O[B];++B;try{if(E.getAttribute("data-froomle-ordervalue")!=null){D.push(E);let P=e.createElement("span");P.setAttribute("data-froomle-tmp-node","tmp"),d.replaceChild(P,E)}}catch{}}let h=[],w=0;for(;w<D.length;){let E=D[w];++w,h.push(E.getAttribute("data-froomle-ordervalue"))}return{el:d,key:x,values:h,orderChildren:D,list_name:k}},r=null,s=new Promise(function(d,x){r=d}),n=s;n._resolve=r,n._isFinished=!1,n._result=null;let i=s,a=e.getRoot(),m=new Array,g=a.querySelectorAll("*"),f=0,_=g.length;for(;f<_;){let d=f++,x=g.item(d);x instanceof HTMLElement&&m.push(x)}let c=m,y=[],b=0;for(;b<c.length;){let d=c[b];++b;let x=0,k=new Array,D=0,V=d.attributes;for(;D<V.length;){let F=V[D];++D,k.push({name:F.name,value:F.value})}let $=k;for(;x<$.length;){let F=$[x];++x,F.name.startsWith("data-froomle-order-")&&y.push(t(d,F.name.substring(19),F.value))}}if(y.length<1){let d=i;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),i}let p=[],q=0;for(;q<y.length;){let d=y[q];++q;let x={list_name:d.list_name,limit:d.values.length,list_size:d.values.length},k={};R.setProperty(k,d.key,d.values),R.setProperty(x,"order",k),p.push(x)}if(o.getPageVisit()==null){let d=i;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),i}else if(o.getEnvironment()==null){let d=i;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),i}try{o.getRawRecommendations(p).then(function(d){let x=d.lists(),k=x.length,D=0,V=k;for(;D<V;){let F=D++,O=x[F],B=y[F];B.el.setAttribute("data-froomle-request-id",d.request_id);let h=new Array,w=0,E=O.items;for(;w<E.length;){let M=E[w];++w;let T=M.get(B.key),U=M.get(B.key),X=B.values.length,ie=0,pe=X;for(;ie<pe;){let le=ie++,he=B.values[le];if(T==he){let jt=B.orderChildren.length,Rt=B.orderChildren[le];h.push(Rt),B.orderChildren.splice(le,1),B.values.splice(le,1);break}}}let C=h.length,P=B.el,j=new Array,H=0,J=P.childNodes;for(;H<J.length;){let M=J[H];++H,j.push(M)}let K=j.length,W=0,z=K;for(;W<z;){let M=W++,T=B.el,U=new Array,X=0,ie=T.childNodes;for(;X<ie.length;){let he=ie[X];++X,U.push(he)}let pe=U[M],le;if(pe instanceof HTMLElement?le=pe.hasAttribute("data-froomle-tmp-node"):le=!1,le){B.el.replaceChild(h[0],pe),h.splice(0,1);let he=h.length;if(h.length==0)break}}}let $=i;$._isFinished||($._result=!0,$._isFinished=!0,$._resolve(!0))})}catch{let x=i;x._isFinished||(x._result=!1,x._isFinished=!0,x._resolve(!1))}return i}static domInit(e){let t=null,r=new Promise(function(i,a){t=i}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;return ne._orderElements(e).then(function(i){ne._buildHistories(e.getRoot()),ne._fillRecoTargets(e.getRoot()).then(function(a){let m=n;m._isFinished||(m._result=!0,m._isFinished=!0,m._resolve(!0))})}),n}static fillElementRecos(e){ne._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t;try{let s=new DOMParser().parseFromString(e,"text/html"),n=new xe;n.root=s.documentElement,t=n}catch{return e}return ne.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return ne}};var ds=l.$global,L=l.global("$hxClasses").FroomleSdk=class se{static register(){se.registered||se._env_set&&se._page_visit_set&&(se.registered=!0)}static buildScriptTag(){let e='<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="'+o.getEnvironment()+'" ',t=o.getPageVisit();t!=null&&(e+='data-froomle-page-visit="'+t+'" ');let r=o.getContextItem();if(r!=null){e+='data-froomle-context-item="'+r+'" ';let g=o.getContextItemType();(g==null||g=="")&&(g="article"),e+='data-froomle-context-item-type="'+g+'" '}let s=o.getDeviceId();s!=null&&(e+='data-froomle-device-id="'+s+'" ');let n=o.getUserId();n!=null&&(e+='data-froomle-user-id="'+n+'" ');let i=o.getConsent();i>0&&(e+='data-froomle-consent="'+i+'" ');let a=o.getRequestDomain();a!=null&&(e+='data-froomle-request-domain="'+a+'" ');let m=o.getChannel();return m!=null&&(e+='data-froomle-channel="'+m+'" '),e+="></script>",e}static setEnvironment(e){o.setEnvironment(e),se._env_set=!0,se.register()}static setDeviceId(e){o.setDeviceId(e)}static setUserId(e){o.setUserId(e)}static setConsent(e){o.setConsent(e)}static setPageVisit(e){o.setPageVisit(e),se._page_visit_set=!0,se.register()}static setChannel(e){o.setChannel(e)}static setRequestDomain(e){o.setRequestDomain(e)}static setSafeRequest(e){o.setSafeRequest(e)}static setContextItem(e){o.setContextItem(e)}static setContextItemType(e){o.setContextItemType(e)}static setCustomVariable(e,t){o.setOthers(e,t)}static getUserId(){return o.getUserId()}static getDeviceId(){return o.getDeviceId()}static getEnvironment(){return o.getEnvironment()}static getSafeRequest(){return o.getSafeRequest()}static getPageVisit(){return o.getPageVisit()}static getConsent(){return o.getConsent()}static getRecommendations(e){return o.getRawRecommendations(e)}static getChannel(){return o.getChannel()}static getVersion(){return"0.0.11"}static runFromHtml(e){return oe.runFromHtml(e)}static get __name__(){return"FroomleSdk"}get __class__(){return se}};L._env_set=!1;L._page_visit_set=!1;L.registered=!1;var ys=l.$global;function mt(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}function Pe(){return o.getConsent()>=1}function gt(){return o.getConsent()<2?"no-consent":o.getDeviceId()}function ft(){let u=o.getChannel();if(u)return u}function Dt(u){let e=(u==null?void 0:u.getAttribute("data-froomle-id"))||(u==null?void 0:u.getAttribute("data-froomle-action-item"));if(e)return e}function Pt(u){let e=(u==null?void 0:u.getAttribute("data-froomle-item-type"))||(u==null?void 0:u.getAttribute("data-froomle-action-item-type"));if(e)return e}function _t(u){var r;let e=u==null?void 0:u.getAttribute("data-froomle-user-group");return e||(typeof document=="undefined"?void 0:((r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group"))||void 0)}function dt(u,e,t="impression",r){if(!Pe())return;let s=ft()||"www-desktop",n={event_type:t,page_type:o.getPageVisit(),action_item:u,action_item_type:e,channel:s,device_id:gt()},i=_t();if(i&&(n.user_group=i),r)for(let a in r)n[a]=r[a];try{fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({events:[n]})})}catch{}}var A=class A{static queueIfNotPresent(e){A.impressionQueue.includes(e)||A.impressionQueue.push(e)}static generateBody(){let e=[];for(let t of A.impressionQueue){let r=Dt(t);if(!r)continue;let s=Pt(t)||"article",n=ft()||"www-desktop",i={event_type:"impression",page_type:o.getPageVisit(),action_item:r,action_item_type:s,channel:n,device_id:gt()},a=_t(t);a&&(i.user_group=a),o.getConsent()>=2&&o.getUserId()&&(i.user_id=o.getUserId());let m=t.getAttribute("data-froomle-reco"),g=t.getAttribute("data-froomle-request-id");m&&g&&(i.list_name=m,i.request_id=g),e.push(i)}return A.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){console.log(A.impressionQueue),A.impressionQueue.length!==0&&Pe()&&fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:A.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=A.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){A.observer.observe(e)}static processDocument(){if(Pe()){console.log("\u{1F680} Processing document for impressions");for(let e of document.querySelectorAll("[data-froomle-id]"))A.intersectsWithViewPortRect(e)?A.queueIfNotPresent(e):A.addIntersectionImpressionListener(e);A.sendImpressions()}}static processElement(e){if(!Pe()||!(e instanceof Element))return;let t=[];e.matches("[data-froomle-id]")&&t.push(e);for(let r of e.querySelectorAll("[data-froomle-id]"))t.push(r);if(t.length!==0){for(let r of t)A.intersectsWithViewPortRect(r)?A.queueIfNotPresent(r):A.addIntersectionImpressionListener(r);A.sendImpressions()}}};A.impressionQueue=[],A.observer=null;var Q=A;typeof document!="undefined"&&(Q.observer=new IntersectionObserver((u,e)=>{u.forEach(t=>{t.isIntersecting&&(Q.impressionQueue.push(t.target),Q.observer.unobserve(t.target))}),Q.impressionQueue.length>0&&Q.sendImpressions()}));var Re=class u{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=u.readChannel()||"www-desktop",t={event_type:"page_visit",page_type:o.getPageVisit(),channel:e,device_id:u.readDeviceId()},r=u.readUserGroup();return r&&(t.user_group=r),o.getConsent()>=2&&o.getUserId()&&(t.user_id=o.getUserId()),JSON.stringify({events:[t]})}static sendPageVisit(){o.getPageVisit()&&(o.getContextItem()||u.canTrackEvents()&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()}))}};var Ie=class u{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItemType(){let e=o.getContextItemType();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=u.readActionItemType()||"article",t=u.readChannel()||"www-desktop",r={event_type:"detail_pageview",page_type:o.getPageVisit(),action_item:o.getContextItem(),action_item_type:e,channel:t,device_id:u.readDeviceId()},s=u.readUserGroup();return s&&(r.user_group=s),o.getConsent()>=2&&o.getUserId()&&(r.user_id=o.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){o.getContextItem()&&o.getPageVisit()&&u.canTrackEvents()&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var ee=class ee{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItem(e){let t=e.getAttribute("data-froomle-id")||e.getAttribute("data-froomle-action-item");if(t)return t}static readActionItemType(e){let t=e.getAttribute("data-froomle-item-type")||e.getAttribute("data-froomle-action-item-type");if(t)return t}static readUserGroup(e){var s;let t=e.getAttribute("data-froomle-user-group");return t||(typeof document=="undefined"?void 0:((s=document.querySelector("[data-froomle-user-group]"))==null?void 0:s.getAttribute("data-froomle-user-group"))||void 0)}static registerClickables(){ee.listenerRegistered||(ee.listenerRegistered=!0,document.addEventListener("click",e=>{if(!ee.canTrackEvents())return;let t=e instanceof MouseEvent?e:null,r=e.target,s=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!s)return;let n=s.closest("a");if(!n)return;let i=n.closest("[data-froomle-id]");if(!i)return;let a=ee.readActionItem(i);if(!a)return;let m=ee.readActionItemType(i)||"article",g=ee.readChannel()||"www-desktop",f=n instanceof HTMLAnchorElement?n.href:null,_=!!f&&e.cancelable&&!e.defaultPrevented&&!n.hasAttribute("download")&&(!n.target||n.target==="_self")&&!!t&&t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey;_&&e.preventDefault();let c={event_type:"click_on_recommendation",page_type:o.getPageVisit(),action_item:a,action_item_type:m,channel:g,device_id:ee.readDeviceId()},y=ee.readUserGroup(i);y&&(c.user_group=y);let b=i.getAttribute("data-froomle-reco"),p=i.getAttribute("data-froomle-request-id");b&&p&&(c.list_name=b,c.request_id=p),o.getConsent()>=2&&o.getUserId()&&(c.user_id=o.getUserId());let d=(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events",x=JSON.stringify({events:[c]}),k=new Blob([x],{type:"application/json"}),D=()=>fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:x,keepalive:!0});if(_&&f){let $=!1,F=()=>{$||($=!0,window.location.assign(f))},O=window.setTimeout(F,200);D().catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(d,k)}).finally(()=>{window.clearTimeout(O),F()});return}typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(d,k)||D().catch(()=>{})},!0))}};ee.listenerRegistered=!1;var Ee=ee;var Tt=xe,pt=L.setEnvironment,ht=L.setPageVisit,yt=L.setRequestDomain,bt=L.setSafeRequest,vt=typeof L.setChannel=="function"?L.setChannel:o.setChannel,wt=L.setContextItem,xt=L.setContextItemType,At=L.setCustomVariable,$t=o.addHistories;function Me(u){L.setUserId(u),document.cookie=`froomle_user_id=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Ge(u){L.setDeviceId(u),document.cookie=`froomle_device_id=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Je(u){L.setConsent(u),document.cookie=`froomle_consent=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${L.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window!="undefined"&&(window.setFroomleConsent=Je);function Ne(u){let e=document.cookie.split("; ");for(let t of e){let[r,s]=t.split("=");if(r===u)return decodeURIComponent(s)}return null}var Ft=L.getRecommendations;if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document!="undefined")){let u=document.currentScript;if(u){let t=u.getAttribute("data-froomle-device-id"),r=u.getAttribute("data-froomle-user-id"),s=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),i=u.getAttribute("data-froomle-request-domain"),a=u.getAttribute("data-froomle-context-item"),m=u.getAttribute("data-froomle-context-item-type"),g=u.getAttribute("data-froomle-safe-request"),f=u.getAttribute("data-froomle-channel");if(pt(s),n&&ht(n),a&&(wt(a),xt(m||"article")),t)Ge(t);else{let _=Ne("froomle_device_id");_&&Ge(_)}if(r)Me(r);else{let _=Ne("froomle_user_id");_&&Me(_)}i&&yt(i),g&&bt(g!=="false"),f&&vt(f)}let e=Ne("froomle_consent");e&&Je(e),document.addEventListener("DOMContentLoaded",()=>{console.log("froomle loads dom"),oe.domInit(Tt.fromDocument(document)).then(s=>{Ee.registerClickables(),Q.processDocument(),Re.sendPageVisit(),Ie.sendPageView()});function t(s){return s.matches("[data-froomle-reco]")||s.querySelector("[data-froomle-reco]")!==null}new MutationObserver(s=>{for(let n of s)if(n.type==="childList"&&n.addedNodes.forEach(i=>{i instanceof Element&&(t(i)&&oe.fillElementRecos(i),Q.processElement(i))}),n.type==="attributes"&&n.target instanceof Element)if(n.attributeName==="data-froomle-reco"){let i=n.target.getAttribute("data-froomle-request-id");(!i||i==="")&&oe.fillElementRecos(n.target)}else if(n.attributeName==="data-froomle-request-id"){let i=n.target.getAttribute("data-froomle-request-id"),a=n.target.getAttribute("data-froomle-id");n.target.getAttribute("data-froomle-reco")&&(!i||i==="")&&(!a||a==="")&&oe.fillElementRecos(n.target)}else n.attributeName==="data-froomle-id"&&Q.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-froomle-reco","data-froomle-request-id","data-froomle-id"]})})}function Ot(){let u,e;return{promise:new Promise((r,s)=>{u=r,e=s}),resolve:u,reject:e}}var Te=[];function Bt(){var u;return typeof document=="undefined"?"":((u=document.querySelector("[data-froomle-user-group]"))==null?void 0:u.getAttribute("data-froomle-user-group"))||""}function Ht(u,e){var n;let t=u,s=((n=t==null?void 0:t.UserGroup)!=null?n:typeof(t==null?void 0:t.get)=="function"?t.get("user_group"):void 0)||e;if(s&&(t.UserGroup=s,typeof(t==null?void 0:t.getData)=="function")){let i=t.getData();i&&(!i.user_group||i.user_group==="")&&(i.user_group=s)}}async function Ut(){let u=Te.map(n=>n.req),e=o.requestsToLists(u),t=await o.getRawRecommendations(e),r=t.user_group||"";typeof document!="undefined"&&r&&document.documentElement.setAttribute("data-froomle-user-group",r);let s=t.lists().reduce((n,i)=>[...n,...i.items],[]);s.forEach(n=>Ht(n,r)),Te.forEach((n,i)=>{s[i]?n.deferred.resolve(s[i]):n.deferred.reject(new Error("No recommendation available"))}),Te.length=0}function Lt(u){let e,t,s={promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t};return Te.push({deferred:s,req:u}),s}function Vt(u){let t=Lt(u).promise,r=Ot(),s=function(i,a){return t.then(m=>(n.completeTarget=m,i?i(m):m),m=>a?a(m):Promise.reject(m))},n=new Proxy(new re({item_id:"",request_id:"",user_group:""}),{get(i,a,m){if(a==="then")return s;if(a==="__froomleList")return u.list;if(a==="get"){let _=Reflect.get(i,a,m);return function(...c){return _.apply(this,c)}}if(typeof a!="string")return Reflect.get(i,a,m);let g=Reflect.get(i,a,m);if(g!=null&&g!=="")return g;let f=i.get(a);return f!=null&&f!==""?f:""},set(i,a,m,g){if(a==="completeTarget"){if(Object.assign(i,m),!i.UserGroup){let f=Bt();if(f){i.UserGroup=f;let _=i.getData();_&&!_.user_group&&(_.user_group=f)}}return!0}return Reflect.set(i,a,m,g)},has(i,a){return i.get(a)!==void 0}});return n}export{ge as a,fe as b,_e as c,o as d,dt as e,Q as f,Re as g,Ie as h,Ee as i,pt as j,ht as k,yt as l,bt as m,vt as n,wt as o,xt as p,At as q,$t as r,Me as s,Ge as t,Je as u,Ft as v,Ut as w,Vt as x};
|
package/dist/froomle.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var FroomleFrontendSdk=(()=>{var $e=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var kt=(a,e)=>{for(var t in e)$e(a,t,{get:e[t],enumerable:!0})},qt=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let
|
|
1
|
+
"use strict";var FroomleFrontendSdk=(()=>{var $e=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var kt=(a,e)=>{for(var t in e)$e(a,t,{get:e[t],enumerable:!0})},qt=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ct(e))!St.call(a,i)&&i!==t&&$e(a,i,{get:()=>e[i],enumerable:!(r=Rt(e,i))||r.enumerable});return a};var Dt=a=>qt($e({},"__esModule",{value:!0}),a);var Ut={};kt(Ut,{FroomleDomTree:()=>dt,RecoBackendV2:()=>o,RecommendationItem:()=>fe,RecommendationList:()=>_e,Recommendations:()=>ge,_RecommendationItemInternal:()=>se,addHistories:()=>Lt,getRecommendations:()=>Nt,sendEvent:()=>pt,setChannel:()=>wt,setConsent:()=>Ge,setContextItem:()=>xt,setContextItemType:()=>It,setCustomVariable:()=>Vt,setDeviceId:()=>Je,setEnvironment:()=>ht,setPageVisit:()=>yt,setRequestDomain:()=>bt,setSafeRequest:()=>vt,setUserId:()=>Me});var s=class a{static global(e){return a.globals[e]?a.globals[e]:a.globals[e]={}}static createStatic(e,t,r){let i=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(i=r(),r=null),i},set:function(n){r!=null&&(i=r(),r=null),i=n}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return a.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?a.mkIter(e):e.iterator()}static mkIter(e){return new Pe(e)}static extend(e){function t(){this[a.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[a.init]&&r[a.init](),this[a.new].apply(this,arguments)}return t?r[a.init]=()=>{let i=e();i[a.init]&&i[a.init](),Object.setPrototypeOf(r.prototype,i.prototype),r[a.init]=void 0}:e&&e[a.init]?(t=!0,r[a.init]=()=>{e[a.init]&&e[a.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[a.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=a.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return a}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var Pe=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class ze extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return ze}};Pe.prototype.array=null;Pe.prototype.current=null;var Wt=s.$global,Ce=s.global("$hxClasses")["haxe.ValueException"]=class We extends s.inherits(()=>q,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return q}get __class__(){return We}};Ce.prototype.value=null;var Yt=s.$global,q=s.global("$hxClasses")["haxe.Exception"]=class ye extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ye?e:e instanceof Error?new ye(e.message,null,e):new Ce(e,null,e)}static thrown(e){return e instanceof ye?e.get_native():e instanceof Error?e:new Ce(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ye}};q.prototype.native=null;q.prototype.__skipStack=null;q.prototype.__nativeException=null;q.prototype.__previousException=null;var rr=s.$global,E=s.global("$hxClasses").Std=class Ke{static string(e){return be.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static random(e){return e<=0?0:Math.floor(Math.random()*e)}static get __name__(){return"Std"}get __class__(){return Ke}};Object.defineProperty(String.prototype,"__class__",{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,At={},$t={},Pt=Number,Tt=Boolean,Ft={},Ot={};var At,$t,Pt,Tt,Ft,Ot;var or=s.$global,be=s.global("$hxClasses")["js.Boot"]=class J{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let r=J.__nativeClassName(e);return r!=null?J.__resolveNativeClass(r):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let m=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],_=m._hx_name;return m.__params__?(t=t+" ",_+"("+(function(f){var c;let y=[];{let b=0,d=m.__params__;for(;b<d.length;){let k=d[b];b=b+1,y.push(J.__string_rec(e[k],t))}}return c=y,c})(this).join(",")+")"):_}if(e instanceof Array){let g="[";t+=" ";let m=0,_=e.length;for(;m<_;){let f=m++;g+=(f>0?",":"")+J.__string_rec(e[f],t)}return g+="]",g}let i;try{i=e.toString}catch{return"???"}if(i!=null&&i!=Object.toString&&typeof i=="function"){let g=e.toString();if(g!="[object Object]")return g}let n=`{
|
|
2
2
|
`;t+=" ";let l=e.hasOwnProperty!=null,u=null;for(u in e)l&&!e.hasOwnProperty(u)||u=="prototype"||u=="__class__"||u=="__super__"||u=="__interfaces__"||u=="__properties__"||(n.length!=2&&(n+=`,
|
|
3
3
|
`),n+=t+u+" : "+J.__string_rec(e[u],t));return t=t.substring(1),n+=`
|
|
4
|
-
`+t+"}",n;break;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let
|
|
5
|
-
`),y=[],b=0,d=c;for(;b<d.length;){let x=d[b];++b,x!=""&&y.push(x)}c=y;let k=new Ze;r.responseHeaders=k;let _=0;for(;_<c.length;){let x=c[_];++_;let S=x.split(": "),D=S.shift(),N=S.length==1?S[0]:S.join(": ");N=ae.ltrim(ae.rtrim(N)),r.responseHeaders.inst.set(D,N)}r.success(me.ofData(t.response))}else if(p==null||p==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(p==null){r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}else switch(p){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=s);let n,l=this.postData,u=this.postBytes;if(l==null)if(u==null)n=null;else{let g=u;n=new Blob([g.b.bufferValue])}else u==null?n=l:n=null;if(n!=null)e=!0;else{let g=0,p=this.params;for(;g<p.length;){let c=p[g];++g,n==null?n="":n=(n==null?"null":R.string(n))+"&";let y=c.name,b=(n==null?"null":R.string(n))+encodeURIComponent(y)+"=",d=c.value;n=b+encodeURIComponent(d)}}try{if(e)t.open("POST",this.url,this.async);else if(n!=null){let g=this.url.split("?").length<=1;t.open("GET",this.url+(g?"?":"&")+(n==null?"null":R.string(n)),this.async),n=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(g){let p=q.caught(g).unwrap();this.req=null,this.onError(p.toString());return}t.withCredentials=this.withCredentials,!tt.exists(this.headers,function(g){return g.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let f=0,m=this.headers;for(;f<m.length;){let g=m[f];++f,t.setRequestHeader(g.name,g.value)}t.send(n),this.async||s(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return Z}get __class__(){return st}};ue.prototype.async=null;ue.prototype.withCredentials=null;ue.prototype.responseHeaders=null;ue.prototype.req=null;var wn=i.$global,He=i.global("$hxClasses").Type=class it{static createInstance(e,t){let r=Function.prototype.bind.apply(e,[null].concat(t));return new r}static get __name__(){return"Type"}get __class__(){return it}};var En=i.$global,I=i.global("$hxClasses").Reflect=class lt{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let s;return e.__properties__?(r=e.__properties__["get_"+t],s=r):s=!1,s?e[r]():e[t]}}static setProperty(e,t,r){let s,n;e.__properties__?(s=e.__properties__["set_"+t],n=s):n=!1,n?e[s](r):e[t]=r}static fields(e){let t=[];if(e!=null){let s=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&s.call(e,r)&&t.push(r)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return"Reflect"}get __class__(){return lt}};var $n=i.$global,Ve=i.global("$hxClasses")["internal.http.FetchHttp"]=class ot extends i.inherits(ue){[i.new](e){this.responseStatus=0,super[i.new](e)}request(e){let t=i.$global,r=t.fetch,s=t.Headers,n=t.URLSearchParams;if(r==null){this.onError("Fetch API not found.");return}let l=He.createInstance(s,[]),u=0,f=this.headers;for(;u<f.length;){let d=f[u];++u,l.append(d.name,d.value)}let m=e?"POST":"GET",g=null;if(e)if(this.postData!=null)g=this.postData;else{g=He.createInstance(n,[]);let d=0,k=this.params;for(;d<k.length;){let _=k[d];++d,g.append(_.name,_.value)}}let p={method:m,headers:l,body:g},c=this,y=r(this.url,p).then(function(d){if(c.responseStatus=d.status,c.onStatus(d.status),d.ok)return d.text();throw q.thrown("HTTP Error: "+R.string(d.status))}).then(function(d){c.onData(d)}),b=I.field(y,"catch");b!=null&&b.apply(y,[function(d){c.onError(R.string(d))}])}static get __name__(){return"internal.http.FetchHttp"}static get __super__(){return ue}get __class__(){return ot}};Ve.prototype.responseStatus=null;var On=i.$global,Le=i.global("$hxClasses")["internal.data.UUID"]=class at{static randomHexChar(){return"0123456789abcdef".charAt(R.random(16))}static v4(){let e="",t=0;for(;t<36;)switch(t++){case 14:e+="4";break;case 19:e+=R.string("0123456789abcdef".charAt(8+R.random(4)));break;case 8:case 13:case 18:case 23:e+="-";break;default:e+=R.string("0123456789abcdef".charAt(R.random(16)))}return e}static get __name__(){return"internal.data.UUID"}get __class__(){return at}};Le.HEX="0123456789abcdef";var Vn=i.$global,ge=function(){};ge.__isInterface__=!0;var _e=function(){};_e.__isInterface__=!0;var fe=function(){};fe.__isInterface__=!0;var Kn=i.$global,o=i.global("$hxClasses")["internal.RecoBackendV2"]=class v extends i.inherits(){[i.new](){}static _requestUri(){return(v._safe_request?"https://":"http://")+v._req_domain+"/api/"+v._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:v._page_visit,channel:v._channel};if(v._consent>=2&&v._history.length>0&&(t.histories=v._buildHistories()),v._consent<2){let u=v.noConsentBody(),f=0,m=I.fields(u);for(;f<m.length;){let g=m[f];++f,t[g]=I.field(u,g)}}else v._user_id!=null&&(t.user_id=v._user_id),t.device_id=v._device_id;let r=0,s=v._others;for(;r<s.length;){let u=s[r];++r,t[u.key]=u.value}let n=I.field(t,"context_item"),l=I.field(t,"context_item_type");return n!=null&&R.string(n)!=""&&(l==null||R.string(l)=="")&&(t.context_item_type="article"),t}static _buildHistories(){let e=[],t=0,r=v._history;for(;t<r.length;){let s=r[t];++t,e.push({id:s,item_type:"article"})}return{pageviews:e}}static requestsToLists(e){let t=[],r="",s=[],n=0,l=[],u=function(c,y,b){r=c,s=y,n=0,l=b},f=function(c){let y=[];if(c==null)return y;let b=0;for(;b<c.length;){let d=c[b];++b,!(d==null||d.key==null||d.key=="")&&y.push({key:d.key,value:d.value})}return y},m=function(c,y){if(c==null&&y==null)return!0;if(c==null||y==null||c.length!=y.length)return!1;let b=new Array(c.length),d=0,k=c.length;for(;d<k;){let O=d++;b[O]=JSON.stringify(c[O])}let _=b,x=new Array(y.length),S=0,D=y.length;for(;S<D;){let O=S++;x[O]=JSON.stringify(y[O])}let N=x;_.sort(I.compare),N.sort(I.compare);let T=0,F=_.length;for(;T<F;){let O=T++;if(_[O]!=N[O])return!1}return!0},g=function(){let c={limit:n,list_name:r,list_size:n},y=0;for(;y<s.length;){let d=s[y];++y;let k=d.value;k instanceof Array||(k=[k]),c[d.key]=k}let b=0;for(;b<l.length;){let d=l[b];++b,c[d.key]=d.value}t.push(c)},p=0;for(;p<e.length;){let c=e[p];++p;let y=f(c.filters),b=c.others!=null?c.others:[];if(r==""){u(c.list,y,b),n+=1;continue}else(r!=c.list||!m(s,y)||!m(l,b))&&(g(),u(c.list,y,b));n+=1}return n!=0&&g(),t}static _requestRecos(e){let t=null,r=new Promise(function(c,y){t=c}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r,l=null,u=new Ve(v._requestUri());u.setHeader("Content-Type","application/json");let f=v.buildRequestBody(e),m=JSON.stringify(f);u.setPostData(m),u.onError=function(c){throw q.thrown("HTTP Request Error: "+c)};try{u.request(!0)}catch(c){let y=q.caught(c).unwrap();throw q.thrown("Failed to execute synchronous request: "+R.string(y)+m)}let g=function(c){let y=JSON.parse(c),b=pe.fromRequestData(y),d=n;d._isFinished||(d._result=b,d._isFinished=!0,d._resolve(b))},p=u.get_responseData();return p!=null?g(p):u.onData=g,n}static getOrder(e,t,r){let s={list_name:e,limit:r.length,list_size:r.length},n={};I.setProperty(n,t,r),I.setProperty(s,"order",n);let l=null,u=new Promise(function(p,c){l=p}),f=u;f._resolve=l,f._isFinished=!1,f._result=null;let m=u,g;return v.getRawRecommendations([s]).then(function(p){let c=[],y=p.lists()[0].items;if(y instanceof Array){let d=0,k=y;for(;d<k.length;){let _=k[d];++d;let x=_.get("categories");x!=null&&c.push(x)}}let b=m;b._isFinished||(b._result=c,b._isFinished=!0,b._resolve(c))}),m}static getRawRecommendations(e){return v._requestRecos(e)}static addHistories(e){v._history=v._history.concat(e)}static setOthers(e,t){let r=0,s=v._others;for(;r<s.length;){let n=s[r];if(++r,n.key==e){n.value=t;return}}v._others.push({key:e,value:t})}static setConsent(e){e>2&&(e=2),v._consent=e,e==2&&v.getDeviceId()=="no-consent"&&v.setDeviceId(Le.v4())}static setChannel(e){v._channel=e}static setPageVisit(e){v._page_visit=e}static setEnvironment(e){v._environment=e}static setDeviceId(e){v._device_id=e}static setUserId(e){v._user_id=e}static setRequestDomain(e){v._req_domain=e}static setSafeRequest(e){v._safe_request=e}static setContextItem(e){v.setOthers("context_item",e)}static setContextItemType(e){v.setOthers("context_item_type",e)}static getRequestDomain(){return v._req_domain}static getSafeRequest(){return v._safe_request}static getEnvironment(){return v._environment}static getPageVisit(){return v._page_visit}static getUserId(){return v._user_id}static getDeviceId(){return v._device_id}static getConsent(){return v._consent}static getChannel(){return v._channel}static getOthers(e){let t=0,r=v._others;for(;t<r.length;){let s=r[t];if(++t,e==s.key)return s.value}return null}static getContextItem(){return v.getOthers("context_item")}static getContextItemType(){return v.getOthers("context_item_type")}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return v}};o._environment=null;o._device_id="no-consent";o._user_id=null;o._consent=0;o._req_domain="europe-west1.froomle.com";o._page_visit=null;o._channel="www-desktop";o._safe_request=!0;o._history=[];o._others=[];var pe=i.global("$hxClasses")["internal._RecommendationsInternal"]=class Ne extends i.inherits(){[i.new](e,t,r,s,n){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=s,this._lists=n}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n=0,l=s.items;for(;n<l.length;){let u=l[n];++n,e.push(u)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let s=r[t];if(++t,s.list_name==e)return s}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n={limit:s.limit,list_key:s.list_key,list_name:s.list_name,list_size:s.list_size,items:[]},l=0,u=s.items;for(;l<u.length;){let f=u[l];++l,n.items.push(be.__cast(f,ie).getData())}e.lists.push(n)}return JSON.stringify(e)}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],s=0;for(;s<t.length;){let n=t[s];++s;let l=I.getProperty(n,"items"),u=[],f=0;for(;f<l.length;){let g=l[f];++f,I.setProperty(g,"request_id",I.getProperty(e,"request_id")),I.setProperty(g,"user_group",I.getProperty(e,"user_group")),u.push(new ie(g))}let m=new ce({limit:I.getProperty(n,"limit"),list_key:I.getProperty(n,"list_key"),list_name:I.getProperty(n,"list_name"),list_size:I.getProperty(n,"list_size"),items:u,request_id:I.getProperty(e,"request_id")});r.push(m)}return new Ne(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[ge]}get __class__(){return Ne}};pe.prototype.request_id=null;pe.prototype.user_group=null;pe.prototype.user_id=null;pe.prototype.device_id=null;pe.prototype._lists=null;var ce=i.global("$hxClasses")["internal._RecommendationsListInternal"]=class ut extends i.inherits(){[i.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size,this.request_id=e.request_id}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[_e]}get __class__(){return ut}};ce.prototype.limit=null;ce.prototype.list_key=null;ce.prototype.list_name=null;ce.prototype.list_size=null;ce.prototype.items=null;ce.prototype.request_id=null;var ie=i.global("$hxClasses")["internal._RecommendationItemInternal"]=class ct extends i.inherits(){[i.new](e){this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group"),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[fe]}get __class__(){return ct}};ie.prototype.Id=null;ie.prototype.RequestId=null;ie.prototype.UserGroup=null;ie.prototype._data=null;var Yn=i.$global,Ue=function(){};Ue.__isInterface__=!0;var rs=i.$global,xe=i.global("$hxClasses")["internal.js.JSFroomleDomTree"]=class De extends i.inherits(){[i.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let r=new DOMParser().parseFromString(e,"text/html"),s=new De;return s.root=r.documentElement,s}static fromDocument(e){let t=new De;return t.root=e.documentElement,t}static get __name__(){return"internal.js.JSFroomleDomTree"}static get __interfaces__(){return[Ue]}get __class__(){return De}};xe.prototype.root=null;var gs=i.$global,oe=i.global("$hxClasses")["internal.domHandler.DomDomDom"]=class re extends i.inherits(){[i.new](){}static _fillRecoTargets(e){let t=null,r=new Promise(function(h,w){t=h}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;if(e==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}let l=[],u=new Array,f=e.querySelectorAll("*"),m=0,g=f.length;for(;m<g;){let h=m++,w=f.item(h);w instanceof HTMLElement&&u.push(w)}let p=u;p.push(e);let c=0;for(;c<p.length;){let h=p[c];++c;let w=0,E=new Array,C=0,A=h.attributes;for(;C<A.length;){let H=A[C];++C,E.push({name:H.name,value:H.value})}let U=E;for(;w<U.length;){let H=U[w];++w,H.name=="data-froomle-reco"&&l.push(h)}}let y=[],b=0;for(;b<l.length;){let h=l[b];++b;let w=h.getAttribute("data-froomle-request-id"),E=h.getAttribute("data-froomle-id"),C=w!=null&&w!="",A=E!=null&&E!="";!C&&!A&&y.push(h)}if(y.length<1){let h=null,w=new Promise(function(C,A){h=C}),E=w;return E._resolve=h,E._isFinished=!1,E._result=null,w}let d=[],k=[],_="",x=[],S=[],D=[],N=function(h,w){if(h.length!=w.length)return!1;let E=new Array(h.length),C=0,A=h.length;for(;C<A;){let $=C++;E[$]=JSON.stringify(h[$])}let U=E,H=new Array(w.length),G=0,K=w.length;for(;G<K;){let $=G++;H[$]=JSON.stringify(w[$])}let W=H;U.sort(I.compare),W.sort(I.compare);let z=0,M=U.length;for(;z<M;){let $=z++;if(U[$]!=W[$])return!1}return!0},T=function(){let h={list_name:_,list_size:S.length,limit:S.length},w=0;for(;w<x.length;){let C=x[w];if(++w,C!=null&&C.key!=null&&C.key!=""){let A=C.value;A instanceof Array||(A=[A]),I.setProperty(h,C.key,A)}}let E=0;for(;E<D.length;){let C=D[E];++E,I.setProperty(h,C.key,C.value)}d.push(h),k.push(S)},F=function(h,w,E,C){_=h,x=w,S=[C],D=E},O=0;for(;O<y.length;){let h=y[O];++O;let w=function(H){let G=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let V=M[z];++z,W.push({name:V.name,value:V.value})}let $=W;for(;K<$.length;){let V=$[K];if(++K,V.name.startsWith("data-froomle-reco-filter-")){let X=j.substr(V.name,25,null),se=V.value;G.push({key:X,value:se})}}return G},E=function(H){let G=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let V=M[z];++z,W.push({name:V.name,value:V.value})}let $=W;for(;K<$.length;){let V=$[K];if(++K,V.name.startsWith("data-froomle-variable-")){let X=j.substr(V.name,22,null),se=V.value;G.push({key:X,value:se})}}return G},C=h.getAttribute("data-froomle-reco"),A=w(h),U=E(h);if(_==""){F(C,A,U,h);continue}else if(C==_&&N(x,A)&&N(D,U)){S.push(h);continue}else{T(),F(C,A,U,h);continue}}_!=""&&T();let B;if(o.getPageVisit()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else if(o.getEnvironment()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else try{B=o.getRawRecommendations(d)}catch{let w=n;return w._isFinished||(w._result=!1,w._isFinished=!0,w._resolve(!1)),n}return B.then(function(h){let w=h.lists(),E=w.length,C=0,A=E;for(;C<A;){let H=C++,G=w[H],K=G.items.length!=k[H].length,W=G.items.length,z=0,M=W;for(;z<M;){let $=z++,V=G.items[$],X=k[H][$];re._fillParameters(X,V,h.request_id)}}let U=n;U._isFinished||(U._result=!0,U._isFinished=!0,U._resolve(!0))}),n}static getAttrByPath(e,t,r){r==null&&(r="fgh");try{t=new we("\\\\[(\\\\w+)\\\\]","g").map(t,function(m){return"."+m.matched(1)}),t=ae.replace(t,"[","."),t=ae.replace(t,"]",""),j.cca(t,0)==46&&(t=j.substr(t,1,null));let n=t.split("."),l=e.get(n[0]),u=1,f=n.length;for(;u<f;){let m=u++;if(l==null)return null;l instanceof Array&&R.parseInt(n[m])!=null?l=l[R.parseInt(n[m])]:l=I.field(l,n[m])}return l}catch{return r}}static _buildHistories(e){let t=[],r=new Array,s=e.querySelectorAll("[data-froomle-id]"),n=0,l=s.length;for(;n<l;){let m=n++,g=s.item(m);g instanceof HTMLElement&&r.push(g)}let u=r,f=0;for(;f<u.length;){let m=u[f];++f,t.push(m.getAttribute("data-froomle-id"))}o.addHistories(t)}static fillParam(e,t,r,s,n){n==null&&(n="");try{let l=re.getAttrByPath(s,r,n);if(t=="inner"){e.textContent=l;let u=e.textContent}else e.setAttribute(t,l)}catch{}}static _fillParameters(e,t,r){e.setAttribute("data-froomle-id",t.get("item_id")),e.setAttribute("data-froomle-request-id",r);let s=t.get("item_type");s!=null&&R.string(s)!=""&&e.setAttribute("data-froomle-item-type",R.string(s)),t.UserGroup!=null&&t.UserGroup!=""&&e.setAttribute("data-froomle-user-group",t.UserGroup);let n=new Array,l=e.querySelectorAll("*"),u=0,f=l.length;for(;u<f;){let p=u++,c=l.item(p);c instanceof HTMLElement&&n.push(c)}let m=n,g=0;for(;g<m.length;){let p=m[g];++g;let c=0,y=new Array,b=0,d=p.attributes;for(;b<d.length;){let _=d[b];++b,y.push({name:_.name,value:_.value})}let k=y;for(;c<k.length;){let _=k[c];if(++c,_.name.startsWith("data-froomle-param-")){let x=ae.replace(_.name,"data-froomle-param-",""),S=_.value;re.fillParam(p,x,S,t)}}}}static _orderElements(e){let t=function(_,x,S){let D=[],N=new Array,T=0,F=_.childNodes;for(;T<F.length;){let E=F[T];++T,N.push(E)}let O=N,B=0;for(;B<O.length;){let E=O[B];++B;try{if(E.getAttribute("data-froomle-ordervalue")!=null){D.push(E);let A=e.createElement("span");A.setAttribute("data-froomle-tmp-node","tmp"),_.replaceChild(A,E)}}catch{}}let h=[],w=0;for(;w<D.length;){let E=D[w];++w,h.push(E.getAttribute("data-froomle-ordervalue"))}return{el:_,key:x,values:h,orderChildren:D,list_name:S}},r=null,s=new Promise(function(_,x){r=_}),n=s;n._resolve=r,n._isFinished=!1,n._result=null;let l=s,u=e.getRoot(),f=new Array,m=u.querySelectorAll("*"),g=0,p=m.length;for(;g<p;){let _=g++,x=m.item(_);x instanceof HTMLElement&&f.push(x)}let c=f,y=[],b=0;for(;b<c.length;){let _=c[b];++b;let x=0,S=new Array,D=0,N=_.attributes;for(;D<N.length;){let F=N[D];++D,S.push({name:F.name,value:F.value})}let T=S;for(;x<T.length;){let F=T[x];++x,F.name.startsWith("data-froomle-order-")&&y.push(t(_,F.name.substring(19),F.value))}}if(y.length<1){let _=l;return _._isFinished||(_._result=!1,_._isFinished=!0,_._resolve(!1)),l}let d=[],k=0;for(;k<y.length;){let _=y[k];++k;let x={list_name:_.list_name,limit:_.values.length,list_size:_.values.length},S={};I.setProperty(S,_.key,_.values),I.setProperty(x,"order",S),d.push(x)}if(o.getPageVisit()==null){let _=l;return _._isFinished||(_._result=!1,_._isFinished=!0,_._resolve(!1)),l}else if(o.getEnvironment()==null){let _=l;return _._isFinished||(_._result=!1,_._isFinished=!0,_._resolve(!1)),l}try{o.getRawRecommendations(d).then(function(_){let x=_.lists(),S=x.length,D=0,N=S;for(;D<N;){let F=D++,O=x[F],B=y[F];B.el.setAttribute("data-froomle-request-id",_.request_id);let h=new Array,w=0,E=O.items;for(;w<E.length;){let M=E[w];++w;let $=M.get(B.key),V=M.get(B.key),X=B.values.length,se=0,de=X;for(;se<de;){let le=se++,he=B.values[le];if($==he){let jt=B.orderChildren.length,Et=B.orderChildren[le];h.push(Et),B.orderChildren.splice(le,1),B.values.splice(le,1);break}}}let C=h.length,A=B.el,U=new Array,H=0,G=A.childNodes;for(;H<G.length;){let M=G[H];++H,U.push(M)}let K=U.length,W=0,z=K;for(;W<z;){let M=W++,$=B.el,V=new Array,X=0,se=$.childNodes;for(;X<se.length;){let he=se[X];++X,V.push(he)}let de=V[M],le;if(de instanceof HTMLElement?le=de.hasAttribute("data-froomle-tmp-node"):le=!1,le){B.el.replaceChild(h[0],de),h.splice(0,1);let he=h.length;if(h.length==0)break}}}let T=l;T._isFinished||(T._result=!0,T._isFinished=!0,T._resolve(!0))})}catch{let x=l;x._isFinished||(x._result=!1,x._isFinished=!0,x._resolve(!1))}return l}static domInit(e){let t=null,r=new Promise(function(l,u){t=l}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;return re._orderElements(e).then(function(l){re._buildHistories(e.getRoot()),re._fillRecoTargets(e.getRoot()).then(function(u){let f=n;f._isFinished||(f._result=!0,f._isFinished=!0,f._resolve(!0))})}),n}static fillElementRecos(e){re._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t;try{let s=new DOMParser().parseFromString(e,"text/html"),n=new xe;n.root=s.documentElement,t=n}catch{return e}return re.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return re}};var hs=i.$global,L=i.global("$hxClasses").FroomleSdk=class ne{static register(){ne.registered||ne._env_set&&ne._page_visit_set&&(ne.registered=!0)}static buildScriptTag(){let e='<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="'+o.getEnvironment()+'" ',t=o.getPageVisit();t!=null&&(e+='data-froomle-page-visit="'+t+'" ');let r=o.getContextItem();if(r!=null){e+='data-froomle-context-item="'+r+'" ';let m=o.getContextItemType();(m==null||m=="")&&(m="article"),e+='data-froomle-context-item-type="'+m+'" '}let s=o.getDeviceId();s!=null&&(e+='data-froomle-device-id="'+s+'" ');let n=o.getUserId();n!=null&&(e+='data-froomle-user-id="'+n+'" ');let l=o.getConsent();l>0&&(e+='data-froomle-consent="'+l+'" ');let u=o.getRequestDomain();u!=null&&(e+='data-froomle-request-domain="'+u+'" ');let f=o.getChannel();return f!=null&&(e+='data-froomle-channel="'+f+'" '),e+="><\/script>",e}static setEnvironment(e){o.setEnvironment(e),ne._env_set=!0,ne.register()}static setDeviceId(e){o.setDeviceId(e)}static setUserId(e){o.setUserId(e)}static setConsent(e){o.setConsent(e)}static setPageVisit(e){o.setPageVisit(e),ne._page_visit_set=!0,ne.register()}static setChannel(e){o.setChannel(e)}static setRequestDomain(e){o.setRequestDomain(e)}static setSafeRequest(e){o.setSafeRequest(e)}static setContextItem(e){o.setContextItem(e)}static setContextItemType(e){o.setContextItemType(e)}static setCustomVariable(e,t){o.setOthers(e,t)}static getUserId(){return o.getUserId()}static getDeviceId(){return o.getDeviceId()}static getEnvironment(){return o.getEnvironment()}static getSafeRequest(){return o.getSafeRequest()}static getPageVisit(){return o.getPageVisit()}static getConsent(){return o.getConsent()}static getRecommendations(e){return o.getRawRecommendations(e)}static getChannel(){return o.getChannel()}static getVersion(){return"0.0.11"}static runFromHtml(e){return oe.runFromHtml(e)}static get __name__(){return"FroomleSdk"}get __class__(){return ne}};L._env_set=!1;L._page_visit_set=!1;L.registered=!1;var vs=i.$global;function mt(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}function Ae(){return o.getConsent()>=1}function gt(){return o.getConsent()<2?"no-consent":o.getDeviceId()}function _t(){let a=o.getChannel();if(a)return a}function Bt(a){let e=(a==null?void 0:a.getAttribute("data-froomle-id"))||(a==null?void 0:a.getAttribute("data-froomle-action-item"));if(e)return e}function Ht(a){let e=(a==null?void 0:a.getAttribute("data-froomle-item-type"))||(a==null?void 0:a.getAttribute("data-froomle-action-item-type"));if(e)return e}function ft(a){var r;let e=a==null?void 0:a.getAttribute("data-froomle-user-group");return e||(typeof document=="undefined"?void 0:((r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group"))||void 0)}function pt(a,e,t="impression",r){if(!Ae())return;let s=_t()||"www-desktop",n={event_type:t,page_type:o.getPageVisit(),action_item:a,action_item_type:e,channel:s,device_id:gt()},l=ft();if(l&&(n.user_group=l),r)for(let u in r)n[u]=r[u];try{fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({events:[n]})})}catch{}}var P=class P{static queueIfNotPresent(e){P.impressionQueue.includes(e)||P.impressionQueue.push(e)}static generateBody(){let e=[];for(let t of P.impressionQueue){let r=Bt(t);if(!r)continue;let s=Ht(t)||"article",n=_t()||"www-desktop",l={event_type:"impression",page_type:o.getPageVisit(),action_item:r,action_item_type:s,channel:n,device_id:gt()},u=ft(t);u&&(l.user_group=u),o.getConsent()>=2&&o.getUserId()&&(l.user_id=o.getUserId());let f=t.getAttribute("data-froomle-reco"),m=t.getAttribute("data-froomle-request-id");f&&m&&(l.list_name=f,l.request_id=m),e.push(l)}return P.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){console.log(P.impressionQueue),P.impressionQueue.length!==0&&Ae()&&fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:P.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=P.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){P.observer.observe(e)}static processDocument(){if(Ae()){console.log("\u{1F680} Processing document for impressions");for(let e of document.querySelectorAll("[data-froomle-id]"))P.intersectsWithViewPortRect(e)?P.queueIfNotPresent(e):P.addIntersectionImpressionListener(e);P.sendImpressions()}}static processElement(e){if(!Ae()||!(e instanceof Element))return;let t=[];e.matches("[data-froomle-id]")&&t.push(e);for(let r of e.querySelectorAll("[data-froomle-id]"))t.push(r);if(t.length!==0){for(let r of t)P.intersectsWithViewPortRect(r)?P.queueIfNotPresent(r):P.addIntersectionImpressionListener(r);P.sendImpressions()}}};P.impressionQueue=[],P.observer=null;var Q=P;typeof document!="undefined"&&(Q.observer=new IntersectionObserver((a,e)=>{a.forEach(t=>{t.isIntersecting&&(Q.impressionQueue.push(t.target),Q.observer.unobserve(t.target))}),Q.impressionQueue.length>0&&Q.sendImpressions()}));var Ie=class a{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=a.readChannel()||"www-desktop",t={event_type:"page_visit",page_type:o.getPageVisit(),channel:e,device_id:a.readDeviceId()},r=a.readUserGroup();return r&&(t.user_group=r),o.getConsent()>=2&&o.getUserId()&&(t.user_id=o.getUserId()),JSON.stringify({events:[t]})}static sendPageVisit(){o.getPageVisit()&&(o.getContextItem()||a.canTrackEvents()&&fetch(a.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:a.generateBody()}))}};var Ee=class a{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItemType(){let e=o.getContextItemType();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=a.readActionItemType()||"article",t=a.readChannel()||"www-desktop",r={event_type:"detail_pageview",page_type:o.getPageVisit(),action_item:o.getContextItem(),action_item_type:e,channel:t,device_id:a.readDeviceId()},s=a.readUserGroup();return s&&(r.user_group=s),o.getConsent()>=2&&o.getUserId()&&(r.user_id=o.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){o.getContextItem()&&o.getPageVisit()&&a.canTrackEvents()&&fetch(a.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:a.generateBody()})}};var ee=class ee{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItem(e){let t=e.getAttribute("data-froomle-id")||e.getAttribute("data-froomle-action-item");if(t)return t}static readActionItemType(e){let t=e.getAttribute("data-froomle-item-type")||e.getAttribute("data-froomle-action-item-type");if(t)return t}static readUserGroup(e){var s;let t=e.getAttribute("data-froomle-user-group");return t||(typeof document=="undefined"?void 0:((s=document.querySelector("[data-froomle-user-group]"))==null?void 0:s.getAttribute("data-froomle-user-group"))||void 0)}static registerClickables(){ee.listenerRegistered||(ee.listenerRegistered=!0,document.addEventListener("click",e=>{if(!ee.canTrackEvents())return;let t=e instanceof MouseEvent?e:null,r=e.target,s=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!s)return;let n=s.closest("a");if(!n)return;let l=n.closest("[data-froomle-id]");if(!l)return;let u=ee.readActionItem(l);if(!u)return;let f=ee.readActionItemType(l)||"article",m=ee.readChannel()||"www-desktop",g=n instanceof HTMLAnchorElement?n.href:null,p=!!g&&e.cancelable&&!e.defaultPrevented&&!n.hasAttribute("download")&&(!n.target||n.target==="_self")&&!!t&&t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey;p&&e.preventDefault();let c={event_type:"click_on_recommendation",page_type:o.getPageVisit(),action_item:u,action_item_type:f,channel:m,device_id:ee.readDeviceId()},y=ee.readUserGroup(l);y&&(c.user_group=y);let b=l.getAttribute("data-froomle-reco"),d=l.getAttribute("data-froomle-request-id");b&&d&&(c.list_name=b,c.request_id=d),o.getConsent()>=2&&o.getUserId()&&(c.user_id=o.getUserId());let _=(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events",x=JSON.stringify({events:[c]}),S=new Blob([x],{type:"application/json"}),D=()=>fetch(_,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:x,keepalive:!0});if(p&&g){let T=!1,F=()=>{T||(T=!0,window.location.assign(g))},O=window.setTimeout(F,200);D().catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(_,S)}).finally(()=>{window.clearTimeout(O),F()});return}typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(_,S)||D().catch(()=>{})},!0))}};ee.listenerRegistered=!1;var Re=ee;var dt=xe,ht=L.setEnvironment,yt=L.setPageVisit,bt=L.setRequestDomain,vt=L.setSafeRequest,wt=typeof L.setChannel=="function"?L.setChannel:o.setChannel,xt=L.setContextItem,It=L.setContextItemType,Vt=L.setCustomVariable,Lt=o.addHistories;function Me(a){L.setUserId(a),document.cookie=`froomle_user_id=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Je(a){L.setDeviceId(a),document.cookie=`froomle_device_id=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Ge(a){L.setConsent(a),document.cookie=`froomle_consent=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${L.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window!="undefined"&&(window.setFroomleConsent=Ge);function je(a){let e=document.cookie.split("; ");for(let t of e){let[r,s]=t.split("=");if(r===a)return decodeURIComponent(s)}return null}var Nt=L.getRecommendations;if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document!="undefined")){let a=document.currentScript;if(a){let t=a.getAttribute("data-froomle-device-id"),r=a.getAttribute("data-froomle-user-id"),s=a.getAttribute("data-froomle-env"),n=a.getAttribute("data-froomle-page-visit"),l=a.getAttribute("data-froomle-request-domain"),u=a.getAttribute("data-froomle-context-item"),f=a.getAttribute("data-froomle-context-item-type"),m=a.getAttribute("data-froomle-safe-request"),g=a.getAttribute("data-froomle-channel");if(ht(s),n&&yt(n),u&&(xt(u),It(f||"article")),t)Je(t);else{let p=je("froomle_device_id");p&&Je(p)}if(r)Me(r);else{let p=je("froomle_user_id");p&&Me(p)}l&&bt(l),m&&vt(m!=="false"),g&&wt(g)}let e=je("froomle_consent");e&&Ge(e),document.addEventListener("DOMContentLoaded",()=>{console.log("froomle loads dom"),oe.domInit(dt.fromDocument(document)).then(s=>{Re.registerClickables(),Q.processDocument(),Ie.sendPageVisit(),Ee.sendPageView()});function t(s){return s.matches("[data-froomle-reco]")||s.querySelector("[data-froomle-reco]")!==null}new MutationObserver(s=>{for(let n of s)if(n.type==="childList"&&n.addedNodes.forEach(l=>{l instanceof Element&&(t(l)&&oe.fillElementRecos(l),Q.processElement(l))}),n.type==="attributes"&&n.target instanceof Element)if(n.attributeName==="data-froomle-reco"){let l=n.target.getAttribute("data-froomle-request-id");(!l||l==="")&&oe.fillElementRecos(n.target)}else if(n.attributeName==="data-froomle-request-id"){let l=n.target.getAttribute("data-froomle-request-id"),u=n.target.getAttribute("data-froomle-id");n.target.getAttribute("data-froomle-reco")&&(!l||l==="")&&(!u||u==="")&&oe.fillElementRecos(n.target)}else n.attributeName==="data-froomle-id"&&Q.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-froomle-reco","data-froomle-request-id","data-froomle-id"]})})}return Dt(Ut);})();
|
|
4
|
+
`+t+"}",n;break;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let i=0,n=r.length;for(;i<n;){let l=i++,u=r[l];if(u==t||J.__interfLoop(u,t))return!0}}return J.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case"$hxCoreType__Bool":return typeof e=="boolean";case"$hxCoreType__Dynamic":return e!=null;case"$hxCoreType__Float":return typeof e=="number";case"$hxCoreType__Int":return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(J.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&J.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t=="$hxCoreType__Class"&&e.__name__!=null||t=="$hxCoreType__Enum"&&e.__ename__!=null?!0:e.__enum__!=null?s.global("$hxEnums")[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?J.__interfLoop(J.getClass(e),t):!1}static __cast(e,t){if(e==null||J.__instanceof(e,t))return e;throw q.thrown("Cannot cast "+E.string(e)+" to "+E.string(t))}static __nativeClassName(e){let t=J.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return J.__nativeClassName(e)!=null}static __resolveNativeClass(e){return s.$global[e]}static get __name__(){return"js.Boot"}get __class__(){return J}};be.__toStr={}.toString;var mr=s.$global,Te=s.global("$hxClasses")["js.Browser"]=class Qe{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw q.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return Qe}};var fr=s.$global,Y=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(a=>({_hx_index:3,__enum__:"haxe.io.Error",e:a}),{_hx_name:"Custom",__params__:["e"]})};Y.__constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds,Y.Custom];Y.__empty_constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds];var hr=s.$global,te=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};te.__constructs__=[te.UTF8,te.RawNative];te.__empty_constructs__=[te.UTF8,te.RawNative];var Ir=s.$global,me=s.global("$hxClasses")["haxe.io.Bytes"]=class Fe extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw q.thrown(Y.OutsideBounds);r==null&&(r=te.UTF8);let i="",n=this.b,l=e,u=e+t;switch(r._hx_index){case 0:let g=e>0;for(;l<u;){let m=n[l++];if(m<128){if(m==0)break;i+=String.fromCodePoint(m)}else if(m<224){let _=(m&63)<<6|n[l++]&127;i+=String.fromCodePoint(_)}else if(m<240){let _=n[l++],f=(m&31)<<12|(_&127)<<6|n[l++]&127;i+=String.fromCodePoint(f)}else{let _=n[l++],f=n[l++],c=(m&15)<<18|(_&127)<<12|(f&127)<<6|n[l++]&127;i+=String.fromCodePoint(c)}}break;case 1:for(;l<u;){let m=n[l++]|n[l++]<<8;i+=String.fromCodePoint(m)}break}return i}static ofData(e){let t=e.hxBytes;return t!=null?t:new Fe(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Fe}};me.prototype.length=null;me.prototype.b=null;var Sr=s.$global,Z=s.global("$hxClasses")["haxe.http.HttpBase"]=class Xe extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,i=this.headers.length;for(;r<i;){let n=r++;if(this.headers[n].name==e){this.headers[n]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,te.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return Xe}};Z.prototype.url=null;Z.prototype.responseBytes=null;Z.prototype.responseAsString=null;Z.prototype.postData=null;Z.prototype.postBytes=null;Z.prototype.headers=null;Z.prototype.params=null;Z.prototype.emptyOnData=null;var Dr=s.$global,Se=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Ye extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Ye}};Se.prototype.map=null;Se.prototype.keys=null;var Pr=s.$global,Oe=function(){};Oe.__isInterface__=!0;var Br=s.$global,ke=s.global("$hxClasses")["genes.util.EsMap"]=class ve extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return ve.adaptIterator(this.inst.keys())}iterator(){return ve.adaptIterator(this.inst.values())}toString(){let e=[],t=ve.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+E.string(r)+" => "+E.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,i=function(){let n=e.next();t=n.value,r=n.done};return{hasNext:function(){return r==null&&i(),!r},next:function(){r==null&&i();let n=t;return i(),n}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return ve}};ke.prototype.inst=null;var jr=s.$global,Ze=s.global("$hxClasses")["haxe.ds.StringMap"]=class Be extends s.inherits(ke){[s.new](){super[s.new]()}copy(){let e=new Be;return e.inst=new Map(this.inst),e}keyValueIterator(){return new Se(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Oe]}static get __super__(){return ke}get __class__(){return Be}};var Gr=s.$global,j=s.global("$hxClasses").HxOverrides=class et{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return et}};typeof performance!="undefined"&&typeof performance.now=="function"&&(j.now=performance.now.bind(performance));var Qr=s.$global,ae=s.global("$hxClasses").StringTools=class qe{static isSpace(e,t){let r=j.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&qe.isSpace(e,r);)++r;return r>0?j.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&qe.isSpace(e,t-r-1);)++r;return r>0?j.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return qe}};var Zr=s.$global,tt=s.global("$hxClasses").Lambda=class rt{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let i=r.next();if(t(i))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return rt}};var ln=s.$global,we=s.global("$hxClasses").EReg=class nt extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw q.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw q.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:j.substr(e,0,t+r));let i=this.r.m!=null;return i&&(this.r.s=e),i}else{let i=this.match(r<0?j.substr(e,t,null):j.substr(e,t,r));return i&&(this.r.s=e,this.r.m.index+=t),i}}map(e,t){let r=0,i="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){i+=E.string(j.substr(e,r,null));break}let n=this.matchedPos();i+=E.string(j.substr(e,r,n.pos-r)),i+=E.string(t(this)),n.len==0?(i+=E.string(j.substr(e,n.pos,1)),r=n.pos+1):r=n.pos+n.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(i+=E.string(j.substr(e,r,null))),i}static get __name__(){return"EReg"}get __class__(){return nt}};we.prototype.r=null;var yn=s.$global,ue=s.global("$hxClasses")["haxe.http.HttpJs"]=class it extends s.inherits(Z){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=Te.createXMLHttpRequest(),r=this,i=function(_){if(t.readyState!=4)return;let f;try{f=t.status}catch{f=null}if(f==0&&Te.get_supported()&&s.$global.location!=null){let c=s.$global.location.protocol.toLowerCase();new we("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(c)&&(f=t.response!=null?200:404)}if(f==null&&(f=null),f!=null&&r.onStatus(f),f!=null&&f>=200&&f<400){r.req=null;let c=t.getAllResponseHeaders().split(`\r
|
|
5
|
+
`),y=[],b=0,d=c;for(;b<d.length;){let x=d[b];++b,x!=""&&y.push(x)}c=y;let k=new Ze;r.responseHeaders=k;let p=0;for(;p<c.length;){let x=c[p];++p;let S=x.split(": "),D=S.shift(),N=S.length==1?S[0]:S.join(": ");N=ae.ltrim(ae.rtrim(N)),r.responseHeaders.inst.set(D,N)}r.success(me.ofData(t.response))}else if(f==null||f==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(f==null){r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}else switch(f){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=i);let n,l=this.postData,u=this.postBytes;if(l==null)if(u==null)n=null;else{let _=u;n=new Blob([_.b.bufferValue])}else u==null?n=l:n=null;if(n!=null)e=!0;else{let _=0,f=this.params;for(;_<f.length;){let c=f[_];++_,n==null?n="":n=(n==null?"null":E.string(n))+"&";let y=c.name,b=(n==null?"null":E.string(n))+encodeURIComponent(y)+"=",d=c.value;n=b+encodeURIComponent(d)}}try{if(e)t.open("POST",this.url,this.async);else if(n!=null){let _=this.url.split("?").length<=1;t.open("GET",this.url+(_?"?":"&")+(n==null?"null":E.string(n)),this.async),n=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(_){let f=q.caught(_).unwrap();this.req=null,this.onError(f.toString());return}t.withCredentials=this.withCredentials,!tt.exists(this.headers,function(_){return _.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let g=0,m=this.headers;for(;g<m.length;){let _=m[g];++g,t.setRequestHeader(_.name,_.value)}t.send(n),this.async||i(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return Z}get __class__(){return it}};ue.prototype.async=null;ue.prototype.withCredentials=null;ue.prototype.responseHeaders=null;ue.prototype.req=null;var wn=s.$global,He=s.global("$hxClasses").Type=class st{static createInstance(e,t){let r=Function.prototype.bind.apply(e,[null].concat(t));return new r}static get __name__(){return"Type"}get __class__(){return st}};var En=s.$global,I=s.global("$hxClasses").Reflect=class lt{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let i;return e.__properties__?(r=e.__properties__["get_"+t],i=r):i=!1,i?e[r]():e[t]}}static setProperty(e,t,r){let i,n;e.__properties__?(i=e.__properties__["set_"+t],n=i):n=!1,n?e[i](r):e[t]=r}static fields(e){let t=[];if(e!=null){let i=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&i.call(e,r)&&t.push(r)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return"Reflect"}get __class__(){return lt}};var $n=s.$global,Ve=s.global("$hxClasses")["internal.http.FetchHttp"]=class ot extends s.inherits(ue){[s.new](e){this.responseStatus=0,super[s.new](e)}request(e){let t=s.$global,r=t.fetch,i=t.Headers,n=t.URLSearchParams;if(r==null){this.onError("Fetch API not found.");return}let l=He.createInstance(i,[]),u=0,g=this.headers;for(;u<g.length;){let d=g[u];++u,l.append(d.name,d.value)}let m=e?"POST":"GET",_=null;if(e)if(this.postData!=null)_=this.postData;else{_=He.createInstance(n,[]);let d=0,k=this.params;for(;d<k.length;){let p=k[d];++d,_.append(p.name,p.value)}}let f={method:m,headers:l,body:_},c=this,y=r(this.url,f).then(function(d){if(c.responseStatus=d.status,c.onStatus(d.status),d.ok)return d.text();throw q.thrown("HTTP Error: "+E.string(d.status))}).then(function(d){c.onData(d)}),b=I.field(y,"catch");b!=null&&b.apply(y,[function(d){c.onError(E.string(d))}])}static get __name__(){return"internal.http.FetchHttp"}static get __super__(){return ue}get __class__(){return ot}};Ve.prototype.responseStatus=null;var On=s.$global,Le=s.global("$hxClasses")["internal.data.UUID"]=class at{static randomHexChar(){return"0123456789abcdef".charAt(E.random(16))}static v4(){let e="",t=0;for(;t<36;)switch(t++){case 14:e+="4";break;case 19:e+=E.string("0123456789abcdef".charAt(8+E.random(4)));break;case 8:case 13:case 18:case 23:e+="-";break;default:e+=E.string("0123456789abcdef".charAt(E.random(16)))}return e}static get __name__(){return"internal.data.UUID"}get __class__(){return at}};Le.HEX="0123456789abcdef";var Vn=s.$global,ge=function(){};ge.__isInterface__=!0;var _e=function(){};_e.__isInterface__=!0;var fe=function(){};fe.__isInterface__=!0;var Kn=s.$global,o=s.global("$hxClasses")["internal.RecoBackendV2"]=class v extends s.inherits(){[s.new](){}static _requestUri(){return(v._safe_request?"https://":"http://")+v._req_domain+"/api/"+v._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:v._page_visit,channel:v._channel};if(v._consent>=2&&v._history.length>0&&(t.histories=v._buildHistories()),v._consent<2){let u=v.noConsentBody(),g=0,m=I.fields(u);for(;g<m.length;){let _=m[g];++g,t[_]=I.field(u,_)}}else v._user_id!=null&&(t.user_id=v._user_id),t.device_id=v._device_id;let r=0,i=v._others;for(;r<i.length;){let u=i[r];++r,t[u.key]=u.value}let n=I.field(t,"context_item"),l=I.field(t,"context_item_type");return n!=null&&E.string(n)!=""&&(l==null||E.string(l)=="")&&(t.context_item_type="article"),t}static _buildHistories(){return{pageviews:v._history}}static requestsToLists(e){let t=[],r="",i=[],n=0,l=[],u=function(c,y,b){r=c,i=y,n=0,l=b},g=function(c){let y=[];if(c==null)return y;let b=0;for(;b<c.length;){let d=c[b];++b,!(d==null||d.key==null||d.key=="")&&y.push({key:d.key,value:d.value})}return y},m=function(c,y){if(c==null&&y==null)return!0;if(c==null||y==null||c.length!=y.length)return!1;let b=new Array(c.length),d=0,k=c.length;for(;d<k;){let O=d++;b[O]=JSON.stringify(c[O])}let p=b,x=new Array(y.length),S=0,D=y.length;for(;S<D;){let O=S++;x[O]=JSON.stringify(y[O])}let N=x;p.sort(I.compare),N.sort(I.compare);let T=0,F=p.length;for(;T<F;){let O=T++;if(p[O]!=N[O])return!1}return!0},_=function(){let c={limit:n,list_name:r,list_size:n},y=0;for(;y<i.length;){let d=i[y];++y;let k=d.value;k instanceof Array||(k=[k]),c[d.key]=k}let b=0;for(;b<l.length;){let d=l[b];++b,c[d.key]=d.value}t.push(c)},f=0;for(;f<e.length;){let c=e[f];++f;let y=g(c.filters),b=c.others!=null?c.others:[];if(r==""){u(c.list,y,b),n+=1;continue}else(r!=c.list||!m(i,y)||!m(l,b))&&(_(),u(c.list,y,b));n+=1}return n!=0&&_(),t}static _requestRecos(e){let t=null,r=new Promise(function(c,y){t=c}),i=r;i._resolve=t,i._isFinished=!1,i._result=null;let n=r,l=null,u=new Ve(v._requestUri());u.setHeader("Content-Type","application/json");let g=v.buildRequestBody(e),m=JSON.stringify(g);u.setPostData(m),u.onError=function(c){throw q.thrown("HTTP Request Error: "+c)};try{u.request(!0)}catch(c){let y=q.caught(c).unwrap();throw q.thrown("Failed to execute synchronous request: "+E.string(y)+m)}let _=function(c){let y=JSON.parse(c),b=pe.fromRequestData(y),d=n;d._isFinished||(d._result=b,d._isFinished=!0,d._resolve(b))},f=u.get_responseData();return f!=null?_(f):u.onData=_,n}static getOrder(e,t,r){let i={list_name:e,limit:r.length,list_size:r.length},n={};I.setProperty(n,t,r),I.setProperty(i,"order",n);let l=null,u=new Promise(function(f,c){l=f}),g=u;g._resolve=l,g._isFinished=!1,g._result=null;let m=u,_;return v.getRawRecommendations([i]).then(function(f){let c=[],y=f.lists()[0].items;if(y instanceof Array){let d=0,k=y;for(;d<k.length;){let p=k[d];++d;let x=p.get("categories");x!=null&&c.push(x)}}let b=m;b._isFinished||(b._result=c,b._isFinished=!0,b._resolve(c))}),m}static getRawRecommendations(e){return v._requestRecos(e)}static addHistories(e,t){if(t==null&&(t="article"),e==null||e.length==0)return;let r=t!=null&&t!=""?t:"article",i=0;for(;i<e.length;){let n=e[i];if(++i,typeof n=="string"){let f=E.string(n);f!=""&&v._history.push({id:f,item_type:r});continue}let l=n,u=I.field(l,"id");if(u==null)continue;let g=E.string(u);if(g=="")continue;let m=I.field(l,"item_type");(m==null||E.string(m)=="")&&(m=I.field(l,"itemType"));let _=m!=null&&E.string(m)!=""?E.string(m):r;v._history.push({id:g,item_type:_})}}static setOthers(e,t){let r=0,i=v._others;for(;r<i.length;){let n=i[r];if(++r,n.key==e){n.value=t;return}}v._others.push({key:e,value:t})}static setConsent(e){e>2&&(e=2),v._consent=e,e==2&&v.getDeviceId()=="no-consent"&&v.setDeviceId(Le.v4())}static setChannel(e){v._channel=e}static setPageVisit(e){v._page_visit=e}static setEnvironment(e){v._environment=e}static setDeviceId(e){v._device_id=e}static setUserId(e){v._user_id=e}static setRequestDomain(e){v._req_domain=e}static setSafeRequest(e){v._safe_request=e}static setContextItem(e){v.setOthers("context_item",e)}static setContextItemType(e){v.setOthers("context_item_type",e)}static getRequestDomain(){return v._req_domain}static getSafeRequest(){return v._safe_request}static getEnvironment(){return v._environment}static getPageVisit(){return v._page_visit}static getUserId(){return v._user_id}static getDeviceId(){return v._device_id}static getConsent(){return v._consent}static getChannel(){return v._channel}static getOthers(e){let t=0,r=v._others;for(;t<r.length;){let i=r[t];if(++t,e==i.key)return i.value}return null}static getContextItem(){return v.getOthers("context_item")}static getContextItemType(){return v.getOthers("context_item_type")}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return v}};o._environment=null;o._device_id="no-consent";o._user_id=null;o._consent=0;o._req_domain="europe-west1.froomle.com";o._page_visit=null;o._channel="www-desktop";o._safe_request=!0;o._history=[];o._others=[];var pe=s.global("$hxClasses")["internal._RecommendationsInternal"]=class Ne extends s.inherits(){[s.new](e,t,r,i,n){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=i,this._lists=n}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let i=r[t];++t;let n=0,l=i.items;for(;n<l.length;){let u=l[n];++n,e.push(u)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let i=r[t];if(++t,i.list_name==e)return i}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,r=this._lists;for(;t<r.length;){let i=r[t];++t;let n={limit:i.limit,list_key:i.list_key,list_name:i.list_name,list_size:i.list_size,items:[]},l=0,u=i.items;for(;l<u.length;){let g=u[l];++l,n.items.push(be.__cast(g,se).getData())}e.lists.push(n)}return JSON.stringify(e)}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],i=0;for(;i<t.length;){let n=t[i];++i;let l=I.getProperty(n,"items"),u=[],g=0;for(;g<l.length;){let _=l[g];++g,I.setProperty(_,"request_id",I.getProperty(e,"request_id")),I.setProperty(_,"user_group",I.getProperty(e,"user_group")),u.push(new se(_))}let m=new ce({limit:I.getProperty(n,"limit"),list_key:I.getProperty(n,"list_key"),list_name:I.getProperty(n,"list_name"),list_size:I.getProperty(n,"list_size"),items:u,request_id:I.getProperty(e,"request_id")});r.push(m)}return new Ne(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[ge]}get __class__(){return Ne}};pe.prototype.request_id=null;pe.prototype.user_group=null;pe.prototype.user_id=null;pe.prototype.device_id=null;pe.prototype._lists=null;var ce=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class ut extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size,this.request_id=e.request_id}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[_e]}get __class__(){return ut}};ce.prototype.limit=null;ce.prototype.list_key=null;ce.prototype.list_name=null;ce.prototype.list_size=null;ce.prototype.items=null;ce.prototype.request_id=null;var se=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class ct extends s.inherits(){[s.new](e){this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group"),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[fe]}get __class__(){return ct}};se.prototype.Id=null;se.prototype.RequestId=null;se.prototype.UserGroup=null;se.prototype._data=null;var Yn=s.$global,Ue=function(){};Ue.__isInterface__=!0;var ri=s.$global,xe=s.global("$hxClasses")["internal.js.JSFroomleDomTree"]=class De extends s.inherits(){[s.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let r=new DOMParser().parseFromString(e,"text/html"),i=new De;return i.root=r.documentElement,i}static fromDocument(e){let t=new De;return t.root=e.documentElement,t}static get __name__(){return"internal.js.JSFroomleDomTree"}static get __interfaces__(){return[Ue]}get __class__(){return De}};xe.prototype.root=null;var gi=s.$global,oe=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class re extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=null,r=new Promise(function(h,w){t=h}),i=r;i._resolve=t,i._isFinished=!1,i._result=null;let n=r;if(e==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}let l=[],u=new Array,g=e.querySelectorAll("*"),m=0,_=g.length;for(;m<_;){let h=m++,w=g.item(h);w instanceof HTMLElement&&u.push(w)}let f=u;f.push(e);let c=0;for(;c<f.length;){let h=f[c];++c;let w=0,R=new Array,C=0,A=h.attributes;for(;C<A.length;){let H=A[C];++C,R.push({name:H.name,value:H.value})}let U=R;for(;w<U.length;){let H=U[w];++w,H.name=="data-froomle-reco"&&l.push(h)}}let y=[],b=0;for(;b<l.length;){let h=l[b];++b;let w=h.getAttribute("data-froomle-request-id"),R=h.getAttribute("data-froomle-id"),C=w!=null&&w!="",A=R!=null&&R!="";!C&&!A&&y.push(h)}if(y.length<1){let h=null,w=new Promise(function(C,A){h=C}),R=w;return R._resolve=h,R._isFinished=!1,R._result=null,w}let d=[],k=[],p="",x=[],S=[],D=[],N=function(h,w){if(h.length!=w.length)return!1;let R=new Array(h.length),C=0,A=h.length;for(;C<A;){let $=C++;R[$]=JSON.stringify(h[$])}let U=R,H=new Array(w.length),G=0,K=w.length;for(;G<K;){let $=G++;H[$]=JSON.stringify(w[$])}let W=H;U.sort(I.compare),W.sort(I.compare);let z=0,M=U.length;for(;z<M;){let $=z++;if(U[$]!=W[$])return!1}return!0},T=function(){let h={list_name:p,list_size:S.length,limit:S.length},w=0;for(;w<x.length;){let C=x[w];if(++w,C!=null&&C.key!=null&&C.key!=""){let A=C.value;A instanceof Array||(A=[A]),I.setProperty(h,C.key,A)}}let R=0;for(;R<D.length;){let C=D[R];++R,I.setProperty(h,C.key,C.value)}d.push(h),k.push(S)},F=function(h,w,R,C){p=h,x=w,S=[C],D=R},O=0;for(;O<y.length;){let h=y[O];++O;let w=function(H){let G=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let V=M[z];++z,W.push({name:V.name,value:V.value})}let $=W;for(;K<$.length;){let V=$[K];if(++K,V.name.startsWith("data-froomle-reco-filter-")){let X=j.substr(V.name,25,null),ie=V.value;G.push({key:X,value:ie})}}return G},R=function(H){let G=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let V=M[z];++z,W.push({name:V.name,value:V.value})}let $=W;for(;K<$.length;){let V=$[K];if(++K,V.name.startsWith("data-froomle-variable-")){let X=j.substr(V.name,22,null),ie=V.value;G.push({key:X,value:ie})}}return G},C=h.getAttribute("data-froomle-reco"),A=w(h),U=R(h);if(p==""){F(C,A,U,h);continue}else if(C==p&&N(x,A)&&N(D,U)){S.push(h);continue}else{T(),F(C,A,U,h);continue}}p!=""&&T();let B;if(o.getPageVisit()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else if(o.getEnvironment()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else try{B=o.getRawRecommendations(d)}catch{let w=n;return w._isFinished||(w._result=!1,w._isFinished=!0,w._resolve(!1)),n}return B.then(function(h){let w=h.lists(),R=w.length,C=0,A=R;for(;C<A;){let H=C++,G=w[H],K=G.items.length!=k[H].length,W=G.items.length,z=0,M=W;for(;z<M;){let $=z++,V=G.items[$],X=k[H][$];re._fillParameters(X,V,h.request_id)}}let U=n;U._isFinished||(U._result=!0,U._isFinished=!0,U._resolve(!0))}),n}static getAttrByPath(e,t,r){r==null&&(r="fgh");try{t=new we("\\\\[(\\\\w+)\\\\]","g").map(t,function(m){return"."+m.matched(1)}),t=ae.replace(t,"[","."),t=ae.replace(t,"]",""),j.cca(t,0)==46&&(t=j.substr(t,1,null));let n=t.split("."),l=e.get(n[0]),u=1,g=n.length;for(;u<g;){let m=u++;if(l==null)return null;l instanceof Array&&E.parseInt(n[m])!=null?l=l[E.parseInt(n[m])]:l=I.field(l,n[m])}return l}catch{return r}}static _buildHistories(e){let t=[],r=new Array,i=e.querySelectorAll("[data-froomle-id]"),n=0,l=i.length;for(;n<l;){let m=n++,_=i.item(m);_ instanceof HTMLElement&&r.push(_)}let u=r,g=0;for(;g<u.length;){let m=u[g];++g,t.push(m.getAttribute("data-froomle-id"))}o.addHistories(t)}static fillParam(e,t,r,i,n){n==null&&(n="");try{let l=re.getAttrByPath(i,r,n);if(t=="inner"){e.textContent=l;let u=e.textContent}else e.setAttribute(t,l)}catch{}}static _fillParameters(e,t,r){e.setAttribute("data-froomle-id",t.get("item_id")),e.setAttribute("data-froomle-request-id",r);let i=t.get("item_type");i!=null&&E.string(i)!=""&&e.setAttribute("data-froomle-item-type",E.string(i)),t.UserGroup!=null&&t.UserGroup!=""&&e.setAttribute("data-froomle-user-group",t.UserGroup);let n=new Array,l=e.querySelectorAll("*"),u=0,g=l.length;for(;u<g;){let f=u++,c=l.item(f);c instanceof HTMLElement&&n.push(c)}let m=n,_=0;for(;_<m.length;){let f=m[_];++_;let c=0,y=new Array,b=0,d=f.attributes;for(;b<d.length;){let p=d[b];++b,y.push({name:p.name,value:p.value})}let k=y;for(;c<k.length;){let p=k[c];if(++c,p.name.startsWith("data-froomle-param-")){let x=ae.replace(p.name,"data-froomle-param-",""),S=p.value;re.fillParam(f,x,S,t)}}}}static _orderElements(e){let t=function(p,x,S){let D=[],N=new Array,T=0,F=p.childNodes;for(;T<F.length;){let R=F[T];++T,N.push(R)}let O=N,B=0;for(;B<O.length;){let R=O[B];++B;try{if(R.getAttribute("data-froomle-ordervalue")!=null){D.push(R);let A=e.createElement("span");A.setAttribute("data-froomle-tmp-node","tmp"),p.replaceChild(A,R)}}catch{}}let h=[],w=0;for(;w<D.length;){let R=D[w];++w,h.push(R.getAttribute("data-froomle-ordervalue"))}return{el:p,key:x,values:h,orderChildren:D,list_name:S}},r=null,i=new Promise(function(p,x){r=p}),n=i;n._resolve=r,n._isFinished=!1,n._result=null;let l=i,u=e.getRoot(),g=new Array,m=u.querySelectorAll("*"),_=0,f=m.length;for(;_<f;){let p=_++,x=m.item(p);x instanceof HTMLElement&&g.push(x)}let c=g,y=[],b=0;for(;b<c.length;){let p=c[b];++b;let x=0,S=new Array,D=0,N=p.attributes;for(;D<N.length;){let F=N[D];++D,S.push({name:F.name,value:F.value})}let T=S;for(;x<T.length;){let F=T[x];++x,F.name.startsWith("data-froomle-order-")&&y.push(t(p,F.name.substring(19),F.value))}}if(y.length<1){let p=l;return p._isFinished||(p._result=!1,p._isFinished=!0,p._resolve(!1)),l}let d=[],k=0;for(;k<y.length;){let p=y[k];++k;let x={list_name:p.list_name,limit:p.values.length,list_size:p.values.length},S={};I.setProperty(S,p.key,p.values),I.setProperty(x,"order",S),d.push(x)}if(o.getPageVisit()==null){let p=l;return p._isFinished||(p._result=!1,p._isFinished=!0,p._resolve(!1)),l}else if(o.getEnvironment()==null){let p=l;return p._isFinished||(p._result=!1,p._isFinished=!0,p._resolve(!1)),l}try{o.getRawRecommendations(d).then(function(p){let x=p.lists(),S=x.length,D=0,N=S;for(;D<N;){let F=D++,O=x[F],B=y[F];B.el.setAttribute("data-froomle-request-id",p.request_id);let h=new Array,w=0,R=O.items;for(;w<R.length;){let M=R[w];++w;let $=M.get(B.key),V=M.get(B.key),X=B.values.length,ie=0,de=X;for(;ie<de;){let le=ie++,he=B.values[le];if($==he){let jt=B.orderChildren.length,Et=B.orderChildren[le];h.push(Et),B.orderChildren.splice(le,1),B.values.splice(le,1);break}}}let C=h.length,A=B.el,U=new Array,H=0,G=A.childNodes;for(;H<G.length;){let M=G[H];++H,U.push(M)}let K=U.length,W=0,z=K;for(;W<z;){let M=W++,$=B.el,V=new Array,X=0,ie=$.childNodes;for(;X<ie.length;){let he=ie[X];++X,V.push(he)}let de=V[M],le;if(de instanceof HTMLElement?le=de.hasAttribute("data-froomle-tmp-node"):le=!1,le){B.el.replaceChild(h[0],de),h.splice(0,1);let he=h.length;if(h.length==0)break}}}let T=l;T._isFinished||(T._result=!0,T._isFinished=!0,T._resolve(!0))})}catch{let x=l;x._isFinished||(x._result=!1,x._isFinished=!0,x._resolve(!1))}return l}static domInit(e){let t=null,r=new Promise(function(l,u){t=l}),i=r;i._resolve=t,i._isFinished=!1,i._result=null;let n=r;return re._orderElements(e).then(function(l){re._buildHistories(e.getRoot()),re._fillRecoTargets(e.getRoot()).then(function(u){let g=n;g._isFinished||(g._result=!0,g._isFinished=!0,g._resolve(!0))})}),n}static fillElementRecos(e){re._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t;try{let i=new DOMParser().parseFromString(e,"text/html"),n=new xe;n.root=i.documentElement,t=n}catch{return e}return re.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return re}};var hi=s.$global,L=s.global("$hxClasses").FroomleSdk=class ne{static register(){ne.registered||ne._env_set&&ne._page_visit_set&&(ne.registered=!0)}static buildScriptTag(){let e='<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="'+o.getEnvironment()+'" ',t=o.getPageVisit();t!=null&&(e+='data-froomle-page-visit="'+t+'" ');let r=o.getContextItem();if(r!=null){e+='data-froomle-context-item="'+r+'" ';let m=o.getContextItemType();(m==null||m=="")&&(m="article"),e+='data-froomle-context-item-type="'+m+'" '}let i=o.getDeviceId();i!=null&&(e+='data-froomle-device-id="'+i+'" ');let n=o.getUserId();n!=null&&(e+='data-froomle-user-id="'+n+'" ');let l=o.getConsent();l>0&&(e+='data-froomle-consent="'+l+'" ');let u=o.getRequestDomain();u!=null&&(e+='data-froomle-request-domain="'+u+'" ');let g=o.getChannel();return g!=null&&(e+='data-froomle-channel="'+g+'" '),e+="><\/script>",e}static setEnvironment(e){o.setEnvironment(e),ne._env_set=!0,ne.register()}static setDeviceId(e){o.setDeviceId(e)}static setUserId(e){o.setUserId(e)}static setConsent(e){o.setConsent(e)}static setPageVisit(e){o.setPageVisit(e),ne._page_visit_set=!0,ne.register()}static setChannel(e){o.setChannel(e)}static setRequestDomain(e){o.setRequestDomain(e)}static setSafeRequest(e){o.setSafeRequest(e)}static setContextItem(e){o.setContextItem(e)}static setContextItemType(e){o.setContextItemType(e)}static setCustomVariable(e,t){o.setOthers(e,t)}static getUserId(){return o.getUserId()}static getDeviceId(){return o.getDeviceId()}static getEnvironment(){return o.getEnvironment()}static getSafeRequest(){return o.getSafeRequest()}static getPageVisit(){return o.getPageVisit()}static getConsent(){return o.getConsent()}static getRecommendations(e){return o.getRawRecommendations(e)}static getChannel(){return o.getChannel()}static getVersion(){return"0.0.11"}static runFromHtml(e){return oe.runFromHtml(e)}static get __name__(){return"FroomleSdk"}get __class__(){return ne}};L._env_set=!1;L._page_visit_set=!1;L.registered=!1;var vi=s.$global;function mt(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}function Ae(){return o.getConsent()>=1}function gt(){return o.getConsent()<2?"no-consent":o.getDeviceId()}function _t(){let a=o.getChannel();if(a)return a}function Bt(a){let e=(a==null?void 0:a.getAttribute("data-froomle-id"))||(a==null?void 0:a.getAttribute("data-froomle-action-item"));if(e)return e}function Ht(a){let e=(a==null?void 0:a.getAttribute("data-froomle-item-type"))||(a==null?void 0:a.getAttribute("data-froomle-action-item-type"));if(e)return e}function ft(a){var r;let e=a==null?void 0:a.getAttribute("data-froomle-user-group");return e||(typeof document=="undefined"?void 0:((r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group"))||void 0)}function pt(a,e,t="impression",r){if(!Ae())return;let i=_t()||"www-desktop",n={event_type:t,page_type:o.getPageVisit(),action_item:a,action_item_type:e,channel:i,device_id:gt()},l=ft();if(l&&(n.user_group=l),r)for(let u in r)n[u]=r[u];try{fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({events:[n]})})}catch{}}var P=class P{static queueIfNotPresent(e){P.impressionQueue.includes(e)||P.impressionQueue.push(e)}static generateBody(){let e=[];for(let t of P.impressionQueue){let r=Bt(t);if(!r)continue;let i=Ht(t)||"article",n=_t()||"www-desktop",l={event_type:"impression",page_type:o.getPageVisit(),action_item:r,action_item_type:i,channel:n,device_id:gt()},u=ft(t);u&&(l.user_group=u),o.getConsent()>=2&&o.getUserId()&&(l.user_id=o.getUserId());let g=t.getAttribute("data-froomle-reco"),m=t.getAttribute("data-froomle-request-id");g&&m&&(l.list_name=g,l.request_id=m),e.push(l)}return P.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){console.log(P.impressionQueue),P.impressionQueue.length!==0&&Ae()&&fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:P.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=P.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){P.observer.observe(e)}static processDocument(){if(Ae()){console.log("\u{1F680} Processing document for impressions");for(let e of document.querySelectorAll("[data-froomle-id]"))P.intersectsWithViewPortRect(e)?P.queueIfNotPresent(e):P.addIntersectionImpressionListener(e);P.sendImpressions()}}static processElement(e){if(!Ae()||!(e instanceof Element))return;let t=[];e.matches("[data-froomle-id]")&&t.push(e);for(let r of e.querySelectorAll("[data-froomle-id]"))t.push(r);if(t.length!==0){for(let r of t)P.intersectsWithViewPortRect(r)?P.queueIfNotPresent(r):P.addIntersectionImpressionListener(r);P.sendImpressions()}}};P.impressionQueue=[],P.observer=null;var Q=P;typeof document!="undefined"&&(Q.observer=new IntersectionObserver((a,e)=>{a.forEach(t=>{t.isIntersecting&&(Q.impressionQueue.push(t.target),Q.observer.unobserve(t.target))}),Q.impressionQueue.length>0&&Q.sendImpressions()}));var Ie=class a{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=a.readChannel()||"www-desktop",t={event_type:"page_visit",page_type:o.getPageVisit(),channel:e,device_id:a.readDeviceId()},r=a.readUserGroup();return r&&(t.user_group=r),o.getConsent()>=2&&o.getUserId()&&(t.user_id=o.getUserId()),JSON.stringify({events:[t]})}static sendPageVisit(){o.getPageVisit()&&(o.getContextItem()||a.canTrackEvents()&&fetch(a.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:a.generateBody()}))}};var Ee=class a{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItemType(){let e=o.getContextItemType();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=a.readActionItemType()||"article",t=a.readChannel()||"www-desktop",r={event_type:"detail_pageview",page_type:o.getPageVisit(),action_item:o.getContextItem(),action_item_type:e,channel:t,device_id:a.readDeviceId()},i=a.readUserGroup();return i&&(r.user_group=i),o.getConsent()>=2&&o.getUserId()&&(r.user_id=o.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){o.getContextItem()&&o.getPageVisit()&&a.canTrackEvents()&&fetch(a.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:a.generateBody()})}};var ee=class ee{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItem(e){let t=e.getAttribute("data-froomle-id")||e.getAttribute("data-froomle-action-item");if(t)return t}static readActionItemType(e){let t=e.getAttribute("data-froomle-item-type")||e.getAttribute("data-froomle-action-item-type");if(t)return t}static readUserGroup(e){var i;let t=e.getAttribute("data-froomle-user-group");return t||(typeof document=="undefined"?void 0:((i=document.querySelector("[data-froomle-user-group]"))==null?void 0:i.getAttribute("data-froomle-user-group"))||void 0)}static registerClickables(){ee.listenerRegistered||(ee.listenerRegistered=!0,document.addEventListener("click",e=>{if(!ee.canTrackEvents())return;let t=e instanceof MouseEvent?e:null,r=e.target,i=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!i)return;let n=i.closest("a");if(!n)return;let l=n.closest("[data-froomle-id]");if(!l)return;let u=ee.readActionItem(l);if(!u)return;let g=ee.readActionItemType(l)||"article",m=ee.readChannel()||"www-desktop",_=n instanceof HTMLAnchorElement?n.href:null,f=!!_&&e.cancelable&&!e.defaultPrevented&&!n.hasAttribute("download")&&(!n.target||n.target==="_self")&&!!t&&t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey;f&&e.preventDefault();let c={event_type:"click_on_recommendation",page_type:o.getPageVisit(),action_item:u,action_item_type:g,channel:m,device_id:ee.readDeviceId()},y=ee.readUserGroup(l);y&&(c.user_group=y);let b=l.getAttribute("data-froomle-reco"),d=l.getAttribute("data-froomle-request-id");b&&d&&(c.list_name=b,c.request_id=d),o.getConsent()>=2&&o.getUserId()&&(c.user_id=o.getUserId());let p=(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events",x=JSON.stringify({events:[c]}),S=new Blob([x],{type:"application/json"}),D=()=>fetch(p,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:x,keepalive:!0});if(f&&_){let T=!1,F=()=>{T||(T=!0,window.location.assign(_))},O=window.setTimeout(F,200);D().catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(p,S)}).finally(()=>{window.clearTimeout(O),F()});return}typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(p,S)||D().catch(()=>{})},!0))}};ee.listenerRegistered=!1;var Re=ee;var dt=xe,ht=L.setEnvironment,yt=L.setPageVisit,bt=L.setRequestDomain,vt=L.setSafeRequest,wt=typeof L.setChannel=="function"?L.setChannel:o.setChannel,xt=L.setContextItem,It=L.setContextItemType,Vt=L.setCustomVariable,Lt=o.addHistories;function Me(a){L.setUserId(a),document.cookie=`froomle_user_id=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Je(a){L.setDeviceId(a),document.cookie=`froomle_device_id=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Ge(a){L.setConsent(a),document.cookie=`froomle_consent=${a}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${L.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window!="undefined"&&(window.setFroomleConsent=Ge);function je(a){let e=document.cookie.split("; ");for(let t of e){let[r,i]=t.split("=");if(r===a)return decodeURIComponent(i)}return null}var Nt=L.getRecommendations;if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document!="undefined")){let a=document.currentScript;if(a){let t=a.getAttribute("data-froomle-device-id"),r=a.getAttribute("data-froomle-user-id"),i=a.getAttribute("data-froomle-env"),n=a.getAttribute("data-froomle-page-visit"),l=a.getAttribute("data-froomle-request-domain"),u=a.getAttribute("data-froomle-context-item"),g=a.getAttribute("data-froomle-context-item-type"),m=a.getAttribute("data-froomle-safe-request"),_=a.getAttribute("data-froomle-channel");if(ht(i),n&&yt(n),u&&(xt(u),It(g||"article")),t)Je(t);else{let f=je("froomle_device_id");f&&Je(f)}if(r)Me(r);else{let f=je("froomle_user_id");f&&Me(f)}l&&bt(l),m&&vt(m!=="false"),_&&wt(_)}let e=je("froomle_consent");e&&Ge(e),document.addEventListener("DOMContentLoaded",()=>{console.log("froomle loads dom"),oe.domInit(dt.fromDocument(document)).then(i=>{Re.registerClickables(),Q.processDocument(),Ie.sendPageVisit(),Ee.sendPageView()});function t(i){return i.matches("[data-froomle-reco]")||i.querySelector("[data-froomle-reco]")!==null}new MutationObserver(i=>{for(let n of i)if(n.type==="childList"&&n.addedNodes.forEach(l=>{l instanceof Element&&(t(l)&&oe.fillElementRecos(l),Q.processElement(l))}),n.type==="attributes"&&n.target instanceof Element)if(n.attributeName==="data-froomle-reco"){let l=n.target.getAttribute("data-froomle-request-id");(!l||l==="")&&oe.fillElementRecos(n.target)}else if(n.attributeName==="data-froomle-request-id"){let l=n.target.getAttribute("data-froomle-request-id"),u=n.target.getAttribute("data-froomle-id");n.target.getAttribute("data-froomle-reco")&&(!l||l==="")&&(!u||u==="")&&oe.fillElementRecos(n.target)}else n.attributeName==="data-froomle-id"&&Q.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-froomle-reco","data-froomle-request-id","data-froomle-id"]})})}return Dt(Ut);})();
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,19 @@ type RecoRequest = {
|
|
|
15
15
|
others?: null | FroomleTuple[]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
type HistoryEntry = {
|
|
19
|
+
id: string,
|
|
20
|
+
item_type: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type HistoryEntryInput = {
|
|
24
|
+
id: string,
|
|
25
|
+
itemType?: null | string,
|
|
26
|
+
item_type?: null | string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type HistoryInput = string | HistoryEntryInput
|
|
30
|
+
|
|
18
31
|
declare class RecoBackendV2 {
|
|
19
32
|
constructor()
|
|
20
33
|
protected static _environment: string
|
|
@@ -25,7 +38,7 @@ declare class RecoBackendV2 {
|
|
|
25
38
|
protected static _page_visit: string
|
|
26
39
|
protected static _channel: string
|
|
27
40
|
protected static _safe_request: boolean
|
|
28
|
-
protected static _history:
|
|
41
|
+
protected static _history: HistoryEntry[]
|
|
29
42
|
protected static _others: FroomleTuple[]
|
|
30
43
|
protected static _requestUri(): string
|
|
31
44
|
protected static noConsentBody(): any
|
|
@@ -35,10 +48,7 @@ declare class RecoBackendV2 {
|
|
|
35
48
|
list_size: number
|
|
36
49
|
}[]): any
|
|
37
50
|
protected static _buildHistories(): {
|
|
38
|
-
pageviews:
|
|
39
|
-
id: string,
|
|
40
|
-
item_type: string
|
|
41
|
-
}[]
|
|
51
|
+
pageviews: HistoryEntry[]
|
|
42
52
|
}
|
|
43
53
|
static requestsToLists(requests: RecoRequest[]): {
|
|
44
54
|
limit: number,
|
|
@@ -56,7 +66,7 @@ declare class RecoBackendV2 {
|
|
|
56
66
|
list_name: string,
|
|
57
67
|
list_size: number
|
|
58
68
|
}[]): Promise<Recommendations>
|
|
59
|
-
static addHistories(hists:
|
|
69
|
+
static addHistories(hists: HistoryInput[], defaultItemType?: null | string): void
|
|
60
70
|
static setOthers(key: string, value: any): void
|
|
61
71
|
static setConsent(consent: number): void
|
|
62
72
|
static setChannel(channel: string): void
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,e as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s}from"./chunk-
|
|
1
|
+
import{a,b,c,e as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s}from"./chunk-R3QWQW4H.js";export{c as RecommendationItem,b as RecommendationList,a as Recommendations,m as addHistories,r as fulfillRecommendations,q as getRecommendations,s as proxyReco,d as sendEvent,i as setChannel,p as setConsent,j as setContextItem,k as setContextItemType,l as setCustomVariable,o as setDeviceId,e as setEnvironment,f as setPageVisit,g as setRequestDomain,h as setSafeRequest,n as setUserId};
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,f as I,g as x,h as F,i as v,w as C,x as P}from"./chunk-
|
|
1
|
+
import{d as a,f as I,g as x,h as F,i as v,w as C,x as P}from"./chunk-R3QWQW4H.js";import f,{createContext as A,useContext as V,useEffect as N,useRef as b,useState as _}from"react";import h from"react";function k({children:e,id:r}){let[n,t]=h.useState(!1);return n||(a.addHistories([r]),t(!0)),h.createElement(h.Fragment,null,e)}import d from"react";function y({children:e,value:r}){return d.createElement(d.Fragment,null,e)}y.displayName="FroomleOrderItem";function S({children:e,list:r,category:n}){let[t,i]=d.useState(null);return d.createElement(d.Fragment,null,(()=>{let u=d.Children.toArray(e),s=[],l=[],m=[[]];for(let o of u)if(console.log(o.type.displayName),d.isValidElement(o)&&o.type===y){let g=o.props.value;s.push(g),l.push(o),m.push([])}else m[m.length-1].push(o);if(t){let o=[];for(let g of t){let R=s.indexOf(g);R!==-1&&(o.push(l[R]),o.push(...m[R+1]))}return o}else return a.getOrder(r,n,s).then(o=>{i(o)}),u})())}function z(e){return N(()=>{C().then(r=>{v.registerClickables(),I.processDocument(),x.sendPageVisit(),F.sendPageView()})},[]),f.createElement(f.Fragment,null,e.children)}var O=A(null);function p(e,...r){for(let n of r){let t=e==null?void 0:e[n];if(t!=null&&t!==""&&t!=="undefined")return String(t)}if(typeof(e==null?void 0:e.get)=="function")for(let n of r){let t=e.get(n);if(t!=null&&t!==""&&t!=="undefined")return String(t)}}function q(){var r;if(typeof document=="undefined")return;let e=(r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group");if(e!=null&&e!==""&&e!=="undefined")return String(e)}function J({reco:e,children:r,...n}){let t=b(null);return f.useEffect(()=>{let i=!1,c=e.__froomleList;return t.current&&c&&t.current.setAttribute("data-froomle-reco",c),Promise.resolve(e).then(u=>{if(i||!t.current)return;let s=p(u,"Id","item_id"),l=p(u,"ItemType","item_type"),m=p(u,"RequestId","request_id"),o=p(u,"UserGroup","user_group")||q();s&&t.current.setAttribute("data-froomle-id",s),l&&t.current.setAttribute("data-froomle-item-type",l),m&&t.current.setAttribute("data-froomle-request-id",m),o&&t.current.setAttribute("data-froomle-user-group",o)}),()=>{i=!0}},[e]),f.createElement(O.Provider,{value:e},f.createElement("div",{ref:t,...n},r))}var K=()=>{let e=V(O);if(e===null)throw new Error("useFroomleReco must be used within a FroomleRecoProvider");return e};function Q(e){let r=b(null),[n,t]=_(0);if(!r.current){let{list:i,filters:c,...u}=e;r.current=P({list:i,filters:c,others:Object.entries(u).map(([s,l])=>({key:s,value:l}))})}return N(()=>{let i=!0;return r.current.then(()=>{i&&t(1)}),()=>{i=!1}},[]),r.current}export{k as FroomleCustomItem,S as FroomleOrder,y as FroomleOrderItem,J as FroomleReco,z as FroomleSdkInit,Q as useCreateReco,K as useReco};
|
package/package.json
CHANGED
package/dist/chunk-ZB7K2NNI.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var i=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let s=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(s=r(),r=null),s},set:function(n){r!=null&&(s=r(),r=null),s=n}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new Ae(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let s=e();s[u.init]&&s[u.init](),Object.setPrototypeOf(r.prototype,s.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};i.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;i.globals={};i.new=Symbol();i.init=Symbol();i.fid=0;var Ae=i.global("$hxClasses")["genes._Register.ArrayIterator"]=class ze extends i.inherits(){[i.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return ze}};Ae.prototype.array=null;Ae.prototype.current=null;var Jt=i.$global,Ce=i.global("$hxClasses")["haxe.ValueException"]=class We extends i.inherits(()=>k,!0){[i.new](e,t,r){super[i.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return We}};Ce.prototype.value=null;var Qt=i.$global,k=i.global("$hxClasses")["haxe.Exception"]=class ye extends i.inherits(()=>Error,!0){[i.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ye?e:e instanceof Error?new ye(e.message,null,e):new Ce(e,null,e)}static thrown(e){return e instanceof ye?e.get_native():e instanceof Error?e:new Ce(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ye}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var er=i.$global,E=i.global("$hxClasses").Std=class Ke{static string(e){return be.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static random(e){return e<=0?0:Math.floor(Math.random()*e)}static get __name__(){return"Std"}get __class__(){return Ke}};Object.defineProperty(String.prototype,"__class__",{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,It={},Et={},Ct=Number,qt=Boolean,St={},kt={};var It,Et,Ct,qt,St,kt;var ir=i.$global,be=i.global("$hxClasses")["js.Boot"]=class G{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let r=G.__nativeClassName(e);return r!=null?G.__resolveNativeClass(r):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let g=i.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],f=g._hx_name;return g.__params__?(t=t+" ",f+"("+(function(_){var c;let y=[];{let b=0,p=g.__params__;for(;b<p.length;){let S=p[b];b=b+1,y.push(G.__string_rec(e[S],t))}}return c=y,c})(this).join(",")+")"):f}if(e instanceof Array){let m="[";t+=" ";let g=0,f=e.length;for(;g<f;){let _=g++;m+=(_>0?",":"")+G.__string_rec(e[_],t)}return m+="]",m}let s;try{s=e.toString}catch{return"???"}if(s!=null&&s!=Object.toString&&typeof s=="function"){let m=e.toString();if(m!="[object Object]")return m}let n=`{
|
|
2
|
-
`;t+=" ";let l=e.hasOwnProperty!=null,a=null;for(a in e)l&&!e.hasOwnProperty(a)||a=="prototype"||a=="__class__"||a=="__super__"||a=="__interfaces__"||a=="__properties__"||(n.length!=2&&(n+=`,
|
|
3
|
-
`),n+=t+a+" : "+G.__string_rec(e[a],t));return t=t.substring(1),n+=`
|
|
4
|
-
`+t+"}",n;break;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let s=0,n=r.length;for(;s<n;){let l=s++,a=r[l];if(a==t||G.__interfLoop(a,t))return!0}}return G.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case"$hxCoreType__Bool":return typeof e=="boolean";case"$hxCoreType__Dynamic":return e!=null;case"$hxCoreType__Float":return typeof e=="number";case"$hxCoreType__Int":return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(G.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&G.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t=="$hxCoreType__Class"&&e.__name__!=null||t=="$hxCoreType__Enum"&&e.__ename__!=null?!0:e.__enum__!=null?i.global("$hxEnums")[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?G.__interfLoop(G.getClass(e),t):!1}static __cast(e,t){if(e==null||G.__instanceof(e,t))return e;throw k.thrown("Cannot cast "+E.string(e)+" to "+E.string(t))}static __nativeClassName(e){let t=G.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return G.__nativeClassName(e)!=null}static __resolveNativeClass(e){return i.$global[e]}static get __name__(){return"js.Boot"}get __class__(){return G}};be.__toStr={}.toString;var ur=i.$global,$e=i.global("$hxClasses")["js.Browser"]=class Qe{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return Qe}};var gr=i.$global,Y=i.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};Y.__constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds,Y.Custom];Y.__empty_constructs__=[Y.Blocked,Y.Overflow,Y.OutsideBounds];var dr=i.$global,te=i.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};te.__constructs__=[te.UTF8,te.RawNative];te.__empty_constructs__=[te.UTF8,te.RawNative];var wr=i.$global,me=i.global("$hxClasses")["haxe.io.Bytes"]=class Fe extends i.inherits(){[i.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(Y.OutsideBounds);r==null&&(r=te.UTF8);let s="",n=this.b,l=e,a=e+t;switch(r._hx_index){case 0:let m=e>0;for(;l<a;){let g=n[l++];if(g<128){if(g==0)break;s+=String.fromCodePoint(g)}else if(g<224){let f=(g&63)<<6|n[l++]&127;s+=String.fromCodePoint(f)}else if(g<240){let f=n[l++],_=(g&31)<<12|(f&127)<<6|n[l++]&127;s+=String.fromCodePoint(_)}else{let f=n[l++],_=n[l++],c=(g&15)<<18|(f&127)<<12|(_&127)<<6|n[l++]&127;s+=String.fromCodePoint(c)}}break;case 1:for(;l<a;){let g=n[l++]|n[l++]<<8;s+=String.fromCodePoint(g)}break}return s}static ofData(e){let t=e.hxBytes;return t!=null?t:new Fe(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Fe}};me.prototype.length=null;me.prototype.b=null;var Er=i.$global,Z=i.global("$hxClasses")["haxe.http.HttpBase"]=class Xe extends i.inherits(){[i.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=i.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,s=this.headers.length;for(;r<s;){let n=r++;if(this.headers[n].name==e){this.headers[n]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return i.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,te.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return Xe}};Z.prototype.url=null;Z.prototype.responseBytes=null;Z.prototype.responseAsString=null;Z.prototype.postData=null;Z.prototype.postBytes=null;Z.prototype.headers=null;Z.prototype.params=null;Z.prototype.emptyOnData=null;var Sr=i.$global,qe=i.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Ye extends i.inherits(){[i.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Ye}};qe.prototype.map=null;qe.prototype.keys=null;var Pr=i.$global,Oe=function(){};Oe.__isInterface__=!0;var Fr=i.$global,Se=i.global("$hxClasses")["genes.util.EsMap"]=class ve extends i.inherits(){[i.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return ve.adaptIterator(this.inst.keys())}iterator(){return ve.adaptIterator(this.inst.values())}toString(){let e=[],t=ve.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+E.string(r)+" => "+E.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,s=function(){let n=e.next();t=n.value,r=n.done};return{hasNext:function(){return r==null&&s(),!r},next:function(){r==null&&s();let n=t;return s(),n}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return ve}};Se.prototype.inst=null;var Vr=i.$global,Ze=i.global("$hxClasses")["haxe.ds.StringMap"]=class Be extends i.inherits(Se){[i.new](){super[i.new]()}copy(){let e=new Be;return e.inst=new Map(this.inst),e}keyValueIterator(){return new qe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Oe]}static get __super__(){return Se}get __class__(){return Be}};var Mr=i.$global,N=i.global("$hxClasses").HxOverrides=class et{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return et}};typeof performance!="undefined"&&typeof performance.now=="function"&&(N.now=performance.now.bind(performance));var Wr=i.$global,ae=i.global("$hxClasses").StringTools=class ke{static isSpace(e,t){let r=N.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&ke.isSpace(e,r);)++r;return r>0?N.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&ke.isSpace(e,t-r-1);)++r;return r>0?N.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return ke}};var Xr=i.$global,tt=i.global("$hxClasses").Lambda=class rt{static exists(e,t){let r=i.getIterator(e);for(;r.hasNext();){let s=r.next();if(t(s))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return rt}};var nn=i.$global,we=i.global("$hxClasses").EReg=class nt extends i.inherits(){[i.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:N.substr(e,0,t+r));let s=this.r.m!=null;return s&&(this.r.s=e),s}else{let s=this.match(r<0?N.substr(e,t,null):N.substr(e,t,r));return s&&(this.r.s=e,this.r.m.index+=t),s}}map(e,t){let r=0,s="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){s+=E.string(N.substr(e,r,null));break}let n=this.matchedPos();s+=E.string(N.substr(e,r,n.pos-r)),s+=E.string(t(this)),n.len==0?(s+=E.string(N.substr(e,n.pos,1)),r=n.pos+1):r=n.pos+n.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(s+=E.string(N.substr(e,r,null))),s}static get __name__(){return"EReg"}get __class__(){return nt}};we.prototype.r=null;var pn=i.$global,ue=i.global("$hxClasses")["haxe.http.HttpJs"]=class st extends i.inherits(Z){[i.new](e){this.async=!0,this.withCredentials=!1,super[i.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=$e.createXMLHttpRequest(),r=this,s=function(f){if(t.readyState!=4)return;let _;try{_=t.status}catch{_=null}if(_==0&&$e.get_supported()&&i.$global.location!=null){let c=i.$global.location.protocol.toLowerCase();new we("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(c)&&(_=t.response!=null?200:404)}if(_==null&&(_=null),_!=null&&r.onStatus(_),_!=null&&_>=200&&_<400){r.req=null;let c=t.getAllResponseHeaders().split(`\r
|
|
5
|
-
`),y=[],b=0,p=c;for(;b<p.length;){let x=p[b];++b,x!=""&&y.push(x)}c=y;let S=new Ze;r.responseHeaders=S;let d=0;for(;d<c.length;){let x=c[d];++d;let q=x.split(": "),D=q.shift(),V=q.length==1?q[0]:q.join(": ");V=ae.ltrim(ae.rtrim(V)),r.responseHeaders.inst.set(D,V)}r.success(me.ofData(t.response))}else if(_==null||_==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(_==null){r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}else switch(_){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let c=t.response!=null?me.ofData(t.response):null;r.responseBytes=c,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=s);let n,l=this.postData,a=this.postBytes;if(l==null)if(a==null)n=null;else{let f=a;n=new Blob([f.b.bufferValue])}else a==null?n=l:n=null;if(n!=null)e=!0;else{let f=0,_=this.params;for(;f<_.length;){let c=_[f];++f,n==null?n="":n=(n==null?"null":E.string(n))+"&";let y=c.name,b=(n==null?"null":E.string(n))+encodeURIComponent(y)+"=",p=c.value;n=b+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(n!=null){let f=this.url.split("?").length<=1;t.open("GET",this.url+(f?"?":"&")+(n==null?"null":E.string(n)),this.async),n=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(f){let _=k.caught(f).unwrap();this.req=null,this.onError(_.toString());return}t.withCredentials=this.withCredentials,!tt.exists(this.headers,function(f){return f.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let m=0,g=this.headers;for(;m<g.length;){let f=g[m];++m,t.setRequestHeader(f.name,f.value)}t.send(n),this.async||s(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return Z}get __class__(){return st}};ue.prototype.async=null;ue.prototype.withCredentials=null;ue.prototype.responseHeaders=null;ue.prototype.req=null;var bn=i.$global,He=i.global("$hxClasses").Type=class it{static createInstance(e,t){let r=Function.prototype.bind.apply(e,[null].concat(t));return new r}static get __name__(){return"Type"}get __class__(){return it}};var xn=i.$global,R=i.global("$hxClasses").Reflect=class lt{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let s;return e.__properties__?(r=e.__properties__["get_"+t],s=r):s=!1,s?e[r]():e[t]}}static setProperty(e,t,r){let s,n;e.__properties__?(s=e.__properties__["set_"+t],n=s):n=!1,n?e[s](r):e[t]=r}static fields(e){let t=[];if(e!=null){let s=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&s.call(e,r)&&t.push(r)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return"Reflect"}get __class__(){return lt}};var Dn=i.$global,Ue=i.global("$hxClasses")["internal.http.FetchHttp"]=class ot extends i.inherits(ue){[i.new](e){this.responseStatus=0,super[i.new](e)}request(e){let t=i.$global,r=t.fetch,s=t.Headers,n=t.URLSearchParams;if(r==null){this.onError("Fetch API not found.");return}let l=He.createInstance(s,[]),a=0,m=this.headers;for(;a<m.length;){let p=m[a];++a,l.append(p.name,p.value)}let g=e?"POST":"GET",f=null;if(e)if(this.postData!=null)f=this.postData;else{f=He.createInstance(n,[]);let p=0,S=this.params;for(;p<S.length;){let d=S[p];++p,f.append(d.name,d.value)}}let _={method:g,headers:l,body:f},c=this,y=r(this.url,_).then(function(p){if(c.responseStatus=p.status,c.onStatus(p.status),p.ok)return p.text();throw k.thrown("HTTP Error: "+E.string(p.status))}).then(function(p){c.onData(p)}),b=R.field(y,"catch");b!=null&&b.apply(y,[function(p){c.onError(E.string(p))}])}static get __name__(){return"internal.http.FetchHttp"}static get __super__(){return ue}get __class__(){return ot}};Ue.prototype.responseStatus=null;var $n=i.$global,Le=i.global("$hxClasses")["internal.data.UUID"]=class at{static randomHexChar(){return"0123456789abcdef".charAt(E.random(16))}static v4(){let e="",t=0;for(;t<36;)switch(t++){case 14:e+="4";break;case 19:e+=E.string("0123456789abcdef".charAt(8+E.random(4)));break;case 8:case 13:case 18:case 23:e+="-";break;default:e+=E.string("0123456789abcdef".charAt(E.random(16)))}return e}static get __name__(){return"internal.data.UUID"}get __class__(){return at}};Le.HEX="0123456789abcdef";var Bn=i.$global,ge=function(){};ge.__isInterface__=!0;var fe=function(){};fe.__isInterface__=!0;var _e=function(){};_e.__isInterface__=!0;var zn=i.$global,o=i.global("$hxClasses")["internal.RecoBackendV2"]=class v extends i.inherits(){[i.new](){}static _requestUri(){return(v._safe_request?"https://":"http://")+v._req_domain+"/api/"+v._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:v._page_visit,channel:v._channel};if(v._consent>=2&&v._history.length>0&&(t.histories=v._buildHistories()),v._consent<2){let a=v.noConsentBody(),m=0,g=R.fields(a);for(;m<g.length;){let f=g[m];++m,t[f]=R.field(a,f)}}else v._user_id!=null&&(t.user_id=v._user_id),t.device_id=v._device_id;let r=0,s=v._others;for(;r<s.length;){let a=s[r];++r,t[a.key]=a.value}let n=R.field(t,"context_item"),l=R.field(t,"context_item_type");return n!=null&&E.string(n)!=""&&(l==null||E.string(l)=="")&&(t.context_item_type="article"),t}static _buildHistories(){let e=[],t=0,r=v._history;for(;t<r.length;){let s=r[t];++t,e.push({id:s,item_type:"article"})}return{pageviews:e}}static requestsToLists(e){let t=[],r="",s=[],n=0,l=[],a=function(c,y,b){r=c,s=y,n=0,l=b},m=function(c){let y=[];if(c==null)return y;let b=0;for(;b<c.length;){let p=c[b];++b,!(p==null||p.key==null||p.key=="")&&y.push({key:p.key,value:p.value})}return y},g=function(c,y){if(c==null&&y==null)return!0;if(c==null||y==null||c.length!=y.length)return!1;let b=new Array(c.length),p=0,S=c.length;for(;p<S;){let O=p++;b[O]=JSON.stringify(c[O])}let d=b,x=new Array(y.length),q=0,D=y.length;for(;q<D;){let O=q++;x[O]=JSON.stringify(y[O])}let V=x;d.sort(R.compare),V.sort(R.compare);let $=0,F=d.length;for(;$<F;){let O=$++;if(d[O]!=V[O])return!1}return!0},f=function(){let c={limit:n,list_name:r,list_size:n},y=0;for(;y<s.length;){let p=s[y];++y;let S=p.value;S instanceof Array||(S=[S]),c[p.key]=S}let b=0;for(;b<l.length;){let p=l[b];++b,c[p.key]=p.value}t.push(c)},_=0;for(;_<e.length;){let c=e[_];++_;let y=m(c.filters),b=c.others!=null?c.others:[];if(r==""){a(c.list,y,b),n+=1;continue}else(r!=c.list||!g(s,y)||!g(l,b))&&(f(),a(c.list,y,b));n+=1}return n!=0&&f(),t}static _requestRecos(e){let t=null,r=new Promise(function(c,y){t=c}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r,l=null,a=new Ue(v._requestUri());a.setHeader("Content-Type","application/json");let m=v.buildRequestBody(e),g=JSON.stringify(m);a.setPostData(g),a.onError=function(c){throw k.thrown("HTTP Request Error: "+c)};try{a.request(!0)}catch(c){let y=k.caught(c).unwrap();throw k.thrown("Failed to execute synchronous request: "+E.string(y)+g)}let f=function(c){let y=JSON.parse(c),b=de.fromRequestData(y),p=n;p._isFinished||(p._result=b,p._isFinished=!0,p._resolve(b))},_=a.get_responseData();return _!=null?f(_):a.onData=f,n}static getOrder(e,t,r){let s={list_name:e,limit:r.length,list_size:r.length},n={};R.setProperty(n,t,r),R.setProperty(s,"order",n);let l=null,a=new Promise(function(_,c){l=_}),m=a;m._resolve=l,m._isFinished=!1,m._result=null;let g=a,f;return v.getRawRecommendations([s]).then(function(_){let c=[],y=_.lists()[0].items;if(y instanceof Array){let p=0,S=y;for(;p<S.length;){let d=S[p];++p;let x=d.get("categories");x!=null&&c.push(x)}}let b=g;b._isFinished||(b._result=c,b._isFinished=!0,b._resolve(c))}),g}static getRawRecommendations(e){return v._requestRecos(e)}static addHistories(e){v._history=v._history.concat(e)}static setOthers(e,t){let r=0,s=v._others;for(;r<s.length;){let n=s[r];if(++r,n.key==e){n.value=t;return}}v._others.push({key:e,value:t})}static setConsent(e){e>2&&(e=2),v._consent=e,e==2&&v.getDeviceId()=="no-consent"&&v.setDeviceId(Le.v4())}static setChannel(e){v._channel=e}static setPageVisit(e){v._page_visit=e}static setEnvironment(e){v._environment=e}static setDeviceId(e){v._device_id=e}static setUserId(e){v._user_id=e}static setRequestDomain(e){v._req_domain=e}static setSafeRequest(e){v._safe_request=e}static setContextItem(e){v.setOthers("context_item",e)}static setContextItemType(e){v.setOthers("context_item_type",e)}static getRequestDomain(){return v._req_domain}static getSafeRequest(){return v._safe_request}static getEnvironment(){return v._environment}static getPageVisit(){return v._page_visit}static getUserId(){return v._user_id}static getDeviceId(){return v._device_id}static getConsent(){return v._consent}static getChannel(){return v._channel}static getOthers(e){let t=0,r=v._others;for(;t<r.length;){let s=r[t];if(++t,e==s.key)return s.value}return null}static getContextItem(){return v.getOthers("context_item")}static getContextItemType(){return v.getOthers("context_item_type")}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return v}};o._environment=null;o._device_id="no-consent";o._user_id=null;o._consent=0;o._req_domain="europe-west1.froomle.com";o._page_visit=null;o._channel="www-desktop";o._safe_request=!0;o._history=[];o._others=[];var de=i.global("$hxClasses")["internal._RecommendationsInternal"]=class Ve extends i.inherits(){[i.new](e,t,r,s,n){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=s,this._lists=n}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n=0,l=s.items;for(;n<l.length;){let a=l[n];++n,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let s=r[t];if(++t,s.list_name==e)return s}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,r=this._lists;for(;t<r.length;){let s=r[t];++t;let n={limit:s.limit,list_key:s.list_key,list_name:s.list_name,list_size:s.list_size,items:[]},l=0,a=s.items;for(;l<a.length;){let m=a[l];++l,n.items.push(be.__cast(m,re).getData())}e.lists.push(n)}return JSON.stringify(e)}static fromRequestData(e){let t=R.getProperty(e,"lists"),r=[],s=0;for(;s<t.length;){let n=t[s];++s;let l=R.getProperty(n,"items"),a=[],m=0;for(;m<l.length;){let f=l[m];++m,R.setProperty(f,"request_id",R.getProperty(e,"request_id")),R.setProperty(f,"user_group",R.getProperty(e,"user_group")),a.push(new re(f))}let g=new ce({limit:R.getProperty(n,"limit"),list_key:R.getProperty(n,"list_key"),list_name:R.getProperty(n,"list_name"),list_size:R.getProperty(n,"list_size"),items:a,request_id:R.getProperty(e,"request_id")});r.push(g)}return new Ve(R.getProperty(e,"device_id"),R.getProperty(e,"request_id"),R.getProperty(e,"user_group"),R.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[ge]}get __class__(){return Ve}};de.prototype.request_id=null;de.prototype.user_group=null;de.prototype.user_id=null;de.prototype.device_id=null;de.prototype._lists=null;var ce=i.global("$hxClasses")["internal._RecommendationsListInternal"]=class ut extends i.inherits(){[i.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size,this.request_id=e.request_id}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[fe]}get __class__(){return ut}};ce.prototype.limit=null;ce.prototype.list_key=null;ce.prototype.list_name=null;ce.prototype.list_size=null;ce.prototype.items=null;ce.prototype.request_id=null;var re=i.global("$hxClasses")["internal._RecommendationItemInternal"]=class ct extends i.inherits(){[i.new](e){this.Id=R.getProperty(e,"item_id"),this.RequestId=R.getProperty(e,"request_id"),this.UserGroup=R.getProperty(e,"user_group"),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[_e]}get __class__(){return ct}};re.prototype.Id=null;re.prototype.RequestId=null;re.prototype.UserGroup=null;re.prototype._data=null;var Qn=i.$global,je=function(){};je.__isInterface__=!0;var es=i.$global,xe=i.global("$hxClasses")["internal.js.JSFroomleDomTree"]=class De extends i.inherits(){[i.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let r=new DOMParser().parseFromString(e,"text/html"),s=new De;return s.root=r.documentElement,s}static fromDocument(e){let t=new De;return t.root=e.documentElement,t}static get __name__(){return"internal.js.JSFroomleDomTree"}static get __interfaces__(){return[je]}get __class__(){return De}};xe.prototype.root=null;var cs=i.$global,oe=i.global("$hxClasses")["internal.domHandler.DomDomDom"]=class ne extends i.inherits(){[i.new](){}static _fillRecoTargets(e){let t=null,r=new Promise(function(h,w){t=h}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;if(e==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}let l=[],a=new Array,m=e.querySelectorAll("*"),g=0,f=m.length;for(;g<f;){let h=g++,w=m.item(h);w instanceof HTMLElement&&a.push(w)}let _=a;_.push(e);let c=0;for(;c<_.length;){let h=_[c];++c;let w=0,I=new Array,C=0,P=h.attributes;for(;C<P.length;){let H=P[C];++C,I.push({name:H.name,value:H.value})}let j=I;for(;w<j.length;){let H=j[w];++w,H.name=="data-froomle-reco"&&l.push(h)}}let y=[],b=0;for(;b<l.length;){let h=l[b];++b;let w=h.getAttribute("data-froomle-request-id"),I=h.getAttribute("data-froomle-id"),C=w!=null&&w!="",P=I!=null&&I!="";!C&&!P&&y.push(h)}if(y.length<1){let h=null,w=new Promise(function(C,P){h=C}),I=w;return I._resolve=h,I._isFinished=!1,I._result=null,w}let p=[],S=[],d="",x=[],q=[],D=[],V=function(h,w){if(h.length!=w.length)return!1;let I=new Array(h.length),C=0,P=h.length;for(;C<P;){let T=C++;I[T]=JSON.stringify(h[T])}let j=I,H=new Array(w.length),J=0,K=w.length;for(;J<K;){let T=J++;H[T]=JSON.stringify(w[T])}let W=H;j.sort(R.compare),W.sort(R.compare);let z=0,M=j.length;for(;z<M;){let T=z++;if(j[T]!=W[T])return!1}return!0},$=function(){let h={list_name:d,list_size:q.length,limit:q.length},w=0;for(;w<x.length;){let C=x[w];if(++w,C!=null&&C.key!=null&&C.key!=""){let P=C.value;P instanceof Array||(P=[P]),R.setProperty(h,C.key,P)}}let I=0;for(;I<D.length;){let C=D[I];++I,R.setProperty(h,C.key,C.value)}p.push(h),S.push(q)},F=function(h,w,I,C){d=h,x=w,q=[C],D=I},O=0;for(;O<y.length;){let h=y[O];++O;let w=function(H){let J=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let U=M[z];++z,W.push({name:U.name,value:U.value})}let T=W;for(;K<T.length;){let U=T[K];if(++K,U.name.startsWith("data-froomle-reco-filter-")){let X=N.substr(U.name,25,null),ie=U.value;J.push({key:X,value:ie})}}return J},I=function(H){let J=[],K=0,W=new Array,z=0,M=H.attributes;for(;z<M.length;){let U=M[z];++z,W.push({name:U.name,value:U.value})}let T=W;for(;K<T.length;){let U=T[K];if(++K,U.name.startsWith("data-froomle-variable-")){let X=N.substr(U.name,22,null),ie=U.value;J.push({key:X,value:ie})}}return J},C=h.getAttribute("data-froomle-reco"),P=w(h),j=I(h);if(d==""){F(C,P,j,h);continue}else if(C==d&&V(x,P)&&V(D,j)){q.push(h);continue}else{$(),F(C,P,j,h);continue}}d!=""&&$();let B;if(o.getPageVisit()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else if(o.getEnvironment()==null){let h=n;return h._isFinished||(h._result=!1,h._isFinished=!0,h._resolve(!1)),n}else try{B=o.getRawRecommendations(p)}catch{let w=n;return w._isFinished||(w._result=!1,w._isFinished=!0,w._resolve(!1)),n}return B.then(function(h){let w=h.lists(),I=w.length,C=0,P=I;for(;C<P;){let H=C++,J=w[H],K=J.items.length!=S[H].length,W=J.items.length,z=0,M=W;for(;z<M;){let T=z++,U=J.items[T],X=S[H][T];ne._fillParameters(X,U,h.request_id)}}let j=n;j._isFinished||(j._result=!0,j._isFinished=!0,j._resolve(!0))}),n}static getAttrByPath(e,t,r){r==null&&(r="fgh");try{t=new we("\\\\[(\\\\w+)\\\\]","g").map(t,function(g){return"."+g.matched(1)}),t=ae.replace(t,"[","."),t=ae.replace(t,"]",""),N.cca(t,0)==46&&(t=N.substr(t,1,null));let n=t.split("."),l=e.get(n[0]),a=1,m=n.length;for(;a<m;){let g=a++;if(l==null)return null;l instanceof Array&&E.parseInt(n[g])!=null?l=l[E.parseInt(n[g])]:l=R.field(l,n[g])}return l}catch{return r}}static _buildHistories(e){let t=[],r=new Array,s=e.querySelectorAll("[data-froomle-id]"),n=0,l=s.length;for(;n<l;){let g=n++,f=s.item(g);f instanceof HTMLElement&&r.push(f)}let a=r,m=0;for(;m<a.length;){let g=a[m];++m,t.push(g.getAttribute("data-froomle-id"))}o.addHistories(t)}static fillParam(e,t,r,s,n){n==null&&(n="");try{let l=ne.getAttrByPath(s,r,n);if(t=="inner"){e.textContent=l;let a=e.textContent}else e.setAttribute(t,l)}catch{}}static _fillParameters(e,t,r){e.setAttribute("data-froomle-id",t.get("item_id")),e.setAttribute("data-froomle-request-id",r);let s=t.get("item_type");s!=null&&E.string(s)!=""&&e.setAttribute("data-froomle-item-type",E.string(s)),t.UserGroup!=null&&t.UserGroup!=""&&e.setAttribute("data-froomle-user-group",t.UserGroup);let n=new Array,l=e.querySelectorAll("*"),a=0,m=l.length;for(;a<m;){let _=a++,c=l.item(_);c instanceof HTMLElement&&n.push(c)}let g=n,f=0;for(;f<g.length;){let _=g[f];++f;let c=0,y=new Array,b=0,p=_.attributes;for(;b<p.length;){let d=p[b];++b,y.push({name:d.name,value:d.value})}let S=y;for(;c<S.length;){let d=S[c];if(++c,d.name.startsWith("data-froomle-param-")){let x=ae.replace(d.name,"data-froomle-param-",""),q=d.value;ne.fillParam(_,x,q,t)}}}}static _orderElements(e){let t=function(d,x,q){let D=[],V=new Array,$=0,F=d.childNodes;for(;$<F.length;){let I=F[$];++$,V.push(I)}let O=V,B=0;for(;B<O.length;){let I=O[B];++B;try{if(I.getAttribute("data-froomle-ordervalue")!=null){D.push(I);let P=e.createElement("span");P.setAttribute("data-froomle-tmp-node","tmp"),d.replaceChild(P,I)}}catch{}}let h=[],w=0;for(;w<D.length;){let I=D[w];++w,h.push(I.getAttribute("data-froomle-ordervalue"))}return{el:d,key:x,values:h,orderChildren:D,list_name:q}},r=null,s=new Promise(function(d,x){r=d}),n=s;n._resolve=r,n._isFinished=!1,n._result=null;let l=s,a=e.getRoot(),m=new Array,g=a.querySelectorAll("*"),f=0,_=g.length;for(;f<_;){let d=f++,x=g.item(d);x instanceof HTMLElement&&m.push(x)}let c=m,y=[],b=0;for(;b<c.length;){let d=c[b];++b;let x=0,q=new Array,D=0,V=d.attributes;for(;D<V.length;){let F=V[D];++D,q.push({name:F.name,value:F.value})}let $=q;for(;x<$.length;){let F=$[x];++x,F.name.startsWith("data-froomle-order-")&&y.push(t(d,F.name.substring(19),F.value))}}if(y.length<1){let d=l;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),l}let p=[],S=0;for(;S<y.length;){let d=y[S];++S;let x={list_name:d.list_name,limit:d.values.length,list_size:d.values.length},q={};R.setProperty(q,d.key,d.values),R.setProperty(x,"order",q),p.push(x)}if(o.getPageVisit()==null){let d=l;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),l}else if(o.getEnvironment()==null){let d=l;return d._isFinished||(d._result=!1,d._isFinished=!0,d._resolve(!1)),l}try{o.getRawRecommendations(p).then(function(d){let x=d.lists(),q=x.length,D=0,V=q;for(;D<V;){let F=D++,O=x[F],B=y[F];B.el.setAttribute("data-froomle-request-id",d.request_id);let h=new Array,w=0,I=O.items;for(;w<I.length;){let M=I[w];++w;let T=M.get(B.key),U=M.get(B.key),X=B.values.length,ie=0,pe=X;for(;ie<pe;){let le=ie++,he=B.values[le];if(T==he){let jt=B.orderChildren.length,Rt=B.orderChildren[le];h.push(Rt),B.orderChildren.splice(le,1),B.values.splice(le,1);break}}}let C=h.length,P=B.el,j=new Array,H=0,J=P.childNodes;for(;H<J.length;){let M=J[H];++H,j.push(M)}let K=j.length,W=0,z=K;for(;W<z;){let M=W++,T=B.el,U=new Array,X=0,ie=T.childNodes;for(;X<ie.length;){let he=ie[X];++X,U.push(he)}let pe=U[M],le;if(pe instanceof HTMLElement?le=pe.hasAttribute("data-froomle-tmp-node"):le=!1,le){B.el.replaceChild(h[0],pe),h.splice(0,1);let he=h.length;if(h.length==0)break}}}let $=l;$._isFinished||($._result=!0,$._isFinished=!0,$._resolve(!0))})}catch{let x=l;x._isFinished||(x._result=!1,x._isFinished=!0,x._resolve(!1))}return l}static domInit(e){let t=null,r=new Promise(function(l,a){t=l}),s=r;s._resolve=t,s._isFinished=!1,s._result=null;let n=r;return ne._orderElements(e).then(function(l){ne._buildHistories(e.getRoot()),ne._fillRecoTargets(e.getRoot()).then(function(a){let m=n;m._isFinished||(m._result=!0,m._isFinished=!0,m._resolve(!0))})}),n}static fillElementRecos(e){ne._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t;try{let s=new DOMParser().parseFromString(e,"text/html"),n=new xe;n.root=s.documentElement,t=n}catch{return e}return ne.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return ne}};var ds=i.$global,L=i.global("$hxClasses").FroomleSdk=class se{static register(){se.registered||se._env_set&&se._page_visit_set&&(se.registered=!0)}static buildScriptTag(){let e='<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="'+o.getEnvironment()+'" ',t=o.getPageVisit();t!=null&&(e+='data-froomle-page-visit="'+t+'" ');let r=o.getContextItem();if(r!=null){e+='data-froomle-context-item="'+r+'" ';let g=o.getContextItemType();(g==null||g=="")&&(g="article"),e+='data-froomle-context-item-type="'+g+'" '}let s=o.getDeviceId();s!=null&&(e+='data-froomle-device-id="'+s+'" ');let n=o.getUserId();n!=null&&(e+='data-froomle-user-id="'+n+'" ');let l=o.getConsent();l>0&&(e+='data-froomle-consent="'+l+'" ');let a=o.getRequestDomain();a!=null&&(e+='data-froomle-request-domain="'+a+'" ');let m=o.getChannel();return m!=null&&(e+='data-froomle-channel="'+m+'" '),e+="></script>",e}static setEnvironment(e){o.setEnvironment(e),se._env_set=!0,se.register()}static setDeviceId(e){o.setDeviceId(e)}static setUserId(e){o.setUserId(e)}static setConsent(e){o.setConsent(e)}static setPageVisit(e){o.setPageVisit(e),se._page_visit_set=!0,se.register()}static setChannel(e){o.setChannel(e)}static setRequestDomain(e){o.setRequestDomain(e)}static setSafeRequest(e){o.setSafeRequest(e)}static setContextItem(e){o.setContextItem(e)}static setContextItemType(e){o.setContextItemType(e)}static setCustomVariable(e,t){o.setOthers(e,t)}static getUserId(){return o.getUserId()}static getDeviceId(){return o.getDeviceId()}static getEnvironment(){return o.getEnvironment()}static getSafeRequest(){return o.getSafeRequest()}static getPageVisit(){return o.getPageVisit()}static getConsent(){return o.getConsent()}static getRecommendations(e){return o.getRawRecommendations(e)}static getChannel(){return o.getChannel()}static getVersion(){return"0.0.11"}static runFromHtml(e){return oe.runFromHtml(e)}static get __name__(){return"FroomleSdk"}get __class__(){return se}};L._env_set=!1;L._page_visit_set=!1;L.registered=!1;var ys=i.$global;function mt(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}function Pe(){return o.getConsent()>=1}function gt(){return o.getConsent()<2?"no-consent":o.getDeviceId()}function ft(){let u=o.getChannel();if(u)return u}function Dt(u){let e=(u==null?void 0:u.getAttribute("data-froomle-id"))||(u==null?void 0:u.getAttribute("data-froomle-action-item"));if(e)return e}function Pt(u){let e=(u==null?void 0:u.getAttribute("data-froomle-item-type"))||(u==null?void 0:u.getAttribute("data-froomle-action-item-type"));if(e)return e}function _t(u){var r;let e=u==null?void 0:u.getAttribute("data-froomle-user-group");return e||(typeof document=="undefined"?void 0:((r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group"))||void 0)}function dt(u,e,t="impression",r){if(!Pe())return;let s=ft()||"www-desktop",n={event_type:t,page_type:o.getPageVisit(),action_item:u,action_item_type:e,channel:s,device_id:gt()},l=_t();if(l&&(n.user_group=l),r)for(let a in r)n[a]=r[a];try{fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({events:[n]})})}catch{}}var A=class A{static queueIfNotPresent(e){A.impressionQueue.includes(e)||A.impressionQueue.push(e)}static generateBody(){let e=[];for(let t of A.impressionQueue){let r=Dt(t);if(!r)continue;let s=Pt(t)||"article",n=ft()||"www-desktop",l={event_type:"impression",page_type:o.getPageVisit(),action_item:r,action_item_type:s,channel:n,device_id:gt()},a=_t(t);a&&(l.user_group=a),o.getConsent()>=2&&o.getUserId()&&(l.user_id=o.getUserId());let m=t.getAttribute("data-froomle-reco"),g=t.getAttribute("data-froomle-request-id");m&&g&&(l.list_name=m,l.request_id=g),e.push(l)}return A.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){console.log(A.impressionQueue),A.impressionQueue.length!==0&&Pe()&&fetch(mt(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:A.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=A.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){A.observer.observe(e)}static processDocument(){if(Pe()){console.log("\u{1F680} Processing document for impressions");for(let e of document.querySelectorAll("[data-froomle-id]"))A.intersectsWithViewPortRect(e)?A.queueIfNotPresent(e):A.addIntersectionImpressionListener(e);A.sendImpressions()}}static processElement(e){if(!Pe()||!(e instanceof Element))return;let t=[];e.matches("[data-froomle-id]")&&t.push(e);for(let r of e.querySelectorAll("[data-froomle-id]"))t.push(r);if(t.length!==0){for(let r of t)A.intersectsWithViewPortRect(r)?A.queueIfNotPresent(r):A.addIntersectionImpressionListener(r);A.sendImpressions()}}};A.impressionQueue=[],A.observer=null;var Q=A;typeof document!="undefined"&&(Q.observer=new IntersectionObserver((u,e)=>{u.forEach(t=>{t.isIntersecting&&(Q.impressionQueue.push(t.target),Q.observer.unobserve(t.target))}),Q.impressionQueue.length>0&&Q.sendImpressions()}));var Re=class u{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=u.readChannel()||"www-desktop",t={event_type:"page_visit",page_type:o.getPageVisit(),channel:e,device_id:u.readDeviceId()},r=u.readUserGroup();return r&&(t.user_group=r),o.getConsent()>=2&&o.getUserId()&&(t.user_id=o.getUserId()),JSON.stringify({events:[t]})}static sendPageVisit(){o.getPageVisit()&&(o.getContextItem()||u.canTrackEvents()&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()}))}};var Ie=class u{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItemType(){let e=o.getContextItemType();if(e)return e}static readUserGroup(){var t;return typeof document=="undefined"?void 0:((t=document.querySelector("[data-froomle-user-group]"))==null?void 0:t.getAttribute("data-froomle-user-group"))||void 0}static uri(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}static generateBody(){let e=u.readActionItemType()||"article",t=u.readChannel()||"www-desktop",r={event_type:"detail_pageview",page_type:o.getPageVisit(),action_item:o.getContextItem(),action_item_type:e,channel:t,device_id:u.readDeviceId()},s=u.readUserGroup();return s&&(r.user_group=s),o.getConsent()>=2&&o.getUserId()&&(r.user_id=o.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){o.getContextItem()&&o.getPageVisit()&&u.canTrackEvents()&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var ee=class ee{static canTrackEvents(){return o.getConsent()>=1}static readDeviceId(){return o.getConsent()<2?"no-consent":o.getDeviceId()}static readChannel(){let e=o.getChannel();if(e)return e}static readActionItem(e){let t=e.getAttribute("data-froomle-id")||e.getAttribute("data-froomle-action-item");if(t)return t}static readActionItemType(e){let t=e.getAttribute("data-froomle-item-type")||e.getAttribute("data-froomle-action-item-type");if(t)return t}static readUserGroup(e){var s;let t=e.getAttribute("data-froomle-user-group");return t||(typeof document=="undefined"?void 0:((s=document.querySelector("[data-froomle-user-group]"))==null?void 0:s.getAttribute("data-froomle-user-group"))||void 0)}static registerClickables(){ee.listenerRegistered||(ee.listenerRegistered=!0,document.addEventListener("click",e=>{if(!ee.canTrackEvents())return;let t=e instanceof MouseEvent?e:null,r=e.target,s=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!s)return;let n=s.closest("a");if(!n)return;let l=n.closest("[data-froomle-id]");if(!l)return;let a=ee.readActionItem(l);if(!a)return;let m=ee.readActionItemType(l)||"article",g=ee.readChannel()||"www-desktop",f=n instanceof HTMLAnchorElement?n.href:null,_=!!f&&e.cancelable&&!e.defaultPrevented&&!n.hasAttribute("download")&&(!n.target||n.target==="_self")&&!!t&&t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey;_&&e.preventDefault();let c={event_type:"click_on_recommendation",page_type:o.getPageVisit(),action_item:a,action_item_type:m,channel:g,device_id:ee.readDeviceId()},y=ee.readUserGroup(l);y&&(c.user_group=y);let b=l.getAttribute("data-froomle-reco"),p=l.getAttribute("data-froomle-request-id");b&&p&&(c.list_name=b,c.request_id=p),o.getConsent()>=2&&o.getUserId()&&(c.user_id=o.getUserId());let d=(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events",x=JSON.stringify({events:[c]}),q=new Blob([x],{type:"application/json"}),D=()=>fetch(d,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:x,keepalive:!0});if(_&&f){let $=!1,F=()=>{$||($=!0,window.location.assign(f))},O=window.setTimeout(F,200);D().catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(d,q)}).finally(()=>{window.clearTimeout(O),F()});return}typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(d,q)||D().catch(()=>{})},!0))}};ee.listenerRegistered=!1;var Ee=ee;var Tt=xe,pt=L.setEnvironment,ht=L.setPageVisit,yt=L.setRequestDomain,bt=L.setSafeRequest,vt=typeof L.setChannel=="function"?L.setChannel:o.setChannel,wt=L.setContextItem,xt=L.setContextItemType,At=L.setCustomVariable,$t=o.addHistories;function Me(u){L.setUserId(u),document.cookie=`froomle_user_id=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Ge(u){L.setDeviceId(u),document.cookie=`froomle_device_id=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Je(u){L.setConsent(u),document.cookie=`froomle_consent=${u}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${L.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window!="undefined"&&(window.setFroomleConsent=Je);function Ne(u){let e=document.cookie.split("; ");for(let t of e){let[r,s]=t.split("=");if(r===u)return decodeURIComponent(s)}return null}var Ft=L.getRecommendations;if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document!="undefined")){let u=document.currentScript;if(u){let t=u.getAttribute("data-froomle-device-id"),r=u.getAttribute("data-froomle-user-id"),s=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),l=u.getAttribute("data-froomle-request-domain"),a=u.getAttribute("data-froomle-context-item"),m=u.getAttribute("data-froomle-context-item-type"),g=u.getAttribute("data-froomle-safe-request"),f=u.getAttribute("data-froomle-channel");if(pt(s),n&&ht(n),a&&(wt(a),xt(m||"article")),t)Ge(t);else{let _=Ne("froomle_device_id");_&&Ge(_)}if(r)Me(r);else{let _=Ne("froomle_user_id");_&&Me(_)}l&&yt(l),g&&bt(g!=="false"),f&&vt(f)}let e=Ne("froomle_consent");e&&Je(e),document.addEventListener("DOMContentLoaded",()=>{console.log("froomle loads dom"),oe.domInit(Tt.fromDocument(document)).then(s=>{Ee.registerClickables(),Q.processDocument(),Re.sendPageVisit(),Ie.sendPageView()});function t(s){return s.matches("[data-froomle-reco]")||s.querySelector("[data-froomle-reco]")!==null}new MutationObserver(s=>{for(let n of s)if(n.type==="childList"&&n.addedNodes.forEach(l=>{l instanceof Element&&(t(l)&&oe.fillElementRecos(l),Q.processElement(l))}),n.type==="attributes"&&n.target instanceof Element)if(n.attributeName==="data-froomle-reco"){let l=n.target.getAttribute("data-froomle-request-id");(!l||l==="")&&oe.fillElementRecos(n.target)}else if(n.attributeName==="data-froomle-request-id"){let l=n.target.getAttribute("data-froomle-request-id"),a=n.target.getAttribute("data-froomle-id");n.target.getAttribute("data-froomle-reco")&&(!l||l==="")&&(!a||a==="")&&oe.fillElementRecos(n.target)}else n.attributeName==="data-froomle-id"&&Q.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-froomle-reco","data-froomle-request-id","data-froomle-id"]})})}function Ot(){let u,e;return{promise:new Promise((r,s)=>{u=r,e=s}),resolve:u,reject:e}}var Te=[];function Bt(){var u;return typeof document=="undefined"?"":((u=document.querySelector("[data-froomle-user-group]"))==null?void 0:u.getAttribute("data-froomle-user-group"))||""}function Ht(u,e){var n;let t=u,s=((n=t==null?void 0:t.UserGroup)!=null?n:typeof(t==null?void 0:t.get)=="function"?t.get("user_group"):void 0)||e;if(s&&(t.UserGroup=s,typeof(t==null?void 0:t.getData)=="function")){let l=t.getData();l&&(!l.user_group||l.user_group==="")&&(l.user_group=s)}}async function Ut(){let u=Te.map(n=>n.req),e=o.requestsToLists(u),t=await o.getRawRecommendations(e),r=t.user_group||"";typeof document!="undefined"&&r&&document.documentElement.setAttribute("data-froomle-user-group",r);let s=t.lists().reduce((n,l)=>[...n,...l.items],[]);s.forEach(n=>Ht(n,r)),Te.forEach((n,l)=>{s[l]?n.deferred.resolve(s[l]):n.deferred.reject(new Error("No recommendation available"))}),Te.length=0}function Lt(u){let e,t,s={promise:new Promise((n,l)=>{e=n,t=l}),resolve:e,reject:t};return Te.push({deferred:s,req:u}),s}function Vt(u){let t=Lt(u).promise,r=Ot(),s=function(l,a){return t.then(m=>(n.completeTarget=m,l?l(m):m),m=>a?a(m):Promise.reject(m))},n=new Proxy(new re({item_id:"",request_id:"",user_group:""}),{get(l,a,m){if(a==="then")return s;if(a==="__froomleList")return u.list;if(a==="get"){let _=Reflect.get(l,a,m);return function(...c){return _.apply(this,c)}}if(typeof a!="string")return Reflect.get(l,a,m);let g=Reflect.get(l,a,m);if(g!=null&&g!=="")return g;let f=l.get(a);return f!=null&&f!==""?f:""},set(l,a,m,g){if(a==="completeTarget"){if(Object.assign(l,m),!l.UserGroup){let f=Bt();if(f){l.UserGroup=f;let _=l.getData();_&&!_.user_group&&(_.user_group=f)}}return!0}return Reflect.set(l,a,m,g)},has(l,a){return l.get(a)!==void 0}});return n}export{ge as a,fe as b,_e as c,o as d,dt as e,Q as f,Re as g,Ie as h,Ee as i,pt as j,ht as k,yt as l,bt as m,vt as n,wt as o,xt as p,At as q,$t as r,Me as s,Ge as t,Je as u,Ft as v,Ut as w,Vt as x};
|