@froomle/frontend-sdk 0.0.18 → 0.0.20
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/LICENSE +201 -0
- package/README.md +4 -1
- package/dist/froomle.global.js +5 -5
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +17 -183
- package/dist/index.js +1 -1
- package/dist/js-D9i4Px3D.js +5 -0
- package/dist/react.cjs +1 -0
- package/dist/react.d.ts +45 -27
- package/dist/react.js +1 -1
- package/dist/src-C84O1lSi.js +1 -0
- package/dist/src-CLF-A8No.cjs +5 -0
- package/package.json +7 -7
- package/dist/Recommendations.d-HGeAMYU5.d.ts +0 -49
- package/dist/chunk-GJPFNIOF.js +0 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
# Froomle Frontend SDK
|
|
1
|
+
# Froomle Frontend SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@froomle/frontend-sdk)
|
|
4
|
+
[](https://www.npmjs.com/package/@froomle/frontend-sdk)
|
|
2
5
|
|
|
3
6
|
Public documentation is located at:
|
|
4
7
|
|
package/dist/froomle.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
`;
|
|
3
|
-
`),
|
|
4
|
-
`+
|
|
5
|
-
`),y=[],f=0,_=m;for(;f<_.length;){let b=_[f];++f,b!=""&&y.push(b)}m=y;let I=new et;r.responseHeaders=I;let C=0;for(;C<m.length;){let b=m[C];++C;let x=b.split(": "),D=x.shift(),q=x.length==1?x[0]:x.join(": ");q=ue.ltrim(ue.rtrim(q)),r.responseHeaders.inst.set(D,q)}r.success(_e.ofData(t.response))}else if(h==null||h==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(h==null){r.req=null;let m=t.response!=null?_e.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(h){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 m=t.response!=null?_e.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=i);let n,l=this.postData,a=this.postBytes;if(l==null)if(a==null)n=null;else{let d=a;n=new Blob([d.b.bufferValue])}else a==null?n=l:n=null;if(n!=null)e=!0;else{let d=0,h=this.params;for(;d<h.length;){let m=h[d];++d,n==null?n="":n=(n==null?"null":E.string(n))+"&";let y=m.name,f=(n==null?"null":E.string(n))+encodeURIComponent(y)+"=",_=m.value;n=f+encodeURIComponent(_)}}try{if(e)t.open("POST",this.url,this.async);else if(n!=null){let d=this.url.split("?").length<=1;t.open("GET",this.url+(d?"?":"&")+(n==null?"null":E.string(n)),this.async),n=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(d){let h=P.caught(d).unwrap();this.req=null,this.onError(h.toString());return}t.withCredentials=this.withCredentials,!rt.exists(this.headers,function(d){return d.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let g=0,c=this.headers;for(;g<c.length;){let d=c[g];++g,t.setRequestHeader(d.name,d.value)}t.send(n),this.async||i(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return te}get __class__(){return st}};ce.prototype.async=null;ce.prototype.withCredentials=null;ce.prototype.responseHeaders=null;ce.prototype.req=null;var xn=s.$global,Ne=s.global("$hxClasses").Type=class lt{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 lt}};var Rn=s.$global,R=s.global("$hxClasses").Reflect=class ot{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 ot}};var Pn=s.$global,je=s.global("$hxClasses")["internal.http.FetchHttp"]=class at extends s.inherits(ce){[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=Ne.createInstance(i,[]),a=0,g=this.headers;for(;a<g.length;){let _=g[a];++a,l.append(_.name,_.value)}let c=e?"POST":"GET",d=null;if(e)if(this.postData!=null)d=this.postData;else{d=Ne.createInstance(n,[]);let _=0,I=this.params;for(;_<I.length;){let C=I[_];++_,d.append(C.name,C.value)}}let h={method:c,headers:l,body:d},m=this,y=r(this.url,h).then(function(_){if(m.responseStatus=_.status,m.onStatus(_.status),_.ok)return _.text();throw P.thrown("HTTP Error: "+E.string(_.status))}).then(function(_){m.onData(_)}),f=R.field(y,"catch");f!=null&&f.apply(y,[function(_){m.onError(E.string(_))}])}static get __name__(){return"internal.http.FetchHttp"}static get __super__(){return ce}get __class__(){return at}};je.prototype.responseStatus=null;var Bn=s.$global,Ve=s.global("$hxClasses")["internal.data.UUID"]=class ut{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 ut}};Ve.HEX="0123456789abcdef";var jn=s.$global,ge=function(){};ge.__isInterface__=!0;var fe=function(){};fe.__isInterface__=!0;var de=function(){};de.__isInterface__=!0;var Qn=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 a=v.noConsentBody(),g=0,c=R.fields(a);for(;g<c.length;){let d=c[g];++g,t[d]=R.field(a,d)}}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 a=i[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(){return{pageviews:v._history}}static requestsToLists(e){let t=[],r="",i=[],n=0,l=[],a=function(m,y,f){r=m,i=y,n=0,l=f},g=function(m){let y=[];if(m==null)return y;let f=0;for(;f<m.length;){let _=m[f];++f,!(_==null||_.key==null||_.key=="")&&y.push({key:_.key,value:_.value})}return y},c=function(m,y){if(m==null&&y==null)return!0;if(m==null||y==null||m.length!=y.length)return!1;let f=new Array(m.length),_=0,I=m.length;for(;_<I;){let A=_++;f[A]=JSON.stringify(m[A])}let C=f,b=new Array(y.length),x=0,D=y.length;for(;x<D;){let A=x++;b[A]=JSON.stringify(y[A])}let q=b;C.sort(R.compare),q.sort(R.compare);let M=0,N=C.length;for(;M<N;){let A=M++;if(C[A]!=q[A])return!1}return!0},d=function(){let m={limit:n,list_name:r,list_size:n},y=0;for(;y<i.length;){let _=i[y];++y;let I=_.value;I instanceof Array||(I=[I]),m[_.key]=I}let f=0;for(;f<l.length;){let _=l[f];++f,m[_.key]=_.value}t.push(m)},h=0;for(;h<e.length;){let m=e[h];++h;let y=g(m.filters),f=m.others!=null?m.others:[];if(r==""){a(m.list,y,f),n+=1;continue}else(r!=m.list||!c(i,y)||!c(l,f))&&(d(),a(m.list,y,f));n+=1}return n!=0&&d(),t}static _requestRecos(e){let t=null,r=null,i=new Promise(function(f,_){t=f,r=_}),n=i;n._resolve=t,n._reject=r,n._isFinished=!1,n._result=null,n._error=null;let l=i,a=!1,g=new je(v._requestUri());g.setHeader("Content-Type","application/json");let c=v.buildRequestBody(e),d=JSON.stringify(c);g.setPostData(d);let h=function(f){if(a)return;a=!0;let _=l;_._isFinished||(_._error=f,_._isFinished=!0,_._reject(f))};g.onError=function(f){h("HTTP Request Error: "+f)},g.onStatus=function(f){(f<200||f>=300)&&h("HTTP Status Error: "+f)};try{g.request(!0)}catch(f){let _=P.caught(f).unwrap();return h("Failed to execute recommendation request: "+E.string(_)),l}let m=function(f){if(!a)try{let _=JSON.parse(f),I=pe.fromRequestData(_);a=!0;let C=l;C._isFinished||(C._result=I,C._error=null,C._isFinished=!0,C._resolve(I))}catch(_){let I=P.caught(_).unwrap();h("Failed to parse recommendation response: "+E.string(I))}},y=g.get_responseData();return y!=null?m(y):a||(g.onData=m),l}static getOrder(e,t,r){let i={list_name:e,limit:r.length,list_size:r.length},n={};R.setProperty(n,t,r),R.setProperty(i,"order",n);let l=null,a=null,g=new Promise(function(m,y){l=m,a=y}),c=g;c._resolve=l,c._reject=a,c._isFinished=!1,c._result=null,c._error=null;let d=g,h;return v.getRawRecommendations([i]).then(function(m){try{let y=[],f=m.lists();if(f!=null&&f.length>0){let I=f[0].items;if(I instanceof Array){let C=0,b=I;for(;C<b.length;){let x=b[C];++C;let D=x.get("categories");D!=null&&y.push(D)}}}let _=d;_._isFinished||(_._result=y,_._error=null,_._isFinished=!0,_._resolve(y))}catch(y){let f=P.caught(y).unwrap(),_="Failed to build order response: "+E.string(f),I=d;I._isFinished||(I._error=_,I._isFinished=!0,I._reject(_))}},function(m){let y=d;y._isFinished||(y._error=m,y._isFinished=!0,y._reject(m))}),d}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 h=E.string(n);h!=""&&v._history.push({id:h,item_type:r});continue}let l=n,a=R.field(l,"id");if(a==null)continue;let g=E.string(a);if(g=="")continue;let c=R.field(l,"item_type");(c==null||E.string(c)=="")&&(c=R.field(l,"itemType"));let d=c!=null&&E.string(c)!=""?E.string(c):r;v._history.push({id:g,item_type:d})}}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(Ve.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 Le 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 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 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,a=i.items;for(;l<a.length;){let g=a[l];++l,n.items.push(ve.__cast(g,le).getData())}e.lists.push(n)}return JSON.stringify(e)}static fromRequestData(e){let t=R.getProperty(e,"lists"),r=[],i=0;for(;i<t.length;){let n=t[i];++i;let l=R.getProperty(n,"items"),a=[],g=0;for(;g<l.length;){let d=l[g];++g,R.setProperty(d,"request_id",R.getProperty(e,"request_id")),R.setProperty(d,"user_group",R.getProperty(e,"user_group")),a.push(new le(d))}let c=new me({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(c)}return new Le(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 Le}};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 me=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class ct 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[fe]}get __class__(){return ct}};me.prototype.limit=null;me.prototype.list_key=null;me.prototype.list_name=null;me.prototype.list_size=null;me.prototype.items=null;me.prototype.request_id=null;var le=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class mt extends s.inherits(){[s.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[de]}get __class__(){return mt}};le.prototype.Id=null;le.prototype.RequestId=null;le.prototype.UserGroup=null;le.prototype._data=null;var Zn=s.$global,Ue=function(){};Ue.__isInterface__=!0;var ni=s.$global,Ie=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}};Ie.prototype.root=null;var gi=s.$global,ae=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class ne extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=null,r=null,i=new Promise(function(p,w){t=p,r=w}),n=i;n._resolve=t,n._reject=r,n._isFinished=!1,n._result=null,n._error=null;let l=i;if(e==null){let p=l;return p._isFinished||(p._result=!1,p._error=null,p._isFinished=!0,p._resolve(!1)),l}let a=[],g=new Array,c=e.querySelectorAll("*"),d=0,h=c.length;for(;d<h;){let p=d++,w=c.item(p);w instanceof HTMLElement&&g.push(w)}let m=g;m.push(e);let y=0;for(;y<m.length;){let p=m[y];++y;let w=0,k=new Array,S=0,F=p.attributes;for(;S<F.length;){let j=F[S];++S,k.push({name:j.name,value:j.value})}let T=k;for(;w<T.length;){let j=T[w];++w,j.name=="data-froomle-reco"&&a.push(p)}}let f=[],_=0;for(;_<a.length;){let p=a[_];++_;let w=p.getAttribute("data-froomle-request-id"),k=p.getAttribute("data-froomle-id"),S=w!=null&&w!="",F=k!=null&&k!="";!S&&!F&&f.push(p)}if(f.length<1){let p=null,w=null,k=new Promise(function(F,T){p=F,w=T}),S=k;return S._resolve=p,S._reject=w,S._isFinished=!1,S._result=null,S._error=null,k}let I=[],C=[],b="",x=[],D=[],q=[],M=function(p,w){if(p.length!=w.length)return!1;let k=new Array(p.length),S=0,F=p.length;for(;S<F;){let O=S++;k[O]=JSON.stringify(p[O])}let T=k,j=new Array(w.length),z=0,X=w.length;for(;z<X;){let O=z++;j[O]=JSON.stringify(w[O])}let Q=j;T.sort(R.compare),Q.sort(R.compare);let W=0,J=T.length;for(;W<J;){let O=W++;if(T[O]!=Q[O])return!1}return!0},N=function(){let p={list_name:b,list_size:D.length,limit:D.length},w=0;for(;w<x.length;){let S=x[w];if(++w,S!=null&&S.key!=null&&S.key!=""){let F=S.value;F instanceof Array||(F=[F]),R.setProperty(p,S.key,F)}}let k=0;for(;k<q.length;){let S=q[k];++k,R.setProperty(p,S.key,S.value)}I.push(p),C.push(D)},A=function(p,w,k,S){b=p,x=w,D=[S],q=k},K=0;for(;K<f.length;){let p=f[K];++K;let w=function(j){let z=[],X=0,Q=new Array,W=0,J=j.attributes;for(;W<J.length;){let V=J[W];++W,Q.push({name:V.name,value:V.value})}let O=Q;for(;X<O.length;){let V=O[X];if(++X,V.name.startsWith("data-froomle-reco-filter-")){let Z=U.substr(V.name,25,null),se=V.value;z.push({key:Z,value:se})}}return z},k=function(j){let z=[],X=0,Q=new Array,W=0,J=j.attributes;for(;W<J.length;){let V=J[W];++W,Q.push({name:V.name,value:V.value})}let O=Q;for(;X<O.length;){let V=O[X];if(++X,V.name.startsWith("data-froomle-variable-")){let Z=U.substr(V.name,22,null),se=V.value;z.push({key:Z,value:se})}}return z},S=p.getAttribute("data-froomle-reco"),F=w(p),T=k(p);if(b==""){A(S,F,T,p);continue}else if(S==b&&M(x,F)&&M(q,T)){D.push(p);continue}else{N(),A(S,F,T,p);continue}}b!=""&&N();let $;if(o.getPageVisit()==null){let p=l;return p._isFinished||(p._result=!1,p._error=null,p._isFinished=!0,p._resolve(!1)),l}else if(o.getEnvironment()==null){let p=l;return p._isFinished||(p._result=!1,p._error=null,p._isFinished=!0,p._resolve(!1)),l}else try{$=o.getRawRecommendations(I)}catch{let w=l;return w._isFinished||(w._result=!1,w._error=null,w._isFinished=!0,w._resolve(!1)),l}return $.then(function(p){let w=p.lists(),k=w.length,S=0,F=k;for(;S<F;){let j=S++,z=w[j],X=z.items.length!=C[j].length,Q=z.items.length,W=0,J=Q;for(;W<J;){let O=W++,V=z.items[O],Z=C[j][O];ne._fillParameters(Z,V,p.request_id)}}let T=l;T._isFinished||(T._result=!0,T._error=null,T._isFinished=!0,T._resolve(!0))}),l}static getAttrByPath(e,t,r){r==null&&(r="fgh");try{t=new xe("\\\\[(\\\\w+)\\\\]","g").map(t,function(c){return"."+c.matched(1)}),t=ue.replace(t,"[","."),t=ue.replace(t,"]",""),U.cca(t,0)==46&&(t=U.substr(t,1,null));let n=t.split("."),l=e.get(n[0]),a=1,g=n.length;for(;a<g;){let c=a++;if(l==null)return null;l instanceof Array&&E.parseInt(n[c])!=null?l=l[E.parseInt(n[c])]:l=R.field(l,n[c])}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 c=n++,d=i.item(c);d instanceof HTMLElement&&r.push(d)}let a=r,g=0;for(;g<a.length;){let c=a[g];++g,t.push(c.getAttribute("data-froomle-id"))}o.addHistories(t)}static fillParam(e,t,r,i,n){n==null&&(n="");try{let l=ne.getAttrByPath(i,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 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("*"),a=0,g=l.length;for(;a<g;){let h=a++,m=l.item(h);m instanceof HTMLElement&&n.push(m)}let c=n,d=0;for(;d<c.length;){let h=c[d];++d;let m=0,y=new Array,f=0,_=h.attributes;for(;f<_.length;){let C=_[f];++f,y.push({name:C.name,value:C.value})}let I=y;for(;m<I.length;){let C=I[m];if(++m,C.name.startsWith("data-froomle-param-")){let b=ue.replace(C.name,"data-froomle-param-",""),x=C.value;ne.fillParam(h,b,x,t)}}}}static _orderElements(e){let t=function(b,x,D){let q=[],M=new Array,N=0,A=b.childNodes;for(;N<A.length;){let k=A[N];++N,M.push(k)}let K=M,$=0;for(;$<K.length;){let k=K[$];++$;try{if(k.getAttribute("data-froomle-ordervalue")!=null){q.push(k);let F=e.createElement("span");F.setAttribute("data-froomle-tmp-node","tmp"),b.replaceChild(F,k)}}catch{}}let p=[],w=0;for(;w<q.length;){let k=q[w];++w,p.push(k.getAttribute("data-froomle-ordervalue"))}return{el:b,key:x,values:p,orderChildren:q,list_name:D}},r=null,i=null,n=new Promise(function(b,x){r=b,i=x}),l=n;l._resolve=r,l._reject=i,l._isFinished=!1,l._result=null,l._error=null;let a=n,g=e.getRoot(),c=new Array,d=g.querySelectorAll("*"),h=0,m=d.length;for(;h<m;){let b=h++,x=d.item(b);x instanceof HTMLElement&&c.push(x)}let y=c,f=[],_=0;for(;_<y.length;){let b=y[_];++_;let x=0,D=new Array,q=0,M=b.attributes;for(;q<M.length;){let A=M[q];++q,D.push({name:A.name,value:A.value})}let N=D;for(;x<N.length;){let A=N[x];++x,A.name.startsWith("data-froomle-order-")&&f.push(t(b,A.name.substring(19),A.value))}}if(f.length<1){let b=a;return b._isFinished||(b._result=!1,b._error=null,b._isFinished=!0,b._resolve(!1)),a}let I=[],C=0;for(;C<f.length;){let b=f[C];++C;let x={list_name:b.list_name,limit:b.values.length,list_size:b.values.length},D={};R.setProperty(D,b.key,b.values),R.setProperty(x,"order",D),I.push(x)}if(o.getPageVisit()==null){let b=a;return b._isFinished||(b._result=!1,b._error=null,b._isFinished=!0,b._resolve(!1)),a}else if(o.getEnvironment()==null){let b=a;return b._isFinished||(b._result=!1,b._error=null,b._isFinished=!0,b._resolve(!1)),a}try{o.getRawRecommendations(I).then(function(b){let x=b.lists(),D=x.length,q=0,M=D;for(;q<M;){let A=q++,K=x[A],$=f[A];$.el.setAttribute("data-froomle-request-id",b.request_id);let p=new Array,w=0,k=K.items;for(;w<k.length;){let J=k[w];++w;let O=J.get($.key),V=J.get($.key),Z=$.values.length,se=0,he=Z;for(;se<he;){let oe=se++,ye=$.values[oe];if(O==ye){let Mt=$.orderChildren.length,Rt=$.orderChildren[oe];p.push(Rt),$.orderChildren.splice(oe,1),$.values.splice(oe,1);break}}}let S=p.length,F=$.el,T=new Array,j=0,z=F.childNodes;for(;j<z.length;){let J=z[j];++j,T.push(J)}let X=T.length,Q=0,W=X;for(;Q<W;){let J=Q++,O=$.el,V=new Array,Z=0,se=O.childNodes;for(;Z<se.length;){let ye=se[Z];++Z,V.push(ye)}let he=V[J],oe;if(he instanceof HTMLElement?oe=he.hasAttribute("data-froomle-tmp-node"):oe=!1,oe){$.el.replaceChild(p[0],he),p.splice(0,1);let ye=p.length;if(p.length==0)break}}}let N=a;N._isFinished||(N._result=!0,N._error=null,N._isFinished=!0,N._resolve(!0))})}catch{let x=a;x._isFinished||(x._result=!1,x._error=null,x._isFinished=!0,x._resolve(!1))}return a}static domInit(e){let t=null,r=null,i=new Promise(function(a,g){t=a,r=g}),n=i;n._resolve=t,n._reject=r,n._isFinished=!1,n._result=null,n._error=null;let l=i;return ne._orderElements(e).then(function(a){ne._buildHistories(e.getRoot()),ne._fillRecoTargets(e.getRoot()).then(function(g){let c=l;c._isFinished||(c._result=!0,c._error=null,c._isFinished=!0,c._resolve(!0))})}),l}static fillElementRecos(e){ne._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t;try{let i=new DOMParser().parseFromString(e,"text/html"),n=new Ie;n.root=i.documentElement,t=n}catch{return e}return ne.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return ne}};var yi=s.$global,L=s.global("$hxClasses").FroomleSdk=class ie{static register(){ie.registered||ie._env_set&&ie._page_visit_set&&(ie.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 c=o.getContextItemType();(c==null||c=="")&&(c="article"),e+='data-froomle-context-item-type="'+c+'" '}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 a=o.getRequestDomain();a!=null&&(e+='data-froomle-request-domain="'+a+'" ');let g=o.getChannel();return g!=null&&(e+='data-froomle-channel="'+g+'" '),e+="><\/script>",e}static setEnvironment(e){o.setEnvironment(e),ie._env_set=!0,ie.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),ie._page_visit_set=!0,ie.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 ae.runFromHtml(e)}static get __name__(){return"FroomleSdk"}get __class__(){return ie}};L._env_set=!1;L._page_visit_set=!1;L.registered=!1;var wi=s.$global;function _t(){return(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events"}function Fe(){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 Ht(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 Nt(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 dt(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 pt(u,e,t="impression",r){if(!Fe())return;let i=ft()||"www-desktop",n={event_type:t,page_type:o.getPageVisit(),action_item:u,action_item_type:e,channel:i,device_id:gt()},l=dt();if(l&&(n.user_group=l),r)for(let a in r)n[a]=r[a];try{fetch(_t(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({events:[n]})})}catch{}}var B=class B{static queueIfNotPresent(e){B.impressionQueue.includes(e)||B.impressionQueue.push(e)}static generateBody(){let e=[];for(let t of B.impressionQueue){let r=Ht(t);if(!r)continue;let i=Nt(t)||"article",n=ft()||"www-desktop",l={event_type:"impression",page_type:o.getPageVisit(),action_item:r,action_item_type:i,channel:n,device_id:gt()},a=dt(t);a&&(l.user_group=a),o.getConsent()>=2&&o.getUserId()&&(l.user_id=o.getUserId());let g=t.getAttribute("data-froomle-reco"),c=t.getAttribute("data-froomle-request-id");g&&c&&(l.list_name=g,l.request_id=c),e.push(l)}return B.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){console.log(B.impressionQueue),B.impressionQueue.length!==0&&Fe()&&fetch(_t(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:B.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=B.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){B.observer.observe(e)}static processDocument(){if(Fe()){console.log("\u{1F680} Processing document for impressions");for(let e of document.querySelectorAll("[data-froomle-id]"))B.intersectsWithViewPortRect(e)?B.queueIfNotPresent(e):B.addIntersectionImpressionListener(e);B.sendImpressions()}}static processElement(e){if(!Fe()||!(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)B.intersectsWithViewPortRect(r)?B.queueIfNotPresent(r):B.addIntersectionImpressionListener(r);B.sendImpressions()}}};B.impressionQueue=[],B.observer=null;var Y=B;typeof document!="undefined"&&(Y.observer=new IntersectionObserver((u,e)=>{u.forEach(t=>{t.isIntersecting&&(Y.impressionQueue.push(t.target),Y.observer.unobserve(t.target))}),Y.impressionQueue.length>0&&Y.sendImpressions()}));var Ee=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 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 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()},i=u.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()&&u.canTrackEvents()&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var H=class H{static readAttributeFromChain(e,t){let r=e;for(;r;){for(let i of t){let n=r.getAttribute(i);if(n)return n}r=r.parentElement}}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){return H.readAttributeFromChain(e,["data-froomle-id","data-froomle-action-item"])}static readActionItemType(e){return H.readAttributeFromChain(e,["data-froomle-item-type","data-froomle-action-item-type"])}static readUserGroup(e){var i;let t=H.readAttributeFromChain(e,["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(){H.listenerRegistered||(H.listenerRegistered=!0,document.addEventListener("click",e=>{if(!H.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 a=n.closest("[data-froomle-reco]"),g=(a?H.readActionItem(a):void 0)||H.readActionItem(l);if(!g)return;let c=(a?H.readActionItemType(a):void 0)||H.readActionItemType(l)||"article",d=H.readChannel()||"www-desktop",h=n instanceof HTMLAnchorElement?n.href:null,m=n.getAttribute("href"),y=typeof m=="string"&&m.trim().startsWith("#"),f=!!h&&!y&&e.cancelable&&!e.defaultPrevented&&!n.hasAttribute("download")&&(!n.target||n.target==="_self")&&!!t&&t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey,_=y&&e.cancelable&&!e.defaultPrevented;(f||_)&&e.preventDefault();let I={event_type:"click_on_recommendation",page_type:o.getPageVisit(),action_item:g,action_item_type:c,channel:d,device_id:H.readDeviceId()},C=(a?H.readUserGroup(a):void 0)||H.readUserGroup(l);C&&(I.user_group=C);let b=(a?H.readAttributeFromChain(a,["data-froomle-reco"]):void 0)||H.readAttributeFromChain(l,["data-froomle-reco"]),x=(a?H.readAttributeFromChain(a,["data-froomle-request-id"]):void 0)||H.readAttributeFromChain(l,["data-froomle-request-id"]);b&&x&&(I.list_name=b,I.request_id=x),o.getConsent()>=2&&o.getUserId()&&(I.user_id=o.getUserId());let q=(o.getSafeRequest()?"https://":"http://")+o.getRequestDomain()+"/api/"+o.getEnvironment()+"/events",M=JSON.stringify({events:[I]}),N=new Blob([M],{type:"application/json"}),A=K=>fetch(q,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:M,...K?{keepalive:!0}:{}});if(f&&h){let K=!1,$=()=>{K||(K=!0,window.location.assign(h))},p=window.setTimeout($,200);A(!0).catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(q,N)}).finally(()=>{window.clearTimeout(p),$()});return}A(!1).catch(()=>{typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(q,N)})},!0))}};H.listenerRegistered=!1;var Ce=H;var ht=Ie,yt=L.setEnvironment,bt=L.setPageVisit,vt=L.setRequestDomain,wt=L.setSafeRequest,xt=typeof L.setChannel=="function"?L.setChannel:o.setChannel,It=L.setContextItem,Et=L.setContextItemType,jt=o.addHistories;function Vt(u,e){L.setCustomVariable(u,e)}function Je(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 ze(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=ze);function Me(u){let e=document.cookie.split("; ");for(let t of e){let[r,i]=t.split("=");if(r===u)return decodeURIComponent(i)}return null}function Lt(u){return L.getRecommendations(u)}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"),i=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"),g=u.getAttribute("data-froomle-context-item-type"),c=u.getAttribute("data-froomle-safe-request"),d=u.getAttribute("data-froomle-channel");if(yt(i),n&&bt(n),a&&(It(a),Et(g||"article")),t)Ge(t);else{let h=Me("froomle_device_id");h&&Ge(h)}if(r)Je(r);else{let h=Me("froomle_user_id");h&&Je(h)}l&&vt(l),c&&wt(c!=="false"),d&&xt(d)}let e=Me("froomle_consent");if(e){let t=Number(e);Number.isNaN(t)||ze(t)}document.addEventListener("DOMContentLoaded",()=>{console.log("froomle loads dom"),ae.domInit(ht.fromDocument(document)).then(i=>{Ce.registerClickables(),Y.processDocument(),Ee.sendPageVisit(),Re.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)&&ae.fillElementRecos(l),Y.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==="")&&ae.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==="")&&ae.fillElementRecos(n.target)}else n.attributeName==="data-froomle-id"&&Y.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);})();
|
|
1
|
+
var FroomleFrontendSdk=(function(e){var t=class e{static global(t){return e.globals[t]?e.globals[t]:e.globals[t]={}}static createStatic(e,t,n){let r=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return n!=null&&(r=n(),n=null),r},set:function(e){n!=null&&(r=n(),n=null),r=e}})}static iterator(t){if(Array.isArray(t)){let n=t;return function(){return e.mkIter(n)}}else return typeof t.iterator==`function`?t.iterator.bind(t):t.iterator}static getIterator(t){return Array.isArray(t)?e.mkIter(t):t.iterator()}static mkIter(e){return new n(e)}static extend(t){function n(){this[e.new].apply(this,arguments)}return Object.setPrototypeOf(n.prototype,t.prototype),n}static inherits(t,n){n==null&&(n=!1);function r(){n&&t&&r[e.init]&&r[e.init](),this[e.new].apply(this,arguments)}return n?r[e.init]=()=>{let n=t();n[e.init]&&n[e.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[e.init]=void 0}:t&&t[e.init]?(n=!0,r[e.init]=()=>{t[e.init]&&t[e.init](),Object.setPrototypeOf(r.prototype,t.prototype),r[e.init]=void 0}):t&&Object.setPrototypeOf(r.prototype,t.prototype),r}static bind(t,n){if(n==null)return null;n.__id__==null&&(n.__id__=e.fid++);let r=null;return t.hx__closures__==null?t.hx__closures__={}:r=t.hx__closures__[n.__id__],r==null&&(r=n.bind(t),t.hx__closures__[n.__id__]=r),r}static get __name__(){return`genes.Register`}get __class__(){return e}};t.$global=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:void 0,t.globals={},t.new=Symbol(),t.init=Symbol(),t.fid=0;let n=t.global(`$hxClasses`)[`genes._Register.ArrayIterator`]=class e extends t.inherits(){[t.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 e}};n.prototype.array=null,n.prototype.current=null,t.$global;let r=t.global(`$hxClasses`)[`haxe.ValueException`]=class e extends t.inherits(()=>i,!0){[t.new](e,n,r){super[t.new](String(e),n,r),this.value=e}unwrap(){return this.value}static get __name__(){return`haxe.ValueException`}static get __super__(){return i}get __class__(){return e}};r.prototype.value=null,t.$global;let i=t.global(`$hxClasses`)[`haxe.Exception`]=class e extends t.inherits(()=>Error,!0){[t.new](e,t,n){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=n==null?this:n}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(t){return t instanceof e?t:t instanceof Error?new e(t.message,null,t):new r(t,null,t)}static thrown(t){return t instanceof e?t.get_native():t instanceof Error?t:new r(t)}static get __name__(){return`haxe.Exception`}static get __super__(){return Error}get __class__(){return e}};i.prototype.native=null,i.prototype.__skipStack=null,i.prototype.__nativeException=null,i.prototype.__previousException=null,t.$global;let a=t.global(`$hxClasses`).Std=class e{static string(e){return o.__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 e}};Object.defineProperty(String.prototype,`__class__`,{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,t.$global;let o=t.global(`$hxClasses`)[`js.Boot`]=class e{static getClass(t){if(t==null)return null;if(t instanceof Array)return Array;{let n=t.__class__;if(n!=null)return n;let r=e.__nativeClassName(t);return r==null?null:e.__resolveNativeClass(r)}}static __string_rec(n,r){if(n==null)return`null`;if(r.length>=5)return`<...>`;let i=typeof n;switch(i==`function`&&(n.__name__||n.__ename__)&&(i=`object`),i){case`function`:return`<function>`;case`object`:if(n.__enum__){let i=t.global(`$hxEnums`)[n.__enum__].__constructs__[n._hx_index],a=i._hx_name;return i.__params__?(r+=` `,a+`(`+(function(t){var a;let o=[];{let t=0,a=i.__params__;for(;t<a.length;){let i=a[t];t+=1,o.push(e.__string_rec(n[i],r))}}return a=o,a})(this).join(`,`)+`)`):a}if(n instanceof Array){let t=`[`;r+=` `;let i=0,a=n.length;for(;i<a;){let a=i++;t+=(a>0?`,`:``)+e.__string_rec(n[a],r)}return t+=`]`,t}let i;try{i=n.toString}catch{return`???`}if(i!=null&&i!=Object.toString&&typeof i==`function`){let e=n.toString();if(e!=`[object Object]`)return e}let a=`{
|
|
2
|
+
`;r+=` `;let o=n.hasOwnProperty!=null,s=null;for(s in n)o&&!n.hasOwnProperty(s)||s==`prototype`||s==`__class__`||s==`__super__`||s==`__interfaces__`||s==`__properties__`||(a.length!=2&&(a+=`,
|
|
3
|
+
`),a+=r+s+` : `+e.__string_rec(n[s],r));return r=r.substring(1),a+=`
|
|
4
|
+
`+r+`}`,a;case`string`:return n;default:return String(n)}}static __interfLoop(t,n){if(t==null)return!1;if(t==n)return!0;let r=t.__interfaces__;if(r!=null&&(t.__super__==null||t.__super__.__interfaces__!=r)){let t=0,i=r.length;for(;t<i;){let i=r[t++];if(i==n||e.__interfLoop(i,n))return!0}}return e.__interfLoop(t.__super__,n)}static __instanceof(n,r){if(r==null)return!1;switch(r){case Array:return n instanceof Array;case`$hxCoreType__Bool`:return typeof n==`boolean`;case`$hxCoreType__Dynamic`:return n!=null;case`$hxCoreType__Float`:return typeof n==`number`;case`$hxCoreType__Int`:return typeof n==`number`?(n|0)===n:!1;case String:return typeof n==`string`;default:if(n!=null){if(typeof r==`function`){if(e.__downcastCheck(n,r))return!0}else if(typeof r==`object`&&e.__isNativeObj(r)&&n instanceof r)return!0}else return!1;return r==`$hxCoreType__Class`&&n.__name__!=null||r==`$hxCoreType__Enum`&&n.__ename__!=null?!0:n.__enum__==null?!1:t.global(`$hxEnums`)[n.__enum__]==r}}static __downcastCheck(t,n){return t instanceof n?!0:n.__isInterface__?e.__interfLoop(e.getClass(t),n):!1}static __cast(t,n){if(t==null||e.__instanceof(t,n))return t;throw i.thrown(`Cannot cast `+a.string(t)+` to `+a.string(n))}static __nativeClassName(t){let n=e.__toStr.call(t).slice(8,-1);return n==`Object`||n==`Function`||n==`Math`||n==`JSON`?null:n}static __isNativeObj(t){return e.__nativeClassName(t)!=null}static __resolveNativeClass(e){return t.$global[e]}static get __name__(){return`js.Boot`}get __class__(){return e}};o.__toStr={}.toString,t.$global;let s=t.global(`$hxClasses`)[`js.Browser`]=class e{static get supported(){return this.get_supported()}static get_supported(){return typeof window<`u`&&window.location!==void 0?typeof window.location.protocol==`string`:!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest<`u`)return new XMLHttpRequest;if(typeof ActiveXObject<`u`)return new`ActiveXObject`(`Microsoft.XMLHTTP`);throw i.thrown(`Unable to create XMLHttpRequest object.`)}static get __name__(){return`js.Browser`}get __class__(){return e}};t.$global;let c=t.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(e=>({_hx_index:3,__enum__:`haxe.io.Error`,e}),{_hx_name:`Custom`,__params__:[`e`]})};c.__constructs__=[c.Blocked,c.Overflow,c.OutsideBounds,c.Custom],c.__empty_constructs__=[c.Blocked,c.Overflow,c.OutsideBounds],t.$global;let l=t.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`}};l.__constructs__=[l.UTF8,l.RawNative],l.__empty_constructs__=[l.UTF8,l.RawNative],t.$global;let u=t.global(`$hxClasses`)[`haxe.io.Bytes`]=class e extends t.inherits(){[t.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,n){if(e<0||t<0||e+t>this.length)throw i.thrown(c.OutsideBounds);n==null&&(n=l.UTF8);let r=``,a=this.b,o=e,s=e+t;switch(n._hx_index){case 0:for(;o<s;){let e=a[o++];if(e<128){if(e==0)break;r+=String.fromCodePoint(e)}else if(e<224){let t=(e&63)<<6|a[o++]&127;r+=String.fromCodePoint(t)}else if(e<240){let t=a[o++],n=(e&31)<<12|(t&127)<<6|a[o++]&127;r+=String.fromCodePoint(n)}else{let t=a[o++],n=a[o++],i=(e&15)<<18|(t&127)<<12|(n&127)<<6|a[o++]&127;r+=String.fromCodePoint(i)}}break;case 1:for(;o<s;){let e=a[o++]|a[o++]<<8;r+=String.fromCodePoint(e)}break}return r}static ofData(t){let n=t.hxBytes;return n==null?new e(t):n}static get __name__(){return`haxe.io.Bytes`}get __class__(){return e}};u.prototype.length=null,u.prototype.b=null,t.$global;let d=t.global(`$hxClasses`)[`haxe.http.HttpBase`]=class e extends t.inherits(){[t.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=t.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let n=0,r=this.headers.length;for(;n<r;){let r=n++;if(this.headers[r].name==e){this.headers[r]={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 t.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,l.UTF8)),this.responseAsString}static get __name__(){return`haxe.http.HttpBase`}get __class__(){return e}};d.prototype.url=null,d.prototype.responseBytes=null,d.prototype.responseAsString=null,d.prototype.postData=null,d.prototype.postBytes=null,d.prototype.headers=null,d.prototype.params=null,d.prototype.emptyOnData=null,t.$global;let f=t.global(`$hxClasses`)[`haxe.iterators.MapKeyValueIterator`]=class e extends t.inherits(){[t.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 e}};f.prototype.map=null,f.prototype.keys=null,t.$global;let p=function(){};p.__isInterface__=!0,t.$global;let m=t.global(`$hxClasses`)[`genes.util.EsMap`]=class e extends t.inherits(){[t.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 e.adaptIterator(this.inst.keys())}iterator(){return e.adaptIterator(this.inst.values())}toString(){let t=[],n=e.adaptIterator(this.inst.keys());for(;n.hasNext();){let e=n.next();t.push(``+a.string(e)+` => `+a.string(this.inst.get(e)))}return`{`+t.join(`, `)+`}`}clear(){this.inst.clear()}static adaptIterator(e){let t,n,r=function(){let r=e.next();t=r.value,n=r.done};return{hasNext:function(){return n==null&&r(),!n},next:function(){n==null&&r();let e=t;return r(),e}}}static get __name__(){return`genes.util.EsMap`}get __class__(){return e}};m.prototype.inst=null,t.$global;let h=t.global(`$hxClasses`)[`haxe.ds.StringMap`]=class e extends t.inherits(m){[t.new](){super[t.new]()}copy(){let t=new e;return t.inst=new Map(this.inst),t}keyValueIterator(){return new f(this)}static get __name__(){return`haxe.ds.StringMap`}static get __interfaces__(){return[p]}static get __super__(){return m}get __class__(){return e}};t.$global;let g=t.global(`$hxClasses`).HxOverrides=class e{static cca(e,t){let n=e.charCodeAt(t);if(n==n)return n}static substr(e,t,n){if(n==null)n=e.length;else if(n<0)if(t==0)n=e.length+n;else return``;return e.substr(t,n)}static now(){return Date.now()}static get __name__(){return`HxOverrides`}get __class__(){return e}};typeof performance<`u`&&typeof performance.now==`function`&&(g.now=performance.now.bind(performance)),t.$global;let _=t.global(`$hxClasses`).StringTools=class e{static isSpace(e,t){let n=g.cca(e,t);return n>8&&n<14?!0:n==32}static ltrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,r);)++r;return r>0?g.substr(t,r,n-r):t}static rtrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,n-r-1);)++r;return r>0?g.substr(t,0,n-r):t}static trim(t){return e.ltrim(e.rtrim(t))}static replace(e,t,n){return e.split(t).join(n)}static get __name__(){return`StringTools`}get __class__(){return e}};t.$global;let v=t.global(`$hxClasses`).Lambda=class e{static exists(e,n){let r=t.getIterator(e);for(;r.hasNext();)if(n(r.next()))return!0;return!1}static get __name__(){return`Lambda`}get __class__(){return e}};t.$global;let y=t.global(`$hxClasses`).EReg=class e extends t.inherits(){[t.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 i.thrown(`EReg::matched`)}matchedPos(){if(this.r.m==null)throw i.thrown(`No string matched`);return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,n){if(n==null&&(n=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(n<0?e:g.substr(e,0,t+n));let r=this.r.m!=null;return r&&(this.r.s=e),r}else{let r=this.match(n<0?g.substr(e,t,null):g.substr(e,t,n));return r&&(this.r.s=e,this.r.m.index+=t),r}}map(e,t){let n=0,r=``;do{if(n>=e.length)break;if(!this.matchSub(e,n)){r+=a.string(g.substr(e,n,null));break}let i=this.matchedPos();r+=a.string(g.substr(e,n,i.pos-n)),r+=a.string(t(this)),i.len==0?(r+=a.string(g.substr(e,i.pos,1)),n=i.pos+1):n=i.pos+i.len}while(this.r.global);return!this.r.global&&n>0&&n<e.length&&(r+=a.string(g.substr(e,n,null))),r}static get __name__(){return`EReg`}get __class__(){return e}};y.prototype.r=null,t.$global;let b=t.global(`$hxClasses`)[`haxe.http.HttpJs`]=class e extends t.inherits(d){[t.new](e){this.async=!0,this.withCredentials=!1,super[t.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let n=this.req=s.createXMLHttpRequest(),r=this,o=function(e){if(n.readyState!=4)return;let i;try{i=n.status}catch{i=null}if(i==0&&s.get_supported()&&t.$global.location!=null){let e=t.$global.location.protocol.toLowerCase();new y(`^(?:about|app|app-storage|.+-extension|file|res|widget):$`,``).match(e)&&(i=n.response==null?404:200)}if(i==null&&(i=null),i!=null&&r.onStatus(i),i!=null&&i>=200&&i<400){r.req=null;let e=n.getAllResponseHeaders().split(`\r
|
|
5
|
+
`),t=[],i=0,a=e;for(;i<a.length;){let e=a[i];++i,e!=``&&t.push(e)}e=t,r.responseHeaders=new h;let o=0;for(;o<e.length;){let t=e[o];++o;let n=t.split(`: `),i=n.shift(),a=n.length==1?n[0]:n.join(`: `);a=_.ltrim(_.rtrim(a)),r.responseHeaders.inst.set(i,a)}r.success(u.ofData(n.response))}else if(i==null||i==0&&n.response==null)r.req=null,r.onError(`Failed to connect or resolve host`);else if(i==null)r.req=null,r.responseBytes=n.response==null?null:u.ofData(n.response),r.onError(`Http Error #`+n.status);else switch(i){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,r.responseBytes=n.response==null?null:u.ofData(n.response),r.onError(`Http Error #`+n.status)}};this.async&&(n.onreadystatechange=o);let c,l=this.postData,d=this.postBytes;if(l==null)if(d==null)c=null;else{let e=d;c=new Blob([e.b.bufferValue])}else c=d==null?l:null;if(c!=null)e=!0;else{let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,c=c==null?``:(c==null?`null`:a.string(c))+`&`;let r=n.name,i=(c==null?`null`:a.string(c))+encodeURIComponent(r)+`=`,o=n.value;c=i+encodeURIComponent(o)}}try{if(e)n.open(`POST`,this.url,this.async);else if(c!=null){let e=this.url.split(`?`).length<=1;n.open(`GET`,this.url+(e?`?`:`&`)+(c==null?`null`:a.string(c)),this.async),c=null}else n.open(`GET`,this.url,this.async);n.responseType=`arraybuffer`}catch(e){let t=i.caught(e).unwrap();this.req=null,this.onError(t.toString());return}n.withCredentials=this.withCredentials,!v.exists(this.headers,function(e){return e.name==`Content-Type`})&&e&&this.postData==null&&n.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`);let f=0,p=this.headers;for(;f<p.length;){let e=p[f];++f,n.setRequestHeader(e.name,e.value)}n.send(c),this.async||o(null)}static get __name__(){return`haxe.http.HttpJs`}static get __super__(){return d}get __class__(){return e}};b.prototype.async=null,b.prototype.withCredentials=null,b.prototype.responseHeaders=null,b.prototype.req=null,t.$global;let x=t.global(`$hxClasses`).Type=class e{static createInstance(e,t){return new(Function.prototype.bind.apply(e,[null].concat(t)))}static get __name__(){return`Type`}get __class__(){return e}};t.$global;let S=t.global(`$hxClasses`).Reflect=class e{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let n;if(e==null)return null;{let r;return e.__properties__?(n=e.__properties__[`get_`+t],r=n):r=!1,r?e[n]():e[t]}}static setProperty(e,t,n){let r,i;e.__properties__?(r=e.__properties__[`set_`+t],i=r):i=!1,i?e[r](n):e[t]=n}static fields(e){let t=[];if(e!=null){let r=Object.prototype.hasOwnProperty;for(var n in e)n!=`__id__`&&n!=`hx__closures__`&&r.call(e,n)&&t.push(n)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return`Reflect`}get __class__(){return e}};t.$global;let C=t.global(`$hxClasses`)[`internal.http.FetchHttp`]=class e extends t.inherits(b){[t.new](e){this.responseStatus=0,super[t.new](e)}request(e){let n=t.$global,r=n.fetch,o=n.Headers,s=n.URLSearchParams;if(r==null){this.onError(`Fetch API not found.`);return}let c=x.createInstance(o,[]),l=0,u=this.headers;for(;l<u.length;){let e=u[l];++l,c.append(e.name,e.value)}let d=e?`POST`:`GET`,f=null;if(e)if(this.postData!=null)f=this.postData;else{f=x.createInstance(s,[]);let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,f.append(n.name,n.value)}}let p={method:d,headers:c,body:f},m=this,h=r(this.url,p).then(function(e){if(m.responseStatus=e.status,m.onStatus(e.status),e.ok)return e.text();throw i.thrown(`HTTP Error: `+a.string(e.status))}).then(function(e){m.onData(e)}),g=S.field(h,`catch`);g!=null&&g.apply(h,[function(e){m.onError(a.string(e))}])}static get __name__(){return`internal.http.FetchHttp`}static get __super__(){return b}get __class__(){return e}};C.prototype.responseStatus=null,t.$global;let w=t.global(`$hxClasses`)[`internal.data.UUID`]=class e{static randomHexChar(){return`0123456789abcdef`.charAt(a.random(16))}static v4(){let e=``,t=0;for(;t<36;)switch(t++){case 14:e+=`4`;break;case 19:e+=a.string(`0123456789abcdef`.charAt(8+a.random(4)));break;case 8:case 13:case 18:case 23:e+=`-`;break;default:e+=a.string(`0123456789abcdef`.charAt(a.random(16)))}return e}static get __name__(){return`internal.data.UUID`}get __class__(){return e}};w.HEX=`0123456789abcdef`,t.$global;let T=function(){};T.__isInterface__=!0;let E=function(){};E.__isInterface__=!0;let D=function(){};D.__isInterface__=!0,t.$global;let O=t.global(`$hxClasses`)[`internal.RecoBackendV2`]=class e extends t.inherits(){[t.new](){}static _requestUri(){return(e._safe_request?`https://`:`http://`)+e._req_domain+`/api/`+e._environment+`/recommendations/requests`}static noConsentBody(){return{device_id:`no-consent`,user_group:`no-consent`,version:`no-consent`}}static buildRequestBody(t){let n={lists:t,page_type:e._page_visit,channel:e._channel};if(e._consent>=2&&e._history.length>0&&(n.histories=e._buildHistories()),e._consent<2){let t=e.noConsentBody(),r=0,i=S.fields(t);for(;r<i.length;){let e=i[r];++r,n[e]=S.field(t,e)}}else e._user_id!=null&&(n.user_id=e._user_id),n.device_id=e._device_id;let r=0,i=e._others;for(;r<i.length;){let e=i[r];++r,n[e.key]=e.value}let o=S.field(n,`context_item`),s=S.field(n,`context_item_type`);return o!=null&&a.string(o)!=``&&(s==null||a.string(s)==``)&&(n.context_item_type=`article`),n}static _buildHistories(){return{pageviews:e._history}}static requestsToLists(e){let t=[],n=``,r=[],i=0,a=[],o=function(e,t,o){n=e,r=t,i=0,a=o},s=function(e){let t=[];if(e==null)return t;let n=0;for(;n<e.length;){let r=e[n];++n,!(r==null||r.key==null||r.key==``)&&t.push({key:r.key,value:r.value})}return t},c=function(e,t){if(e==null&&t==null)return!0;if(e==null||t==null||e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(S.compare),l.sort(S.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},l=function(){let e={limit:i,list_name:n,list_size:i},o=0;for(;o<r.length;){let t=r[o];++o;let n=t.value;n instanceof Array||(n=[n]),e[t.key]=n}let s=0;for(;s<a.length;){let t=a[s];++s,e[t.key]=t.value}t.push(e)},u=0;for(;u<e.length;){let t=e[u];++u;let d=s(t.filters),f=t.others==null?[]:t.others;if(n==``){o(t.list,d,f),i+=1;continue}else (n!=t.list||!c(r,d)||!c(a,f))&&(l(),o(t.list,d,f));i+=1}return i!=0&&l(),t}static _requestRecos(t){let n=null,r=null,o=new Promise(function(e,t){n=e,r=t}),s=o;s._resolve=n,s._reject=r,s._isFinished=!1,s._result=null,s._error=null;let c=o,l=!1,u=new C(e._requestUri());u.setHeader(`Content-Type`,`application/json`);let d=e.buildRequestBody(t),f=JSON.stringify(d);u.setPostData(f);let p=function(e){if(l)return;l=!0;let t=c;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))};u.onError=function(e){p(`HTTP Request Error: `+e)},u.onStatus=function(e){(e<200||e>=300)&&p(`HTTP Status Error: `+e)};try{u.request(!0)}catch(e){let t=i.caught(e).unwrap();return p(`Failed to execute recommendation request: `+a.string(t)),c}let m=function(e){if(!l)try{let t=JSON.parse(e),n=k.fromRequestData(t);l=!0;let r=c;r._isFinished||(r._result=n,r._error=null,r._isFinished=!0,r._resolve(n))}catch(e){let t=i.caught(e).unwrap();p(`Failed to parse recommendation response: `+a.string(t))}},h=u.get_responseData();return h==null?l||(u.onData=m):m(h),c}static getOrder(t,n,r){let o={list_name:t,limit:r.length,list_size:r.length},s={};S.setProperty(s,n,r),S.setProperty(o,`order`,s);let c=null,l=null,u=new Promise(function(e,t){c=e,l=t}),d=u;d._resolve=c,d._reject=l,d._isFinished=!1,d._result=null,d._error=null;let f=u;return e.getRawRecommendations([o]).then(function(e){try{let t=[],n=e.lists();if(n!=null&&n.length>0){let e=n[0].items;if(e instanceof Array){let n=0,r=e;for(;n<r.length;){let e=r[n];++n;let i=e.get(`categories`);i!=null&&t.push(i)}}}let r=f;r._isFinished||(r._result=t,r._error=null,r._isFinished=!0,r._resolve(t))}catch(e){let t=i.caught(e).unwrap(),n=`Failed to build order response: `+a.string(t),r=f;r._isFinished||(r._error=n,r._isFinished=!0,r._reject(n))}},function(e){let t=f;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))}),f}static getRawRecommendations(t){return e._requestRecos(t)}static addHistories(t,n){if(n==null&&(n=`article`),t==null||t.length==0)return;let r=n!=null&&n!=``?n:`article`,i=0;for(;i<t.length;){let n=t[i];if(++i,typeof n==`string`){let t=a.string(n);t!=``&&e._history.push({id:t,item_type:r});continue}let o=n,s=S.field(o,`id`);if(s==null)continue;let c=a.string(s);if(c==``)continue;let l=S.field(o,`item_type`);(l==null||a.string(l)==``)&&(l=S.field(o,`itemType`));let u=l!=null&&a.string(l)!=``?a.string(l):r;e._history.push({id:c,item_type:u})}}static setOthers(t,n){let r=0,i=e._others;for(;r<i.length;){let e=i[r];if(++r,e.key==t){e.value=n;return}}e._others.push({key:t,value:n})}static setConsent(t){t>2&&(t=2),e._consent=t,t==2&&e.getDeviceId()==`no-consent`&&e.setDeviceId(w.v4())}static setChannel(t){e._channel=t}static setPageVisit(t){e._page_visit=t}static setEnvironment(t){e._environment=t}static setDeviceId(t){e._device_id=t}static setUserId(t){e._user_id=t}static setRequestDomain(t){e._req_domain=t}static setSafeRequest(t){e._safe_request=t}static setContextItem(t){e.setOthers(`context_item`,t)}static setContextItemType(t){e.setOthers(`context_item_type`,t)}static getRequestDomain(){return e._req_domain}static getSafeRequest(){return e._safe_request}static getEnvironment(){return e._environment}static getPageVisit(){return e._page_visit}static getUserId(){return e._user_id}static getDeviceId(){return e._device_id}static getConsent(){return e._consent}static getChannel(){return e._channel}static getOthers(t){let n=0,r=e._others;for(;n<r.length;){let e=r[n];if(++n,t==e.key)return e.value}return null}static getContextItem(){return e.getOthers(`context_item`)}static getContextItemType(){return e.getOthers(`context_item_type`)}static get __name__(){return`internal.RecoBackendV2`}get __class__(){return e}};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=[];let k=t.global(`$hxClasses`)[`internal._RecommendationsInternal`]=class e extends t.inherits(){[t.new](e,t,n,r,i){this.request_id=t,this.user_group=n,this.device_id=e,this.user_id=r,this._lists=i}items(){let e=[],t=0,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i=0,a=r.items;for(;i<a.length;){let t=a[i];++i,e.push(t)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,n=this._lists;for(;t<n.length;){let r=n[t];if(++t,r.list_name==e)return r}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,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i={limit:r.limit,list_key:r.list_key,list_name:r.list_name,list_size:r.list_size,items:[]},a=0,s=r.items;for(;a<s.length;){let e=s[a];++a,i.items.push(o.__cast(e,j).getData())}e.lists.push(i)}return JSON.stringify(e)}static fromRequestData(t){let n=S.getProperty(t,`lists`),r=[],i=0;for(;i<n.length;){let e=n[i];++i;let a=S.getProperty(e,`items`),o=[],s=0;for(;s<a.length;){let e=a[s];++s,S.setProperty(e,`request_id`,S.getProperty(t,`request_id`)),S.setProperty(e,`user_group`,S.getProperty(t,`user_group`)),o.push(new j(e))}let c=new A({limit:S.getProperty(e,`limit`),list_key:S.getProperty(e,`list_key`),list_name:S.getProperty(e,`list_name`),list_size:S.getProperty(e,`list_size`),items:o,request_id:S.getProperty(t,`request_id`)});r.push(c)}return new e(S.getProperty(t,`device_id`),S.getProperty(t,`request_id`),S.getProperty(t,`user_group`),S.getProperty(t,`user_id`),r)}static get __name__(){return`internal._RecommendationsInternal`}static get __interfaces__(){return[T]}get __class__(){return e}};k.prototype.request_id=null,k.prototype.user_group=null,k.prototype.user_id=null,k.prototype.device_id=null,k.prototype._lists=null;let A=t.global(`$hxClasses`)[`internal._RecommendationsListInternal`]=class e extends t.inherits(){[t.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 e}};A.prototype.limit=null,A.prototype.list_key=null,A.prototype.list_name=null,A.prototype.list_size=null,A.prototype.items=null,A.prototype.request_id=null;let j=t.global(`$hxClasses`)[`internal._RecommendationItemInternal`]=class e extends t.inherits(){[t.new](e){this.Id=S.getProperty(e,`item_id`),this.RequestId=S.getProperty(e,`request_id`),this.UserGroup=S.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[D]}get __class__(){return e}};j.prototype.Id=null,j.prototype.RequestId=null,j.prototype.UserGroup=null,j.prototype._data=null,t.$global;let M=function(){};M.__isInterface__=!0,t.$global;let N=t.global(`$hxClasses`)[`internal.js.JSFroomleDomTree`]=class e extends t.inherits(){[t.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(t){let n=new DOMParser().parseFromString(t,`text/html`),r=new e;return r.root=n.documentElement,r}static fromDocument(t){let n=new e;return n.root=t.documentElement,n}static get __name__(){return`internal.js.JSFroomleDomTree`}static get __interfaces__(){return[M]}get __class__(){return e}};N.prototype.root=null,t.$global;let P=t.global(`$hxClasses`).StringBuf=class e extends t.inherits(){[t.new](){this.b=``}static get __name__(){return`StringBuf`}get __class__(){return e}};P.prototype.b=null,t.$global;let F=t.global(`$hxClasses`)[`internal.domHandler.DomDomDom`]=class e extends t.inherits(){[t.new](){}static _fillRecoTargets(t){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;if(t==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let s=[],c=[],l=t.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c;f.push(t);let p=0;for(;p<f.length;){let e=f[p];++p;let t=0,n=[],r=0,i=e.attributes;for(;r<i.length;){let e=i[r];++r,n.push({name:e.name,value:e.value})}let a=n;for(;t<a.length;){let n=a[t];++t,n.name==`data-froomle-reco`&&s.push(e)}}let m=[],h=0;for(;h<s.length;){let e=s[h];++h;let t=e.getAttribute(`data-froomle-request-id`),n=e.getAttribute(`data-froomle-id`);!(t!=null&&t!=``)&&!(n!=null&&n!=``)&&m.push(e)}if(m.length<1){let e=null,t=null,n=new Promise(function(n,r){e=n,t=r}),r=n;return r._resolve=e,r._reject=t,r._isFinished=!1,r._result=null,r._error=null,n}let _=[],v=[],y=``,b=[],x=[],C=[],w=function(e,t){if(e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(S.compare),l.sort(S.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},T=function(){let e={list_name:y,list_size:x.length,limit:x.length},t=0;for(;t<b.length;){let n=b[t];if(++t,n!=null&&n.key!=null&&n.key!=``){let t=n.value;t instanceof Array||(t=[t]),S.setProperty(e,n.key,t)}}let n=0;for(;n<C.length;){let t=C[n];++n,S.setProperty(e,t.key,t.value)}_.push(e),v.push(x)},E=function(e,t,n,r){y=e,b=t,x=[r],C=n},D=0;for(;D<m.length;){let e=m[D];++D;let t=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-reco-filter-`)){let n=g.substr(e.name,25,null),r=e.value;t.push({key:n,value:r})}}return t},n=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-variable-`)){let n=g.substr(e.name,22,null),r=e.value;t.push({key:n,value:r})}}return t},r=e.getAttribute(`data-froomle-reco`),i=t(e),a=n(e);if(y==``){E(r,i,a,e);continue}else if(r==y&&w(b,i)&&w(C,a)){x.push(e);continue}else{T(),E(r,i,a,e);continue}}y!=``&&T();let k;if(O.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(O.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else try{k=O.getRawRecommendations(_)}catch{let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}return k.then(function(t){let n=t.lists(),r=n.length,i=0,a=r;for(;i<a;){let r=i++,a=n[r];a.items.length,v[r].length;let o=a.items.length,s=0,c=o;for(;s<c;){let n=s++,i=a.items[n],o=v[r][n];e._fillParameters(o,i,t.request_id)}}let s=o;s._isFinished||(s._result=!0,s._error=null,s._isFinished=!0,s._resolve(!0))}),o}static getAttrByPath(e,t,n){n==null&&(n=`fgh`);try{t=new y(`\\\\[(\\\\w+)\\\\]`,`g`).map(t,function(e){return`.`+e.matched(1)}),t=_.replace(t,`[`,`.`),t=_.replace(t,`]`,``),g.cca(t,0)==46&&(t=g.substr(t,1,null));let n=t.split(`.`),r=e.get(n[0]),i=1,o=n.length;for(;i<o;){let e=i++;if(r==null)return null;r=r instanceof Array&&a.parseInt(n[e])!=null?r[a.parseInt(n[e])]:S.field(r,n[e])}return r}catch{return n}}static stringifyValue(e,t){return t==null&&(t=``),e==null?t:a.string(e)}static isQuotedToken(e){if(e==null||e.length<2)return!1;let t=e.charAt(0),n=e.charAt(e.length-1);return t==`'`&&n==`'`?!0:t==`"`?n==`"`:!1}static unescapeQuotedValue(e){let t=e;return t=_.replace(t,`\\'`,`'`),t=_.replace(t,`\\"`,`"`),t=_.replace(t,`\\\\`,`\\`),t}static unquoteToken(t){let n=_.trim(t);if(!e.isQuotedToken(n))return n;let r=g.substr(n,1,n.length-2);return e.unescapeQuotedValue(r)}static splitTopLevel(e,t){if(t==null||t.length!=1)return[e];let n=t.charAt(0),r=[],i=new P,a=0,o=null,s=!1,c=0,l=e.length;for(;c<l;){let t=c++,l=e.charAt(t);if(s){i.b+=l==null?`null`:``+l,s=!1;continue}if(o!=null){if(l==`\\`){i.b+=l==null?`null`:``+l,s=!0;continue}l==o&&(o=null),i.b+=l==null?`null`:``+l;continue}if(l==`'`||l==`"`){o=l,i.b+=l==null?`null`:``+l;continue}if(l==`(`?++a:l==`)`&&a>0&&--a,a==0&&l==n){r.push(_.trim(i.b)),i=new P;continue}i.b+=l==null?`null`:``+l}return r.push(_.trim(i.b)),r}static parseTransformPart(t){let n=_.trim(t);if(n==``)return{name:``,args:[]};let r=n.indexOf(`(`);if(r==-1||!n.endsWith(`)`))return{name:n,args:[]};let i=_.trim(g.substr(n,0,r)),a=g.substr(n,r+1,n.length-r-2),o=[];if(_.trim(a)!=``){let t=0,n=e.splitTopLevel(a,`,`);for(;t<n.length;){let r=n[t];++t,o.push(e.unquoteToken(r))}}return{name:i,args:o}}static resolveSeedValue(t,n,r){let i=_.trim(t);return i==``?r:e.isQuotedToken(i)?e.unquoteToken(i):e.stringifyValue(e.getAttrByPath(n,i,r),r)}static applyTransform(e,t,n){let r=e==null?``:e;switch(t==null?``:t.toLowerCase()){case`append`:return n.length>=1?r+n[0]:r;case`default`:return(r==null||r==``)&&n.length>=1?n[0]:r;case`lower`:return r.toLowerCase();case`prepend`:return n.length>=1?n[0]+r:r;case`replace`:return n.length>=2?_.replace(r,n[0],n[1]):r;case`trim`:return _.trim(r);case`upper`:return r.toUpperCase();case`urlencode`:return encodeURIComponent(r);default:return r}}static evaluateExpression(t,n,r){let i=_.trim(t);if(i.startsWith(`=`)&&(i=_.trim(g.substr(i,1,null))),i==``)return r;let a=e.splitTopLevel(i,`|`);if(a.length==0)return r;let o=e.resolveSeedValue(a[0],n,r),s=1,c=a.length;for(;s<c;){let t=s++,n=e.parseTransformPart(a[t]);n.name!=``&&(o=e.applyTransform(o,n.name,n.args))}return o}static findTemplateExpressionEnd(e,t){let n=null,r=!1,i=0,a=t;for(;a<e.length;){let t=e.charAt(a);if(r){r=!1,++a;continue}if(n!=null){t==`\\`?r=!0:t==n&&(n=null),++a;continue}if(t==`'`||t==`"`){n=t,++a;continue}if(t==`$`&&a+1<e.length&&e.charAt(a+1)==`{`){++i,a+=2;continue}if(t==`}`){if(i==0)return a;--i}++a}return-1}static resolveTemplate(t,n,r){if(t.indexOf("${")==-1)return t;let i=``,o=0;for(;o<t.length;){let s=t.indexOf("${",o);if(s==-1){i+=a.string(g.substr(t,o,null));break}i+=a.string(g.substr(t,o,s-o));let c=e.findTemplateExpressionEnd(t,s+2);if(c==-1){i+=a.string(g.substr(t,s,null));break}let l=g.substr(t,s+2,c-s-2);i+=a.string(e.evaluateExpression(l,n,r)),o=c+1}return i}static resolveParamValue(t,n,r){r==null&&(r=``);let i=e.stringifyValue(r,``),a=t==null?``:t,o=_.trim(a);return o==``?i:a.indexOf("${")==-1?o.startsWith(`=`)?e.evaluateExpression(g.substr(o,1,null),n,i):e.stringifyValue(e.getAttrByPath(n,o,i),i):e.resolveTemplate(a,n,i)}static _buildHistories(e){let t=[],n=[],r=e.querySelectorAll(`[data-froomle-id]`),i=0,a=r.length;for(;i<a;){let e=i++,t=r.item(e);t instanceof HTMLElement&&n.push(t)}let o=n,s=0;for(;s<o.length;){let e=o[s];++s,t.push(e.getAttribute(`data-froomle-id`))}O.addHistories(t)}static fillParam(t,n,r,i,a){a==null&&(a=``);try{let o=e.resolveParamValue(r,i,a);n==`inner`?(t.textContent=o,t.textContent):t.setAttribute(n,o)}catch{}}static _fillParameters(t,n,r){t.setAttribute(`data-froomle-id`,n.get(`item_id`)),t.setAttribute(`data-froomle-request-id`,r);let i=n.get(`item_type`);i!=null&&a.string(i)!=``&&t.setAttribute(`data-froomle-item-type`,a.string(i)),n.UserGroup!=null&&n.UserGroup!=``&&t.setAttribute(`data-froomle-user-group`,n.UserGroup);let o=[],s=t.querySelectorAll(`*`),c=0,l=s.length;for(;c<l;){let e=c++,t=s.item(e);t instanceof HTMLElement&&o.push(t)}let u=o,d=0;for(;d<u.length;){let t=u[d];++d;let r=0,i=[],a=0,o=t.attributes;for(;a<o.length;){let e=o[a];++a,i.push({name:e.name,value:e.value})}let s=i;for(;r<s.length;){let i=s[r];if(++r,i.name.startsWith(`data-froomle-param-`)){let r=_.replace(i.name,`data-froomle-param-`,``),a=i.value;e.fillParam(t,r,a,n)}}}}static _orderElements(e){let t=function(t,n,r){let i=[],a=[],o=0,s=t.childNodes;for(;o<s.length;){let e=s[o];++o,a.push(e)}let c=a,l=0;for(;l<c.length;){let n=c[l];++l;try{if(n.getAttribute(`data-froomle-ordervalue`)!=null){i.push(n);let r=e.createElement(`span`);r.setAttribute(`data-froomle-tmp-node`,`tmp`),t.replaceChild(r,n)}}catch{}}let u=[],d=0;for(;d<i.length;){let e=i[d];++d,u.push(e.getAttribute(`data-froomle-ordervalue`))}return{el:t,key:n,values:u,orderChildren:i,list_name:r}},n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i,s=e.getRoot(),c=[],l=s.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c,p=[],m=0;for(;m<f.length;){let e=f[m];++m;let n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let r=o[n];++n,r.name.startsWith(`data-froomle-order-`)&&p.push(t(e,r.name.substring(19),r.value))}}if(p.length<1){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let h=[],g=0;for(;g<p.length;){let e=p[g];++g;let t={list_name:e.list_name,limit:e.values.length,list_size:e.values.length},n={};S.setProperty(n,e.key,e.values),S.setProperty(t,`order`,n),h.push(t)}if(O.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(O.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}try{O.getRawRecommendations(h).then(function(e){let t=e.lists(),n=t.length,r=0,i=n;for(;r<i;){let n=r++,i=t[n],a=p[n];a.el.setAttribute(`data-froomle-request-id`,e.request_id);let o=[],s=0,c=i.items;for(;s<c.length;){let e=c[s];++s;let t=e.get(a.key);e.get(a.key);let n=a.values.length,r=0,i=n;for(;r<i;){let e=r++;if(t==a.values[e]){a.orderChildren.length;let t=a.orderChildren[e];o.push(t),a.orderChildren.splice(e,1),a.values.splice(e,1);break}}}o.length;let l=a.el,u=[],d=0,f=l.childNodes;for(;d<f.length;){let e=f[d];++d,u.push(e)}let m=u.length,h=0,g=m;for(;h<g;){let e=h++,t=a.el,n=[],r=0,i=t.childNodes;for(;r<i.length;){let e=i[r];++r,n.push(e)}let s=n[e],c=s,l;if(l=c instanceof HTMLElement?c.hasAttribute(`data-froomle-tmp-node`):!1,l&&(a.el.replaceChild(o[0],s),o.splice(0,1),o.length,o.length==0))break}}let a=o;a._isFinished||(a._result=!0,a._error=null,a._isFinished=!0,a._resolve(!0))})}catch{let e=o;e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1))}return o}static domInit(t){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;return e._orderElements(t).then(function(n){e._buildHistories(t.getRoot()),e._fillRecoTargets(t.getRoot()).then(function(e){let t=o;t._isFinished||(t._result=!0,t._error=null,t._isFinished=!0,t._resolve(!0))})}),o}static fillElementRecos(t){e._fillRecoTargets(t)}static runFromHtml(t){if(t==``)return``;let n;try{let e=new DOMParser().parseFromString(t,`text/html`),r=new N;r.root=e.documentElement,n=r}catch{return t}return e.domInit(n),n.toString()}static get __name__(){return`internal.domHandler.DomDomDom`}get __class__(){return e}};t.$global;let I=t.global(`$hxClasses`).FroomleSdk=class e{static register(){e.registered||e._env_set&&e._page_visit_set&&(e.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 n=O.getContextItem();if(n!=null){e+=`data-froomle-context-item="`+n+`" `;let t=O.getContextItemType();(t==null||t==``)&&(t=`article`),e+=`data-froomle-context-item-type="`+t+`" `}let r=O.getDeviceId();r!=null&&(e+=`data-froomle-device-id="`+r+`" `);let i=O.getUserId();i!=null&&(e+=`data-froomle-user-id="`+i+`" `);let a=O.getConsent();a>0&&(e+=`data-froomle-consent="`+a+`" `);let o=O.getRequestDomain();o!=null&&(e+=`data-froomle-request-domain="`+o+`" `);let s=O.getChannel();return s!=null&&(e+=`data-froomle-channel="`+s+`" `),e+=`><\/script>`,e}static setEnvironment(t){O.setEnvironment(t),e._env_set=!0,e.register()}static setDeviceId(e){O.setDeviceId(e)}static setUserId(e){O.setUserId(e)}static setConsent(e){O.setConsent(e)}static setPageVisit(t){O.setPageVisit(t),e._page_visit_set=!0,e.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 F.runFromHtml(e)}static get __name__(){return`FroomleSdk`}get __class__(){return e}};I._env_set=!1,I._page_visit_set=!1,I.registered=!1;function L(){return(O.getSafeRequest()?`https://`:`http://`)+O.getRequestDomain()+`/api/`+O.getEnvironment()+`/events`}function R(){return O.getConsent()>=1}function ee(){return O.getConsent()<2?`no-consent`:O.getDeviceId()}function te(){let e=O.getChannel();if(e)return e}function ne(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-id`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item`));if(t)return t}function re(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-item-type`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item-type`));if(t)return t}function z(e){var t;let n=e==null?void 0:e.getAttribute(`data-froomle-user-group`);if(n)return n;if(!(typeof document>`u`))return((t=document.querySelector(`[data-froomle-user-group]`))==null?void 0:t.getAttribute(`data-froomle-user-group`))||void 0}function ie(e,t,n=`impression`,r){if(!R())return;let i=te()||`www-desktop`,a={event_type:n,page_type:O.getPageVisit(),action_item:e,action_item_type:t,channel:i,device_id:ee()},o=z();if(o&&(a.user_group=o),r)for(let e in r)a[e]=r[e];try{fetch(L(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({events:[a]})})}catch{}}var B=class e{static queueIfNotPresent(t){e.impressionQueue.includes(t)||e.impressionQueue.push(t)}static generateBody(){let t=[];for(let n of e.impressionQueue){let e=ne(n);if(!e)continue;let r=re(n)||`article`,i=te()||`www-desktop`,a={event_type:`impression`,page_type:O.getPageVisit(),action_item:e,action_item_type:r,channel:i,device_id:ee()},o=z(n);o&&(a.user_group=o),O.getConsent()>=2&&O.getUserId()&&(a.user_id=O.getUserId());let s=n.getAttribute(`data-froomle-reco`),c=n.getAttribute(`data-froomle-request-id`);s&&c&&(a.list_name=s,a.request_id=c),t.push(a)}return e.impressionQueue=[],JSON.stringify({events:t})}static sendImpressions(){console.log(e.impressionQueue),e.impressionQueue.length!==0&&R()&&fetch(L(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.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(t){let n=t.getBoundingClientRect(),r=e.getViewPortRect();return n.right>r.left&&n.left<r.right&&n.bottom>r.top&&n.top<r.bottom}static addIntersectionImpressionListener(t){e.observer.observe(t)}static processDocument(){if(R()){console.log(`🚀 Processing document for impressions`);for(let t of document.querySelectorAll(`[data-froomle-id]`))e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}static processElement(t){if(!R()||!(t instanceof Element))return;let n=[];t.matches(`[data-froomle-id]`)&&n.push(t);for(let e of t.querySelectorAll(`[data-froomle-id]`))n.push(e);if(n.length!==0){for(let t of n)e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}};B.impressionQueue=[],B.observer=null,typeof document<`u`&&(B.observer=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(B.impressionQueue.push(e.target),B.observer.unobserve(e.target))}),B.impressionQueue.length>0&&B.sendImpressions()}));var ae=class e{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 e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(O.getSafeRequest()?`https://`:`http://`)+O.getRequestDomain()+`/api/`+O.getEnvironment()+`/events`}static generateBody(){let t=e.readChannel()||`www-desktop`,n={event_type:`page_visit`,page_type:O.getPageVisit(),channel:t,device_id:e.readDeviceId()},r=e.readUserGroup();return r&&(n.user_group=r),O.getConsent()>=2&&O.getUserId()&&(n.user_id=O.getUserId()),JSON.stringify({events:[n]})}static sendPageVisit(){O.getPageVisit()&&(O.getContextItem()||e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()}))}},oe=class e{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 e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(O.getSafeRequest()?`https://`:`http://`)+O.getRequestDomain()+`/api/`+O.getEnvironment()+`/events`}static generateBody(){let t=e.readActionItemType()||`article`,n=e.readChannel()||`www-desktop`,r={event_type:`detail_pageview`,page_type:O.getPageVisit(),action_item:O.getContextItem(),action_item_type:t,channel:n,device_id:e.readDeviceId()},i=e.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()&&e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()})}},V=class e{static readAttributeFromChain(e,t){let n=e;for(;n;){for(let e of t){let t=n.getAttribute(e);if(t)return t}n=n.parentElement}}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(t){return e.readAttributeFromChain(t,[`data-froomle-id`,`data-froomle-action-item`])}static readActionItemType(t){return e.readAttributeFromChain(t,[`data-froomle-item-type`,`data-froomle-action-item-type`])}static readUserGroup(t){var n;let r=e.readAttributeFromChain(t,[`data-froomle-user-group`]);if(r)return r;if(!(typeof document>`u`))return((n=document.querySelector(`[data-froomle-user-group]`))==null?void 0:n.getAttribute(`data-froomle-user-group`))||void 0}static registerClickables(){e.listenerRegistered||(e.listenerRegistered=!0,document.addEventListener(`click`,t=>{if(!e.canTrackEvents())return;let n=t instanceof MouseEvent?t:null,r=t.target,i=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!i)return;let a=i.closest(`a`);if(!a)return;let o=a.closest(`[data-froomle-id]`);if(!o)return;let s=a.closest(`[data-froomle-reco]`),c=(s?e.readActionItem(s):void 0)||e.readActionItem(o);if(!c)return;let l=(s?e.readActionItemType(s):void 0)||e.readActionItemType(o)||`article`,u=e.readChannel()||`www-desktop`,d=a instanceof HTMLAnchorElement?a.href:null,f=a.getAttribute(`href`),p=typeof f==`string`&&f.trim().startsWith(`#`),m=!!d&&!p&&t.cancelable&&!t.defaultPrevented&&!a.hasAttribute(`download`)&&(!a.target||a.target===`_self`)&&!!n&&n.button===0&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!n.altKey,h=p&&t.cancelable&&!t.defaultPrevented;(m||h)&&t.preventDefault();let g={event_type:`click_on_recommendation`,page_type:O.getPageVisit(),action_item:c,action_item_type:l,channel:u,device_id:e.readDeviceId()},_=(s?e.readUserGroup(s):void 0)||e.readUserGroup(o);_&&(g.user_group=_);let v=(s?e.readAttributeFromChain(s,[`data-froomle-reco`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-reco`]),y=(s?e.readAttributeFromChain(s,[`data-froomle-request-id`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-request-id`]);v&&y&&(g.list_name=v,g.request_id=y),O.getConsent()>=2&&O.getUserId()&&(g.user_id=O.getUserId());let b=(O.getSafeRequest()?`https://`:`http://`)+O.getRequestDomain()+`/api/`+O.getEnvironment()+`/events`,x=JSON.stringify({events:[g]}),S=new Blob([x],{type:`application/json`}),C=e=>fetch(b,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:x,...e?{keepalive:!0}:{}});if(m&&d){let e=!1,t=()=>{e||(e=!0,window.location.assign(d))},n=window.setTimeout(t,200);C(!0).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)}).finally(()=>{window.clearTimeout(n),t()});return}C(!1).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)})},!0))}};V.listenerRegistered=!1;let H=N,U=I.setEnvironment,W=I.setPageVisit,G=I.setRequestDomain,K=I.setSafeRequest,q=typeof I.setChannel==`function`?I.setChannel:O.setChannel,J=I.setContextItem,Y=I.setContextItemType,se=O.addHistories;function ce(e,t){I.setCustomVariable(e,t)}function X(e){I.setUserId(e),document.cookie=`froomle_user_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Z(e){I.setDeviceId(e),document.cookie=`froomle_device_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Q(e){I.setConsent(e),document.cookie=`froomle_consent=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${I.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window<`u`&&(window.setFroomleConsent=Q);function $(e){let t=document.cookie.split(`; `);for(let n of t){let[t,r]=n.split(`=`);if(t===e)return decodeURIComponent(r)}return null}function le(e){return I.getRecommendations(e)}if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document<`u`)){let e=document.currentScript;if(e){let t=e.getAttribute(`data-froomle-device-id`),n=e.getAttribute(`data-froomle-user-id`),r=e.getAttribute(`data-froomle-env`),i=e.getAttribute(`data-froomle-page-visit`),a=e.getAttribute(`data-froomle-request-domain`),o=e.getAttribute(`data-froomle-context-item`),s=e.getAttribute(`data-froomle-context-item-type`),c=e.getAttribute(`data-froomle-safe-request`),l=e.getAttribute(`data-froomle-channel`);if(U(r),i&&W(i),o&&(J(o),Y(s||`article`)),t)Z(t);else{let e=$(`froomle_device_id`);e&&Z(e)}if(n)X(n);else{let e=$(`froomle_user_id`);e&&X(e)}a&&G(a),c&&K(c!==`false`),l&&q(l)}let t=$(`froomle_consent`);if(t){let e=Number(t);Number.isNaN(e)||Q(e)}document.addEventListener(`DOMContentLoaded`,()=>{console.log(`froomle loads dom`),F.domInit(H.fromDocument(document)).then(e=>{V.registerClickables(),B.processDocument(),ae.sendPageVisit(),oe.sendPageView()});function e(e){return e.matches(`[data-froomle-reco]`)||e.querySelector(`[data-froomle-reco]`)!==null}new MutationObserver(t=>{for(let n of t)if(n.type===`childList`&&n.addedNodes.forEach(t=>{t instanceof Element&&(e(t)&&F.fillElementRecos(t),B.processElement(t))}),n.type===`attributes`&&n.target instanceof Element)if(n.attributeName===`data-froomle-reco`){let e=n.target.getAttribute(`data-froomle-request-id`);(!e||e===``)&&F.fillElementRecos(n.target)}else if(n.attributeName===`data-froomle-request-id`){let e=n.target.getAttribute(`data-froomle-request-id`),t=n.target.getAttribute(`data-froomle-id`);n.target.getAttribute(`data-froomle-reco`)&&(!e||e===``)&&(!t||t===``)&&F.fillElementRecos(n.target)}else n.attributeName===`data-froomle-id`&&B.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-froomle-reco`,`data-froomle-request-id`,`data-froomle-id`]})})}return e.FroomleDomTree=H,e.RecoBackendV2=O,e.RecommendationItem=D,e.RecommendationList=E,e.Recommendations=T,e._RecommendationItemInternal=j,e.addHistories=se,e.getRecommendations=le,e.sendEvent=ie,e.setChannel=q,e.setConsent=Q,e.setContextItem=J,e.setContextItemType=Y,e.setCustomVariable=ce,e.setDeviceId=Z,e.setEnvironment=U,e.setPageVisit=W,e.setRequestDomain=G,e.setSafeRequest=K,e.setUserId=X,e})({});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./src-CLF-A8No.cjs`);exports.RecommendationItem=e.S,exports.RecommendationList=e.C,exports.Recommendations=e.w,exports.addHistories=e.r,exports.fulfillRecommendations=e.t,exports.getRecommendations=e.i,exports.proxyReco=e.n,exports.sendEvent=e.b,exports.setChannel=e.a,exports.setConsent=e.o,exports.setContextItem=e.s,exports.setContextItemType=e.c,exports.setCustomVariable=e.l,exports.setDeviceId=e.u,exports.setEnvironment=e.d,exports.setPageVisit=e.f,exports.setRequestDomain=e.p,exports.setSafeRequest=e.m,exports.setUserId=e.h;
|