@debales/ai 1.1.22 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/ai-browser.js +1 -1
- package/dist/module/ai.js +28 -7
- package/dist/module/ai.umd.js +1 -1
- package/package.json +2 -2
|
@@ -4930,4 +4930,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4930
4930
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
4931
4931
|
* derived from CryptoJS.mode.CTR
|
|
4932
4932
|
* Jan Hruby jhruby.web@gmail.com
|
|
4933
|
-
*/return n.mode.CTRGladman=function(){var r=n.lib.BlockCipherMode.extend();function o(f){if((f>>24&255)===255){var h=f>>16&255,p=f>>8&255,v=f&255;h===255?(h=0,p===255?(p=0,v===255?v=0:++v):++p):++h,f=0,f+=h<<16,f+=p<<8,f+=v}else f+=16777216;return f}function a(f){return(f[0]=o(f[0]))===0&&(f[1]=o(f[1])),f}var l=r.Encryptor=r.extend({processBlock:function(f,h){var p=this._cipher,v=p.blockSize,m=this._iv,x=this._counter;m&&(x=this._counter=m.slice(0),this._iv=void 0),a(x);var _=x.slice(0);p.encryptBlock(_,0);for(var w=0;w<v;w++)f[h+w]^=_[w]}});return r.Decryptor=l,r}(),n.mode.CTRGladman})}(Wk)),Wk.exports}var Xk={exports:{}},bge=Xk.exports,yP;function _ge(){return yP||(yP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(bge,function(n){return n.mode.OFB=function(){var r=n.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(a,l){var f=this._cipher,h=f.blockSize,p=this._iv,v=this._keystream;p&&(v=this._keystream=p.slice(0),this._iv=void 0),f.encryptBlock(v,0);for(var m=0;m<h;m++)a[l+m]^=v[m]}});return r.Decryptor=o,r}(),n.mode.OFB})}(Xk)),Xk.exports}var Jk={exports:{}},Sge=Jk.exports,xP;function wge(){return xP||(xP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Sge,function(n){return n.mode.ECB=function(){var r=n.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(o,a){this._cipher.encryptBlock(o,a)}}),r.Decryptor=r.extend({processBlock:function(o,a){this._cipher.decryptBlock(o,a)}}),r}(),n.mode.ECB})}(Jk)),Jk.exports}var eT={exports:{}},Cge=eT.exports,bP;function Ege(){return bP||(bP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Cge,function(n){return n.pad.AnsiX923={pad:function(r,o){var a=r.sigBytes,l=o*4,f=l-a%l,h=a+f-1;r.clamp(),r.words[h>>>2]|=f<<24-h%4*8,r.sigBytes+=f},unpad:function(r){var o=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=o}},n.pad.Ansix923})}(eT)),eT.exports}var tT={exports:{}},Age=tT.exports,_P;function kge(){return _P||(_P=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Age,function(n){return n.pad.Iso10126={pad:function(r,o){var a=o*4,l=a-r.sigBytes%a;r.concat(n.lib.WordArray.random(l-1)).concat(n.lib.WordArray.create([l<<24],1))},unpad:function(r){var o=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=o}},n.pad.Iso10126})}(tT)),tT.exports}var nT={exports:{}},Tge=nT.exports,SP;function Rge(){return SP||(SP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Tge,function(n){return n.pad.Iso97971={pad:function(r,o){r.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(r,o)},unpad:function(r){n.pad.ZeroPadding.unpad(r),r.sigBytes--}},n.pad.Iso97971})}(nT)),nT.exports}var rT={exports:{}},Oge=rT.exports,wP;function Dge(){return wP||(wP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Oge,function(n){return n.pad.ZeroPadding={pad:function(r,o){var a=o*4;r.clamp(),r.sigBytes+=a-(r.sigBytes%a||a)},unpad:function(r){for(var o=r.words,a=r.sigBytes-1,a=r.sigBytes-1;a>=0;a--)if(o[a>>>2]>>>24-a%4*8&255){r.sigBytes=a+1;break}}},n.pad.ZeroPadding})}(rT)),rT.exports}var iT={exports:{}},Mge=iT.exports,CP;function Ige(){return CP||(CP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Mge,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(iT)),iT.exports}var oT={exports:{}},$ge=oT.exports,EP;function Bge(){return EP||(EP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})($ge,function(n){return function(r){var o=n,a=o.lib,l=a.CipherParams,f=o.enc,h=f.Hex,p=o.format;p.Hex={stringify:function(v){return v.ciphertext.toString(h)},parse:function(v){var m=h.parse(v);return l.create({ciphertext:m})}}}(),n.format.Hex})}(oT)),oT.exports}var aT={exports:{}},Lge=aT.exports,AP;function Nge(){return AP||(AP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Lge,function(n){return function(){var r=n,o=r.lib,a=o.BlockCipher,l=r.algo,f=[],h=[],p=[],v=[],m=[],x=[],_=[],w=[],T=[],E=[];(function(){for(var O=[],M=0;M<256;M++)M<128?O[M]=M<<1:O[M]=M<<1^283;for(var L=0,z=0,M=0;M<256;M++){var P=z^z<<1^z<<2^z<<3^z<<4;P=P>>>8^P&255^99,f[L]=P,h[P]=L;var G=O[L],J=O[G],U=O[J],K=O[P]*257^P*16843008;p[L]=K<<24|K>>>8,v[L]=K<<16|K>>>16,m[L]=K<<8|K>>>24,x[L]=K;var K=U*16843009^J*65537^G*257^L*16843008;_[P]=K<<24|K>>>8,w[P]=K<<16|K>>>16,T[P]=K<<8|K>>>24,E[P]=K,L?(L=G^O[O[O[U^G]]],z^=O[O[z]]):L=z=1}})();var k=[0,1,2,4,8,16,32,64,128,27,54],R=l.AES=a.extend({_doReset:function(){var O;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var M=this._keyPriorReset=this._key,L=M.words,z=M.sigBytes/4,P=this._nRounds=z+6,G=(P+1)*4,J=this._keySchedule=[],U=0;U<G;U++)U<z?J[U]=L[U]:(O=J[U-1],U%z?z>6&&U%z==4&&(O=f[O>>>24]<<24|f[O>>>16&255]<<16|f[O>>>8&255]<<8|f[O&255]):(O=O<<8|O>>>24,O=f[O>>>24]<<24|f[O>>>16&255]<<16|f[O>>>8&255]<<8|f[O&255],O^=k[U/z|0]<<24),J[U]=J[U-z]^O);for(var K=this._invKeySchedule=[],ee=0;ee<G;ee++){var U=G-ee;if(ee%4)var O=J[U];else var O=J[U-4];ee<4||U<=4?K[ee]=O:K[ee]=_[f[O>>>24]]^w[f[O>>>16&255]]^T[f[O>>>8&255]]^E[f[O&255]]}}},encryptBlock:function(O,M){this._doCryptBlock(O,M,this._keySchedule,p,v,m,x,f)},decryptBlock:function(O,M){var L=O[M+1];O[M+1]=O[M+3],O[M+3]=L,this._doCryptBlock(O,M,this._invKeySchedule,_,w,T,E,h);var L=O[M+1];O[M+1]=O[M+3],O[M+3]=L},_doCryptBlock:function(O,M,L,z,P,G,J,U){for(var K=this._nRounds,ee=O[M]^L[0],W=O[M+1]^L[1],le=O[M+2]^L[2],ve=O[M+3]^L[3],ce=4,re=1;re<K;re++){var xe=z[ee>>>24]^P[W>>>16&255]^G[le>>>8&255]^J[ve&255]^L[ce++],ke=z[W>>>24]^P[le>>>16&255]^G[ve>>>8&255]^J[ee&255]^L[ce++],B=z[le>>>24]^P[ve>>>16&255]^G[ee>>>8&255]^J[W&255]^L[ce++],Y=z[ve>>>24]^P[ee>>>16&255]^G[W>>>8&255]^J[le&255]^L[ce++];ee=xe,W=ke,le=B,ve=Y}var xe=(U[ee>>>24]<<24|U[W>>>16&255]<<16|U[le>>>8&255]<<8|U[ve&255])^L[ce++],ke=(U[W>>>24]<<24|U[le>>>16&255]<<16|U[ve>>>8&255]<<8|U[ee&255])^L[ce++],B=(U[le>>>24]<<24|U[ve>>>16&255]<<16|U[ee>>>8&255]<<8|U[W&255])^L[ce++],Y=(U[ve>>>24]<<24|U[ee>>>16&255]<<16|U[W>>>8&255]<<8|U[le&255])^L[ce++];O[M]=xe,O[M+1]=ke,O[M+2]=B,O[M+3]=Y},keySize:256/32});r.AES=a._createHelper(R)}(),n.AES})}(aT)),aT.exports}var sT={exports:{}},zge=sT.exports,kP;function Uge(){return kP||(kP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(zge,function(n){return function(){var r=n,o=r.lib,a=o.WordArray,l=o.BlockCipher,f=r.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],v=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],m=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],x=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],_=f.DES=l.extend({_doReset:function(){for(var k=this._key,R=k.words,O=[],M=0;M<56;M++){var L=h[M]-1;O[M]=R[L>>>5]>>>31-L%32&1}for(var z=this._subKeys=[],P=0;P<16;P++){for(var G=z[P]=[],J=v[P],M=0;M<24;M++)G[M/6|0]|=O[(p[M]-1+J)%28]<<31-M%6,G[4+(M/6|0)]|=O[28+(p[M+24]-1+J)%28]<<31-M%6;G[0]=G[0]<<1|G[0]>>>31;for(var M=1;M<7;M++)G[M]=G[M]>>>(M-1)*4+3;G[7]=G[7]<<5|G[7]>>>27}for(var U=this._invSubKeys=[],M=0;M<16;M++)U[M]=z[15-M]},encryptBlock:function(k,R){this._doCryptBlock(k,R,this._subKeys)},decryptBlock:function(k,R){this._doCryptBlock(k,R,this._invSubKeys)},_doCryptBlock:function(k,R,O){this._lBlock=k[R],this._rBlock=k[R+1],w.call(this,4,252645135),w.call(this,16,65535),T.call(this,2,858993459),T.call(this,8,16711935),w.call(this,1,1431655765);for(var M=0;M<16;M++){for(var L=O[M],z=this._lBlock,P=this._rBlock,G=0,J=0;J<8;J++)G|=m[J][((P^L[J])&x[J])>>>0];this._lBlock=P,this._rBlock=z^G}var U=this._lBlock;this._lBlock=this._rBlock,this._rBlock=U,w.call(this,1,1431655765),T.call(this,8,16711935),T.call(this,2,858993459),w.call(this,16,65535),w.call(this,4,252645135),k[R]=this._lBlock,k[R+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function w(k,R){var O=(this._lBlock>>>k^this._rBlock)&R;this._rBlock^=O,this._lBlock^=O<<k}function T(k,R){var O=(this._rBlock>>>k^this._lBlock)&R;this._lBlock^=O,this._rBlock^=O<<k}r.DES=l._createHelper(_);var E=f.TripleDES=l.extend({_doReset:function(){var k=this._key,R=k.words;if(R.length!==2&&R.length!==4&&R.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var O=R.slice(0,2),M=R.length<4?R.slice(0,2):R.slice(2,4),L=R.length<6?R.slice(0,2):R.slice(4,6);this._des1=_.createEncryptor(a.create(O)),this._des2=_.createEncryptor(a.create(M)),this._des3=_.createEncryptor(a.create(L))},encryptBlock:function(k,R){this._des1.encryptBlock(k,R),this._des2.decryptBlock(k,R),this._des3.encryptBlock(k,R)},decryptBlock:function(k,R){this._des3.decryptBlock(k,R),this._des2.encryptBlock(k,R),this._des1.decryptBlock(k,R)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=l._createHelper(E)}(),n.TripleDES})}(sT)),sT.exports}var lT={exports:{}},Fge=lT.exports,TP;function jge(){return TP||(TP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Fge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=l.RC4=a.extend({_doReset:function(){for(var v=this._key,m=v.words,x=v.sigBytes,_=this._S=[],w=0;w<256;w++)_[w]=w;for(var w=0,T=0;w<256;w++){var E=w%x,k=m[E>>>2]>>>24-E%4*8&255;T=(T+_[w]+k)%256;var R=_[w];_[w]=_[T],_[T]=R}this._i=this._j=0},_doProcessBlock:function(v,m){v[m]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var v=this._S,m=this._i,x=this._j,_=0,w=0;w<4;w++){m=(m+1)%256,x=(x+v[m])%256;var T=v[m];v[m]=v[x],v[x]=T,_|=v[(v[m]+v[x])%256]<<24-w*8}return this._i=m,this._j=x,_}r.RC4=a._createHelper(f);var p=l.RC4Drop=f.extend({cfg:f.cfg.extend({drop:192}),_doReset:function(){f._doReset.call(this);for(var v=this.cfg.drop;v>0;v--)h.call(this)}});r.RC4Drop=a._createHelper(p)}(),n.RC4})}(lT)),lT.exports}var uT={exports:{}},Hge=uT.exports,RP;function Pge(){return RP||(RP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Hge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=[],h=[],p=[],v=l.Rabbit=a.extend({_doReset:function(){for(var x=this._key.words,_=this.cfg.iv,w=0;w<4;w++)x[w]=(x[w]<<8|x[w]>>>24)&16711935|(x[w]<<24|x[w]>>>8)&4278255360;var T=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],E=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var w=0;w<4;w++)m.call(this);for(var w=0;w<8;w++)E[w]^=T[w+4&7];if(_){var k=_.words,R=k[0],O=k[1],M=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,L=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,z=M>>>16|L&4294901760,P=L<<16|M&65535;E[0]^=M,E[1]^=z,E[2]^=L,E[3]^=P,E[4]^=M,E[5]^=z,E[6]^=L,E[7]^=P;for(var w=0;w<4;w++)m.call(this)}},_doProcessBlock:function(x,_){var w=this._X;m.call(this),f[0]=w[0]^w[5]>>>16^w[3]<<16,f[1]=w[2]^w[7]>>>16^w[5]<<16,f[2]=w[4]^w[1]>>>16^w[7]<<16,f[3]=w[6]^w[3]>>>16^w[1]<<16;for(var T=0;T<4;T++)f[T]=(f[T]<<8|f[T]>>>24)&16711935|(f[T]<<24|f[T]>>>8)&4278255360,x[_+T]^=f[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,_=this._C,w=0;w<8;w++)h[w]=_[w];_[0]=_[0]+1295307597+this._b|0,_[1]=_[1]+3545052371+(_[0]>>>0<h[0]>>>0?1:0)|0,_[2]=_[2]+886263092+(_[1]>>>0<h[1]>>>0?1:0)|0,_[3]=_[3]+1295307597+(_[2]>>>0<h[2]>>>0?1:0)|0,_[4]=_[4]+3545052371+(_[3]>>>0<h[3]>>>0?1:0)|0,_[5]=_[5]+886263092+(_[4]>>>0<h[4]>>>0?1:0)|0,_[6]=_[6]+1295307597+(_[5]>>>0<h[5]>>>0?1:0)|0,_[7]=_[7]+3545052371+(_[6]>>>0<h[6]>>>0?1:0)|0,this._b=_[7]>>>0<h[7]>>>0?1:0;for(var w=0;w<8;w++){var T=x[w]+_[w],E=T&65535,k=T>>>16,R=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[w]=R^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.Rabbit=a._createHelper(v)}(),n.Rabbit})}(uT)),uT.exports}var cT={exports:{}},qge=cT.exports,OP;function Gge(){return OP||(OP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(qge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=[],h=[],p=[],v=l.RabbitLegacy=a.extend({_doReset:function(){var x=this._key.words,_=this.cfg.iv,w=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],T=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var E=0;E<4;E++)m.call(this);for(var E=0;E<8;E++)T[E]^=w[E+4&7];if(_){var k=_.words,R=k[0],O=k[1],M=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,L=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,z=M>>>16|L&4294901760,P=L<<16|M&65535;T[0]^=M,T[1]^=z,T[2]^=L,T[3]^=P,T[4]^=M,T[5]^=z,T[6]^=L,T[7]^=P;for(var E=0;E<4;E++)m.call(this)}},_doProcessBlock:function(x,_){var w=this._X;m.call(this),f[0]=w[0]^w[5]>>>16^w[3]<<16,f[1]=w[2]^w[7]>>>16^w[5]<<16,f[2]=w[4]^w[1]>>>16^w[7]<<16,f[3]=w[6]^w[3]>>>16^w[1]<<16;for(var T=0;T<4;T++)f[T]=(f[T]<<8|f[T]>>>24)&16711935|(f[T]<<24|f[T]>>>8)&4278255360,x[_+T]^=f[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,_=this._C,w=0;w<8;w++)h[w]=_[w];_[0]=_[0]+1295307597+this._b|0,_[1]=_[1]+3545052371+(_[0]>>>0<h[0]>>>0?1:0)|0,_[2]=_[2]+886263092+(_[1]>>>0<h[1]>>>0?1:0)|0,_[3]=_[3]+1295307597+(_[2]>>>0<h[2]>>>0?1:0)|0,_[4]=_[4]+3545052371+(_[3]>>>0<h[3]>>>0?1:0)|0,_[5]=_[5]+886263092+(_[4]>>>0<h[4]>>>0?1:0)|0,_[6]=_[6]+1295307597+(_[5]>>>0<h[5]>>>0?1:0)|0,_[7]=_[7]+3545052371+(_[6]>>>0<h[6]>>>0?1:0)|0,this._b=_[7]>>>0<h[7]>>>0?1:0;for(var w=0;w<8;w++){var T=x[w]+_[w],E=T&65535,k=T>>>16,R=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[w]=R^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.RabbitLegacy=a._createHelper(v)}(),n.RabbitLegacy})}(cT)),cT.exports}var fT={exports:{}},Vge=fT.exports,DP;function Yge(){return DP||(DP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Vge,function(n){return function(){var r=n,o=r.lib,a=o.BlockCipher,l=r.algo;const f=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],p=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var v={pbox:[],sbox:[]};function m(E,k){let R=k>>24&255,O=k>>16&255,M=k>>8&255,L=k&255,z=E.sbox[0][R]+E.sbox[1][O];return z=z^E.sbox[2][M],z=z+E.sbox[3][L],z}function x(E,k,R){let O=k,M=R,L;for(let z=0;z<f;++z)O=O^E.pbox[z],M=m(E,O)^M,L=O,O=M,M=L;return L=O,O=M,M=L,M=M^E.pbox[f],O=O^E.pbox[f+1],{left:O,right:M}}function _(E,k,R){let O=k,M=R,L;for(let z=f+1;z>1;--z)O=O^E.pbox[z],M=m(E,O)^M,L=O,O=M,M=L;return L=O,O=M,M=L,M=M^E.pbox[1],O=O^E.pbox[0],{left:O,right:M}}function w(E,k,R){for(let P=0;P<4;P++){E.sbox[P]=[];for(let G=0;G<256;G++)E.sbox[P][G]=p[P][G]}let O=0;for(let P=0;P<f+2;P++)E.pbox[P]=h[P]^k[O],O++,O>=R&&(O=0);let M=0,L=0,z=0;for(let P=0;P<f+2;P+=2)z=x(E,M,L),M=z.left,L=z.right,E.pbox[P]=M,E.pbox[P+1]=L;for(let P=0;P<4;P++)for(let G=0;G<256;G+=2)z=x(E,M,L),M=z.left,L=z.right,E.sbox[P][G]=M,E.sbox[P][G+1]=L;return!0}var T=l.Blowfish=a.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var E=this._keyPriorReset=this._key,k=E.words,R=E.sigBytes/4;w(v,k,R)}},encryptBlock:function(E,k){var R=x(v,E[k],E[k+1]);E[k]=R.left,E[k+1]=R.right},decryptBlock:function(E,k){var R=_(v,E[k],E[k+1]);E[k]=R.left,E[k+1]=R.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=a._createHelper(T)}(),n.Blowfish})}(fT)),fT.exports}var Zge=Rk.exports,MP;function Qge(){return MP||(MP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Mk(),G0e(),Y0e(),Np(),K0e(),zp(),rP(),k8(),tge(),sP(),ige(),age(),lge(),T8(),fge(),Fd(),Eo(),gge(),vge(),xge(),_ge(),wge(),Ege(),kge(),Rge(),Dge(),Ige(),Bge(),Nge(),Uge(),jge(),Pge(),Gge(),Yge())})(Zge,function(n){return n})}(Rk)),Rk.exports}var Kge=Qge();const Wge=$u(Kge);class Xge extends Tk{constructor(){super(...arguments);Pi(this,"platform",Ki.THE_COLLECTIVE);Pi(this,"apiBaseURL","https://testapi.thecollective.in/")}getCookie(n){var a;const o=`; ${document.cookie}`.split(`; ${n}=`);return o.length===2&&((a=o.pop())==null?void 0:a.split(";").shift())||null}generateHash(n){const r=JSON.parse(JSON.stringify(n));return delete r.hash,Wge.MD5(JSON.stringify(r)).toString()}async fetchCart(){try{const n={storeId:0,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),page:"cartSummary",device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},r=this.generateHash(n),o={...n,hash:r,validateHash:!0},a=await fetch(`${this.apiBaseURL}cart/getCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(o)});if(!a.ok)return this.createErrorResult(`Failed to fetch cart: ${a.status}`);const l=await a.json();return this.createSuccessResult({items:l.items||[],total:l.total||0,itemCount:l.itemCount||0,currency:l.currency||"INR",token:l.token||""})}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}async addToCart(n,r=1,o){try{const a=n,l=o!=null&&o.size?parseInt(o.size):0,f=new URLSearchParams;f.append("dbls_order_source","direct_recommendation"),f.append("dbls_session_id",er()),f.append("dbls_method","add_to_cart"),f.append("utm_source","debales_chatbot");const h={productId:a,productAttributeId:0,size:l,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),version:1.2,buyNow:0,quantity:r,oldAttributeId:0,wishlistDeleteFlag:0,cartOperation:"add",storeId:0,utmSource:f.toString(),sliderSource:"",page:"cartSummary",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},p=this.generateHash(h),v={...h,hash:p,validateHash:!0},m=await fetch(`${this.apiBaseURL}cart/addToCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(v)});return m.ok?this.createSuccessResult(void 0,"Item added to cart successfully"):this.createErrorResult(`Failed to add item to cart: ${m.status}`)}catch(a){return this.createErrorResult(a instanceof Error?a.message:"Unknown error")}}async removeFromCart(n){try{const r={customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),productId:n,storeId:0,productAttributeId:0,device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},o=this.generateHash(r),a={...r,hash:o,validateHash:!0},l=await fetch(`${this.apiBaseURL}cart/deleteCartProduct`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(a)});return l.ok?this.createSuccessResult(void 0,"Item removed from cart successfully"):this.createErrorResult(`Failed to remove item from cart: ${l.status}`)}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async updateQuantity(n){try{return console.log("TheCollectiveCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async clearCart(){try{return console.log("TheCollectiveCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}generateCartUrl(n){const r=U0e(n);if(!r.isValid)return"";const o=new URL("/checkoutsummary",r.url);return o.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),o.searchParams.append("attributes[from]","debales-ai-chatbot"),o.searchParams.append("attributes[through]","add-to-cart"),o.searchParams.append("attributes[dbls_session_id]",er()),o.searchParams.append("timestamp",Date.now().toString()),uf(o.toString())}generateProductUrl(n,r){const o=new URL(r.link);return o.host=n,uf(o.toString())}async addCartAttributes(n={}){try{return console.log("TheCollectiveCartAdapter: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}}const Up=class Up{constructor(){Pi(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Up.instance||(Up.instance=new Up),Up.instance}getAdapter(t){const n=t||zd.detect(),r=this.adapterCache.get(n);if(r)return r;let o;switch(n){case Ki.SHOPIFY:o=new B0e;break;case Ki.MAGENTO:o=new L0e;break;case Ki.THE_COLLECTIVE:o=new Xge;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),o=new $0e}return this.adapterCache.set(n,o),o}clearCache(){this.adapterCache.clear()}};Pi(Up,"instance");let R8=Up;const Jge=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,o]=Z.useState(!1),[a,l]=Z.useState(null),[f,h]=Z.useState(null),p=Z.useCallback(async()=>{try{o(!0),l(null);const R=await e.fetchCart();R.success?h(R.data):l(R.error)}catch(R){l(R instanceof Error?R.message:"Failed to fetch cart")}finally{o(!1)}},[e]),v=async(R,O,M)=>{try{l(null);const L=await e.addToCart(R,O,M);return L.success&&await p(),L}catch(L){return{success:!1,error:L instanceof Error?L.message:"Failed to add item to cart"}}},m=async R=>{try{l(null);const O=await e.removeFromCart(R);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to remove item from cart"}}},x=async R=>{try{l(null);const O=await e.updateQuantity(R);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to update quantity"}}},_=async()=>{try{l(null);const R=await e.clearCart();return R.success&&await p(),R}catch(R){return{success:!1,error:R instanceof Error?R.message:"Failed to clear cart"}}},w=R=>e.generateCartUrl(R),T=(R,O)=>e.generateProductUrl(R,O),E=async R=>e.addCartAttributes(R);Z.useEffect(()=>{n&&p()},[n,p]);const k={isLoading:r,error:a,cart:f,fetchCart:p,addToCart:v,removeFromCart:m,updateQuantity:x,clearCart:_,generateCartUrl:w,generateProductUrl:T,addCartAttributes:E};return I.jsx(Bz.Provider,{value:k,children:t})},Qu=Object.create(null);Qu.open="0",Qu.close="1",Qu.ping="2",Qu.pong="3",Qu.message="4",Qu.upgrade="5",Qu.noop="6";const dT=Object.create(null);Object.keys(Qu).forEach(e=>{dT[Qu[e]]=e});const O8={type:"error",data:"parser error"},IP=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",$P=typeof ArrayBuffer=="function",BP=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,D8=({type:e,data:t},n,r)=>IP&&t instanceof Blob?n?r(t):LP(t,r):$P&&(t instanceof ArrayBuffer||BP(t))?n?r(t):LP(new Blob([t]),r):r(Qu[e]+(t||"")),LP=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function NP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let M8;function eme(e,t){if(IP&&e.data instanceof Blob)return e.data.arrayBuffer().then(NP).then(t);if($P&&(e.data instanceof ArrayBuffer||BP(e.data)))return t(NP(e.data));D8(e,!1,n=>{M8||(M8=new TextEncoder),t(M8.encode(n))})}const zP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zx=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<zP.length;e++)zx[zP.charCodeAt(e)]=e;const tme=e=>{let t=e.length*.75,n=e.length,r,o=0,a,l,f,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),v=new Uint8Array(p);for(r=0;r<n;r+=4)a=zx[e.charCodeAt(r)],l=zx[e.charCodeAt(r+1)],f=zx[e.charCodeAt(r+2)],h=zx[e.charCodeAt(r+3)],v[o++]=a<<2|l>>4,v[o++]=(l&15)<<4|f>>2,v[o++]=(f&3)<<6|h&63;return p},nme=typeof ArrayBuffer=="function",I8=(e,t)=>{if(typeof e!="string")return{type:"message",data:UP(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:rme(e.substring(1),t)}:dT[n]?e.length>1?{type:dT[n],data:e.substring(1)}:{type:dT[n]}:O8},rme=(e,t)=>{if(nme){const n=tme(e);return UP(n,t)}else return{base64:!0,data:e}},UP=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},FP="",ime=(e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach((a,l)=>{D8(a,!1,f=>{r[l]=f,++o===n&&t(r.join(FP))})})},ome=(e,t)=>{const n=e.split(FP),r=[];for(let o=0;o<n.length;o++){const a=I8(n[o],t);if(r.push(a),a.type==="error")break}return r};function ame(){return new TransformStream({transform(e,t){eme(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const a=new DataView(o.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{o=new Uint8Array(9);const a=new DataView(o.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let $8;function hT(e){return e.reduce((t,n)=>t+n.length,0)}function pT(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=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 sme(e,t){$8||($8=new TextDecoder);const n=[];let r=0,o=-1,a=!1;return new TransformStream({transform(l,f){for(n.push(l);;){if(r===0){if(hT(n)<1)break;const h=pT(n,1);a=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(hT(n)<2)break;const h=pT(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(hT(n)<8)break;const h=pT(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),v=p.getUint32(0);if(v>Math.pow(2,21)-1){f.enqueue(O8);break}o=v*Math.pow(2,32)+p.getUint32(4),r=3}else{if(hT(n)<o)break;const h=pT(n,o);f.enqueue(I8(a?h:$8.decode(h),t)),r=0}if(o===0||o>e){f.enqueue(O8);break}}}})}const jP=4;function Wi(e){if(e)return lme(e)}function lme(e){for(var t in Wi.prototype)e[t]=Wi.prototype[t];return e}Wi.prototype.on=Wi.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Wi.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Wi.prototype.off=Wi.prototype.removeListener=Wi.prototype.removeAllListeners=Wi.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===t||r.fn===t){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Wi.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,t)}return this},Wi.prototype.emitReserved=Wi.prototype.emit,Wi.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Wi.prototype.hasListeners=function(e){return!!this.listeners(e).length};const gT=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),dl=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),ume="arraybuffer";function yye(){}function HP(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const cme=dl.setTimeout,fme=dl.clearTimeout;function mT(e,t){t.useNativeTimers?(e.setTimeoutFn=cme.bind(dl),e.clearTimeoutFn=fme.bind(dl)):(e.setTimeoutFn=dl.setTimeout.bind(dl),e.clearTimeoutFn=dl.clearTimeout.bind(dl))}const dme=1.33;function hme(e){return typeof e=="string"?pme(e):Math.ceil((e.byteLength||e.size)*dme)}function pme(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function PP(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function gme(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function mme(e){let t={},n=e.split("&");for(let r=0,o=n.length;r<o;r++){let a=n[r].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class vme extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class B8 extends Wi{constructor(t){super(),this.writable=!1,mT(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new vme(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=I8(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=gme(t);return n.length?"?"+n:""}}class yme extends B8{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};ome(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,ime(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PP()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let qP=!1;try{qP=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xme=qP;function bme(){}class _me extends yme{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(o,a)=>{this.onError("xhr post error",o,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Ku extends Wi{constructor(t,n,r){super(),this.createRequest=t,mT(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=HP(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ku.requestsCount++,Ku.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bme,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ku.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Ku.requestsCount=0,Ku.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",GP);else if(typeof addEventListener=="function"){const e="onpagehide"in dl?"pagehide":"unload";addEventListener(e,GP,!1)}}function GP(){for(let e in Ku.requests)Ku.requests.hasOwnProperty(e)&&Ku.requests[e].abort()}const Sme=function(){const e=VP({xdomain:!1});return e&&e.responseType!==null}();class wme extends _me{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Sme&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Ku(VP,this.uri(),t)}}function VP(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||xme))return new XMLHttpRequest}catch{}if(!t)try{return new dl[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const YP=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Cme extends B8{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=YP?{}:HP(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],o=n===t.length-1;D8(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}o&&gT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PP()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const L8=dl.WebSocket||dl.MozWebSocket;class Eme extends Cme{createSocket(t,n,r){return YP?new L8(t,n,r):n?new L8(t,n):new L8(t)}doWrite(t,n){this.ws.send(n)}}class Ame extends B8{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=sme(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),o=ame();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const a=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),a())}).catch(f=>{})};a();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this._writer.write(l).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],o=n===t.length-1;this._writer.write(r).then(()=>{o&&gT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const kme={websocket:Eme,webtransport:Ame,polling:wme},Tme=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Rme=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function N8(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=Tme.exec(e||""),a={},l=14;for(;l--;)a[Rme[l]]=o[l]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=Ome(a,a.path),a.queryKey=Dme(a,a.query),a}function Ome(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Dme(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,a){o&&(n[o]=a)}),n}const z8=typeof addEventListener=="function"&&typeof removeEventListener=="function",vT=[];z8&&addEventListener("offline",()=>{vT.forEach(e=>e())},!1);class jd extends Wi{constructor(t,n){if(super(),this.binaryType=ume,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=N8(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=N8(n.host).host);mT(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=r}),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},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mme(this.opts.query)),z8&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},vT.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=jP,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jd.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jd.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=hme(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,gT(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(jd.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),z8&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=vT.indexOf(this._offlineEventListener);r!==-1&&vT.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}jd.protocol=jP;class Mme extends jd{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;jd.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jd.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(v(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function a(){r||(r=!0,v(),n.close(),n=null)}const l=m=>{const x=new Error("probe error: "+m);x.transport=n.name,a(),this.emitReserved("upgradeError",x)};function f(){l("transport closed")}function h(){l("socket closed")}function p(m){n&&m.name!==n.name&&a()}const v=()=>{n.removeListener("open",o),n.removeListener("error",l),n.removeListener("close",f),this.off("close",h),this.off("upgrading",p)};n.once("open",o),n.once("error",l),n.once("close",f),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Ime=class extends Mme{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>kme[o]).filter(o=>!!o)),super(t,r)}};function $me(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=N8(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 a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const Bme=typeof ArrayBuffer=="function",Lme=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ZP=Object.prototype.toString,Nme=typeof Blob=="function"||typeof Blob<"u"&&ZP.call(Blob)==="[object BlobConstructor]",zme=typeof File=="function"||typeof File<"u"&&ZP.call(File)==="[object FileConstructor]";function U8(e){return Bme&&(e instanceof ArrayBuffer||Lme(e))||Nme&&e instanceof Blob||zme&&e instanceof File}function yT(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(yT(e[n]))return!0;return!1}if(U8(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return yT(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&yT(e[n]))return!0;return!1}function Ume(e){const t=[],n=e.data,r=e;return r.data=F8(n,t),r.attachments=t.length,{packet:r,buffers:t}}function F8(e,t){if(!e)return e;if(U8(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=F8(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=F8(e[r],t));return n}return e}function Fme(e,t){return e.data=j8(e.data,t),delete e.attachments,e}function j8(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=j8(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=j8(e[n],t));return e}const jme=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Hme=5;var Wn;(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"})(Wn||(Wn={}));class Pme{constructor(t){this.replacer=t}encode(t){return(t.type===Wn.EVENT||t.type===Wn.ACK)&&yT(t)?this.encodeAsBinary({type:t.type===Wn.EVENT?Wn.BINARY_EVENT:Wn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Wn.BINARY_EVENT||t.type===Wn.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ume(t),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function QP(e){return Object.prototype.toString.call(e)==="[object Object]"}class H8 extends Wi{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===Wn.BINARY_EVENT;r||n.type===Wn.BINARY_ACK?(n.type=r?Wn.EVENT:Wn.ACK,this.reconstructor=new qme(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(U8(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(Wn[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Wn.BINARY_EVENT||r.type===Wn.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const l=t.substring(a,n);if(l!=Number(l)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(l)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(a,n)}else r.nsp="/";const o=t.charAt(n+1);if(o!==""&&Number(o)==o){const a=n+1;for(;++n;){const l=t.charAt(n);if(l==null||Number(l)!=l){--n;break}if(n===t.length)break}r.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(H8.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case Wn.CONNECT:return QP(n);case Wn.DISCONNECT:return n===void 0;case Wn.CONNECT_ERROR:return typeof n=="string"||QP(n);case Wn.EVENT:case Wn.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&jme.indexOf(n[0])===-1);case Wn.ACK:case Wn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class qme{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Fme(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Gme=Object.freeze(Object.defineProperty({__proto__:null,Decoder:H8,Encoder:Pme,get PacketType(){return Wn},protocol:Hme},Symbol.toStringTag,{value:"Module"}));function Wl(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Vme=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class KP extends Wi{constructor(t,n,r){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=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Wl(t,"open",this.onopen.bind(this)),Wl(t,"packet",this.onpacket.bind(this)),Wl(t,"error",this.onerror.bind(this)),Wl(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,o,a;if(Vme.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const l={type:Wn.EVENT,data:n};if(l.options={},l.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const v=this.ids++,m=n.pop();this._registerAckCallback(v,m),l.id=v}const f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(l),this.packet(l)):this.sendBuffer.push(l)),this.flags={},this}_registerAckCallback(t,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===t&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),l=(...f)=>{this.io.clearTimeoutFn(a),n.apply(this,f)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,o)=>{const a=(l,f)=>l?o(l):r(f);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...a)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Wn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Wn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new 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 Wn.EVENT:case Wn.BINARY_EVENT:this.onevent(t);break;case Wn.ACK:case Wn.BINARY_ACK:this.onack(t);break;case Wn.DISCONNECT:this.ondisconnect();break;case Wn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:Wn.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Wn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Um(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}Um.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=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Um.prototype.reset=function(){this.attempts=0},Um.prototype.setMin=function(e){this.ms=e},Um.prototype.setMax=function(e){this.max=e},Um.prototype.setJitter=function(e){this.jitter=e};class P8 extends Wi{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,mT(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Um({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||Gme;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Ime(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Wl(n,"open",function(){r.onopen(),t&&t()}),a=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),t?t(f):this.maybeReconnectOnOpen()},l=Wl(n,"error",a);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),a(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Wl(t,"ping",this.onping.bind(this)),Wl(t,"data",this.ondata.bind(this)),Wl(t,"error",this.onerror.bind(this)),Wl(t,"close",this.onclose.bind(this)),Wl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){gT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KP(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ux={};function xT(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=$me(e,t.path||"/socket.io"),r=n.source,o=n.id,a=n.path,l=Ux[o]&&a in Ux[o].nsps,f=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let h;return f?h=new P8(r,t):(Ux[o]||(Ux[o]=new P8(r,t)),h=Ux[o]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(xT,{Manager:P8,Socket:KP,io:xT,connect:xT});const Fp=class Fp{constructor(){Pi(this,"socket",null);Pi(this,"isConnected",!1);Pi(this,"eventListeners",new Map)}static getInstance(){return Fp.instance||(Fp.instance=new Fp),Fp.instance}connect(t){return this.socket?this.socket:(this.socket=xT(`${dle}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,o;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(o=this.socket)==null||o.on(t,n)}off(t,n){var o;const r=this.eventListeners.get(t);if(r){const a=r.indexOf(n);a>-1&&r.splice(a,1),(o=this.socket)==null||o.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(o=>o(...n))}};Pi(Fp,"instance");let q8=Fp;const Wu=q8.getInstance(),Yme=({children:e,nameSpace:t})=>{const[n,r]=Z.useState(""),[o,a]=Z.useState([]),[l,f]=Z.useState(!1),[h,p]=Z.useState(!1),[v,m]=Z.useState([]),[x,_]=Z.useState(!1),[w,T]=Z.useState(!1),[E,k]=Z.useState([]),[R,O]=Nle(Vn(Rn.USER_INFO),null),[M,L]=Tx(Vn(Rn.IS_FORM_CLOSED_BY_USER),!1),[z,P]=xi.useState(null),G=hd("web-socket"),[J,U]=xi.useState([]),[K,ee]=Z.useState(null),[W,le]=Z.useState(!1),[ve,ce]=Z.useState(sessionStorage.getItem(Vn(Rn.LAST_SHOWN_MESSAGE_ID,{botId:t}))),re=vle(),xe=er(),[ke,B]=xi.useState(null),[Y,ie]=Z.useState(null);Z.useEffect(()=>{if(G){const it=Wu.connect("/api/v1/chat");ee(it);const Ke=()=>{console.debug("connected to websocket"),le(!0)},ot=()=>{console.debug("disconnected from websocket"),le(!1)},Je=mt=>{console.debug("response from websocket",mt);const ct=mt.conversationId??crypto.randomUUID().toString();ce(ct),mt.Variants_quantity&&k(ae=>[...ae,...mt.Variants_quantity]);const te=[...o,{text:mt.response,products:mt.products,conversationId:ct,rating:"neutral",leading_queries:mt.leading_queries,collections:mt.collections,variants:mt.variants,shop:mt.shop,Variants_quantity:mt.Variants_quantity,monthlyChatLimitReached:mt.monthlyChatLimitReached,isBot:!0}];a(te),F(te),m(ae=>[...ae,[o[o.length-1].text,mt.response]]),p(!1)},Lt=mt=>{if(mt.event==="error"){const ct={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},te=[...o,ct];a(te),F(te),p(!1)}};return Wu.on("connect",Ke),Wu.on("disconnect",ot),Wu.on("response",Je),Wu.on("system",Lt),()=>{Wu.off("connect",Ke),Wu.off("disconnect",ot),Wu.off("response",Je),Wu.off("system",Lt)}}},[G,o]);const F=it=>{sessionStorage.setItem(Vn(Rn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(it))},fe=()=>{const it=sessionStorage.getItem(Vn(Rn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return it?JSON.parse(it):[]},ze=Z.useCallback(async()=>{if(t)try{f(!0);const it=await fetch(`${Ci}/api/wordpress/UiData?value=${t}`),Ke=await it.json();if(!it.ok)throw new Error("failed to fetch data"+Ke.error);const ot=document.getElementById("debales-ai-assistant");ot&&(ot.style.zIndex=String(Ke.zIndex??2031483602)),ie(Ke),Ke!=null&&Ke.shopifyShopDomain&&Vle(Ke.shopifyShopDomain).then(Lt=>{B(Lt)}),U(Ke.suggestedQuestions);const Je=fe();if(Je.length>0)a(Je);else{const Lt={text:Ke.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};a([Lt])}}catch(it){console.error(it)}finally{f(!1)}},[t]);Z.useEffect(()=>{ze()},[ze]);const Ae=Z.useMemo(()=>{var it;return!!(!M&&((it=Y==null?void 0:Y.pluginConfig)!=null&&it.collectedUserInfo)&&(Y.pluginConfig.collectedUserInfo.name||Y.pluginConfig.collectedUserInfo.email||Y.pluginConfig.collectedUserInfo.phone)&&!R)},[Y,R,M]),Qe=Z.useCallback(async(it,Ke,ot,Je,Lt,mt)=>{if(!it||it.trim()===""||h&&!ot)return;let ct=[...o];Je?Je&&o.length<=2?(_(!0),ct=[]):_(!1):(ct.push({text:it,isBot:!1}),_(!1));const te=er();p(!0);try{a(ct),F(ct);const ae=await fetch(`${Ci}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:te,userMessage:it,nameSpace:t,chat_history:v,leading_queries:Lt,answer:Ke,products:ot,userInfo:JSON.stringify(R),anonymousUserId:re,distinctId:Yu.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:mt})});if(!ae.ok)throw new Error("Network response was not ok");const _e=await ae.json(),Se=_e.conversationId??crypto.randomUUID().toString();ce(Se),_e.Variants_quantity&&k(Fe=>[...Fe,..._e.Variants_quantity]);const je=[...ct,{text:_e.response,products:_e.products,conversationId:Se,rating:"neutral",leading_queries:_e.leading_queries,collections:_e.collections,variants:_e.variants,shop:_e.shop,Variants_quantity:_e.Variants_quantity,monthlyChatLimitReached:_e.monthlyChatLimitReached,isBot:!0}];a(je),F(je),m(Fe=>[...Fe,[it,_e.response]])}catch(ae){console.error(ae);const _e={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Se=[...ct,_e];Je||(a(Se),F(Se))}finally{p(!1)}},[o,h,v,t,re,R]),Ze=Z.useCallback(it=>{Y&&ie(Ke=>Ke?{...Ke,mobileDisplayMode:it}:null)},[Y]),ut=Z.useCallback(async(it,Ke,ot,Je,Lt,mt)=>{if(!it||it.trim()===""||h&&!ot)return;let ct=[...o];if(Je?Je&&o.length<=2?(_(!0),ct=[]):_(!1):(ct.push({text:it,isBot:!1}),_(!1)),p(!0),a(ct),F(ct),K&&W){const te={type:N0e.MESSAGE,role:z0e.USER,query:it,nameSpace:t,leadingQueries:Lt,answer:Ke,products:ot,userInfo:R,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:xe,anonymousUserId:re,distinctId:Yu.getDistinctId(),followUpQuestion:mt};Wu.emit("chat",te)}else Qe(it,Ke,ot,Je,Lt,mt)},[o,h,t,re,K,W,xe,Qe,R]),wt={sessionId:xe,messages:o,isLoading:l,isMessageLoading:h,isKlaviyoMessage:x,showUserInfoModel:w,pendingBulkItems:E,lastedBotmessageId:ve,uiData:Y,storeMetaData:ke,suggestedQuestions:J,isUserInfoNeeded:Ae,input:n,pendingQuestion:z,userInfo:R,isFormClosedByUser:M,onSendMessage:G?ut:Qe,setMessages:a,setIsLoading:f,setIsMessageLoading:p,setIsKlaviyoMessage:_,setShowUserInfoModel:T,setPendingBulkItems:k,setLastedBotmessageId:ce,fetchUiInfo:ze,changeDisplayModel:Ze,saveConversation:F,loadConversation:fe,setSuggestedQuestions:U,setUserInfo:O,setInput:r,setPendingQuestion:P,setIsFormClosedByUser:L};return I.jsx(aU.Provider,{value:wt,children:e})};function Zme(e){const t=R8.getInstance().getAdapter();return I.jsx(Yme,{nameSpace:e.botId,children:I.jsx(gZ,{apiKey:hle,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:Ci+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:zd.detect(),project:e.botId,sessionId:er()}),n.group("project",e.botId,{platform:zd.detect()});const r=No();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:I.jsx(Jge,{adapter:t,children:e.children})})})}function Qme(e){return I.jsx(I0e,{children:I.jsx(Zme,{botId:e.botId,children:I.jsx(M0e,{...e})})})}const cf=new Map;function bT(e){const{botId:t}=e;if(cf.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),cf.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const o=C5.createRoot(r);o.render(xi.createElement(Qme,{botId:e.botId}));const a={container:r,unmount:()=>{if(o.unmount(),cf.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(l){console.warn("Error removing chatbot container:",l)}}};return cf.set(t,a),a}typeof window<"u"&&(window.DebalesChatbotBrowser={init:bT,destroy:e=>{const t=cf.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>cf.has(e),getInitializedBots:()=>Array.from(cf.keys())});function WP(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!cf.has(r)&&bT({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!cf.has(r)&&bT({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",WP):WP()),Nc.initDebalesChatbot=bT,Object.defineProperty(Nc,Symbol.toStringTag,{value:"Module"}),Nc}({});
|
|
4933
|
+
*/return n.mode.CTRGladman=function(){var r=n.lib.BlockCipherMode.extend();function o(f){if((f>>24&255)===255){var h=f>>16&255,p=f>>8&255,v=f&255;h===255?(h=0,p===255?(p=0,v===255?v=0:++v):++p):++h,f=0,f+=h<<16,f+=p<<8,f+=v}else f+=16777216;return f}function a(f){return(f[0]=o(f[0]))===0&&(f[1]=o(f[1])),f}var l=r.Encryptor=r.extend({processBlock:function(f,h){var p=this._cipher,v=p.blockSize,m=this._iv,x=this._counter;m&&(x=this._counter=m.slice(0),this._iv=void 0),a(x);var _=x.slice(0);p.encryptBlock(_,0);for(var w=0;w<v;w++)f[h+w]^=_[w]}});return r.Decryptor=l,r}(),n.mode.CTRGladman})}(Wk)),Wk.exports}var Xk={exports:{}},bge=Xk.exports,yP;function _ge(){return yP||(yP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(bge,function(n){return n.mode.OFB=function(){var r=n.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(a,l){var f=this._cipher,h=f.blockSize,p=this._iv,v=this._keystream;p&&(v=this._keystream=p.slice(0),this._iv=void 0),f.encryptBlock(v,0);for(var m=0;m<h;m++)a[l+m]^=v[m]}});return r.Decryptor=o,r}(),n.mode.OFB})}(Xk)),Xk.exports}var Jk={exports:{}},Sge=Jk.exports,xP;function wge(){return xP||(xP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Sge,function(n){return n.mode.ECB=function(){var r=n.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(o,a){this._cipher.encryptBlock(o,a)}}),r.Decryptor=r.extend({processBlock:function(o,a){this._cipher.decryptBlock(o,a)}}),r}(),n.mode.ECB})}(Jk)),Jk.exports}var eT={exports:{}},Cge=eT.exports,bP;function Ege(){return bP||(bP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Cge,function(n){return n.pad.AnsiX923={pad:function(r,o){var a=r.sigBytes,l=o*4,f=l-a%l,h=a+f-1;r.clamp(),r.words[h>>>2]|=f<<24-h%4*8,r.sigBytes+=f},unpad:function(r){var o=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=o}},n.pad.Ansix923})}(eT)),eT.exports}var tT={exports:{}},Age=tT.exports,_P;function kge(){return _P||(_P=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Age,function(n){return n.pad.Iso10126={pad:function(r,o){var a=o*4,l=a-r.sigBytes%a;r.concat(n.lib.WordArray.random(l-1)).concat(n.lib.WordArray.create([l<<24],1))},unpad:function(r){var o=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=o}},n.pad.Iso10126})}(tT)),tT.exports}var nT={exports:{}},Tge=nT.exports,SP;function Rge(){return SP||(SP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Tge,function(n){return n.pad.Iso97971={pad:function(r,o){r.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(r,o)},unpad:function(r){n.pad.ZeroPadding.unpad(r),r.sigBytes--}},n.pad.Iso97971})}(nT)),nT.exports}var rT={exports:{}},Oge=rT.exports,wP;function Dge(){return wP||(wP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Oge,function(n){return n.pad.ZeroPadding={pad:function(r,o){var a=o*4;r.clamp(),r.sigBytes+=a-(r.sigBytes%a||a)},unpad:function(r){for(var o=r.words,a=r.sigBytes-1,a=r.sigBytes-1;a>=0;a--)if(o[a>>>2]>>>24-a%4*8&255){r.sigBytes=a+1;break}}},n.pad.ZeroPadding})}(rT)),rT.exports}var iT={exports:{}},Mge=iT.exports,CP;function Ige(){return CP||(CP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})(Mge,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(iT)),iT.exports}var oT={exports:{}},$ge=oT.exports,EP;function Bge(){return EP||(EP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Eo())})($ge,function(n){return function(r){var o=n,a=o.lib,l=a.CipherParams,f=o.enc,h=f.Hex,p=o.format;p.Hex={stringify:function(v){return v.ciphertext.toString(h)},parse:function(v){var m=h.parse(v);return l.create({ciphertext:m})}}}(),n.format.Hex})}(oT)),oT.exports}var aT={exports:{}},Lge=aT.exports,AP;function Nge(){return AP||(AP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Lge,function(n){return function(){var r=n,o=r.lib,a=o.BlockCipher,l=r.algo,f=[],h=[],p=[],v=[],m=[],x=[],_=[],w=[],T=[],E=[];(function(){for(var O=[],M=0;M<256;M++)M<128?O[M]=M<<1:O[M]=M<<1^283;for(var L=0,z=0,M=0;M<256;M++){var P=z^z<<1^z<<2^z<<3^z<<4;P=P>>>8^P&255^99,f[L]=P,h[P]=L;var G=O[L],J=O[G],U=O[J],K=O[P]*257^P*16843008;p[L]=K<<24|K>>>8,v[L]=K<<16|K>>>16,m[L]=K<<8|K>>>24,x[L]=K;var K=U*16843009^J*65537^G*257^L*16843008;_[P]=K<<24|K>>>8,w[P]=K<<16|K>>>16,T[P]=K<<8|K>>>24,E[P]=K,L?(L=G^O[O[O[U^G]]],z^=O[O[z]]):L=z=1}})();var k=[0,1,2,4,8,16,32,64,128,27,54],R=l.AES=a.extend({_doReset:function(){var O;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var M=this._keyPriorReset=this._key,L=M.words,z=M.sigBytes/4,P=this._nRounds=z+6,G=(P+1)*4,J=this._keySchedule=[],U=0;U<G;U++)U<z?J[U]=L[U]:(O=J[U-1],U%z?z>6&&U%z==4&&(O=f[O>>>24]<<24|f[O>>>16&255]<<16|f[O>>>8&255]<<8|f[O&255]):(O=O<<8|O>>>24,O=f[O>>>24]<<24|f[O>>>16&255]<<16|f[O>>>8&255]<<8|f[O&255],O^=k[U/z|0]<<24),J[U]=J[U-z]^O);for(var K=this._invKeySchedule=[],ee=0;ee<G;ee++){var U=G-ee;if(ee%4)var O=J[U];else var O=J[U-4];ee<4||U<=4?K[ee]=O:K[ee]=_[f[O>>>24]]^w[f[O>>>16&255]]^T[f[O>>>8&255]]^E[f[O&255]]}}},encryptBlock:function(O,M){this._doCryptBlock(O,M,this._keySchedule,p,v,m,x,f)},decryptBlock:function(O,M){var L=O[M+1];O[M+1]=O[M+3],O[M+3]=L,this._doCryptBlock(O,M,this._invKeySchedule,_,w,T,E,h);var L=O[M+1];O[M+1]=O[M+3],O[M+3]=L},_doCryptBlock:function(O,M,L,z,P,G,J,U){for(var K=this._nRounds,ee=O[M]^L[0],W=O[M+1]^L[1],le=O[M+2]^L[2],ve=O[M+3]^L[3],ce=4,re=1;re<K;re++){var xe=z[ee>>>24]^P[W>>>16&255]^G[le>>>8&255]^J[ve&255]^L[ce++],ke=z[W>>>24]^P[le>>>16&255]^G[ve>>>8&255]^J[ee&255]^L[ce++],B=z[le>>>24]^P[ve>>>16&255]^G[ee>>>8&255]^J[W&255]^L[ce++],Y=z[ve>>>24]^P[ee>>>16&255]^G[W>>>8&255]^J[le&255]^L[ce++];ee=xe,W=ke,le=B,ve=Y}var xe=(U[ee>>>24]<<24|U[W>>>16&255]<<16|U[le>>>8&255]<<8|U[ve&255])^L[ce++],ke=(U[W>>>24]<<24|U[le>>>16&255]<<16|U[ve>>>8&255]<<8|U[ee&255])^L[ce++],B=(U[le>>>24]<<24|U[ve>>>16&255]<<16|U[ee>>>8&255]<<8|U[W&255])^L[ce++],Y=(U[ve>>>24]<<24|U[ee>>>16&255]<<16|U[W>>>8&255]<<8|U[le&255])^L[ce++];O[M]=xe,O[M+1]=ke,O[M+2]=B,O[M+3]=Y},keySize:256/32});r.AES=a._createHelper(R)}(),n.AES})}(aT)),aT.exports}var sT={exports:{}},zge=sT.exports,kP;function Uge(){return kP||(kP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(zge,function(n){return function(){var r=n,o=r.lib,a=o.WordArray,l=o.BlockCipher,f=r.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],v=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],m=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],x=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],_=f.DES=l.extend({_doReset:function(){for(var k=this._key,R=k.words,O=[],M=0;M<56;M++){var L=h[M]-1;O[M]=R[L>>>5]>>>31-L%32&1}for(var z=this._subKeys=[],P=0;P<16;P++){for(var G=z[P]=[],J=v[P],M=0;M<24;M++)G[M/6|0]|=O[(p[M]-1+J)%28]<<31-M%6,G[4+(M/6|0)]|=O[28+(p[M+24]-1+J)%28]<<31-M%6;G[0]=G[0]<<1|G[0]>>>31;for(var M=1;M<7;M++)G[M]=G[M]>>>(M-1)*4+3;G[7]=G[7]<<5|G[7]>>>27}for(var U=this._invSubKeys=[],M=0;M<16;M++)U[M]=z[15-M]},encryptBlock:function(k,R){this._doCryptBlock(k,R,this._subKeys)},decryptBlock:function(k,R){this._doCryptBlock(k,R,this._invSubKeys)},_doCryptBlock:function(k,R,O){this._lBlock=k[R],this._rBlock=k[R+1],w.call(this,4,252645135),w.call(this,16,65535),T.call(this,2,858993459),T.call(this,8,16711935),w.call(this,1,1431655765);for(var M=0;M<16;M++){for(var L=O[M],z=this._lBlock,P=this._rBlock,G=0,J=0;J<8;J++)G|=m[J][((P^L[J])&x[J])>>>0];this._lBlock=P,this._rBlock=z^G}var U=this._lBlock;this._lBlock=this._rBlock,this._rBlock=U,w.call(this,1,1431655765),T.call(this,8,16711935),T.call(this,2,858993459),w.call(this,16,65535),w.call(this,4,252645135),k[R]=this._lBlock,k[R+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function w(k,R){var O=(this._lBlock>>>k^this._rBlock)&R;this._rBlock^=O,this._lBlock^=O<<k}function T(k,R){var O=(this._rBlock>>>k^this._lBlock)&R;this._lBlock^=O,this._rBlock^=O<<k}r.DES=l._createHelper(_);var E=f.TripleDES=l.extend({_doReset:function(){var k=this._key,R=k.words;if(R.length!==2&&R.length!==4&&R.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var O=R.slice(0,2),M=R.length<4?R.slice(0,2):R.slice(2,4),L=R.length<6?R.slice(0,2):R.slice(4,6);this._des1=_.createEncryptor(a.create(O)),this._des2=_.createEncryptor(a.create(M)),this._des3=_.createEncryptor(a.create(L))},encryptBlock:function(k,R){this._des1.encryptBlock(k,R),this._des2.decryptBlock(k,R),this._des3.encryptBlock(k,R)},decryptBlock:function(k,R){this._des3.decryptBlock(k,R),this._des2.encryptBlock(k,R),this._des1.decryptBlock(k,R)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=l._createHelper(E)}(),n.TripleDES})}(sT)),sT.exports}var lT={exports:{}},Fge=lT.exports,TP;function jge(){return TP||(TP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Fge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=l.RC4=a.extend({_doReset:function(){for(var v=this._key,m=v.words,x=v.sigBytes,_=this._S=[],w=0;w<256;w++)_[w]=w;for(var w=0,T=0;w<256;w++){var E=w%x,k=m[E>>>2]>>>24-E%4*8&255;T=(T+_[w]+k)%256;var R=_[w];_[w]=_[T],_[T]=R}this._i=this._j=0},_doProcessBlock:function(v,m){v[m]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var v=this._S,m=this._i,x=this._j,_=0,w=0;w<4;w++){m=(m+1)%256,x=(x+v[m])%256;var T=v[m];v[m]=v[x],v[x]=T,_|=v[(v[m]+v[x])%256]<<24-w*8}return this._i=m,this._j=x,_}r.RC4=a._createHelper(f);var p=l.RC4Drop=f.extend({cfg:f.cfg.extend({drop:192}),_doReset:function(){f._doReset.call(this);for(var v=this.cfg.drop;v>0;v--)h.call(this)}});r.RC4Drop=a._createHelper(p)}(),n.RC4})}(lT)),lT.exports}var uT={exports:{}},Hge=uT.exports,RP;function Pge(){return RP||(RP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Hge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=[],h=[],p=[],v=l.Rabbit=a.extend({_doReset:function(){for(var x=this._key.words,_=this.cfg.iv,w=0;w<4;w++)x[w]=(x[w]<<8|x[w]>>>24)&16711935|(x[w]<<24|x[w]>>>8)&4278255360;var T=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],E=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var w=0;w<4;w++)m.call(this);for(var w=0;w<8;w++)E[w]^=T[w+4&7];if(_){var k=_.words,R=k[0],O=k[1],M=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,L=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,z=M>>>16|L&4294901760,P=L<<16|M&65535;E[0]^=M,E[1]^=z,E[2]^=L,E[3]^=P,E[4]^=M,E[5]^=z,E[6]^=L,E[7]^=P;for(var w=0;w<4;w++)m.call(this)}},_doProcessBlock:function(x,_){var w=this._X;m.call(this),f[0]=w[0]^w[5]>>>16^w[3]<<16,f[1]=w[2]^w[7]>>>16^w[5]<<16,f[2]=w[4]^w[1]>>>16^w[7]<<16,f[3]=w[6]^w[3]>>>16^w[1]<<16;for(var T=0;T<4;T++)f[T]=(f[T]<<8|f[T]>>>24)&16711935|(f[T]<<24|f[T]>>>8)&4278255360,x[_+T]^=f[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,_=this._C,w=0;w<8;w++)h[w]=_[w];_[0]=_[0]+1295307597+this._b|0,_[1]=_[1]+3545052371+(_[0]>>>0<h[0]>>>0?1:0)|0,_[2]=_[2]+886263092+(_[1]>>>0<h[1]>>>0?1:0)|0,_[3]=_[3]+1295307597+(_[2]>>>0<h[2]>>>0?1:0)|0,_[4]=_[4]+3545052371+(_[3]>>>0<h[3]>>>0?1:0)|0,_[5]=_[5]+886263092+(_[4]>>>0<h[4]>>>0?1:0)|0,_[6]=_[6]+1295307597+(_[5]>>>0<h[5]>>>0?1:0)|0,_[7]=_[7]+3545052371+(_[6]>>>0<h[6]>>>0?1:0)|0,this._b=_[7]>>>0<h[7]>>>0?1:0;for(var w=0;w<8;w++){var T=x[w]+_[w],E=T&65535,k=T>>>16,R=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[w]=R^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.Rabbit=a._createHelper(v)}(),n.Rabbit})}(uT)),uT.exports}var cT={exports:{}},qge=cT.exports,OP;function Gge(){return OP||(OP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(qge,function(n){return function(){var r=n,o=r.lib,a=o.StreamCipher,l=r.algo,f=[],h=[],p=[],v=l.RabbitLegacy=a.extend({_doReset:function(){var x=this._key.words,_=this.cfg.iv,w=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],T=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var E=0;E<4;E++)m.call(this);for(var E=0;E<8;E++)T[E]^=w[E+4&7];if(_){var k=_.words,R=k[0],O=k[1],M=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,L=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,z=M>>>16|L&4294901760,P=L<<16|M&65535;T[0]^=M,T[1]^=z,T[2]^=L,T[3]^=P,T[4]^=M,T[5]^=z,T[6]^=L,T[7]^=P;for(var E=0;E<4;E++)m.call(this)}},_doProcessBlock:function(x,_){var w=this._X;m.call(this),f[0]=w[0]^w[5]>>>16^w[3]<<16,f[1]=w[2]^w[7]>>>16^w[5]<<16,f[2]=w[4]^w[1]>>>16^w[7]<<16,f[3]=w[6]^w[3]>>>16^w[1]<<16;for(var T=0;T<4;T++)f[T]=(f[T]<<8|f[T]>>>24)&16711935|(f[T]<<24|f[T]>>>8)&4278255360,x[_+T]^=f[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,_=this._C,w=0;w<8;w++)h[w]=_[w];_[0]=_[0]+1295307597+this._b|0,_[1]=_[1]+3545052371+(_[0]>>>0<h[0]>>>0?1:0)|0,_[2]=_[2]+886263092+(_[1]>>>0<h[1]>>>0?1:0)|0,_[3]=_[3]+1295307597+(_[2]>>>0<h[2]>>>0?1:0)|0,_[4]=_[4]+3545052371+(_[3]>>>0<h[3]>>>0?1:0)|0,_[5]=_[5]+886263092+(_[4]>>>0<h[4]>>>0?1:0)|0,_[6]=_[6]+1295307597+(_[5]>>>0<h[5]>>>0?1:0)|0,_[7]=_[7]+3545052371+(_[6]>>>0<h[6]>>>0?1:0)|0,this._b=_[7]>>>0<h[7]>>>0?1:0;for(var w=0;w<8;w++){var T=x[w]+_[w],E=T&65535,k=T>>>16,R=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[w]=R^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.RabbitLegacy=a._createHelper(v)}(),n.RabbitLegacy})}(cT)),cT.exports}var fT={exports:{}},Vge=fT.exports,DP;function Yge(){return DP||(DP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Np(),zp(),Fd(),Eo())})(Vge,function(n){return function(){var r=n,o=r.lib,a=o.BlockCipher,l=r.algo;const f=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],p=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var v={pbox:[],sbox:[]};function m(E,k){let R=k>>24&255,O=k>>16&255,M=k>>8&255,L=k&255,z=E.sbox[0][R]+E.sbox[1][O];return z=z^E.sbox[2][M],z=z+E.sbox[3][L],z}function x(E,k,R){let O=k,M=R,L;for(let z=0;z<f;++z)O=O^E.pbox[z],M=m(E,O)^M,L=O,O=M,M=L;return L=O,O=M,M=L,M=M^E.pbox[f],O=O^E.pbox[f+1],{left:O,right:M}}function _(E,k,R){let O=k,M=R,L;for(let z=f+1;z>1;--z)O=O^E.pbox[z],M=m(E,O)^M,L=O,O=M,M=L;return L=O,O=M,M=L,M=M^E.pbox[1],O=O^E.pbox[0],{left:O,right:M}}function w(E,k,R){for(let P=0;P<4;P++){E.sbox[P]=[];for(let G=0;G<256;G++)E.sbox[P][G]=p[P][G]}let O=0;for(let P=0;P<f+2;P++)E.pbox[P]=h[P]^k[O],O++,O>=R&&(O=0);let M=0,L=0,z=0;for(let P=0;P<f+2;P+=2)z=x(E,M,L),M=z.left,L=z.right,E.pbox[P]=M,E.pbox[P+1]=L;for(let P=0;P<4;P++)for(let G=0;G<256;G+=2)z=x(E,M,L),M=z.left,L=z.right,E.sbox[P][G]=M,E.sbox[P][G+1]=L;return!0}var T=l.Blowfish=a.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var E=this._keyPriorReset=this._key,k=E.words,R=E.sigBytes/4;w(v,k,R)}},encryptBlock:function(E,k){var R=x(v,E[k],E[k+1]);E[k]=R.left,E[k+1]=R.right},decryptBlock:function(E,k){var R=_(v,E[k],E[k+1]);E[k]=R.left,E[k+1]=R.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=a._createHelper(T)}(),n.Blowfish})}(fT)),fT.exports}var Zge=Rk.exports,MP;function Qge(){return MP||(MP=1,function(e,t){(function(n,r,o){e.exports=r(Kn(),Mk(),G0e(),Y0e(),Np(),K0e(),zp(),rP(),k8(),tge(),sP(),ige(),age(),lge(),T8(),fge(),Fd(),Eo(),gge(),vge(),xge(),_ge(),wge(),Ege(),kge(),Rge(),Dge(),Ige(),Bge(),Nge(),Uge(),jge(),Pge(),Gge(),Yge())})(Zge,function(n){return n})}(Rk)),Rk.exports}var Kge=Qge();const Wge=$u(Kge);class Xge extends Tk{constructor(){super(...arguments);Pi(this,"platform",Ki.THE_COLLECTIVE);Pi(this,"apiBaseURL","https://testapi.thecollective.in/")}getCookie(n){var a;const o=`; ${document.cookie}`.split(`; ${n}=`);return o.length===2&&((a=o.pop())==null?void 0:a.split(";").shift())||null}generateHash(n){const r=JSON.parse(JSON.stringify(n));return delete r.hash,Wge.MD5(JSON.stringify(r)).toString()}async fetchCart(){try{const n={storeId:0,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),page:"cartSummary",device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},r=this.generateHash(n),o={...n,hash:r,validateHash:!0},a=await fetch(`${this.apiBaseURL}cart/getCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(o)});if(!a.ok)return this.createErrorResult(`Failed to fetch cart: ${a.status}`);const l=await a.json();if(!l.results||l.results==="")return this.createSuccessResult({items:[],total:0,itemCount:0,currency:"INR",token:""});const f=l.results[0],h=f.products.map(p=>({id:p.id_cart_product,quantity:p.quantity,properties:{size:p.size,color:p.color,brand:p.brand,subbrand:p.subbrand},title:p.name,price:p.unitproductprice,variant_id:p.id_product_attribute}));return this.createSuccessResult({items:h,total:f.totalCartvalue,itemCount:h.length,currency:"INR",token:l.hash})}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}async addToCart(n,r=1,o){try{const a=n,l=o!=null&&o.size?parseInt(o.size):0,f=new URLSearchParams;f.append("dbls_order_source","direct_recommendation"),f.append("dbls_session_id",er()),f.append("dbls_method","add_to_cart"),f.append("utm_source","debales_chatbot");const h={productId:a,productAttributeId:0,size:l,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMER_ID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CART_ID")||"0"),version:1.2,buyNow:0,quantity:r,oldAttributeId:0,wishlistDeleteFlag:0,cartOperation:"add",storeId:0,utmSource:f.toString(),sliderSource:"",page:"cartSummary",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},p=this.generateHash(h),v={...h,hash:p,validateHash:!0},m=await fetch(`${this.apiBaseURL}cart/addToCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(v)});return m.ok?this.createSuccessResult(void 0,"Item added to cart successfully"):this.createErrorResult(`Failed to add item to cart: ${m.status}`)}catch(a){return this.createErrorResult(a instanceof Error?a.message:"Unknown error")}}async removeFromCart(n){try{const r={customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),productId:n,storeId:0,productAttributeId:0,device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},o=this.generateHash(r),a={...r,hash:o,validateHash:!0},l=await fetch(`${this.apiBaseURL}cart/deleteCartProduct`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(a)});return l.ok?this.createSuccessResult(void 0,"Item removed from cart successfully"):this.createErrorResult(`Failed to remove item from cart: ${l.status}`)}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async updateQuantity(n){try{return console.log("TheCollectiveCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async clearCart(){try{return console.log("TheCollectiveCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}generateCartUrl(n){const r=U0e(n);if(!r.isValid)return"";const o=new URL("/checkoutsummary",r.url);return o.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),o.searchParams.append("attributes[from]","debales-ai-chatbot"),o.searchParams.append("attributes[through]","add-to-cart"),o.searchParams.append("attributes[dbls_session_id]",er()),o.searchParams.append("timestamp",Date.now().toString()),uf(o.toString())}generateProductUrl(n,r){const o=new URL(r.link);return o.host=n,uf(o.toString())}async addCartAttributes(n={}){try{return console.log("TheCollectiveCartAdapter: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}}const Up=class Up{constructor(){Pi(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return Up.instance||(Up.instance=new Up),Up.instance}getAdapter(t){const n=t||zd.detect(),r=this.adapterCache.get(n);if(r)return r;let o;switch(n){case Ki.SHOPIFY:o=new B0e;break;case Ki.MAGENTO:o=new L0e;break;case Ki.THE_COLLECTIVE:o=new Xge;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),o=new $0e}return this.adapterCache.set(n,o),o}clearCache(){this.adapterCache.clear()}};Pi(Up,"instance");let R8=Up;const Jge=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,o]=Z.useState(!1),[a,l]=Z.useState(null),[f,h]=Z.useState(null),p=Z.useCallback(async()=>{try{o(!0),l(null);const R=await e.fetchCart();R.success?h(R.data):l(R.error)}catch(R){l(R instanceof Error?R.message:"Failed to fetch cart")}finally{o(!1)}},[e]),v=async(R,O,M)=>{try{l(null);const L=await e.addToCart(R,O,M);return L.success&&await p(),L}catch(L){return{success:!1,error:L instanceof Error?L.message:"Failed to add item to cart"}}},m=async R=>{try{l(null);const O=await e.removeFromCart(R);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to remove item from cart"}}},x=async R=>{try{l(null);const O=await e.updateQuantity(R);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to update quantity"}}},_=async()=>{try{l(null);const R=await e.clearCart();return R.success&&await p(),R}catch(R){return{success:!1,error:R instanceof Error?R.message:"Failed to clear cart"}}},w=R=>e.generateCartUrl(R),T=(R,O)=>e.generateProductUrl(R,O),E=async R=>e.addCartAttributes(R);Z.useEffect(()=>{n&&p()},[n,p]);const k={isLoading:r,error:a,cart:f,fetchCart:p,addToCart:v,removeFromCart:m,updateQuantity:x,clearCart:_,generateCartUrl:w,generateProductUrl:T,addCartAttributes:E};return I.jsx(Bz.Provider,{value:k,children:t})},Qu=Object.create(null);Qu.open="0",Qu.close="1",Qu.ping="2",Qu.pong="3",Qu.message="4",Qu.upgrade="5",Qu.noop="6";const dT=Object.create(null);Object.keys(Qu).forEach(e=>{dT[Qu[e]]=e});const O8={type:"error",data:"parser error"},IP=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",$P=typeof ArrayBuffer=="function",BP=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,D8=({type:e,data:t},n,r)=>IP&&t instanceof Blob?n?r(t):LP(t,r):$P&&(t instanceof ArrayBuffer||BP(t))?n?r(t):LP(new Blob([t]),r):r(Qu[e]+(t||"")),LP=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function NP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let M8;function eme(e,t){if(IP&&e.data instanceof Blob)return e.data.arrayBuffer().then(NP).then(t);if($P&&(e.data instanceof ArrayBuffer||BP(e.data)))return t(NP(e.data));D8(e,!1,n=>{M8||(M8=new TextEncoder),t(M8.encode(n))})}const zP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zx=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<zP.length;e++)zx[zP.charCodeAt(e)]=e;const tme=e=>{let t=e.length*.75,n=e.length,r,o=0,a,l,f,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),v=new Uint8Array(p);for(r=0;r<n;r+=4)a=zx[e.charCodeAt(r)],l=zx[e.charCodeAt(r+1)],f=zx[e.charCodeAt(r+2)],h=zx[e.charCodeAt(r+3)],v[o++]=a<<2|l>>4,v[o++]=(l&15)<<4|f>>2,v[o++]=(f&3)<<6|h&63;return p},nme=typeof ArrayBuffer=="function",I8=(e,t)=>{if(typeof e!="string")return{type:"message",data:UP(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:rme(e.substring(1),t)}:dT[n]?e.length>1?{type:dT[n],data:e.substring(1)}:{type:dT[n]}:O8},rme=(e,t)=>{if(nme){const n=tme(e);return UP(n,t)}else return{base64:!0,data:e}},UP=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},FP="",ime=(e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach((a,l)=>{D8(a,!1,f=>{r[l]=f,++o===n&&t(r.join(FP))})})},ome=(e,t)=>{const n=e.split(FP),r=[];for(let o=0;o<n.length;o++){const a=I8(n[o],t);if(r.push(a),a.type==="error")break}return r};function ame(){return new TransformStream({transform(e,t){eme(e,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const a=new DataView(o.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{o=new Uint8Array(9);const a=new DataView(o.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let $8;function hT(e){return e.reduce((t,n)=>t+n.length,0)}function pT(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=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 sme(e,t){$8||($8=new TextDecoder);const n=[];let r=0,o=-1,a=!1;return new TransformStream({transform(l,f){for(n.push(l);;){if(r===0){if(hT(n)<1)break;const h=pT(n,1);a=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(hT(n)<2)break;const h=pT(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(hT(n)<8)break;const h=pT(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),v=p.getUint32(0);if(v>Math.pow(2,21)-1){f.enqueue(O8);break}o=v*Math.pow(2,32)+p.getUint32(4),r=3}else{if(hT(n)<o)break;const h=pT(n,o);f.enqueue(I8(a?h:$8.decode(h),t)),r=0}if(o===0||o>e){f.enqueue(O8);break}}}})}const jP=4;function Wi(e){if(e)return lme(e)}function lme(e){for(var t in Wi.prototype)e[t]=Wi.prototype[t];return e}Wi.prototype.on=Wi.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Wi.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Wi.prototype.off=Wi.prototype.removeListener=Wi.prototype.removeAllListeners=Wi.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===t||r.fn===t){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Wi.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,t)}return this},Wi.prototype.emitReserved=Wi.prototype.emit,Wi.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Wi.prototype.hasListeners=function(e){return!!this.listeners(e).length};const gT=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),dl=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),ume="arraybuffer";function yye(){}function HP(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const cme=dl.setTimeout,fme=dl.clearTimeout;function mT(e,t){t.useNativeTimers?(e.setTimeoutFn=cme.bind(dl),e.clearTimeoutFn=fme.bind(dl)):(e.setTimeoutFn=dl.setTimeout.bind(dl),e.clearTimeoutFn=dl.clearTimeout.bind(dl))}const dme=1.33;function hme(e){return typeof e=="string"?pme(e):Math.ceil((e.byteLength||e.size)*dme)}function pme(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function PP(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function gme(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function mme(e){let t={},n=e.split("&");for(let r=0,o=n.length;r<o;r++){let a=n[r].split("=");t[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return t}class vme extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class B8 extends Wi{constructor(t){super(),this.writable=!1,mT(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new vme(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=I8(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=gme(t);return n.length?"?"+n:""}}class yme extends B8{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};ome(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,ime(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PP()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let qP=!1;try{qP=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xme=qP;function bme(){}class _me extends yme{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(o,a)=>{this.onError("xhr post error",o,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Ku extends Wi{constructor(t,n,r){super(),this.createRequest=t,mT(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=HP(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ku.requestsCount++,Ku.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bme,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ku.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Ku.requestsCount=0,Ku.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",GP);else if(typeof addEventListener=="function"){const e="onpagehide"in dl?"pagehide":"unload";addEventListener(e,GP,!1)}}function GP(){for(let e in Ku.requests)Ku.requests.hasOwnProperty(e)&&Ku.requests[e].abort()}const Sme=function(){const e=VP({xdomain:!1});return e&&e.responseType!==null}();class wme extends _me{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Sme&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Ku(VP,this.uri(),t)}}function VP(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||xme))return new XMLHttpRequest}catch{}if(!t)try{return new dl[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const YP=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Cme extends B8{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=YP?{}:HP(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],o=n===t.length-1;D8(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}o&&gT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PP()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const L8=dl.WebSocket||dl.MozWebSocket;class Eme extends Cme{createSocket(t,n,r){return YP?new L8(t,n,r):n?new L8(t,n):new L8(t)}doWrite(t,n){this.ws.send(n)}}class Ame extends B8{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=sme(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),o=ame();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();const a=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),a())}).catch(f=>{})};a();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this._writer.write(l).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],o=n===t.length-1;this._writer.write(r).then(()=>{o&&gT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const kme={websocket:Eme,webtransport:Ame,polling:wme},Tme=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Rme=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function N8(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=Tme.exec(e||""),a={},l=14;for(;l--;)a[Rme[l]]=o[l]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=Ome(a,a.path),a.queryKey=Dme(a,a.query),a}function Ome(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Dme(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,a){o&&(n[o]=a)}),n}const z8=typeof addEventListener=="function"&&typeof removeEventListener=="function",vT=[];z8&&addEventListener("offline",()=>{vT.forEach(e=>e())},!1);class jd extends Wi{constructor(t,n){if(super(),this.binaryType=ume,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=N8(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=N8(n.host).host);mT(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=r}),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},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=mme(this.opts.query)),z8&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},vT.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=jP,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jd.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jd.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=hme(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,gT(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(jd.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),z8&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=vT.indexOf(this._offlineEventListener);r!==-1&&vT.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}jd.protocol=jP;class Mme extends jd{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;jd.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jd.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(v(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function a(){r||(r=!0,v(),n.close(),n=null)}const l=m=>{const x=new Error("probe error: "+m);x.transport=n.name,a(),this.emitReserved("upgradeError",x)};function f(){l("transport closed")}function h(){l("socket closed")}function p(m){n&&m.name!==n.name&&a()}const v=()=>{n.removeListener("open",o),n.removeListener("error",l),n.removeListener("close",f),this.off("close",h),this.off("upgrading",p)};n.once("open",o),n.once("error",l),n.once("close",f),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Ime=class extends Mme{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>kme[o]).filter(o=>!!o)),super(t,r)}};function $me(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=N8(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 a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const Bme=typeof ArrayBuffer=="function",Lme=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,ZP=Object.prototype.toString,Nme=typeof Blob=="function"||typeof Blob<"u"&&ZP.call(Blob)==="[object BlobConstructor]",zme=typeof File=="function"||typeof File<"u"&&ZP.call(File)==="[object FileConstructor]";function U8(e){return Bme&&(e instanceof ArrayBuffer||Lme(e))||Nme&&e instanceof Blob||zme&&e instanceof File}function yT(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(yT(e[n]))return!0;return!1}if(U8(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return yT(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&yT(e[n]))return!0;return!1}function Ume(e){const t=[],n=e.data,r=e;return r.data=F8(n,t),r.attachments=t.length,{packet:r,buffers:t}}function F8(e,t){if(!e)return e;if(U8(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=F8(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=F8(e[r],t));return n}return e}function Fme(e,t){return e.data=j8(e.data,t),delete e.attachments,e}function j8(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=j8(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=j8(e[n],t));return e}const jme=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Hme=5;var Wn;(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"})(Wn||(Wn={}));class Pme{constructor(t){this.replacer=t}encode(t){return(t.type===Wn.EVENT||t.type===Wn.ACK)&&yT(t)?this.encodeAsBinary({type:t.type===Wn.EVENT?Wn.BINARY_EVENT:Wn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Wn.BINARY_EVENT||t.type===Wn.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ume(t),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function QP(e){return Object.prototype.toString.call(e)==="[object Object]"}class H8 extends Wi{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===Wn.BINARY_EVENT;r||n.type===Wn.BINARY_ACK?(n.type=r?Wn.EVENT:Wn.ACK,this.reconstructor=new qme(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(U8(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(Wn[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Wn.BINARY_EVENT||r.type===Wn.BINARY_ACK){const a=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const l=t.substring(a,n);if(l!=Number(l)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(l)}if(t.charAt(n+1)==="/"){const a=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(a,n)}else r.nsp="/";const o=t.charAt(n+1);if(o!==""&&Number(o)==o){const a=n+1;for(;++n;){const l=t.charAt(n);if(l==null||Number(l)!=l){--n;break}if(n===t.length)break}r.id=Number(t.substring(a,n+1))}if(t.charAt(++n)){const a=this.tryParse(t.substr(n));if(H8.isPayloadValid(r.type,a))r.data=a;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case Wn.CONNECT:return QP(n);case Wn.DISCONNECT:return n===void 0;case Wn.CONNECT_ERROR:return typeof n=="string"||QP(n);case Wn.EVENT:case Wn.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&jme.indexOf(n[0])===-1);case Wn.ACK:case Wn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class qme{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Fme(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Gme=Object.freeze(Object.defineProperty({__proto__:null,Decoder:H8,Encoder:Pme,get PacketType(){return Wn},protocol:Hme},Symbol.toStringTag,{value:"Module"}));function Wl(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Vme=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class KP extends Wi{constructor(t,n,r){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=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Wl(t,"open",this.onopen.bind(this)),Wl(t,"packet",this.onpacket.bind(this)),Wl(t,"error",this.onerror.bind(this)),Wl(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,o,a;if(Vme.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const l={type:Wn.EVENT,data:n};if(l.options={},l.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const v=this.ids++,m=n.pop();this._registerAckCallback(v,m),l.id=v}const f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(l),this.packet(l)):this.sendBuffer.push(l)),this.flags={},this}_registerAckCallback(t,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===t&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),l=(...f)=>{this.io.clearTimeoutFn(a),n.apply(this,f)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,o)=>{const a=(l,f)=>l?o(l):r(f);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...a)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Wn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Wn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new 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 Wn.EVENT:case Wn.BINARY_EVENT:this.onevent(t);break;case Wn.ACK:case Wn.BINARY_ACK:this.onack(t);break;case Wn.DISCONNECT:this.ondisconnect();break;case Wn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:Wn.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Wn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Um(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}Um.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=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Um.prototype.reset=function(){this.attempts=0},Um.prototype.setMin=function(e){this.ms=e},Um.prototype.setMax=function(e){this.max=e},Um.prototype.setJitter=function(e){this.jitter=e};class P8 extends Wi{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,mT(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Um({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||Gme;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Ime(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Wl(n,"open",function(){r.onopen(),t&&t()}),a=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),t?t(f):this.maybeReconnectOnOpen()},l=Wl(n,"error",a);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),a(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Wl(t,"ping",this.onping.bind(this)),Wl(t,"data",this.ondata.bind(this)),Wl(t,"error",this.onerror.bind(this)),Wl(t,"close",this.onclose.bind(this)),Wl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){gT(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new KP(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ux={};function xT(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=$me(e,t.path||"/socket.io"),r=n.source,o=n.id,a=n.path,l=Ux[o]&&a in Ux[o].nsps,f=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let h;return f?h=new P8(r,t):(Ux[o]||(Ux[o]=new P8(r,t)),h=Ux[o]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(xT,{Manager:P8,Socket:KP,io:xT,connect:xT});const Fp=class Fp{constructor(){Pi(this,"socket",null);Pi(this,"isConnected",!1);Pi(this,"eventListeners",new Map)}static getInstance(){return Fp.instance||(Fp.instance=new Fp),Fp.instance}connect(t){return this.socket?this.socket:(this.socket=xT(`${dle}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,o;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(o=this.socket)==null||o.on(t,n)}off(t,n){var o;const r=this.eventListeners.get(t);if(r){const a=r.indexOf(n);a>-1&&r.splice(a,1),(o=this.socket)==null||o.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(o=>o(...n))}};Pi(Fp,"instance");let q8=Fp;const Wu=q8.getInstance(),Yme=({children:e,nameSpace:t})=>{const[n,r]=Z.useState(""),[o,a]=Z.useState([]),[l,f]=Z.useState(!1),[h,p]=Z.useState(!1),[v,m]=Z.useState([]),[x,_]=Z.useState(!1),[w,T]=Z.useState(!1),[E,k]=Z.useState([]),[R,O]=Nle(Vn(Rn.USER_INFO),null),[M,L]=Tx(Vn(Rn.IS_FORM_CLOSED_BY_USER),!1),[z,P]=xi.useState(null),G=hd("web-socket"),[J,U]=xi.useState([]),[K,ee]=Z.useState(null),[W,le]=Z.useState(!1),[ve,ce]=Z.useState(sessionStorage.getItem(Vn(Rn.LAST_SHOWN_MESSAGE_ID,{botId:t}))),re=vle(),xe=er(),[ke,B]=xi.useState(null),[Y,ie]=Z.useState(null);Z.useEffect(()=>{if(G){const it=Wu.connect("/api/v1/chat");ee(it);const Ke=()=>{console.debug("connected to websocket"),le(!0)},ot=()=>{console.debug("disconnected from websocket"),le(!1)},Je=mt=>{console.debug("response from websocket",mt);const ct=mt.conversationId??crypto.randomUUID().toString();ce(ct),mt.Variants_quantity&&k(ae=>[...ae,...mt.Variants_quantity]);const te=[...o,{text:mt.response,products:mt.products,conversationId:ct,rating:"neutral",leading_queries:mt.leading_queries,collections:mt.collections,variants:mt.variants,shop:mt.shop,Variants_quantity:mt.Variants_quantity,monthlyChatLimitReached:mt.monthlyChatLimitReached,isBot:!0}];a(te),F(te),m(ae=>[...ae,[o[o.length-1].text,mt.response]]),p(!1)},Lt=mt=>{if(mt.event==="error"){const ct={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},te=[...o,ct];a(te),F(te),p(!1)}};return Wu.on("connect",Ke),Wu.on("disconnect",ot),Wu.on("response",Je),Wu.on("system",Lt),()=>{Wu.off("connect",Ke),Wu.off("disconnect",ot),Wu.off("response",Je),Wu.off("system",Lt)}}},[G,o]);const F=it=>{sessionStorage.setItem(Vn(Rn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(it))},fe=()=>{const it=sessionStorage.getItem(Vn(Rn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return it?JSON.parse(it):[]},ze=Z.useCallback(async()=>{if(t)try{f(!0);const it=await fetch(`${Ci}/api/wordpress/UiData?value=${t}`),Ke=await it.json();if(!it.ok)throw new Error("failed to fetch data"+Ke.error);const ot=document.getElementById("debales-ai-assistant");ot&&(ot.style.zIndex=String(Ke.zIndex??2031483602)),ie(Ke),Ke!=null&&Ke.shopifyShopDomain&&Vle(Ke.shopifyShopDomain).then(Lt=>{B(Lt)}),U(Ke.suggestedQuestions);const Je=fe();if(Je.length>0)a(Je);else{const Lt={text:Ke.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};a([Lt])}}catch(it){console.error(it)}finally{f(!1)}},[t]);Z.useEffect(()=>{ze()},[ze]);const Ae=Z.useMemo(()=>{var it;return!!(!M&&((it=Y==null?void 0:Y.pluginConfig)!=null&&it.collectedUserInfo)&&(Y.pluginConfig.collectedUserInfo.name||Y.pluginConfig.collectedUserInfo.email||Y.pluginConfig.collectedUserInfo.phone)&&!R)},[Y,R,M]),Qe=Z.useCallback(async(it,Ke,ot,Je,Lt,mt)=>{if(!it||it.trim()===""||h&&!ot)return;let ct=[...o];Je?Je&&o.length<=2?(_(!0),ct=[]):_(!1):(ct.push({text:it,isBot:!1}),_(!1));const te=er();p(!0);try{a(ct),F(ct);const ae=await fetch(`${Ci}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:te,userMessage:it,nameSpace:t,chat_history:v,leading_queries:Lt,answer:Ke,products:ot,userInfo:JSON.stringify(R),anonymousUserId:re,distinctId:Yu.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:mt})});if(!ae.ok)throw new Error("Network response was not ok");const _e=await ae.json(),Se=_e.conversationId??crypto.randomUUID().toString();ce(Se),_e.Variants_quantity&&k(Fe=>[...Fe,..._e.Variants_quantity]);const je=[...ct,{text:_e.response,products:_e.products,conversationId:Se,rating:"neutral",leading_queries:_e.leading_queries,collections:_e.collections,variants:_e.variants,shop:_e.shop,Variants_quantity:_e.Variants_quantity,monthlyChatLimitReached:_e.monthlyChatLimitReached,isBot:!0}];a(je),F(je),m(Fe=>[...Fe,[it,_e.response]])}catch(ae){console.error(ae);const _e={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Se=[...ct,_e];Je||(a(Se),F(Se))}finally{p(!1)}},[o,h,v,t,re,R]),Ze=Z.useCallback(it=>{Y&&ie(Ke=>Ke?{...Ke,mobileDisplayMode:it}:null)},[Y]),ut=Z.useCallback(async(it,Ke,ot,Je,Lt,mt)=>{if(!it||it.trim()===""||h&&!ot)return;let ct=[...o];if(Je?Je&&o.length<=2?(_(!0),ct=[]):_(!1):(ct.push({text:it,isBot:!1}),_(!1)),p(!0),a(ct),F(ct),K&&W){const te={type:N0e.MESSAGE,role:z0e.USER,query:it,nameSpace:t,leadingQueries:Lt,answer:Ke,products:ot,userInfo:R,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:xe,anonymousUserId:re,distinctId:Yu.getDistinctId(),followUpQuestion:mt};Wu.emit("chat",te)}else Qe(it,Ke,ot,Je,Lt,mt)},[o,h,t,re,K,W,xe,Qe,R]),wt={sessionId:xe,messages:o,isLoading:l,isMessageLoading:h,isKlaviyoMessage:x,showUserInfoModel:w,pendingBulkItems:E,lastedBotmessageId:ve,uiData:Y,storeMetaData:ke,suggestedQuestions:J,isUserInfoNeeded:Ae,input:n,pendingQuestion:z,userInfo:R,isFormClosedByUser:M,onSendMessage:G?ut:Qe,setMessages:a,setIsLoading:f,setIsMessageLoading:p,setIsKlaviyoMessage:_,setShowUserInfoModel:T,setPendingBulkItems:k,setLastedBotmessageId:ce,fetchUiInfo:ze,changeDisplayModel:Ze,saveConversation:F,loadConversation:fe,setSuggestedQuestions:U,setUserInfo:O,setInput:r,setPendingQuestion:P,setIsFormClosedByUser:L};return I.jsx(aU.Provider,{value:wt,children:e})};function Zme(e){const t=R8.getInstance().getAdapter();return I.jsx(Yme,{nameSpace:e.botId,children:I.jsx(gZ,{apiKey:hle,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:Ci+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:zd.detect(),project:e.botId,sessionId:er()}),n.group("project",e.botId,{platform:zd.detect()});const r=No();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:I.jsx(Jge,{adapter:t,children:e.children})})})}function Qme(e){return I.jsx(I0e,{children:I.jsx(Zme,{botId:e.botId,children:I.jsx(M0e,{...e})})})}const cf=new Map;function bT(e){const{botId:t}=e;if(cf.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),cf.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const o=C5.createRoot(r);o.render(xi.createElement(Qme,{botId:e.botId}));const a={container:r,unmount:()=>{if(o.unmount(),cf.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(l){console.warn("Error removing chatbot container:",l)}}};return cf.set(t,a),a}typeof window<"u"&&(window.DebalesChatbotBrowser={init:bT,destroy:e=>{const t=cf.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>cf.has(e),getInitializedBots:()=>Array.from(cf.keys())});function WP(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!cf.has(r)&&bT({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!cf.has(r)&&bT({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",WP):WP()),Nc.initDebalesChatbot=bT,Object.defineProperty(Nc,Symbol.toStringTag,{value:"Module"}),Nc}({});
|
package/dist/module/ai.js
CHANGED
|
@@ -76905,12 +76905,33 @@ class Vpe extends r4 {
|
|
|
76905
76905
|
`Failed to fetch cart: ${o.status}`
|
|
76906
76906
|
);
|
|
76907
76907
|
const l = await o.json();
|
|
76908
|
+
if (!l.results || l.results === "")
|
|
76909
|
+
return this.createSuccessResult({
|
|
76910
|
+
items: [],
|
|
76911
|
+
total: 0,
|
|
76912
|
+
itemCount: 0,
|
|
76913
|
+
currency: "INR",
|
|
76914
|
+
token: ""
|
|
76915
|
+
});
|
|
76916
|
+
const d = l.results[0], h = d.products.map((p) => ({
|
|
76917
|
+
id: p.id_cart_product,
|
|
76918
|
+
quantity: p.quantity,
|
|
76919
|
+
properties: {
|
|
76920
|
+
size: p.size,
|
|
76921
|
+
color: p.color,
|
|
76922
|
+
brand: p.brand,
|
|
76923
|
+
subbrand: p.subbrand
|
|
76924
|
+
},
|
|
76925
|
+
title: p.name,
|
|
76926
|
+
price: p.unitproductprice,
|
|
76927
|
+
variant_id: p.id_product_attribute
|
|
76928
|
+
}));
|
|
76908
76929
|
return this.createSuccessResult({
|
|
76909
|
-
items:
|
|
76910
|
-
total:
|
|
76911
|
-
itemCount:
|
|
76912
|
-
currency:
|
|
76913
|
-
token: l.
|
|
76930
|
+
items: h,
|
|
76931
|
+
total: d.totalCartvalue,
|
|
76932
|
+
itemCount: h.length,
|
|
76933
|
+
currency: "INR",
|
|
76934
|
+
token: l.hash
|
|
76914
76935
|
});
|
|
76915
76936
|
} catch (n) {
|
|
76916
76937
|
return this.createErrorResult(
|
|
@@ -76926,8 +76947,8 @@ class Vpe extends r4 {
|
|
|
76926
76947
|
productId: o,
|
|
76927
76948
|
productAttributeId: 0,
|
|
76928
76949
|
size: l,
|
|
76929
|
-
customerId: parseInt(this.getCookie("
|
|
76930
|
-
cartId: parseInt(this.getCookie("
|
|
76950
|
+
customerId: parseInt(this.getCookie("DEVELOPMENT_CUSTOMER_ID") || "0"),
|
|
76951
|
+
cartId: parseInt(this.getCookie("DEVELOPMENT_CART_ID") || "0"),
|
|
76931
76952
|
version: 1.2,
|
|
76932
76953
|
buyNow: 0,
|
|
76933
76954
|
quantity: r,
|
package/dist/module/ai.umd.js
CHANGED
|
@@ -4823,4 +4823,4 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
4823
4823
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
4824
4824
|
* derived from CryptoJS.mode.CTR
|
|
4825
4825
|
* Jan Hruby jhruby.web@gmail.com
|
|
4826
|
-
*/return n.mode.CTRGladman=function(){var r=n.lib.BlockCipherMode.extend();function a(d){if((d>>24&255)===255){var h=d>>16&255,p=d>>8&255,y=d&255;h===255?(h=0,p===255?(p=0,y===255?y=0:++y):++p):++h,d=0,d+=h<<16,d+=p<<8,d+=y}else d+=1<<24;return d}function o(d){return(d[0]=a(d[0]))===0&&(d[1]=a(d[1])),d}var l=r.Encryptor=r.extend({processBlock:function(d,h){var p=this._cipher,y=p.blockSize,m=this._iv,x=this._counter;m&&(x=this._counter=m.slice(0),this._iv=void 0),o(x);var S=x.slice(0);p.encryptBlock(S,0);for(var C=0;C<y;C++)d[h+C]^=S[C]}});return r.Decryptor=l,r}(),n.mode.CTRGladman})}(P2)),P2.exports}var G2={exports:{}},Nde=G2.exports,VU;function zde(){return VU||(VU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Nde,function(n){return n.mode.OFB=function(){var r=n.lib.BlockCipherMode.extend(),a=r.Encryptor=r.extend({processBlock:function(o,l){var d=this._cipher,h=d.blockSize,p=this._iv,y=this._keystream;p&&(y=this._keystream=p.slice(0),this._iv=void 0),d.encryptBlock(y,0);for(var m=0;m<h;m++)o[l+m]^=y[m]}});return r.Decryptor=a,r}(),n.mode.OFB})}(G2)),G2.exports}var V2={exports:{}},Fde=V2.exports,YU;function Ude(){return YU||(YU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Fde,function(n){return n.mode.ECB=function(){var r=n.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(a,o){this._cipher.encryptBlock(a,o)}}),r.Decryptor=r.extend({processBlock:function(a,o){this._cipher.decryptBlock(a,o)}}),r}(),n.mode.ECB})}(V2)),V2.exports}var Y2={exports:{}},Hde=Y2.exports,ZU;function jde(){return ZU||(ZU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Hde,function(n){return n.pad.AnsiX923={pad:function(r,a){var o=r.sigBytes,l=a*4,d=l-o%l,h=o+d-1;r.clamp(),r.words[h>>>2]|=d<<24-h%4*8,r.sigBytes+=d},unpad:function(r){var a=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=a}},n.pad.Ansix923})}(Y2)),Y2.exports}var Z2={exports:{}},qde=Z2.exports,QU;function Pde(){return QU||(QU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(qde,function(n){return n.pad.Iso10126={pad:function(r,a){var o=a*4,l=o-r.sigBytes%o;r.concat(n.lib.WordArray.random(l-1)).concat(n.lib.WordArray.create([l<<24],1))},unpad:function(r){var a=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=a}},n.pad.Iso10126})}(Z2)),Z2.exports}var Q2={exports:{}},Gde=Q2.exports,KU;function Vde(){return KU||(KU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Gde,function(n){return n.pad.Iso97971={pad:function(r,a){r.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(r,a)},unpad:function(r){n.pad.ZeroPadding.unpad(r),r.sigBytes--}},n.pad.Iso97971})}(Q2)),Q2.exports}var K2={exports:{}},Yde=K2.exports,WU;function Zde(){return WU||(WU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Yde,function(n){return n.pad.ZeroPadding={pad:function(r,a){var o=a*4;r.clamp(),r.sigBytes+=o-(r.sigBytes%o||o)},unpad:function(r){for(var a=r.words,o=r.sigBytes-1,o=r.sigBytes-1;o>=0;o--)if(a[o>>>2]>>>24-o%4*8&255){r.sigBytes=o+1;break}}},n.pad.ZeroPadding})}(K2)),K2.exports}var W2={exports:{}},Qde=W2.exports,XU;function Kde(){return XU||(XU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Qde,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(W2)),W2.exports}var X2={exports:{}},Wde=X2.exports,JU;function Xde(){return JU||(JU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Wde,function(n){return function(r){var a=n,o=a.lib,l=o.CipherParams,d=a.enc,h=d.Hex,p=a.format;p.Hex={stringify:function(y){return y.ciphertext.toString(h)},parse:function(y){var m=h.parse(y);return l.create({ciphertext:m})}}}(),n.format.Hex})}(X2)),X2.exports}var J2={exports:{}},Jde=J2.exports,eH;function ehe(){return eH||(eH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(Jde,function(n){return function(){var r=n,a=r.lib,o=a.BlockCipher,l=r.algo,d=[],h=[],p=[],y=[],m=[],x=[],S=[],C=[],T=[],E=[];(function(){for(var O=[],R=0;R<256;R++)R<128?O[R]=R<<1:O[R]=R<<1^283;for(var z=0,L=0,R=0;R<256;R++){var P=L^L<<1^L<<2^L<<3^L<<4;P=P>>>8^P&255^99,d[z]=P,h[P]=z;var G=O[z],V=O[G],F=O[V],Z=O[P]*257^P*16843008;p[z]=Z<<24|Z>>>8,y[z]=Z<<16|Z>>>16,m[z]=Z<<8|Z>>>24,x[z]=Z;var Z=F*16843009^V*65537^G*257^z*16843008;S[P]=Z<<24|Z>>>8,C[P]=Z<<16|Z>>>16,T[P]=Z<<8|Z>>>24,E[P]=Z,z?(z=G^O[O[O[F^G]]],L^=O[O[L]]):z=L=1}})();var k=[0,1,2,4,8,16,32,64,128,27,54],D=l.AES=o.extend({_doReset:function(){var O;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var R=this._keyPriorReset=this._key,z=R.words,L=R.sigBytes/4,P=this._nRounds=L+6,G=(P+1)*4,V=this._keySchedule=[],F=0;F<G;F++)F<L?V[F]=z[F]:(O=V[F-1],F%L?L>6&&F%L==4&&(O=d[O>>>24]<<24|d[O>>>16&255]<<16|d[O>>>8&255]<<8|d[O&255]):(O=O<<8|O>>>24,O=d[O>>>24]<<24|d[O>>>16&255]<<16|d[O>>>8&255]<<8|d[O&255],O^=k[F/L|0]<<24),V[F]=V[F-L]^O);for(var Z=this._invKeySchedule=[],te=0;te<G;te++){var F=G-te;if(te%4)var O=V[F];else var O=V[F-4];te<4||F<=4?Z[te]=O:Z[te]=S[d[O>>>24]]^C[d[O>>>16&255]]^T[d[O>>>8&255]]^E[d[O&255]]}}},encryptBlock:function(O,R){this._doCryptBlock(O,R,this._keySchedule,p,y,m,x,d)},decryptBlock:function(O,R){var z=O[R+1];O[R+1]=O[R+3],O[R+3]=z,this._doCryptBlock(O,R,this._invKeySchedule,S,C,T,E,h);var z=O[R+1];O[R+1]=O[R+3],O[R+3]=z},_doCryptBlock:function(O,R,z,L,P,G,V,F){for(var Z=this._nRounds,te=O[R]^z[0],W=O[R+1]^z[1],oe=O[R+2]^z[2],me=O[R+3]^z[3],K=4,se=1;se<Z;se++){var xe=L[te>>>24]^P[W>>>16&255]^G[oe>>>8&255]^V[me&255]^z[K++],Oe=L[W>>>24]^P[oe>>>16&255]^G[me>>>8&255]^V[te&255]^z[K++],H=L[oe>>>24]^P[me>>>16&255]^G[te>>>8&255]^V[W&255]^z[K++],de=L[me>>>24]^P[te>>>16&255]^G[W>>>8&255]^V[oe&255]^z[K++];te=xe,W=Oe,oe=H,me=de}var xe=(F[te>>>24]<<24|F[W>>>16&255]<<16|F[oe>>>8&255]<<8|F[me&255])^z[K++],Oe=(F[W>>>24]<<24|F[oe>>>16&255]<<16|F[me>>>8&255]<<8|F[te&255])^z[K++],H=(F[oe>>>24]<<24|F[me>>>16&255]<<16|F[te>>>8&255]<<8|F[W&255])^z[K++],de=(F[me>>>24]<<24|F[te>>>16&255]<<16|F[W>>>8&255]<<8|F[oe&255])^z[K++];O[R]=xe,O[R+1]=Oe,O[R+2]=H,O[R+3]=de},keySize:256/32});r.AES=o._createHelper(D)}(),n.AES})}(J2)),J2.exports}var eA={exports:{}},the=eA.exports,tH;function nhe(){return tH||(tH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(the,function(n){return function(){var r=n,a=r.lib,o=a.WordArray,l=a.BlockCipher,d=r.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],y=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],m=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],x=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],S=d.DES=l.extend({_doReset:function(){for(var k=this._key,D=k.words,O=[],R=0;R<56;R++){var z=h[R]-1;O[R]=D[z>>>5]>>>31-z%32&1}for(var L=this._subKeys=[],P=0;P<16;P++){for(var G=L[P]=[],V=y[P],R=0;R<24;R++)G[R/6|0]|=O[(p[R]-1+V)%28]<<31-R%6,G[4+(R/6|0)]|=O[28+(p[R+24]-1+V)%28]<<31-R%6;G[0]=G[0]<<1|G[0]>>>31;for(var R=1;R<7;R++)G[R]=G[R]>>>(R-1)*4+3;G[7]=G[7]<<5|G[7]>>>27}for(var F=this._invSubKeys=[],R=0;R<16;R++)F[R]=L[15-R]},encryptBlock:function(k,D){this._doCryptBlock(k,D,this._subKeys)},decryptBlock:function(k,D){this._doCryptBlock(k,D,this._invSubKeys)},_doCryptBlock:function(k,D,O){this._lBlock=k[D],this._rBlock=k[D+1],C.call(this,4,252645135),C.call(this,16,65535),T.call(this,2,858993459),T.call(this,8,16711935),C.call(this,1,1431655765);for(var R=0;R<16;R++){for(var z=O[R],L=this._lBlock,P=this._rBlock,G=0,V=0;V<8;V++)G|=m[V][((P^z[V])&x[V])>>>0];this._lBlock=P,this._rBlock=L^G}var F=this._lBlock;this._lBlock=this._rBlock,this._rBlock=F,C.call(this,1,1431655765),T.call(this,8,16711935),T.call(this,2,858993459),C.call(this,16,65535),C.call(this,4,252645135),k[D]=this._lBlock,k[D+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function C(k,D){var O=(this._lBlock>>>k^this._rBlock)&D;this._rBlock^=O,this._lBlock^=O<<k}function T(k,D){var O=(this._rBlock>>>k^this._lBlock)&D;this._lBlock^=O,this._rBlock^=O<<k}r.DES=l._createHelper(S);var E=d.TripleDES=l.extend({_doReset:function(){var k=this._key,D=k.words;if(D.length!==2&&D.length!==4&&D.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var O=D.slice(0,2),R=D.length<4?D.slice(0,2):D.slice(2,4),z=D.length<6?D.slice(0,2):D.slice(4,6);this._des1=S.createEncryptor(o.create(O)),this._des2=S.createEncryptor(o.create(R)),this._des3=S.createEncryptor(o.create(z))},encryptBlock:function(k,D){this._des1.encryptBlock(k,D),this._des2.decryptBlock(k,D),this._des3.encryptBlock(k,D)},decryptBlock:function(k,D){this._des3.decryptBlock(k,D),this._des2.encryptBlock(k,D),this._des1.decryptBlock(k,D)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=l._createHelper(E)}(),n.TripleDES})}(eA)),eA.exports}var tA={exports:{}},rhe=tA.exports,nH;function ihe(){return nH||(nH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(rhe,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=l.RC4=o.extend({_doReset:function(){for(var y=this._key,m=y.words,x=y.sigBytes,S=this._S=[],C=0;C<256;C++)S[C]=C;for(var C=0,T=0;C<256;C++){var E=C%x,k=m[E>>>2]>>>24-E%4*8&255;T=(T+S[C]+k)%256;var D=S[C];S[C]=S[T],S[T]=D}this._i=this._j=0},_doProcessBlock:function(y,m){y[m]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var y=this._S,m=this._i,x=this._j,S=0,C=0;C<4;C++){m=(m+1)%256,x=(x+y[m])%256;var T=y[m];y[m]=y[x],y[x]=T,S|=y[(y[m]+y[x])%256]<<24-C*8}return this._i=m,this._j=x,S}r.RC4=o._createHelper(d);var p=l.RC4Drop=d.extend({cfg:d.cfg.extend({drop:192}),_doReset:function(){d._doReset.call(this);for(var y=this.cfg.drop;y>0;y--)h.call(this)}});r.RC4Drop=o._createHelper(p)}(),n.RC4})}(tA)),tA.exports}var nA={exports:{}},ahe=nA.exports,rH;function ohe(){return rH||(rH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(ahe,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=[],h=[],p=[],y=l.Rabbit=o.extend({_doReset:function(){for(var x=this._key.words,S=this.cfg.iv,C=0;C<4;C++)x[C]=(x[C]<<8|x[C]>>>24)&16711935|(x[C]<<24|x[C]>>>8)&4278255360;var T=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],E=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var C=0;C<4;C++)m.call(this);for(var C=0;C<8;C++)E[C]^=T[C+4&7];if(S){var k=S.words,D=k[0],O=k[1],R=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,z=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,L=R>>>16|z&4294901760,P=z<<16|R&65535;E[0]^=R,E[1]^=L,E[2]^=z,E[3]^=P,E[4]^=R,E[5]^=L,E[6]^=z,E[7]^=P;for(var C=0;C<4;C++)m.call(this)}},_doProcessBlock:function(x,S){var C=this._X;m.call(this),d[0]=C[0]^C[5]>>>16^C[3]<<16,d[1]=C[2]^C[7]>>>16^C[5]<<16,d[2]=C[4]^C[1]>>>16^C[7]<<16,d[3]=C[6]^C[3]>>>16^C[1]<<16;for(var T=0;T<4;T++)d[T]=(d[T]<<8|d[T]>>>24)&16711935|(d[T]<<24|d[T]>>>8)&4278255360,x[S+T]^=d[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,S=this._C,C=0;C<8;C++)h[C]=S[C];S[0]=S[0]+1295307597+this._b|0,S[1]=S[1]+3545052371+(S[0]>>>0<h[0]>>>0?1:0)|0,S[2]=S[2]+886263092+(S[1]>>>0<h[1]>>>0?1:0)|0,S[3]=S[3]+1295307597+(S[2]>>>0<h[2]>>>0?1:0)|0,S[4]=S[4]+3545052371+(S[3]>>>0<h[3]>>>0?1:0)|0,S[5]=S[5]+886263092+(S[4]>>>0<h[4]>>>0?1:0)|0,S[6]=S[6]+1295307597+(S[5]>>>0<h[5]>>>0?1:0)|0,S[7]=S[7]+3545052371+(S[6]>>>0<h[6]>>>0?1:0)|0,this._b=S[7]>>>0<h[7]>>>0?1:0;for(var C=0;C<8;C++){var T=x[C]+S[C],E=T&65535,k=T>>>16,D=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[C]=D^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.Rabbit=o._createHelper(y)}(),n.Rabbit})}(nA)),nA.exports}var rA={exports:{}},she=rA.exports,iH;function lhe(){return iH||(iH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(she,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=[],h=[],p=[],y=l.RabbitLegacy=o.extend({_doReset:function(){var x=this._key.words,S=this.cfg.iv,C=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],T=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var E=0;E<4;E++)m.call(this);for(var E=0;E<8;E++)T[E]^=C[E+4&7];if(S){var k=S.words,D=k[0],O=k[1],R=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,z=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,L=R>>>16|z&4294901760,P=z<<16|R&65535;T[0]^=R,T[1]^=L,T[2]^=z,T[3]^=P,T[4]^=R,T[5]^=L,T[6]^=z,T[7]^=P;for(var E=0;E<4;E++)m.call(this)}},_doProcessBlock:function(x,S){var C=this._X;m.call(this),d[0]=C[0]^C[5]>>>16^C[3]<<16,d[1]=C[2]^C[7]>>>16^C[5]<<16,d[2]=C[4]^C[1]>>>16^C[7]<<16,d[3]=C[6]^C[3]>>>16^C[1]<<16;for(var T=0;T<4;T++)d[T]=(d[T]<<8|d[T]>>>24)&16711935|(d[T]<<24|d[T]>>>8)&4278255360,x[S+T]^=d[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,S=this._C,C=0;C<8;C++)h[C]=S[C];S[0]=S[0]+1295307597+this._b|0,S[1]=S[1]+3545052371+(S[0]>>>0<h[0]>>>0?1:0)|0,S[2]=S[2]+886263092+(S[1]>>>0<h[1]>>>0?1:0)|0,S[3]=S[3]+1295307597+(S[2]>>>0<h[2]>>>0?1:0)|0,S[4]=S[4]+3545052371+(S[3]>>>0<h[3]>>>0?1:0)|0,S[5]=S[5]+886263092+(S[4]>>>0<h[4]>>>0?1:0)|0,S[6]=S[6]+1295307597+(S[5]>>>0<h[5]>>>0?1:0)|0,S[7]=S[7]+3545052371+(S[6]>>>0<h[6]>>>0?1:0)|0,this._b=S[7]>>>0<h[7]>>>0?1:0;for(var C=0;C<8;C++){var T=x[C]+S[C],E=T&65535,k=T>>>16,D=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[C]=D^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.RabbitLegacy=o._createHelper(y)}(),n.RabbitLegacy})}(rA)),rA.exports}var iA={exports:{}},uhe=iA.exports,aH;function che(){return aH||(aH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(uhe,function(n){return function(){var r=n,a=r.lib,o=a.BlockCipher,l=r.algo;const d=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],p=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var y={pbox:[],sbox:[]};function m(E,k){let D=k>>24&255,O=k>>16&255,R=k>>8&255,z=k&255,L=E.sbox[0][D]+E.sbox[1][O];return L=L^E.sbox[2][R],L=L+E.sbox[3][z],L}function x(E,k,D){let O=k,R=D,z;for(let L=0;L<d;++L)O=O^E.pbox[L],R=m(E,O)^R,z=O,O=R,R=z;return z=O,O=R,R=z,R=R^E.pbox[d],O=O^E.pbox[d+1],{left:O,right:R}}function S(E,k,D){let O=k,R=D,z;for(let L=d+1;L>1;--L)O=O^E.pbox[L],R=m(E,O)^R,z=O,O=R,R=z;return z=O,O=R,R=z,R=R^E.pbox[1],O=O^E.pbox[0],{left:O,right:R}}function C(E,k,D){for(let P=0;P<4;P++){E.sbox[P]=[];for(let G=0;G<256;G++)E.sbox[P][G]=p[P][G]}let O=0;for(let P=0;P<d+2;P++)E.pbox[P]=h[P]^k[O],O++,O>=D&&(O=0);let R=0,z=0,L=0;for(let P=0;P<d+2;P+=2)L=x(E,R,z),R=L.left,z=L.right,E.pbox[P]=R,E.pbox[P+1]=z;for(let P=0;P<4;P++)for(let G=0;G<256;G+=2)L=x(E,R,z),R=L.left,z=L.right,E.sbox[P][G]=R,E.sbox[P][G+1]=z;return!0}var T=l.Blowfish=o.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var E=this._keyPriorReset=this._key,k=E.words,D=E.sigBytes/4;C(y,k,D)}},encryptBlock:function(E,k){var D=x(y,E[k],E[k+1]);E[k]=D.left,E[k+1]=D.right},decryptBlock:function(E,k){var D=S(y,E[k],E[k+1]);E[k]=D.left,E[k+1]=D.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=o._createHelper(T)}(),n.Blowfish})}(iA)),iA.exports}var fhe=S2.exports,oH;function dhe(){return oH||(oH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),E2(),lde(),cde(),up(),hde(),cp(),MU(),JD(),yde(),$U(),_de(),wde(),Ede(),eO(),Tde(),Sd(),pa(),Rde(),Bde(),Lde(),zde(),Ude(),jde(),Pde(),Vde(),Zde(),Kde(),Xde(),ehe(),nhe(),ihe(),ohe(),lhe(),che())})(fhe,function(n){return n})}(S2)),S2.exports}var hhe=dhe();const phe=Jk(hhe);class ghe extends _2{constructor(){super(...arguments);$i(this,"platform",Hi.THE_COLLECTIVE);$i(this,"apiBaseURL","https://testapi.thecollective.in/")}getCookie(n){var o;const a=`; ${document.cookie}`.split(`; ${n}=`);return a.length===2&&((o=a.pop())==null?void 0:o.split(";").shift())||null}generateHash(n){const r=JSON.parse(JSON.stringify(n));return delete r.hash,phe.MD5(JSON.stringify(r)).toString()}async fetchCart(){try{const n={storeId:0,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),page:"cartSummary",device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},r=this.generateHash(n),a={...n,hash:r,validateHash:!0},o=await fetch(`${this.apiBaseURL}cart/getCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(a)});if(!o.ok)return this.createErrorResult(`Failed to fetch cart: ${o.status}`);const l=await o.json();return this.createSuccessResult({items:l.items||[],total:l.total||0,itemCount:l.itemCount||0,currency:l.currency||"INR",token:l.token||""})}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}async addToCart(n,r=1,a){try{const o=n,l=a!=null&&a.size?parseInt(a.size):0,d=new URLSearchParams;d.append("dbls_order_source","direct_recommendation"),d.append("dbls_session_id",Kn()),d.append("dbls_method","add_to_cart"),d.append("utm_source","debales_chatbot");const h={productId:o,productAttributeId:0,size:l,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),version:1.2,buyNow:0,quantity:r,oldAttributeId:0,wishlistDeleteFlag:0,cartOperation:"add",storeId:0,utmSource:d.toString(),sliderSource:"",page:"cartSummary",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},p=this.generateHash(h),y={...h,hash:p,validateHash:!0},m=await fetch(`${this.apiBaseURL}cart/addToCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(y)});return m.ok?this.createSuccessResult(void 0,"Item added to cart successfully"):this.createErrorResult(`Failed to add item to cart: ${m.status}`)}catch(o){return this.createErrorResult(o instanceof Error?o.message:"Unknown error")}}async removeFromCart(n){try{const r={customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),productId:n,storeId:0,productAttributeId:0,device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},a=this.generateHash(r),o={...r,hash:a,validateHash:!0},l=await fetch(`${this.apiBaseURL}cart/deleteCartProduct`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(o)});return l.ok?this.createSuccessResult(void 0,"Item removed from cart successfully"):this.createErrorResult(`Failed to remove item from cart: ${l.status}`)}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async updateQuantity(n){try{return console.log("TheCollectiveCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async clearCart(){try{return console.log("TheCollectiveCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}generateCartUrl(n){const r=nde(n);if(!r.isValid)return"";const a=new URL("/checkoutsummary",r.url);return a.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),a.searchParams.append("attributes[from]","debales-ai-chatbot"),a.searchParams.append("attributes[through]","add-to-cart"),a.searchParams.append("attributes[dbls_session_id]",Kn()),a.searchParams.append("timestamp",Date.now().toString()),Uc(a.toString())}generateProductUrl(n,r){const a=new URL(r.link);return a.host=n,Uc(a.toString())}async addCartAttributes(n={}){try{return console.log("TheCollectiveCartAdapter: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}}const fp=class fp{constructor(){$i(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return fp.instance||(fp.instance=new fp),fp.instance}getAdapter(t){const n=t||bd.detect(),r=this.adapterCache.get(n);if(r)return r;let a;switch(n){case Hi.SHOPIFY:a=new Xfe;break;case Hi.MAGENTO:a=new Jfe;break;case Hi.THE_COLLECTIVE:a=new ghe;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),a=new Wfe}return this.adapterCache.set(n,a),a}clearCache(){this.adapterCache.clear()}};$i(fp,"instance");let tO=fp;const mhe=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,a]=ie.useState(!1),[o,l]=ie.useState(null),[d,h]=ie.useState(null),p=ie.useCallback(async()=>{try{a(!0),l(null);const D=await e.fetchCart();D.success?h(D.data):l(D.error)}catch(D){l(D instanceof Error?D.message:"Failed to fetch cart")}finally{a(!1)}},[e]),y=async(D,O,R)=>{try{l(null);const z=await e.addToCart(D,O,R);return z.success&&await p(),z}catch(z){return{success:!1,error:z instanceof Error?z.message:"Failed to add item to cart"}}},m=async D=>{try{l(null);const O=await e.removeFromCart(D);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to remove item from cart"}}},x=async D=>{try{l(null);const O=await e.updateQuantity(D);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to update quantity"}}},S=async()=>{try{l(null);const D=await e.clearCart();return D.success&&await p(),D}catch(D){return{success:!1,error:D instanceof Error?D.message:"Failed to clear cart"}}},C=D=>e.generateCartUrl(D),T=(D,O)=>e.generateProductUrl(D,O),E=async D=>e.addCartAttributes(D);ie.useEffect(()=>{n&&p()},[n,p]);const k={isLoading:r,error:o,cart:d,fetchCart:p,addToCart:y,removeFromCart:m,updateQuantity:x,clearCart:S,generateCartUrl:C,generateProductUrl:T,addCartAttributes:E};return I.jsx(n7.Provider,{value:k,children:t})},Ou=Object.create(null);Ou.open="0",Ou.close="1",Ou.ping="2",Ou.pong="3",Ou.message="4",Ou.upgrade="5",Ou.noop="6";const aA=Object.create(null);Object.keys(Ou).forEach(e=>{aA[Ou[e]]=e});const nO={type:"error",data:"parser error"},sH=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",lH=typeof ArrayBuffer=="function",uH=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,rO=({type:e,data:t},n,r)=>sH&&t instanceof Blob?n?r(t):cH(t,r):lH&&(t instanceof ArrayBuffer||uH(t))?n?r(t):cH(new Blob([t]),r):r(Ou[e]+(t||"")),cH=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function fH(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let iO;function vhe(e,t){if(sH&&e.data instanceof Blob)return e.data.arrayBuffer().then(fH).then(t);if(lH&&(e.data instanceof ArrayBuffer||uH(e.data)))return t(fH(e.data));rO(e,!1,n=>{iO||(iO=new TextEncoder),t(iO.encode(n))})}const dH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ax=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<dH.length;e++)ax[dH.charCodeAt(e)]=e;const yhe=e=>{let t=e.length*.75,n=e.length,r,a=0,o,l,d,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),y=new Uint8Array(p);for(r=0;r<n;r+=4)o=ax[e.charCodeAt(r)],l=ax[e.charCodeAt(r+1)],d=ax[e.charCodeAt(r+2)],h=ax[e.charCodeAt(r+3)],y[a++]=o<<2|l>>4,y[a++]=(l&15)<<4|d>>2,y[a++]=(d&3)<<6|h&63;return p},xhe=typeof ArrayBuffer=="function",aO=(e,t)=>{if(typeof e!="string")return{type:"message",data:hH(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:bhe(e.substring(1),t)}:aA[n]?e.length>1?{type:aA[n],data:e.substring(1)}:{type:aA[n]}:nO},bhe=(e,t)=>{if(xhe){const n=yhe(e);return hH(n,t)}else return{base64:!0,data:e}},hH=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},pH="",_he=(e,t)=>{const n=e.length,r=new Array(n);let a=0;e.forEach((o,l)=>{rO(o,!1,d=>{r[l]=d,++a===n&&t(r.join(pH))})})},She=(e,t)=>{const n=e.split(pH),r=[];for(let a=0;a<n.length;a++){const o=aO(n[a],t);if(r.push(o),o.type==="error")break}return r};function whe(){return new TransformStream({transform(e,t){vhe(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const o=new DataView(a.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{a=new Uint8Array(9);const o=new DataView(a.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let oO;function oA(e){return e.reduce((t,n)=>t+n.length,0)}function sA(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=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 Che(e,t){oO||(oO=new TextDecoder);const n=[];let r=0,a=-1,o=!1;return new TransformStream({transform(l,d){for(n.push(l);;){if(r===0){if(oA(n)<1)break;const h=sA(n,1);o=(h[0]&128)===128,a=h[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(oA(n)<2)break;const h=sA(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(oA(n)<8)break;const h=sA(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(nO);break}a=y*Math.pow(2,32)+p.getUint32(4),r=3}else{if(oA(n)<a)break;const h=sA(n,a);d.enqueue(aO(o?h:oO.decode(h),t)),r=0}if(a===0||a>e){d.enqueue(nO);break}}}})}const gH=4;function ji(e){if(e)return Ehe(e)}function Ehe(e){for(var t in ji.prototype)e[t]=ji.prototype[t];return e}ji.prototype.on=ji.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ji.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ji.prototype.off=ji.prototype.removeListener=ji.prototype.removeAllListeners=ji.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===t||r.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this},ji.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,t)}return this},ji.prototype.emitReserved=ji.prototype.emit,ji.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ji.prototype.hasListeners=function(e){return!!this.listeners(e).length};const lA=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),js=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ahe="arraybuffer";function B0e(){}function mH(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const khe=js.setTimeout,The=js.clearTimeout;function uA(e,t){t.useNativeTimers?(e.setTimeoutFn=khe.bind(js),e.clearTimeoutFn=The.bind(js)):(e.setTimeoutFn=js.setTimeout.bind(js),e.clearTimeoutFn=js.clearTimeout.bind(js))}const Dhe=1.33;function Ohe(e){return typeof e=="string"?Mhe(e):Math.ceil((e.byteLength||e.size)*Dhe)}function Mhe(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function vH(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Rhe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Ihe(e){let t={},n=e.split("&");for(let r=0,a=n.length;r<a;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class Bhe extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class sO extends ji{constructor(t){super(),this.writable=!1,uA(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new Bhe(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=aO(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Rhe(t);return n.length?"?"+n:""}}class $he extends sO{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};She(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,_he(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=vH()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let yH=!1;try{yH=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Lhe=yH;function Nhe(){}class zhe extends $he{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(a,o)=>{this.onError("xhr post error",a,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Mu extends ji{constructor(t,n,r){super(),this.createRequest=t,uA(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=mH(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Mu.requestsCount++,Mu.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Nhe,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Mu.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Mu.requestsCount=0,Mu.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",xH);else if(typeof addEventListener=="function"){const e="onpagehide"in js?"pagehide":"unload";addEventListener(e,xH,!1)}}function xH(){for(let e in Mu.requests)Mu.requests.hasOwnProperty(e)&&Mu.requests[e].abort()}const Fhe=function(){const e=bH({xdomain:!1});return e&&e.responseType!==null}();class Uhe extends zhe{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Fhe&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mu(bH,this.uri(),t)}}function bH(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Lhe))return new XMLHttpRequest}catch{}if(!t)try{return new js[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const _H=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Hhe extends sO{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=_H?{}:mH(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;rO(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}a&&lA(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=vH()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lO=js.WebSocket||js.MozWebSocket;class jhe extends Hhe{createSocket(t,n,r){return _H?new lO(t,n,r):n?new lO(t,n):new lO(t)}doWrite(t,n){this.ws.send(n)}}class qhe extends sO{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Che(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),a=whe();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const o=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),o())}).catch(d=>{})};o();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this._writer.write(l).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;this._writer.write(r).then(()=>{a&&lA(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Phe={websocket:jhe,webtransport:qhe,polling:Uhe},Ghe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Vhe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uO(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let a=Ghe.exec(e||""),o={},l=14;for(;l--;)o[Vhe[l]]=a[l]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Yhe(o,o.path),o.queryKey=Zhe(o,o.query),o}function Yhe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Zhe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,o){a&&(n[a]=o)}),n}const cO=typeof addEventListener=="function"&&typeof removeEventListener=="function",cA=[];cO&&addEventListener("offline",()=>{cA.forEach(e=>e())},!1);class wd extends ji{constructor(t,n){if(super(),this.binaryType=Ahe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=uO(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uO(n.host).host);uA(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),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},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ihe(this.opts.query)),cO&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},cA.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=gH,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&wd.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",wd.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=Ohe(a)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,lA(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(wd.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),cO&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=cA.indexOf(this._offlineEventListener);r!==-1&&cA.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}wd.protocol=gH;class Qhe extends wd{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;wd.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;wd.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function o(){r||(r=!0,y(),n.close(),n=null)}const l=m=>{const x=new Error("probe error: "+m);x.transport=n.name,o(),this.emitReserved("upgradeError",x)};function d(){l("transport closed")}function h(){l("socket closed")}function p(m){n&&m.name!==n.name&&o()}const y=()=>{n.removeListener("open",a),n.removeListener("error",l),n.removeListener("close",d),this.off("close",h),this.off("upgrading",p)};n.once("open",a),n.once("error",l),n.once("close",d),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Khe=class extends Qhe{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(a=>Phe[a]).filter(a=>!!a)),super(t,r)}};function Whe(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=uO(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 o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const Xhe=typeof ArrayBuffer=="function",Jhe=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,SH=Object.prototype.toString,epe=typeof Blob=="function"||typeof Blob<"u"&&SH.call(Blob)==="[object BlobConstructor]",tpe=typeof File=="function"||typeof File<"u"&&SH.call(File)==="[object FileConstructor]";function fO(e){return Xhe&&(e instanceof ArrayBuffer||Jhe(e))||epe&&e instanceof Blob||tpe&&e instanceof File}function fA(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(fA(e[n]))return!0;return!1}if(fO(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return fA(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&fA(e[n]))return!0;return!1}function npe(e){const t=[],n=e.data,r=e;return r.data=dO(n,t),r.attachments=t.length,{packet:r,buffers:t}}function dO(e,t){if(!e)return e;if(fO(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=dO(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=dO(e[r],t));return n}return e}function rpe(e,t){return e.data=hO(e.data,t),delete e.attachments,e}function hO(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=hO(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=hO(e[n],t));return e}const ipe=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ape=5;var jn;(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"})(jn||(jn={}));class ope{constructor(t){this.replacer=t}encode(t){return(t.type===jn.EVENT||t.type===jn.ACK)&&fA(t)?this.encodeAsBinary({type:t.type===jn.EVENT?jn.BINARY_EVENT:jn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===jn.BINARY_EVENT||t.type===jn.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=npe(t),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}function wH(e){return Object.prototype.toString.call(e)==="[object Object]"}class pO extends ji{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===jn.BINARY_EVENT;r||n.type===jn.BINARY_ACK?(n.type=r?jn.EVENT:jn.ACK,this.reconstructor=new spe(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fO(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(jn[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===jn.BINARY_EVENT||r.type===jn.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const l=t.substring(o,n);if(l!=Number(l)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(l)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const o=n+1;for(;++n;){const l=t.charAt(n);if(l==null||Number(l)!=l){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(pO.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case jn.CONNECT:return wH(n);case jn.DISCONNECT:return n===void 0;case jn.CONNECT_ERROR:return typeof n=="string"||wH(n);case jn.EVENT:case jn.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ipe.indexOf(n[0])===-1);case jn.ACK:case jn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class spe{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=rpe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lpe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pO,Encoder:ope,get PacketType(){return jn},protocol:ape},Symbol.toStringTag,{value:"Module"}));function Ul(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const upe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class CH extends ji{constructor(t,n,r){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=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ul(t,"open",this.onopen.bind(this)),Ul(t,"packet",this.onpacket.bind(this)),Ul(t,"error",this.onerror.bind(this)),Ul(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,a,o;if(upe.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const l={type:jn.EVENT,data:n};if(l.options={},l.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,m=n.pop();this._registerAckCallback(y,m),l.id=y}const d=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(l),this.packet(l)):this.sendBuffer.push(l)),this.flags={},this}_registerAckCallback(t,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===t&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},a),l=(...d)=>{this.io.clearTimeoutFn(o),n.apply(this,d)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,a)=>{const o=(l,d)=>l?a(l):r(d);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...o)=>r!==this._queue[0]?void 0:(a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:jn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case jn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new 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 jn.EVENT:case jn.BINARY_EVENT:this.onevent(t);break;case jn.ACK:case jn.BINARY_ACK:this.onack(t);break;case jn.DISCONNECT:this.ondisconnect();break;case jn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:jn.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:jn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function im(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}im.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=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},im.prototype.reset=function(){this.attempts=0},im.prototype.setMin=function(e){this.ms=e},im.prototype.setMax=function(e){this.max=e},im.prototype.setJitter=function(e){this.jitter=e};class gO extends ji{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,uA(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new im({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||lpe;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Khe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Ul(n,"open",function(){r.onopen(),t&&t()}),o=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),t?t(d):this.maybeReconnectOnOpen()},l=Ul(n,"error",o);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{a(),o(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ul(t,"ping",this.onping.bind(this)),Ul(t,"data",this.ondata.bind(this)),Ul(t,"error",this.onerror.bind(this)),Ul(t,"close",this.onclose.bind(this)),Ul(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){lA(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new CH(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ox={};function dA(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Whe(e,t.path||"/socket.io"),r=n.source,a=n.id,o=n.path,l=ox[a]&&o in ox[a].nsps,d=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let h;return d?h=new gO(r,t):(ox[a]||(ox[a]=new gO(r,t)),h=ox[a]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(dA,{Manager:gO,Socket:CH,io:dA,connect:dA});const dp=class dp{constructor(){$i(this,"socket",null);$i(this,"isConnected",!1);$i(this,"eventListeners",new Map)}static getInstance(){return dp.instance||(dp.instance=new dp),dp.instance}connect(t){return this.socket?this.socket:(this.socket=dA(`${wie}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,a;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(a=this.socket)==null||a.on(t,n)}off(t,n){var a;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(a=this.socket)==null||a.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(a=>a(...n))}};$i(dp,"instance");let mO=dp;const Ru=mO.getInstance(),cpe=({children:e,nameSpace:t})=>{const[n,r]=ie.useState(""),[a,o]=ie.useState([]),[l,d]=ie.useState(!1),[h,p]=ie.useState(!1),[y,m]=ie.useState([]),[x,S]=ie.useState(!1),[C,T]=ie.useState(!1),[E,k]=ie.useState([]),[D,O]=Zie(zn(Sn.USER_INFO),null),[R,z]=Y1(zn(Sn.IS_FORM_CLOSED_BY_USER),!1),[L,P]=ie.useState(null),G=Wf("web-socket"),[V,F]=ie.useState([]),[Z,te]=ie.useState(null),[W,oe]=ie.useState(!1),[me,K]=ie.useState(sessionStorage.getItem(zn(Sn.LAST_SHOWN_MESSAGE_ID,{botId:t}))),se=Tie(),xe=Kn(),[Oe,H]=ie.useState(null),[de,ce]=ie.useState(null);ie.useEffect(()=>{if(G){const ct=Ru.connect("/api/v1/chat");te(ct);const Xe=()=>{console.debug("connected to websocket"),oe(!0)},Je=()=>{console.debug("disconnected from websocket"),oe(!1)},We=ot=>{console.debug("response from websocket",ot);const xt=ot.conversationId??crypto.randomUUID().toString();K(xt),ot.Variants_quantity&&k(ae=>[...ae,...ot.Variants_quantity]);const ee=[...a,{text:ot.response,products:ot.products,conversationId:xt,rating:"neutral",leading_queries:ot.leading_queries,collections:ot.collections,variants:ot.variants,shop:ot.shop,Variants_quantity:ot.Variants_quantity,monthlyChatLimitReached:ot.monthlyChatLimitReached,isBot:!0}];o(ee),q(ee),m(ae=>[...ae,[a[a.length-1].text,ot.response]]),p(!1)},$t=ot=>{if(ot.event==="error"){const xt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},ee=[...a,xt];o(ee),q(ee),p(!1)}};return Ru.on("connect",Xe),Ru.on("disconnect",Je),Ru.on("response",We),Ru.on("system",$t),()=>{Ru.off("connect",Xe),Ru.off("disconnect",Je),Ru.off("response",We),Ru.off("system",$t)}}},[G,a]);const q=ct=>{sessionStorage.setItem(zn(Sn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(ct))},ye=()=>{const ct=sessionStorage.getItem(zn(Sn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return ct?JSON.parse(ct):[]},Qe=ie.useCallback(async()=>{if(t)try{d(!0);const ct=await fetch(`${yi}/api/wordpress/UiData?value=${t}`),Xe=await ct.json();if(!ct.ok)throw new Error("failed to fetch data"+Xe.error);const Je=document.getElementById("debales-ai-assistant");Je&&(Je.style.zIndex=String(Xe.zIndex??2031483602)),ce(Xe),Xe!=null&&Xe.shopifyShopDomain&&rae(Xe.shopifyShopDomain).then($t=>{H($t)}),F(Xe.suggestedQuestions);const We=ye();if(We.length>0)o(We);else{const $t={text:Xe.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([$t])}}catch(ct){console.error(ct)}finally{d(!1)}},[t]);ie.useEffect(()=>{Qe()},[Qe]);const Me=ie.useMemo(()=>{var ct;return!!(!R&&((ct=de==null?void 0:de.pluginConfig)!=null&&ct.collectedUserInfo)&&(de.pluginConfig.collectedUserInfo.name||de.pluginConfig.collectedUserInfo.email||de.pluginConfig.collectedUserInfo.phone)&&!D)},[de,D,R]),pt=ie.useCallback(async(ct,Xe,Je,We,$t,ot)=>{if(!ct||ct.trim()===""||h&&!Je)return;let xt=[...a];We?We&&a.length<=2?(S(!0),xt=[]):S(!1):(xt.push({text:ct,isBot:!1}),S(!1));const ee=Kn();p(!0);try{o(xt),q(xt);const ae=await fetch(`${yi}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ee,userMessage:ct,nameSpace:t,chat_history:y,leading_queries:$t,answer:Xe,products:Je,userInfo:JSON.stringify(D),anonymousUserId:se,distinctId:Tu.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:ot})});if(!ae.ok)throw new Error("Network response was not ok");const ve=await ae.json(),Ce=ve.conversationId??crypto.randomUUID().toString();K(Ce),ve.Variants_quantity&&k(Ne=>[...Ne,...ve.Variants_quantity]);const Ue=[...xt,{text:ve.response,products:ve.products,conversationId:Ce,rating:"neutral",leading_queries:ve.leading_queries,collections:ve.collections,variants:ve.variants,shop:ve.shop,Variants_quantity:ve.Variants_quantity,monthlyChatLimitReached:ve.monthlyChatLimitReached,isBot:!0}];o(Ue),q(Ue),m(Ne=>[...Ne,[ct,ve.response]])}catch(ae){console.error(ae);const ve={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Ce=[...xt,ve];We||(o(Ce),q(Ce))}finally{p(!1)}},[a,h,y,t,se,D]),Ke=ie.useCallback(ct=>{de&&ce(Xe=>Xe?{...Xe,mobileDisplayMode:ct}:null)},[de]),wt=ie.useCallback(async(ct,Xe,Je,We,$t,ot)=>{if(!ct||ct.trim()===""||h&&!Je)return;let xt=[...a];if(We?We&&a.length<=2?(S(!0),xt=[]):S(!1):(xt.push({text:ct,isBot:!1}),S(!1)),p(!0),o(xt),q(xt),Z&&W){const ee={type:ede.MESSAGE,role:tde.USER,query:ct,nameSpace:t,leadingQueries:$t,answer:Xe,products:Je,userInfo:D,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:xe,anonymousUserId:se,distinctId:Tu.getDistinctId(),followUpQuestion:ot};Ru.emit("chat",ee)}else pt(ct,Xe,Je,We,$t,ot)},[a,h,t,se,Z,W,xe,pt,D]),kt={sessionId:xe,messages:a,isLoading:l,isMessageLoading:h,isKlaviyoMessage:x,showUserInfoModel:C,pendingBulkItems:E,lastedBotmessageId:me,uiData:de,storeMetaData:Oe,suggestedQuestions:V,isUserInfoNeeded:Me,input:n,pendingQuestion:L,userInfo:D,isFormClosedByUser:R,onSendMessage:G?wt:pt,setMessages:o,setIsLoading:d,setIsMessageLoading:p,setIsKlaviyoMessage:S,setShowUserInfoModel:T,setPendingBulkItems:k,setLastedBotmessageId:K,fetchUiInfo:Qe,changeDisplayModel:Ke,saveConversation:q,loadConversation:ye,setSuggestedQuestions:F,setUserInfo:O,setInput:r,setPendingQuestion:P,setIsFormClosedByUser:z};return I.jsx(k7.Provider,{value:kt,children:e})};function fpe(e){const t=tO.getInstance().getAdapter();return I.jsx(cpe,{nameSpace:e.botId,children:I.jsx(BG,{apiKey:Cie,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:yi+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:bd.detect(),project:e.botId,sessionId:Kn()}),n.group("project",e.botId,{platform:bd.detect()});const r=Aa();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:I.jsx(mhe,{adapter:t,children:e.children})})})}function dpe(e){return I.jsx(Kfe,{children:I.jsx(fpe,{botId:e.botId,children:I.jsx(qfe,{...e})})})}return dpe});
|
|
4826
|
+
*/return n.mode.CTRGladman=function(){var r=n.lib.BlockCipherMode.extend();function a(d){if((d>>24&255)===255){var h=d>>16&255,p=d>>8&255,y=d&255;h===255?(h=0,p===255?(p=0,y===255?y=0:++y):++p):++h,d=0,d+=h<<16,d+=p<<8,d+=y}else d+=1<<24;return d}function o(d){return(d[0]=a(d[0]))===0&&(d[1]=a(d[1])),d}var l=r.Encryptor=r.extend({processBlock:function(d,h){var p=this._cipher,y=p.blockSize,m=this._iv,x=this._counter;m&&(x=this._counter=m.slice(0),this._iv=void 0),o(x);var S=x.slice(0);p.encryptBlock(S,0);for(var C=0;C<y;C++)d[h+C]^=S[C]}});return r.Decryptor=l,r}(),n.mode.CTRGladman})}(P2)),P2.exports}var G2={exports:{}},Nde=G2.exports,VU;function zde(){return VU||(VU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Nde,function(n){return n.mode.OFB=function(){var r=n.lib.BlockCipherMode.extend(),a=r.Encryptor=r.extend({processBlock:function(o,l){var d=this._cipher,h=d.blockSize,p=this._iv,y=this._keystream;p&&(y=this._keystream=p.slice(0),this._iv=void 0),d.encryptBlock(y,0);for(var m=0;m<h;m++)o[l+m]^=y[m]}});return r.Decryptor=a,r}(),n.mode.OFB})}(G2)),G2.exports}var V2={exports:{}},Fde=V2.exports,YU;function Ude(){return YU||(YU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Fde,function(n){return n.mode.ECB=function(){var r=n.lib.BlockCipherMode.extend();return r.Encryptor=r.extend({processBlock:function(a,o){this._cipher.encryptBlock(a,o)}}),r.Decryptor=r.extend({processBlock:function(a,o){this._cipher.decryptBlock(a,o)}}),r}(),n.mode.ECB})}(V2)),V2.exports}var Y2={exports:{}},Hde=Y2.exports,ZU;function jde(){return ZU||(ZU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Hde,function(n){return n.pad.AnsiX923={pad:function(r,a){var o=r.sigBytes,l=a*4,d=l-o%l,h=o+d-1;r.clamp(),r.words[h>>>2]|=d<<24-h%4*8,r.sigBytes+=d},unpad:function(r){var a=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=a}},n.pad.Ansix923})}(Y2)),Y2.exports}var Z2={exports:{}},qde=Z2.exports,QU;function Pde(){return QU||(QU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(qde,function(n){return n.pad.Iso10126={pad:function(r,a){var o=a*4,l=o-r.sigBytes%o;r.concat(n.lib.WordArray.random(l-1)).concat(n.lib.WordArray.create([l<<24],1))},unpad:function(r){var a=r.words[r.sigBytes-1>>>2]&255;r.sigBytes-=a}},n.pad.Iso10126})}(Z2)),Z2.exports}var Q2={exports:{}},Gde=Q2.exports,KU;function Vde(){return KU||(KU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Gde,function(n){return n.pad.Iso97971={pad:function(r,a){r.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(r,a)},unpad:function(r){n.pad.ZeroPadding.unpad(r),r.sigBytes--}},n.pad.Iso97971})}(Q2)),Q2.exports}var K2={exports:{}},Yde=K2.exports,WU;function Zde(){return WU||(WU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Yde,function(n){return n.pad.ZeroPadding={pad:function(r,a){var o=a*4;r.clamp(),r.sigBytes+=o-(r.sigBytes%o||o)},unpad:function(r){for(var a=r.words,o=r.sigBytes-1,o=r.sigBytes-1;o>=0;o--)if(a[o>>>2]>>>24-o%4*8&255){r.sigBytes=o+1;break}}},n.pad.ZeroPadding})}(K2)),K2.exports}var W2={exports:{}},Qde=W2.exports,XU;function Kde(){return XU||(XU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Qde,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(W2)),W2.exports}var X2={exports:{}},Wde=X2.exports,JU;function Xde(){return JU||(JU=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),pa())})(Wde,function(n){return function(r){var a=n,o=a.lib,l=o.CipherParams,d=a.enc,h=d.Hex,p=a.format;p.Hex={stringify:function(y){return y.ciphertext.toString(h)},parse:function(y){var m=h.parse(y);return l.create({ciphertext:m})}}}(),n.format.Hex})}(X2)),X2.exports}var J2={exports:{}},Jde=J2.exports,eH;function ehe(){return eH||(eH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(Jde,function(n){return function(){var r=n,a=r.lib,o=a.BlockCipher,l=r.algo,d=[],h=[],p=[],y=[],m=[],x=[],S=[],C=[],T=[],E=[];(function(){for(var O=[],R=0;R<256;R++)R<128?O[R]=R<<1:O[R]=R<<1^283;for(var z=0,L=0,R=0;R<256;R++){var P=L^L<<1^L<<2^L<<3^L<<4;P=P>>>8^P&255^99,d[z]=P,h[P]=z;var G=O[z],V=O[G],F=O[V],Z=O[P]*257^P*16843008;p[z]=Z<<24|Z>>>8,y[z]=Z<<16|Z>>>16,m[z]=Z<<8|Z>>>24,x[z]=Z;var Z=F*16843009^V*65537^G*257^z*16843008;S[P]=Z<<24|Z>>>8,C[P]=Z<<16|Z>>>16,T[P]=Z<<8|Z>>>24,E[P]=Z,z?(z=G^O[O[O[F^G]]],L^=O[O[L]]):z=L=1}})();var k=[0,1,2,4,8,16,32,64,128,27,54],D=l.AES=o.extend({_doReset:function(){var O;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var R=this._keyPriorReset=this._key,z=R.words,L=R.sigBytes/4,P=this._nRounds=L+6,G=(P+1)*4,V=this._keySchedule=[],F=0;F<G;F++)F<L?V[F]=z[F]:(O=V[F-1],F%L?L>6&&F%L==4&&(O=d[O>>>24]<<24|d[O>>>16&255]<<16|d[O>>>8&255]<<8|d[O&255]):(O=O<<8|O>>>24,O=d[O>>>24]<<24|d[O>>>16&255]<<16|d[O>>>8&255]<<8|d[O&255],O^=k[F/L|0]<<24),V[F]=V[F-L]^O);for(var Z=this._invKeySchedule=[],te=0;te<G;te++){var F=G-te;if(te%4)var O=V[F];else var O=V[F-4];te<4||F<=4?Z[te]=O:Z[te]=S[d[O>>>24]]^C[d[O>>>16&255]]^T[d[O>>>8&255]]^E[d[O&255]]}}},encryptBlock:function(O,R){this._doCryptBlock(O,R,this._keySchedule,p,y,m,x,d)},decryptBlock:function(O,R){var z=O[R+1];O[R+1]=O[R+3],O[R+3]=z,this._doCryptBlock(O,R,this._invKeySchedule,S,C,T,E,h);var z=O[R+1];O[R+1]=O[R+3],O[R+3]=z},_doCryptBlock:function(O,R,z,L,P,G,V,F){for(var Z=this._nRounds,te=O[R]^z[0],W=O[R+1]^z[1],oe=O[R+2]^z[2],me=O[R+3]^z[3],K=4,se=1;se<Z;se++){var xe=L[te>>>24]^P[W>>>16&255]^G[oe>>>8&255]^V[me&255]^z[K++],Oe=L[W>>>24]^P[oe>>>16&255]^G[me>>>8&255]^V[te&255]^z[K++],H=L[oe>>>24]^P[me>>>16&255]^G[te>>>8&255]^V[W&255]^z[K++],de=L[me>>>24]^P[te>>>16&255]^G[W>>>8&255]^V[oe&255]^z[K++];te=xe,W=Oe,oe=H,me=de}var xe=(F[te>>>24]<<24|F[W>>>16&255]<<16|F[oe>>>8&255]<<8|F[me&255])^z[K++],Oe=(F[W>>>24]<<24|F[oe>>>16&255]<<16|F[me>>>8&255]<<8|F[te&255])^z[K++],H=(F[oe>>>24]<<24|F[me>>>16&255]<<16|F[te>>>8&255]<<8|F[W&255])^z[K++],de=(F[me>>>24]<<24|F[te>>>16&255]<<16|F[W>>>8&255]<<8|F[oe&255])^z[K++];O[R]=xe,O[R+1]=Oe,O[R+2]=H,O[R+3]=de},keySize:256/32});r.AES=o._createHelper(D)}(),n.AES})}(J2)),J2.exports}var eA={exports:{}},the=eA.exports,tH;function nhe(){return tH||(tH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(the,function(n){return function(){var r=n,a=r.lib,o=a.WordArray,l=a.BlockCipher,d=r.algo,h=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],y=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],m=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],x=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],S=d.DES=l.extend({_doReset:function(){for(var k=this._key,D=k.words,O=[],R=0;R<56;R++){var z=h[R]-1;O[R]=D[z>>>5]>>>31-z%32&1}for(var L=this._subKeys=[],P=0;P<16;P++){for(var G=L[P]=[],V=y[P],R=0;R<24;R++)G[R/6|0]|=O[(p[R]-1+V)%28]<<31-R%6,G[4+(R/6|0)]|=O[28+(p[R+24]-1+V)%28]<<31-R%6;G[0]=G[0]<<1|G[0]>>>31;for(var R=1;R<7;R++)G[R]=G[R]>>>(R-1)*4+3;G[7]=G[7]<<5|G[7]>>>27}for(var F=this._invSubKeys=[],R=0;R<16;R++)F[R]=L[15-R]},encryptBlock:function(k,D){this._doCryptBlock(k,D,this._subKeys)},decryptBlock:function(k,D){this._doCryptBlock(k,D,this._invSubKeys)},_doCryptBlock:function(k,D,O){this._lBlock=k[D],this._rBlock=k[D+1],C.call(this,4,252645135),C.call(this,16,65535),T.call(this,2,858993459),T.call(this,8,16711935),C.call(this,1,1431655765);for(var R=0;R<16;R++){for(var z=O[R],L=this._lBlock,P=this._rBlock,G=0,V=0;V<8;V++)G|=m[V][((P^z[V])&x[V])>>>0];this._lBlock=P,this._rBlock=L^G}var F=this._lBlock;this._lBlock=this._rBlock,this._rBlock=F,C.call(this,1,1431655765),T.call(this,8,16711935),T.call(this,2,858993459),C.call(this,16,65535),C.call(this,4,252645135),k[D]=this._lBlock,k[D+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function C(k,D){var O=(this._lBlock>>>k^this._rBlock)&D;this._rBlock^=O,this._lBlock^=O<<k}function T(k,D){var O=(this._rBlock>>>k^this._lBlock)&D;this._lBlock^=O,this._rBlock^=O<<k}r.DES=l._createHelper(S);var E=d.TripleDES=l.extend({_doReset:function(){var k=this._key,D=k.words;if(D.length!==2&&D.length!==4&&D.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var O=D.slice(0,2),R=D.length<4?D.slice(0,2):D.slice(2,4),z=D.length<6?D.slice(0,2):D.slice(4,6);this._des1=S.createEncryptor(o.create(O)),this._des2=S.createEncryptor(o.create(R)),this._des3=S.createEncryptor(o.create(z))},encryptBlock:function(k,D){this._des1.encryptBlock(k,D),this._des2.decryptBlock(k,D),this._des3.encryptBlock(k,D)},decryptBlock:function(k,D){this._des3.decryptBlock(k,D),this._des2.encryptBlock(k,D),this._des1.decryptBlock(k,D)},keySize:192/32,ivSize:64/32,blockSize:64/32});r.TripleDES=l._createHelper(E)}(),n.TripleDES})}(eA)),eA.exports}var tA={exports:{}},rhe=tA.exports,nH;function ihe(){return nH||(nH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(rhe,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=l.RC4=o.extend({_doReset:function(){for(var y=this._key,m=y.words,x=y.sigBytes,S=this._S=[],C=0;C<256;C++)S[C]=C;for(var C=0,T=0;C<256;C++){var E=C%x,k=m[E>>>2]>>>24-E%4*8&255;T=(T+S[C]+k)%256;var D=S[C];S[C]=S[T],S[T]=D}this._i=this._j=0},_doProcessBlock:function(y,m){y[m]^=h.call(this)},keySize:256/32,ivSize:0});function h(){for(var y=this._S,m=this._i,x=this._j,S=0,C=0;C<4;C++){m=(m+1)%256,x=(x+y[m])%256;var T=y[m];y[m]=y[x],y[x]=T,S|=y[(y[m]+y[x])%256]<<24-C*8}return this._i=m,this._j=x,S}r.RC4=o._createHelper(d);var p=l.RC4Drop=d.extend({cfg:d.cfg.extend({drop:192}),_doReset:function(){d._doReset.call(this);for(var y=this.cfg.drop;y>0;y--)h.call(this)}});r.RC4Drop=o._createHelper(p)}(),n.RC4})}(tA)),tA.exports}var nA={exports:{}},ahe=nA.exports,rH;function ohe(){return rH||(rH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(ahe,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=[],h=[],p=[],y=l.Rabbit=o.extend({_doReset:function(){for(var x=this._key.words,S=this.cfg.iv,C=0;C<4;C++)x[C]=(x[C]<<8|x[C]>>>24)&16711935|(x[C]<<24|x[C]>>>8)&4278255360;var T=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],E=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var C=0;C<4;C++)m.call(this);for(var C=0;C<8;C++)E[C]^=T[C+4&7];if(S){var k=S.words,D=k[0],O=k[1],R=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,z=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,L=R>>>16|z&4294901760,P=z<<16|R&65535;E[0]^=R,E[1]^=L,E[2]^=z,E[3]^=P,E[4]^=R,E[5]^=L,E[6]^=z,E[7]^=P;for(var C=0;C<4;C++)m.call(this)}},_doProcessBlock:function(x,S){var C=this._X;m.call(this),d[0]=C[0]^C[5]>>>16^C[3]<<16,d[1]=C[2]^C[7]>>>16^C[5]<<16,d[2]=C[4]^C[1]>>>16^C[7]<<16,d[3]=C[6]^C[3]>>>16^C[1]<<16;for(var T=0;T<4;T++)d[T]=(d[T]<<8|d[T]>>>24)&16711935|(d[T]<<24|d[T]>>>8)&4278255360,x[S+T]^=d[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,S=this._C,C=0;C<8;C++)h[C]=S[C];S[0]=S[0]+1295307597+this._b|0,S[1]=S[1]+3545052371+(S[0]>>>0<h[0]>>>0?1:0)|0,S[2]=S[2]+886263092+(S[1]>>>0<h[1]>>>0?1:0)|0,S[3]=S[3]+1295307597+(S[2]>>>0<h[2]>>>0?1:0)|0,S[4]=S[4]+3545052371+(S[3]>>>0<h[3]>>>0?1:0)|0,S[5]=S[5]+886263092+(S[4]>>>0<h[4]>>>0?1:0)|0,S[6]=S[6]+1295307597+(S[5]>>>0<h[5]>>>0?1:0)|0,S[7]=S[7]+3545052371+(S[6]>>>0<h[6]>>>0?1:0)|0,this._b=S[7]>>>0<h[7]>>>0?1:0;for(var C=0;C<8;C++){var T=x[C]+S[C],E=T&65535,k=T>>>16,D=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[C]=D^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.Rabbit=o._createHelper(y)}(),n.Rabbit})}(nA)),nA.exports}var rA={exports:{}},she=rA.exports,iH;function lhe(){return iH||(iH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(she,function(n){return function(){var r=n,a=r.lib,o=a.StreamCipher,l=r.algo,d=[],h=[],p=[],y=l.RabbitLegacy=o.extend({_doReset:function(){var x=this._key.words,S=this.cfg.iv,C=this._X=[x[0],x[3]<<16|x[2]>>>16,x[1],x[0]<<16|x[3]>>>16,x[2],x[1]<<16|x[0]>>>16,x[3],x[2]<<16|x[1]>>>16],T=this._C=[x[2]<<16|x[2]>>>16,x[0]&4294901760|x[1]&65535,x[3]<<16|x[3]>>>16,x[1]&4294901760|x[2]&65535,x[0]<<16|x[0]>>>16,x[2]&4294901760|x[3]&65535,x[1]<<16|x[1]>>>16,x[3]&4294901760|x[0]&65535];this._b=0;for(var E=0;E<4;E++)m.call(this);for(var E=0;E<8;E++)T[E]^=C[E+4&7];if(S){var k=S.words,D=k[0],O=k[1],R=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,z=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,L=R>>>16|z&4294901760,P=z<<16|R&65535;T[0]^=R,T[1]^=L,T[2]^=z,T[3]^=P,T[4]^=R,T[5]^=L,T[6]^=z,T[7]^=P;for(var E=0;E<4;E++)m.call(this)}},_doProcessBlock:function(x,S){var C=this._X;m.call(this),d[0]=C[0]^C[5]>>>16^C[3]<<16,d[1]=C[2]^C[7]>>>16^C[5]<<16,d[2]=C[4]^C[1]>>>16^C[7]<<16,d[3]=C[6]^C[3]>>>16^C[1]<<16;for(var T=0;T<4;T++)d[T]=(d[T]<<8|d[T]>>>24)&16711935|(d[T]<<24|d[T]>>>8)&4278255360,x[S+T]^=d[T]},blockSize:128/32,ivSize:64/32});function m(){for(var x=this._X,S=this._C,C=0;C<8;C++)h[C]=S[C];S[0]=S[0]+1295307597+this._b|0,S[1]=S[1]+3545052371+(S[0]>>>0<h[0]>>>0?1:0)|0,S[2]=S[2]+886263092+(S[1]>>>0<h[1]>>>0?1:0)|0,S[3]=S[3]+1295307597+(S[2]>>>0<h[2]>>>0?1:0)|0,S[4]=S[4]+3545052371+(S[3]>>>0<h[3]>>>0?1:0)|0,S[5]=S[5]+886263092+(S[4]>>>0<h[4]>>>0?1:0)|0,S[6]=S[6]+1295307597+(S[5]>>>0<h[5]>>>0?1:0)|0,S[7]=S[7]+3545052371+(S[6]>>>0<h[6]>>>0?1:0)|0,this._b=S[7]>>>0<h[7]>>>0?1:0;for(var C=0;C<8;C++){var T=x[C]+S[C],E=T&65535,k=T>>>16,D=((E*E>>>17)+E*k>>>15)+k*k,O=((T&4294901760)*T|0)+((T&65535)*T|0);p[C]=D^O}x[0]=p[0]+(p[7]<<16|p[7]>>>16)+(p[6]<<16|p[6]>>>16)|0,x[1]=p[1]+(p[0]<<8|p[0]>>>24)+p[7]|0,x[2]=p[2]+(p[1]<<16|p[1]>>>16)+(p[0]<<16|p[0]>>>16)|0,x[3]=p[3]+(p[2]<<8|p[2]>>>24)+p[1]|0,x[4]=p[4]+(p[3]<<16|p[3]>>>16)+(p[2]<<16|p[2]>>>16)|0,x[5]=p[5]+(p[4]<<8|p[4]>>>24)+p[3]|0,x[6]=p[6]+(p[5]<<16|p[5]>>>16)+(p[4]<<16|p[4]>>>16)|0,x[7]=p[7]+(p[6]<<8|p[6]>>>24)+p[5]|0}r.RabbitLegacy=o._createHelper(y)}(),n.RabbitLegacy})}(rA)),rA.exports}var iA={exports:{}},uhe=iA.exports,aH;function che(){return aH||(aH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),up(),cp(),Sd(),pa())})(uhe,function(n){return function(){var r=n,a=r.lib,o=a.BlockCipher,l=r.algo;const d=16,h=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],p=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var y={pbox:[],sbox:[]};function m(E,k){let D=k>>24&255,O=k>>16&255,R=k>>8&255,z=k&255,L=E.sbox[0][D]+E.sbox[1][O];return L=L^E.sbox[2][R],L=L+E.sbox[3][z],L}function x(E,k,D){let O=k,R=D,z;for(let L=0;L<d;++L)O=O^E.pbox[L],R=m(E,O)^R,z=O,O=R,R=z;return z=O,O=R,R=z,R=R^E.pbox[d],O=O^E.pbox[d+1],{left:O,right:R}}function S(E,k,D){let O=k,R=D,z;for(let L=d+1;L>1;--L)O=O^E.pbox[L],R=m(E,O)^R,z=O,O=R,R=z;return z=O,O=R,R=z,R=R^E.pbox[1],O=O^E.pbox[0],{left:O,right:R}}function C(E,k,D){for(let P=0;P<4;P++){E.sbox[P]=[];for(let G=0;G<256;G++)E.sbox[P][G]=p[P][G]}let O=0;for(let P=0;P<d+2;P++)E.pbox[P]=h[P]^k[O],O++,O>=D&&(O=0);let R=0,z=0,L=0;for(let P=0;P<d+2;P+=2)L=x(E,R,z),R=L.left,z=L.right,E.pbox[P]=R,E.pbox[P+1]=z;for(let P=0;P<4;P++)for(let G=0;G<256;G+=2)L=x(E,R,z),R=L.left,z=L.right,E.sbox[P][G]=R,E.sbox[P][G+1]=z;return!0}var T=l.Blowfish=o.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var E=this._keyPriorReset=this._key,k=E.words,D=E.sigBytes/4;C(y,k,D)}},encryptBlock:function(E,k){var D=x(y,E[k],E[k+1]);E[k]=D.left,E[k+1]=D.right},decryptBlock:function(E,k){var D=S(y,E[k],E[k+1]);E[k]=D.left,E[k+1]=D.right},blockSize:64/32,keySize:128/32,ivSize:64/32});r.Blowfish=o._createHelper(T)}(),n.Blowfish})}(iA)),iA.exports}var fhe=S2.exports,oH;function dhe(){return oH||(oH=1,function(e,t){(function(n,r,a){e.exports=r(Hn(),E2(),lde(),cde(),up(),hde(),cp(),MU(),JD(),yde(),$U(),_de(),wde(),Ede(),eO(),Tde(),Sd(),pa(),Rde(),Bde(),Lde(),zde(),Ude(),jde(),Pde(),Vde(),Zde(),Kde(),Xde(),ehe(),nhe(),ihe(),ohe(),lhe(),che())})(fhe,function(n){return n})}(S2)),S2.exports}var hhe=dhe();const phe=Jk(hhe);class ghe extends _2{constructor(){super(...arguments);$i(this,"platform",Hi.THE_COLLECTIVE);$i(this,"apiBaseURL","https://testapi.thecollective.in/")}getCookie(n){var o;const a=`; ${document.cookie}`.split(`; ${n}=`);return a.length===2&&((o=a.pop())==null?void 0:o.split(";").shift())||null}generateHash(n){const r=JSON.parse(JSON.stringify(n));return delete r.hash,phe.MD5(JSON.stringify(r)).toString()}async fetchCart(){try{const n={storeId:0,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),page:"cartSummary",device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},r=this.generateHash(n),a={...n,hash:r,validateHash:!0},o=await fetch(`${this.apiBaseURL}cart/getCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(a)});if(!o.ok)return this.createErrorResult(`Failed to fetch cart: ${o.status}`);const l=await o.json();if(!l.results||l.results==="")return this.createSuccessResult({items:[],total:0,itemCount:0,currency:"INR",token:""});const d=l.results[0],h=d.products.map(p=>({id:p.id_cart_product,quantity:p.quantity,properties:{size:p.size,color:p.color,brand:p.brand,subbrand:p.subbrand},title:p.name,price:p.unitproductprice,variant_id:p.id_product_attribute}));return this.createSuccessResult({items:h,total:d.totalCartvalue,itemCount:h.length,currency:"INR",token:l.hash})}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}async addToCart(n,r=1,a){try{const o=n,l=a!=null&&a.size?parseInt(a.size):0,d=new URLSearchParams;d.append("dbls_order_source","direct_recommendation"),d.append("dbls_session_id",Kn()),d.append("dbls_method","add_to_cart"),d.append("utm_source","debales_chatbot");const h={productId:o,productAttributeId:0,size:l,customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMER_ID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CART_ID")||"0"),version:1.2,buyNow:0,quantity:r,oldAttributeId:0,wishlistDeleteFlag:0,cartOperation:"add",storeId:0,utmSource:d.toString(),sliderSource:"",page:"cartSummary",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},p=this.generateHash(h),y={...h,hash:p,validateHash:!0},m=await fetch(`${this.apiBaseURL}cart/addToCart`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(y)});return m.ok?this.createSuccessResult(void 0,"Item added to cart successfully"):this.createErrorResult(`Failed to add item to cart: ${m.status}`)}catch(o){return this.createErrorResult(o instanceof Error?o.message:"Unknown error")}}async removeFromCart(n){try{const r={customerId:parseInt(this.getCookie("DEVELOPMENT_CUSTOMERID")||"0"),cartId:parseInt(this.getCookie("DEVELOPMENT_CARTID")||"0"),productId:n,storeId:0,productAttributeId:0,device:"desktop",shopId:7,shopName:"The Collective",deviceId:this.getCookie("DEVELOPMENT_DEVICE_ID")||"",isS2SCall:!1,deviceType:"desktop",brand:"The Collective",geoLocation:-1,fcmToken:-1,deviceToken:this.getCookie("DEVELOPMENT_DEVICE_TOKEN")||""},a=this.generateHash(r),o={...r,hash:a,validateHash:!0},l=await fetch(`${this.apiBaseURL}cart/deleteCartProduct`,{method:"POST",headers:{"Content-Type":"application/json",securekey:"8837130cc8d08aba14323fbd4714f4aa",Version:"1"},body:JSON.stringify(o)});return l.ok?this.createSuccessResult(void 0,"Item removed from cart successfully"):this.createErrorResult(`Failed to remove item from cart: ${l.status}`)}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async updateQuantity(n){try{return console.log("TheCollectiveCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}async clearCart(){try{return console.log("TheCollectiveCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}catch(n){return this.createErrorResult(n instanceof Error?n.message:"Unknown error")}}generateCartUrl(n){const r=nde(n);if(!r.isValid)return"";const a=new URL("/checkoutsummary",r.url);return a.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),a.searchParams.append("attributes[from]","debales-ai-chatbot"),a.searchParams.append("attributes[through]","add-to-cart"),a.searchParams.append("attributes[dbls_session_id]",Kn()),a.searchParams.append("timestamp",Date.now().toString()),Uc(a.toString())}generateProductUrl(n,r){const a=new URL(r.link);return a.host=n,Uc(a.toString())}async addCartAttributes(n={}){try{return console.log("TheCollectiveCartAdapter: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}catch(r){return this.createErrorResult(r instanceof Error?r.message:"Unknown error")}}}const fp=class fp{constructor(){$i(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return fp.instance||(fp.instance=new fp),fp.instance}getAdapter(t){const n=t||bd.detect(),r=this.adapterCache.get(n);if(r)return r;let a;switch(n){case Hi.SHOPIFY:a=new Xfe;break;case Hi.MAGENTO:a=new Jfe;break;case Hi.THE_COLLECTIVE:a=new ghe;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),a=new Wfe}return this.adapterCache.set(n,a),a}clearCache(){this.adapterCache.clear()}};$i(fp,"instance");let tO=fp;const mhe=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,a]=ie.useState(!1),[o,l]=ie.useState(null),[d,h]=ie.useState(null),p=ie.useCallback(async()=>{try{a(!0),l(null);const D=await e.fetchCart();D.success?h(D.data):l(D.error)}catch(D){l(D instanceof Error?D.message:"Failed to fetch cart")}finally{a(!1)}},[e]),y=async(D,O,R)=>{try{l(null);const z=await e.addToCart(D,O,R);return z.success&&await p(),z}catch(z){return{success:!1,error:z instanceof Error?z.message:"Failed to add item to cart"}}},m=async D=>{try{l(null);const O=await e.removeFromCart(D);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to remove item from cart"}}},x=async D=>{try{l(null);const O=await e.updateQuantity(D);return O.success&&await p(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to update quantity"}}},S=async()=>{try{l(null);const D=await e.clearCart();return D.success&&await p(),D}catch(D){return{success:!1,error:D instanceof Error?D.message:"Failed to clear cart"}}},C=D=>e.generateCartUrl(D),T=(D,O)=>e.generateProductUrl(D,O),E=async D=>e.addCartAttributes(D);ie.useEffect(()=>{n&&p()},[n,p]);const k={isLoading:r,error:o,cart:d,fetchCart:p,addToCart:y,removeFromCart:m,updateQuantity:x,clearCart:S,generateCartUrl:C,generateProductUrl:T,addCartAttributes:E};return I.jsx(n7.Provider,{value:k,children:t})},Ou=Object.create(null);Ou.open="0",Ou.close="1",Ou.ping="2",Ou.pong="3",Ou.message="4",Ou.upgrade="5",Ou.noop="6";const aA=Object.create(null);Object.keys(Ou).forEach(e=>{aA[Ou[e]]=e});const nO={type:"error",data:"parser error"},sH=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",lH=typeof ArrayBuffer=="function",uH=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,rO=({type:e,data:t},n,r)=>sH&&t instanceof Blob?n?r(t):cH(t,r):lH&&(t instanceof ArrayBuffer||uH(t))?n?r(t):cH(new Blob([t]),r):r(Ou[e]+(t||"")),cH=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function fH(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let iO;function vhe(e,t){if(sH&&e.data instanceof Blob)return e.data.arrayBuffer().then(fH).then(t);if(lH&&(e.data instanceof ArrayBuffer||uH(e.data)))return t(fH(e.data));rO(e,!1,n=>{iO||(iO=new TextEncoder),t(iO.encode(n))})}const dH="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ax=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<dH.length;e++)ax[dH.charCodeAt(e)]=e;const yhe=e=>{let t=e.length*.75,n=e.length,r,a=0,o,l,d,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),y=new Uint8Array(p);for(r=0;r<n;r+=4)o=ax[e.charCodeAt(r)],l=ax[e.charCodeAt(r+1)],d=ax[e.charCodeAt(r+2)],h=ax[e.charCodeAt(r+3)],y[a++]=o<<2|l>>4,y[a++]=(l&15)<<4|d>>2,y[a++]=(d&3)<<6|h&63;return p},xhe=typeof ArrayBuffer=="function",aO=(e,t)=>{if(typeof e!="string")return{type:"message",data:hH(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:bhe(e.substring(1),t)}:aA[n]?e.length>1?{type:aA[n],data:e.substring(1)}:{type:aA[n]}:nO},bhe=(e,t)=>{if(xhe){const n=yhe(e);return hH(n,t)}else return{base64:!0,data:e}},hH=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},pH="",_he=(e,t)=>{const n=e.length,r=new Array(n);let a=0;e.forEach((o,l)=>{rO(o,!1,d=>{r[l]=d,++a===n&&t(r.join(pH))})})},She=(e,t)=>{const n=e.split(pH),r=[];for(let a=0;a<n.length;a++){const o=aO(n[a],t);if(r.push(o),o.type==="error")break}return r};function whe(){return new TransformStream({transform(e,t){vhe(e,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const o=new DataView(a.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{a=new Uint8Array(9);const o=new DataView(a.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let oO;function oA(e){return e.reduce((t,n)=>t+n.length,0)}function sA(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let a=0;a<t;a++)n[a]=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 Che(e,t){oO||(oO=new TextDecoder);const n=[];let r=0,a=-1,o=!1;return new TransformStream({transform(l,d){for(n.push(l);;){if(r===0){if(oA(n)<1)break;const h=sA(n,1);o=(h[0]&128)===128,a=h[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(oA(n)<2)break;const h=sA(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(oA(n)<8)break;const h=sA(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(nO);break}a=y*Math.pow(2,32)+p.getUint32(4),r=3}else{if(oA(n)<a)break;const h=sA(n,a);d.enqueue(aO(o?h:oO.decode(h),t)),r=0}if(a===0||a>e){d.enqueue(nO);break}}}})}const gH=4;function ji(e){if(e)return Ehe(e)}function Ehe(e){for(var t in ji.prototype)e[t]=ji.prototype[t];return e}ji.prototype.on=ji.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},ji.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},ji.prototype.off=ji.prototype.removeListener=ji.prototype.removeAllListeners=ji.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===t||r.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this},ji.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,t)}return this},ji.prototype.emitReserved=ji.prototype.emit,ji.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ji.prototype.hasListeners=function(e){return!!this.listeners(e).length};const lA=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),js=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ahe="arraybuffer";function B0e(){}function mH(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const khe=js.setTimeout,The=js.clearTimeout;function uA(e,t){t.useNativeTimers?(e.setTimeoutFn=khe.bind(js),e.clearTimeoutFn=The.bind(js)):(e.setTimeoutFn=js.setTimeout.bind(js),e.clearTimeoutFn=js.clearTimeout.bind(js))}const Dhe=1.33;function Ohe(e){return typeof e=="string"?Mhe(e):Math.ceil((e.byteLength||e.size)*Dhe)}function Mhe(e){let t=0,n=0;for(let r=0,a=e.length;r<a;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function vH(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Rhe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Ihe(e){let t={},n=e.split("&");for(let r=0,a=n.length;r<a;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class Bhe extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class sO extends ji{constructor(t){super(),this.writable=!1,uA(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new Bhe(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=aO(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Rhe(t);return n.length?"?"+n:""}}class $he extends sO{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};She(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,_he(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=vH()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let yH=!1;try{yH=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Lhe=yH;function Nhe(){}class zhe extends $he{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(a,o)=>{this.onError("xhr post error",a,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Mu extends ji{constructor(t,n,r){super(),this.createRequest=t,uA(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=mH(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Mu.requestsCount++,Mu.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Nhe,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Mu.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Mu.requestsCount=0,Mu.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",xH);else if(typeof addEventListener=="function"){const e="onpagehide"in js?"pagehide":"unload";addEventListener(e,xH,!1)}}function xH(){for(let e in Mu.requests)Mu.requests.hasOwnProperty(e)&&Mu.requests[e].abort()}const Fhe=function(){const e=bH({xdomain:!1});return e&&e.responseType!==null}();class Uhe extends zhe{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Fhe&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mu(bH,this.uri(),t)}}function bH(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Lhe))return new XMLHttpRequest}catch{}if(!t)try{return new js[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const _H=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Hhe extends sO{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=_H?{}:mH(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;rO(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}a&&lA(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=vH()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const lO=js.WebSocket||js.MozWebSocket;class jhe extends Hhe{createSocket(t,n,r){return _H?new lO(t,n,r):n?new lO(t,n):new lO(t)}doWrite(t,n){this.ws.send(n)}}class qhe extends sO{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Che(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),a=whe();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const o=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),o())}).catch(d=>{})};o();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this._writer.write(l).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],a=n===t.length-1;this._writer.write(r).then(()=>{a&&lA(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Phe={websocket:jhe,webtransport:qhe,polling:Uhe},Ghe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Vhe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uO(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let a=Ghe.exec(e||""),o={},l=14;for(;l--;)o[Vhe[l]]=a[l]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Yhe(o,o.path),o.queryKey=Zhe(o,o.query),o}function Yhe(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Zhe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,o){a&&(n[a]=o)}),n}const cO=typeof addEventListener=="function"&&typeof removeEventListener=="function",cA=[];cO&&addEventListener("offline",()=>{cA.forEach(e=>e())},!1);class wd extends ji{constructor(t,n){if(super(),this.binaryType=Ahe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=uO(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uO(n.host).host);uA(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),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},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ihe(this.opts.query)),cO&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},cA.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=gH,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&wd.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",wd.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=Ohe(a)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,lA(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(wd.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),cO&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=cA.indexOf(this._offlineEventListener);r!==-1&&cA.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}wd.protocol=gH;class Qhe extends wd{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;wd.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;wd.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=n.name,this.emitReserved("upgradeError",x)}}))};function o(){r||(r=!0,y(),n.close(),n=null)}const l=m=>{const x=new Error("probe error: "+m);x.transport=n.name,o(),this.emitReserved("upgradeError",x)};function d(){l("transport closed")}function h(){l("socket closed")}function p(m){n&&m.name!==n.name&&o()}const y=()=>{n.removeListener("open",a),n.removeListener("error",l),n.removeListener("close",d),this.off("close",h),this.off("upgrading",p)};n.once("open",a),n.once("error",l),n.once("close",d),this.once("close",h),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let Khe=class extends Qhe{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(a=>Phe[a]).filter(a=>!!a)),super(t,r)}};function Whe(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=uO(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 o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const Xhe=typeof ArrayBuffer=="function",Jhe=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,SH=Object.prototype.toString,epe=typeof Blob=="function"||typeof Blob<"u"&&SH.call(Blob)==="[object BlobConstructor]",tpe=typeof File=="function"||typeof File<"u"&&SH.call(File)==="[object FileConstructor]";function fO(e){return Xhe&&(e instanceof ArrayBuffer||Jhe(e))||epe&&e instanceof Blob||tpe&&e instanceof File}function fA(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(fA(e[n]))return!0;return!1}if(fO(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return fA(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&fA(e[n]))return!0;return!1}function npe(e){const t=[],n=e.data,r=e;return r.data=dO(n,t),r.attachments=t.length,{packet:r,buffers:t}}function dO(e,t){if(!e)return e;if(fO(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=dO(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=dO(e[r],t));return n}return e}function rpe(e,t){return e.data=hO(e.data,t),delete e.attachments,e}function hO(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=hO(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=hO(e[n],t));return e}const ipe=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ape=5;var jn;(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"})(jn||(jn={}));class ope{constructor(t){this.replacer=t}encode(t){return(t.type===jn.EVENT||t.type===jn.ACK)&&fA(t)?this.encodeAsBinary({type:t.type===jn.EVENT?jn.BINARY_EVENT:jn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===jn.BINARY_EVENT||t.type===jn.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=npe(t),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}function wH(e){return Object.prototype.toString.call(e)==="[object Object]"}class pO extends ji{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===jn.BINARY_EVENT;r||n.type===jn.BINARY_ACK?(n.type=r?jn.EVENT:jn.ACK,this.reconstructor=new spe(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fO(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if(jn[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===jn.BINARY_EVENT||r.type===jn.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const l=t.substring(o,n);if(l!=Number(l)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(l)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const o=n+1;for(;++n;){const l=t.charAt(n);if(l==null||Number(l)!=l){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(pO.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case jn.CONNECT:return wH(n);case jn.DISCONNECT:return n===void 0;case jn.CONNECT_ERROR:return typeof n=="string"||wH(n);case jn.EVENT:case jn.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ipe.indexOf(n[0])===-1);case jn.ACK:case jn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class spe{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=rpe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const lpe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pO,Encoder:ope,get PacketType(){return jn},protocol:ape},Symbol.toStringTag,{value:"Module"}));function Ul(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const upe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class CH extends ji{constructor(t,n,r){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=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ul(t,"open",this.onopen.bind(this)),Ul(t,"packet",this.onpacket.bind(this)),Ul(t,"error",this.onerror.bind(this)),Ul(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,a,o;if(upe.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const l={type:jn.EVENT,data:n};if(l.options={},l.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,m=n.pop();this._registerAckCallback(y,m),l.id=y}const d=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(l),this.packet(l)):this.sendBuffer.push(l)),this.flags={},this}_registerAckCallback(t,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===t&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},a),l=(...d)=>{this.io.clearTimeoutFn(o),n.apply(this,d)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,a)=>{const o=(l,d)=>l?a(l):r(d);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...o)=>r!==this._queue[0]?void 0:(a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:jn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case jn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new 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 jn.EVENT:case jn.BINARY_EVENT:this.onevent(t);break;case jn.ACK:case jn.BINARY_ACK:this.onack(t);break;case jn.DISCONNECT:this.ondisconnect();break;case jn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:jn.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:jn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function im(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}im.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=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},im.prototype.reset=function(){this.attempts=0},im.prototype.setMin=function(e){this.ms=e},im.prototype.setMax=function(e){this.max=e},im.prototype.setJitter=function(e){this.jitter=e};class gO extends ji{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,uA(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new im({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||lpe;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new Khe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Ul(n,"open",function(){r.onopen(),t&&t()}),o=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),t?t(d):this.maybeReconnectOnOpen()},l=Ul(n,"error",o);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{a(),o(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ul(t,"ping",this.onping.bind(this)),Ul(t,"data",this.ondata.bind(this)),Ul(t,"error",this.onerror.bind(this)),Ul(t,"close",this.onclose.bind(this)),Ul(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){lA(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new CH(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ox={};function dA(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Whe(e,t.path||"/socket.io"),r=n.source,a=n.id,o=n.path,l=ox[a]&&o in ox[a].nsps,d=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let h;return d?h=new gO(r,t):(ox[a]||(ox[a]=new gO(r,t)),h=ox[a]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(dA,{Manager:gO,Socket:CH,io:dA,connect:dA});const dp=class dp{constructor(){$i(this,"socket",null);$i(this,"isConnected",!1);$i(this,"eventListeners",new Map)}static getInstance(){return dp.instance||(dp.instance=new dp),dp.instance}connect(t){return this.socket?this.socket:(this.socket=dA(`${wie}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,a;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(a=this.socket)==null||a.on(t,n)}off(t,n){var a;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(a=this.socket)==null||a.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(a=>a(...n))}};$i(dp,"instance");let mO=dp;const Ru=mO.getInstance(),cpe=({children:e,nameSpace:t})=>{const[n,r]=ie.useState(""),[a,o]=ie.useState([]),[l,d]=ie.useState(!1),[h,p]=ie.useState(!1),[y,m]=ie.useState([]),[x,S]=ie.useState(!1),[C,T]=ie.useState(!1),[E,k]=ie.useState([]),[D,O]=Zie(zn(Sn.USER_INFO),null),[R,z]=Y1(zn(Sn.IS_FORM_CLOSED_BY_USER),!1),[L,P]=ie.useState(null),G=Wf("web-socket"),[V,F]=ie.useState([]),[Z,te]=ie.useState(null),[W,oe]=ie.useState(!1),[me,K]=ie.useState(sessionStorage.getItem(zn(Sn.LAST_SHOWN_MESSAGE_ID,{botId:t}))),se=Tie(),xe=Kn(),[Oe,H]=ie.useState(null),[de,ce]=ie.useState(null);ie.useEffect(()=>{if(G){const ct=Ru.connect("/api/v1/chat");te(ct);const Xe=()=>{console.debug("connected to websocket"),oe(!0)},Je=()=>{console.debug("disconnected from websocket"),oe(!1)},We=ot=>{console.debug("response from websocket",ot);const xt=ot.conversationId??crypto.randomUUID().toString();K(xt),ot.Variants_quantity&&k(ae=>[...ae,...ot.Variants_quantity]);const ee=[...a,{text:ot.response,products:ot.products,conversationId:xt,rating:"neutral",leading_queries:ot.leading_queries,collections:ot.collections,variants:ot.variants,shop:ot.shop,Variants_quantity:ot.Variants_quantity,monthlyChatLimitReached:ot.monthlyChatLimitReached,isBot:!0}];o(ee),q(ee),m(ae=>[...ae,[a[a.length-1].text,ot.response]]),p(!1)},$t=ot=>{if(ot.event==="error"){const xt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},ee=[...a,xt];o(ee),q(ee),p(!1)}};return Ru.on("connect",Xe),Ru.on("disconnect",Je),Ru.on("response",We),Ru.on("system",$t),()=>{Ru.off("connect",Xe),Ru.off("disconnect",Je),Ru.off("response",We),Ru.off("system",$t)}}},[G,a]);const q=ct=>{sessionStorage.setItem(zn(Sn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(ct))},ye=()=>{const ct=sessionStorage.getItem(zn(Sn.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return ct?JSON.parse(ct):[]},Qe=ie.useCallback(async()=>{if(t)try{d(!0);const ct=await fetch(`${yi}/api/wordpress/UiData?value=${t}`),Xe=await ct.json();if(!ct.ok)throw new Error("failed to fetch data"+Xe.error);const Je=document.getElementById("debales-ai-assistant");Je&&(Je.style.zIndex=String(Xe.zIndex??2031483602)),ce(Xe),Xe!=null&&Xe.shopifyShopDomain&&rae(Xe.shopifyShopDomain).then($t=>{H($t)}),F(Xe.suggestedQuestions);const We=ye();if(We.length>0)o(We);else{const $t={text:Xe.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([$t])}}catch(ct){console.error(ct)}finally{d(!1)}},[t]);ie.useEffect(()=>{Qe()},[Qe]);const Me=ie.useMemo(()=>{var ct;return!!(!R&&((ct=de==null?void 0:de.pluginConfig)!=null&&ct.collectedUserInfo)&&(de.pluginConfig.collectedUserInfo.name||de.pluginConfig.collectedUserInfo.email||de.pluginConfig.collectedUserInfo.phone)&&!D)},[de,D,R]),pt=ie.useCallback(async(ct,Xe,Je,We,$t,ot)=>{if(!ct||ct.trim()===""||h&&!Je)return;let xt=[...a];We?We&&a.length<=2?(S(!0),xt=[]):S(!1):(xt.push({text:ct,isBot:!1}),S(!1));const ee=Kn();p(!0);try{o(xt),q(xt);const ae=await fetch(`${yi}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ee,userMessage:ct,nameSpace:t,chat_history:y,leading_queries:$t,answer:Xe,products:Je,userInfo:JSON.stringify(D),anonymousUserId:se,distinctId:Tu.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:ot})});if(!ae.ok)throw new Error("Network response was not ok");const ve=await ae.json(),Ce=ve.conversationId??crypto.randomUUID().toString();K(Ce),ve.Variants_quantity&&k(Ne=>[...Ne,...ve.Variants_quantity]);const Ue=[...xt,{text:ve.response,products:ve.products,conversationId:Ce,rating:"neutral",leading_queries:ve.leading_queries,collections:ve.collections,variants:ve.variants,shop:ve.shop,Variants_quantity:ve.Variants_quantity,monthlyChatLimitReached:ve.monthlyChatLimitReached,isBot:!0}];o(Ue),q(Ue),m(Ne=>[...Ne,[ct,ve.response]])}catch(ae){console.error(ae);const ve={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Ce=[...xt,ve];We||(o(Ce),q(Ce))}finally{p(!1)}},[a,h,y,t,se,D]),Ke=ie.useCallback(ct=>{de&&ce(Xe=>Xe?{...Xe,mobileDisplayMode:ct}:null)},[de]),wt=ie.useCallback(async(ct,Xe,Je,We,$t,ot)=>{if(!ct||ct.trim()===""||h&&!Je)return;let xt=[...a];if(We?We&&a.length<=2?(S(!0),xt=[]):S(!1):(xt.push({text:ct,isBot:!1}),S(!1)),p(!0),o(xt),q(xt),Z&&W){const ee={type:ede.MESSAGE,role:tde.USER,query:ct,nameSpace:t,leadingQueries:$t,answer:Xe,products:Je,userInfo:D,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:xe,anonymousUserId:se,distinctId:Tu.getDistinctId(),followUpQuestion:ot};Ru.emit("chat",ee)}else pt(ct,Xe,Je,We,$t,ot)},[a,h,t,se,Z,W,xe,pt,D]),kt={sessionId:xe,messages:a,isLoading:l,isMessageLoading:h,isKlaviyoMessage:x,showUserInfoModel:C,pendingBulkItems:E,lastedBotmessageId:me,uiData:de,storeMetaData:Oe,suggestedQuestions:V,isUserInfoNeeded:Me,input:n,pendingQuestion:L,userInfo:D,isFormClosedByUser:R,onSendMessage:G?wt:pt,setMessages:o,setIsLoading:d,setIsMessageLoading:p,setIsKlaviyoMessage:S,setShowUserInfoModel:T,setPendingBulkItems:k,setLastedBotmessageId:K,fetchUiInfo:Qe,changeDisplayModel:Ke,saveConversation:q,loadConversation:ye,setSuggestedQuestions:F,setUserInfo:O,setInput:r,setPendingQuestion:P,setIsFormClosedByUser:z};return I.jsx(k7.Provider,{value:kt,children:e})};function fpe(e){const t=tO.getInstance().getAdapter();return I.jsx(cpe,{nameSpace:e.botId,children:I.jsx(BG,{apiKey:Cie,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:yi+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:bd.detect(),project:e.botId,sessionId:Kn()}),n.group("project",e.botId,{platform:bd.detect()});const r=Aa();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:I.jsx(mhe,{adapter:t,children:e.children})})})}function dpe(e){return I.jsx(Kfe,{children:I.jsx(fpe,{botId:e.botId,children:I.jsx(qfe,{...e})})})}return dpe});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@debales/ai",
|
|
3
3
|
"private": false,
|
|
4
4
|
"access": "public",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.23",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/module/ai.js",
|
|
8
8
|
"types": "./dist/module/index.d.ts",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"typescript-eslint": "^8.24.1",
|
|
54
54
|
"vite": "^6.2.0",
|
|
55
55
|
"vite-plugin-dts": "^4.5.3",
|
|
56
|
-
"@debales/eslint-config": "0.0.0",
|
|
57
56
|
"@debales/shared": "0.0.1",
|
|
57
|
+
"@debales/eslint-config": "0.0.0",
|
|
58
58
|
"@debales/typescript-config": "0.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|