forked from nettleweb/nettleweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
840 lines (837 loc) · 239 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
/*! For license information please see out.js.LICENSE.txt */
https://nettleweb.com/
/*! Copyright (C) 2024 nettleweb.com; All rights reserved. !*/
"use strict";
(()=>{var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),
e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{Decoder:()=>ge,Encoder:()=>fe,PacketType:()=>pe,
protocol:()=>ue});var n={};e.r(n),e.d(n,{decode:()=>Gl,encode:()=>Wl});const r=Object.create(null);r.open="0",r.close="1",r.ping="2",r.pong="3",r.message="4",r.upgrade="5",r.noop="6";const i=Object.create(null);Object.keys(r).forEach((e=>{i[r[e]]=e}));const s={type:"error",data:"parser error"
},o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),a="function"==typeof ArrayBuffer,c=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,l=({type:e,data:t},n,i)=>o&&t instanceof Blob?n?i(t):d(t,i):a&&(t instanceof ArrayBuffer||c(t))?n?i(t):d(new Blob([t]),i):i(r[e]+(t||"")),d=(e,t)=>{
const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function h(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let u
;const p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)f[p.charCodeAt(e)]=e;const m="function"==typeof ArrayBuffer,g=(e,t)=>{if("string"!=typeof e)return{type:"message",data:y(e,t)};const n=e.charAt(0)
;return"b"===n?{type:"message",data:b(e.substring(1),t)}:i[n]?e.length>1?{type:i[n],data:e.substring(1)}:{type:i[n]}:s},b=(e,t)=>{if(m){const n=(e=>{let t,n,r,i,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);const l=new ArrayBuffer(o),d=new Uint8Array(l)
;for(t=0;t<a;t+=4)n=f[e.charCodeAt(t)],r=f[e.charCodeAt(t+1)],i=f[e.charCodeAt(t+2)],s=f[e.charCodeAt(t+3)],d[c++]=n<<2|r>>4,d[c++]=(15&r)<<4|i>>2,d[c++]=(3&i)<<6|63&s;return l})(e);return y(n,t)}return{base64:!0,data:e}
},y=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function w(){return new TransformStream({transform(e,t){!function(e,t){o&&e.data instanceof Blob?e.data.arrayBuffer().then(h).then(t):a&&(e.data instanceof ArrayBuffer||c(e.data))?t(h(e.data)):l(e,!1,(e=>{
u||(u=new TextEncoder),t(u.encode(e))}))}(e,(n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer)
;e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)}))}})}let v;function _(e){return e.reduce(((e,t)=>e+t.length),0)}function k(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0
;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function E(e){if(e)return function(e){for(var t in E.prototype)e[t]=E.prototype[t];return e}(e)}E.prototype.on=E.prototype.addEventListener=function(e,t){
return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},E.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},
E.prototype.off=E.prototype.removeListener=E.prototype.removeAllListeners=E.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this
;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},E.prototype.emit=function(e){this._callbacks=this._callbacks||{}
;for(var t=Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},E.prototype.emitReserved=E.prototype.emit,E.prototype.listeners=function(e){
return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},E.prototype.hasListeners=function(e){return!!this.listeners(e).length};const C="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function x(e,...t){
return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const A=C.setTimeout,T=C.clearTimeout;function S(e,t){t.useNativeTimers?(e.setTimeoutFn=A.bind(C),e.clearTimeoutFn=T.bind(C)):(e.setTimeoutFn=C.setTimeout.bind(C),e.clearTimeoutFn=C.clearTimeout.bind(C))}class L extends Error{
constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class I extends E{constructor(e){super(),this.writable=!1,S(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new L(e,t,n)),this}open(){
return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){
const t=g(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){
const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t=""
;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const j="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),O=64,D={};let R,B=0,N=0;function P(e){let t="";do{t=j[e%O]+t,
e=Math.floor(e/O)}while(e>0);return t}function z(){const e=P(+new Date);return e!==R?(B=0,R=e):e+"."+P(B++)}for(;N<O;N++)D[j[N]]=N;let M=!1;try{M="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Oa){}const U=M;function F(e){const t=e.xdomain;try{
if("undefined"!=typeof XMLHttpRequest&&(!t||U))return new XMLHttpRequest}catch(e){}if(!t)try{return new(C[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function H(){}const $=null!=new F({xdomain:!1}).responseType;class q extends E{constructor(e,t){super(),S(this,t),
this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=x(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new F(t);try{
n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{
n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),
this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{
this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=q.requestsCount++,q.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}
cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=H,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete q.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),
this.cleanup())}abort(){this.cleanup()}}function V(){for(let e in q.requests)q.requests.hasOwnProperty(e)&&q.requests[e].abort()}q.requestsCount=0,q.requests={},
"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",V):"function"==typeof addEventListener&&addEventListener("onpagehide"in C?"pagehide":"unload",V,!1))
;const W="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Z=C.WebSocket||C.MozWebSocket,G="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),K={websocket:class extends I{
constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return
;const e=this.uri(),t=this.opts.protocols,n=G?{}:x(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity")
;this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=G?new Z(e,t,n):t?new Z(e,t):new Z(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{
this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){
const n=e[t],r=t===e.length-1;l(n,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}r&&W((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{}
;return this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Z}},webtransport:class extends I{get name(){return"webtransport"}doOpen(){
"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{
this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){v||(v=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,c){for(n.push(a);;){if(0===r){if(_(n)<1)break;const e=k(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){
if(_(n)<2)break;const e=k(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(_(n)<8)break;const e=k(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>2097151){c.enqueue(s);break}i=4294967296*o+t.getUint32(4),r=3}else{if(_(n)<i)break
;const e=k(n,i);c.enqueue(g(o?e:v.decode(e),t)),r=0}if(0===i||i>e){c.enqueue(s);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=w();r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const i=()=>{n.read().then((({done:e,value:t})=>{
e||(this.onPacket(t),i())})).catch((e=>{}))};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this.writer.write(n).then((()=>{
r&&W((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends I{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port
;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=$&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{
this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{
const n=e.split("\x1e"),r=[];for(let e=0;e<n.length;e++){const i=g(n[e],t);if(r.push(i),"error"===i.type)break}return r})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({
description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){
this.writable=!1,((e,t)=>{const n=e.length,r=Array(n);let i=0;e.forEach(((e,s)=>{l(e,!1,(e=>{r[s]=e,++i===n&&t(r.join("\x1e"))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{}
;return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new q(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e})
;n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}
},Y=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,J=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"]
;function X(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Y.exec(e||""),s={},o=14;for(;o--;)s[J[o]]=i[o]||"";return-1!=n&&-1!=r&&(s.source=t,
s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1),
"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,s.query),s}class Q extends E{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],
e&&"object"==typeof e&&(t=e,e=null),e?(e=X(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=X(t.host).host),S(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,
t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),
this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{
threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=")
;t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{
this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},
addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port
},this.opts.transportOptions[e]);return new K[e](n)}open(){let e;if(this.opts.rememberUpgrade&&Q.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")
}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,
e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;Q.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),
t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Q.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),
this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function i(){n||(n=!0,l(),t.close(),t=null)}const s=e=>{const n=Error("probe error: "+e);n.transport=t.name,i(),
this.emitReserved("upgradeError",n)};function o(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",r),
t.once("error",s),t.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",Q.priorWebsocketSuccess="websocket"===this.transport.name,
this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),
this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=Error("server error");t.code=e.data,this.onError(t);break
;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,
this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),
this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){
if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){
if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),
t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){
return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n}
;this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)}
;return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){Q.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}
onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),
"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}
filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}Q.protocol=4,Q.protocol
;const ee="function"==typeof ArrayBuffer,te=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ne=Object.prototype.toString,re="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ne.call(Blob),ie="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ne.call(File)
;function se(e){return ee&&(e instanceof ArrayBuffer||te(e))||re&&e instanceof Blob||ie&&e instanceof File}function oe(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(oe(e[t]))return!0;return!1}if(se(e))return!0
;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return oe(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&oe(e[t]))return!0;return!1}function ae(e){const t=[],n=e.data,r=e;return r.data=ce(n,t),r.attachments=t.length,{packet:r,buffers:t}}
function ce(e,t){if(!e)return e;if(se(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ce(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={}
;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ce(e[r],t));return n}return e}function le(e,t){return e.data=de(e.data,t),delete e.attachments,e}function de(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num]
;throw Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=de(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=de(e[n],t));return e}
const he=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ue=5;var pe;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",
e[e.BINARY_ACK=6]="BINARY_ACK"}(pe||(pe={}));class fe{constructor(e){this.replacer=e}encode(e){return e.type!==pe.EVENT&&e.type!==pe.ACK||!oe(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===pe.EVENT?pe.BINARY_EVENT:pe.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){
let t=""+e.type;return e.type!==pe.BINARY_EVENT&&e.type!==pe.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=ae(e),n=this.encodeAsString(t.packet),r=t.buffers
;return r.unshift(n),r}}function me(e){return"[object Object]"===Object.prototype.toString.call(e)}class ge extends E{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");t=this.decodeString(e)
;const n=t.type===pe.BINARY_EVENT;n||t.type===pe.BINARY_ACK?(t.type=n?pe.EVENT:pe.ACK,this.reconstructor=new be(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!se(e)&&!e.base64)throw Error("Unknown type: "+e)
;if(!this.reconstructor)throw Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))}
;if(void 0===pe[n.type])throw Error("unknown packet type "+n.type);if(n.type===pe.BINARY_EVENT||n.type===pe.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw Error("Illegal attachments");n.attachments=Number(i)}
if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}
if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!ge.isPayloadValid(n.type,r))throw Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case pe.CONNECT:return me(t);case pe.DISCONNECT:
return void 0===t;case pe.CONNECT_ERROR:return"string"==typeof t||me(t);case pe.EVENT:case pe.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===he.indexOf(t[0]));case pe.ACK:case pe.BINARY_ACK:return Array.isArray(t)}}destroy(){
this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class be{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=le(this.reconPack,this.buffers)
;return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function ye(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const we=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1})
;class ve extends E{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),
this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ye(e,"open",this.onopen.bind(this)),ye(e,"packet",this.onpacket.bind(this)),ye(e,"error",this.onerror.bind(this)),ye(e,"close",this.onclose.bind(this))]}get active(){
return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){
if(we.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:pe.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,
"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),
this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e]
;for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))}),r),s=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise(((n,r)=>{
const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{
if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return
;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){
this.packet({type:pe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){
Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>t.id+""===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case pe.CONNECT:
e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break
;case pe.EVENT:case pe.BINARY_EVENT:this.onevent(e);break;case pe.ACK:case pe.BINARY_ACK:this.onack(e);break;case pe.DISCONNECT:this.ondisconnect();break;case pe.CONNECT_ERROR:this.destroy();const t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){
const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),
this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:pe.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),
t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{
this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:pe.DISCONNECT}),
this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){
return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners
;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){
return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this
}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function _e(e){
e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}_e.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e)
;e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},_e.prototype.reset=function(){this.attempts=0},_e.prototype.setMin=function(e){this.ms=e},_e.prototype.setMax=function(e){this.max=e},_e.prototype.setJitter=function(e){this.jitter=e};class ke extends E{constructor(e,n){var r;super(),
this.nsps={},this.subs=[],e&&"object"==typeof e&&(n=e,e=void 0),(n=n||{}).path=n.path||"/socket.io",this.opts=n,S(this,n),this.reconnection(!1!==n.reconnection),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),
this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=n.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new _e({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==n.timeout?2e4:n.timeout),
this._readyState="closed",this.uri=e;const i=n.parser||t;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==n.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){
return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t
;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}
timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Q(this.uri,this.opts)
;const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=ye(t,"open",(function(){n.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=ye(t,"error",i);if(!1!==this._timeout){
const e=this._timeout,n=this.setTimeoutFn((()=>{r(),i(Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",
this.emitReserved("open");const e=this.engine;this.subs.push(ye(e,"ping",this.onping.bind(this)),ye(e,"data",this.ondata.bind(this)),ye(e,"error",this.onerror.bind(this)),ye(e,"close",this.onclose.bind(this)),ye(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}
ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){W((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new ve(this,e,t),
this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,
this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),
this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{
const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t)
;this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ee={};function Ce(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e
;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=X(e)),
r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r
}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=Ee[i]&&s in Ee[i].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?a=new ke(r,t):(Ee[i]||(Ee[i]=new ke(r,t)),a=Ee[i]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Ce,{Manager:ke,
Socket:ve,io:Ce,connect:Ce});const xe=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),
t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},Ae={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,
ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){
if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,l=i>>2,d=(3&i)<<4|o>>4
;let h=(15&o)<<2|c>>6,u=63&c;a||(u=64,s||(h=64)),r.push(n[l],n[d],n[h],n[u])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(xe(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0
;for(;n<e.length;){const i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),
t[r++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[]
;for(let t=0;t<e.length;){const i=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const a=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==a)throw new Te;const c=i<<2|s>>4;if(r.push(c),64!==o){const e=s<<4&240|o>>2;if(r.push(e),64!==a){
const e=o<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),
this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,
this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class Te extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Se=function(e){return function(e){const t=xe(e);return Ae.encodeByteArray(t,!0)}(e).replace(/\./g,"")},Le=function(e){try{
return Ae.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},Ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e.g)return e.g;throw Error("Unable to locate global object.")
}().__FIREBASE_DEFAULTS__,je=()=>{try{return Ie()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{
e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&Le(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}},Oe=()=>{var e;return null===(e=je())||void 0===e?void 0:e.config};class De{constructor(){
this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function Re(){try{return"object"==typeof indexedDB
}catch(e){return!1}}function Be(){return new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e
;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}class Ne extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,Ne.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Pe.prototype.create)}
}class Pe{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(ze,((e,n)=>{const r=t[n];return null!=r?r+"":`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`
;return new Ne(r,o,n)}}const ze=/\{\$([^}]+)}/g;function Me(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],s=t[i];if(Ue(n)&&Ue(s)){if(!Me(n,s))return!1}else if(n!==s)return!1}for(const e of r)if(!n.includes(e))return!1
;return!0}function Ue(e){return null!==e&&"object"==typeof e}const Fe=1e3,He=2,$e=144e5,qe=.5;function Ve(e,t=Fe,n=He){const r=t*Math.pow(n,e),i=Math.round(qe*r*(Math.random()-.5)*2);return Math.min($e,r+i)}function We(e){return e&&e._delegate?e._delegate:e}class Ze{constructor(e,t,n){this.name=e,
this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){
return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const Ge="[DEFAULT]";class Ke{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,
this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new De;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)
}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null
;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`)
;if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:Ge})}catch(e){}
for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=Ge){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}
async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=Ge){return this.instances.has(e)}
getOptions(e=Ge){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`)
;if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){var n
;const r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t)
;if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===Ge?void 0:r),options:t}),this.instances.set(e,n),
this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=Ge){return this.component?this.component.multipleInstances?e:Ge:e}
shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Ye{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name)
;if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){
if(this.providers.has(e))return this.providers.get(e);const t=new Ke(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const Je=[];var Xe;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",
e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(Xe||(Xe={}));const Qe={debug:Xe.DEBUG,verbose:Xe.VERBOSE,info:Xe.INFO,warn:Xe.WARN,error:Xe.ERROR,silent:Xe.SILENT},et=Xe.INFO,tt={[Xe.DEBUG]:"log",[Xe.VERBOSE]:"log",[Xe.INFO]:"info",[Xe.WARN]:"warn",[Xe.ERROR]:"error"},nt=(e,t,...n)=>{
if(t<e.logLevel)return;const r=(new Date).toISOString(),i=tt[t];if(!i)throw Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)};class rt{constructor(e){this.name=e,this._logLevel=et,this._logHandler=nt,this._userLogHandler=null,
Je.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in Xe))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?Qe[e]:e}get logHandler(){return this._logHandler}set logHandler(e){
if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,Xe.DEBUG,...e),
this._logHandler(this,Xe.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,Xe.VERBOSE,...e),this._logHandler(this,Xe.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,Xe.INFO,...e),this._logHandler(this,Xe.INFO,...e)}warn(...e){
this._userLogHandler&&this._userLogHandler(this,Xe.WARN,...e),this._logHandler(this,Xe.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,Xe.ERROR,...e),this._logHandler(this,Xe.ERROR,...e)}}const it=(e,t)=>t.some((t=>e instanceof t));let st,ot
;const at=new WeakMap,ct=new WeakMap,lt=new WeakMap,dt=new WeakMap,ht=new WeakMap;let ut={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return ct.get(e);if("objectStoreNames"===t)return e.objectStoreNames||lt.get(e)
;if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return mt(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function pt(e){
return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ot||(ot=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(gt(this),t),mt(at.get(this))}:function(...t){
return mt(e.apply(gt(this),t))}:function(t,...n){const r=e.call(gt(this),t,...n);return lt.set(r,t.sort?t.sort():[t]),mt(r)}}function ft(e){return"function"==typeof e?pt(e):(e instanceof IDBTransaction&&function(e){if(ct.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{
e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)}));ct.set(e,t)}(e),
it(e,st||(st=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,ut):e)}function mt(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(mt(e.result)),r()
},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&at.set(t,e)})).catch((()=>{})),ht.set(t,e),t}(e);if(dt.has(e))return dt.get(e);const t=ft(e);return t!==e&&(dt.set(e,t),ht.set(t,e)),t}const gt=e=>ht.get(e)
;function bt(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=mt(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(mt(o.result),e.oldVersion,e.newVersion,mt(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{
s&&e.addEventListener("close",(()=>s())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}const yt=["get","getKey","getAll","getAllKeys","count"],wt=["put","add","delete","clear"],vt=new Map;function _t(e,t){
if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(vt.get(t))return vt.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=wt.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!yt.includes(n))return;const s=async function(e,...t){
const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return vt.set(t,s),s}var kt;kt=ut,ut={...kt,get:(e,t,n)=>_t(e,t)||kt.get(e,t,n),has:(e,t)=>!!_t(e,t)||kt.has(e,t)};class Et{constructor(e){
this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}
const Ct="@firebase/app",xt="0.10.9",At=new rt("@firebase/app"),Tt="@firebase/app-compat",St="@firebase/analytics-compat",Lt="@firebase/analytics",It="@firebase/app-check-compat",jt="@firebase/app-check",Ot="@firebase/auth",Dt="@firebase/auth-compat",Rt="@firebase/database",Bt="@firebase/database-compat",Nt="@firebase/functions",Pt="@firebase/functions-compat",zt="@firebase/installations",Mt="@firebase/installations-compat",Ut="@firebase/messaging",Ft="@firebase/messaging-compat",Ht="@firebase/performance",$t="@firebase/performance-compat",qt="@firebase/remote-config",Vt="@firebase/remote-config-compat",Wt="@firebase/storage",Zt="@firebase/storage-compat",Gt="@firebase/firestore",Kt="@firebase/vertexai-preview",Yt="@firebase/firestore-compat",Jt="firebase",Xt="[DEFAULT]",Qt={
[Ct]:"fire-core",[Tt]:"fire-core-compat",[Lt]:"fire-analytics",[St]:"fire-analytics-compat",[jt]:"fire-app-check",[It]:"fire-app-check-compat",[Ot]:"fire-auth",[Dt]:"fire-auth-compat",[Rt]:"fire-rtdb",[Bt]:"fire-rtdb-compat",[Nt]:"fire-fn",[Pt]:"fire-fn-compat",[zt]:"fire-iid",
[Mt]:"fire-iid-compat",[Ut]:"fire-fcm",[Ft]:"fire-fcm-compat",[Ht]:"fire-perf",[$t]:"fire-perf-compat",[qt]:"fire-rc",[Vt]:"fire-rc-compat",[Wt]:"fire-gcs",[Zt]:"fire-gcs-compat",[Gt]:"fire-fst",[Yt]:"fire-fst-compat",[Kt]:"fire-vertex","fire-js":"fire-js",[Jt]:"fire-js-all"
},en=new Map,tn=new Map,nn=new Map;function rn(e,t){try{e.container.addComponent(t)}catch(n){At.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function sn(e){const t=e.name;if(nn.has(t))return At.debug(`There were multiple attempts to register component ${t}.`),!1
;nn.set(t,e);for(const t of en.values())rn(t,e);for(const t of tn.values())rn(t,e);return!0}function on(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const an=new Pe("app","Firebase",{
"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted",
"server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.",
"invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
"idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",
"finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class cn{constructor(e,t,n){this._isDeleted=!1,
this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Ze("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){
return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){
return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw an.create("app-deleted",{appName:this._name})}}function ln(e,t={}){let n=e;"object"!=typeof t&&(t={
name:t});const r=Object.assign({name:Xt,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw an.create("bad-app-name",{appName:i+""});if(n||(n=Oe()),!n)throw an.create("no-options");const s=en.get(i);if(s){if(Me(n,s.options)&&Me(r,s.config))return s
;throw an.create("duplicate-app",{appName:i})}const o=new Ye(i);for(const e of nn.values())o.addComponent(e);const a=new cn(n,r,o);return en.set(i,a),a}function dn(e,t,n){var r;let i=null!==(r=Qt[e])&&void 0!==r?r:e;n&&(i+="-"+n);const s=i.match(/\s|\//),o=t.match(/\s|\//);if(s||o){
const e=[`Unable to register library "${i}" with version "${t}":`];return s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void At.warn(e.join(" "))}
sn(new Ze(i+"-version",(()=>({library:i,version:t})),"VERSION"))}const hn="firebase-heartbeat-database",un=1,pn="firebase-heartbeat-store";let fn=null;function mn(){return fn||(fn=bt(hn,un,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(pn)}catch(e){console.warn(e)}}}).catch((e=>{
throw an.create("idb-open",{originalErrorMessage:e.message})}))),fn}async function gn(e,t){try{const n=(await mn()).transaction(pn,"readwrite"),r=n.objectStore(pn);await r.put(t,bn(e)),await n.done}catch(e){if(e instanceof Ne)At.warn(e.message);else{const t=an.create("idb-set",{
originalErrorMessage:null==e?void 0:e.message});At.warn(t.message)}}}function bn(e){return`${e.name}!${e.options.appId}`}class yn{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new vn(t),
this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=wn()
;if(console.log("heartbeats",null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats),null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,
null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some((e=>e.date===i)))return;return this._heartbeatsCache.heartbeats.push({date:i,agent:r}),
this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(e){At.warn(e)}}async getHeartbeatsHeader(){var e;try{
if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=wn(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice()
;for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),_n(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),_n(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=Se(JSON.stringify({
version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return At.warn(e),""}}}
function wn(){return(new Date).toISOString().substring(0,10)}class vn{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Re()&&Be().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){
const e=await async function(e){try{const t=(await mn()).transaction(pn),n=await t.objectStore(pn).get(bn(e));return await t.done,n}catch(e){if(e instanceof Ne)At.warn(e.message);else{const t=an.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});At.warn(t.message)}}}(this.app)
;return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gn(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,
heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gn(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function _n(e){
return Se(JSON.stringify({version:2,heartbeats:e})).length}var kn;kn="",sn(new Ze("platform-logger",(e=>new Et(e)),"PRIVATE")),sn(new Ze("heartbeat",(e=>new yn(e)),"PRIVATE")),dn(Ct,xt,kn),dn(Ct,xt,"esm2017"),dn("fire-js",""),dn("firebase","10.13.0","app")
;const En="@firebase/installations",Cn="0.6.8",xn=1e4,An="w:"+Cn,Tn="FIS_v2",Sn="https://firebaseinstallations.googleapis.com/v1",Ln=36e5,In=new Pe("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',
"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.",
"delete-pending-registration":"Can't delete installation while there is a pending registration request."});function jn(e){return e instanceof Ne&&e.code.includes("request-failed")}function On({projectId:e}){return`${Sn}/projects/${e}/installations`}function Dn(e){return{token:e.token,
requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function Rn(e,t){const n=(await t.json()).error;return In.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function Bn({apiKey:e}){
return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Nn(e,{refreshToken:t}){const n=Bn(e);return n.append("Authorization",function(e){return`${Tn} ${e}`}(t)),n}async function Pn(e){const t=await e();return t.status>=500&&t.status<600?e():t}
function zn(e){return new Promise((t=>{setTimeout(t,e)}))}const Mn=/^[cdef][\w-]{21}$/,Un="";function Fn(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(n=e,
btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_"));var n;return t.substr(0,22)}(e);return Mn.test(t)?t:Un}catch(e){return Un}}function Hn(e){return`${e.appName}!${e.appId}`}const $n=new Map;function qn(e,t){const n=Hn(e);Vn(n,t),function(e,t){const n=Zn();n&&n.postMessage({key:e,
fid:t}),Gn()}(n,t)}function Vn(e,t){const n=$n.get(e);if(n)for(const e of n)e(t)}let Wn=null;function Zn(){return!Wn&&"BroadcastChannel"in self&&(Wn=new BroadcastChannel("[Firebase] FID Change"),Wn.onmessage=e=>{Vn(e.data.key,e.data.fid)}),Wn}function Gn(){0===$n.size&&Wn&&(Wn.close(),Wn=null)}
const Kn="firebase-installations-database",Yn=1,Jn="firebase-installations-store";let Xn=null;function Qn(){return Xn||(Xn=bt(Kn,Yn,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Jn)}})),Xn}async function er(e,t){
const n=Hn(e),r=(await Qn()).transaction(Jn,"readwrite"),i=r.objectStore(Jn),s=await i.get(n);return await i.put(t,n),await r.done,s&&s.fid===t.fid||qn(e,t.fid),t}async function tr(e){const t=Hn(e),n=(await Qn()).transaction(Jn,"readwrite");await n.objectStore(Jn).delete(t),await n.done}
async function nr(e,t){const n=Hn(e),r=(await Qn()).transaction(Jn,"readwrite"),i=r.objectStore(Jn),s=await i.get(n),o=t(s);return void 0===o?await i.delete(n):await i.put(o,n),await r.done,!o||s&&s.fid===o.fid||qn(e,o.fid),o}async function rr(e){let t;const n=await nr(e.appConfig,(n=>{
const r=function(e){const t=e||{fid:Fn(),registrationStatus:0};return or(t)}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(In.create("app-offline"))};const n={fid:t.fid,registrationStatus:1,
registrationTime:Date.now()},r=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=On(e),i=Bn(e),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const o={fid:n,authVersion:Tn,
appId:e.appId,sdkVersion:An},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await Pn((()=>fetch(r,a)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:Dn(e.authToken)}}throw await Rn("Create Installation",c)}(e,t)
;return er(e.appConfig,n)}catch(n){throw jn(n)&&409===n.customData.serverCode?await tr(e.appConfig):await er(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:ir(e)}:{
installationEntry:t}}(e,r);return t=i.registrationPromise,i.installationEntry}));return n.fid===Un?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function ir(e){let t=await sr(e.appConfig);for(;1===t.registrationStatus;)await zn(100),t=await sr(e.appConfig)
;if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await rr(e);return n||t}return t}function sr(e){return nr(e,(e=>{if(!e)throw In.create("installation-not-found");return or(e)}))}function or(e){return 1===(t=e).registrationStatus&&t.registrationTime+xn<Date.now()?{
fid:e.fid,registrationStatus:0}:e;var t}async function ar({appConfig:e,heartbeatServiceProvider:t},n){const r=function(e,{fid:t}){return`${On(e)}/${t}/authTokens:generate`}(e,n),i=Nn(e,n),s=t.getImmediate({optional:!0});if(s){const e=await s.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}
const o={installation:{sdkVersion:An,appId:e.appId}},a={method:"POST",headers:i,body:JSON.stringify(o)},c=await Pn((()=>fetch(r,a)));if(c.ok)return Dn(await c.json());throw await Rn("Generate Auth Token",c)}async function cr(e,t=!1){let n;const r=await nr(e.appConfig,(r=>{
if(!dr(r))throw In.create("not-registered");const i=r.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Ln}(e)}(i))return r;if(1===i.requestStatus)return n=async function(e,t){let n=await lr(e.appConfig)
;for(;1===n.authToken.requestStatus;)await zn(100),n=await lr(e.appConfig);const r=n.authToken;return 0===r.requestStatus?cr(e,t):r}(e,t),r;{if(!navigator.onLine)throw In.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()}
;return Object.assign(Object.assign({},e),{authToken:t})}(r);return n=async function(e,t){try{const n=await ar(e,t),r=Object.assign(Object.assign({},t),{authToken:n});return await er(e.appConfig,r),n}catch(n){if(!jn(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){
const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await er(e.appConfig,n)}else await tr(e.appConfig);throw n}}(e,t),t}}));return n?await n:r.authToken}function lr(e){return nr(e,(e=>{if(!dr(e))throw In.create("not-registered");const t=e.authToken
;return 1===(n=t).requestStatus&&n.requestTime+xn<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function dr(e){return void 0!==e&&2===e.registrationStatus}async function hr(e,t=!1){const n=e;return await async function(e){
const{registrationPromise:t}=await rr(e);t&&await t}(n),(await cr(n,t)).token}function ur(e){return In.create("missing-app-config-values",{valueName:e})}const pr="installations",fr=e=>{const t=on(e.getProvider("app").getImmediate(),pr).getImmediate();return{getId:()=>async function(e){
const t=e,{installationEntry:n,registrationPromise:r}=await rr(t);return r?r.catch(console.error):cr(t).catch(console.error),n.fid}(t),getToken:e=>hr(t,e)}};sn(new Ze(pr,(e=>{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw ur("App Configuration")
;if(!e.name)throw ur("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ur(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:on(t,"heartbeat"),
_delete:()=>Promise.resolve()}}),"PUBLIC")),sn(new Ze("installations-internal",fr,"PRIVATE")),dn(En,Cn),dn(En,Cn,"esm2017")
;const mr="analytics",gr="firebase_id",br="origin",yr=6e4,wr="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",vr="https://www.googletagmanager.com/gtag/js",_r=new rt("@firebase/analytics"),kr=new Pe("analytics","Analytics",{
"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.",
"already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.",
"already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}",
"invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",
"indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",
"fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",
"no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',
"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function Er(e){if(!e.startsWith(vr)){const t=kr.create("invalid-gtag-resource",{gtagURL:e});return _r.warn(t.message),""}return e}function Cr(e){
return Promise.all(e.map((e=>e.catch((e=>e)))))}function xr(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:Er}),r=document.createElement("script"),i=`${vr}?l=${e}&id=${t}`
;r.src=n?null==n?void 0:n.createScriptURL(i):i,r.async=!0,document.head.appendChild(r)}function Ar(e,t,n,r){return async function(i,...s){try{if("event"===i){const[r,i]=s;await async function(e,t,n,r,i){try{let s=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const r=await Cr(n)
;for(const n of e){const e=r.find((e=>e.measurementId===n)),i=e&&t[e.appId];if(!i){s=[];break}s.push(i)}}0===s.length&&(s=Object.values(t)),await Promise.all(s),e("event",r,i||{})}catch(e){_r.error(e)}}(e,t,n,r,i)}else if("config"===i){const[i,o]=s;await async function(e,t,n,r,i,s){const o=r[i];try{
if(o)await t[o];else{const e=(await Cr(n)).find((e=>e.measurementId===i));e&&await t[e.appId]}}catch(e){_r.error(e)}e("config",i,s)}(e,t,n,r,i,o)}else if("consent"===i){const[t,n]=s;e("consent",t,n)}else if("get"===i){const[t,n,r]=s;e("get",t,n,r)}else if("set"===i){const[t]=s;e("set",t)
}else e(i,...s)}catch(e){_r.error(e)}}}const Tr=30,Sr=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}}
;function Lr(e){return new Headers({Accept:"application/json","x-goog-api-key":e})}async function Ir(e,t=Sr,n){const{appId:r,apiKey:i,measurementId:s}=e.options;if(!r)throw kr.create("no-app-id");if(!i){if(s)return{measurementId:s,appId:r};throw kr.create("no-api-key")}
const o=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()},a=new Or;return setTimeout((async()=>{a.abort()}),void 0!==n?n:yr),jr({appId:r,apiKey:i,measurementId:s},o,a,t)}async function jr(e,{throttleEndTimeMillis:t,backoffCount:n},r,i=Sr){var s
;const{appId:o,measurementId:a}=e;try{await function(e,t){return new Promise(((n,r)=>{const i=Math.max(t-Date.now(),0),s=setTimeout(n,i);e.addEventListener((()=>{clearTimeout(s),r(kr.create("fetch-throttle",{throttleEndTimeMillis:t}))}))}))}(r,t)}catch(e){
if(a)return _r.warn("Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID "+a+` provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:o,measurementId:a};throw e}try{
const t=await async function(e){var t;const{appId:n,apiKey:r}=e,i={method:"GET",headers:Lr(r)},s=wr.replace("{app-id}",n),o=await fetch(s,i);if(200!==o.status&&304!==o.status){let e="";try{const n=await o.json();(null===(t=n.error)||void 0===t?void 0:t.message)&&(e=n.error.message)}catch(e){}
throw kr.create("config-fetch-failed",{httpStatus:o.status,responseMessage:e})}return o.json()}(e);return i.deleteThrottleMetadata(o),t}catch(t){const c=t;if(!function(e){if(!(e instanceof Ne&&e.customData))return!1;const t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t
}(c)){if(i.deleteThrottleMetadata(o),a)return _r.warn("Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID "+a+` provided in the "measurementId" field in the local Firebase config. [${null==c?void 0:c.message}]`),{appId:o,measurementId:a};throw t}
const l=503===Number(null===(s=null==c?void 0:c.customData)||void 0===s?void 0:s.httpStatus)?Ve(n,i.intervalMillis,Tr):Ve(n,i.intervalMillis),d={throttleEndTimeMillis:Date.now()+l,backoffCount:n+1};return i.setThrottleMetadata(o,d),_r.debug(`Calling attemptFetch again in ${l} millis`),jr(e,d,r,i)}}
class Or{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach((e=>e()))}}let Dr,Rr;function Br(e){Rr=e}function Nr(e){Dr=e}async function Pr(e,t,n,r,i,s,o){var a;const c=Ir(e);c.then((t=>{n[t.measurementId]=t.appId,
e.options.measurementId&&t.measurementId!==e.options.measurementId&&_r.warn(`The measurement ID in the local Firebase config (${e.options.measurementId}) does not match the measurement ID fetched from the server (${t.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)
})).catch((e=>_r.error(e))),t.push(c);const l=async function(){if(!Re())return _r.warn(kr.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await Be()}catch(e){return _r.warn(kr.create("indexeddb-unavailable",{
errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then((e=>e?r.getId():void 0)),[d,h]=await Promise.all([c,l]);(function(e){const t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(vr)&&n.src.includes(e))return n;return null
})(s)||xr(s,d.measurementId),Rr&&(i("consent","default",Rr),Br(void 0)),i("js",new Date);const u=null!==(a=null==o?void 0:o.config)&&void 0!==a?a:{};return u[br]="firebase",u.update=!0,null!=h&&(u[gr]=h),i("config",d.measurementId,u),Dr&&(i("set",Dr),Nr(void 0)),d.measurementId}class zr{
constructor(e){this.app=e}_delete(){return delete Mr[this.app.options.appId],Promise.resolve()}}let Mr={},Ur=[];const Fr={};let Hr,$r,qr="dataLayer",Vr="gtag",Wr=!1;function Zr(){const e=[];if(function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0
;return"object"==typeof e&&void 0!==e.id}()&&e.push("This is a browser extension environment."),"undefined"!=typeof navigator&&navigator.cookieEnabled||e.push("Cookies are not available."),e.length>0){const t=e.map(((e,t)=>`(${t+1}) ${e}`)).join(" "),n=kr.create("invalid-analytics-context",{
errorInfo:t});_r.warn(n.message)}}function Gr(e,t,n){Zr();const r=e.options.appId;if(!r)throw kr.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw kr.create("no-api-key")
;_r.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+e.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}
if(null!=Mr[r])throw kr.create("already-exists",{id:r});if(!Wr){!function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t}(qr);const{wrappedGtag:e,gtagCore:t}=function(e,t,n,r,i){let s=function(...e){window[r].push(arguments)}
;return window[i]&&"function"==typeof window[i]&&(s=window[i]),window[i]=Ar(s,e,t,n),{gtagCore:s,wrappedGtag:window[i]}}(Mr,Ur,Fr,qr,Vr);$r=e,Hr=t,Wr=!0}return Mr[r]=Pr(e,Ur,Fr,t,Hr,qr,n),new zr(e)}function Kr(e=function(e=Xt){const t=en.get(e);if(!t&&e===Xt&&Oe())return ln()
;if(!t)throw an.create("no-app",{appName:e});return t}()){const t=on(e=We(e),mr);return t.isInitialized()?t.getImmediate():function(e,t={}){const n=on(e,mr);if(n.isInitialized()){const e=n.getImmediate();if(Me(t,n.getOptions()))return e;throw kr.create("already-initialized")}const r=n.initialize({
options:t});return r}(e)}function Yr(e,t,n,r){e=We(e),async function(e,t,n,r,i){if(i&&i.global)e("event",n,r);else{const i=await t;e("event",n,Object.assign(Object.assign({},r),{send_to:i}))}}($r,Mr[e.app.options.appId],t,n,r).catch((e=>_r.error(e)))}const Jr="@firebase/analytics",Xr="0.10.7"
;sn(new Ze(mr,((e,{options:t})=>Gr(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)),"PUBLIC")),sn(new Ze("analytics-internal",(function(e){try{const t=e.getProvider(mr).getImmediate();return{logEvent:(e,n,r)=>Yr(t,e,n,r)}}catch(e){
throw kr.create("interop-component-reg-failed",{reason:e})}}),"PRIVATE")),dn(Jr,Xr),dn(Jr,Xr,"esm2017");const Qr=function(){for(let e=Object.getPrototypeOf(this);null!=e;e=Object.getPrototypeOf(e))try{delete e.constructor}catch(e){}},ei=Object.freeze(Object.create(null))
;Object.defineProperty(Qr,"prototype",{value:ei,writable:!1,enumerable:!1,configurable:!1}),Object.setPrototypeOf(Qr,null),Object.freeze(Qr);const ti=Qr;var ni,ri=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};ni=new WeakMap;const ii=class extends ti{constructor(){super(...arguments),
ni.set(this,Object.create(null))}get size(){return Object.keys(ri(this,ni,"f")).length}has(e){return e in ri(this,ni,"f")}get(e){return ri(this,ni,"f")[e]||null}set(e,t){ri(this,ni,"f")[e]=t}delete(e){return delete ri(this,ni,"f")[e]}clear(){const e=ri(this,ni,"f")
;for(const t of Object.keys(e))delete e[t]}keys(){return Object.keys(ri(this,ni,"f"))}values(){const e=ri(this,ni,"f"),t=[];for(const n of Object.keys(e))t.push(e[n]);return t}entries(){const e=ri(this,ni,"f"),t=[];for(const n of Object.keys(e))t.push([n,e[n]]);return t}}
;var si,oi=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it")
;return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},ai=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter")
;if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};si=new WeakMap;const ci=class extends ti{get size(){return oi(this,si,"f").length}constructor(e){super(),
si.set(this,void 0),ai(this,si,e,"f")}has(e){return null!=oi(this,si,"f").getItem(e)}get(e){return oi(this,si,"f").getItem(e)}set(e,t){oi(this,si,"f").setItem(e,t)}delete(e){return oi(this,si,"f").removeItem(e),!0}clear(){oi(this,si,"f").clear()}keys(){const e=oi(this,si,"f"),t=e.length,n=Array(t)
;for(let r=0;r<t;r++)n[r]=e.key(r);return n}values(){const e=oi(this,si,"f"),t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=e.getItem(e.key(r));return n}entries(){const e=oi(this,si,"f"),t=e.length,n=Array(t);for(let r=0;r<t;r++){const t=e.key(r);n[r]=[t,e.getItem(t)]}return n}}
;var li,di,hi,ui,pi=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it")
;return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},fi=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter")
;if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};li=new WeakMap,di=new WeakMap,hi=new WeakMap,ui=new WeakMap;const mi=class extends ti{get message(){
return pi(this,hi,"f")}get persistent(){return pi(this,ui,"f")}get localStorage(){return pi(this,li,"f")}get sessionStorage(){return pi(this,di,"f")}constructor(e){super(),li.set(this,void 0),di.set(this,void 0),hi.set(this,void 0),ui.set(this,void 0);try{const{localStorage:t,sessionStorage:n}=e
;if(null==t||null==n)throw Error("Required storage interfaces not available.");const r="___whitespider___",i=Date.now().toString(24);if(t.setItem(r,i),t.getItem(r)!==i)throw Error("Local storage test failed: value mismatch");if(n.setItem(r,i),
n.getItem(r)!==i)throw Error("Session storage test failed: value mismatch");fi(this,li,new ci(t),"f"),fi(this,di,new ci(n),"f"),fi(this,hi,null,"f"),fi(this,ui,!0,"f")}catch(e){fi(this,li,new ii,"f"),fi(this,di,new ii,"f"),fi(this,hi,e+"","f"),fi(this,ui,!1,"f")}}
},gi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bi=new Uint8Array(new ArrayBuffer(256),0,256);for(let e=0;e<64;e++)bi[gi.charCodeAt(e)]=e;const yi={encode:function(e){let t="",n="";const r=e.byteLength,i=new Uint8Array(e,0,r);for(let e=0;e<r;e+=3){
const n=i[e]<<16|i[e+1]<<8|i[e+2];t+=gi[n>>18&63]+gi[n>>12&63]+gi[n>>6&63]+gi[63&n]}const s=r%3;return 1===s?(n="==",t=t.slice(0,-2)):2===s&&(n="=",t=t.slice(0,-1)),t+n},decode:function(e){const t=.75*e.length-(e.endsWith("==")?2:e.endsWith("=")?1:0),n=new ArrayBuffer(t),r=new Uint8Array(n,0,t)
;let i=0;for(let t=0;t<e.length;t+=4){const n=bi[e.charCodeAt(t)]<<18|bi[e.charCodeAt(t+1)]<<12|bi[e.charCodeAt(t+2)]<<6|bi[e.charCodeAt(t+3)];r[i++]=n>>16&255,r[i++]=n>>8&255,r[i++]=255&n}return n}};Object.setPrototypeOf(yi,null),Object.freeze(yi);const wi=yi,vi={encode:function(e){
const t=Array.from(e).map((e=>e.codePointAt(0)||0)),n=[];for(const e of t)e<=127?n.push(e):e<=2047?(n.push(e>>6|192),n.push(63&e|128)):e<=65535?(n.push(e>>12|224),n.push(e>>6&63|128),n.push(63&e|128)):e<=1114111&&(n.push(e>>18|240),n.push(e>>12&63|128),n.push(e>>6&63|128),n.push(63&e|128))
;return new Uint8Array(n).buffer},decode:function(e){const t=new Uint8Array(e);let n="",r=0;for(;r<t.length;){const e=t[r];if(128&e)if(192==(224&e)){const i=t[r+1];n+=String.fromCharCode((31&e)<<6|63&i),r+=2}else if(224==(240&e)){const i=t[r+1],s=t[r+2]
;n+=String.fromCharCode((15&e)<<12|(63&i)<<6|63&s),r+=3}else if(240==(248&e)){const i=(7&e)<<18|(63&t[r+1])<<12|(63&t[r+2])<<6|63&t[r+3];n+=i<=1114111?String.fromCodePoint(i):"\ufffd",r+=4}else n+="\ufffd",r+=1;else n+=String.fromCharCode(e),r+=1}return n}};Object.setPrototypeOf(vi,null),
Object.freeze(vi);const _i=vi;function ki(e){if("string"!=typeof e||!e)throw Error("expected a non-empty string, got: "+e)}function Ei(e){if("number"!=typeof e)throw Error("expected a number, got: "+e)}
const Ci=1,xi=1,Ai="emoji",Ti="keyvalue",Si="favorites",Li="tokens",Ii="tokens",ji="unicode",Oi="count",Di="group",Ri="order",Bi="group-order",Ni="eTag",Pi="url",zi="skinTone",Mi="readonly",Ui="readwrite",Fi="skinUnicodes",Hi="skinUnicodes";function $i(e){return function(e,t){const n=new Set,r=[]
;for(const i of e){const e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}(e,(e=>e.unicode))}const qi={},Vi={},Wi={};function Zi(e,t,n){n.onerror=()=>t(n.error),n.onblocked=()=>t(Error("IDB blocked")),n.onsuccess=()=>e(n.result)}async function Gi(e){const t=await new Promise(((t,n)=>{
const r=indexedDB.open(e,Ci);qi[e]=r,r.onupgradeneeded=e=>{e.oldVersion<xi&&function(e){function t(t,n,r){const i=n?e.createObjectStore(t,{keyPath:n}):e.createObjectStore(t);if(r)for(const[e,[t,n]]of Object.entries(r))i.createIndex(e,t,{multiEntry:n});return i}t(Ti),t(Ai,ji,{[Ii]:[Li,!0],
[Bi]:[[Di,Ri]],[Fi]:[Hi,!0]}),t(Si,void 0,{[Oi]:[""]})}(r.result)},Zi(t,n,r)}));return t.onclose=()=>Yi(e),t}function Ki(e,t,n,r){return new Promise(((i,s)=>{const o=e.transaction(t,n,{durability:"relaxed"}),a="string"==typeof t?o.objectStore(t):t.map((e=>o.objectStore(e)));let c;r(a,o,(e=>{c=e})),
o.oncomplete=()=>i(c),o.onerror=()=>s(o.error)}))}function Yi(e){const t=qi[e],n=t&&t.result;if(n){n.close();const t=Wi[e];if(t)for(const e of t)e()}delete qi[e],delete Vi[e],delete Wi[e]}
const Ji=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function Xi(e){
return e.split(/[\s_]+/).map((e=>!e.match(/\w/)||Ji.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/\u2019/g,"'").toLowerCase())).filter(Boolean)}const Qi=2;function es(e){return e.filter(Boolean).map((e=>e.toLowerCase())).filter((e=>e.length>=Qi))}function ts(e,t,n,r){
e[t](n).onsuccess=e=>r&&r(e.target.result)}function ns(e,t,n){ts(e,"get",t,n)}function rs(e,t,n){ts(e,"getAll",t,n)}function is(e){e.commit&&e.commit()}function ss(e,t){const n=function(e,t){let n=e[0];for(let r=1;r<e.length;r++){const i=e[r];t(n)>t(i)&&(n=i)}return n}(e,(e=>e.length)),r=[]
;for(const i of n)e.some((e=>-1===e.findIndex((e=>t(e)===t(i)))))||r.push(i);return r}async function os(e,t,n,r){try{const i=function(e){const t=e.map((({annotation:e,emoticon:t,group:n,order:r,shortcodes:i,skins:s,tags:o,emoji:a,version:c})=>{const l={annotation:e,group:n,order:r,tags:o,
tokens:[...new Set(es([...(i||[]).map(Xi).flat(),...(o||[]).map(Xi).flat(),...Xi(e),t]))].sort(),unicode:a,version:c};if(t&&(l.emoticon=t),i&&(l.shortcodes=i),s){l.skinTones=[],l.skinUnicodes=[],l.skinVersions=[];for(const{tone:e,emoji:t,version:n}of s)l.skinTones.push(e),l.skinUnicodes.push(t),
l.skinVersions.push(n)}return l}));return t}(t);await Ki(e,[Ai,Ti],Ui,(([e,t],s)=>{let o,a,c=0;function l(){2==++c&&function(){if(o!==r||a!==n){e.clear();for(const t of i)e.put(t);t.put(r,Ni),t.put(n,Pi),is(s)}}()}ns(t,Ni,(e=>{o=e,l()})),ns(t,Pi,(e=>{a=e,l()}))}))}finally{}}async function as(e,t){
const n=es(Xi(t));return n.length?Ki(e,Ai,Mi,((e,t,r)=>{const i=[],s=()=>{const e=ss(i,(e=>e.unicode));r(e.sort(((e,t)=>e.order<t.order?-1:1)))};for(let t=0;t<n.length;t++){const r=n[t],o=t===n.length-1?IDBKeyRange.bound(r,r+"\uffff",!1,!0):IDBKeyRange.only(r);rs(e.index(Ii),o,(e=>{i.push(e),
i.length===n.length&&s()}))}})):[]}async function cs(e,t){const n=await as(e,t);if(!n.length){const n=e=>(e.shortcodes||[]).includes(t.toLowerCase());return await async function(e,t){return Ki(e,Ai,Mi,((e,n,r)=>{let i;const s=()=>{e.getAll(i&&IDBKeyRange.lowerBound(i,!0),50).onsuccess=e=>{
const n=e.target.result;for(const e of n)if(i=e.unicode,t(e))return r(e);if(n.length<50)return r();s()}};s()}))}(e,n)||null}return n.filter((e=>{const n=(e.shortcodes||[]).map((e=>e.toLowerCase()));return n.includes(t.toLowerCase())}))[0]||null}function ls(e,t,n){
return Ki(e,t,Mi,((e,t,r)=>ns(e,n,r)))}const ds="",hs=["name","url"];function us(e){!function(e){const t=e&&Array.isArray(e),n=t&&e.length&&(!e[0]||hs.some((t=>!(t in e[0]))));if(!t||n)throw Error("Custom emojis are in the wrong format")}(e)
;const t=(e,t)=>e.name.toLowerCase()<t.name.toLowerCase()?-1:1,n=e.sort(t),r=function(e,t){const n=new Map;for(const r of e){const e=t(r);for(const t of e){let e=n;for(let n=0;n<t.length;n++){const r=t.charAt(n);let i=e.get(r);i||(i=new Map,e.set(r,i)),e=i}let i=e.get(ds);i||(i=[],e.set(ds,i)),
i.push(r)}}return(e,t)=>{let r=n;for(let t=0;t<e.length;t++){const n=e.charAt(t),i=r.get(n);if(!i)return[];r=i}if(t)return r.get(ds)||[];const i=[],s=[r];for(;s.length;){const e=[...s.shift().entries()].sort(((e,t)=>e[0]<t[0]?-1:1));for(const[t,n]of e)t===ds?i.push(...n):s.push(n)}return i}
}(e,(e=>[...new Set((e.shortcodes||[]).map((e=>Xi(e))).flat())])),i=e=>r(e,!0),s=e=>r(e,!1),o=new Map,a=new Map;for(const t of e){a.set(t.name.toLowerCase(),t);for(const e of t.shortcodes||[])o.set(e.toLowerCase(),t)}return{all:n,search:e=>{const n=Xi(e),r=n.map(((e,t)=>(t<n.length-1?i:s)(e)))
;return ss(r,(e=>e.name)).sort(t)},byShortcode:e=>o.get(e.toLowerCase()),byName:e=>a.get(e.toLowerCase())}}const ps="undefined"!=typeof wrappedJSObject;function fs(e){if(!e)return e;if(ps&&(e=structuredClone(e)),delete e.tokens,e.skinTones){const t=e.skinTones.length;e.skins=Array(t)
;for(let n=0;n<t;n++)e.skins[n]={tone:e.skinTones[n],unicode:e.skinUnicodes[n],version:e.skinVersions[n]};delete e.skinTones,delete e.skinUnicodes,delete e.skinVersions}return e}function ms(e){e||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}
const gs=["annotation","emoji","group","order","version"];function bs(e,t){if(2!==Math.floor(e.status/100))throw Error("Failed to fetch: "+t+": "+e.status)}async function ys(e){const t=await fetch(e);bs(t,e);const n=t.headers.get("etag");ms(n);const r=await t.json();return function(e){
if(!e||!Array.isArray(e)||!e[0]||"object"!=typeof e[0]||gs.some((t=>!(t in e[0]))))throw Error("Emoji data is in the wrong format")}(r),[n,r]}async function ws(e){let t=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=-1;++i<t;)r[i]=e.charCodeAt(i);return n
}(JSON.stringify(e));const n=function(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=-1;++i<r;)t+=String.fromCharCode(n[i]);return t}(await crypto.subtle.digest("SHA-1",t));return btoa(n)}async function vs(e,t){let n,r=await async function(e){const t=await fetch(e,{method:"HEAD"});bs(t,e)
;const n=t.headers.get("etag");return ms(n),n}(t);if(!r){const e=await ys(t);r=e[0],n=e[1],r||(r=await ws(n))}await async function(e,t,n){const[r,i]=await Promise.all([Ni,Pi].map((t=>ls(e,Ti,t))));return r===n&&i===t}(e,t,r)||(n||(n=(await ys(t))[1]),await os(e,n,t,r))}class _s{
constructor({dataSource:e="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",locale:t="en",customEmoji:n=[]}={}){this.dataSource=e,this.locale=t,this._dbName="emoji-picker-element-"+this.locale,this._db=void 0,this._lazyUpdate=void 0,this._custom=us(n),
this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const e=this._db=await(t=this._dbName,Vi[t]||(Vi[t]=Gi(t)),Vi[t]);var t;!function(e,t){let n=Wi[e];n||(n=Wi[e]=[]),n.push(t)}(this._dbName,this._clear);const n=this.dataSource,r=await async function(e){return!await ls(e,Ti,Pi)
}(e);r?await async function(e,t){let[n,r]=await ys(t);n||(n=await ws(r)),await os(e,r,t,n)}(e,n):this._lazyUpdate=vs(e,n)}async ready(){const e=async()=>(this._ready||(this._ready=this._init()),this._ready);await e(),this._db||await e()}async getEmojiByGroup(e){return Ei(e),await this.ready(),
$i(await async function(e,t){return Ki(e,Ai,Mi,((e,n,r)=>{const i=IDBKeyRange.bound([t,0],[t+1,0],!1,!0);rs(e.index(Bi),i,r)}))}(this._db,e)).map(fs)}async getEmojiBySearchQuery(e){return ki(e),await this.ready(),[...this._custom.search(e),...$i(await as(this._db,e)).map(fs)]}
async getEmojiByShortcode(e){ki(e),await this.ready();const t=this._custom.byShortcode(e);return t||fs(await cs(this._db,e))}async getEmojiByUnicodeOrName(e){ki(e),await this.ready();const t=this._custom.byName(e);return t||fs(await async function(e,t){return Ki(e,Ai,Mi,((e,n,r)=>ns(e,t,(n=>{
if(n)return r(n);ns(e.index(Fi),t,(e=>r(e||null)))}))))}(this._db,e))}async getPreferredSkinTone(){return await this.ready(),await ls(this._db,Ti,zi)||0}async setPreferredSkinTone(e){return Ei(e),await this.ready(),function(e,t,n,r){return Ki(e,t,Ui,((e,t)=>{e.put(r,n),is(t)}))}(this._db,Ti,zi,e)}
async incrementFavoriteEmojiCount(e){return ki(e),await this.ready(),t=this._db,n=e,Ki(t,Si,Ui,((e,t)=>ns(e,n,(r=>{e.put((r||0)+1,n),is(t)}))));var t,n}async getTopFavoriteEmoji(e){return Ei(e),await this.ready(),(await function(e,t,n){return 0===n?[]:Ki(e,[Si,Ai],Mi,(([e,r],i,s)=>{const o=[]
;e.index(Oi).openCursor(void 0,"prev").onsuccess=e=>{const i=e.target.result;if(!i)return s(o);function a(e){if(o.push(e),o.length===n)return s(o);i.continue()}const c=i.primaryKey,l=t.byName(c);if(l)return a(l);ns(r,c,(e=>{if(e)return a(e);i.continue()}))}}))}(this._db,this._custom,e)).map(fs)}
set customEmoji(e){this._custom=us(e)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch(e){}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Yi(this._dbName)}async delete(){var e
;await this._shutdown(),await(e=this._dbName,new Promise(((t,n)=>{Yi(e),Zi(t,n,indexedDB.deleteDatabase(e))})))}}
const ks=[[-1,"\u2728","custom"],[0,"\u{1f600}","smileys-emotion"],[1,"\u{1f44b}","people-body"],[3,"\u{1f431}","animals-nature"],[4,"\u{1f34e}","food-drink"],[5,"\u{1f3e0}\ufe0f","travel-places"],[6,"\u26bd","activities"],[7,"\u{1f4dd}","objects"],[8,"\u26d4\ufe0f","symbols"],[9,"\u{1f3c1}","flags"]].map((([e,t,n])=>({
id:e,emoji:t,name:n}))),Es=ks.slice(1),Cs="function"==typeof requestIdleCallback?requestIdleCallback:setTimeout;function xs(e){return e.unicode.includes("\u200d")}const As={"\u{1fae8}":15.1,"\u{1fae0}":14,"\u{1f972}":13.1,"\u{1f97b}":12.1,"\u{1f970}":11,"\u{1f929}":5,"\u{1f471}\u200d\u2640\ufe0f":4,
"\u{1f923}":3,"\u{1f441}\ufe0f\u200d\u{1f5e8}\ufe0f":2,"\u{1f600}":1,"\u{1f610}\ufe0f":.7,"\u{1f603}":.6
},Ts=["\u{1f60a}","\u{1f612}","\u2764\ufe0f","\u{1f44d}\ufe0f","\u{1f60d}","\u{1f602}","\u{1f62d}","\u263a\ufe0f","\u{1f614}","\u{1f629}","\u{1f60f}","\u{1f495}","\u{1f64c}","\u{1f618}"],Ss='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Ls=(e,t)=>e<t?-1:e>t?1:0,Is=(e,t)=>{
const n=document.createElement("canvas");n.width=n.height=1;const r=n.getContext("2d",{willReadFrequently:!0});return r.textBaseline="top",r.font="100px "+Ss,r.fillStyle=t,r.scale(.01,.01),r.fillText(e,0,0),r.getImageData(0,0,1,1).data},js=(e,t)=>{const n=[...e].join(",")
;return n===[...t].join(",")&&!n.startsWith("0,0,0,")};function Os(e){const t=Is(e,"#000"),n=Is(e,"#fff");return t&&n&&js(t,n)}let Ds;const Rs=()=>(Ds||(Ds=new Promise((e=>Cs((()=>e(function(){const e=Object.entries(As);try{for(const[t,n]of e)if(Os(t))return n}catch(e){}return e[0][1]}())))))),
Ds),Bs=new Map,Ns="\ufe0f",Ps="\ud83c",zs="\u200d",Ms=127995,Us=57339;function Fs(e){e.preventDefault(),e.stopPropagation()}function Hs(e,t,n){return(t+=e?-1:1)<0?t=n.length-1:t>=n.length&&(t=0),t}function $s(e,t){const n=new Set,r=[];for(const i of e){const e=t(i);n.has(e)||(n.add(e),r.push(i))}
return r}const qs=requestAnimationFrame;let Vs,Ws="function"==typeof ResizeObserver;function Zs(e){{const t=document.createRange();return t.selectNode(e.firstChild),t.getBoundingClientRect().width}}function Gs(e,t,n){let r=e.get(t);return r||(r=n(),e.set(t,r)),r}function Ks(e){return""+e}
const Ys=new WeakMap,Js=new WeakMap,Xs=Symbol("un-keyed"),Qs="replaceChildren"in Element.prototype;function eo(e,t){const{targetNode:n}=t;let{targetParentNode:r}=t,i=!1;r?i=function(e,t){let n=e.firstChild,r=0;for(;n;){if(t[r]!==n)return!0;n=n.nextSibling,r++}return r!==t.length}(r,e):(i=!0,
t.targetNode=void 0,t.targetParentNode=r=n.parentNode),i&&function(e,t){Qs?e.replaceChildren(...t):(e.innerHTML="",e.append(...t))}(r,e)}function to(e){let t="",n=!1,r=!1,i=-1;const s=new Map,o=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];if(t+=l,a===c-1)break
;for(let e=0;e<l.length;e++)switch(l.charAt(e)){case"<":"/"===l.charAt(e+1)?o.pop():(n=!0,o.push(++i));break;case">":n=!1,r=!1;break;case"=":r=!0}const d=Gs(s,o[o.length-1],(()=>[]));let h,u,p;if(r){const t=/(\S+)="?([^"=]*)$/.exec(l);h=t[1],u=t[2],p=/^[^">]*/.exec(e[a+1])[0]}const f={
attributeName:h,attributeValuePre:u,attributeValuePost:p,expressionIndex:a};d.push(f),n||r||(t+=" ")}const a=function(e){const t=document.createElement("template");return t.innerHTML=e,t}(t);return{template:a,elementsToBindings:s}}function no(e){
const{template:t,elementsToBindings:n}=Gs(Ys,e,(()=>to(e))),r=t.cloneNode(!0).content.firstElementChild,i=function(e,t){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);let i=e,s=-1;do{const e=t.get(++s);if(e)for(let t=0;t<e.length;t++){const r=e[t],s={binding:r,
targetNode:r.attributeName?i:i.firstChild,targetParentNode:void 0,currentExpression:void 0};n.push(s)}}while(i=r.nextNode());return n}(r,n);return function(e){return function(e,t){for(const n of t){
const{targetNode:t,currentExpression:r,binding:{expressionIndex:i,attributeName:s,attributeValuePre:o,attributeValuePost:a}}=n,c=e[i];if(r!==c)if(n.currentExpression=c,s)t.setAttribute(s,o+Ks(c)+a);else{let e;Array.isArray(c)?eo(c,n):c instanceof Element?(e=c,t.replaceWith(e)):t.nodeValue=Ks(c),
e&&(n.targetNode=e)}}}(e,i),r}}function ro(e,t,n,r,i,s,o,a){const{labelWithSkin:c,titleForEmoji:l,unicodeWithSkin:d}=n,{html:h,map:u}=function(e){const t=Gs(Js,e,(()=>new Map));let n=Xs;return{map:function(e,t,r){return e.map(((e,i)=>{const s=n;n=r(e);try{return t(e,i)}finally{n=s}}))},
html:function(e,...r){const i=Gs(t,e,(()=>new Map));return Gs(i,n,(()=>no(e)))(r)}}}(t);function p(e,n,r){
return u(e,((e,i)=>h`<button role="${n?"option":"menuitem"}" aria-selected="${t.searchMode?i===t.activeSearchItem:""}" aria-label="${c(e,t.currentSkinTone)}" title="${l(e)}" class="emoji ${n&&i===t.activeSearchItem?"active":""}" id="${`${r}-${e.id}`}">${e.unicode?d(e,t.currentSkinTone):h`<img class="custom-emoji" src="${e.url}" alt="" loading="lazy">`}</button>`),(e=>`${r}-${e.id}`))
}
const f=h`<section data-ref="rootElement" class="picker" aria-label="${t.i18n.regionLabel}" style="${t.pickerStyle}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${t.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!(!t.searchMode||!t.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${t.activeSearchItemId?"emo-"+t.activeSearchItemId:""}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${t.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${t.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${t.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${t.skinTonePickerExpanded?"hide-focus":""}" aria-label="${t.skinToneButtonLabel}" title="${t.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${t.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${t.skinToneButtonText}</button></div><span id="skintone-description" class="sr-only">${t.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${t.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${t.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${t.i18n.skinTonesLabel}" aria-activedescendant="skintone-${t.activeSkinTone}" aria-hidden="${!t.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${u(t.skinTones,((e,n)=>h`<div id="skintone-${n}" class="emoji ${n===t.activeSkinTone?"active":""}" aria-selected="${n===t.activeSkinTone}" role="option" title="${t.i18n.skinTones[n]}" aria-label="${t.i18n.skinTones[n]}">${e}</div>`),(e=>e))}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${t.groups.length},1fr)" aria-label="${t.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${u(t.groups,(e=>h`<button role="tab" class="nav-button" aria-controls="tab-${e.id}" aria-label="${t.i18n.categories[e.name]}" aria-selected="${!t.searchMode&&t.currentGroup.id===e.id}" title="${t.i18n.categories[e.name]}" data-group-id="${e.id}"><div class="nav-emoji emoji">${e.emoji}</div></button>`),(e=>e.id))}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(t.isRtl?-1:1)*t.currentGroupIndex*100}%)"></div></div><div class="message ${t.message?"":"gone"}" role="alert" aria-live="polite">${t.message}</div><div data-ref="tabpanelElement" class="tabpanel ${!t.databaseLoaded||t.message?"gone":""}" role="${t.searchMode?"region":"tabpanel"}" aria-label="${t.searchMode?t.i18n.searchResultsLabel:t.i18n.categories[t.currentGroup.name]}" id="${t.searchMode?"":"tab-"+t.currentGroup.id}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${u(t.currentEmojisWithCategories,((e,n)=>h`<div><div id="menu-label-${n}" class="category ${1===t.currentEmojisWithCategories.length&&""===t.currentEmojisWithCategories[0].category?"gone":""}" aria-hidden="true">${t.searchMode?t.i18n.searchResultsLabel:e.category?e.category:t.currentEmojisWithCategories.length>1?t.i18n.categories.custom:t.i18n.categories[t.currentGroup.name]}</div><div class="emoji-menu" role="${t.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${n}" id="${t.searchMode?"search-results":""}">${p(e.emojis,t.searchMode,"emo")}</div></div>`),(e=>e.category))}</div></div><div class="favorites emoji-menu ${t.message?"gone":""}" role="menu" aria-label="${t.i18n.favoritesLabel}" data-on-click="onEmojiClick">${p(t.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`
;if(a){e.appendChild(f);const t=(t,n)=>{for(const r of e.querySelectorAll(`[${t}]`))n(r,r.getAttribute(t))};for(const e of["click","focusout","input","keydown","keyup"])t("data-on-"+e,((t,n)=>{t.addEventListener(e,r[n])}));t("data-ref",((e,t)=>{s[t]=e})),t("data-action",((e,t)=>{i[t](e)})),
o.addEventListener("abort",(()=>{e.removeChild(f)}))}}const io="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e);function so(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}const oo=[],{assign:ao}=Object
;function co(e,t){const n={},r=new AbortController,i=r.signal,{state:s,createEffect:o}=function(e){let t,n=!1;const r=new Map,i=new Set;let s;const o=()=>{if(n)return;const e=[...i];i.clear();try{for(const t of e)t()}finally{s=!1,i.size&&(s=!0,io(o))}},a=new Proxy({},{get(e,n){if(t){let e=r.get(n)
;e||(e=new Set,r.set(n,e)),e.add(t)}return e[n]},set(e,t,n){if(e[t]!==n){e[t]=n;const a=r.get(t);if(a){for(const e of a)i.add(e);s||(s=!0,io(o))}}return!0}});return e.addEventListener("abort",(()=>{n=!0})),{state:a,createEffect:e=>{const n=()=>{const r=t;t=n;try{return e()}finally{t=r}};return n()}}
}(i);ao(s,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),ao(s,t),ao(s,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,
skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:8,isRtl:!1,currentGroupIndex:0,groups:Es,
databaseLoaded:!1,activeSearchItemId:void 0}),o((()=>{s.currentGroup!==s.groups[s.currentGroupIndex]&&(s.currentGroup=s.groups[s.currentGroupIndex])}));const a=t=>{e.getElementById(t).focus()},c=t=>e.getElementById("emo-"+t.id),l=(e,t)=>{n.rootElement.dispatchEvent(new CustomEvent(e,{detail:t,
bubbles:!0,composed:!0}))},d=(e,t)=>e.id===t.id,h=(e,t)=>{const{category:n,emojis:r}=e,{category:i,emojis:s}=t;return n===i&&so(r,s,d)},u=e=>{so(s.currentEmojis,e,d)||(s.currentEmojis=e)},p=e=>{s.searchMode!==e&&(s.searchMode=e)},f=(e,t)=>t&&e.skins&&e.skins[t]||e.unicode,m={labelWithSkin:(e,t)=>{
return(n=[e.name||f(e,t),e.annotation,...e.shortcodes||oo].filter(Boolean),$s(n,(e=>e))).join(", ");var n},titleForEmoji:e=>e.annotation||(e.shortcodes||oo).join(", "),unicodeWithSkin:f},g={onClickSkinToneButton:function(e){s.skinTonePickerExpanded=!s.skinTonePickerExpanded,
s.activeSkinTone=s.currentSkinTone,s.skinTonePickerExpanded&&(Fs(e),qs((()=>a("skintone-list"))))},onEmojiClick:async function(e){const{target:t}=e;t.classList.contains("emoji")&&(Fs(e),E(t.id.substring(4)))},onNavClick:function(e){const{target:t}=e,r=t.closest(".nav-button");if(!r)return
;const i=parseInt(r.dataset.groupId,10);n.searchElement.value="",s.rawSearchText="",s.searchText="",s.activeSearchItem=-1,s.currentGroupIndex=s.groups.findIndex((e=>e.id===i))},onNavKeydown:function(e){const{target:t,key:n}=e,r=t=>{t&&(Fs(e),t.focus())};switch(n){case"ArrowLeft":
return r(t.previousElementSibling);case"ArrowRight":return r(t.nextElementSibling);case"Home":return r(t.parentElement.firstElementChild);case"End":return r(t.parentElement.lastElementChild)}},onSearchKeydown:function(e){if(!s.searchMode||!s.currentEmojis.length)return;const t=t=>{Fs(e),
s.activeSearchItem=Hs(t,s.activeSearchItem,s.currentEmojis)};switch(e.key){case"ArrowDown":return t(!1);case"ArrowUp":return t(!0);case"Enter":if(-1!==s.activeSearchItem)return Fs(e),E(s.currentEmojis[s.activeSearchItem].id);s.activeSearchItem=0}},onSkinToneOptionsClick:function(e){
const{target:{id:t}}=e,n=t&&t.match(/^skintone-(\d)/);n&&(Fs(e),C(parseInt(n[1],10)))},onSkinToneOptionsFocusOut:async function(e){const{relatedTarget:t}=e;t&&"skintone-list"===t.id||(s.skinTonePickerExpanded=!1)},onSkinToneOptionsKeydown:function(e){if(!s.skinTonePickerExpanded)return
;const t=async t=>{Fs(e),s.activeSkinTone=t};switch(e.key){case"ArrowUp":return t(Hs(!0,s.activeSkinTone,s.skinTones));case"ArrowDown":return t(Hs(!1,s.activeSkinTone,s.skinTones));case"Home":return t(0);case"End":return t(s.skinTones.length-1);case"Enter":return Fs(e),C(s.activeSkinTone)
;case"Escape":return Fs(e),s.skinTonePickerExpanded=!1,a("skintone-button")}},onSkinToneOptionsKeyup:function(e){if(s.skinTonePickerExpanded)return" "===e.key?(Fs(e),C(s.activeSkinTone)):void 0},onSearchInput:function(e){s.rawSearchText=e.target.value}},b={calculateEmojiGridStyle:function(e){
!function(e,t,n){let r;Ws?(r=new ResizeObserver(n),r.observe(e)):qs(n),t.addEventListener("abort",(()=>{r&&r.disconnect()}))}(e,i,(()=>{{const e=getComputedStyle(n.rootElement),t=parseInt(e.getPropertyValue("--num-columns"),10),r="rtl"===e.getPropertyValue("direction");s.numColumns=t,s.isRtl=r}}))}}
;let y=!0;function w(){s.database.customEmoji=s.customEmoji||oo}function v(e){return!e.unicode||!xs(e)||Bs.get(e.unicode)}async function _(e){const t=s.emojiVersion||await Rs();return e.filter((({version:e})=>!e||e<=t))}async function k(e){return function(e,t){const n=e=>{const n={}
;for(const r of e)"number"==typeof r.tone&&r.version<=t&&(n[r.tone]=r.unicode);return n};return e.map((({unicode:e,skins:t,shortcodes:r,url:i,name:s,category:o,annotation:a})=>({unicode:e,name:s,shortcodes:r,url:i,category:o,annotation:a,id:e||s,skins:t&&n(t)})))}(e,s.emojiVersion||await Rs())}
async function E(e){const t=await s.database.getEmojiByUnicodeOrName(e),n=[...s.currentEmojis,...s.currentFavorites].find((t=>t.id===e)),r=n.unicode&&f(n,s.currentSkinTone);await s.database.incrementFavoriteEmojiCount(e),l("emoji-click",{emoji:t,skinTone:s.currentSkinTone,...r&&{unicode:r},
...n.name&&{name:n.name}})}function C(e){s.currentSkinTone=e,s.skinTonePickerExpanded=!1,a("skintone-button"),l("skin-tone-change",{skinTone:e}),s.database.setPreferredSkinTone(e)}return o((()=>{ro(e,s,m,g,b,n,i,y),y=!1})),s.emojiVersion||Rs().then((e=>{e||(s.message=s.i18n.emojiUnsupportedMessage)
})),o((()=>{s.database&&async function(){let e=!1;const t=setTimeout((()=>{e=!0,s.message=s.i18n.loadingMessage}),1e3);try{await s.database.ready(),s.databaseLoaded=!0}catch(e){console.error(e),s.message=s.i18n.networkErrorMessage}finally{clearTimeout(t),e&&(e=!1,s.message="")}}()})),o((()=>{
s.pickerStyle=`\n --num-groups: ${s.groups.length}; \n --indicator-opacity: ${s.searchMode?0:1}; \n --num-skintones: 6;`})),o((()=>{s.customEmoji&&s.database&&w()})),o((()=>{
s.customEmoji&&s.customEmoji.length?s.groups!==ks&&(s.groups=ks):s.groups!==Es&&(s.currentGroupIndex&&s.currentGroupIndex--,s.groups=Es)})),o((()=>{!async function(){s.databaseLoaded&&(s.currentSkinTone=await s.database.getPreferredSkinTone())}()})),o((()=>{
s.skinTones=[,,,,,,].fill().map(((e,t)=>function(e,t){if(0===t)return e;const n=e.indexOf(zs);return-1!==n?e.substring(0,n)+String.fromCodePoint(Ms+t-1)+e.substring(n):(e.endsWith(Ns)&&(e=e.substring(0,e.length-1)),e+Ps+String.fromCodePoint(Us+t-1))}(s.skinToneEmoji,t)))})),o((()=>{
s.skinToneButtonText=s.skinTones[s.currentSkinTone]})),o((()=>{s.skinToneButtonLabel=s.i18n.skinToneLabel.replace("{skinTone}",s.i18n.skinTones[s.currentSkinTone])})),o((()=>{s.databaseLoaded&&async function(){
const{database:e}=s,t=(await Promise.all(Ts.map((t=>e.getEmojiByUnicodeOrName(t))))).filter(Boolean);s.defaultFavoriteEmojis=t}()})),o((()=>{s.databaseLoaded&&s.defaultFavoriteEmojis&&async function(){w()
;const{database:e,defaultFavoriteEmojis:t,numColumns:n}=s,r=await e.getTopFavoriteEmoji(n),i=await k($s([...r,...t],(e=>e.unicode||e.name)).slice(0,n));s.currentFavorites=i}()})),o((()=>{!async function(){const{searchText:e,currentGroup:t,databaseLoaded:n,customEmoji:r}=s;if(n)if(e.length>=2){
const t=await async function(e){return k(await _(await s.database.getEmojiBySearchQuery(e)))}(e);s.searchText===e&&(u(t),p(!0))}else{const{id:e}=t;if(-1!==e||r&&r.length){const t=await async function(e){const t=-1===e?s.customEmoji:await s.database.getEmojiByGroup(e);return k(await _(t))}(e)
;s.currentGroup.id===e&&(u(t),p(!1))}}else s.currentEmojis=[],s.searchMode=!1}()})),o((()=>{const{currentEmojis:e,emojiVersion:t}=s,r=e.filter((e=>e.unicode)).filter((e=>xs(e)&&!Bs.has(e.unicode)));if(!t&&r.length)u(e),qs((()=>function(e){const t=function(e,t,n){let r=!0;for(const i of e){
const e=Zs(n(i));void 0===Vs&&(Vs=Zs(t));const s=e/1.8<Vs;Bs.set(i.unicode,s),s||(r=!1)}return r}(e,n.baselineEmoji,c);t||(s.currentEmojis=[...s.currentEmojis])}(r)));else{const r=t?e:e.filter(v);u(r),qs((()=>{var e;(e=n.tabpanelElement)&&(e.scrollTop=0)}))}})),o((()=>{})),o((()=>{
const e=function(){const{searchMode:e,currentEmojis:t}=s;if(e)return[{category:"",emojis:t}];const n=new Map;for(const e of t){const t=e.category||"";let r=n.get(t);r||(r=[],n.set(t,r)),r.push(e)}return[...n.entries()].map((([e,t])=>({category:e,emojis:t
}))).sort(((e,t)=>s.customCategorySorting(e.category,t.category)))}();(e=>{so(s.currentEmojisWithCategories,e,h)||(s.currentEmojisWithCategories=e)})(e)})),o((()=>{s.activeSearchItemId=-1!==s.activeSearchItem&&s.currentEmojis[s.activeSearchItem].id})),o((()=>{const{rawSearchText:e}=s;Cs((()=>{
s.searchText=(e||"").trim(),s.activeSearchItem=-1}))})),o((()=>{s.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",(()=>{s.skinTonePickerExpandedAfterAnimation=!0}),{once:!0}):s.skinTonePickerExpandedAfterAnimation=!1})),{$set(e){ao(s,e)},$destroy(){r.abort()}}}var lo={
categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading\u2026",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",
searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",
skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body",
"animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}}
;const ho=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],uo=`:host{--emoji-font-family:${Ss}}`;class po extends HTMLElement{constructor(e){super(),this.attachShadow({mode:"open"});const t=document.createElement("style")
;t.textContent=":host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.custom-emoji,.emoji,button.emoji{height:var(--total-emoji-size);width:var(--total-emoji-size)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.custom-emoji{padding:var(--emoji-padding);object-fit:contain;pointer-events:none;background-repeat:no-repeat;background-position:center center;background-size:var(--emoji-size) var(--emoji-size)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}"+uo,
this.shadowRoot.appendChild(t),this._ctx={locale:"en",dataSource:"https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",skinToneEmoji:"\u{1f590}\ufe0f",customCategorySorting:Ls,customEmoji:null,i18n:lo,emojiVersion:null,...e}
;for(const e of ho)"database"!==e&&Object.prototype.hasOwnProperty.call(this,e)&&(this._ctx[e]=this[e],delete this[e]);this._dbFlush()}connectedCallback(){this._cmp||(this._cmp=co(this.shadowRoot,this._ctx))}disconnectedCallback(){io((()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),
this._cmp=void 0;const{database:e}=this._ctx;e.close().catch((e=>console.error(e)))}}))}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(e,t,n){
this._set(e.replace(/-([a-z])/g,((e,t)=>t.toUpperCase())),"emoji-version"===e?parseFloat(n):n)}_set(e,t){this._ctx[e]=t,this._cmp&&this._cmp.$set({[e]:t}),["locale","dataSource"].includes(e)&&this._dbFlush()}_dbCreate(){const{locale:e,dataSource:t,database:n}=this._ctx
;n&&n.locale===e&&n.dataSource===t||this._set("database",new _s({locale:e,dataSource:t}))}_dbFlush(){io((()=>this._dbCreate()))}}const fo={};for(const e of ho)fo[e]={get(){return"database"===e&&this._dbCreate(),this._ctx[e]},set(t){if("database"===e)throw Error("database is read-only")
;this._set(e,t)}};function mo(e){let t=e.length;for(;--t>=0;)e[t]=0}Object.defineProperties(po.prototype,fo),customElements.get("emoji-picker")||customElements.define("emoji-picker",po)
;const go=256,bo=286,yo=30,wo=15,vo=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),_o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ko=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Eo=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Co=Array(576)
;mo(Co);const xo=Array(60);mo(xo);const Ao=Array(512);mo(Ao);const To=Array(256);mo(To);const So=Array(29);mo(So);const Lo=Array(yo);function Io(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let jo,Oo,Do;function Ro(e,t){
this.dyn_tree=e,this.max_code=0,this.stat_desc=t}mo(Lo);const Bo=e=>e<256?Ao[e]:Ao[256+(e>>>7)],No=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Po=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,No(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,
e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},zo=(e,t,n)=>{Po(e,n[2*t],n[2*t+1])},Mo=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Uo=(e,t,n)=>{const r=Array(16);let i,s,o=0;for(i=1;i<=wo;i++)o=o+n[i-1]<<1,r[i]=o;for(s=0;s<=t;s++){let t=e[2*s+1]
;0!==t&&(e[2*s]=Mo(r[t]++,t))}},Fo=e=>{let t;for(t=0;t<bo;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yo;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ho=e=>{
e.bi_valid>8?No(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},$o=(e,t,n,r)=>{const i=2*t,s=2*n;return e[i]<e[s]||e[i]===e[s]&&r[t]<=r[n]},qo=(e,t,n)=>{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i<e.heap_len&&$o(t,e.heap[i+1],e.heap[i],e.depth)&&i++,
!$o(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r},Vo=(e,t,n)=>{let r,i,s,o,a=0;if(0!==e.sym_next)do{r=255&e.pending_buf[e.sym_buf+a++],r+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===r?zo(e,i,t):(s=To[i],zo(e,s+go+1,t),o=vo[s],0!==o&&(i-=So[s],
Po(e,i,o)),r--,s=Bo(r),zo(e,s,n),o=_o[s],0!==o&&(r-=Lo[s],Po(e,r,o)))}while(a<e.sym_next);zo(e,256,t)},Wo=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,a,c,l=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<s;o++)0!==n[2*o]?(e.heap[++e.heap_len]=l=o,
e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,n[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=r[2*c+1]);for(t.max_code=l,o=e.heap_len>>1;o>=1;o--)qo(e,n,o);c=s;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],qo(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=o,
e.heap[--e.heap_max]=a,n[2*c]=n[2*o]+n[2*a],e.depth[c]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,n[2*o+1]=n[2*a+1]=c,e.heap[1]=c++,qo(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{
const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,d,h,u,p,f,m=0;for(u=0;u<=wo;u++)e.bl_count[u]=0;for(n[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)d=e.heap[l],u=n[2*n[2*d+1]+1]+1,
u>c&&(u=c,m++),n[2*d+1]=u,d>r||(e.bl_count[u]++,p=0,d>=a&&(p=o[d-a]),f=n[2*d],e.opt_len+=f*(u+p),s&&(e.static_len+=f*(i[2*d+1]+p)));if(0!==m){do{for(u=c-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[c]--,m-=2}while(m>0)
;for(u=c;0!==u;u--)for(d=e.bl_count[u];0!==d;)h=e.heap[--l],h>r||(n[2*h+1]!==u&&(e.opt_len+=(u-n[2*h+1])*n[2*h],n[2*h+1]=u),d--)}})(e,t),Uo(n,l,e.bl_count)},Zo=(e,t,n)=>{let r,i,s=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],
++a<c&&i===o||(a<l?e.bl_tree[2*i]+=a:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,s=i,0===o?(c=138,l=3):i===o?(c=6,l=3):(c=7,l=4))},Go=(e,t,n)=>{let r,i,s=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++a<c&&i===o)){
if(a<l)do{zo(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==s&&(zo(e,i,e.bl_tree),a--),zo(e,16,e.bl_tree),Po(e,a-3,2)):a<=10?(zo(e,17,e.bl_tree),Po(e,a-3,3)):(zo(e,18,e.bl_tree),Po(e,a-11,7));a=0,s=i,0===o?(c=138,l=3):i===o?(c=6,l=3):(c=7,l=4)}};let Ko=!1;const Yo=(e,t,n,r)=>{Po(e,0+(r?1:0),3),Ho(e),
No(e,n),No(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var Jo=(e,t,n,r)=>{let i,s,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0
;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<go;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Wo(e,e.l_desc),Wo(e,e.d_desc),o=(e=>{let t;for(Zo(e,e.dyn_ltree,e.l_desc.max_code),Zo(e,e.dyn_dtree,e.d_desc.max_code),Wo(e,e.bl_desc),
t=18;t>=3&&0===e.bl_tree[2*Eo[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=n+5,n+4<=i&&-1!==t?Yo(e,t,n,r):4===e.strategy||s===i?(Po(e,2+(r?1:0),3),Vo(e,Co,xo)):(Po(e,4+(r?1:0),3),((e,t,n,r)=>{let i;for(Po(e,t-257,5),Po(e,n-1,5),
Po(e,r-4,4),i=0;i<r;i++)Po(e,e.bl_tree[2*Eo[i]+1],3);Go(e,e.dyn_ltree,t-1),Go(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Vo(e,e.dyn_ltree,e.dyn_dtree)),Fo(e),r&&Ho(e)},Xo={_tr_init:e=>{Ko||((()=>{let e,t,n,r,i;const s=Array(16);for(n=0,r=0;r<28;r++)for(So[r]=n,
e=0;e<1<<vo[r];e++)To[n++]=r;for(To[n-1]=r,i=0,r=0;r<16;r++)for(Lo[r]=i,e=0;e<1<<_o[r];e++)Ao[i++]=r;for(i>>=7;r<yo;r++)for(Lo[r]=i<<7,e=0;e<1<<_o[r]-7;e++)Ao[256+i++]=r;for(t=0;t<=wo;t++)s[t]=0;for(e=0;e<=143;)Co[2*e+1]=8,e++,s[8]++;for(;e<=255;)Co[2*e+1]=9,e++,s[9]++;for(;e<=279;)Co[2*e+1]=7,e++,
s[7]++;for(;e<=287;)Co[2*e+1]=8,e++,s[8]++;for(Uo(Co,287,s),e=0;e<yo;e++)xo[2*e+1]=5,xo[2*e]=Mo(e,5);jo=new Io(Co,vo,257,bo,wo),Oo=new Io(xo,_o,0,yo,wo),Do=new Io([],ko,0,19,7)})(),Ko=!0),e.l_desc=new Ro(e.dyn_ltree,jo),e.d_desc=new Ro(e.dyn_dtree,Oo),e.bl_desc=new Ro(e.bl_tree,Do),e.bi_buf=0,
e.bi_valid=0,Fo(e)},_tr_stored_block:Yo,_tr_flush_block:Jo,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(To[n]+go+1)]++,e.dyn_dtree[2*Bo(t)]++),
e.sym_next===e.sym_end),_tr_align:e=>{Po(e,2,3),zo(e,256,Co),(e=>{16===e.bi_valid?(No(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},Qo=(e,t,n,r)=>{let i=65535&e,s=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{
i=i+t[r++]|0,s=s+i|0}while(--o);i%=65521,s%=65521}return i|s<<16};const ea=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var ta=(e,t,n,r)=>{const i=ea,s=r+n;e^=-1;for(let n=r;n<s;n++)e=e>>>8^i[255&(e^t[n])];return~e
},na={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ra={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,
Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}
;const{_tr_init:ia,_tr_stored_block:sa,_tr_flush_block:oa,_tr_tally:aa,_tr_align:ca}=Xo,{Z_NO_FLUSH:la,Z_PARTIAL_FLUSH:da,Z_FULL_FLUSH:ha,Z_FINISH:ua,Z_BLOCK:pa,Z_OK:fa,Z_STREAM_END:ma,Z_STREAM_ERROR:ga,Z_DATA_ERROR:ba,Z_BUF_ERROR:ya,Z_DEFAULT_COMPRESSION:wa,Z_FILTERED:va,Z_HUFFMAN_ONLY:_a,Z_RLE:ka,Z_FIXED:Ea,Z_DEFAULT_STRATEGY:Ca,Z_UNKNOWN:xa,Z_DEFLATED:Aa}=ra,Ta=258,Sa=262,La=42,Ia=113,ja=666,Oa=(e,t)=>(e.msg=na[t],
t),Da=e=>2*e-(e>4?9:0),Ra=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Ba=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do{n=e.head[--r],e.head[r]=n>=i?n-i:0}while(--t);t=i,r=t;do{n=e.prev[--r],e.prev[r]=n>=i?n-i:0}while(--t)};let Na=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Pa=e=>{const t=e.state
;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},za=(e,t)=>{
oa(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Pa(e.strm)},Ma=(e,t)=>{e.pending_buf[e.pending++]=t},Ua=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Fa=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),0===i?0:(e.avail_in-=i,
t.set(e.input.subarray(e.next_in,e.next_in+i),n),1===e.state.wrap?e.adler=Qo(e.adler,t,i,n):2===e.state.wrap&&(e.adler=ta(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Ha=(e,t)=>{let n,r,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match
;const c=e.strstart>e.w_size-Sa?e.strstart-(e.w_size-Sa):0,l=e.window,d=e.w_mask,h=e.prev,u=e.strstart+Ta;let p=l[s+o-1],f=l[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,l[n+o]===f&&l[n+o-1]===p&&l[n]===l[s]&&l[++n]===l[s+1]){s+=2,n++
;do{}while(l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&s<u);if(r=Ta-(u-s),s=u-Ta,r>o){if(e.match_start=t,o=r,r>=a)break;p=l[s+o-1],f=l[s+o]}}}while((t=h[t&d])>c&&0!=--i);return o<=e.lookahead?o:e.lookahead
},$a=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Sa)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Ba(e),r+=t),0===e.strm.avail_in)break
;if(n=Fa(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Na(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Na(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,
!(e.lookahead+e.insert<3)););}while(e.lookahead<Sa&&0!==e.strm.avail_in)},qa=(e,t)=>{let n,r,i,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,a=e.strm.avail_in;do{if(n=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,r=e.strstart-e.block_start,
n>r+e.strm.avail_in&&(n=r+e.strm.avail_in),n>i&&(n=i),n<s&&(0===n&&t!==ua||t===la||n!==r+e.strm.avail_in))break;o=t===ua&&n===r+e.strm.avail_in?1:0,sa(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Pa(e.strm),
r&&(r>n&&(r=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+r),e.strm.next_out),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r,e.block_start+=r,n-=r),n&&(Fa(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o)
;return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),
e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),
o?4:t!==la&&t!==ua&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,
e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Fa(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,
i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,s=i>e.w_size?e.w_size:i,r=e.strstart-e.block_start,(r>=s||(r||t===ua)&&t!==la&&0===e.strm.avail_in&&r<=i)&&(n=r>i?i:r,o=t===ua&&0===e.strm.avail_in&&n===r?1:0,sa(e,e.block_start,n,o),e.block_start+=n,Pa(e.strm)),o?3:1)},Va=(e,t)=>{let n,r
;for(;;){if(e.lookahead<Sa){if($a(e),e.lookahead<Sa&&t===la)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Na(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Sa&&(e.match_length=Ha(e,n)),
e.match_length>=3)if(r=aa(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Na(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],
e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Na(e,e.ins_h,e.window[e.strstart+1]);else r=aa(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(za(e,!1),0===e.strm.avail_out))return 1}
return e.insert=e.strstart<2?e.strstart:2,t===ua?(za(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(za(e,!1),0===e.strm.avail_out)?1:2},Wa=(e,t)=>{let n,r,i;for(;;){if(e.lookahead<Sa){if($a(e),e.lookahead<Sa&&t===la)return 1;if(0===e.lookahead)break}if(n=0,
e.lookahead>=3&&(e.ins_h=Na(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,
0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Sa&&(e.match_length=Ha(e,n),e.match_length<=5&&(e.strategy===va||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,
r=aa(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Na(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,
e.match_length=2,e.strstart++,r&&(za(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(r=aa(e,0,e.window[e.strstart-1]),r&&za(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}
return e.match_available&&(r=aa(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===ua?(za(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(za(e,!1),0===e.strm.avail_out)?1:2};function Za(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,
this.max_chain=r,this.func=i}const Ga=[new Za(0,0,0,0,qa),new Za(4,4,8,4,Va),new Za(4,5,16,8,Va),new Za(4,6,32,32,Va),new Za(4,4,16,16,Wa),new Za(8,16,32,32,Wa),new Za(8,16,128,128,Wa),new Za(8,32,128,256,Wa),new Za(32,128,258,1024,Wa),new Za(32,258,258,4096,Wa)];function Ka(){this.strm=null,
this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Aa,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,
this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,
this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Ra(this.dyn_ltree),Ra(this.dyn_dtree),Ra(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),
this.heap=new Uint16Array(573),Ra(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Ra(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ya=e=>{
if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==La&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Ia&&t.status!==ja?1:0},Ja=e=>{if(Ya(e))return Oa(e,ga);e.total_in=e.total_out=0,e.data_type=xa;const t=e.state;return t.pending=0,
t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?La:Ia,e.adler=2===t.wrap?0:1,t.last_flush=-2,ia(t),fa},Xa=e=>{const t=Ja(e);var n;return t===fa&&((n=e.state).window_size=2*n.w_size,Ra(n.head),n.max_lazy_match=Ga[n.level].max_lazy,n.good_match=Ga[n.level].good_length,
n.nice_match=Ga[n.level].nice_length,n.max_chain_length=Ga[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},Qa=(e,t,n,r,i,s)=>{if(!e)return ga;let o=1;if(t===wa&&(t=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),
i<1||i>9||n!==Aa||r<8||r>15||t<0||t>9||s<0||s>Ea||8===r&&1!==o)return Oa(e,ga);8===r&&(r=9);const a=new Ka;return e.state=a,a.strm=e,a.status=La,a.wrap=o,a.gzhead=null,a.w_bits=r,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,
a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,
a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=s,a.method=n,Xa(e)};var ec=(e,t)=>{if(Ya(e)||t>pa||t<0)return e?Oa(e,ga):ga;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===ja&&t!==ua)return Oa(e,0===e.avail_out?ya:ga);const r=n.last_flush;if(n.last_flush=t,0!==n.pending){
if(Pa(e),0===e.avail_out)return n.last_flush=-1,fa}else if(0===e.avail_in&&Da(t)<=Da(r)&&t!==ua)return Oa(e,ya);if(n.status===ja&&0!==e.avail_in)return Oa(e,ya);if(n.status===La&&0===n.wrap&&(n.status=Ia),n.status===La){let t=Aa+(n.w_bits-8<<4)<<8,r=-1
;if(r=n.strategy>=_a||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=r<<6,0!==n.strstart&&(t|=32),t+=31-t%31,Ua(n,t),0!==n.strstart&&(Ua(n,e.adler>>>16),Ua(n,65535&e.adler)),e.adler=1,n.status=Ia,Pa(e),0!==n.pending)return n.last_flush=-1,fa}if(57===n.status)if(e.adler=0,Ma(n,31),Ma(n,139),Ma(n,8),
n.gzhead)Ma(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Ma(n,255&n.gzhead.time),Ma(n,n.gzhead.time>>8&255),Ma(n,n.gzhead.time>>16&255),Ma(n,n.gzhead.time>>24&255),Ma(n,9===n.level?2:n.strategy>=_a||n.level<2?4:0),Ma(n,255&n.gzhead.os),
n.gzhead.extra&&n.gzhead.extra.length&&(Ma(n,255&n.gzhead.extra.length),Ma(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ta(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Ma(n,0),Ma(n,0),Ma(n,0),Ma(n,0),Ma(n,0),Ma(n,9===n.level?2:n.strategy>=_a||n.level<2?4:0),
Ma(n,3),n.status=Ia,Pa(e),0!==n.pending)return n.last_flush=-1,fa;if(69===n.status){if(n.gzhead.extra){let t=n.pending,r=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+r>n.pending_buf_size;){let i=n.pending_buf_size-n.pending
;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=ta(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=i,Pa(e),0!==n.pending)return n.last_flush=-1,fa;t=0,r-=i}let i=new Uint8Array(n.gzhead.extra)
;n.pending_buf.set(i.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending+=r,n.gzhead.hcrc&&n.pending>t&&(e.adler=ta(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){
if(n.gzhead.hcrc&&n.pending>r&&(e.adler=ta(e.adler,n.pending_buf,n.pending-r,r)),Pa(e),0!==n.pending)return n.last_flush=-1,fa;r=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Ma(n,t)}while(0!==t)
;n.gzhead.hcrc&&n.pending>r&&(e.adler=ta(e.adler,n.pending_buf,n.pending-r,r)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,r=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>r&&(e.adler=ta(e.adler,n.pending_buf,n.pending-r,r)),Pa(e),
0!==n.pending)return n.last_flush=-1,fa;r=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Ma(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>r&&(e.adler=ta(e.adler,n.pending_buf,n.pending-r,r))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){
if(n.pending+2>n.pending_buf_size&&(Pa(e),0!==n.pending))return n.last_flush=-1,fa;Ma(n,255&e.adler),Ma(n,e.adler>>8&255),e.adler=0}if(n.status=Ia,Pa(e),0!==n.pending)return n.last_flush=-1,fa}if(0!==e.avail_in||0!==n.lookahead||t!==la&&n.status!==ja){
let r=0===n.level?qa(n,t):n.strategy===_a?((e,t)=>{let n;for(;;){if(0===e.lookahead&&($a(e),0===e.lookahead)){if(t===la)return 1;break}if(e.match_length=0,n=aa(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(za(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ua?(za(e,!0),
0===e.strm.avail_out?3:4):e.sym_next&&(za(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===ka?((e,t)=>{let n,r,i,s;const o=e.window;for(;;){if(e.lookahead<=Ta){if($a(e),e.lookahead<=Ta&&t===la)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,
r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){s=e.strstart+Ta;do{}while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<s);e.match_length=Ta-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}
if(e.match_length>=3?(n=aa(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=aa(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(za(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===ua?(za(e,!0),
0===e.strm.avail_out?3:4):e.sym_next&&(za(e,!1),0===e.strm.avail_out)?1:2})(n,t):Ga[n.level].func(n,t);if(3!==r&&4!==r||(n.status=ja),1===r||3===r)return 0===e.avail_out&&(n.last_flush=-1),fa;if(2===r&&(t===da?ca(n):t!==pa&&(sa(n,0,0,!1),t===ha&&(Ra(n.head),0===n.lookahead&&(n.strstart=0,
n.block_start=0,n.insert=0))),Pa(e),0===e.avail_out))return n.last_flush=-1,fa}return t!==ua?fa:n.wrap<=0?ma:(2===n.wrap?(Ma(n,255&e.adler),Ma(n,e.adler>>8&255),Ma(n,e.adler>>16&255),Ma(n,e.adler>>24&255),Ma(n,255&e.total_in),Ma(n,e.total_in>>8&255),Ma(n,e.total_in>>16&255),
Ma(n,e.total_in>>24&255)):(Ua(n,e.adler>>>16),Ua(n,65535&e.adler)),Pa(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?fa:ma)},tc={deflateInit:(e,t)=>Qa(e,t,Aa,15,8,Ca),deflateInit2:Qa,deflateReset:Xa,deflateResetKeep:Ja,deflateSetHeader:(e,t)=>Ya(e)||2!==e.state.wrap?ga:(e.state.gzhead=t,fa),deflate:ec,
deflateEnd:e=>{if(Ya(e))return ga;const t=e.state.status;return e.state=null,t===Ia?Oa(e,ba):fa},deflateSetDictionary:(e,t)=>{let n=t.length;if(Ya(e))return ga;const r=e.state,i=r.wrap;if(2===i||1===i&&r.status!==La||r.lookahead)return ga;if(1===i&&(e.adler=Qo(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){
0===i&&(Ra(r.head),r.strstart=0,r.block_start=0,r.insert=0);let e=new Uint8Array(r.w_size);e.set(t.subarray(n-r.w_size,n),0),t=e,n=r.w_size}const s=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,$a(r);r.lookahead>=3;){let e=r.strstart,t=r.lookahead-2;do{
r.ins_h=Na(r,r.ins_h,r.window[e+3-1]),r.prev[e&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=e,e++}while(--t);r.strstart=e,r.lookahead=2,$a(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=o,
e.input=a,e.avail_in=s,r.wrap=i,fa},deflateInfo:"pako deflate (from Nodeca project)"};const nc=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var rc={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){
if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const t in n)nc(n,t)&&(e[t]=n[t])}}return e},flattenChunks:e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,r=0,i=e.length;t<i;t++){let i=e[t];n.set(i,r),r+=i.length}return n}}
;let ic=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){ic=!1}const sc=new Uint8Array(256);for(let e=0;e<256;e++)sc[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;sc[254]=sc[254]=1;var oc={string2buf:e=>{
if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,r,i,s,o=e.length,a=0;for(i=0;i<o;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<o&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),a+=n<128?1:n<2048?2:n<65536?3:4
;for(t=new Uint8Array(a),s=0,i=0;s<a;i++)n=e.charCodeAt(i),55296==(64512&n)&&i+1<o&&(r=e.charCodeAt(i+1),56320==(64512&r)&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?t[s++]=n:n<2048?(t[s++]=192|n>>>6,t[s++]=128|63&n):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,
t[s++]=128|63&n):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=128|63&n);return t},buf2string:(e,t)=>{const n=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let r,i;const s=Array(2*n);for(i=0,r=0;r<n;){
let t=e[r++];if(t<128){s[i++]=t;continue}let o=sc[t];if(o>4)s[i++]=65533,r+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&r<n;)t=t<<6|63&e[r++],o--;o>1?s[i++]=65533:t<65536?s[i++]=t:(t-=65536,s[i++]=55296|t>>10&1023,s[i++]=56320|1023&t)}}return((e,t)=>{
if(t<65534&&e.subarray&&ic)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n})(s,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--
;return n<0||0===n?t:n+sc[e[n]]>t?n:t}},ac=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}
;const cc=Object.prototype.toString,{Z_NO_FLUSH:lc,Z_SYNC_FLUSH:dc,Z_FULL_FLUSH:hc,Z_FINISH:uc,Z_OK:pc,Z_STREAM_END:fc,Z_DEFAULT_COMPRESSION:mc,Z_DEFAULT_STRATEGY:gc,Z_DEFLATED:bc}=ra;function yc(e){this.options=rc.assign({level:mc,method:bc,chunkSize:16384,windowBits:15,memLevel:8,strategy:gc
},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ac,this.strm.avail_out=0
;let n=tc.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==pc)throw Error(na[n]);if(t.header&&tc.deflateSetHeader(this.strm,t.header),t.dictionary){let e
;if(e="string"==typeof t.dictionary?oc.string2buf(t.dictionary):"[object ArrayBuffer]"===cc.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=tc.deflateSetDictionary(this.strm,e),n!==pc)throw Error(na[n]);this._dict_set=!0}}function wc(e,t){const n=new yc(t);if(n.push(e,!0),
n.err)throw n.msg||na[n.err];return n.result}yc.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?uc:lc,"string"==typeof e?n.input=oc.string2buf(e):"[object ArrayBuffer]"===cc.call(e)?n.input=new Uint8Array(e):n.input=e,
n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(s===dc||s===hc)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(i=tc.deflate(n,s),
i===fc)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=tc.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===pc;if(0!==n.avail_out){if(s>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0
},yc.prototype.onData=function(e){this.chunks.push(e)},yc.prototype.onEnd=function(e){e===pc&&(this.result=rc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var vc={Deflate:yc,deflate:wc,deflateRaw:function(e,t){return(t=t||{}).raw=!0,wc(e,t)},gzip:function(e,t){
return(t=t||{}).gzip=!0,wc(e,t)},constants:ra};const _c=16209;var kc=function(e,t){let n,r,i,s,o,a,c,l,d,h,u,p,f,m,g,b,y,w,v,_,k,E,C,x;const A=e.state;n=e.next_in,C=e.input,r=n+(e.avail_in-5),i=e.next_out,x=e.output,s=i-(t-e.avail_out),o=i+(e.avail_out-257),a=A.dmax,c=A.wsize,l=A.whave,d=A.wnext,
h=A.window,u=A.hold,p=A.bits,f=A.lencode,m=A.distcode,g=(1<<A.lenbits)-1,b=(1<<A.distbits)-1;e:do{p<15&&(u+=C[n++]<<p,p+=8,u+=C[n++]<<p,p+=8),y=f[u&g];t:for(;;){if(w=y>>>24,u>>>=w,p-=w,w=y>>>16&255,0===w)x[i++]=65535&y;else{if(!(16&w)){if(64&w){if(32&w){A.mode=16191;break e}
e.msg="invalid literal/length code",A.mode=_c;break e}y=f[(65535&y)+(u&(1<<w)-1)];continue t}for(v=65535&y,w&=15,w&&(p<w&&(u+=C[n++]<<p,p+=8),v+=u&(1<<w)-1,u>>>=w,p-=w),p<15&&(u+=C[n++]<<p,p+=8,u+=C[n++]<<p,p+=8),y=m[u&b];;){if(w=y>>>24,u>>>=w,p-=w,w=y>>>16&255,16&w){if(_=65535&y,w&=15,
p<w&&(u+=C[n++]<<p,p+=8,p<w&&(u+=C[n++]<<p,p+=8)),_+=u&(1<<w)-1,_>a){e.msg="invalid distance too far back",A.mode=_c;break e}if(u>>>=w,p-=w,w=i-s,_>w){if(w=_-w,w>l&&A.sane){e.msg="invalid distance too far back",A.mode=_c;break e}if(k=0,E=h,0===d){if(k+=c-w,w<v){v-=w;do{x[i++]=h[k++]}while(--w)
;k=i-_,E=x}}else if(d<w){if(k+=c+d-w,w-=d,w<v){v-=w;do{x[i++]=h[k++]}while(--w);if(k=0,d<v){w=d,v-=w;do{x[i++]=h[k++]}while(--w);k=i-_,E=x}}}else if(k+=d-w,w<v){v-=w;do{x[i++]=h[k++]}while(--w);k=i-_,E=x}for(;v>2;)x[i++]=E[k++],x[i++]=E[k++],x[i++]=E[k++],v-=3;v&&(x[i++]=E[k++],v>1&&(x[i++]=E[k++]))
}else{k=i-_;do{x[i++]=x[k++],x[i++]=x[k++],x[i++]=x[k++],v-=3}while(v>2);v&&(x[i++]=x[k++],v>1&&(x[i++]=x[k++]))}break}if(64&w){e.msg="invalid distance code",A.mode=_c;break e}y=m[(65535&y)+(u&(1<<w)-1)]}}break}}while(n<r&&i<o);v=p>>3,n-=v,p-=v<<3,u&=(1<<p)-1,e.next_in=n,e.next_out=i,
e.avail_in=n<r?r-n+5:5-(n-r),e.avail_out=i<o?o-i+257:257-(i-o),A.hold=u,A.bits=p}
;const Ec=15,Cc=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),xc=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Ac=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Tc=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64])
;var Sc=(e,t,n,r,i,s,o,a)=>{const c=a.bits;let l,d,h,u,p,f,m=0,g=0,b=0,y=0,w=0,v=0,_=0,k=0,E=0,C=0,x=null;const A=new Uint16Array(16),T=new Uint16Array(16);let S,L,I,j=null;for(m=0;m<=Ec;m++)A[m]=0;for(g=0;g<r;g++)A[t[n+g]]++;for(w=c,y=Ec;y>=1&&0===A[y];y--);if(w>y&&(w=y),
0===y)return i[s++]=20971520,i[s++]=20971520,a.bits=1,0;for(b=1;b<y&&0===A[b];b++);for(w<b&&(w=b),k=1,m=1;m<=Ec;m++)if(k<<=1,k-=A[m],k<0)return-1;if(k>0&&(0===e||1!==y))return-1;for(T[1]=0,m=1;m<Ec;m++)T[m+1]=T[m]+A[m];for(g=0;g<r;g++)0!==t[n+g]&&(o[T[t[n+g]]++]=g);if(0===e?(x=j=o,f=20):1===e?(x=Cc,
j=xc,f=257):(x=Ac,j=Tc,f=0),C=0,g=0,m=b,p=s,v=w,_=0,h=-1,E=1<<w,u=E-1,1===e&&E>852||2===e&&E>592)return 1;for(;;){S=m-_,o[g]+1<f?(L=0,I=o[g]):o[g]>=f?(L=j[o[g]-f],I=x[o[g]-f]):(L=96,I=0),l=1<<m-_,d=1<<v,b=d;do{d-=l,i[p+(C>>_)+d]=S<<24|L<<16|I}while(0!==d);for(l=1<<m-1;C&l;)l>>=1;if(0!==l?(C&=l-1,
C+=l):C=0,g++,0==--A[m]){if(m===y)break;m=t[n+o[g]]}if(m>w&&(C&u)!==h){for(0===_&&(_=w),p+=b,v=m-_,k=1<<v;v+_<y&&(k-=A[v+_],!(k<=0));)v++,k<<=1;if(E+=1<<v,1===e&&E>852||2===e&&E>592)return 1;h=C&u,i[h]=w<<24|v<<16|p-s}}return 0!==C&&(i[p+C]=m-_<<24|64<<16),a.bits=w,0}
;const{Z_FINISH:Lc,Z_BLOCK:Ic,Z_TREES:jc,Z_OK:Oc,Z_STREAM_END:Dc,Z_NEED_DICT:Rc,Z_STREAM_ERROR:Bc,Z_DATA_ERROR:Nc,Z_MEM_ERROR:Pc,Z_BUF_ERROR:zc,Z_DEFLATED:Mc}=ra,Uc=16180,Fc=16190,Hc=16191,$c=16192,qc=16194,Vc=16199,Wc=16200,Zc=16206,Gc=16209,Kc=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)
;function Yc(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,
this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Jc=e=>{if(!e)return 1
;const t=e.state;return!t||t.strm!==e||t.mode<Uc||t.mode>16211?1:0},Xc=e=>{if(Jc(e))return Bc;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Uc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,
t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Oc},Qc=e=>{if(Jc(e))return Bc;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Xc(e)},el=(e,t)=>{let n;if(Jc(e))return Bc;const r=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),
t&&(t<8||t>15)?Bc:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Qc(e))},tl=(e,t)=>{if(!e)return Bc;const n=new Yc;e.state=n,n.strm=e,n.window=null,n.mode=Uc;const r=el(e,t);return r!==Oc&&(e.state=null),r};let nl,rl,il=!0;const sl=e=>{if(il){nl=new Int32Array(512),
rl=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Sc(1,e.lens,0,288,nl,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Sc(2,e.lens,0,32,rl,0,e.work,{bits:5}),il=!1}e.lencode=nl,e.lenbits=9,e.distcode=rl,e.distbits=5
},ol=(e,t,n,r)=>{let i;const s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),r>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>r&&(i=r),s.window.set(t.subarray(n-r,n-r+i),s.wnext),
(r-=i)?(s.window.set(t.subarray(n-r,n),0),s.wnext=r,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0};var al={inflateReset:Qc,inflateReset2:el,inflateResetKeep:Xc,inflateInit:e=>tl(e,15),inflateInit2:tl,inflate:(e,t)=>{
let n,r,i,s,o,a,c,l,d,h,u,p,f,m,g,b,y,w,v,_,k,E,C=0;const x=new Uint8Array(4);let A,T;const S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Jc(e)||!e.output||!e.input&&0!==e.avail_in)return Bc;n=e.state,n.mode===Hc&&(n.mode=$c),o=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,
r=e.input,a=e.avail_in,l=n.hold,d=n.bits,h=a,u=c,E=Oc;e:for(;;)switch(n.mode){case Uc:if(0===n.wrap){n.mode=$c;break}for(;d<16;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(2&n.wrap&&35615===l){0===n.wbits&&(n.wbits=15),n.check=0,x[0]=255&l,x[1]=l>>>8&255,n.check=ta(n.check,x,2,0),l=0,d=0,n.mode=16181
;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",n.mode=Gc;break}if((15&l)!==Mc){e.msg="unknown compression method",n.mode=Gc;break}if(l>>>=4,d-=4,k=8+(15&l),0===n.wbits&&(n.wbits=k),k>15||k>n.wbits){e.msg="invalid window size",n.mode=Gc;break}
n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&l?16189:Hc,l=0,d=0;break;case 16181:for(;d<16;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(n.flags=l,(255&n.flags)!==Mc){e.msg="unknown compression method",n.mode=Gc;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=Gc;break}
n.head&&(n.head.text=l>>8&1),512&n.flags&&4&n.wrap&&(x[0]=255&l,x[1]=l>>>8&255,n.check=ta(n.check,x,2,0)),l=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}n.head&&(n.head.time=l),512&n.flags&&4&n.wrap&&(x[0]=255&l,x[1]=l>>>8&255,x[2]=l>>>16&255,x[3]=l>>>24&255,
n.check=ta(n.check,x,4,0)),l=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}n.head&&(n.head.xflags=255&l,n.head.os=l>>8),512&n.flags&&4&n.wrap&&(x[0]=255&l,x[1]=l>>>8&255,n.check=ta(n.check,x,2,0)),l=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){
if(0===a)break e;a--,l+=r[s++]<<d,d+=8}n.length=l,n.head&&(n.head.extra_len=l),512&n.flags&&4&n.wrap&&(x[0]=255&l,x[1]=l>>>8&255,n.check=ta(n.check,x,2,0)),l=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>a&&(p=a),
p&&(n.head&&(k=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(s,s+p),k)),512&n.flags&&4&n.wrap&&(n.check=ta(n.check,r,p,s)),a-=p,s+=p,n.length-=p),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){
if(0===a)break e;p=0;do{k=r[s+p++],n.head&&k&&n.length<65536&&(n.head.name+=String.fromCharCode(k))}while(k&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=ta(n.check,r,p,s)),a-=p,s+=p,k)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break e;p=0;do{
k=r[s+p++],n.head&&k&&n.length<65536&&(n.head.comment+=String.fromCharCode(k))}while(k&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=ta(n.check,r,p,s)),a-=p,s+=p,k)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}
if(4&n.wrap&&l!==(65535&n.check)){e.msg="header crc mismatch",n.mode=Gc;break}l=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Hc;break;case 16189:for(;d<32;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}e.adler=n.check=Kc(l),l=0,d=0,n.mode=Fc;case Fc:
if(0===n.havedict)return e.next_out=o,e.avail_out=c,e.next_in=s,e.avail_in=a,n.hold=l,n.bits=d,Rc;e.adler=n.check=1,n.mode=Hc;case Hc:if(t===Ic||t===jc)break e;case $c:if(n.last){l>>>=7&d,d-=7&d,n.mode=Zc;break}for(;d<3;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}switch(n.last=1&l,l>>>=1,d-=1,3&l){
case 0:n.mode=16193;break;case 1:if(sl(n),n.mode=Vc,t===jc){l>>>=2,d-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=Gc}l>>>=2,d-=2;break;case 16193:for(l>>>=7&d,d-=7&d;d<32;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if((65535&l)!=(l>>>16^65535)){
e.msg="invalid stored block lengths",n.mode=Gc;break}if(n.length=65535&l,l=0,d=0,n.mode=qc,t===jc)break e;case qc:n.mode=16195;case 16195:if(p=n.length,p){if(p>a&&(p=a),p>c&&(p=c),0===p)break e;i.set(r.subarray(s,s+p),o),a-=p,s+=p,c-=p,o+=p,n.length-=p;break}n.mode=Hc;break;case 16196:for(;d<14;){
if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(n.nlen=257+(31&l),l>>>=5,d-=5,n.ndist=1+(31&l),l>>>=5,d-=5,n.ncode=4+(15&l),l>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Gc;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===a)break e
;a--,l+=r[s++]<<d,d+=8}n.lens[S[n.have++]]=7&l,l>>>=3,d-=3}for(;n.have<19;)n.lens[S[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},E=Sc(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,E){e.msg="invalid code lengths set",n.mode=Gc;break}n.have=0,n.mode=16198;case 16198:
for(;n.have<n.nlen+n.ndist;){for(;C=n.lencode[l&(1<<n.lenbits)-1],g=C>>>24,b=C>>>16&255,y=65535&C,!(g<=d);){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(y<16)l>>>=g,d-=g,n.lens[n.have++]=y;else{if(16===y){for(T=g+2;d<T;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(l>>>=g,d-=g,0===n.have){
e.msg="invalid bit length repeat",n.mode=Gc;break}k=n.lens[n.have-1],p=3+(3&l),l>>>=2,d-=2}else if(17===y){for(T=g+3;d<T;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}l>>>=g,d-=g,k=0,p=3+(7&l),l>>>=3,d-=3}else{for(T=g+7;d<T;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}l>>>=g,d-=g,k=0,p=11+(127&l),l>>>=7,d-=7
}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Gc;break}for(;p--;)n.lens[n.have++]=k}}if(n.mode===Gc)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Gc;break}if(n.lenbits=9,A={bits:n.lenbits},E=Sc(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),
n.lenbits=A.bits,E){e.msg="invalid literal/lengths set",n.mode=Gc;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},E=Sc(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,E){e.msg="invalid distances set",n.mode=Gc;break}if(n.mode=Vc,t===jc)break e;case Vc:n.mode=Wc
;case Wc:if(a>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=s,e.avail_in=a,n.hold=l,n.bits=d,kc(e,u),o=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,r=e.input,a=e.avail_in,l=n.hold,d=n.bits,n.mode===Hc&&(n.back=-1);break}for(n.back=0;C=n.lencode[l&(1<<n.lenbits)-1],g=C>>>24,b=C>>>16&255,
y=65535&C,!(g<=d);){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(b&&!(240&b)){for(w=g,v=b,_=y;C=n.lencode[_+((l&(1<<w+v)-1)>>w)],g=C>>>24,b=C>>>16&255,y=65535&C,!(w+g<=d);){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}l>>>=w,d-=w,n.back+=w}if(l>>>=g,d-=g,n.back+=g,n.length=y,0===b){n.mode=16205;break}
if(32&b){n.back=-1,n.mode=Hc;break}if(64&b){e.msg="invalid literal/length code",n.mode=Gc;break}n.extra=15&b,n.mode=16201;case 16201:if(n.extra){for(T=n.extra;d<T;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}n.length+=l&(1<<n.extra)-1,l>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202
;case 16202:for(;C=n.distcode[l&(1<<n.distbits)-1],g=C>>>24,b=C>>>16&255,y=65535&C,!(g<=d);){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}if(!(240&b)){for(w=g,v=b,_=y;C=n.distcode[_+((l&(1<<w+v)-1)>>w)],g=C>>>24,b=C>>>16&255,y=65535&C,!(w+g<=d);){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}l>>>=w,d-=w,
n.back+=w}if(l>>>=g,d-=g,n.back+=g,64&b){e.msg="invalid distance code",n.mode=Gc;break}n.offset=y,n.extra=15&b,n.mode=16203;case 16203:if(n.extra){for(T=n.extra;d<T;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}n.offset+=l&(1<<n.extra)-1,l>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){
e.msg="invalid distance too far back",n.mode=Gc;break}n.mode=16204;case 16204:if(0===c)break e;if(p=u-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Gc;break}p>n.wnext?(p-=n.wnext,f=n.wsize-p):f=n.wnext-p,p>n.length&&(p=n.length),m=n.window}else m=i,
f=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do{i[o++]=m[f++]}while(--p);0===n.length&&(n.mode=Wc);break;case 16205:if(0===c)break e;i[o++]=n.length,c--,n.mode=Wc;break;case Zc:if(n.wrap){for(;d<32;){if(0===a)break e;a--,l|=r[s++]<<d,d+=8}if(u-=c,e.total_out+=u,n.total+=u,
4&n.wrap&&u&&(e.adler=n.check=n.flags?ta(n.check,i,u,o-u):Qo(n.check,i,u,o-u)),u=c,4&n.wrap&&(n.flags?l:Kc(l))!==n.check){e.msg="incorrect data check",n.mode=Gc;break}l=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===a)break e;a--,l+=r[s++]<<d,d+=8}
if(4&n.wrap&&l!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=Gc;break}l=0,d=0}n.mode=16208;case 16208:E=Dc;break e;case Gc:E=Nc;break e;case 16210:return Pc;default:return Bc}return e.next_out=o,e.avail_out=c,e.next_in=s,e.avail_in=a,n.hold=l,n.bits=d,
(n.wsize||u!==e.avail_out&&n.mode<Gc&&(n.mode<Zc||t!==Lc))&&ol(e,e.output,e.next_out,u-e.avail_out),h-=e.avail_in,u-=e.avail_out,e.total_in+=h,e.total_out+=u,n.total+=u,4&n.wrap&&u&&(e.adler=n.check=n.flags?ta(n.check,i,u,e.next_out-u):Qo(n.check,i,u,e.next_out-u)),
e.data_type=n.bits+(n.last?64:0)+(n.mode===Hc?128:0)+(n.mode===Vc||n.mode===qc?256:0),(0===h&&0===u||t===Lc)&&E===Oc&&(E=zc),E},inflateEnd:e=>{if(Jc(e))return Bc;let t=e.state;return t.window&&(t.window=null),e.state=null,Oc},inflateGetHeader:(e,t)=>{if(Jc(e))return Bc;const n=e.state
;return 2&n.wrap?(n.head=t,t.done=!1,Oc):Bc},inflateSetDictionary:(e,t)=>{const n=t.length;let r,i,s;return Jc(e)?Bc:(r=e.state,0!==r.wrap&&r.mode!==Fc?Bc:r.mode===Fc&&(i=1,i=Qo(i,t,n,0),i!==r.check)?Nc:(s=ol(e,t,n,n),s?(r.mode=16210,Pc):(r.havedict=1,Oc)))},
inflateInfo:"pako inflate (from Nodeca project)"},cl=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}
;const ll=Object.prototype.toString,{Z_NO_FLUSH:dl,Z_FINISH:hl,Z_OK:ul,Z_STREAM_END:pl,Z_NEED_DICT:fl,Z_STREAM_ERROR:ml,Z_DATA_ERROR:gl,Z_MEM_ERROR:bl}=ra;function yl(e){this.options=rc.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options
;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,
this.chunks=[],this.strm=new ac,this.strm.avail_out=0;let n=al.inflateInit2(this.strm,t.windowBits);if(n!==ul)throw Error(na[n]);if(this.header=new cl,al.inflateGetHeader(this.strm,this.header),
t.dictionary&&("string"==typeof t.dictionary?t.dictionary=oc.string2buf(t.dictionary):"[object ArrayBuffer]"===ll.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=al.inflateSetDictionary(this.strm,t.dictionary),n!==ul)))throw Error(na[n])}function wl(e,t){const n=new yl(t)
;if(n.push(e),n.err)throw n.msg||na[n.err];return n.result}yl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=t===~~t?t:!0===t?hl:dl,"[object ArrayBuffer]"===ll.call(e)?n.input=new Uint8Array(e):n.input=e,
n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),s=al.inflate(n,o),s===fl&&i&&(s=al.inflateSetDictionary(n,i),s===ul?s=al.inflate(n,o):s===gl&&(s=fl));n.avail_in>0&&s===pl&&n.state.wrap>0&&0!==e[n.next_in];)al.inflateReset(n),
s=al.inflate(n,o);switch(s){case ml:case gl:case fl:case bl:return this.onEnd(s),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||s===pl))if("string"===this.options.to){let e=oc.utf8border(n.output,n.next_out),t=n.next_out-e,i=oc.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,
t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(s!==ul||0!==a){if(s===pl)return s=al.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},
yl.prototype.onData=function(e){this.chunks.push(e)},yl.prototype.onEnd=function(e){e===ul&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=rc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var vl={Inflate:yl,inflate:wl,
inflateRaw:function(e,t){return(t=t||{}).raw=!0,wl(e,t)},ungzip:wl,constants:ra};const{Deflate:_l,deflate:kl,deflateRaw:El,gzip:Cl}=vc,{Inflate:xl,inflate:Al,inflateRaw:Tl,ungzip:Sl}=vl;var Ll=kl,Il=Al;const jl={encode:e=>{const t=Array.from(e).map((e=>e.codePointAt(0)||0)),n=[]
;for(const e of t)e<=127?n.push(e):e<=2047?(n.push(e>>6|192),n.push(63&e|128)):e<=65535?(n.push(e>>12|224),n.push(e>>6&63|128),n.push(63&e|128)):e<=1114111&&(n.push(e>>18|240),n.push(e>>12&63|128),n.push(e>>6&63|128),n.push(63&e|128));return Uint8Array.from(n).buffer},decode:e=>{
const t=new Uint8Array(e);let n="",r=0;for(;r<t.length;){const e=t[r];if(128&e)if(192==(224&e)){const i=t[r+1];n+=String.fromCharCode((31&e)<<6|63&i),r+=2}else if(224==(240&e)){const i=t[r+1],s=t[r+2];n+=String.fromCharCode((15&e)<<12|(63&i)<<6|63&s),r+=3}else if(240==(248&e)){
const i=(7&e)<<18|(63&t[r+1])<<12|(63&t[r+2])<<6|63&t[r+3];n+=i<=1114111?String.fromCodePoint(i):"\ufffd",r+=4}else n+="\ufffd",r+=1;else n+=String.fromCharCode(e),r+=1}return n}},Ol=jl;var Dl,Rl,Bl=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable")
;if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n},Nl=function(e,t,n,r){
if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};Dl=new WeakMap,
Rl=new WeakMap;const Pl=class{constructor(e){Dl.set(this,void 0),Rl.set(this,0),ArrayBuffer.isView(e)?Bl(this,Dl,e.buffer,"f"):Bl(this,Dl,new DataView(e,0,0).buffer,"f")}read(){var e,t;return new Uint8Array(Nl(this,Dl,"f"))[(Bl(this,Rl,(t=Nl(this,Rl,"f"),e=t++,t),"f"),e)]}readNBytes(e){
const t=Nl(this,Dl,"f"),n=t.byteLength,r=Nl(this,Rl,"f");if(r>=n)return new ArrayBuffer(0);const i=Bl(this,Rl,Nl(this,Rl,"f")+e,"f");return i>n?t.slice(r,n):t.slice(r,i)}};var zl,Ml=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter")
;if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};zl=new WeakMap;const Ul=class{constructor(){zl.set(this,[])}write(e){const t=Ml(this,zl,"f")
;switch(typeof e){case"number":t.push(e);break;case"object":Array.isArray(e)?t.push(Uint8Array.from(e).buffer):ArrayBuffer.isView(e)?t.push(e.buffer):t.push(new DataView(e,0,0).buffer);break;default:throw Error("Invalid value: "+e)}}toArrayBuffer(e){const t=Ml(this,zl,"f")
;if((e||(e=0))<=0)for(const n of t)e+="number"==typeof n?1:n.byteLength;const n=new Uint8Array(new ArrayBuffer(e),0,e);e=0;for(const r of t){if("number"==typeof r){n[e++]=r;continue}const t=r.byteLength;n.set(new Uint8Array(r,0,t),e),e+=t}return n.buffer}};function Fl(e){try{
return new DataView(e,0,0),!0}catch(e){return!1}}function Hl(e){const t=e.buffer,n=e.byteOffset,r=e.byteLength;return 0===n&&r===t.byteLength?t:t.slice(n,n+r)}function $l(e,t){const n=Ol.encode(t),r=new DataView(new ArrayBuffer(4),0,4);r.setUint32(0,n.byteLength,!0),e.write(r),e.write(n)}
function ql(e,t){const n=new DataView(new ArrayBuffer(5),0,5);n.setUint8(0,102),n.setUint32(1,t.byteLength,!0),e.write(n),e.write(t)}function Vl(e,t){switch(typeof t){case"string":e.write(101),$l(e,t);break;case"boolean":e.write([10,t?1:0]);break;case"undefined":e.write(0);break;case"number":{
if(Number.isSafeInteger(t))if(t>=0){if(t<=255){const n=new DataView(new ArrayBuffer(2),0,2);return n.setUint8(0,10),n.setUint8(1,t),void e.write(n)}if(t<=65535){const n=new DataView(new ArrayBuffer(3),0,3);return n.setUint8(0,11),n.setUint16(1,t,!0),void e.write(n)}if(t<=4294967295){
const n=new DataView(new ArrayBuffer(5),0,5);return n.setUint8(0,12),n.setUint32(1,t,!0),void e.write(n)}}else{if(t>=-128&&t<128){const n=new DataView(new ArrayBuffer(2),0,2);return n.setUint8(0,20),n.setInt8(1,t),void e.write(n)}if(t>=-32768&&t<32768){const n=new DataView(new ArrayBuffer(3),0,3)
;return n.setUint8(0,21),n.setInt16(1,t,!0),void e.write(n)}if(t>=-2147483648&&t<2147483648){const n=new DataView(new ArrayBuffer(5),0,5);return n.setUint8(0,22),n.setInt32(1,t,!0),void e.write(n)}}const n=new DataView(new ArrayBuffer(9),0,9);n.setUint8(0,33),n.setFloat64(1,t,!0),e.write(n)}break
;case"bigint":{const n=new DataView(new ArrayBuffer(9),0,9);t>=0n?(n.setUint8(0,13),n.setBigUint64(1,t,!0)):(n.setUint8(0,23),n.setBigUint64(1,t,!0)),e.write(n)}break;case"object":null===t?e.write(255):Array.isArray(t)?function(e,t){const n=new DataView(new ArrayBuffer(5),0,5);n.setUint8(0,99),
n.setUint32(1,t.length,!0),e.write(n);for(const n of t)Vl(e,n)}(e,t):Fl(t)?ql(e,t):ArrayBuffer.isView(t)?ql(e,Hl(t)):function(e,t){if("function"==typeof t.toJSON)return void Vl(e,t.toJSON());const n=Object.keys(t);{const t=new DataView(new ArrayBuffer(5),0,5);t.setUint8(0,100),
t.setUint32(1,n.length,!0),e.write(t)}for(const r of n){const n=t[r];switch(typeof n){case"boolean":case"bigint":case"number":case"object":case"string":case"undefined":$l(e,r),Vl(e,n)}}}(e,t)}}function Wl(e,t){if("object"!=typeof e||null==e)throw Error("Data must be a non-null object or array.")
;if("object"!=typeof(t||(t={})))throw Error("The options parameter must be an object.");{const t=new Ul;Vl(t,e),e=t.toArrayBuffer()}const n=t.compressMethod||0,r=t.compressLevel||5;switch(n){case 0:break;case 1:e=Ll(e,{raw:!0,level:r,memLevel:9,chunkSize:8192,windowBits:15});break;case 3:e=Ll(e,{
gzip:!0,level:r,memLevel:9,chunkSize:8192,windowBits:15});break;case 2:case 4:case 5:case 6:throw Error("Not implemented");default:throw Error("Unknown compress method: "+n)}const i=new Uint8Array(new ArrayBuffer(e.byteLength+7));return i[0]=128,i[1]=99,i[2]=98,i[3]=106,i[4]=102,i[5]=1,i[6]=n,
i.set(new Uint8Array(e),7),i.buffer}function Zl(e){const t=e.read();switch(t){case 0:return;case 255:return null;case 10:return e.read();case 11:return new DataView(e.readNBytes(2),0,2).getUint16(0,!0);case 12:return new DataView(e.readNBytes(4),0,4).getUint32(0,!0);case 13:
return new DataView(e.readNBytes(8),0,8).getBigUint64(0,!0);case 20:return e.read()<<8>>8;case 21:return new DataView(e.readNBytes(2),0,2).getInt16(0,!0);case 22:return new DataView(e.readNBytes(4),0,4).getInt32(0,!0);case 23:return new DataView(e.readNBytes(8),0,8).getBigInt64(0,!0);case 32:
return new DataView(e.readNBytes(4),0,4).getFloat32(0,!0);case 33:return new DataView(e.readNBytes(8),0,8).getFloat64(0,!0);case 99:return function(e){const t=new DataView(e.readNBytes(4),0,4).getUint32(0,!0),n=Array(t);for(let r=0;r<t;r++)n[r]=Zl(e);return n}(e);case 100:return function(e){
const t=new DataView(e.readNBytes(4),0,4).getUint32(0,!0),n=Object.create(null);for(let r=0;r<t;r++)n[Ol.decode(e.readNBytes(new DataView(e.readNBytes(4),0,4).getUint32(0,!0)))]=Zl(e);return n}(e);case 101:return Ol.decode(e.readNBytes(new DataView(e.readNBytes(4),0,4).getUint32(0,!0)));case 102:
return e.readNBytes(new DataView(e.readNBytes(4),0,4).getUint32(0,!0));default:throw Error("Parse Error: Invalid data ID: "+t)}}function Gl(e,t){if("object"!=typeof(t||{}))throw Error("The options parameter must be an object.");if(ArrayBuffer.isView(e)&&(e=Hl(e)),
!Fl(e))throw Error("The data parameter must be an ArrayBuffer.");{const t=new Uint8Array(e,0,e.byteLength);if(128!==t[0]||99!==t[1]||98!==t[2]||106!==t[3]||102!==t[4]||1!==t[5])throw Error("Parse Error: Input data is not valid.");switch(t[6]){case 0:e=e.slice(7);break;case 1:e=Il(e.slice(7),{raw:!0,
chunkSize:8192,windowBits:15}).buffer;break;case 3:e=Il(e.slice(7),{chunkSize:8192,windowBits:15}).buffer;break;case 2:case 4:case 5:case 6:throw Error("Not implemented");default:throw Error("Parse Error: Unknown compress method.")}}return Zl(new Pl(e))}Object.seal(Object.setPrototypeOf(n,null)),
Object.freeze(Wl)
;const Kl=Object.freeze(Gl),Yl=Object.preventExtensions(Object.setPrototypeOf(Kl(wi.decode("gGNiamYBAYVUbW/bNhB294bC2BswYF/LqijQD5ElLd3QSHaKLAnQAW0XdO66YRgMSjxJnGlSISnL3n/Zf+3x5HQvCDoD1vGO9xwf3cOT+HoymXyA/xWHL9A8rF6C9wreQDmrzIZ2Svj8zmTSGSe9NDq3oLiXWyiEdJ3i+7xUploXgxS+zWvp48poD9oXLcim9f8KdVwIqZv8225XbLhtpM6ztNsx3ntTVEYZmz+o67oojRVg82PcckZJwR6k+MONGgvFTv4J+TePscbo+r2CXBu74aooebVurOm1yBHzOH2Sjkk130i1z6PXZa99Hx05rl3swMpDzWEk+12aFkpqiA/k6RSFLQEbu45XgTwSLqgxAv5CMxdye3rGau65YmCtscxUVW8tCDa0UgE7NAqxzLfADs1wzNToS8c63sBsnoQ6U6p2pYA7YN7uWe8CjGONugaLMFZaMyBxhudo8IOx66OwDsm84VIzlAfsoR7xBJiStD+/YBfAxX0K1hCkb73vXJ4kmlQfRtUTSmjgLppLeqH8EYVa+CpgsMZpiQR/ay3UiyiJfqddCZ+g8SgreAr8AZ+iQe/MeyvL3gOF19Ch+Yfaf4ua/b+odZq+V7HsfYoporgqFddrCmzgSzTXPdj9T6Cg8saeKUVbmnJdZWU3vo6Bz/6bS/EO7qHhh27c3tGIMq/h4S2ZjfRtP6a9A435Fj4OHZUYI38La5zE+dPdRrEtWIfjuIiyWRox0JUJk7WIel/HTyL2FK/S/Ysfz5e/Xl2y1iPg6vX3z384Z1GcJG+Oz5PkYnnBfnm2fPGcZbMsSS5fRowoIaNhGGbD8czYJlm+SnYBnmUBcLOeCS8iPIEKIxvtFrdgs5OTkxER4aUM5EATKlyg6XwDnrOq5daBf8c7udnQfAOLaCth6Iz10c3ULCL60CwEbGUFMTlHUuOniavYVVzBIhurUNtOr3C22DIs58kYmc6TA4HSiP3plDLOx+q4NwYxB2mP4zOQCq8AJwy7P9mJj/AZVjCqsgprR0mrFe9kcDsISUHT4O1pAHtdSlN52VPsmgB0B4Jr4UN8Yv/eAg==")),null))
;let Jl="whitespider";const{p:Xl,s:Ql,y:ed,e:td}=Yl.x;Xl&&Ql&&ed&&(Jl=Ql+td+"0."+ed+Xl+"/",Jl.length<10&&(Jl=""));const nd=Jl;let rd;const id=Object.freeze(Object.create(null,{_:{value:({console:e})=>{if(null==e||"object"!=typeof e)throw Error("Invalid interface");const t=Reflect.get(e,"log",void 0)
;if("function"!=typeof t)throw Error("Invalid instance impl");rd=(...e)=>(Reflect.apply(t,null,e),!0)},writable:!1,enumerable:!1,configurable:!1},$:{get:()=>rd,enumerable:!1,configurable:!1}}));(async({window:e,document:t})=>{function n(e){const n=t.getElementById(e)
;if(null==n)throw Error("Element does not exist: "+e);return n}function r(e){const n=t.querySelector(e);if(n instanceof HTMLElement)return n;throw Error("Failed to query selector: "+e)}function i(e){null!=e?(p.textContent=e,p.style.display="block"):p.style.display="none"}function s(e){
f.appendChild(o(e)),m.style.display="block"}function o(n){const r=t.createElement("iframe");return r.setAttribute("width","1024"),r.setAttribute("height","768"),r.setAttribute("allowfullscreen","true"),r.setAttribute("allowpaymentrequest","true"),r.setAttribute("name","Frame"),
r.setAttribute("allow","fullscreen payment"),r.setAttribute("loading","lazy"),r.setAttribute("scrolling","no"),r.setAttribute("frameborder","0"),r.setAttribute("credentialless","true"),r.setAttribute("referrerpolicy","no-referrer"),r.onload=()=>{r.onload=null
;const t="data:application/xhtml+xml;base64,"+wi.encode(_i.encode(`<?xml version="1.0" encoding="utf-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n\t<head>\n\t\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n\t\t<meta http-equiv="Referrer-Policy" content="no-referrer" />\n\t\t<meta name="referrer" content="no-referrer" />\n\t\t<meta name="viewport" content="width=device-width,initial-scale=1" />\n\t\t<base href="${e.origin}" target="_blank" />\n\t\t<link rel="icon" type="image/x-icon" href="res/google.ico" />\n\t\t<title>Google</title>\n\t\t<style type="text/css">\nbody, embed, iframe {\n\tposition: absolute;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tmargin: 0px;\n\tpadding: 0px;\n\tborder: none;\n\toverflow: hidden;\n}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<embed type="text/plain" width="1024" height="768" src="${n.replace(/\&/g,"&")}" />\n\t</body>\n</html>`))
;r.setAttribute("src",t)},r}function a(e){try{return new URL(e)}catch(e){return null}}function c(t){const n=e.open(void 0,"_blank","");if(null==n)return void i("Please allow popups in your browser settings and try again.");n.stop(),n.focus()
;const r=y.parseFromString(`<?xml version="1.0" encoding="utf-8" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en">\n\t<head>\n\t\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n\t\t<meta http-equiv="Referrer-Policy" content="no-referrer" />\n\t\t<meta name="referrer" content="no-referrer" />\n\t\t<meta name="viewport" content="width=device-width,initial-scale=1" />\n\t\t<base href="${e.origin}" target="_blank" />\n\t\t<link rel="icon" type="image/x-icon" href="res/google.ico" />\n\t\t<style type="text/css">\nbody, embed, iframe {\n\tposition: absolute;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 100%;\n\tmargin: 0px;\n\tpadding: 0px;\n\tborder: none;\n\toverflow: hidden;\n}\n\t\t</style>\n\t\t<title>Google</title>\n\t</head>\n\t<body>\n\t\t\x3c!-- dummy --\x3e\n\t</body>\n</html>`,"application/xml")
;t.remove(),r.body.appendChild(t),n.document.documentElement.replaceWith(r.documentElement)}function l(e,t){return new Promise(((n,r)=>{const i=Date.now().toString(36),s=(e,t,a)=>{e===i&&(A.off("res",s),A.off("disconnect",o),null!=a?r(a):n(t))},o=()=>{A.off("res",s),A.off("disconnect",o),
r("Error: Server connection interrupted.")};A.on("res",s),A.on("disconnect",o),A.emit("fetch",i,e,t)}))}"complete"!==t.readyState&&await new Promise((e=>{const n=()=>{"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),e())};t.addEventListener("readystatechange",n,{passive:!0})
})),id._(e),e.onerror=(e,t,n,r,i)=>{let s="Unhandled error at "+(t||"unknown source ");null!=n&&(s+=n),null!=r&&(s+=":"+r),null!=i&&(s+="\n\n"+i),console.error(s),p.textContent=s,p.style.display="block"},e.onkeydown=e=>{if(e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey)switch(e.key){case"q":
e.preventDefault(),e.stopPropagation(),d.replace("https://www.google.com/webhp?igu=1");break;case"b":e.preventDefault(),e.stopPropagation();const{body:n}=t;n.hasAttribute("style")?n.removeAttribute("style"):n.setAttribute("style","filter: blur(15px);");break;case"h":e.preventDefault(),
e.stopPropagation(),"NettleWeb"===t.title?(t.title="Google",r("link[rel*='icon']").href="/res/google.ico"):(t.title="NettleWeb",r("link[rel*='icon']").href="/favicon.ico")}},e.onpopstate=e=>{e.preventDefault(),e.stopPropagation(),i("Notice: Please press ctrl+Q to leave this website.")},
e.onappinstalled=e=>{e.preventDefault(),e.stopPropagation(),b.style.display="none"},e.onbeforeinstallprompt=e=>{e.preventDefault(),e.stopPropagation(),b.style.display="block",b.onclick=()=>{e.prompt()}}
;const d=e.location,h=e.history,u=d.pathname,p=n("error"),f=n("frame"),m=n("frame-view"),g=n("status"),b=n("install"),y=new DOMParser,w=r('link[rel="canonical"]'),v=id.$;{const{_a:F,_b:H,_d:$,_e:q,_f:V,_g:W,_h:Z,_i:G,_j:K,_k:Y,_l:J,_m:X,_n:Q,_o:ee,_v:te,_w:ne,_p:re,_q:ie,_r:se}=Yl;if((()=>{v(F,H)
;const e=new URL(d.href),n=e.hostname,r=e.origin;switch(e.protocol){case"http:":if("localhost"!==n)return e.protocol="https:",e.pathname="/",e.host=n,d.replace(e.href),!1;break;case"https:":break;default:return!0}switch(n){case"whitespider.cf":case"whitespider.tk":case"whitespider.dev":
case"whitespider.web.app":case"whitespider.pages.dev":case"whitespider.firebaseapp.com":return e.host="nettleweb.com",e.pathname="/",d.replace(e.href),!1}{const e=t[ee](Z);if(null==e||e[K](G)!==J)return!0}for(const e of t[X](Q)){switch(e[K]("type")||""){case"":case"text/javascript":
case"application/javascript":break;default:return e.remove(),!0}const t=e[K]("src");if(!t||e.textContent)return e.remove(),!0;const n=new URL(t.startsWith("//")?"https:"+t:t,r);if(n.origin!==r){if("https:"===n.protocol){const e=n.host.split("."),t=e.length;if("com"===e[t-1]){const n=e[t-2]
;if(n.indexOf("google")>=0||n.indexOf("firebase")>=0)continue}}return e.remove(),!0}}return w[K]("href")!==V||null==t[ee](re)||null==t[ee](ie)||t[se]!==F.slice(2,11)})()){v(q,Y);const oe=y.parseFromString(te,"application/xhtml+xml");oe.title=W;const ae=oe.body;ae.innerHTML=$;{
const ce=oe.createElement("button");ce.innerHTML=ne,ce.setAttribute("type","button"),ce.addEventListener("click",(()=>{d.replace(V)}),{passive:!0}),ae.appendChild(ce)}return void t.documentElement.replaceWith(oe.documentElement)}
for(const le of Object.getOwnPropertyNames(Yl))2===le.length&&delete Yl[le]}if(e!==e.top){if("null"===d.ancestorOrigins?.item(0)){const de=t.createElement("div");return de.style.padding="15px",de.textContent="Click here to continue",de.onclick=()=>{const e=t.createElement("embed")
;e.type="text/plain",e.width="1280",e.height="720",e.src="https://nettleweb.com/",c(e)},t.body.innerHTML="",void t.body.appendChild(de)}if("https://nettleweb.com"!==d.origin)return void d.replace("https://nettleweb.com/")}Kr(ln({appId:"1:176227430389:web:94270de43b7eb971c03abc",
apiKey:"AIzaSyCPXTy7dt3fpcLd8kVTBtXy0xuBdeuhbFc",projectId:"whitespider",authDomain:"whitespider.firebaseapp.com",databaseURL:"https://whitespider-default-rtdb.firebaseio.com",storageBucket:"whitespider.appspot.com",measurementId:"G-F72WBJT57S",messagingSenderId:"176227430389"},"NettleWeb"))
;const _=t.documentElement.clientWidth<800,k=new mi(e),{localStorage:E}=k;let C,x,A,T,S,L,I,j,O,D=null,R=null;const B=[],N=[];if(e.isSecureContext??"https:"===d.protocol){if(k.persistent)try{const he=await async function(t,n){try{const r=await e.fetch(t,{cache:n||"force-cache",method:"GET"})
;return r.ok?await r.text():null}catch(e){return null}}("/manifest.json","no-cache");if(null!=he){const ue=JSON.parse(he).version;if(ue!==E.get("__mf_version")){t.body.innerHTML="Updating contents...";const pe=e.caches;for(const fe of await pe.keys())await pe.delete(fe)
;return E.delete("__new_read"),E.set("__mf_version",ue),void d.reload()}n("version").textContent="v"+ue}C=E.get("__secrets_")||void 0}catch(me){}else i("Warning: Cookies are blocked by your browser. Some features might not work properly, and your game data will NOT be saved.");try{
const ge=e.navigator.serviceWorker;null!=ge&&(await ge.register("/sw.js",{type:"classic",scope:"/",updateViaCache:"none"}),await ge.ready)}catch(be){}}try{const ye=await e.fetch("/d/index.json",{mode:"same-origin",cache:"no-cache",method:"GET"})
;if(!ye.ok)throw Error("Remote returned error status code: "+ye.status);const we=Kl(await ye.arrayBuffer());for(const ve of we)B.push(ve);for(const _e of we.sort(((e,t)=>t.date-e.date)).slice(0,200))N.push(_e)}catch(ke){return void i("Failed to initialize local game list. Message: "+ke)}try{
const Ee=e.top;null!=Ee&&(S=Ee===e?e:Ee.origin===e.origin?Ee:null)}catch(xe){}p.onclick=()=>{p.innerHTML="",p.style.display="none"},n("frame-close").onclick=()=>{f.innerHTML="",m.style.display="none",h.replaceState(void 0,"","/"),w.setAttribute("href","https://nettleweb.com/")},
n("frame-newtab").onclick=()=>{const e=f.firstElementChild;null!=e&&(f.innerHTML="",m.style.display="none",c(e))};{const Ae=r("link[rel*='icon']"),Te=n("backend-url"),Se=n("notice"),Le=n("theme"),Ie=n("tab-cloaking");let je;function Oe(e){if(null!=A&&(A.disconnect(),A.close()),null==T){
const{q:e,r:t}=Yl;null!=e&&null!=t&&(T=e+t+nd)}A=Ce(e||T||"https://service.nettleweb.com/",{path:"/api-v2/",secure:!0,upgrade:!0,timeout:1e4,forceNew:!0,multiplex:!1,protocols:[],transports:["polling","websocket"],autoConnect:!0,reconnection:!0,rememberUpgrade:!0,reconnectionDelay:5e3,
closeOnBeforeunload:!0}),g.innerHTML="Connecting...",g.style.color="#808000",A.on("an",(e=>{"string"==typeof e&&e.length>0&&(Se.textContent=e,Se.style.display="block")})),"string"!=typeof x&&A.once("lr",(e=>{x=e})),A.io.on("open",(()=>{g.innerHTML="\u2713Connected",g.style.color="#008000"})),
A.io.on("close",(()=>{g.innerHTML="\u2715Disconnected",g.style.color="#ff0000"})),A.io.on("reconnect_attempt",(()=>{g.innerHTML="Connecting...",g.style.color="#808000"})),A.io.on("reconnect_error",(()=>{g.innerHTML="\u2715Disconnected",g.style.color="#ff0000"})),A.io.on("reconnect",(()=>{
g.innerHTML="\u2713Connected",g.style.color="#008000",null!=C&&A.emit("login",C),null!=D&&D()}))}function De(e){switch(null==je&&(je=t.createElement("link"),je.rel="stylesheet",je.type="text/css",je.href="index.dark.css",t.head.appendChild(je)),e){case"light":je.disabled=!0,
je.removeAttribute("media");break;case"dark":je.disabled=!1,je.removeAttribute("media");break;default:je.media="all and (prefers-color-scheme: dark)",je.disabled=!1}}function Re(e){switch(e){case"empty":L=!0,t.title="\u2060",Ae.type="image/x-icon",Ae.href="/res/empty.ico";break;case"google":L=!0,
t.title="Google",Ae.type="image/x-icon",Ae.href="/res/google.ico";break;case"classroom":L=!0,t.title="Home",Ae.type="image/png",Ae.href="/res/classroom.png";break;default:L=!1,t.title="NettleWeb",Ae.type="image/x-icon",Ae.href="/favicon.ico"}}Te.onblur=()=>{const e=a(Te.value.trim());if(null!=e){
const t=e.href;E.set("__backendURL_",t),Oe(Te.value=t)}else E.delete("__backendURL_"),Oe(Te.value="")},Le.onchange=()=>{const e=Le.value;De(e),E.set("__set_theme",e)},Ie.onchange=()=>{const e=Ie.value;Re(e),E.set("__set_tabc",e)};{const Be=E.get("__backendURL_")||"";Oe(Be),Te.value=Be}{
const Ne=E.get("__set_theme")||"default";De(Ne),Le.value=Ne}{const Pe=E.get("__set_tabc")||"disabled";Re(Pe),Ie.value=Pe}}{
const ze=n("game-container"),Me=n("player"),Ue=n("game-page"),Fe=n("edit"),He=n("name"),$e=n("type"),qe=n("tags"),Ve=n("date"),We=n("user"),Ze=n("desc"),Ge=n("ecode"),Ke=n("dlink"),Ye=n("e-name"),Je=n("e-tags"),Xe=n("e-desc"),Qe=n("e-subm"),et=n("editor"),tt=n("s-games"),nt=n("controller"),rt=n("gnav-back"),it=n("gnav-forward"),st=n("gnav-page-no"),ot=n("gnav-page-count"),at=[],ct=[]
;let lt="all",dt="",ht=0;l(15).then((e=>{for(const t of Object.keys(e).map((t=>({k:parseInt(t,36),v:e[t]}))).sort(((e,t)=>t.v-e.v)).slice(0,100))for(const e of B)if(e.date===t.k){ct.push(e);break}})).catch((e=>{i("Failed to fetch remote game data. Message: "+e)}));{
const gt=n("game-search"),bt=r("#game-search>input");let yt=0;function wt(){dt=bt.value.toLowerCase().trim(),ft()}gt.onsubmit=e=>{e.preventDefault(),e.stopPropagation(),clearTimeout(yt),wt()},bt.onblur=()=>{clearTimeout(yt),wt()},bt.oninput=()=>{clearTimeout(yt),yt=setTimeout((()=>{wt()}),1e3)}}{
const vt=t.querySelectorAll("#game-category>button");for(const _t of vt)_t.onclick=()=>{for(const e of vt)e.removeAttribute("data-current");_t.setAttribute("data-current","true"),lt=_t.getAttribute("data-match")||"all",ft()}}{const kt=r('#game-category>button[data-match="new"]')
;E.has("__new_read")||(kt.setAttribute("unread","true"),kt.addEventListener("click",(()=>{kt.removeAttribute("unread"),E.set("__new_read","1")}),{once:!0,passive:!0}))}function ut(){switch(lt){case"all":return dt.length>0?B.filter((e=>e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)):B
;case"new":return dt.length>0?N.filter((e=>e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)):N;case"hot":return dt.length>0?ct.filter((e=>e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)):ct;case"html5":
return B.filter((e=>"html5"===e.type&&(0===dt.length||e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)));case"flash":return B.filter((e=>"flash"===e.type&&(0===dt.length||e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)));case"dos":
return B.filter((e=>"dos"===e.type&&(0===dt.length||e.name.toLowerCase().indexOf(dt)>=0||e.tags.indexOf(dt)>=0)));default:return B.filter((e=>e.tags.split(",").indexOf(lt)>=0&&(0===dt.length||e.name.toLowerCase().indexOf(dt)>=0)))}}function pt(){const e=[...B];for(let t=e.length;t>0;t--){
const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}function ft(){ht=0,at.length=0;const e=ut();if(0===e.length)rt.disabled=!0,it.disabled=!0,ze.innerHTML="No results found :(";else{for(let t=0;t<e.length;t+=100)at.push(e.slice(t,t+100));mt()}}function mt(){ze.innerHTML="",
st.value=ht+1+"",st.min="1",st.max=ot.innerHTML=at.length+"",rt.disabled=ht<1,ht>=at.length-1?it.disabled=!0:it.disabled=!1;for(const e of at[ht]){const{name:n,prev:r,date:i}=e,s=t.createElement("a");s.href=i>0?"/"+i.toString(36):"#",s.title="Play "+n,s.target="_self",s.className="game",
s.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),j(e))},s.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,s.appendChild(e)}switch(e.type){
case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",s.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",s.appendChild(e)}break;case"dos":{const e=t.createElement("span")
;e.textContent="Dos",e.style.background="#0000ff",s.appendChild(e)}break;default:s.style.backgroundImage='url("/res/preview.svg")'}ze.appendChild(s)}}j=async({name:e,type:n,tags:r,date:s,path:a,desc:c,user:u})=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,
Ue.setAttribute("data-current","true"),Me.appendChild(o("/ext/emu/?name="+e+"&type="+n+"&url="+encodeURIComponent(a))),R=()=>{R=null,Me.innerHTML="",L||(t.title="NettleWeb"),h.replaceState(void 0,"","/"),w.setAttribute("href","https://nettleweb.com/")},tt.innerHTML="",We.innerHTML="",
He.textContent=e,$e.textContent=n.toUpperCase(),qe.textContent=r.replace(/\,/g,", ")||"None",Ve.textContent=new Date(s).toLocaleDateString("POSIX",{month:"2-digit",day:"2-digit",year:"numeric"}),Ze.textContent=c||"No information provided by the uploader.",nt.style.display="block",Me.scrollIntoView({
block:"start",inline:"start",behavior:"instant"});{const n="/"+s.toString(36),r="https://nettleweb.com"+n;L||(t.title=e+" - NettleWeb"),h.replaceState(void 0,"",n),w.setAttribute("href",r),Ke.textContent=r,Ge.textContent='<embed type="text/plain" width="1280" height="720" src="'+r+'" />'}
Fe.innerHTML="Edit Game Info",Fe.disabled=!1,Fe.onclick=()=>{null!=C?(Ye.value=e,Je.value=r,Xe.value=c,et.style.display="block",Fe.style.display="none"):P.click()},Qe.onclick=()=>{if(null==C)return void i("Invalid session. Please refresh this page and try again.")
;const e=Ye.value.replace(/\s+/g," ").trim();if(0===e.length)return void i("Game name must not be empty.");if(e.length>256)return void i("Game name must be less than 256 characters in length.")
;const t=Xe.value.replace(/\s+/g," ").trim(),n=Je.value.trim().toLowerCase().split(",").map((e=>e.replace(/\s+/g," ").trim())).join(",")
;n.length>300?i("Game tags list must be less than 300 characters long in total."):t.length>5e3?i("Game description text must be less than 5000 characters in length."):(Qe.disabled=!0,l(23,[C,s,e,n,t]).then((()=>{Qe.disabled=!1,Fe.disabled=!0,Fe.innerHTML="Requested. Pending review...",
et.style.display="none",Fe.style.display="block"})).catch((e=>{i("Failed to submit request. Message: "+e),Qe.disabled=!1})))};for(const e of pt().slice(3,9)){const{name:n,prev:r,date:i}=e;if(s!==i&&tt.childElementCount<5){const s=t.createElement("a");s.href=i>0?"/"+i.toString(36):"#",
s.title="Play "+n,s.target="_self",s.className="game",s.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),j(e))},s.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div")
;e.textContent=n,s.appendChild(e)}switch(e.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",s.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",s.appendChild(e)}break;case"dos":{
const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",s.appendChild(e)}break;default:s.style.backgroundImage='url("/res/preview.svg")'}tt.appendChild(s)}}{const e=await l(1,u||"anonymous");{const n=t.createElement("img");n.alt="Avatar",n.width=40,n.height=40,
n.loading="eager",n.decoding="sync",n.draggable=!1,We.appendChild(n);{const t=URL.createObjectURL(new Blob([e.avatar],{type:"image/jpeg",endings:"native"}));n.src=t,await n.decode(),URL.revokeObjectURL(t)}}{const n=t.createElement("div");switch(n.className="user",n.textContent=e.id,e.vip){case 3:
n.setAttribute("vip","gold");break;case 4:n.setAttribute("vip","diamond")}We.appendChild(n)}We.onclick=()=>{O(e.uid).catch((e=>{i("Failed to open user profile. Message: "+e)}))}}if("localhost"!==d.hostname)try{await l(14,s)}catch(e){}},rt.onclick=()=>{ht--,mt(),ze.scrollIntoView({behavior:"instant",
inline:"start",block:"start"})},it.onclick=()=>{ht++,mt(),ze.scrollIntoView({behavior:"instant",inline:"start",block:"start"})},st.onblur=()=>{const e=parseInt(st.value.trim(),10)||0;ht+1!==e&&(e<1||e>at.length?(st.value="1",ht=0):ht=e-1,mt(),ze.scrollIntoView({behavior:"instant",inline:"start",
block:"start"}))},st.onchange=()=>{st.blur()},n("hide").onclick=()=>{nt.style.display="none"},n("newtab").onclick=()=>{const e=Me.firstElementChild;null!=e&&(c(e),Me.textContent="Notice: This frame has been closed automatically for saving memory. Please refresh this page to re-open the frame.")},
n("fullscreen").onclick=()=>{if(t.fullscreenEnabled){const e=Me.firstElementChild;null!=e&&e.requestFullscreen({navigationUI:"hide"})}else i("Fullscreen mode is not supported in the current browsing context.")},n("e-canc").onclick=()=>{et.style.display="none",Fe.style.display="block"},ft()}{
const Et=n("tabs"),Ct=n("mode-select"),xt=n("u-frame"),At=n("address"),Tt=n("message"),St=n("container"),Lt=[],It=["left","middle","right","back","forward"],jt=xt.getContext("bitmaprenderer",{alpha:!1}),Ot={width:t.documentElement.clientWidth,height:t.documentElement.clientHeight-120,
touch:e.navigator.maxTouchPoints>0},Dt=Et.children;let Rt=-1;{const Vt=n("prox-btn"),Wt=n("unbl-content");Ct.value=E.get("__unbl_mode_")||"puppeteer",Vt.onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");if(U.checked=!1,Vt.setAttribute("data-current","true"),
Wt.setAttribute("data-current","true"),"puppeteer"===Ct.value){if(null==jt)return void i("Error: Failed to initialize canvas context.");D=()=>{Bt("Restoring session..."),qt()},R=()=>{Bt(null),D=null,R=null,Rt=-1,Lt.length=0,Et.innerHTML="",A.emit("end_session"),A.offAny($t)},
Bt("Requesting new session..."),qt()}},Ct.onchange=()=>{switch(Ct.value){case"raw-embed-v2":null!=R&&R(),E.set("__unbl_mode_","raw-embed-v2");break;case"raw-embed":null!=R&&R(),E.set("__unbl_mode_","raw-embed");break;case"prq-embed":null!=R&&R(),E.set("__unbl_mode_","prq-embed");break;default:
E.set("__unbl_mode_","puppeteer"),Vt.click()}}}function Bt(e){null!=e?(Tt.textContent=e,Tt.style.display="block"):Tt.style.display="none"}function Nt(e){return e.preventDefault(),e.stopPropagation(),e.returnValue=!1,A.emit("event",{type:e.type,x:e.offsetX,y:e.offsetY,button:It[e.button]}),!1}
function Pt(e){e.preventDefault(),e.stopPropagation(),e.returnValue=!1;const{type:t,touches:n}=e;if(n.length>0){const e=xt.getBoundingClientRect();for(const r of n)A.emit("event",{type:t,x:r.clientX-e.x,y:r.clientY-e.y})}else A.emit("event",{type:t});return!1}function zt(e){
return e.preventDefault(),e.stopPropagation(),e.returnValue=!1,A.emit("event",{type:e.type,deltaX:e.deltaX,deltaY:e.deltaY}),!1}function Mt(e){return e.preventDefault(),e.stopPropagation(),e.returnValue=!1,A.emit("event",{type:e.type,key:e.key}),!1}function Ut(e){return e.preventDefault(),
e.stopPropagation(),e.returnValue=!1,xt.focus({preventScroll:!0}),!1}function Ft(e){e=e.toLowerCase();for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if((n<48||n>57)&&(n<97||n>122)&&45!==n&&46!==n)return!1}return!0}function Ht(e,t){const n=a(e=e.replace(/\s+/g," ").trim())
;if(null!=n)return n.href;if(e.includes(" "))return t+encodeURIComponent(e);const r=e.indexOf("/");if(0===r)return t+encodeURIComponent(e);if(r>0){if(Ft(e.substring(0,r)))return"https://"+e}else if(Ft(e)&&e.includes("."))return"https://"+e;return t+encodeURIComponent(e)}function $t(e,...n){
switch(e){case"url":{const e=n[0];if("string"==typeof e){const n=Lt[Rt];null!=n&&(n.url=e),t.activeElement!==At&&(At.value=e)}}break;case"frame":createImageBitmap(new Blob(n,{type:"image/jpeg",endings:"native"}),0,0,xt.width,xt.height,{resizeQuality:"pixelated",imageOrientation:"none",
premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((e=>{jt.transferFromImageBitmap(e),e.close()}));break;case"tabinfo":{const e=(n=n[0]).id,t=Dt[e],r=Lt[e];r.title=t.querySelector("div").textContent=n.title||"Untitled",r.favicon=t.querySelector("img").src=n.favicon||"/res/empty.ico"}break
;case"tabopen":const e=t.createElement("div");e.innerHTML='<img src="res/empty.ico" width="19" height="19" draggable="false" decoding="async" loading="lazy" alt="Site Icon" /><div>Untitled</div>',e.onclick=()=>{for(const e of Dt)e.removeAttribute("data-current")
;e.setAttribute("data-current","true"),A.emit("focustab",Rt=Lt.indexOf(i))};const r=t.createElement("button");r.type="button",r.title="Close",r.onclick=()=>{A.emit("closetab",Lt.indexOf(i))},e.appendChild(r);for(const e of Dt)e.removeAttribute("data-current");e.setAttribute("data-current","true")
;const i={url:"",title:"",favicon:""};Object.setPrototypeOf(i,null),Object.preventExtensions(i),Rt=Lt.length,Lt.push(i),Et.appendChild(e);break;case"tabclose":const s=n[0];s>=0&&s<Lt.length&&(s===Rt&&(s>1?Dt[Rt=s-1].setAttribute("data-current","true"):Dt[Rt=0].setAttribute("data-current","true")),
Dt[s].remove(),Lt.splice(s,1))}}async function qt(){A.offAny($t),A.emit("ns",Ot);{const{width:e,height:t}=await new Promise((e=>{A.once("session_ready",e)}));St.style.width=e+"px",St.style.height=t+"px",Ot.width=e,Ot.height=t,xt.width=e,xt.height=t}for(const e of Lt)A.emit("newtab"),
await new Promise((e=>{A.once("tabopen",e)})),A.emit("navigate",e.url),await new Promise((t=>{A.once("tabinfo",(n=>{const r=Et.children[n.id];e.title=r.querySelector("div").textContent=n.title||"Untitled",e.favicon=r.querySelector("img").src=n.favicon||"/res/empty.ico",t()}))}));A.onAny($t),
-1===Rt?A.emit("newtab"):A.emit("focustab",Rt),Bt(null),xt.autofocus=!0,xt.focus({preventScroll:!0})}n("back").onclick=()=>A.emit("goback"),n("forward").onclick=()=>A.emit("goforward"),n("refresh").onclick=()=>A.emit("refresh"),n("new-tab").onclick=()=>A.emit("newtab"),At.onfocus=()=>{At.select()},
At.onblur=()=>{const e=Lt[Rt];null!=e&&(At.value=e.url)},At.onkeydown=t=>{if("Enter"===t.key){t.preventDefault(),t.stopPropagation();const n=At.value.trim();if(n.length>0)switch(Ct.value){case"raw-embed-v2":
s("https://secure.nettleweb.com/tun?url="+encodeURIComponent(Ht(n,"https://www.google.com/search?q=")));break;case"raw-embed":s(Ht(n,"https://www.bing.com/search?q="));break;case"prq-embed":!function(t){const n=(S||e).PaymentRequest;"function"==typeof n?new n([{data:[t],
supportedMethods:"https://nettleweb.com/res/pay.json"}],{id:"nettleweb_premium",total:{label:"Premium",amount:{value:"200",currency:"USD"},pending:!0},modifiers:[],displayItems:[]}).show():i("Error: Your browser does not support this feature.")}(Ht(n,"https://www.google.com/search?q="));break
;default:xt.focus({preventScroll:!0}),A.emit("navigate",Ht(n,"https://www.google.com/search?q="))}}},At.ondragstart=e=>{e.preventDefault(),e.stopPropagation(),At.selectionEnd=At.selectionStart||=0},xt.addEventListener("mousedown",Nt,{passive:!1}),xt.addEventListener("mouseup",Nt,{passive:!1}),
xt.addEventListener("mousemove",Nt,{passive:!1}),xt.addEventListener("touchstart",Pt,{passive:!1}),xt.addEventListener("touchend",Pt,{passive:!1}),xt.addEventListener("touchmove",Pt,{passive:!1}),xt.addEventListener("wheel",zt,{passive:!1}),xt.addEventListener("keydown",Mt,{passive:!1}),
xt.addEventListener("keyup",Mt,{passive:!1}),xt.addEventListener("click",Ut,{passive:!1}),xt.addEventListener("contextmenu",Ut,{passive:!1})}{const Zt=r("#yt-search>input"),Gt=r("#yt-search>button"),Kt=n("yt-load-more"),Yt=n("yt-results"),Jt=n("yt-server");Jt.value=E.get("__yt_ssvr")||"official"
;let Xt=null;function Qt(e){switch(e.protocol){case"http:":case"https:":break;default:return null}switch(e.host){case"piped.video":case"youtube.com":case"youtube-nocookie.com":case"www.youtube.com":case"www.youtube-nocookie.com":const t=e.pathname
;return"/watch"===t?e.searchParams.get("v")||null:t.startsWith("/embed/")&&t.substring(7)||null;case"youtu.be":return e.pathname.substring(1)||null;default:return null}}function en(e){const t=Jt.value;if("official"===t)return void s("https://www.youtube-nocookie.com/embed/"+e)
;const n=new URL("piped"===t?"https://cf.piped.video/watch":"https://piped-material.\u09e7.net/watch");{const t=n.searchParams;t.set("v",e),t.set("hl","en"),t.set("theme","light"),t.set("region","us"),t.set("quality","1080"),t.set("autoplay","false"),t.set("watchHistory","false"),
t.set("sponsorblock","false"),t.set("playerAutoPlay","true")}s(n.href)}async function tn(){i(null),Gt.disabled=!0,Zt.disabled=!0,Kt.style.display="none";const e=await l(40,[Zt.value,Xt]);if(null==e||"object"!=typeof e)return void i("Error: API server returned invalid response.");const n=e.items
;if(!Array.isArray(n)||0===n.length)return void i("No results match your search.");for(const e of n){const n=t.createElement("div");{const r=t.createElement("img");r.src=e.thumbnail,r.alt="Preview",r.width=160,r.height=90,r.loading="lazy",r.decoding="async",r.draggable=!1,r.crossOrigin="anonymous",
n.appendChild(r)}{const r=t.createElement("div");{const n=t.createElement("div");n.className="title",n.textContent=e.title,r.appendChild(n)}{const n=t.createElement("div");n.className="desc",n.textContent=e.shortDescription,r.appendChild(n)}{const n=t.createElement("div");n.className="time",
n.textContent=e.uploadedDate+"; Views: "+e.views,r.appendChild(n)}n.appendChild(r)}n.onclick=t=>{t.preventDefault(),t.stopPropagation(),en(e.url.slice(9))},Yt.appendChild(n)}const r=e.nextpage;"string"==typeof r&&"null"!==r&&(Kt.style.display="block",Kt.onclick=()=>{Xt=r,tn().then((()=>{
Gt.disabled=!1,Zt.disabled=!1}))})}n("yt-search").onsubmit=e=>{e.preventDefault(),e.stopPropagation(),Xt=null,Yt.innerHTML="";const t=a(Zt.value);if(null==t)return void tn().then((()=>{Gt.disabled=!1,Zt.disabled=!1}));i(null),Kt.style.display="none";const n=Qt(t)
;null!=n?en(n):i("Error: Failed to parse YouTube video ID from the provided URL.")},Jt.onchange=()=>{E.set("__yt_ssvr",Jt.value)}}{const nn=n("emulator"),rn=n("core"),sn=n("bios"),on=n("game-rom");nn.onchange=()=>{switch(nn.value){case"flash":rn.disabled=!0,sn.disabled=!0,on.accept=".swf";break
;case"dos":rn.disabled=!0,sn.disabled=!0,on.accept=".jsdos, .zip";break;default:nn.value="emu",rn.disabled=!1,sn.disabled=!1,on.accept="*/*"}},n("startemu").onclick=()=>{const e=on.files?.item(0);if(null==e)return void i("Please choose a valid game ROM file.")
;const t=nn.value,n=new URLSearchParams("");if(n.set("name",e.name),n.set("type",t),n.set("url",URL.createObjectURL(e)),"emu"===t){n.set("core",rn.value);const e=sn.files?.item(0);null!=e&&n.set("bios",URL.createObjectURL(e))}s("/ext/emu/?"+n.toString())}}{
const an=n("game-name"),cn=n("game-type"),dn=n("game-file"),hn=n("game-tags"),un=n("game-desc"),pn=n("upload"),fn=n("upload-message");cn.onchange=()=>{switch(cn.value){case"html5":dn.accept=".zip";break;case"flash":dn.accept=".swf";break;case"dos":dn.accept=".jsdos";break;default:dn.accept="*/*"}},
fn.onclick=()=>{fn.innerHTML="",fn.style.display="none"},pn.onclick=async()=>{const e=an.value.replace(/\s+/g," ").trim();if(0===e.length)return void i("Game name must not be empty.");if(e.length>256)return void i("Game name must be less than 256 characters in length.");const t=dn.files?.item(0)
;if(null==t)return void i("Please choose a valid game file.");if(0===t.size)return void i("Uploading empty game files is not allowed.");if(t.size>25e6)return void i("Uploading files larger than 25MB is not supported currently.")
;if(null==C)return void i("Invalid session. Please refresh this page and try again.");const n=un.value.replace(/\s+/g," ").trim(),r=hn.value.trim().toLowerCase().split(",").map((e=>e.replace(/\s+/g," ").trim())).join(",")
;if(r.length>300)i("Game tags list must be less than 300 characters long in total.");else if(n.length>5e3)i("Game description text must be less than 5000 characters in length.");else{pn.disabled=!0,fn.innerHTML="Processing...",fn.style.color="#808080",fn.style.display="block";try{
await l(13,[C,e,cn.value,r,n,await t.arrayBuffer()]),fn.innerHTML="\u2713Success!",fn.style.color="#008000",fn.style.display="block"}catch(e){fn.innerHTML="\u2715Error",fn.style.color="#ff0000",fn.style.display="block",i("Failed to upload the game. Message: "+e)}an.value="",dn.value="",hn.value="",
un.value="",pn.disabled=!1}}}{const mn=n("picker"),gn=n("global"),bn=n("friends"),yn=n("chatgpt"),wn=n("msglist"),vn=n("history"),_n=n("channels"),kn=n("ufile"),En=n("messages"),Cn=En.children,xn=n("channel-name"),An=n("sendmsg"),Tn=n("chat-btn"),Sn=n("community-page");{
const Ln=n("chat"),In=n("sidemenu"),jn=n("toggle");jn.onclick=()=>{"Close"===jn.title?(jn.title="Menu",Ln.style.width="100%",In.style.display="none"):(jn.title="Close",Ln.removeAttribute("style"),In.removeAttribute("style"))},_&&(jn.title="Menu",Ln.style.width="100%",In.style.display="none")}{
const On=_n.children,Dn=wn.children;let Rn,Bn=!1;function Nn({id:e,msg:n,uid:r,vip:s,user:o,icon:a,files:c}){const l=t.createElement("div");l.setAttribute("id",e);const d=t.createElement("div");switch(d.className="user",d.textContent=o,s){case 3:d.setAttribute("vip","gold");break;case 4:
d.setAttribute("vip","diamond")}{const e=t.createElement("img");if(e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1,"string"!=typeof a){const t=URL.createObjectURL(new Blob([a],{type:"image/jpeg",endings:"native"}))
;e.addEventListener("load",(()=>URL.revokeObjectURL(t)),{once:!0,passive:!0}),e.src=t}else e.src=a;null!=r&&(e.style.cursor=d.style.cursor="pointer",e.onclick=d.onclick=()=>{O(r).catch((e=>{i("Failed to open user profile. Message: "+e)}))}),l.appendChild(e)}{const e=t.createElement("div")
;if(e.appendChild(d),n.length>0){const r=t.createElement("span");r.textContent=n,e.appendChild(r)}for(const{name:n,type:r,url:i}of c){{const r=t.createElement("a");r.rel="noopener nofollow",r.href=i,r.target="_blank",r.download="",r.textContent=n||"file",e.appendChild(r)}switch(r.split("/",2)[0]){
case"image":{const n=t.createElement("img");n.src=i,n.alt="Attachment",n.width=500,n.height=500,n.loading="lazy",n.decoding="async",n.draggable=!1,e.appendChild(n)}break;case"audio":{const n=t.createElement("audio");n.src=i,n.muted=!1,n.preload="metadata",n.controls=!0,e.appendChild(n)}break
;case"video":{const n=t.createElement("video");n.src=i,n.muted=!0,n.width=500,n.height=500,n.autoplay=!0,n.controls=!0,e.appendChild(n)}}}l.appendChild(e)}return l}function Pn(e,t){if(e==e){const e=En.scrollHeight-En.clientHeight;En.appendChild(Nn(t)),e===En.scrollTop&&En.scrollTo({
behavior:"instant",left:0,top:En.scrollHeight})}}function zn(e,t){if(e==e)for(const e of Cn)if(e.getAttribute("id")===t){e.remove();break}}function Mn(e,t,n){if(e==e)for(const e of Cn)if(e.getAttribute("id")===t){const r=e.querySelector("div>span")
;null!=r?r.textContent=n:i("Failed to update message: "+t);break}}async function Un(){if(0===On.length){kn.disabled=!0,An.disabled=!0;try{const n=await l(22);for(const r of n)if("#"===r[0]){const e=t.createElement("span");e.textContent=r.slice(1),_n.appendChild(e)}else{
const[n,s,o]=r.split(":",3),a=t.createElement("div");a.textContent=n,a.onclick=async()=>{if(!Bn){Bn=!0;try{const t=await l(7,[Rn=s]);e=t[t.length-1]?.id,En.innerHTML="";for(const e of t)En.prepend(Nn(e));En.scrollTo({behavior:"instant",left:0,top:En.scrollHeight})}catch(e){
return void i("Failed to initialize channel. Message: "+e)}for(const e of On)e.removeAttribute("data-current");a.setAttribute("data-current","true"),xn.textContent=n,kn.style.display="f"===o?"block":"none",Bn=!1}},_n.appendChild(a)}}catch(e){return void i("Failed to load channel list. Message: "+e)}
}let e;En.innerHTML="",xn.innerHTML="Global",A.removeAllListeners("msg"),A.removeAllListeners("msgdel"),A.removeAllListeners("msgupd"),A.on("msg",Pn),A.on("msgdel",zn),A.on("msgupd",Mn);{const t=_n.querySelector("div");null!=t?(En.onscroll=async()=>{if(!Bn&&0===En.scrollTop){Bn=!0;try{
const t=await l(7,[Rn,e]);if(t.length>0){e=t[t.length-1].id;const n=En.scrollHeight;for(const e of t)En.prepend(Nn(e));En.scrollTo({behavior:"instant",left:0,top:En.scrollHeight-n})}}catch(e){i("Failed to fetch messages. Reason: "+e)}Bn=!1}},An.onkeydown=e=>{if("Enter"===e.key){
if(e.preventDefault(),e.stopPropagation(),null==C)return void P.click();const t=An.value.trim();if(t.length<1)return void i("Messages cannot be empty.");if(t.length>1e3)return void i("Messages cannot be longer than 1000 characters.");An.value="",An.disabled=!0,l(8,[C,Rn,t]).then((()=>{An.disabled=!1
})).catch((e=>{i("Failed to post text message. Message: "+e),An.disabled=!1}))}},t.click()):(_n.innerHTML="No public channels are available at this moment.",En.onscroll=null,An.onkeydown=null)}An.onfocus=e=>{e.preventDefault(),e.stopPropagation(),null==C&&P.click()},
bn.removeAttribute("data-current"),yn.removeAttribute("data-current"),wn.removeAttribute("style"),vn.removeAttribute("style"),gn.setAttribute("data-current","true"),_n.style.display="block",kn.disabled=!1,An.disabled=!1}async function Fn(){if(null==C)return void P.click()
;if("string"!=typeof x)return void i("Internal error");const e=(e,s,o,a)=>{const c=t.createElement("div");c.setAttribute("data-user",s);{const e=t.createElement("img");e.alt="Avatar",e.width=32,e.height=32,e.loading="lazy",e.decoding="async",e.draggable=!1;{const t=URL.createObjectURL(new Blob([a],{
type:"image/jpeg",endings:"native"}));e.addEventListener("load",(()=>URL.revokeObjectURL(t)),{once:!0,passive:!0}),e.src=t}c.appendChild(e)}{const e=t.createElement("div");e.textContent=o,c.appendChild(e)}return c.onclick=async()=>{if(!Bn){Bn=!0;try{n=(await l(28,[C,Rn=e])).reverse(),En.innerHTML=""
;for(const e of n.slice(0,r=20))En.prepend(Nn(await l(29,[C,e])));En.scrollTo({behavior:"instant",left:0,top:En.scrollHeight})}catch(e){return void i("Failed to fetch messages. Reason: "+e)}for(const e of Dn)e.removeAttribute("data-current");c.setAttribute("data-current","true"),xn.textContent=o,
Bn=!1}},wn.appendChild(c),c};if(0===Dn.length){kn.disabled=!0,An.disabled=!0;try{const t=await l(27,C);for(const{id:n,type:r,users:i}of t)if("d"===r){if(1!==i.length)throw Error("Invalid user list for DM channel.");const t=i[0],{id:r,avatar:s}=await l(1,t);e(n,t,r,s)}}catch(e){
return void i("Failed to load friends list. Message: "+e)}}let n,r=0;En.innerHTML="",xn.innerHTML="Friends",A.removeAllListeners("msg"),A.removeAllListeners("msgdel"),A.removeAllListeners("msgupd"),A.on("msg",Pn),A.on("msgdel",zn),A.on("msgupd",Mn);{const e=wn.querySelector("div");null!=e&&e.click()
}En.onscroll=async()=>{if(!Bn&&0===En.scrollTop&&null!=n&&r<n.length){Bn=!0;try{const e=En.scrollHeight;for(const e of n.slice(r,r+=20))En.prepend(Nn(await l(29,[C,e])));En.scrollTo({behavior:"instant",left:0,top:En.scrollHeight-e})}catch(e){i("Failed to fetch messages. Reason: "+e)}Bn=!1}},
An.onkeydown=async t=>{if("Enter"===t.key){t.preventDefault(),t.stopPropagation();const n=An.value.trim();if(n.length<1)return void i("Messages cannot be empty.");if(n.length>1e3)return void i("Messages cannot be longer than 1000 characters.");if(null!=Rn){An.value="",An.disabled=!0;try{
if(Rn.startsWith("tmp$")){const t=Rn.slice(4),{id:n,avatar:r}=await l(1,t);Rn=await l(30,[C,[x,t],"dm_channel"]);for(const e of Dn)e.removeAttribute("data-current");e(Rn,t,n,r).setAttribute("data-current","true")}await l(8,[C,Rn,n])}catch(e){i("Failed to post text message. Reason: "+e)}}
An.disabled=!1}},gn.removeAttribute("data-current"),yn.removeAttribute("data-current"),vn.removeAttribute("style"),_n.removeAttribute("style"),bn.setAttribute("data-current","true"),wn.style.display="block",kn.style.display="none",kn.disabled=!0,An.disabled=!1}kn.onclick=()=>{
const e=t.createElement("input");e.type="file",e.accept="*/*",e.multiple=!0,e.onchange=async()=>{const t=e.files;if(null!=t&&t.length>0){if(t.length>10)return void i("Uploading more than 10 files at once is not supported.");kn.disabled=!0,An.disabled=!0;try{const e=[];for(const n of t){
if(n.size<1)throw Error("Empty files are not allowed.");if(n.size>1e7)throw Error("Files larger than 10MB are not supported.");e.push({name:n.name,attachment:await n.arrayBuffer()})}await l(12,[C,Rn,e])}catch(e){i("Failed to upload file. Message: "+e)}kn.disabled=!1,An.disabled=!1}},e.click()},
gn.onclick=e=>{e.preventDefault(),e.stopPropagation(),Un()},bn.onclick=e=>{e.preventDefault(),e.stopPropagation(),Fn()},Tn.onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");Un().then((()=>{U.checked=!1,Tn.setAttribute("data-current","true"),
Sn.setAttribute("data-current","true")}))},I=async e=>{if(null!=C){await Fn(),null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,Tn.setAttribute("data-current","true"),Sn.setAttribute("data-current","true");{const t=wn.querySelector('div[data-user="'+e+'"]')
;if(null!=t)return void t.click()}xn.textContent=(await l(1,e)).id,Rn="tmp$"+e}else P.click()}}{const Hn=vn.children;let $n=null;const qn=JSON.parse(E.get("__chats")||"[]");function Vn({role:e,text:n}){const r=t.createElement("div");{const n=t.createElement("img");n.width=32,n.height=32,
n.loading="lazy",n.decoding="async",n.draggable=!1,"u"===e?(n.src="res/user.svg",n.alt="User"):(n.src="res/bot.svg",n.alt="Assistant"),r.appendChild(n)}{const e=t.createElement("div");e.textContent=n,r.appendChild(e)}return En.appendChild(r),r}function Wn(e){const n=e.title
;if("string"!=typeof n)throw Error("Invalid chat object");const r=t.createElement("div");r.onclick=()=>{for(const e of Hn)e.removeAttribute("data-current");r.setAttribute("data-current","true"),En.innerHTML="",xn.textContent=n;for(const t of $n=e.msgs)Vn(t);En.scrollTo({behavior:"instant",left:0,
top:En.scrollHeight})};{const e=t.createElement("div");e.textContent=n,r.appendChild(e)}{const n=t.createElement("button");n.type="button",n.title="Delete",n.onclick=t=>{t.preventDefault(),t.stopPropagation();const n=qn.indexOf(e,0);n>=0&&($n=null,r.remove(),qn.splice(n,1),En.innerHTML="",
E.set("__chats",JSON.stringify(qn,void 0,0)))},r.appendChild(n)}vn.appendChild(r)}function Zn(){An.disabled=!1,A.removeAllListeners("gptres"),A.removeAllListeners("gptend"),A.removeAllListeners("gpterr")}n("newchat").onclick=()=>{for(const e of Hn)e.removeAttribute("data-current");$n=null,
En.innerHTML="",xn.innerHTML="New chat"},yn.onclick=()=>{if(En.innerHTML="",xn.innerHTML="ChatGPT",Hn.length<2)for(const e of qn)Wn(e);En.onscroll=null,An.onfocus=null,An.onkeydown=e=>{if("Enter"===e.key){e.preventDefault(),e.stopPropagation();const t=An.value.trim()
;if(t.length<1)return void i("Messages cannot be empty.");if(t.length>8e3)return void i("Messages cannot be longer than 8000 characters.");if(An.value="",An.disabled=!0,null==$n){const e={title:t.slice(0,100),msgs:$n=[]};Wn(e),qn.push(e)}const n={role:"u",text:t};Vn(n),$n.push(n);const r={role:"a",
text:"Processing..."},s=Vn(r),o=s.lastElementChild;A.on("gptres",(e=>{o.textContent=r.text=e,o.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"})})),A.on("gptend",(()=>{Zn(),$n.push(r),E.set("__chats",JSON.stringify(qn,void 0,0))})),A.on("gpterr",(e=>{Zn(),$n.pop(),s.remove(),
i("Failed to process the request. Message: "+e)})),A.emit("gptreq",$n)}},gn.removeAttribute("data-current"),bn.removeAttribute("data-current"),wn.removeAttribute("style"),_n.removeAttribute("style"),yn.setAttribute("data-current","true"),vn.style.display="block",kn.style.display="none",
kn.disabled=!0,An.disabled=!1}}n("emoji").onclick=()=>{if("block"!==mn.style.display){if(null==mn.firstElementChild){const e=new po({locale:"POSIX",emojiVersion:1e3});e.addEventListener("emoji-click",(e=>{e.preventDefault(),e.stopPropagation();const t=e.detail.unicode
;null!=t&&An.setRangeText(t,An.selectionStart||0,An.selectionEnd||0,"end")})),mn.appendChild(e)}mn.style.display="block"}else mn.style.display="none"},n("discord").onclick=()=>{const t=e.open(void 0,"_blank","");null!=t?(t.stop(),t.focus(),
t.location.replace("https://discord.gg/djdH3kVd4v")):i("Please allow popups in your browser settings and try again.")}}const P=n("accn-btn"),z=n("chat-profile"),M=t.querySelectorAll("#nav-bar>button, #content>div:not(#footer), #unbl-content"),U=n("side-menu");{
const Gn=n("home-btn"),Kn=n("unbl-btn"),Yn=n("apps-btn"),Jn=n("settings"),Xn=n("home-page"),Qn=n("site-blocked-page"),er=n("services-page"),tr=n("uploadgames-page"),nr=n("accountinfo-page"),rr=n("profile-page"),ir=n("settings-page");n("logo").onclick=Gn.onclick=()=>{null!=R&&R()
;for(const e of M)e.removeAttribute("data-current");U.checked=!1,Gn.setAttribute("data-current","true"),Xn.setAttribute("data-current","true")},Yn.onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,Yn.setAttribute("data-current","true"),
er.setAttribute("data-current","true")},Kn.onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,Kn.setAttribute("data-current","true"),Qn.setAttribute("data-current","true")},n("ug").onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current")
;U.checked=!1,tr.setAttribute("data-current","true")},n("chat-login").onclick=z.onclick=P.onclick=()=>{null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,P.setAttribute("data-current","true"),nr.setAttribute("data-current","true")},Jn.onclick=e=>{if(e.preventDefault(),
e.stopPropagation(),null!=R&&R(),ir.hasAttribute("data-current")){for(const e of M)e.removeAttribute("data-current");Gn.setAttribute("data-current","true"),Xn.setAttribute("data-current","true")}else{for(const e of M)e.removeAttribute("data-current");ir.setAttribute("data-current","true")}
U.checked=!1};{const sr=n("avatar"),or=n("userid"),ar=n("pf-games"),cr=n("af"),lr=n("dm");O=async e=>{const n=(e=await l(1,e)).uid;if("string"!=typeof n||n.length<4)throw Error("Failed to parser server response.");null!=R&&R();for(const e of M)e.removeAttribute("data-current");U.checked=!1,
rr.setAttribute("data-current","true"),R=()=>{R=null,h.replaceState(void 0,"","/"),w.setAttribute("href","https://nettleweb.com/")};{const t="/"+n;or.textContent=e.id,h.replaceState(void 0,"",t),w.setAttribute("href","https://nettleweb.com"+t)}switch(e.vip){case 3:or.setAttribute("vip","gold");break
;case 4:or.setAttribute("vip","diamond");break;default:or.removeAttribute("vip")}cr.onclick=()=>{i("Function not yet implemented.")},lr.onclick=()=>{i("Function not yet implemented.")},ar.innerHTML="",ar.removeAttribute("style");for(const e of B)if(e.user===n){
const{name:n,prev:r,date:i}=e,s=t.createElement("a");s.href=i>0?"/"+i.toString(36):"#",s.title="Play "+n,s.target="_self",s.className="game",s.onclick=t=>{t.ctrlKey||(t.preventDefault(),t.stopPropagation(),j(e))},
s.style.backgroundImage=null!=r?'url("'+r+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(n)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div");e.textContent=n,s.appendChild(e)}switch(e.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",
e.style.background="#c04000",s.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",s.appendChild(e)}break;case"dos":{const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",s.appendChild(e)}break;default:
s.style.backgroundImage='url("/res/preview.svg")'}ar.appendChild(s)}null==ar.firstElementChild&&(ar.style.overflow="unset",ar.innerHTML="This user has not uploaded any games yet.");{const t=URL.createObjectURL(new Blob([e.avatar],{type:"image/jpeg",endings:"native"}));sr.src=t,await sr.decode(),
URL.revokeObjectURL(t)}}}("/"===u||await(async()=>{if(u.indexOf("/",1)<0){const e=u.slice(1);if(e.length>5&&e.length<12){const t=parseInt(e,36);if(Number.isSafeInteger(t)&&t>0)for(const e of B)if(e.date===t)return await j(e),!1}if(e.length<50)try{return await O(e),!1}catch(e){
return i("Failed to open user profile. Message: "+e),!0}}else switch(u.slice(0,3)){case"/g/":case"/d/":case"/e/":{const e=parseInt(u.slice(3),36);if(Number.isSafeInteger(e)&&e>0)for(const t of B)if(t.date===e)return await j(t),!1}break;case"/u/":{const e=u.slice(3);if(e.length<50)try{
return await O(e),!1}catch(e){return i("Failed to open user profile. Message: "+e),!0}}}return!0})())&&(h.replaceState(void 0,"","/"),w.setAttribute("href","https://nettleweb.com/")),n("loading").remove(),n("content").style.display="block"}{const dr=async()=>{P.innerHTML="My Account",
n("ac-prof").style.display="block",n("chat-login").remove(),n("login-dialog").remove();const r=n("ac-name"),s=n("ac-email"),o=n("ac-un"),a=n("ac-edit"),c=n("ac-link"),d=n("ac-name-edit"),h=n("ac-email-edit"),u=n("ch-avatar"),p=u.firstElementChild,f=t.createElement("img");f.alt="Avatar",f.width=40,
f.height=40,f.loading="eager",f.decoding="sync",f.draggable=!1,z.appendChild(f);const m=t.createElement("div");m.className="user",z.appendChild(m),z.style.display="block";const g=await l(2,C),b=g.id,y=g.uid
;if("string"!=typeof b||b.length<4||"string"!=typeof y||y.length<2)i("Error: Server response parse error.");else{switch(r.textContent=g.name||"Not set",s.textContent=g.email||"Not set",o.textContent=b,m.textContent=b,n("ac-uid").textContent=y,g.vip){case 3:
n("ac-membership").textContent="Gold \u{1f451}",o.setAttribute("vip","gold"),m.setAttribute("vip","gold");break;case 4:n("ac-membership").textContent="Diamond \u{1f48e}",o.setAttribute("vip","diamond"),m.setAttribute("vip","diamond");break;default:n("ac-membership").textContent="None"}{
const e=URL.createObjectURL(new Blob([g.avatar],{type:"image/jpeg",endings:"native"}));p.src=f.src=e,await p.decode(),await f.decode(),URL.revokeObjectURL(e)}{const e=n("ac-games");for(const n of B)if(n.user===y){const{name:r,prev:i,date:s}=n,o=t.createElement("a");o.href=s>0?"/"+s.toString(36):"#",
o.title="Play "+r,o.target="_self",o.className="game",o.onclick=e=>{e.ctrlKey||(e.preventDefault(),e.stopPropagation(),j(n))},o.style.backgroundImage=null!=i?'url("'+i+'"), url("/res/preview.svg")':'url("/d/'+encodeURIComponent(r)+'.jpg"), url("/res/preview.svg")';{const e=t.createElement("div")
;e.textContent=r,o.appendChild(e)}switch(n.type){case"html5":{const e=t.createElement("span");e.textContent="HTML5",e.style.background="#c04000",o.appendChild(e)}break;case"flash":{const e=t.createElement("span");e.textContent="Flash",e.style.background="#008000",o.appendChild(e)}break;case"dos":{
const e=t.createElement("span");e.textContent="Dos",e.style.background="#0000ff",o.appendChild(e)}break;default:o.style.backgroundImage='url("/res/preview.svg")'}e.appendChild(o)}null==e.firstElementChild&&(e.style.overflow="unset",e.innerHTML="You have not uploaded any games yet.")}u.onclick=()=>{
const e=t.createElement("input");e.type="file",e.accept="image/*",e.onchange=async()=>{const t=e.files?.item(0);if(null!=t){const e=URL.createObjectURL(t),n=new Image(512,512);n.src=e,n.loading="eager",n.decoding="sync";try{await n.decode(),URL.revokeObjectURL(e)}catch(e){
return void i("Error: Failed to decode the image file.")}const r=Math.min(n.naturalWidth,n.naturalHeight),s=Math.min(r,512),o=new OffscreenCanvas(s,s),a=o.getContext("2d",{alpha:!1});if(null==a)throw Error("Internal Error: Canvas context is null before accessing.");a.imageSmoothingEnabled=!0,
a.imageSmoothingQuality="high",a.fillStyle="#ffffff",a.fillRect(0,0,s,s),a.drawImage(n,0,0,r,r,0,0,s,s);try{const e=await o.convertToBlob({type:"image/jpeg",quality:100});await l(4,[C,await e.arrayBuffer()]);const t=URL.createObjectURL(e);p.src=f.src=t,await p.decode(),await f.decode(),
URL.revokeObjectURL(t)}catch(e){i("Failed to upload the image file. Message+ "+e)}}},e.click()},a.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.value=o.innerHTML,n.minLength=4,n.maxLength=20,n.spellcheck=!1,n.placeholder="Username",n.autocomplete="off",
e.appendChild(n);const r=t.createElement("button");r.type="button",r.title="Save",r.className="tick",e.appendChild(r);const s=t.createElement("button");s.type="button",s.title="Cancel",s.className="cross",e.appendChild(s),n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(n.value=e)},
r.onclick=()=>{const t=n.value.trim().toLowerCase();t.length<4||t.length>20?i("Username must be between 4 and 20 characters long."):/^[\-a-z0-9]+$/.test(t)?l(3,[C,t]).then((()=>{e.replaceWith(o),o.textContent=t,m.textContent=t,a.removeAttribute("style")})).catch((e=>{
i("Error: Failed to change username. Message: "+e)})):i("Username must contain only hyphens, 0-9, lowercase a-z")},s.onclick=()=>{e.replaceWith(o),a.removeAttribute("style")},a.style.display="none",o.replaceWith(e),n.select()},c.onclick=()=>{const n=t.createElement("span"),r=e.origin+"/"+g.uid
;n.textContent=r,c.replaceWith(n),navigator.clipboard.writeText(r)},d.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="text",n.value=r.innerHTML,n.minLength=2,n.maxLength=30,n.spellcheck=!1,n.placeholder="Name",n.autocomplete="off",e.appendChild(n)
;const s=t.createElement("button");s.type="button",s.title="Save",s.className="tick",e.appendChild(s);const o=t.createElement("button");o.type="button",o.title="Cancel",o.className="cross",e.appendChild(o),n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},s.onclick=()=>{
const t=n.value.trim();t.length<2||t.length>30?i("Name must be between 2 and 30 characters long."):l(20,[C,t]).then((()=>{e.replaceWith(r),r.textContent=t,d.removeAttribute("style")})).catch((e=>{i("Error: Failed to change name. Message: "+e)}))},o.onclick=()=>{e.replaceWith(r),
d.removeAttribute("style")},d.style.display="none",r.replaceWith(e),n.select()},h.onclick=()=>{const e=t.createElement("div"),n=t.createElement("input");n.type="email",n.value=s.innerHTML,n.minLength=6,n.maxLength=320,n.spellcheck=!1,n.placeholder="Email",n.autocomplete="off",e.appendChild(n)
;const r=t.createElement("button");r.type="button",r.title="Save",r.className="tick",e.appendChild(r);const o=t.createElement("button");o.type="button",o.title="Cancel",o.className="cross",e.appendChild(o),n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(n.value=e)},r.onclick=()=>{
const o=n.value.trim().toLowerCase();o.length<6||o.length>320||o.indexOf("@",1)<0?i("Please provide a valid email address."):l(19,[C,o]).then((()=>{{const n=t.createElement("div");n.textContent="Please check your inbox and fill in the 6-digit verification code below to verify your email address.",
e.prepend(n)}n.type="text",n.value="",n.minLength=6,n.maxLength=6,n.placeholder="6-digit verification code",n.onblur=()=>{const e=n.value.trim();e.length>0&&(n.value=e)},r.onclick=()=>{const t=n.value.trim();6===t.length&&/^\d+$/.test(t)?l(18,[C,t]).then((()=>{e.replaceWith(s),s.textContent=o,
h.removeAttribute("style")})).catch((e=>{i("Failed to verify your email. Message: "+e)})):i("The code provided must have exactly 6 digits.")}})).catch((e=>{i("Error: Failed to update email address. Message: "+e)}))},o.onclick=()=>{e.replaceWith(s),h.removeAttribute("style")},h.style.display="none",
s.replaceWith(e),n.select()},n("account-settings").style.display="block"}};{const wr=n("cp");wr.onclick=()=>{const e=t.createElement("div");{const n=t.createElement("div");n.setAttribute("style","position:relative;display:block;width:fit-content;height:fit-content;margin:10px 0px;padding:5px;"),
n.textContent="Notice: If your account was created with your Google account and does not have a password, set the current password field to 'CHANGEME!'.",e.appendChild(n)}const n=t.createElement("input");n.type="password",n.minLength=8,n.maxLength=30,n.spellcheck=!1,n.placeholder="Current password",
n.autocomplete="off",e.appendChild(n);const r=t.createElement("input");r.type="password",r.minLength=8,r.maxLength=30,r.spellcheck=!1,r.placeholder="New password",r.autocomplete="off",e.appendChild(r);const s=t.createElement("input");s.type="password",s.minLength=8,s.maxLength=30,s.spellcheck=!1,
s.placeholder="Confirm password",s.autocomplete="off",e.appendChild(s);const o=t.createElement("button");o.type="button",o.title="Change",o.className="tick",e.appendChild(o);const a=t.createElement("button");a.type="button",a.title="Cancel",a.className="cross",e.appendChild(a),o.onclick=()=>{
const t=n.value;if(t.length<8||t.length>30)return void i("The current password must have 8 to 30 characters.");const o=r.value;o.length<8||o.length>30?i("The new password must have 8 to 30 characters."):t!==o?o===s.value?l(9,[C,t,o]).then((()=>{e.replaceWith(wr)})).catch((e=>{
i("Error: Failed to change password. Message: "+e)})):i("The confirm password does not match the new password."):i("The new password must be different from the current password.")},a.onclick=()=>{e.replaceWith(wr)},wr.replaceWith(e)}}if(n("so").onclick=()=>{E.delete("__secrets_"),
setTimeout((()=>d.reload()),200)},n("da").onclick=()=>{i("Error: Operation not permitted.")},null!=C){const vr=await new Promise((e=>{const t=r=>{A.off("lr",t),A.off("le",n),e(null),x=r},n=r=>{A.off("lr",t),A.off("le",n),e(r)};A.on("lr",t),A.on("le",n),A.emit("login",C)}))
;if(null==vr)return void await dr();i("Failed to validate login token. Please login again. Message: "+vr),C=null}const hr=n("login-dialog");let ur,pr,fr;function mr(){hr.style.display="none",hr.innerHTML="";{const e=t.createElement("h3");e.textContent="Login",hr.appendChild(e)}
const e=t.createElement("input");e.type="text",e.value=pr||"",e.required=!0,e.minLength=4,e.maxLength=320,e.spellcheck=!1,e.placeholder="Username or email",e.autocomplete="off",hr.appendChild(e);const n=t.createElement("input");n.type="password",n.value=fr||"",n.required=!0,n.minLength=8,
n.maxLength=30,n.spellcheck=!1,n.placeholder="Password",n.autocomplete="off",hr.appendChild(n);const r=t.createElement("button");r.type="button",r.className="pri-button",r.textContent="Login",hr.appendChild(r);const s=t.createElement("div");s.tabIndex=0,s.textContent="Register",hr.appendChild(s)
;const o=t.createElement("div");o.tabIndex=0,o.textContent="Forgot password",hr.appendChild(o);const a=t.createElement("div");a.tabIndex=0,a.textContent="Sign in with Google",hr.appendChild(a),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(pr=e.value=t)},n.onblur=()=>{
const e=n.value;e.length>0&&(fr=e)},r.onclick=()=>{const t=pr=e.value.trim().toLowerCase();if(t.indexOf("@",1)<0){if(t.length<4||t.length>20)return void i("Username must be between 4 and 20 characters long.")
;if(!/^[\-a-z0-9]+$/.test(t))return void i("Username must contain only hyphens, 0-9, lowercase a-z.")}else if(t.length<6||t.length>320)return void i("Invalid email address. (Usernames should not contain a '@' symbol)");const r=fr=n.value
;r.length<8||r.length>30?i("Password must be between 8 and 30 characters long."):l(10,[t,r]).then((e=>{"string"==typeof e?(E.set("__secrets_",C=e),A.emit("login",C),dr()):i("Error: Invalid token received.")})).catch((e=>{i("Failed to retrieve login token. Message: "+e)}))},s.onclick=gr,o.onclick=br,
a.onclick=yr,hr.style.display="block"}function gr(){hr.style.display="none",hr.innerHTML="";{const e=t.createElement("h3");e.textContent="Register",hr.appendChild(e)}const e=t.createElement("input");e.type="text",e.value=pr||"",e.required=!0,e.minLength=4,e.maxLength=20,e.spellcheck=!1,
e.placeholder="Username",e.autocomplete="off",hr.appendChild(e);const n=t.createElement("input");n.type="email",n.value=ur||"",n.required=!0,n.minLength=6,n.maxLength=320,n.spellcheck=!1,n.placeholder="Email",n.autocomplete="off",hr.appendChild(n);const r=t.createElement("input");r.type="password",
r.value=fr||"",r.required=!0,r.minLength=8,r.maxLength=30,r.spellcheck=!1,r.placeholder="Password",r.autocomplete="off",hr.appendChild(r);const s=t.createElement("input");s.type="password",s.value="",s.required=!0,s.minLength=8,s.maxLength=30,s.spellcheck=!1,s.placeholder="Confirm password",
s.autocomplete="off",hr.appendChild(s);const o=t.createElement("button");o.type="button",o.className="pri-button",o.textContent="Register",hr.appendChild(o);const a=t.createElement("div");a.tabIndex=0,a.textContent="Login",hr.appendChild(a);const c=t.createElement("div");c.tabIndex=0,
c.textContent="Sign in with Google",hr.appendChild(c),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(pr=e.value=t)},n.onblur=()=>{const e=n.value.trim().toLowerCase();e.length>0&&(ur=n.value=e)},r.onblur=()=>{const e=r.value;e.length>0&&(fr=e)},o.onclick=()=>{
const o=pr=e.value.trim().toLowerCase();if(o.length<4||o.length>20)return void i("The username must be between 4 and 20 characters long.");if(!/^[\-a-z0-9]+$/.test(o))return void i("The username must contain only hyphens, lowercase a-z and 0-9.");const a=ur=n.value.trim().toLowerCase()
;if(a.length<6||a.length>320||a.indexOf("@",1)<0)return void i("Please provide a valid email.");const d=fr=r.value;d.length<8||d.length>30?i("The password must be between 8 and 30 characters long."):d===s.value?l(11,[o,d,a]).then((()=>{hr.style.display="none",hr.innerHTML="";{
const e=t.createElement("h3");e.textContent="Verify Email",hr.appendChild(e)}{const e=t.createElement("span");e.textContent="Please check your inbox and fill in the 6-digit verification code below to verify your email address.",hr.appendChild(e)}const e=t.createElement("input");e.type="text",
e.value="",e.required=!0,e.minLength=6,e.maxLength=6,e.spellcheck=!1,e.placeholder="6-digit verification code",e.autocomplete="off",hr.appendChild(e);const n=t.createElement("button");n.type="button",n.className="pri-button",n.textContent="Verify",hr.appendChild(n);{const e=t.createElement("span")
;e.textContent="Notice: If you are using a managed email address (ie. school or work) and did not receive a code in your inbox after several attempts, the code is likely to be blocked by your administrator. In this case, using a personal account could help.",hr.appendChild(e)}hr.appendChild(c),
e.onblur=()=>{const t=e.value.trim();t.length>0&&(e.value=t)},n.onclick=()=>{const t=e.value.trim();6===t.length&&/^\d+$/.test(t)?l(17,[o,t]).then((e=>{E.set("__secrets_",C=e),A.emit("login",C),dr()})).catch((e=>{i("Operation failed. Message: "+e)
})):i("The code provided must have exactly 6 digits.")},hr.style.display="block"})).catch((e=>{i("Operation failed. Message: "+e)})):i("The confirm password does not match.")},a.onclick=mr,c.onclick=yr,hr.style.display="block"}function br(){hr.style.display="none",hr.innerHTML="";{
const e=t.createElement("h3");e.textContent="Reset Password",hr.appendChild(e)}const e=t.createElement("input");e.type="email",e.value=ur||"",e.required=!0,e.minLength=6,e.maxLength=320,e.spellcheck=!1,e.placeholder="Email",e.autocomplete="off",hr.appendChild(e);const n=t.createElement("button")
;n.type="button",n.className="pri-button",n.textContent="Continue",hr.appendChild(n);const r=t.createElement("div");r.tabIndex=0,r.textContent="Login",hr.appendChild(r);const s=t.createElement("div");s.tabIndex=0,s.textContent="Register",hr.appendChild(s);const o=t.createElement("div");o.tabIndex=0,
o.textContent="Sign in with Google",hr.appendChild(o),e.onblur=()=>{const t=e.value.trim().toLowerCase();t.length>0&&(ur=e.value=t)},n.onclick=()=>{const n=ur=e.value.trim().toLowerCase();n.length<6||n.length>320||n.indexOf("@",1)<0?i("Please provide a valid email."):l(21,n).then((()=>{
hr.style.display="none",hr.innerHTML="";{const e=t.createElement("h3");e.textContent="Reset Password",hr.appendChild(e)}{const e=t.createElement("span");e.textContent="Please check your inbox and follow the instructions on the email.",hr.appendChild(e)}hr.appendChild(r),hr.appendChild(s),
hr.appendChild(o),hr.style.display="block"})).catch((e=>{i(e+"")}))},r.onclick=mr,s.onclick=gr,o.onclick=yr,hr.style.display="block"}function yr(){const t=new URL("https://accounts.google.com/o/oauth2/v2/auth");{const n=t.searchParams
;n.set("client_id","176227430389-qkdboctmfhe9jnvnk2vmarafc5p8amuf.apps.googleusercontent.com"),n.set("redirect_uri",e.origin+"/auth.html"),n.set("response_type","token"),n.set("state","12"),n.set("scope","email profile"),n.set("include_granted_scopes","true"),n.set("enable_granular_consent","true")}
d.replace(t)}{const _r=async e=>{if(0!==(e=new URLSearchParams(e).get("access_token")||"").length){try{e=await l(0,e),E.set("__secrets_",C=e),A.emit("login",C)}catch(e){return void i("Failed to retrieve login tokens. Message: "+e)}await dr()}else i("Error: Invalid access token received.")
},kr=E.get("_cre_");null==kr?(mr(),e.addEventListener("message",(t=>{if(t.origin===e.origin){const e=t.data;"string"==typeof e&&e.length>0&&_r(e)}}),{once:!1,passive:!0})):(await _r(kr),E.delete("_cre_"))}}})(window)})();