@dodoex/wallet-web3 0.5.4 → 0.6.1
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/__tslib-6e4ae2f5.js +1 -0
- package/dist/{alchemy-provider-5870b6fa-7183581f.js → alchemy-provider-5870b6fa-bb821a34.js} +1 -1
- package/dist/{alchemy-websocket-provider-213da986-d5a91aac.js → alchemy-websocket-provider-213da986-702b5398.js} +1 -1
- package/dist/{blocto-0ec2fc36.js → blocto-c38e644a.js} +1 -1
- package/dist/browser-3f7e560e.js +1 -0
- package/dist/{ccip-d1141d3a.js → ccip-86a505f2.js} +1 -1
- package/dist/cjs/__tslib-44b18af7.cjs +1 -0
- package/dist/cjs/{alchemy-provider-5870b6fa-94b8a05d.cjs → alchemy-provider-5870b6fa-38f9ed80.cjs} +1 -1
- package/dist/cjs/{alchemy-websocket-provider-213da986-cb2dca69.cjs → alchemy-websocket-provider-213da986-fb48ef07.cjs} +1 -1
- package/dist/cjs/{blocto-c4470598.cjs → blocto-7eb7575b.cjs} +1 -1
- package/dist/cjs/browser-d0e333da.cjs +1 -0
- package/dist/cjs/{ccip-466d4e59.cjs → ccip-a63a44a2.cjs} +1 -1
- package/dist/cjs/{draggabilly-53856a31.cjs → draggabilly-76e13056.cjs} +1 -1
- package/dist/cjs/id-749531a6.cjs +1 -0
- package/dist/cjs/{index-76cccf0c.cjs → index-0029a709.cjs} +1 -1
- package/dist/cjs/index-10979fb2.cjs +1 -0
- package/dist/cjs/{index-86ef4f22.cjs → index-3617a04a.cjs} +1 -1
- package/dist/cjs/index-563a38d7.cjs +27 -0
- package/dist/cjs/{index-9d9946f3.cjs → index-56a82537.cjs} +7 -7
- package/dist/cjs/index-6c5027af.cjs +15 -0
- package/dist/cjs/index-7eb41eb1.cjs +2 -0
- package/dist/cjs/{index-c4c73f44.cjs → index-a19ffa92.cjs} +1 -1
- package/dist/cjs/{index-6aa1755b.cjs → index-aa28e9f9.cjs} +2 -2
- package/dist/cjs/index-b64e1d7e.cjs +1 -0
- package/dist/cjs/{index-9075d9c2.cjs → index-cc156a43.cjs} +1 -1
- package/dist/cjs/{index-56fff369.cjs → index-df00325f.cjs} +1 -1
- package/dist/cjs/{index-63b5eebb.cjs → index-e85aaa9d.cjs} +1 -1
- package/dist/cjs/index-ef8a01c5.cjs +16 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-f6621022.cjs +9 -0
- package/dist/cjs/{interface-d5ec613a.cjs → interface-d50ce16b.cjs} +1 -1
- package/dist/cjs/lib-typedarrays-82021648.cjs +1 -0
- package/dist/cjs/mm-install-modal_2.entry-4950a7e9.cjs +1 -0
- package/dist/cjs/{portis-9af3489b.cjs → portis-3a895975.cjs} +1 -1
- package/dist/cjs/rainbow-6579e86d.cjs +1 -0
- package/dist/cjs/sha224-ed46e71e.cjs +1 -0
- package/dist/cjs/{sha256-6785be1d.cjs → sha256-d1b2312d.cjs} +1 -1
- package/dist/cjs/{typed-data-a102eb38.cjs → typed-data-460b86be.cjs} +1 -1
- package/dist/cjs/uAuth-37ec9004.cjs +1 -0
- package/dist/cjs/{walletConnect-d4368503.cjs → walletConnect-333618c1.cjs} +1 -1
- package/dist/cjs/{walletLink-1b5e5056.cjs → walletLink-1bbb754c.cjs} +2 -2
- package/dist/{draggabilly-96bd4e8a.js → draggabilly-9c13a931.js} +1 -1
- package/dist/id-72e0c1a1.js +1 -0
- package/dist/index-06f6f79c.js +27 -0
- package/dist/{index-29d50f5e.js → index-2c7120ea.js} +1 -1
- package/dist/index-3354aa33.js +15 -0
- package/dist/{index-d9690f1f.js → index-352a03ce.js} +1 -1
- package/dist/{index-de489272.js → index-46da6d5f.js} +7 -7
- package/dist/{index-ec77233b.js → index-4b6b9842.js} +1 -1
- package/dist/{index-9a72391b.js → index-69adc195.js} +1 -1
- package/dist/index-754d059b.js +1 -0
- package/dist/index-7b0eeb5c.js +1 -0
- package/dist/index-a3d1a073.js +16 -0
- package/dist/{index-aa09ffe2.js → index-b0e82b69.js} +1 -1
- package/dist/{index-b27ec2be.js → index-badfa46e.js} +1 -1
- package/dist/{index-25f5dd77.js → index-e3d55f2e.js} +1 -1
- package/dist/index-fcb3d760.js +2 -0
- package/dist/index.es-2327b5db.js +9 -0
- package/dist/index.js +1 -1
- package/dist/{interface-501ba1ce.js → interface-367d293e.js} +1 -1
- package/dist/lib-typedarrays-3210a74e.js +1 -0
- package/dist/mm-install-modal_2.entry-e9e33358.js +1 -0
- package/dist/{portis-59e75b95.js → portis-0126b01f.js} +1 -1
- package/dist/rainbow-46822247.js +1 -0
- package/dist/sha224-58bed7be.js +1 -0
- package/dist/{sha256-cdb06d7c.js → sha256-ad86865d.js} +1 -1
- package/dist/{typed-data-d46cb643.js → typed-data-cc0c21ba.js} +1 -1
- package/dist/uAuth-e9b4faa5.js +1 -0
- package/dist/{walletConnect-23af88ec.js → walletConnect-a7ad9f23.js} +1 -1
- package/dist/{walletLink-782b101e.js → walletLink-a6e7bead.js} +2 -2
- package/package.json +2 -2
- package/dist/cjs/id-07cfd31e.cjs +0 -1
- package/dist/cjs/index-af8c9c8e.cjs +0 -15
- package/dist/cjs/index-b82ccec9.cjs +0 -9
- package/dist/cjs/index.es-d9e722ea.cjs +0 -9
- package/dist/cjs/lib-typedarrays-afe9c8e7.cjs +0 -1
- package/dist/cjs/rainbow-4b5d0839.cjs +0 -1
- package/dist/cjs/sha224-8f3f5508.cjs +0 -1
- package/dist/cjs/uAuth-22dae0a4.cjs +0 -1
- package/dist/cjs/v4-3e682452.cjs +0 -1
- package/dist/id-6dc2a6aa.js +0 -1
- package/dist/index-0534a22e.js +0 -15
- package/dist/index-66392fdc.js +0 -9
- package/dist/index.es-d60f6859.js +0 -9
- package/dist/lib-typedarrays-5ac4ff04.js +0 -1
- package/dist/rainbow-2c04e9df.js +0 -1
- package/dist/sha224-b20bdf3b.js +0 -1
- package/dist/uAuth-a93ad1ec.js +0 -1
- package/dist/v4-95658a31.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,O as t,a0 as n,a1 as r,a2 as o,a3 as a,a4 as i,a5 as l,a6 as s,a7 as u,a8 as c,a9 as d,aa as f,ab as p,ac as h,ad as m,ae as g,af as y,ag as b,ah as v,ai as w,aj as A,ak as k,al as S,am as C,an as E,ao as x,ap as P,z as T}from"./index-de489272.js";export{aq as isInBinance}from"./index-de489272.js";import*as D from"react";import O,{createContext as I,useState as R,useEffect as B,useCallback as z,useContext as N}from"react";import L from"react-dom";import{I as M}from"./interface-501ba1ce.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";import"./id-6dc2a6aa.js";function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t,n){return Q=X()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&K(o,n.prototype),o},Q.apply(null,arguments)}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function U(e,t,n){return t&&j(e.prototype,t),n&&j(e,n),e}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},V(e)}function q(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}function Y(e){return function(e){if(Array.isArray(e))return F(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function J(e){var t="function"==typeof Map?new Map:void 0;return J=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Q(e,arguments,V(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(n,e)},J(e)}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Z(e){var t=X();return function(){var n,r=V(e);if(t){var o=V(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?_(e):t}(this,n)}}var $,ee=Object.defineProperty,te=function(e,t,n){return function(e,t,n){t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!=(void 0===t?"undefined":G(t))?t+"":t,n),n},ne="INTERNAL_ERROR",re="SERVER_ERROR",oe=[-32700,-32600,-32601,-32602,-32603],ae=(W($={},"PARSE_ERROR",{code:-32700,message:"Parse error"}),W($,"INVALID_REQUEST",{code:-32600,message:"Invalid Request"}),W($,"METHOD_NOT_FOUND",{code:-32601,message:"Method not found"}),W($,"INVALID_PARAMS",{code:-32602,message:"Invalid params"}),W($,ne,{code:-32603,message:"Internal error"}),W($,re,{code:-32e3,message:"Server error"}),$),ie=re;function le(e){return Object.keys(ae).includes(e)?ae[e]:ae[ie]}function se(e,t){return(void 0===e?"undefined":G(e))>"u"?le(ne):("string"==typeof e&&(e=q(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){W(e,t,n[t])}))}return e}({},le(re)),{message:e})),(void 0===t?"undefined":G(t))<"u"&&(e.data=t),function(e){return oe.includes(e)}(e.code)&&(e=function(e){return Object.values(ae).find((function(t){return t.code===e}))||ae[ie]}(e.code)),e)}function ue(e,t){var n=function(e){var t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return!((void 0===n?"undefined":G(n))>"u")&&new RegExp(t).test(n)}function ce(e){return ue(e,"^https?:")}function de(e){return"string"==typeof e?e:JSON.stringify(e)}var fe={16:10,24:12,32:14},pe=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],he=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],me=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],ge=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],ye=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],be=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],ve=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],we=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ae=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],ke=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Se=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ce=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ee=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],xe=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Pe=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Te(e){return parseInt("".concat(e))===e}function De(e){if(!Te(e.length))return!1;for(var t=0;t<e.length;t++)if(!Te(e[t])||e[t]<0||e[t]>255)return!1;return!0}function Oe(e){return new Uint8Array(e)}function Ie(e){for(var t=[],n=0;n<e.length;n+=4)t.push(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]);return t}function Re(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!De(e))throw new Error("Array contains invalid value");return new Uint8Array(e)}if(Te(e.length)&&De(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Be(e,t,n,r,o){(null!=r||null!=o)&&(e=e.slice?e.slice(r,o):Array.prototype.slice.call(e,r,o)),t.set(e,n)}var ze=function(){function e(t){H(this,e),te(this,"key"),te(this,"_Ke"),te(this,"_Kd"),this.key=Re(t,!0),this._prepare()}return U(e,[{key:"_prepare",value:function(){var e=fe[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var n,r=4*(e+1),o=this.key.length/4,a=Ie(this.key),i=0;i<o;i++)n=i>>2,this._Ke[n][i%4]=a[i],this._Kd[e-n][i%4]=a[i];for(var l,s=0,u=o;u<r;){if(l=a[o-1],a[0]^=he[l>>16&255]<<24^he[l>>8&255]<<16^he[255&l]<<8^he[l>>24&255]^pe[s]<<24,s+=1,8!=o)for(var c=1;c<o;c++)a[c]^=a[c-1];else{for(var d=1;d<o/2;d++)a[d]^=a[d-1];l=a[o/2-1],a[o/2]^=he[255&l]^he[l>>8&255]<<8^he[l>>16&255]<<16^he[l>>24&255]<<24;for(var f=o/2+1;f<o;f++)a[f]^=a[f-1]}for(var p=0,h=void 0,m=void 0;p<o&&u<r;)h=u>>2,m=u%4,this._Ke[h][m]=a[p],this._Kd[e-h][m]=a[p++],u++}for(var g=1;g<e;g++)for(var y=0;y<4;y++)l=this._Kd[g][y],this._Kd[g][y]=Ce[l>>24&255]^Ee[l>>16&255]^xe[l>>8&255]^Pe[255&l]}},{key:"encrypt",value:function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,n=[0,0,0,0],r=Ie(e),o=0;o<4;o++)r[o]^=this._Ke[0][o];for(var a=1;a<t;a++){for(var i=0;i<4;i++)n[i]=ge[r[i]>>24&255]^ye[r[(i+1)%4]>>16&255]^be[r[(i+2)%4]>>8&255]^ve[255&r[(i+3)%4]]^this._Ke[a][i];r=n.slice()}for(var l,s=Oe(16),u=0;u<4;u++)l=this._Ke[t][u],s[4*u]=255&(he[r[u]>>24&255]^l>>24),s[4*u+1]=255&(he[r[(u+1)%4]>>16&255]^l>>16),s[4*u+2]=255&(he[r[(u+2)%4]>>8&255]^l>>8),s[4*u+3]=255&(he[255&r[(u+3)%4]]^l);return s}},{key:"decrypt",value:function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],r=Ie(e),o=0;o<4;o++)r[o]^=this._Kd[0][o];for(var a=1;a<t;a++){for(var i=0;i<4;i++)n[i]=we[r[i]>>24&255]^Ae[r[(i+3)%4]>>16&255]^ke[r[(i+2)%4]>>8&255]^Se[255&r[(i+1)%4]]^this._Kd[a][i];r=n.slice()}for(var l,s=Oe(16),u=0;u<4;u++)l=this._Kd[t][u],s[4*u]=255&(me[r[u]>>24&255]^l>>24),s[4*u+1]=255&(me[r[(u+3)%4]>>16&255]^l>>16),s[4*u+2]=255&(me[r[(u+2)%4]>>8&255]^l>>8),s[4*u+3]=255&(me[255&r[(u+1)%4]]^l);return s}}]),e}();!function(){function e(t,n){if(H(this,e),te(this,"_aes"),te(this,"_lastCipherblock"),n){if(16!=n.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else n=new Uint8Array(16);this._lastCipherblock=Re(n,!0),this._aes=new ze(t)}U(e,[{key:"encrypt",value:function(e){if(e=Re(e),e.length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Oe(e.length),n=Oe(16),r=0;r<e.length;r+=16){Be(e,n,0,r,r+16);for(var o=0;o<16;o++)n[o]^=this._lastCipherblock[o];this._lastCipherblock=this._aes.encrypt(n),Be(this._lastCipherblock,t,r)}return t}},{key:"decrypt",value:function(e){if(e=Re(e),e.length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Oe(e.length),n=Oe(16),r=0;r<e.length;r+=16){Be(e,n,0,r,r+16),n=this._aes.decrypt(n);for(var o=0;o<16;o++)t[r+o]=n[o]^this._lastCipherblock[o];Be(e,this._lastCipherblock,0,r,r+16)}return t}}])}();var Ne=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r;(r=console).log.apply(r,["[DEBUG]"].concat(Y(t)))};function Le(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function Me(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Le(a,r,o,i,l,"next",e)}function l(e){Le(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){_e(e,t,n[t])}))}return e}function Qe(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function je(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ue(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(e){return function(t){return s([e,t])}}function s(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}"undefined"==typeof window||G(window),function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(n,e);var t=Z(n);function n(e,r){var o;return H(this,n),o=t.call(this,r),te(_(o),"code"),o.code=e,Object.setPrototypeOf(_(o),(function(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}(this,n)?this.constructor:void 0).prototype),o}U(n,[{key:"toString",value:function(){return"".concat(this.message," (").concat(this.code,")")}}])}(J(Error));var We,Ve=Object.defineProperty,qe=function(e,t,n){return function(e,t,n){t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!=(void 0===t?"undefined":je(t))?t+"":t,n),n},Ke={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Ye=function(){function n(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.url=t,qe(this,"events",new e),qe(this,"isAvailable",!1),qe(this,"registering",!1),!ce(t))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(t));this.url=t}return function(e,t,n){t&&Fe(e.prototype,t),n&&Fe(e,n)}(n,[{key:"connected",get:function(){return this.isAvailable}},{key:"connecting",get:function(){return this.registering}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,t=this;return Me((function(){return Ue(this,(function(n){switch(n.label){case 0:return[4,t.register(e)];case 1:return n.sent(),[2]}}))}))()}},{key:"close",value:function(){var e=this;return Me((function(){return Ue(this,(function(t){if(!e.isAvailable)throw new Error("Connection already closed");return e.onClose(),[2]}))}))()}},{key:"request",value:function(e){var n=this;return Me((function(){var r,o,a,i;return Ue(this,(function(l){switch(l.label){case 0:return Ne("HttpClient ~ request ~ payload:",e),n.isAvailable?[3,2]:[4,n.register()];case 1:l.sent(),l.label=2;case 2:l.label=3;case 3:return l.trys.push([3,6,,7]),r=de(e),[4,t(n.url,Qe(He({},Ke),{body:r}))];case 4:return[4,l.sent().json()];case 5:return o=l.sent(),a="string"==typeof o?function(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type ".concat(void 0===e?"undefined":G(e)));try{return JSON.parse(e)}catch(t){return e}}(o):o,[2,(Ne("HttpClient ~ request ~ result:",a),a)];case 6:return i=l.sent(),[2,n.formatError(e.id,i)];case 7:return[2]}}))}))()}},{key:"formatError",value:function(e,t){var n=this.parseError(t);return function(e,t,n){return{id:e,jsonrpc:"2.0",error:se(t,n)}}(e,n.message||n.toString())}},{key:"register",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,n=this;return Me((function(){var r,o,a;return Ue(this,(function(i){switch(i.label){case 0:if(!ce(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));if(n.registering)return[2,new Promise((function(e,t){n.events.once("register_error",(function(e){t(e)})),n.events.once("open",(function(){if(je(n.isAvailable)>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))];n.url=e,n.registering=!0,i.label=1;case 1:return i.trys.push([1,3,,4]),r=de({id:1,jsonrpc:"2.0",method:"test",params:[]}),[4,t(e,Qe(He({},Ke),{body:r}))];case 2:return i.sent(),n.onOpen(),[3,4];case 3:throw o=i.sent(),a=n.parseError(o),n.events.emit("register_error",a),n.onClose(),a;case 4:return[2]}}))}))()}},{key:"onOpen",value:function(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}},{key:"onClose",value:function(){this.isAvailable=!1,this.registering=!1,this.events.emit("open")}},{key:"parseError",value:function(e){return function(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error("Unavailable ".concat(n," RPC url at ").concat(t)):e}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url,"HTTP")}}]),n}(),Ge={exports:{}},Je={},Xe={exports:{}},Ze={};var $e,et,tt,nt={};
|
|
1
|
+
import{$ as e,O as t,a0 as n,a1 as r,a2 as o,a3 as a,a4 as i,a5 as l,a6 as s,a7 as u,a8 as c,a9 as d,aa as f,ab as p,ac as h,ad as m,ae as g,af as y,ag as b,ah as v,ai as w,aj as A,ak as k,al as S,am as C,an as E,ao as x,ap as P,z as T}from"./index-46da6d5f.js";export{aq as isInBinance}from"./index-46da6d5f.js";import*as D from"react";import O,{createContext as I,useState as R,useEffect as B,useCallback as z,useContext as N}from"react";import L from"react-dom";import{I as M}from"./interface-367d293e.js";import"@ethersproject/address";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";import"./id-72e0c1a1.js";function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t,n){return Q=X()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&K(o,n.prototype),o},Q.apply(null,arguments)}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function U(e,t,n){return t&&j(e.prototype,t),n&&j(e,n),e}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(e){return V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},V(e)}function q(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function K(e,t){return K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},K(e,t)}function Y(e){return function(e){if(Array.isArray(e))return F(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function J(e){var t="function"==typeof Map?new Map:void 0;return J=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return Q(e,arguments,V(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(n,e)},J(e)}function X(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Z(e){var t=X();return function(){var n,r=V(e);if(t){var o=V(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?_(e):t}(this,n)}}var $,ee=Object.defineProperty,te=function(e,t,n){return function(e,t,n){t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!=(void 0===t?"undefined":G(t))?t+"":t,n),n},ne="INTERNAL_ERROR",re="SERVER_ERROR",oe=[-32700,-32600,-32601,-32602,-32603],ae=(W($={},"PARSE_ERROR",{code:-32700,message:"Parse error"}),W($,"INVALID_REQUEST",{code:-32600,message:"Invalid Request"}),W($,"METHOD_NOT_FOUND",{code:-32601,message:"Method not found"}),W($,"INVALID_PARAMS",{code:-32602,message:"Invalid params"}),W($,ne,{code:-32603,message:"Internal error"}),W($,re,{code:-32e3,message:"Server error"}),$),ie=re;function le(e){return Object.keys(ae).includes(e)?ae[e]:ae[ie]}function se(e,t){return(void 0===e?"undefined":G(e))>"u"?le(ne):("string"==typeof e&&(e=q(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){W(e,t,n[t])}))}return e}({},le(re)),{message:e})),(void 0===t?"undefined":G(t))<"u"&&(e.data=t),function(e){return oe.includes(e)}(e.code)&&(e=function(e){return Object.values(ae).find((function(t){return t.code===e}))||ae[ie]}(e.code)),e)}function ue(e,t){var n=function(e){var t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return!((void 0===n?"undefined":G(n))>"u")&&new RegExp(t).test(n)}function ce(e){return ue(e,"^https?:")}function de(e){return"string"==typeof e?e:JSON.stringify(e)}var fe={16:10,24:12,32:14},pe=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],he=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],me=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],ge=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],ye=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],be=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],ve=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],we=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ae=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],ke=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Se=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ce=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ee=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],xe=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Pe=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Te(e){return parseInt("".concat(e))===e}function De(e){if(!Te(e.length))return!1;for(var t=0;t<e.length;t++)if(!Te(e[t])||e[t]<0||e[t]>255)return!1;return!0}function Oe(e){return new Uint8Array(e)}function Ie(e){for(var t=[],n=0;n<e.length;n+=4)t.push(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]);return t}function Re(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!De(e))throw new Error("Array contains invalid value");return new Uint8Array(e)}if(Te(e.length)&&De(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Be(e,t,n,r,o){(null!=r||null!=o)&&(e=e.slice?e.slice(r,o):Array.prototype.slice.call(e,r,o)),t.set(e,n)}var ze=function(){function e(t){H(this,e),te(this,"key"),te(this,"_Ke"),te(this,"_Kd"),this.key=Re(t,!0),this._prepare()}return U(e,[{key:"_prepare",value:function(){var e=fe[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var n,r=4*(e+1),o=this.key.length/4,a=Ie(this.key),i=0;i<o;i++)n=i>>2,this._Ke[n][i%4]=a[i],this._Kd[e-n][i%4]=a[i];for(var l,s=0,u=o;u<r;){if(l=a[o-1],a[0]^=he[l>>16&255]<<24^he[l>>8&255]<<16^he[255&l]<<8^he[l>>24&255]^pe[s]<<24,s+=1,8!=o)for(var c=1;c<o;c++)a[c]^=a[c-1];else{for(var d=1;d<o/2;d++)a[d]^=a[d-1];l=a[o/2-1],a[o/2]^=he[255&l]^he[l>>8&255]<<8^he[l>>16&255]<<16^he[l>>24&255]<<24;for(var f=o/2+1;f<o;f++)a[f]^=a[f-1]}for(var p=0,h=void 0,m=void 0;p<o&&u<r;)h=u>>2,m=u%4,this._Ke[h][m]=a[p],this._Kd[e-h][m]=a[p++],u++}for(var g=1;g<e;g++)for(var y=0;y<4;y++)l=this._Kd[g][y],this._Kd[g][y]=Ce[l>>24&255]^Ee[l>>16&255]^xe[l>>8&255]^Pe[255&l]}},{key:"encrypt",value:function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,n=[0,0,0,0],r=Ie(e),o=0;o<4;o++)r[o]^=this._Ke[0][o];for(var a=1;a<t;a++){for(var i=0;i<4;i++)n[i]=ge[r[i]>>24&255]^ye[r[(i+1)%4]>>16&255]^be[r[(i+2)%4]>>8&255]^ve[255&r[(i+3)%4]]^this._Ke[a][i];r=n.slice()}for(var l,s=Oe(16),u=0;u<4;u++)l=this._Ke[t][u],s[4*u]=255&(he[r[u]>>24&255]^l>>24),s[4*u+1]=255&(he[r[(u+1)%4]>>16&255]^l>>16),s[4*u+2]=255&(he[r[(u+2)%4]>>8&255]^l>>8),s[4*u+3]=255&(he[255&r[(u+3)%4]]^l);return s}},{key:"decrypt",value:function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,n=[0,0,0,0],r=Ie(e),o=0;o<4;o++)r[o]^=this._Kd[0][o];for(var a=1;a<t;a++){for(var i=0;i<4;i++)n[i]=we[r[i]>>24&255]^Ae[r[(i+3)%4]>>16&255]^ke[r[(i+2)%4]>>8&255]^Se[255&r[(i+1)%4]]^this._Kd[a][i];r=n.slice()}for(var l,s=Oe(16),u=0;u<4;u++)l=this._Kd[t][u],s[4*u]=255&(me[r[u]>>24&255]^l>>24),s[4*u+1]=255&(me[r[(u+3)%4]>>16&255]^l>>16),s[4*u+2]=255&(me[r[(u+2)%4]>>8&255]^l>>8),s[4*u+3]=255&(me[255&r[(u+1)%4]]^l);return s}}]),e}();!function(){function e(t,n){if(H(this,e),te(this,"_aes"),te(this,"_lastCipherblock"),n){if(16!=n.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else n=new Uint8Array(16);this._lastCipherblock=Re(n,!0),this._aes=new ze(t)}U(e,[{key:"encrypt",value:function(e){if(e=Re(e),e.length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Oe(e.length),n=Oe(16),r=0;r<e.length;r+=16){Be(e,n,0,r,r+16);for(var o=0;o<16;o++)n[o]^=this._lastCipherblock[o];this._lastCipherblock=this._aes.encrypt(n),Be(this._lastCipherblock,t,r)}return t}},{key:"decrypt",value:function(e){if(e=Re(e),e.length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Oe(e.length),n=Oe(16),r=0;r<e.length;r+=16){Be(e,n,0,r,r+16),n=this._aes.decrypt(n);for(var o=0;o<16;o++)t[r+o]=n[o]^this._lastCipherblock[o];Be(e,this._lastCipherblock,0,r,r+16)}return t}}])}();var Ne=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r;(r=console).log.apply(r,["[DEBUG]"].concat(Y(t)))};function Le(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function Me(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Le(a,r,o,i,l,"next",e)}function l(e){Le(a,r,o,i,l,"throw",e)}i(void 0)}))}}function Fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){_e(e,t,n[t])}))}return e}function Qe(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function je(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function Ue(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(e){return function(t){return s([e,t])}}function s(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}"undefined"==typeof window||G(window),function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(n,e);var t=Z(n);function n(e,r){var o;return H(this,n),o=t.call(this,r),te(_(o),"code"),o.code=e,Object.setPrototypeOf(_(o),(function(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}(this,n)?this.constructor:void 0).prototype),o}U(n,[{key:"toString",value:function(){return"".concat(this.message," (").concat(this.code,")")}}])}(J(Error));var We,Ve=Object.defineProperty,qe=function(e,t,n){return function(e,t,n){t in e?Ve(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n}(e,"symbol"!=(void 0===t?"undefined":je(t))?t+"":t,n),n},Ke={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Ye=function(){function n(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.url=t,qe(this,"events",new e),qe(this,"isAvailable",!1),qe(this,"registering",!1),!ce(t))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(t));this.url=t}return function(e,t,n){t&&Fe(e.prototype,t),n&&Fe(e,n)}(n,[{key:"connected",get:function(){return this.isAvailable}},{key:"connecting",get:function(){return this.registering}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,t=this;return Me((function(){return Ue(this,(function(n){switch(n.label){case 0:return[4,t.register(e)];case 1:return n.sent(),[2]}}))}))()}},{key:"close",value:function(){var e=this;return Me((function(){return Ue(this,(function(t){if(!e.isAvailable)throw new Error("Connection already closed");return e.onClose(),[2]}))}))()}},{key:"request",value:function(e){var n=this;return Me((function(){var r,o,a,i;return Ue(this,(function(l){switch(l.label){case 0:return Ne("HttpClient ~ request ~ payload:",e),n.isAvailable?[3,2]:[4,n.register()];case 1:l.sent(),l.label=2;case 2:l.label=3;case 3:return l.trys.push([3,6,,7]),r=de(e),[4,t(n.url,Qe(He({},Ke),{body:r}))];case 4:return[4,l.sent().json()];case 5:return o=l.sent(),a="string"==typeof o?function(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type ".concat(void 0===e?"undefined":G(e)));try{return JSON.parse(e)}catch(t){return e}}(o):o,[2,(Ne("HttpClient ~ request ~ result:",a),a)];case 6:return i=l.sent(),[2,n.formatError(e.id,i)];case 7:return[2]}}))}))()}},{key:"formatError",value:function(e,t){var n=this.parseError(t);return function(e,t,n){return{id:e,jsonrpc:"2.0",error:se(t,n)}}(e,n.message||n.toString())}},{key:"register",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url,n=this;return Me((function(){var r,o,a;return Ue(this,(function(i){switch(i.label){case 0:if(!ce(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));if(n.registering)return[2,new Promise((function(e,t){n.events.once("register_error",(function(e){t(e)})),n.events.once("open",(function(){if(je(n.isAvailable)>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))];n.url=e,n.registering=!0,i.label=1;case 1:return i.trys.push([1,3,,4]),r=de({id:1,jsonrpc:"2.0",method:"test",params:[]}),[4,t(e,Qe(He({},Ke),{body:r}))];case 2:return i.sent(),n.onOpen(),[3,4];case 3:throw o=i.sent(),a=n.parseError(o),n.events.emit("register_error",a),n.onClose(),a;case 4:return[2]}}))}))()}},{key:"onOpen",value:function(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}},{key:"onClose",value:function(){this.isAvailable=!1,this.registering=!1,this.events.emit("open")}},{key:"parseError",value:function(e){return function(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error("Unavailable ".concat(n," RPC url at ").concat(t)):e}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url,"HTTP")}}]),n}(),Ge={exports:{}},Je={},Xe={exports:{}},Ze={};var $e,et,tt,nt={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* scheduler.development.js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aC as t,A as e}from"./index-46da6d5f.js";export{aD as getAlchemySigner}from"./index-46da6d5f.js";import"@ethersproject/providers";import"zustand";import"@ethersproject/bytes";import"@ethersproject/properties";import"@ethersproject/address";import"@ethersproject/abstract-signer";import"buffer";import"@ethersproject/abstract-provider";import"@ethersproject/contracts";import"events";import"@ethersproject/constants";import"@ethersproject/transactions";async function r(e,r){const o=await t(e);return o.on("connect",r.connect),o.on("disconnect",r.disconnect),o.on("accountsChanged",r.accountsChanged),o.on("chainChanged",r.chainChanged),o.on("message",r.message),o}function o(){const t=e.getState().provider?.provider;if(t)return t.disconnect()}function n(t){return e.getState().provider?.smartAccountClient?.account?.signTypedDataWith6492?.(t)}export{r as default,o as disconnect,n as signTypedData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{K as e}from"./index-46da6d5f.js";import{r as t}from"./__tslib-6e4ae2f5.js";function s(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(s){if("default"!==s&&!(s in e)){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}))})),Object.freeze(e)}var n,i={},r={},o={},a={},c={};function h(){return n||(n=1,Object.defineProperty(c,"__esModule",{value:!0}),c.E_CANCELED=c.E_ALREADY_LOCKED=c.E_TIMEOUT=void 0,c.E_TIMEOUT=new Error("timeout while waiting for mutex to become available"),c.E_ALREADY_LOCKED=new Error("mutex already locked"),c.E_CANCELED=new Error("request for lock canceled")),c}Object.defineProperty(a,"__esModule",{value:!0});var u=t,l=h(),d=function(){function e(e,t){void 0===t&&(t=l.E_CANCELED),this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}return e.prototype.acquire=function(e,t){var s=this;if(void 0===e&&(e=1),void 0===t&&(t=0),e<=0)throw new Error("invalid weight ".concat(e,": must be positive"));return new Promise((function(n,i){var r={resolve:n,reject:i,weight:e,priority:t},o=_(s._queue,(function(e){return t<=e.priority}));-1===o&&e<=s._value?s._dispatchItem(r):s._queue.splice(o+1,0,r)}))},e.prototype.runExclusive=function(e){return u.__awaiter(this,arguments,void 0,(function(e,t,s){var n,i,r;return void 0===t&&(t=1),void 0===s&&(s=0),u.__generator(this,(function(o){switch(o.label){case 0:return[4,this.acquire(t,s)];case 1:n=o.sent(),i=n[0],r=n[1],o.label=2;case 2:return o.trys.push([2,,4,5]),[4,e(i)];case 3:return[2,o.sent()];case 4:return r(),[7];case 5:return[2]}}))}))},e.prototype.waitForUnlock=function(e,t){var s=this;if(void 0===e&&(e=1),void 0===t&&(t=0),e<=0)throw new Error("invalid weight ".concat(e,": must be positive"));return this._couldLockImmediately(e,t)?Promise.resolve():new Promise((function(n){var i,r,o;s._weightedWaiters[e-1]||(s._weightedWaiters[e-1]=[]),i=s._weightedWaiters[e-1],r={resolve:n,priority:t},o=_(i,(function(e){return r.priority<=e.priority})),i.splice(o+1,0,r)}))},e.prototype.isLocked=function(){return this._value<=0},e.prototype.getValue=function(){return this._value},e.prototype.setValue=function(e){this._value=e,this._dispatchQueue()},e.prototype.release=function(e){if(void 0===e&&(e=1),e<=0)throw new Error("invalid weight ".concat(e,": must be positive"));this._value+=e,this._dispatchQueue()},e.prototype.cancel=function(){var e=this;this._queue.forEach((function(t){return t.reject(e._cancelError)})),this._queue=[]},e.prototype._dispatchQueue=function(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()},e.prototype._dispatchItem=function(e){var t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])},e.prototype._newReleaser=function(e){var t=this,s=!1;return function(){s||(s=!0,t.release(e))}},e.prototype._drainUnlockWaiters=function(){if(0===this._queue.length)for(var e=this._value;e>0;e--){(s=this._weightedWaiters[e-1])&&(s.forEach((function(e){return e.resolve()})),this._weightedWaiters[e-1]=[])}else{var t=this._queue[0].priority;for(e=this._value;e>0;e--){var s;if(s=this._weightedWaiters[e-1]){var n=s.findIndex((function(e){return e.priority<=t}));(-1===n?s:s.splice(0,n)).forEach((function(e){return e.resolve()}))}}}},e.prototype._couldLockImmediately=function(e,t){return(0===this._queue.length||this._queue[0].priority<t)&&e<=this._value},e}();function _(e,t){for(var s=e.length-1;s>=0;s--)if(t(e[s]))return s;return-1}a.default=d,Object.defineProperty(o,"__esModule",{value:!0});var f=t,p=a,b=function(){function e(e){this._semaphore=new p.default(1,e)}return e.prototype.acquire=function(){return f.__awaiter(this,arguments,void 0,(function(e){var t;return void 0===e&&(e=0),f.__generator(this,(function(s){switch(s.label){case 0:return[4,this._semaphore.acquire(1,e)];case 1:return t=s.sent(),[2,t[1]]}}))}))},e.prototype.runExclusive=function(e,t){return void 0===t&&(t=0),this._semaphore.runExclusive((function(){return e()}),1,t)},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.waitForUnlock=function(e){return void 0===e&&(e=0),this._semaphore.waitForUnlock(1,e)},e.prototype.release=function(){this._semaphore.isLocked()&&this._semaphore.release()},e.prototype.cancel=function(){return this._semaphore.cancel()},e}();o.default=b;var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.withTimeout=void 0;var m=t,v=h();function y(e){return void 0!==e.getValue}g.withTimeout=function(e,t,s){var n=this;return void 0===s&&(s=v.E_TIMEOUT),{acquire:function(i,r){var o;if(y(e)?o=i:(o=void 0,r=i),void 0!==o&&o<=0)throw new Error("invalid weight ".concat(o,": must be positive"));return new Promise((function(i,a){return m.__awaiter(n,void 0,void 0,(function(){var n,c,h,u;return m.__generator(this,(function(l){switch(l.label){case 0:n=!1,c=setTimeout((function(){n=!0,a(s)}),t),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,y(e)?e.acquire(o,r):e.acquire(r)];case 2:return h=l.sent(),n?(Array.isArray(h)?h[1]:h)():(clearTimeout(c),i(h)),[3,4];case 3:return u=l.sent(),n||(clearTimeout(c),a(u)),[3,4];case 4:return[2]}}))}))}))},runExclusive:function(e,t,s){return m.__awaiter(this,void 0,void 0,(function(){var n,i;return m.__generator(this,(function(r){switch(r.label){case 0:n=function(){},r.label=1;case 1:return r.trys.push([1,,7,8]),[4,this.acquire(t,s)];case 2:return i=r.sent(),Array.isArray(i)?(n=i[1],[4,e(i[0])]):[3,4];case 3:return[2,r.sent()];case 4:return n=i,[4,e()];case 5:return[2,r.sent()];case 6:return[3,8];case 7:return n(),[7];case 8:return[2]}}))}))},release:function(t){e.release(t)},cancel:function(){return e.cancel()},waitForUnlock:function(n,i){var r;if(y(e)?r=n:(r=void 0,i=n),void 0!==r&&r<=0)throw new Error("invalid weight ".concat(r,": must be positive"));return new Promise((function(n,o){var a=setTimeout((function(){return o(s)}),t);(y(e)?e.waitForUnlock(r,i):e.waitForUnlock(i)).then((function(){clearTimeout(a),n()}))}))},isLocked:function(){return e.isLocked()},getValue:function(){return e.getValue()},setValue:function(t){return e.setValue(t)}}};var S={};Object.defineProperty(S,"__esModule",{value:!0}),S.tryAcquire=void 0;var w=h(),T=g;S.tryAcquire=function(e,t){return void 0===t&&(t=w.E_ALREADY_LOCKED),(0,T.withTimeout)(e,0,t)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tryAcquire=e.withTimeout=e.Semaphore=e.Mutex=void 0;var s=t,n=o;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return n.default}});var i=a;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return i.default}});var r=g;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return r.withTimeout}});var c=S;Object.defineProperty(e,"tryAcquire",{enumerable:!0,get:function(){return c.tryAcquire}}),s.__exportStar(h(),e)}(r);var P={};!function(e){function t(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{c(n.next(e))}catch(e){r(e)}}function a(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))}function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var n,i={exports:{}};var r,o,a,c,h,u,l,d,_,f=function(){if(n)return i.exports;n=1;var e,t="object"==typeof Reflect?Reflect:null,s=t&&"function"==typeof t.apply?t.apply:function(e,t,s){return Function.prototype.apply.call(e,t,s)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}i.exports=o,i.exports.once=function(e,t){return new Promise((function(s,n){function i(s){e.removeListener(t,r),n(s)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",i),s([].slice.call(arguments))}b(e,t,r,{once:!0}),"error"!==t&&function(e,t,s){"function"==typeof e.on&&b(e,"error",t,s)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,s,n){var i,r,o,a;if(c(s),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),r=e._events),o=r[t]),void 0===o)o=r[t]=s,++e._eventsCount;else if("function"==typeof o?o=r[t]=n?[s,o]:[o,s]:n?o.unshift(s):o.push(s),(i=h(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,s){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},i=l.bind(n);return i.listener=s,n.wrapFn=i,i}function _(e,t,s){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?s?[i.listener||i]:[i]:s?function(e){for(var t=new Array(e.length),s=0;s<t.length;++s)t[s]=e[s].listener||e[s];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var s=t[e];if("function"==typeof s)return 1;if(void 0!==s)return s.length}return 0}function p(e,t){for(var s=new Array(t),n=0;n<t;++n)s[n]=e[n];return s}function b(e,t,s,n){if("function"==typeof e.on)n.once?e.once(t,s):e.on(t,s);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(r){n.once&&e.removeEventListener(t,i),s(r)}))}}return Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return h(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=r[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var h=c.length,u=p(c,h);for(n=0;n<h;++n)s(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return c(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var s,n,i,r,o;if(c(t),void 0===(n=this._events))return this;if(void 0===(s=n[e]))return this;if(s===t||s.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,s.listener||t));else if("function"!=typeof s){for(i=-1,r=s.length-1;r>=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,i=r;break}if(i<0)return this;0===i?s.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(s,i),1===s.length&&(n[e]=s[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,s,n;if(void 0===(s=this._events))return this;if(void 0===s.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==s[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete s[e]),this;if(0===arguments.length){var i,r=Object.keys(s);for(n=0;n<r.length;++n)"removeListener"!==(i=r[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=s[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return _(this,e,!0)},o.prototype.rawListeners=function(e){return _(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},i.exports}(),p=s(f);function b(e){return null!=e&&"function"==typeof e}function g(e,t,s){e>31&&(e=31);const n=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)}(0,Math.min(s,t*Math.pow(2,e)));return Math.min(s,t+n)}function m(e){return Math.min(1e3*e,2147483647)}e.errorCodes=void 0,(r=e.errorCodes||(e.errorCodes={}))[r.timeout=1]="timeout",r[r.transportClosed=2]="transportClosed",r[r.clientDisconnected=3]="clientDisconnected",r[r.clientClosed=4]="clientClosed",r[r.clientConnectToken=5]="clientConnectToken",r[r.clientRefreshToken=6]="clientRefreshToken",r[r.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",r[r.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",r[r.subscriptionRefreshToken=9]="subscriptionRefreshToken",r[r.transportWriteError=10]="transportWriteError",r[r.connectionClosed=11]="connectionClosed",r[r.badConfiguration=12]="badConfiguration",r[r.subscriptionGetState=13]="subscriptionGetState",r[r.sharedPollGetSignature=14]="sharedPollGetSignature",e.connectingCodes=void 0,(o=e.connectingCodes||(e.connectingCodes={}))[o.connectCalled=0]="connectCalled",o[o.transportClosed=1]="transportClosed",o[o.noPing=2]="noPing",o[o.subscribeTimeout=3]="subscribeTimeout",o[o.unsubscribeError=4]="unsubscribeError",e.disconnectedCodes=void 0,(a=e.disconnectedCodes||(e.disconnectedCodes={}))[a.disconnectCalled=0]="disconnectCalled",a[a.unauthorized=1]="unauthorized",a[a.badProtocol=2]="badProtocol",a[a.messageSizeLimit=3]="messageSizeLimit",e.subscribingCodes=void 0,(c=e.subscribingCodes||(e.subscribingCodes={}))[c.subscribeCalled=0]="subscribeCalled",c[c.transportClosed=1]="transportClosed",e.unsubscribedCodes=void 0,(h=e.unsubscribedCodes||(e.unsubscribedCodes={}))[h.unsubscribeCalled=0]="unsubscribeCalled",h[h.unauthorized=1]="unauthorized",h[h.clientClosed=2]="clientClosed",e.subscriptionFlags=void 0,(u=e.subscriptionFlags||(e.subscriptionFlags={}))[u.channelCompaction=1]="channelCompaction",u[u.rejectUnrecovered=2]="rejectUnrecovered",e.State=void 0,(l=e.State||(e.State={})).Disconnected="disconnected",l.Connecting="connecting",l.Connected="connected",e.SubscriptionState=void 0,(d=e.SubscriptionState||(e.SubscriptionState={})).Unsubscribed="unsubscribed",d.Subscribing="subscribing",d.Subscribed="subscribed",function(e){e[e.Live=0]="Live",e[e.Stream=1]="Stream",e[e.State=2]="State"}(_||(_={}));class v extends p{constructor(t,s,n){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this._getState=null,this._map=!1,this._mapPresenceType=1,this._mapPhase=null,this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapCursor="",this._mapPageSize=0,this._mapUnrecoverableStrategy="from_scratch",this._debounceMs=0,this._debouncePending=new Map,this._sharedPoll=!1,this._sharedPollEpoch="",this._sharedPollTrackedItems=new Map,this._sharedPollGetSignature=null,this._sharedPollSignatureRefreshTimeout=null,this._sharedPollSignatureRefreshAttempts=0,this._sharedPollTrackRetryTimeout=null,this._sharedPollTrackRetryAttempts=0,this._sharedPollReplayRetryTimeout=null,this._sharedPollReplayRetryAttempts=0,this._sharedPollSignatures=[],this._sharedPollSignatureRefreshTargetMs=null,this._sharedPollSignatureRefreshInFlight=!1,this.channel=s,this.state=e.SubscriptionState.Unsubscribed,this._centrifuge=t,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValueMap=new Map,this._unsubPromise=Promise.resolve(),this._deltaNumPubs=0,this._deltaNumFull=0,this._deltaNumDelta=0,this._deltaBytesReceived=0,this._deltaBytesDecoded=0,this._setOptions(n),this.type=this._sharedPoll?"shared_poll":this._map?"map":"stream",this._centrifuge._debugEnabled?(this.on("state",(e=>{this._debug("subscription state",s,e.oldState,"->",e.newState)})),this.on("error",(e=>{this._debug("subscription error",s,e)}))):this.on("error",(function(){Function.prototype()}))}ready(t){return this.state===e.SubscriptionState.Unsubscribed?Promise.reject({code:e.errorCodes.subscriptionUnsubscribed,message:this.state}):this.state===e.SubscriptionState.Subscribed?Promise.resolve():new Promise(((s,n)=>{const i={resolve:s,reject:n};t&&(i.timeout=setTimeout((function(){n({code:e.errorCodes.timeout,message:"timeout"})}),t)),this._promises[this._nextPromiseId()]=i}))}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(e.subscribingCodes.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(e.unsubscribedCodes.unsubscribeCalled,"unsubscribe called",!0)}_debouncedPublish(e,t,s){const n=this._debouncePending.get(e);if(n)return n.data=t,n.dirty=!0,Promise.resolve({});const i={data:t,dirty:!1,timer:null};i.timer=setTimeout((()=>{const t=this._debouncePending.get(e);if(!t||!t.dirty)return void this._debouncePending.delete(e);t.dirty=!1;const n=t.data;(s?this._centrifuge.mapPublish(this.channel,e,n):this._centrifuge.publish(this.channel,n)).catch((()=>{})),t.timer=setTimeout((()=>{const t=this._debouncePending.get(e);t&&t.dirty?(this._debouncePending.delete(e),this._debouncedPublish(e,t.data,s)):this._debouncePending.delete(e)}),this._debounceMs)}),this._debounceMs),this._debouncePending.set(e,i);return s?this._centrifuge.mapPublish(this.channel,e,t):this._centrifuge.publish(this.channel,t)}_cancelDebounce(e){const t=this._debouncePending.get(e);t&&(clearTimeout(t.timer),this._debouncePending.delete(e))}_cancelAllDebounce(){for(const[,e]of this._debouncePending)clearTimeout(e.timer);this._debouncePending.clear()}presence(){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)}))}presenceStats(){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)}))}setTagsFilter(e){if(e&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=e,this._map&&(this._recover=!1,this._offset=null,this._epoch=null)}setData(e){this._data=e}deltaStats(){const e=this._deltaBytesDecoded;return{numPublications:this._deltaNumPubs,numFullPayloads:this._deltaNumFull,numDeltaPayloads:this._deltaNumDelta,bytesReceived:this._deltaBytesReceived,bytesDecoded:e,compressionRatio:e>0?1-this._deltaBytesReceived/e:0}}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:e.errorCodes.subscriptionUnsubscribed,message:this.state}):new Promise(((t,s)=>{const n=this._centrifuge._config.timeout,i=setTimeout((()=>{s({code:e.errorCodes.timeout,message:"timeout"})}),n);this._promises[this._nextPromiseId()]={timeout:i,resolve:t,reject:s}}))}_nextPromiseId(){return++this._promiseId}_needRecover(){return!0===this._recover}_isUnsubscribed(){return this.state===e.SubscriptionState.Unsubscribed}_isSubscribing(){return this.state===e.SubscriptionState.Subscribing}_isSubscribed(){return this.state===e.SubscriptionState.Subscribed}_setState(e){if(this.state!==e){const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return""!==this._token||null!==this._getToken}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout(),this._clearSharedPollSignatureRefresh(),this._clearSharedPollTrackRetry(),this._clearSharedPollReplayRetry(),this._sharedPollSignatureRefreshTargetMs=null,this._sharedPollSignatureRefreshInFlight=!1}_invalidateState(){this._token="",this._prevValueMap=new Map,this._map&&(this._offset=null,this._epoch=null,this._recover=!1,this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapCursor="",this._mapPhase=null)}_setSubscribed(t){if(!this._isSubscribing())return;if(this._clearSubscribingState(),t.id&&(this._id=t.id),t.recoverable&&(this._recover=!0,this._offset=t.offset||0,this._epoch=t.epoch||""),t.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,t.publish_debounce&&(this._debounceMs=t.publish_debounce),this._sharedPoll){const e=t.epoch||"";if(""!==this._sharedPollEpoch&&this._sharedPollEpoch!==e)for(const e of this._sharedPollTrackedItems.keys())this._sharedPollTrackedItems.set(e,0);this._sharedPollEpoch=e}this._setState(e.SubscriptionState.Subscribed);const s=this._centrifuge._getSubscribeContext(this.channel,t);this.emit("subscribed",s),this._resolvePromises();const n=t.publications;if(n&&n.length>0)for(const e in n)n.hasOwnProperty(e)&&this._handlePublication(n[e]);!0===t.expires&&(this._refreshTimeout=setTimeout((()=>this._refresh()),m(t.ttl)))}_setSubscribing(s,n){return t(this,void 0,void 0,(function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(e.SubscriptionState.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:s,reason:n}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())}))}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._map?(this._mapSubscribe(),null):this._getState&&null===this._offset?(this._loadStreamState(),null):this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then((e=>this._handleTokenResponse(e))).catch((e=>this._handleTokenError(e))),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_loadStreamState(){this._isSubscribing()?this._getState().then((e=>{this._isSubscribing()?(this._offset=e.offset,this._epoch=e.epoch,this._recover=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():this._getSubscriptionToken().then((e=>this._handleTokenResponse(e))).catch((e=>this._handleTokenError(e)))):this._inflight=!1})).catch((t=>{this._isSubscribing()?(this._inflight=!1,this._subscribeError({code:e.errorCodes.subscriptionGetState,message:(null==t?void 0:t.toString())||"getState failed",temporary:!0})):this._inflight=!1})):this._inflight=!1}_getDataAndSubscribe(e){this._getData?this._getData({channel:this.channel}).then((t=>{this._isSubscribing()?(this._data=t,this._sendSubscribe(e)):this._inflight=!1})).catch((e=>this._handleGetDataError(e))):this._inflight=!1}_handleGetDataError(t){if(this._isSubscribing()){if(t instanceof A)return this._inflight=!1,void this._failUnauthorized();this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:e.errorCodes.badConfiguration,message:(null==t?void 0:t.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}else this._inflight=!1}_handleTokenResponse(e){if(this._isSubscribing()){if(!e)return this._inflight=!1,void this._failUnauthorized();this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}else this._inflight=!1}_handleTokenError(t){if(this._isSubscribing()){if(t instanceof A)return this._inflight=!1,void this._failUnauthorized();this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:e.errorCodes.subscriptionSubscribeToken,message:(null==t?void 0:t.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}else this._inflight=!1}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;const t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then((e=>{this._inflight=!1;const t=e.reply.subscribe;this._handleSubscribeResponse(t),e.next&&e.next()}),(e=>{this._inflight=!1,this._handleSubscribeError(e.error),e.next&&e.next()})),t}_buildSubscribeCommand(t){const s={channel:this.channel};if(t&&(s.token=t),this._data&&(s.data=this._data),this._sharedPoll)return s.type=4,this._delta&&(s.delta=this._delta),{subscribe:s};if(this._positioned&&(s.positioned=!0),this._recoverable&&(s.recoverable=!0),this._joinLeave&&(s.join_leave=!0),s.flag=e.subscriptionFlags.channelCompaction,this._getState&&(s.flag|=e.subscriptionFlags.rejectUnrecovered),this._needRecover()){s.recover=!0;const e=this._getOffset();e&&(s.offset=e);const t=this._getEpoch();t&&(s.epoch=t)}return this._delta&&(s.delta=this._delta),this._tagsFilter&&(s.tf=this._tagsFilter),{subscribe:s}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(t){if(this._isSubscribing()){if(t.code!==e.errorCodes.timeout)return 112===t.code&&this._getState?(this._offset=null,this._epoch=null,this._recover=!1,this._prevValueMap=new Map,void this._scheduleResubscribe()):void this._subscribeError(t);this._centrifuge._disconnect(e.connectingCodes.subscribeTimeout,"subscribe timeout",!0)}}_handleSubscribeResponse(e){this._isSubscribing()&&(this._setSubscribed(e),this._sharedPoll&&this._sharedPollReplayTrack())}_setUnsubscribed(t,s,n){if(this._isUnsubscribed())return Promise.resolve();let i=Promise.resolve();return this._isSubscribed()?(n&&(i=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&n&&(i=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._sharedPollEpoch="",this._sharedPollSignatures=[],this._sharedPollTrackedItems.clear(),this._sharedPollSignatureRefreshInFlight=!1,this._sharedPollSignatureRefreshTargetMs=null,this._cancelAllDebounce(),this._setState(e.SubscriptionState.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:t,reason:s}),this._rejectPromises({code:e.errorCodes.subscriptionUnsubscribed,message:this.state}),i}_handlePublication(e){if(this._delta&&this._delta_negotiated){const t=(this._map||this._sharedPoll)&&e.key||"",{newData:s,newPrevValue:n,isDelta:i,wireBytes:r,fullBytes:o}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValueMap.get(t));e.data=s,this._deltaNumPubs++,this._deltaBytesReceived+=r,this._deltaBytesDecoded+=o,i?this._deltaNumDelta++:this._deltaNumFull++,e.removed?this._prevValueMap.delete(t):this._prevValueMap.set(t,n)}let t;if(this._sharedPoll){if(e.key&&!this._sharedPollTrackedItems.has(e.key))return;e.key&&(e.removed?this._sharedPollTrackedItems.delete(e.key):e.version&&this._sharedPollTrackedItems.set(e.key,e.version)),t=this._getSharedPollUpdateContext(e)}else t=this._map?this._getMapUpdateContext(e):this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),(this._map||this._sharedPoll)&&this.emit("update",t),e.offset&&(this._offset=e.offset),e.epoch&&(this._epoch=e.epoch)}_seedDeltaTracking(e){if(this._delta&&e.key)if("string"==typeof e.data){const t=e.data;e.removed?this._prevValueMap.delete(e.key):this._prevValueMap.set(e.key,(new TextEncoder).encode(t));const s=t.length;this._deltaNumPubs++,this._deltaNumFull++,this._deltaBytesReceived+=s,this._deltaBytesDecoded+=s,e.data=JSON.parse(t)}else if(e.data instanceof Uint8Array){e.removed?this._prevValueMap.delete(e.key):this._prevValueMap.set(e.key,e.data);const t=e.data.length;this._deltaNumPubs++,this._deltaNumFull++,this._deltaBytesReceived+=t,this._deltaBytesDecoded+=t}}_handleJoin(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing())return void this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);const e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout((function(){e._isSubscribing()&&e._subscribe()}),t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(t){if(this._isSubscribing())if(t.code<100||109===t.code||!0===t.temporary){109===t.code&&(this._token="");const s={channel:this.channel,type:"subscribe",error:t};this._centrifuge.state===e.State.Connected&&this.emit("error",s),this._scheduleResubscribe()}else this._setUnsubscribed(t.code,t.message,!1)}_getResubscribeDelay(){const e=g(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),void 0!==e.minResubscribeDelay&&(this._minResubscribeDelay=e.minResubscribeDelay),void 0!==e.maxResubscribeDelay&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),!0===e.positioned&&(this._positioned=!0),!0===e.recoverable&&(this._recoverable=!0),!0===e.joinLeave&&(this._joinLeave=!0),e.delta){if("fossil"!==e.delta)throw new Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together");e.getState&&(this._getState=e.getState,this._recover=!0),!0===e.map&&(this._map=!0),void 0!==e.mapPageSize&&(this._mapPageSize=e.mapPageSize),void 0!==e.mapPresenceType&&(this._mapPresenceType=e.mapPresenceType,this._map=!0),e.mapUnrecoverableStrategy&&(this._mapUnrecoverableStrategy=e.mapUnrecoverableStrategy),!0===e.sharedPoll&&(this._sharedPoll=!0),e.sharedPollGetSignature&&(this._sharedPollGetSignature=e.sharedPollGetSignature)}}_getOffset(){const e=this._offset;return null!==e?e:0}_getEpoch(){const e=this._epoch;return null!==e?e:""}_clearRefreshTimeout(){null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){null!==this._resubscribeTimeout&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);const t={channel:this.channel},s=this._getToken;return null===s?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:e.errorCodes.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new A(""))):s(t)}_refresh(){this._clearRefreshTimeout();const t=this;this._getSubscriptionToken().then((function(e){if(!t._isSubscribed())return;if(!e)return void t._failUnauthorized();t._token=e;const s={sub_refresh:{channel:t.channel,token:e}};t._centrifuge._call(s).then((e=>{const s=e.reply.sub_refresh;t._refreshResponse(s),e.next&&e.next()}),(e=>{t._refreshError(e.error),e.next&&e.next()}))})).catch((function(s){s instanceof A?t._failUnauthorized():(t.emit("error",{type:"refreshToken",channel:t.channel,error:{code:e.errorCodes.subscriptionRefreshToken,message:void 0!==s?s.toString():""}}),t._refreshTimeout=setTimeout((()=>t._refresh()),t._getRefreshRetryDelay()))}))}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),!0===e.expires&&(this._refreshTimeout=setTimeout((()=>this._refresh()),m(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||!0===e.temporary?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout((()=>this._refresh()),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return g(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(e.unsubscribedCodes.unauthorized,"unauthorized",!0)}_sendTrackRequest(e,t){if(0===e.length)return Promise.resolve();const s=[];let n=[],i=100;if(t&&t.length>0)for(const e of t)i+=e.length+4;for(const t of e){let e=100;for(const s of t.items)e+=s.key.length+16;n.length>0&&i+e>6e4&&(s.push(n),n=[],i=100),n.push(t),i+=e}n.length>0&&s.push(n);const r=(e,t)=>new Promise(((s,n)=>{const i={channel:this.channel,type:1,track:e.map((e=>({signature:e.signature,items:e.items.map((e=>e.version>0?e:{key:e.key}))})))};t&&t.length>0&&(i.untrack=t);const r={sub_refresh:i};this._centrifuge._call(r).then((e=>{this._handleTrackResponse(e.reply.sub_refresh),e.next&&e.next(),s()}),(e=>{e.next&&e.next(),n(e.error)}))}));return s.reduce(((e,s,n)=>e.then((()=>r(s,0===n?t:void 0)))),Promise.resolve())}_sendUntrackRequest(e){return new Promise(((t,s)=>{const n={sub_refresh:{channel:this.channel,type:2,untrack:e}};this._centrifuge._call(n).then((e=>{e.next&&e.next(),t()}),(e=>{e.next&&e.next(),s(e.error)}))}))}_handleTrackResponse(e){if(this._clearSharedPollTrackRetry(),e&&e.items&&e.items.length>0)for(const t of e.items)this._handlePublication(t);if(e&&!0===e.expires&&e.ttl>0){const t=Date.now()+1e3*e.ttl;this._maybeScheduleSharedPollSignatureRefresh(t)}}_maybeScheduleSharedPollSignatureRefresh(e){if(null===e)return this._sharedPollSignatureRefreshTargetMs=null,void this._clearSharedPollSignatureRefresh();this._isSubscribed()&&(null!==this._sharedPollSignatureRefreshTargetMs&&e>=this._sharedPollSignatureRefreshTargetMs||(this._sharedPollSignatureRefreshTargetMs=e,this._clearSharedPollSignatureRefresh(),this._sharedPollSignatureRefreshTimeout=setTimeout((()=>this._sharedPollRefreshSignature()),Math.max(0,e-Date.now()))))}_clearSharedPollSignatureRefresh(){null!==this._sharedPollSignatureRefreshTimeout&&(clearTimeout(this._sharedPollSignatureRefreshTimeout),this._sharedPollSignatureRefreshTimeout=null),this._sharedPollSignatureRefreshAttempts=0}_clearSharedPollTrackRetry(){null!==this._sharedPollTrackRetryTimeout&&(clearTimeout(this._sharedPollTrackRetryTimeout),this._sharedPollTrackRetryTimeout=null),this._sharedPollTrackRetryAttempts=0}_clearSharedPollReplayRetry(){null!==this._sharedPollReplayRetryTimeout&&(clearTimeout(this._sharedPollReplayRetryTimeout),this._sharedPollReplayRetryTimeout=null),this._sharedPollReplayRetryAttempts=0}_handleTrackError(e){this._isSubscribed()&&(this.emit("error",{type:"track",channel:this.channel,error:e}),109!==e.code?(e.code<100||!0===e.temporary)&&(this._sharedPollTrackRetryTimeout=setTimeout((()=>this._sharedPollReplayTrack()),g(this._sharedPollTrackRetryAttempts++,1e3,15e3))):this._sharedPollRefreshSignature())}_sharedPollRefreshSignature(){if(this._clearSharedPollSignatureRefresh(),!this._isSubscribed())return;if(!this._sharedPollGetSignature)return;if(0===this._sharedPollTrackedItems.size)return;if(this._sharedPollSignatureRefreshInFlight)return;this._sharedPollSignatureRefreshTargetMs=null,this._sharedPollSignatureRefreshInFlight=!0;const t=Array.from(this._sharedPollTrackedItems.keys()),s=this;this._sharedPollGetSignature({keys:t}).then((e=>{if(s._sharedPollSignatureRefreshInFlight=!1,!s._isSubscribed())return;s._sharedPollSignatureRefreshAttempts=0;const n=new Set(e.keys),i=[];for(const e of t)n.has(e)||(s._sharedPollTrackedItems.delete(e),i.push(e),s.emit("update",{channel:s.channel,key:e,data:null,removed:!0}));i.length>0&&s._sendUntrackRequest(i).catch((e=>{s.emit("error",{type:"untrack",channel:s.channel,error:e})}));const r=[];for(const t of e.keys){const e=s._sharedPollTrackedItems.get(t);void 0!==e&&r.push({key:t,version:e})}const o=new Set(e.keys),a=s._sharedPollSignatures.filter((e=>e.keys.some((e=>s._sharedPollTrackedItems.has(e)&&!o.has(e)))));s._sharedPollSignatures=r.length>0?[{keys:e.keys,signature:e.signature},...a]:a,0!==r.length&&s._sendTrackRequest([{items:r,signature:e.signature}]).catch((e=>{s._handleTrackError(e)}))})).catch((t=>{s._sharedPollSignatureRefreshInFlight=!1,s.emit("error",{type:"signatureRefresh",channel:s.channel,error:{code:e.errorCodes.sharedPollGetSignature,message:void 0!==t?t.toString():""}}),s._sharedPollSignatureRefreshTimeout=setTimeout((()=>s._sharedPollRefreshSignature()),g(s._sharedPollSignatureRefreshAttempts++,5e3,3e4))}))}_sharedPollReplayTrack(){if(!this._isSubscribed())return;if(0===this._sharedPollTrackedItems.size&&0===this._sharedPollSignatures.length)return;const t=new Set,s=[],n=[];for(const e of this._sharedPollSignatures){const i=e.keys.map((e=>{var t;return{key:e,version:null!==(t=this._sharedPollTrackedItems.get(e))&&void 0!==t?t:0}}));s.push({items:i,signature:e.signature});for(const s of e.keys)this._sharedPollTrackedItems.has(s)?t.add(s):n.push(s)}s.length>0&&this._sendTrackRequest(s,n).catch((e=>{this._handleTrackError(e)}));const i=[];for(const e of this._sharedPollTrackedItems.keys())t.has(e)||i.push(e);if(0===i.length)return;if(!this._sharedPollGetSignature)return void this.emit("error",{type:"track",channel:this.channel,error:{code:e.errorCodes.sharedPollGetSignature,message:"getSignature callback required for tracked keys without an explicit signature"}});const r=this;this._sharedPollGetSignature({keys:i}).then((e=>{if(!r._isSubscribed())return;r._clearSharedPollReplayRetry();const t=new Set(e.keys),s=[];for(const e of i)t.has(e)||(r._sharedPollTrackedItems.delete(e),s.push(e),r.emit("update",{channel:r.channel,key:e,data:null,removed:!0}));s.length>0&&r._sendUntrackRequest(s).catch((e=>{r.emit("error",{type:"untrack",channel:r.channel,error:e})}));const n=[];for(const t of e.keys){const e=r._sharedPollTrackedItems.get(t);void 0!==e&&n.push({key:t,version:e})}0!==n.length&&(r._sharedPollSignatures.push({keys:e.keys,signature:e.signature}),r._sendTrackRequest([{items:n,signature:e.signature}]).catch((e=>{r._handleTrackError(e)})))})).catch((t=>{r.emit("error",{type:"signatureRefresh",channel:r.channel,error:{code:e.errorCodes.sharedPollGetSignature,message:void 0!==t?t.toString():""}}),r._sharedPollReplayRetryTimeout=setTimeout((()=>r._sharedPollReplayTrack()),g(r._sharedPollReplayRetryAttempts++,5e3,3e4))}))}_mapSubscribe(){if(this._debug("starting map subscribe on",this.channel),this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapCursor="",this._recover&&null!==this._offset&&null!==this._epoch||(this._prevValueMap=new Map),this._mapPhase=_.State,this._recover&&null!==this._offset&&null!==this._epoch)return this._debug("map subscribe: recovering from position, skipping to stream phase"),this._mapPhase=_.Stream,void this._fetchStream();this._canSubscribeWithoutGettingToken()?this._fetchSnapshot():this._getSubscriptionToken().then((e=>{if(this._isSubscribing()){if(!e)return this._inflight=!1,void this._failUnauthorized();this._token=e,this._fetchSnapshot()}else this._inflight=!1})).catch((e=>this._handleTokenError(e)))}_fetchSnapshot(e){if(!this._isSubscribing()||!this._isTransportOpen())return void(this._inflight=!1);const t=this._buildMapSubscribeCommand(_.State,e);this._debug("map subscribe: fetching snapshot page",e?`cursor=${e}`:"initial"),this._centrifuge._call(t).then((e=>{const t=e.reply.subscribe;this._handleMapStateResponse(t),e.next&&e.next()}),(e=>{this._handleMapSubscribeError(e.error),e.next&&e.next()}))}_handleMapStateResponse(e){if(this._isSubscribing()){if(!e.phase)return this._debug("map subscribe: server forced LIVE transition during state pagination"),void this._handleMapLiveResponse(e);if(!this._epoch&&e.epoch&&(this._epoch=e.epoch,this._offset=e.offset||0),this._epoch&&e.epoch&&this._epoch!==e.epoch)return this._debug("map subscribe: epoch changed during snapshot pagination, restarting"),this._mapStateBuffer=[],this._mapCursor="",this._epoch=null,this._offset=null,this._prevValueMap=new Map,void this._fetchSnapshot();if(e.state&&e.state.length>0)for(const t of e.state)this._seedDeltaTracking(t),this._mapStateBuffer.push(this._getMapUpdateContext(t));if(e.cursor)return this._mapCursor=e.cursor,void this._fetchSnapshot(this._mapCursor);this._transitionFromSnapshot()}else this._inflight=!1}_transitionFromSnapshot(){this._debug("map subscribe: snapshot complete, transitioning to stream phase"),this._mapPhase=_.Stream,this._fetchStream()}_fetchStream(){if(!this._isSubscribing()||!this._isTransportOpen())return void(this._inflight=!1);const e=this._buildMapSubscribeCommand(_.Stream);this._debug("map subscribe: fetching stream from offset",this._offset),this._centrifuge._call(e).then((e=>{const t=e.reply.subscribe;this._handleMapStreamResponse(t),e.next&&e.next()}),(e=>{this._handleMapSubscribeError(e.error),e.next&&e.next()}))}_handleMapStreamResponse(e){if(this._isSubscribing()){if(!e.phase)return this._debug("map subscribe: server forced LIVE transition during stream"),void this._handleMapLiveResponse(e);if(this._epoch&&e.epoch&&this._epoch!==e.epoch)return this._debug("map subscribe: epoch changed during stream, restarting"),this._mapStateBuffer=[],this._mapStreamBuffer=[],this._epoch=null,this._offset=null,this._prevValueMap=new Map,this._mapPhase=_.State,void this._fetchSnapshot();if(e.publications&&e.publications.length>0)for(const t of e.publications)this._seedDeltaTracking(t),this._mapStreamBuffer.push(this._getMapUpdateContext(t));void 0!==e.offset&&(this._offset=e.offset),this._fetchStream()}else this._inflight=!1}_handleMapLiveResponse(t){if(!this._isSubscribing())return void(this._inflight=!1);if(this._inflight=!1,this._epoch&&t.epoch&&this._epoch!==t.epoch)return this._debug("map subscribe: epoch changed during live transition, restarting"),this._mapStateBuffer=[],this._mapStreamBuffer=[],this._epoch=null,this._offset=null,this._prevValueMap=new Map,this._inflight=!0,this._mapPhase=_.State,void this._fetchSnapshot();if(t.state&&t.state.length>0)for(const e of t.state)this._seedDeltaTracking(e),this._mapStateBuffer.push(this._getMapUpdateContext(e));if(t.publications&&t.publications.length>0)for(const e of t.publications){if(this._delta&&t.delta){const t=e.key||"",{newData:s,newPrevValue:n,isDelta:i,wireBytes:r,fullBytes:o}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValueMap.get(t));e.data=s,this._deltaNumPubs++,this._deltaBytesReceived+=r,this._deltaBytesDecoded+=o,i?this._deltaNumDelta++:this._deltaNumFull++,e.removed?this._prevValueMap.delete(t):this._prevValueMap.set(t,n)}else this._delta&&e.key&&(e.removed?this._prevValueMap.delete(e.key):this._prevValueMap.set(e.key,e.data));this._mapStreamBuffer.push(this._getMapUpdateContext(e))}this._offset=t.offset||0,this._epoch=t.epoch||"",this._clearSubscribingState(),t.id&&(this._id=t.id),this._recover=!0===t.recoverable,t.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,t.publish_debounce&&(this._debounceMs=t.publish_debounce),this._setState(e.SubscriptionState.Subscribed);const s=this._centrifuge._getSubscribeContext(this.channel,t);if(s.state=this._mapStateBuffer,this.emit("subscribed",s),this._resolvePromises(),!s.recovered){if(this._mapStreamBuffer.length>0){const e=new Map;for(const t of this._mapStateBuffer)e.set(t.key,t);for(const t of this._mapStreamBuffer)t.removed?e.delete(t.key):e.set(t.key,t);this._mapStateBuffer=Array.from(e.values()),this._mapStreamBuffer=[]}this.emit("sync",{entries:this._mapStateBuffer})}for(const e of this._mapStreamBuffer)this.emit("publication",e),this.emit("update",e);this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapPhase=null,!0===t.expires&&(this._refreshTimeout=setTimeout((()=>this._refresh()),m(t.ttl)))}_handleMapSubscribeError(t){if(this._inflight=!1,this._isSubscribing())if(t.code!==e.errorCodes.timeout){if(this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapPhase=null,this._prevValueMap=new Map,112===t.code&&"from_scratch"===this._mapUnrecoverableStrategy)return this._debug("map subscribe: unrecoverable position, restarting from scratch"),this._offset=null,this._epoch=null,this._recover=!1,void this._scheduleResubscribe();this._subscribeError(t)}else this._centrifuge._disconnect(e.connectingCodes.subscribeTimeout,"subscribe timeout",!0)}_buildMapSubscribeCommand(t,s){const n={channel:this.channel,type:this._mapPresenceType||1,phase:t};return this._token&&(n.token=this._token),this._tagsFilter&&(n.tf=this._tagsFilter),this._delta&&(n.delta=this._delta),n.flag=e.subscriptionFlags.channelCompaction,t===_.State&&(this._mapPageSize>0&&(n.limit=this._mapPageSize),s&&(n.cursor=s),this._epoch?(n.offset=this._offset,n.epoch=this._epoch):this._data&&(n.data=this._data)),t===_.Stream&&(this._mapPageSize>0&&(n.limit=this._mapPageSize),n.offset=this._offset,n.epoch=this._epoch,this._recover&&(n.recover=!0,0===this._mapStreamBuffer.length&&this._data&&(n.data=this._data))),{subscribe:n}}_getMapUpdateContext(e){const t={channel:this.channel,data:e.data,key:e.key||""};return!0===e.removed&&(t.removed=!0),void 0!==e.offset&&(t.offset=e.offset),e.info&&(t.info=this._centrifuge._getJoinLeaveContext(e.info)),e.tags&&(t.tags=e.tags),t}_getSharedPollUpdateContext(e){const t={channel:this.channel,key:e.key||"",data:e.data};return!0===e.removed&&(t.removed=!0),void 0!==e.version&&(t.version=e.version),t}}class y extends v{publish(e){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._debounceMs>0?this._debouncedPublish("",e,!1):this._centrifuge.publish(this.channel,e)}))}history(e){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)}))}}class S extends v{publish(e,s){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._debounceMs>0?this._debouncedPublish(e,s,!0):this._centrifuge.mapPublish(this.channel,e,s)}))}remove(e){return t(this,void 0,void 0,(function*(){return yield this._methodCall(),this._cancelDebounce(e),this._centrifuge.mapRemove(this.channel,e)}))}}class w extends v{track(t,s){if(0===t.length)return;let n;const i=s;if("string"==typeof t[0]){n=t.map((e=>({key:e,version:0})))}else n=t;for(const e of n){const t=this._sharedPollTrackedItems.get(e.key);(void 0===t||e.version>t)&&this._sharedPollTrackedItems.set(e.key,e.version)}if(void 0!==i)return this._sharedPollSignatures.push({keys:n.map((e=>e.key)),signature:i}),void(this._isSubscribed()&&this._sendTrackRequest([{items:n,signature:i}]).catch((e=>{this._handleTrackError(e)})));if(!this._sharedPollGetSignature)return void this.emit("error",{type:"track",channel:this.channel,error:{code:e.errorCodes.sharedPollGetSignature,message:"getSignature callback required for track(keys)"}});if(!this._isSubscribed())return;const r=n.map((e=>e.key));this._sharedPollGetSignature({keys:r}).then((e=>{if(!this._isSubscribed())return;const t=new Set(e.keys),s=[];for(const e of r)t.has(e)||(this._sharedPollTrackedItems.delete(e),s.push(e),this.emit("update",{channel:this.channel,key:e,data:null,removed:!0}));s.length>0&&this._sendUntrackRequest(s).catch((e=>{this.emit("error",{type:"untrack",channel:this.channel,error:e})}));const n=[];for(const t of e.keys){const e=this._sharedPollTrackedItems.get(t);void 0!==e&&n.push({key:t,version:e})}0!==n.length&&(this._sharedPollSignatures.push({keys:e.keys,signature:e.signature}),this._sendTrackRequest([{items:n,signature:e.signature}]).catch((e=>{this._handleTrackError(e)})))})).catch((t=>{this.emit("error",{type:"track",channel:this.channel,error:{code:e.errorCodes.sharedPollGetSignature,message:void 0!==t?t.toString():"getSignature failed"}})}))}untrack(e){for(const t of e)this._sharedPollTrackedItems.delete(t);this._sharedPollSignatures=this._sharedPollSignatures.filter((e=>e.keys.some((e=>this._sharedPollTrackedItems.has(e))))),this._isSubscribed()&&this._sendUntrackRequest(e).catch((e=>{this.emit("error",{type:"untrack",channel:this.channel,error:e})}))}trackedKeys(){return new Set(this._sharedPollTrackedItems.keys())}}class T{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return null!==this.options.sockjs}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=e=>{t.onError(e)},this._transport.onclose=e=>{t.onClose(e)},this._transport.onmessage=e=>{t.onMessage(e.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class P{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return void 0!==this.options.websocket&&null!==this.options.websocket}initialize(e,t){let s="";"protobuf"===e&&(s="centrifuge-protobuf"),this._transport=""!==s?new this.options.websocket(this.endpoint,s):new this.options.websocket(this.endpoint),"protobuf"===e&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=e=>{t.onError(e)},this._transport.onclose=e=>{t.onClose(e)},this._transport.onmessage=e=>{t.onMessage(e.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class E{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw new Error(e.status);return e}_fetchEventTarget(e,t,s){const n=new EventTarget;return(0,e.options.fetch)(t,s).then(e._handleErrors).then((t=>{n.dispatchEvent(new Event("open"));let s="",i=0,r=new Uint8Array;const o=t.body.getReader();return new e.options.readableStream({start:t=>function a(){return o.read().then((({done:o,value:c})=>{if(o)return n.dispatchEvent(new Event("close")),void t.close();try{if("json"===e._protocol)for(s+=e._utf8decoder.decode(c);i<s.length;)if("\n"===s[i]){const e=s.substring(0,i);n.dispatchEvent(new MessageEvent("message",{data:e})),s=s.substring(i+1),i=0}else++i;else{const t=new Uint8Array(r.length+c.length);for(t.set(r),t.set(c,r.length),r=t;;){const t=e.options.decoder.decodeReply(r);if(!t.ok)break;{const e=r.slice(0,t.pos);n.dispatchEvent(new MessageEvent("message",{data:e})),r=r.slice(t.pos)}}}}catch(e){return n.dispatchEvent(new Event("error",{detail:e})),n.dispatchEvent(new Event("close")),void t.close()}a()})).catch((function(e){n.dispatchEvent(new Event("error",{detail:e})),n.dispatchEvent(new Event("close")),t.close()}))}()})})).catch((e=>{n.dispatchEvent(new Event("error",{detail:e})),n.dispatchEvent(new Event("close"))})),n}supported(){return null!==this.options.fetch&&null!==this.options.readableStream&&"undefined"!=typeof TextDecoder&&"undefined"!=typeof AbortController&&"undefined"!=typeof EventTarget&&"undefined"!=typeof Event&&"undefined"!=typeof MessageEvent&&"undefined"!=typeof Error}initialize(e,t,s){let n,i;this._protocol=e,this._abortController=new AbortController,"json"===e?(n={Accept:"application/json","Content-Type":"application/json"},i=s):(n={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},i=s);const r={method:"POST",headers:n,body:i,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},o=this._fetchEventTarget(this,this.endpoint,r);o.addEventListener("open",(()=>{t.onOpen()})),o.addEventListener("error",(e=>{this._abortController.abort(),t.onError(e)})),o.addEventListener("close",(()=>{this._abortController.abort(),t.onClose({code:4,reason:"connection closed"})})),o.addEventListener("message",(e=>{t.onMessage(e.data)}))}close(){this._abortController.abort()}send(e,t,s){let n,i;const r={session:t,node:s,data:e};"json"===this._protocol?(n={"Content-Type":"application/json"},i=JSON.stringify(r)):(n={"Content-Type":"application/octet-stream"},i=this.options.encoder.encodeEmulationRequest(r));const o={method:"POST",headers:n,body:i,mode:"cors",credentials:"same-origin"};(0,this.options.fetch)(this.options.emulationEndpoint,o)}}class k{constructor(e,t){this.endpoint=e,this.options=t,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return null!==this.options.eventsource&&null!==this.options.fetch}initialize(e,t,s){let n;n=globalThis&&globalThis.document&&globalThis.document.baseURI?new URL(this.endpoint,globalThis.document.baseURI):new URL(this.endpoint),n.searchParams.append("cf_connect",s);const i=new this.options.eventsource(n.toString(),{});this._transport=i;i.onopen=function(){t.onOpen()},i.onerror=function(e){i.close(),t.onError(e),t.onClose({code:4,reason:"connection closed"})},i.onmessage=function(e){t.onMessage(e.data)},this._onClose=function(){t.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),null!==this._onClose&&this._onClose()}send(e,t,s){const n={session:t,node:s,data:e},i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),mode:"cors",credentials:"same-origin"};(0,this.options.fetch)(this.options.emulationEndpoint,i)}}class C{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return void 0!==this.options.webtransport&&null!==this.options.webtransport}initialize(e,s){return t(this,void 0,void 0,(function*(){let t;t=globalThis&&globalThis.document&&globalThis.document.baseURI?new URL(this.endpoint,globalThis.document.baseURI):new URL(this.endpoint),"protobuf"===e&&t.searchParams.append("cf_protocol","protobuf"),this._protocol=e;const n=new EventTarget;this._transport=new this.options.webtransport(t.toString()),this._transport.closed.then((()=>{s.onClose({code:4,reason:"connection closed"})})).catch((()=>{s.onClose({code:4,reason:"connection closed"})}));try{yield this._transport.ready}catch(e){return void this.close()}let i;try{i=yield this._transport.createBidirectionalStream()}catch(e){return void this.close()}this._stream=i,this._writer=this._stream.writable.getWriter(),n.addEventListener("close",(()=>{s.onClose({code:4,reason:"connection closed"})})),n.addEventListener("message",(e=>{s.onMessage(e.data)})),this._startReading(n),s.onOpen()}))}_startReading(e){return t(this,void 0,void 0,(function*(){const t=this._stream.readable.getReader();let s="",n=0,i=new Uint8Array;try{for(;;){const{done:r,value:o}=yield t.read();if(o.length>0)if("json"===this._protocol)for(s+=this._utf8decoder.decode(o);n<s.length;)if("\n"===s[n]){const t=s.substring(0,n);e.dispatchEvent(new MessageEvent("message",{data:t})),s=s.substring(n+1),n=0}else++n;else{const t=new Uint8Array(i.length+o.length);for(t.set(i),t.set(o,i.length),i=t;;){const t=this.options.decoder.decodeReply(i);if(!t.ok)break;{const s=i.slice(0,t.pos);e.dispatchEvent(new MessageEvent("message",{data:s})),i=i.slice(t.pos)}}}if(r)break}}catch(t){e.dispatchEvent(new Event("close"))}}))}close(){return t(this,void 0,void 0,(function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch(e){}}))}send(e){return t(this,void 0,void 0,(function*(){let t;t="json"===this._protocol?(new TextEncoder).encode(e+"\n"):e;try{yield this._writer.write(t)}catch(e){this.close()}}))}}const R=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];class O{constructor(e){this.a=e,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){const e=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return e}getChar(){return String.fromCharCode(this.getByte())}getInt(){let e,t=0;for(;this.haveBytes()&&(e=R[127&this.getByte()])>=0;)t=(t<<6)+e;return this.pos--,t>>>0}}class I{constructor(){this.a=[]}toByteArray(e){return Array.isArray(e)?this.a:new Uint8Array(this.a)}putArray(e,t,s){for(let n=t;n<s;n++)this.a.push(e[n])}}function D(e){let t=0,s=0,n=0,i=0,r=0,o=e.length;for(;o>=16;)t=t+e[r+0]|0,s=s+e[r+1]|0,n=n+e[r+2]|0,i=i+e[r+3]|0,t=t+e[r+4]|0,s=s+e[r+5]|0,n=n+e[r+6]|0,i=i+e[r+7]|0,t=t+e[r+8]|0,s=s+e[r+9]|0,n=n+e[r+10]|0,i=i+e[r+11]|0,t=t+e[r+12]|0,s=s+e[r+13]|0,n=n+e[r+14]|0,i=i+e[r+15]|0,r+=16,o-=16;for(;o>=4;)t=t+e[r+0]|0,s=s+e[r+1]|0,n=n+e[r+2]|0,i=i+e[r+3]|0,r+=4,o-=4;switch(i=((i+(n<<8)|0)+(s<<16)|0)+(t<<24)|0,o){case 3:i=i+(e[r+2]<<8)|0;case 2:i=i+(e[r+1]<<16)|0;case 1:i=i+(e[r+0]<<24)|0}return i>>>0}class x{name(){return"json"}encodeCommands(e){return e.map((e=>JSON.stringify(e))).join("\n")}decodeReplies(e){return e.trim().split("\n").map((e=>JSON.parse(e)))}applyDeltaIfNeeded(e,t){let s,n,i;if(e.delta){i=!0;const r=function(e,t){let s=0;const n=new O(t),i=e.length,r=t.length,o=n.getInt();if("\n"!==n.getChar())throw new Error("size integer not terminated by '\\n'");const a=new I;for(;n.haveBytes();){const t=n.getInt();let c;switch(n.getChar()){case"@":if(c=n.getInt(),n.haveBytes()&&","!==n.getChar())throw new Error("copy command not terminated by ','");if(s+=t,s>o)throw new Error("copy exceeds output file size");if(c+t>i)throw new Error("copy extends past end of input");a.putArray(e,c,c+t);break;case":":if(s+=t,s>o)throw new Error("insert command gives an output larger than predicted");if(t>r)throw new Error("insert count exceeds size of delta");a.putArray(n.a,n.pos,n.pos+t),n.pos+=t;break;case";":{const n=a.toByteArray(e);if(t!==D(n))throw new Error("bad checksum");if(s!==o)throw new Error("generated size does not match predicted size");return n}default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")}(t,(new TextEncoder).encode(e.data));s=JSON.parse((new TextDecoder).decode(r)),n=r}else i=!1,s=JSON.parse(e.data),n=(new TextEncoder).encode(e.data);return{newData:s,newPrevValue:n,isDelta:i,wireBytes:e.data.length,fullBytes:n.length}}}const N={headers:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null};class A extends Error{constructor(e){super(e),this.name=this.constructor.name}}class L extends p{constructor(t,s){super(),this._reconnectTimeout=null,this._refreshTimeout=null,this._serverPingTimeout=null,this.state=e.State.Disconnected,this._transportIsOpen=!1,this._endpoint=t,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new x,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config=Object.assign(Object.assign({},N),s),this._configure(),this._debugEnabled?(this.on("state",(e=>{this._debug("client state",e.oldState,"->",e.newState)})),this.on("error",(e=>{this._debug("client error",e)}))):this.on("error",(function(){Function.prototype()}))}newSubscription(e,t){if(null!==this.getSubscription(e))throw new Error("Subscription to the channel "+e+" already exists");const s=new y(this,e,t);return this._subs[e]=s,s}newMapSubscription(e,t){if(null!==this.getSubscription(e))throw new Error("Subscription to the channel "+e+" already exists");const s=new S(this,e,{token:null==t?void 0:t.token,getToken:null==t?void 0:t.getToken,data:null==t?void 0:t.data,minResubscribeDelay:null==t?void 0:t.minResubscribeDelay,maxResubscribeDelay:null==t?void 0:t.maxResubscribeDelay,delta:null==t?void 0:t.delta,tagsFilter:null==t?void 0:t.tagsFilter,map:!0,mapPageSize:null==t?void 0:t.pageSize,mapUnrecoverableStrategy:null==t?void 0:t.unrecoverableStrategy});return this._subs[e]=s,s}newMapClientsSubscription(e,t){if(null!==this.getSubscription(e))throw new Error("Subscription to the channel "+e+" already exists");const s=new S(this,e,{token:null==t?void 0:t.token,getToken:null==t?void 0:t.getToken,data:null==t?void 0:t.data,minResubscribeDelay:null==t?void 0:t.minResubscribeDelay,maxResubscribeDelay:null==t?void 0:t.maxResubscribeDelay,delta:null==t?void 0:t.delta,tagsFilter:null==t?void 0:t.tagsFilter,map:!0,mapPresenceType:2,mapPageSize:null==t?void 0:t.pageSize,mapUnrecoverableStrategy:null==t?void 0:t.unrecoverableStrategy});return this._subs[e]=s,s}newMapUsersSubscription(e,t){if(null!==this.getSubscription(e))throw new Error("Subscription to the channel "+e+" already exists");const s=new S(this,e,{token:null==t?void 0:t.token,getToken:null==t?void 0:t.getToken,data:null==t?void 0:t.data,minResubscribeDelay:null==t?void 0:t.minResubscribeDelay,maxResubscribeDelay:null==t?void 0:t.maxResubscribeDelay,delta:null==t?void 0:t.delta,tagsFilter:null==t?void 0:t.tagsFilter,map:!0,mapPresenceType:3,mapPageSize:null==t?void 0:t.pageSize,mapUnrecoverableStrategy:null==t?void 0:t.unrecoverableStrategy});return this._subs[e]=s,s}newSharedPollSubscription(e,t){if(null!==this.getSubscription(e))throw new Error("Subscription to the channel "+e+" already exists");const s=new w(this,e,{token:null==t?void 0:t.token,getToken:null==t?void 0:t.getToken,data:null==t?void 0:t.data,minResubscribeDelay:null==t?void 0:t.minResubscribeDelay,maxResubscribeDelay:null==t?void 0:t.maxResubscribeDelay,delta:null==t?void 0:t.delta,sharedPoll:!0,sharedPollGetSignature:null==t?void 0:t.getSignature});return this._subs[e]=s,s}getSubscription(e){return this._getSub(e)}getMapSubscription(e){return this._getSub(e)}getSharedPollSubscription(e){return this._getSub(e)}removeSubscription(t){t&&(t.state!==e.SubscriptionState.Unsubscribed&&t.unsubscribe(),this._removeSubscription(t))}removeMapSubscription(e){this.removeSubscription(e)}removeSharedPollSubscription(e){this.removeSubscription(e)}subscriptions(){return this._subs}mapSubscriptions(){const e={};for(const[t,s]of Object.entries(this._subs))"map"===s.type&&(e[t]=s);return e}sharedPollSubscriptions(){const e={};for(const[t,s]of Object.entries(this._subs))"shared_poll"===s.type&&(e[t]=s);return e}ready(s){return t(this,void 0,void 0,(function*(){switch(this.state){case e.State.Disconnected:throw{code:e.errorCodes.clientDisconnected,message:"client disconnected"};case e.State.Connected:return;default:return new Promise(((t,n)=>{const i={resolve:t,reject:n};s&&(i.timeout=setTimeout((()=>{n({code:e.errorCodes.timeout,message:"timeout"})}),s)),this._promises[this._nextPromiseId()]=i}))}}))}connect(){this._isConnected()?this._debug("connect called when already connected"):this._isConnecting()?this._debug("connect called when already connecting"):(this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting())}disconnect(){this._disconnect(e.disconnectedCodes.disconnectCalled,"disconnect called",!1)}setToken(e){this._token=e}setData(e){this._data=e}setHeaders(e){this._config.headers=e}send(s){return t(this,void 0,void 0,(function*(){const t={send:{data:s}};yield this._methodCall();if(!this._transportSendCommands([t]))throw this._createErrorObject(e.errorCodes.transportWriteError,"transport write error")}))}rpc(e,s){return t(this,void 0,void 0,(function*(){const t={rpc:{method:e,data:s}};yield this._methodCall();return{data:(yield this._callPromise(t,(e=>e.rpc))).data}}))}publish(e,s){return t(this,void 0,void 0,(function*(){const t={publish:{channel:e,data:s}};return yield this._methodCall(),yield this._callPromise(t,(()=>({}))),{}}))}mapPublish(e,s,n){return t(this,void 0,void 0,(function*(){const t={publish:{channel:e,type:1,key:s,data:n}};return yield this._methodCall(),yield this._callPromise(t,(()=>({}))),{}}))}mapRemove(e,s){return t(this,void 0,void 0,(function*(){const t={publish:{channel:e,type:1,key:s,removed:!0}};return yield this._methodCall(),yield this._callPromise(t,(()=>({}))),{}}))}history(e,s){return t(this,void 0,void 0,(function*(){const t={history:this._getHistoryRequest(e,s)};yield this._methodCall();const n=yield this._callPromise(t,(e=>e.history)),i=[];if(n.publications)for(let t=0;t<n.publications.length;t++)i.push(this._getPublicationContext(e,n.publications[t]));return{publications:i,epoch:n.epoch||"",offset:n.offset||0}}))}presence(e){return t(this,void 0,void 0,(function*(){const t={presence:{channel:e}};yield this._methodCall();const s=(yield this._callPromise(t,(e=>e.presence))).presence;for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const t=s[e],n=t.conn_info,i=t.chan_info;n&&(t.connInfo=n),i&&(t.chanInfo=i)}return{clients:s}}))}presenceStats(e){return t(this,void 0,void 0,(function*(){const t={presence_stats:{channel:e}};yield this._methodCall();const s=yield this._callPromise(t,(e=>e.presence_stats));return{numUsers:s.num_users,numClients:s.num_clients}}))}startBatching(){this._batching=!0}stopBatching(){const e=this;Promise.resolve().then((function(){Promise.resolve().then((function(){e._batching=!1,e._flush()}))}))}_debug(...e){this._debugEnabled&&function(e,t){if(globalThis.console){const s=globalThis.console[e];b(s)&&s.apply(globalThis.console,t)}}("debug",e)}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw new Error("Promise polyfill required");if(!this._endpoint)throw new Error("endpoint configuration required");if(null!==this._config.token&&(this._token=this._config.token),null!==this._config.data&&(this._data=this._config.data),this._codec=new x,this._formatOverride(),(!0===this._config.debug||"undefined"!=typeof localStorage&&"function"==typeof localStorage.getItem&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),"string"==typeof this._endpoint);else{if(!Array.isArray(this._endpoint))throw new Error("unsupported url configuration type: only string or array of objects are supported");this._transports=this._endpoint,this._emulation=!0;for(const e in this._transports)if(this._transports.hasOwnProperty(e)){const t=this._transports[e];if(!t.endpoint||!t.transport)throw new Error("malformed transport configuration");const s=t.transport;if(["websocket","http_stream","sse","sockjs","webtransport"].indexOf(s)<0)throw new Error("unsupported transport name: "+s)}}}_setState(e){if(this.state!==e){this._reconnecting=!1;const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t}),!0}return!1}_isDisconnected(){return this.state===e.State.Disconnected}_isConnecting(){return this.state===e.State.Connecting}_isConnected(){return this.state===e.State.Connected}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let t=null;null!==this._config.networkEventTarget?t=this._config.networkEventTarget:void 0!==globalThis.addEventListener&&(t=globalThis),t&&(t.addEventListener("offline",(()=>{this._debug("offline event triggered"),this.state!==e.State.Connected&&this.state!==e.State.Connecting||(this._disconnect(e.connectingCodes.transportClosed,"transport closed",!0),this._deviceWentOffline=!0)})),t.addEventListener("online",(()=>{this._debug("online event triggered"),this.state===e.State.Connecting&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())})),this._networkEventsSet=!0)}_getReconnectDelay(){const e=g(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,e}_clearOutgoingRequests(){for(const t in this._callbacks)if(this._callbacks.hasOwnProperty(t)){const s=this._callbacks[t];clearTimeout(s.timeout);const n=s.errback;if(!n)continue;n({error:this._createErrorObject(e.errorCodes.connectionClosed,"connection closed")})}this._callbacks={}}_clearConnectedState(){this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout();for(const t in this._subs){if(!this._subs.hasOwnProperty(t))continue;const s=this._subs[t];s.state===e.SubscriptionState.Subscribed&&s._setSubscribing(e.subscribingCodes.transportClosed,"transport closed")}for(const e in this._serverSubs)this._serverSubs.hasOwnProperty(e)&&this.emit("subscribing",{channel:e})}_handleWriteError(t){for(const s of t){const t=s.id;if(!(t in this._callbacks))continue;const n=this._callbacks[t];clearTimeout(this._callbacks[t].timeout),delete this._callbacks[t];(0,n.errback)({error:this._createErrorObject(e.errorCodes.transportWriteError,"transport write error")})}}_transportSendCommands(e){if(!e.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(e),this._session,this._node)}catch(t){return this._debug("error writing commands",t),this._handleWriteError(e),!1}return!0}_initializeTransport(){let t;null!==this._config.websocket?t=this._config.websocket:"function"!=typeof globalThis.WebSocket&&"object"!=typeof globalThis.WebSocket||(t=globalThis.WebSocket);let s=null;null!==this._config.sockjs?s=this._config.sockjs:void 0!==globalThis.SockJS&&(s=globalThis.SockJS);let n=null;null!==this._config.eventsource?n=this._config.eventsource:void 0!==globalThis.EventSource&&(n=globalThis.EventSource);let i=null;null!==this._config.fetch?i=this._config.fetch:void 0!==globalThis.fetch&&(i=globalThis.fetch);let r=null;if(null!==this._config.readableStream?r=this._config.readableStream:void 0!==globalThis.ReadableStream&&(r=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let e=0;for(;;){if(e>=this._transports.length)throw new Error("no supported transport found");const o=this._transports[this._currentTransportIndex],a=o.transport,c=o.endpoint;if("websocket"===a){if(this._debug("trying websocket transport"),this._transport=new P(c,{websocket:t}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,e++;continue}}else if("webtransport"===a){if(this._debug("trying webtransport transport"),this._transport=new C(c,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,e++;continue}}else if("http_stream"===a){if(this._debug("trying http_stream transport"),this._transport=new E(c,{fetch:i,readableStream:r,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,e++;continue}}else if("sse"===a){if(this._debug("trying sse transport"),this._transport=new k(c,{eventsource:n,fetch:i,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,e++;continue}}else{if("sockjs"!==a)throw new Error("unknown transport "+a);if(this._debug("trying sockjs"),this._transport=new T(c,{sockjs:s,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,e++;continue}}break}}else{if(o=this._endpoint,a="http",0===o.lastIndexOf(a,0))throw new Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new P(this._endpoint,{websocket:t}),!this._transport.supported())throw new Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}var o,a;const c=this,h=this._transport,u=this._nextTransportId();c._debug("id of transport",u);let l=!1;const d=[];if(this._transport.emulation()){const e=c._sendConnect(!0);d.push(e)}this._setNetworkEvents();const _=this._codec.encodeCommands(d);let f;this._transportClosed=!1,f=setTimeout((function(){h.close()}),this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(f&&(clearTimeout(f),f=null),c._transportId!=u)return c._debug("open callback from non-actual transport"),void h.close();l=!0,c._debug(h.subName(),"transport open"),h.emulation()||(c._transportIsOpen=!0,c._transportWasOpen=!0,c.startBatching(),c._sendConnect(!1),c._sendSubscribeCommands(),c.stopBatching(),c.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(e){c._transportId==u?c._debug("transport level error",e):c._debug("error callback from non-actual transport")},onClose:function(t){if(f&&(clearTimeout(f),f=null),c._transportId!=u)return void c._debug("close callback from non-actual transport");c._debug(h.subName(),"transport closed"),c._transportClosed=!0,c._transportIsOpen=!1;let s="connection closed",n=!0,i=0;if(t&&"code"in t&&t.code&&(i=t.code),t&&t.reason)try{const e=JSON.parse(t.reason);s=e.reason,n=e.reconnect}catch(e){s=t.reason,(i>=3500&&i<4e3||i>=4500&&i<5e3)&&(n=!1)}i<3e3?(1009===i?(i=e.disconnectedCodes.messageSizeLimit,s="message size limit exceeded",n=!1):(i=e.connectingCodes.transportClosed,s="transport closed"),c._emulation&&!c._transportWasOpen&&(c._currentTransportIndex++,c._currentTransportIndex>=c._transports.length&&(c._triedAllTransports=!0,c._currentTransportIndex=0))):c._transportWasOpen=!0,c._isConnecting()&&!l&&c.emit("error",{type:"transport",error:{code:e.errorCodes.transportClosed,message:"transport closed"},transport:h.name()}),c._reconnecting=!1,c._disconnect(i,s,n)},onMessage:function(e){c._dataReceived(e)}},_),c.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(e){const t=this._constructConnectCommand(),s=this;return this._call(t,e).then((e=>{const t=e.reply.connect;s._connectResponse(t),e.next&&e.next()}),(e=>{s._connectError(e.error),e.next&&e.next()})),t}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting())return void this._debug("stop reconnecting: client not in connecting state");if(this._reconnecting)return void this._debug("reconnect already in progress, return from reconnect routine");if(!1===this._transportClosed)return void this._debug("waiting for transport close");this._reconnecting=!0;const t=""===this._token;if(!(this._refreshRequired||t&&null!==this._config.getToken))return void(this._config.getData?this._config.getData().then((e=>{this._isConnecting()&&(this._data=e,this._initializeTransport())})).catch((e=>this._handleGetDataError(e))):this._initializeTransport());const s=this;this._getToken().then((function(e){s._isConnecting()&&(null!=e&&null!=e?(s._token=e,s._debug("connection token refreshed"),s._config.getData?s._config.getData().then((function(e){s._isConnecting()&&(s._data=e,s._initializeTransport())})).catch((e=>s._handleGetDataError(e))):s._initializeTransport()):s._failUnauthorized())})).catch((function(t){if(!s._isConnecting())return;if(t instanceof A)return void s._failUnauthorized();s.emit("error",{type:"connectToken",error:{code:e.errorCodes.clientConnectToken,message:void 0!==t?t.toString():""}});const n=s._getReconnectDelay();s._debug("error on getting connection token, reconnect after "+n+" milliseconds",t),s._reconnecting=!1,s._reconnectTimeout=setTimeout((()=>{s._startReconnecting()}),n)}))}_handleGetDataError(t){if(t instanceof A)return void this._failUnauthorized();this.emit("error",{type:"connectData",error:{code:e.errorCodes.badConfiguration,message:(null==t?void 0:t.toString())||""}});const s=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+s+" milliseconds",t),this._reconnecting=!1,this._reconnectTimeout=setTimeout((()=>{this._startReconnecting()}),s)}_connectError(t){this.state===e.State.Connecting&&(109===t.code&&(this._refreshRequired=!0),t.code<100||!0===t.temporary||109===t.code?(this.emit("error",{type:"connect",error:t}),this._debug("closing transport due to connect error"),this._disconnect(t.code,t.message,!0)):this._disconnect(t.code,t.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let e=!1;!this._emulation||this._transportWasOpen||this._triedAllTransports||(e=!0);let t=this._getReconnectDelay();e&&(t=0),this._debug("reconnect after "+t+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout((()=>{this._startReconnecting()}),t)}_constructConnectCommand(){const e={};this._token&&(e.token=this._token),this._data&&(e.data=this._data),this._config.name&&(e.name=this._config.name),this._config.version&&(e.version=this._config.version),Object.keys(this._config.headers).length>0&&(e.headers=this._config.headers);const t={};let s=!1;for(const e in this._serverSubs)if(this._serverSubs.hasOwnProperty(e)&&this._serverSubs[e].recoverable){s=!0;const n={recover:!0};this._serverSubs[e].offset&&(n.offset=this._serverSubs[e].offset),this._serverSubs[e].epoch&&(n.epoch=this._serverSubs[e].epoch),t[e]=n}return s&&(e.subs=t),{connect:e}}_getHistoryRequest(e,t){const s={channel:e};return void 0!==t&&(t.since&&(s.since={offset:t.since.offset},t.since.epoch&&(s.since.epoch=t.since.epoch)),void 0!==t.limit&&(s.limit=t.limit),!0===t.reverse&&(s.reverse=!0)),s}_methodCall(){return this._isConnected()?Promise.resolve():new Promise(((t,s)=>{const n=setTimeout((function(){s({code:e.errorCodes.timeout,message:"timeout"})}),this._config.timeout);this._promises[this._nextPromiseId()]={timeout:n,resolve:t,reject:s}}))}_callPromise(e,t){return new Promise(((s,n)=>{this._call(e,!1).then((e=>{var n;const i=t(e.reply);s(i),null===(n=e.next)||void 0===n||n.call(e)}),(e=>{var t;n(e.error),null===(t=e.next)||void 0===t||t.call(e)}))}))}_dataReceived(e){this._serverPing>0&&this._waitServerPing();const t=this._codec.decodeReplies(e);this._dispatchPromise=this._dispatchPromise.then((()=>{let e;this._dispatchPromise=new Promise((t=>{e=t})),this._dispatchSynchronized(t,e)}))}_dispatchSynchronized(e,t){let s=Promise.resolve();for(const t in e)e.hasOwnProperty(t)&&(s=s.then((()=>this._dispatchReply(e[t]))));s=s.then((()=>{t()}))}_dispatchReply(e){let t;const s=new Promise((e=>{t=e}));if(null==e)return this._debug("dispatch: got undefined or null reply"),t(),s;const n=e.id;return n&&n>0?this._handleReply(e,t):e.push?this._handlePush(e.push,t):this._handleServerPing(t),s}_call(e,t){return new Promise(((s,n)=>{e.id=this._nextCommandId(),this._registerCall(e.id,s,n),t||this._addCommand(e)}))}_startConnecting(){this._debug("start connecting"),this._setState(e.State.Connecting)&&this.emit("connecting",{code:e.connectingCodes.connectCalled,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(t,s,n){if(this._isDisconnected())return;this._transportIsOpen=!1;const i=this.state;this._reconnecting=!1;const r={code:t,reason:s};let o=!1;if(n?o=this._setState(e.State.Connecting):(o=this._setState(e.State.Disconnected),this._rejectPromises({code:e.errorCodes.clientDisconnected,message:"disconnected"})),this._clearOutgoingRequests(),i===e.State.Connecting&&this._clearReconnectTimeout(),i===e.State.Connected&&this._clearConnectedState(),o&&(this._isConnecting()?this.emit("connecting",r):this.emit("disconnected",r)),this._transport){this._debug("closing existing transport");const e=this._transport;this._transport=null,e.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(e.disconnectedCodes.unauthorized,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:e.errorCodes.badConfiguration,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new A("")))}_refresh(){const t=this._client,s=this;this._getToken().then((function(e){if(t!==s._client)return;if(!e)return void s._failUnauthorized();if(s._token=e,s._debug("connection token refreshed"),!s._isConnected())return;const n={refresh:{token:s._token}};s._call(n,!1).then((e=>{const t=e.reply.refresh;s._refreshResponse(t),e.next&&e.next()}),(e=>{s._refreshError(e.error),e.next&&e.next()}))})).catch((function(t){s._isConnected()&&(t instanceof A?s._failUnauthorized():(s.emit("error",{type:"refreshToken",error:{code:e.errorCodes.clientRefreshToken,message:void 0!==t?t.toString():""}}),s._refreshTimeout=setTimeout((()=>s._refresh()),s._getRefreshRetryDelay())))}))}_refreshError(e){e.code<100||!0===e.temporary?(this.emit("error",{type:"refresh",error:e}),this._refreshTimeout=setTimeout((()=>this._refresh()),this._getRefreshRetryDelay())):this._disconnect(e.code,e.message,!1)}_getRefreshRetryDelay(){return g(0,5e3,1e4)}_refreshResponse(e){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._client=e.client,this._refreshTimeout=setTimeout((()=>this._refresh()),m(e.ttl)))}_removeSubscription(e){null!==e&&delete this._subs[e.channel]}_unsubscribe(t){if(!this._transportIsOpen)return Promise.resolve();const s={unsubscribe:{channel:t.channel}},n=this;return new Promise(((t,i)=>{this._call(s,!1).then((e=>{t(),e.next&&e.next()}),(s=>{t(),s.next&&s.next(),n._disconnect(e.connectingCodes.unsubscribeError,"unsubscribe error",!0)}))}))}_getSub(e,t){if(t&&t>0){for(const e in this._subs)if(this._subs.hasOwnProperty(e)){const s=this._subs[e];if(s._id===t)return s}return null}const s=this._subs[e];return s||null}_isServerSub(e){return void 0!==this._serverSubs[e]}_sendSubscribeCommands(){const t=[];for(const s in this._subs){if(!this._subs.hasOwnProperty(s))continue;const n=this._subs[s];if(!0!==n._inflight&&n.state===e.SubscriptionState.Subscribing){const e=n._subscribe();e&&t.push(e)}}return t}_connectResponse(t){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=t.client,this._setState(e.State.Connected),this._refreshTimeout&&clearTimeout(this._refreshTimeout),t.expires&&(this._refreshTimeout=setTimeout((()=>this._refresh()),m(t.ttl))),this._session=t.session,this._node=t.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();const s={client:t.client,transport:this._transport.subName()};t.data&&(s.data=t.data),this.emit("connected",s),this._resolvePromises(),this._processServerSubs(t.subs||{}),t.ping&&t.ping>0?(this._serverPing=1e3*t.ping,this._sendPong=!0===t.pong,this._waitServerPing()):this._serverPing=0}_processServerSubs(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];this._serverSubs[t]={offset:s.offset,epoch:s.epoch,recoverable:s.recoverable||!1};const n=this._getSubscribeContext(t,s);this.emit("subscribed",n)}for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];if(s.recovered){const e=s.publications;if(e&&e.length>0)for(const s in e)e.hasOwnProperty(s)&&this._handlePublication(t,e[s])}}for(const t in this._serverSubs)this._serverSubs.hasOwnProperty(t)&&(e[t]||(this.emit("unsubscribed",{channel:t}),delete this._serverSubs[t]))}_clearRefreshTimeout(){null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){null!==this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){null!==this._serverPingTimeout&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){0!==this._config.maxServerPingDelay&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout((()=>{this._isConnected()&&this._disconnect(e.connectingCodes.noPing,"no ping",!0)}),this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(e,t){const s={channel:e,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};t.recovered&&(s.recovered=!0),t.positioned&&(s.positioned=!0),t.recoverable&&(s.recoverable=!0),t.was_recovering&&(s.wasRecovering=!0);let n="";"epoch"in t&&(n=t.epoch);let i=0;return"offset"in t&&(i=t.offset),(s.positioned||s.recoverable)&&(s.streamPosition={offset:i,epoch:n}),Array.isArray(t.publications)&&t.publications.length>0&&(s.hasRecoveredPublications=!0),t.data&&(s.data=t.data),s}_handleReply(e,t){const s=e.id;if(!(s in this._callbacks))return void t();const n=this._callbacks[s];if(clearTimeout(this._callbacks[s].timeout),delete this._callbacks[s],"error"in(i=e)&&null!==i.error){const s=n.errback;if(!s)return void t();s({error:{code:e.error.code,message:e.error.message||"",temporary:e.error.temporary||!1},next:t})}else{const s=n.callback;if(!s)return;s({reply:e,next:t})}var i}_handleJoin(e,t,s){const n=this._getSub(e,s);if(n||!e)n._handleJoin(t);else if(this._isServerSub(e)){const s={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("join",s)}}_handleLeave(e,t,s){const n=this._getSub(e,s);if(n||!e)n._handleLeave(t);else if(this._isServerSub(e)){const s={channel:e,info:this._getJoinLeaveContext(t.info)};this.emit("leave",s)}}_handleUnsubscribe(e,t){const s=this._getSub(e,0);s||!e?t.code<2500?s._setUnsubscribed(t.code,t.reason,!1):(2502===t.code&&s._invalidateState(),s._setSubscribing(t.code,t.reason)):this._isServerSub(e)&&(delete this._serverSubs[e],this.emit("unsubscribed",{channel:e}))}_handleSubscribe(e,t){this._serverSubs[e]={offset:t.offset,epoch:t.epoch,recoverable:t.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(e,t))}_handleDisconnect(e){const t=e.code;let s=!0;if((t>=3500&&t<4e3||t>=4500&&t<5e3)&&(s=!1),3014===t){this._token="",this._refreshRequired=!0;for(const e in this._subs)this._subs.hasOwnProperty(e)&&this._subs[e]._invalidateState()}this._disconnect(t,e.reason,s)}_getPublicationContext(e,t){const s={channel:e,data:t.data};return t.offset&&(s.offset=t.offset),t.info&&(s.info=this._getJoinLeaveContext(t.info)),t.tags&&(s.tags=t.tags),s}_getJoinLeaveContext(e){const t={client:e.client,user:e.user},s=e.conn_info;s&&(t.connInfo=s);const n=e.chan_info;return n&&(t.chanInfo=n),t}_handlePublication(e,t,s){const n=this._getSub(e,s);if(n||!e)n._handlePublication(t);else if(this._isServerSub(e)){const s=this._getPublicationContext(e,t);this.emit("publication",s),void 0!==t.offset&&(this._serverSubs[e].offset=t.offset)}}_handleMessage(e){this.emit("message",{data:e.data})}_handleServerPing(e){if(this._sendPong){const e={};this._transportSendCommands([e])}e()}_handlePush(e,t){const s=e.channel,n=e.id;e.pub?this._handlePublication(s,e.pub,n):e.message?this._handleMessage(e.message):e.join?this._handleJoin(s,e.join,n):e.leave?this._handleLeave(s,e.leave,n):e.unsubscribe?this._handleUnsubscribe(s,e.unsubscribe):e.subscribe?this._handleSubscribe(s,e.subscribe):e.disconnect&&this._handleDisconnect(e.disconnect),t()}_flush(){const e=this._commands.slice(0);this._commands=[],this._transportSendCommands(e)}_createErrorObject(e,t,s){const n={code:e,message:t};return s&&(n.temporary=!0),n}_registerCall(t,s,n){this._callbacks[t]={callback:s,errback:n,timeout:null},this._callbacks[t].timeout=setTimeout((()=>{delete this._callbacks[t],b(n)&&n({error:this._createErrorObject(e.errorCodes.timeout,"timeout")})}),this._config.timeout)}_addCommand(e){this._batching?this._commands.push(e):this._transportSendCommands([e])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}}L.SubscriptionState=e.SubscriptionState,L.State=e.State,L.UnauthorizedError=A,e.Centrifuge=L,e.Subscription=y,e.UnauthorizedError=A}(P);var E={},k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default="ffffffff-ffff-ffff-ffff-ffffffffffff";var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default="00000000-0000-0000-0000-000000000000";var R={},O={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i,Object.defineProperty(O,"__esModule",{value:!0});const D=I;O.default=function(e){return"string"==typeof e&&D.default.test(e)},Object.defineProperty(R,"__esModule",{value:!0});const x=O;R.default=function(e){if(!(0,x.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)};var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.unsafeStringify=void 0;const A=O,L=[];for(let e=0;e<256;++e)L.push((e+256).toString(16).slice(1));function U(e,t=0){return(L[e[t+0]]+L[e[t+1]]+L[e[t+2]]+L[e[t+3]]+"-"+L[e[t+4]]+L[e[t+5]]+"-"+L[e[t+6]]+L[e[t+7]]+"-"+L[e[t+8]]+L[e[t+9]]+"-"+L[e[t+10]]+L[e[t+11]]+L[e[t+12]]+L[e[t+13]]+L[e[t+14]]+L[e[t+15]]).toLowerCase()}N.unsafeStringify=U,N.default=function(e,t=0){const s=U(e,t);if(!(0,A.default)(s))throw TypeError("Stringified UUID is invalid");return s};var M={},j={};let F;Object.defineProperty(j,"__esModule",{value:!0});const B=new Uint8Array(16);j.default=function(){if(!F){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");F=crypto.getRandomValues.bind(crypto)}return F(B)},Object.defineProperty(M,"__esModule",{value:!0}),M.updateV1State=void 0;const q=j,z=N,V={};function K(e,t,s){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=s.slice(10,16),e.node[0]|=1,e.clockseq=16383&(s[8]<<8|s[9])),e.msecs=t,e}function W(e,t,s,n,i,r,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(o<0||o+16>r.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else r=new Uint8Array(16),o=0;t??=Date.now(),s??=0,n??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+s)%4294967296;r[o++]=a>>>24&255,r[o++]=a>>>16&255,r[o++]=a>>>8&255,r[o++]=255&a;const c=t/4294967296*1e4&268435455;r[o++]=c>>>8&255,r[o++]=255&c,r[o++]=c>>>24&15|16,r[o++]=c>>>16&255,r[o++]=n>>>8|128,r[o++]=255&n;for(let e=0;e<6;++e)r[o++]=i[e];return r}M.updateV1State=K,M.default=function(e,t,s){let n;const i=e?._v6??!1;if(e){const t=Object.keys(e);1===t.length&&"_v6"===t[0]&&(e=void 0)}if(e)n=W(e.random??e.rng?.()??(0,q.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,s);else{const e=Date.now(),r=(0,q.default)();K(V,e,r),n=W(r,V.msecs,V.nsecs,i?void 0:V.clockseq,i?void 0:V.node,t,s)}return t??(0,z.unsafeStringify)(n)};var G={};Object.defineProperty(G,"__esModule",{value:!0});const J=R,$=N;G.default=function(e){const t=function(e){return Uint8Array.of((15&e[6])<<4|e[7]>>4&15,(15&e[7])<<4|(240&e[4])>>4,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,(15&e[1])<<4|(240&e[2])>>4,96|15&e[2],e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,J.default)(e):e);return"string"==typeof e?(0,$.unsafeStringify)(t):t};var Y={},H={};function Q(e){return 14+(e+64>>>9<<4)+1}function X(e,t){const s=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(s>>16)<<16|65535&s}function Z(e,t,s,n,i,r){return X((o=X(X(t,e),X(n,r)))<<(a=i)|o>>>32-a,s);var o,a}function ee(e,t,s,n,i,r,o){return Z(t&s|~t&n,e,t,i,r,o)}function te(e,t,s,n,i,r,o){return Z(t&n|s&~n,e,t,i,r,o)}function se(e,t,s,n,i,r,o){return Z(t^s^n,e,t,i,r,o)}function ne(e,t,s,n,i,r,o){return Z(s^(t|~n),e,t,i,r,o)}Object.defineProperty(H,"__esModule",{value:!0}),H.default=function(e){return function(e){const t=new Uint8Array(4*e.length);for(let s=0;s<4*e.length;s++)t[s]=e[s>>2]>>>s%4*8&255;return t}(function(e,t){const s=new Uint32Array(Q(t)).fill(0);s.set(e),s[t>>5]|=128<<t%32,s[s.length-1]=t,e=s;let n=1732584193,i=-271733879,r=-1732584194,o=271733878;for(let t=0;t<e.length;t+=16){const s=n,a=i,c=r,h=o;n=ee(n,i,r,o,e[t],7,-680876936),o=ee(o,n,i,r,e[t+1],12,-389564586),r=ee(r,o,n,i,e[t+2],17,606105819),i=ee(i,r,o,n,e[t+3],22,-1044525330),n=ee(n,i,r,o,e[t+4],7,-176418897),o=ee(o,n,i,r,e[t+5],12,1200080426),r=ee(r,o,n,i,e[t+6],17,-1473231341),i=ee(i,r,o,n,e[t+7],22,-45705983),n=ee(n,i,r,o,e[t+8],7,1770035416),o=ee(o,n,i,r,e[t+9],12,-1958414417),r=ee(r,o,n,i,e[t+10],17,-42063),i=ee(i,r,o,n,e[t+11],22,-1990404162),n=ee(n,i,r,o,e[t+12],7,1804603682),o=ee(o,n,i,r,e[t+13],12,-40341101),r=ee(r,o,n,i,e[t+14],17,-1502002290),i=ee(i,r,o,n,e[t+15],22,1236535329),n=te(n,i,r,o,e[t+1],5,-165796510),o=te(o,n,i,r,e[t+6],9,-1069501632),r=te(r,o,n,i,e[t+11],14,643717713),i=te(i,r,o,n,e[t],20,-373897302),n=te(n,i,r,o,e[t+5],5,-701558691),o=te(o,n,i,r,e[t+10],9,38016083),r=te(r,o,n,i,e[t+15],14,-660478335),i=te(i,r,o,n,e[t+4],20,-405537848),n=te(n,i,r,o,e[t+9],5,568446438),o=te(o,n,i,r,e[t+14],9,-1019803690),r=te(r,o,n,i,e[t+3],14,-187363961),i=te(i,r,o,n,e[t+8],20,1163531501),n=te(n,i,r,o,e[t+13],5,-1444681467),o=te(o,n,i,r,e[t+2],9,-51403784),r=te(r,o,n,i,e[t+7],14,1735328473),i=te(i,r,o,n,e[t+12],20,-1926607734),n=se(n,i,r,o,e[t+5],4,-378558),o=se(o,n,i,r,e[t+8],11,-2022574463),r=se(r,o,n,i,e[t+11],16,1839030562),i=se(i,r,o,n,e[t+14],23,-35309556),n=se(n,i,r,o,e[t+1],4,-1530992060),o=se(o,n,i,r,e[t+4],11,1272893353),r=se(r,o,n,i,e[t+7],16,-155497632),i=se(i,r,o,n,e[t+10],23,-1094730640),n=se(n,i,r,o,e[t+13],4,681279174),o=se(o,n,i,r,e[t],11,-358537222),r=se(r,o,n,i,e[t+3],16,-722521979),i=se(i,r,o,n,e[t+6],23,76029189),n=se(n,i,r,o,e[t+9],4,-640364487),o=se(o,n,i,r,e[t+12],11,-421815835),r=se(r,o,n,i,e[t+15],16,530742520),i=se(i,r,o,n,e[t+2],23,-995338651),n=ne(n,i,r,o,e[t],6,-198630844),o=ne(o,n,i,r,e[t+7],10,1126891415),r=ne(r,o,n,i,e[t+14],15,-1416354905),i=ne(i,r,o,n,e[t+5],21,-57434055),n=ne(n,i,r,o,e[t+12],6,1700485571),o=ne(o,n,i,r,e[t+3],10,-1894986606),r=ne(r,o,n,i,e[t+10],15,-1051523),i=ne(i,r,o,n,e[t+1],21,-2054922799),n=ne(n,i,r,o,e[t+8],6,1873313359),o=ne(o,n,i,r,e[t+15],10,-30611744),r=ne(r,o,n,i,e[t+6],15,-1560198380),i=ne(i,r,o,n,e[t+13],21,1309151649),n=ne(n,i,r,o,e[t+4],6,-145523070),o=ne(o,n,i,r,e[t+11],10,-1120210379),r=ne(r,o,n,i,e[t+2],15,718787259),i=ne(i,r,o,n,e[t+9],21,-343485551),n=X(n,s),i=X(i,a),r=X(r,c),o=X(o,h)}return Uint32Array.of(n,i,r,o)}(function(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(Q(8*e.length)).fill(0);for(let s=0;s<e.length;s++)t[s>>2]|=(255&e[s])<<s%4*8;return t}(e),8*e.length))};var ie={};Object.defineProperty(ie,"__esModule",{value:!0}),ie.URL=ie.DNS=ie.stringToBytes=void 0;const re=R,oe=N;function ae(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let s=0;s<e.length;++s)t[s]=e.charCodeAt(s);return t}ie.stringToBytes=ae,ie.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ie.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",ie.default=function(e,t,s,n,i,r){const o="string"==typeof s?ae(s):s,a="string"==typeof n?(0,re.default)(n):n;if("string"==typeof n&&(n=(0,re.default)(n)),16!==n?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(a),c.set(o,a.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){if((r=r||0)<0||r+16>i.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[r+e]=c[e];return i}return(0,oe.unsafeStringify)(c)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.URL=e.DNS=void 0;const t=H,s=ie;var n=ie;function i(e,n,i,r){return(0,s.default)(48,t.default,e,n,i,r)}Object.defineProperty(e,"DNS",{enumerable:!0,get:function(){return n.DNS}}),Object.defineProperty(e,"URL",{enumerable:!0,get:function(){return n.URL}}),i.DNS=s.DNS,i.URL=s.URL,e.default=i}(Y);var ce={},he={};Object.defineProperty(he,"__esModule",{value:!0});const ue="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);he.default={randomUUID:ue},Object.defineProperty(ce,"__esModule",{value:!0});const le=he,de=j,_e=N;ce.default=function(e,t,s){if(le.default.randomUUID&&!t&&!e)return le.default.randomUUID();const n=(e=e||{}).random??e.rng?.()??(0,de.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((s=s||0)<0||s+16>t.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[s+e]=n[e];return t}return(0,_e.unsafeStringify)(n)};var fe={},pe={};function be(e,t,s,n){switch(e){case 0:return t&s^~t&n;case 1:case 3:return t^s^n;case 2:return t&s^t&n^s&n}}function ge(e,t){return e<<t|e>>>32-t}Object.defineProperty(pe,"__esModule",{value:!0}),pe.default=function(e){const t=[1518500249,1859775393,2400959708,3395469782],s=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128;const i=(e=n).length/4+2,r=Math.ceil(i/16),o=new Array(r);for(let t=0;t<r;++t){const s=new Uint32Array(16);for(let n=0;n<16;++n)s[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];o[t]=s}o[r-1][14]=8*(e.length-1)/Math.pow(2,32),o[r-1][14]=Math.floor(o[r-1][14]),o[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=o[e][t];for(let e=16;e<80;++e)n[e]=ge(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let i=s[0],r=s[1],a=s[2],c=s[3],h=s[4];for(let e=0;e<80;++e){const s=Math.floor(e/20),o=ge(i,5)+be(s,r,a,c)+h+t[s]+n[e]>>>0;h=c,c=a,a=ge(r,30)>>>0,r=i,i=o}s[0]=s[0]+i>>>0,s[1]=s[1]+r>>>0,s[2]=s[2]+a>>>0,s[3]=s[3]+c>>>0,s[4]=s[4]+h>>>0}return Uint8Array.of(s[0]>>24,s[0]>>16,s[0]>>8,s[0],s[1]>>24,s[1]>>16,s[1]>>8,s[1],s[2]>>24,s[2]>>16,s[2]>>8,s[2],s[3]>>24,s[3]>>16,s[3]>>8,s[3],s[4]>>24,s[4]>>16,s[4]>>8,s[4])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.URL=e.DNS=void 0;const t=pe,s=ie;var n=ie;function i(e,n,i,r){return(0,s.default)(80,t.default,e,n,i,r)}Object.defineProperty(e,"DNS",{enumerable:!0,get:function(){return n.DNS}}),Object.defineProperty(e,"URL",{enumerable:!0,get:function(){return n.URL}}),i.DNS=s.DNS,i.URL=s.URL,e.default=i}(fe);var me={};Object.defineProperty(me,"__esModule",{value:!0});const ve=N,ye=M,Se=G;me.default=function(e,t,s){e??={},s??=0;let n=(0,ye.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,Se.default)(n),t){if(s<0||s+16>t.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let e=0;e<16;e++)t[s+e]=n[e];return t}return(0,ve.unsafeStringify)(n)};var we={};Object.defineProperty(we,"__esModule",{value:!0});const Te=R,Pe=N;we.default=function(e){const t=function(e){return Uint8Array.of((15&e[3])<<4|e[4]>>4&15,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|15&e[6],e[7],(15&e[1])<<4|(240&e[2])>>4,(15&e[2])<<4|(240&e[3])>>4,16|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,Te.default)(e):e);return"string"==typeof e?(0,Pe.unsafeStringify)(t):t};var Ee={};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.updateV7State=void 0;const ke=j,Ce=N,Re={};function Oe(e,t,s){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=s[6]<<23|s[7]<<16|s[8]<<8|s[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++),e}function Ie(e,t,s,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else n=new Uint8Array(16),i=0;return t??=Date.now(),s??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=255&t,n[i++]=112|s>>>28&15,n[i++]=s>>>20&255,n[i++]=128|s>>>14&63,n[i++]=s>>>6&255,n[i++]=s<<2&255|3&e[10],n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}Ee.updateV7State=Oe,Ee.default=function(e,t,s){let n;if(e)n=Ie(e.random??e.rng?.()??(0,ke.default)(),e.msecs,e.seq,t,s);else{const e=Date.now(),i=(0,ke.default)();Oe(Re,e,i),n=Ie(i,Re.msecs,Re.seq,t,s)}return t??(0,Ce.unsafeStringify)(n)};var De={};Object.defineProperty(De,"__esModule",{value:!0});const xe=O;function Ne(e){let t,s=e[0],n=1;for(;n<e.length;){const i=e[n],r=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==s)return;"access"===i||"optionalAccess"===i?(t=s,s=r(s)):"call"!==i&&"optionalCall"!==i||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}var Ae,Le,Ue,Me,je;De.default=function(e){if(!(0,xe.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.validate=e.v7=e.v6ToV1=e.v6=e.v5=e.v4=e.v3=e.v1ToV6=e.v1=e.stringify=e.parse=e.NIL=e.MAX=void 0;var t=k;Object.defineProperty(e,"MAX",{enumerable:!0,get:function(){return t.default}});var s=C;Object.defineProperty(e,"NIL",{enumerable:!0,get:function(){return s.default}});var n=R;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return n.default}});var i=N;Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return i.default}});var r=M;Object.defineProperty(e,"v1",{enumerable:!0,get:function(){return r.default}});var o=G;Object.defineProperty(e,"v1ToV6",{enumerable:!0,get:function(){return o.default}});var a=Y;Object.defineProperty(e,"v3",{enumerable:!0,get:function(){return a.default}});var c=ce;Object.defineProperty(e,"v4",{enumerable:!0,get:function(){return c.default}});var h=fe;Object.defineProperty(e,"v5",{enumerable:!0,get:function(){return h.default}});var u=me;Object.defineProperty(e,"v6",{enumerable:!0,get:function(){return u.default}});var l=we;Object.defineProperty(e,"v6ToV1",{enumerable:!0,get:function(){return l.default}});var d=Ee;Object.defineProperty(e,"v7",{enumerable:!0,get:function(){return d.default}});var _=O;Object.defineProperty(e,"validate",{enumerable:!0,get:function(){return _.default}});var f=De;Object.defineProperty(e,"version",{enumerable:!0,get:function(){return f.default}})}(E),Object.defineProperty(i,"__esModule",{value:!0});var Fe,Be=e.exports,qe=(Fe=Be)&&Fe.__esModule?Fe:{default:Fe},ze=(e=>(e.DISCONNECTED="DISCONNECTED",e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e))(ze||{}),Ve=(e=>(e.SESSION_EXPIRED="SESSION_EXPIRED",e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.SESSION_INVALID_STATE="SESSION_INVALID_STATE",e.SESSION_SAVE_FAILED="SESSION_SAVE_FAILED",e.TRANSPORT_DISCONNECTED="TRANSPORT_DISCONNECTED",e.TRANSPORT_PUBLISH_FAILED="TRANSPORT_PUBLISH_FAILED",e.TRANSPORT_SUBSCRIBE_FAILED="TRANSPORT_SUBSCRIBE_FAILED",e.TRANSPORT_HISTORY_FAILED="TRANSPORT_HISTORY_FAILED",e.TRANSPORT_PARSE_FAILED="TRANSPORT_PARSE_FAILED",e.TRANSPORT_RECONNECT_FAILED="TRANSPORT_RECONNECT_FAILED",e.DECRYPTION_FAILED="DECRYPTION_FAILED",e.INVALID_KEY="INVALID_KEY",e.REQUEST_EXPIRED="REQUEST_EXPIRED",e.OTP_INCORRECT="OTP_INCORRECT",e.OTP_MAX_ATTEMPTS_REACHED="OTP_MAX_ATTEMPTS_REACHED",e.OTP_ENTRY_TIMEOUT="OTP_ENTRY_TIMEOUT",e.UNKNOWN="UNKNOWN",e))(Ve||{}),Ke=class extends Error{constructor(e,t){super(t||e),this.code=e,this.name=e}},We=class extends Ke{},Ge=class extends Ke{},Je=class extends Ke{},$e=Ae=class extends qe.default{__init(){this.session=null}__init2(){this._state="DISCONNECTED"}on(e,t){return super.on(e,t)}constructor(e,t,s){super(),Ae.prototype.__init.call(this),Ae.prototype.__init2.call(this),this.transport=e,this.keymanager=t,this.sessionstore=s,this.transport.on("error",(e=>this.emit("error",e))),this.transport.on("message",(async e=>{if(!Ne([this,"access",e=>e.session,"optionalAccess",e=>e.keyPair,"access",e=>e.privateKey]))return;if(await this.checkSessionExpiry())return void this.emit("error",new We("SESSION_EXPIRED","Session expired"));const t=await this.decryptMessage(e.data);t&&this.handleMessage(t)}))}get state(){return this._state}set state(e){this._state=e}async reconnect(){if("CONNECTING"!==this.state&&this.session&&this.transport.reconnect)try{this.state="CONNECTING",await this.transport.reconnect(),this.state="CONNECTED",this.emit("connected")}catch(e){throw this.state="DISCONNECTED",new Ge("TRANSPORT_RECONNECT_FAILED","Failed to reconnect")}}async resume(e){if("DISCONNECTED"!==this.state)throw new We("SESSION_INVALID_STATE",`Cannot resume when state is ${this.state}`);this.state="CONNECTING";try{const t=await this.sessionstore.get(e);if(!t)throw new We("SESSION_NOT_FOUND","Session not found or expired");this.keymanager.validatePeerKey(t.theirPublicKey),this.session=t,await this.transport.connect(),await this.transport.subscribe(t.channel),this.state="CONNECTED",this.emit("connected")}catch(e){throw this.state="DISCONNECTED",this.session=null,e}}async disconnect(){if(!this.session)return;const e=this.session;this.session=null,this.state="DISCONNECTED",await this.transport.disconnect(),await this.transport.clear(e.channel),await this.sessionstore.delete(e.id),this.emit("disconnected")}async sendMessage(e,t){if(!this.session)throw new We("SESSION_INVALID_STATE","Cannot send message: session is not initialized.");if(await this.checkSessionExpiry())throw new We("SESSION_EXPIRED","Session expired");const s=JSON.stringify(t),n=await this.keymanager.encrypt(s,this.session.theirPublicKey);if(!await this.transport.publish(e,n))throw new Ge("TRANSPORT_DISCONNECTED","Message could not be sent because the transport is disconnected.")}async checkSessionExpiry(){return!(!this.session||this.session.expiresAt>=Date.now())&&(await this.disconnect(),!0)}async decryptMessage(e){if(!Ne([this,"access",e=>e.session,"optionalAccess",e=>e.keyPair,"access",e=>e.privateKey]))return null;try{const t=await this.keymanager.decrypt(e,this.session.keyPair.privateKey);return JSON.parse(t)}catch(e){const t=e instanceof Error?e.message:String(e);return this.emit("error",new Je("DECRYPTION_FAILED",`Decryption failed: ${t}`)),null}}},Ye=["trusted","untrusted"];var He=r,Qe=((Le=class e{static __initStatic(){this.SESSION_PREFIX="session:"}static __initStatic2(){this.MASTER_LIST_KEY="sessions:master-list"}__init3(){this.mutex=new He.Mutex}static async create(t){const s=new e(t);return await s.garbageCollect(),s}constructor(e){Le.prototype.__init3.call(this),this.kvstore=e}async set(e){if(Number.isNaN(e.expiresAt)||e.expiresAt<Date.now())throw new We("SESSION_SAVE_FAILED","Cannot save expired session");const t={id:e.id,channel:e.channel,keyPair:{publicKeyB64:Buffer.from(e.keyPair.publicKey).toString("base64"),privateKeyB64:Buffer.from(e.keyPair.privateKey).toString("base64")},theirPublicKeyB64:Buffer.from(e.theirPublicKey).toString("base64"),expiresAt:e.expiresAt},s=this.getSessionKey(e.id);await this.kvstore.set(s,JSON.stringify(t)),await this.addToMasterList(e.id)}async get(e){const t=this.getSessionKey(e),s=await this.kvstore.get(t);if(!s)return null;try{const t=JSON.parse(s);if("number"!=typeof t.expiresAt||!(t.expiresAt>=Date.now()))return await this.delete(e),null;return{id:t.id,channel:t.channel,keyPair:{publicKey:new Uint8Array(Buffer.from(t.keyPair.publicKeyB64,"base64")),privateKey:new Uint8Array(Buffer.from(t.keyPair.privateKeyB64,"base64"))},theirPublicKey:new Uint8Array(Buffer.from(t.theirPublicKeyB64,"base64")),expiresAt:t.expiresAt}}catch(t){return await this.delete(e),null}}async list(){const e=await this.getMasterList(),t=[];for(const s of e){const e=await this.get(s);e&&t.push(e)}return t}async delete(e){const t=this.getSessionKey(e);await this.kvstore.delete(t),await this.removeFromMasterList(e)}async garbageCollect(){const e=await this.getMasterList();await Promise.all(e.map((async e=>this.get(e))))}getSessionKey(t){return`${e.SESSION_PREFIX}${t}`}async getMasterList(){const t=await this.kvstore.get(e.MASTER_LIST_KEY);if(!t)return[];try{return JSON.parse(t)}catch(e){return[]}}async addToMasterList(t){await this.mutex.runExclusive((async()=>{const s=await this.getMasterList();s.includes(t)||(s.push(t),await this.kvstore.set(e.MASTER_LIST_KEY,JSON.stringify(s)))}))}async removeFromMasterList(t){await this.mutex.runExclusive((async()=>{const s=(await this.getMasterList()).filter((e=>e!==t));await this.kvstore.set(e.MASTER_LIST_KEY,JSON.stringify(s))}))}}).__initStatic(),Le.__initStatic2(),Le),Xe=P,Ze=e=>new Promise((t=>setTimeout(t,e)));var et=Ue=class{constructor(e,t){Ue.prototype.__init4.call(this),this.realSub=e,this.parent=t}__init4(){this.hasUnsubscribed=!1}get channel(){return this.realSub.channel}get state(){return this.realSub.state}subscribe(){this.realSub.subscribe()}unsubscribe(){this.hasUnsubscribed||(this.hasUnsubscribed=!0,this.parent.removeSubscription({channel:this.channel}))}async publish(e){return await this.realSub.publish(e)}history(e){return this.realSub.history(e)}on(e,t){return this.realSub.on(e,t),this}once(e,t){return this.realSub.once(e,t),this}off(e,t){return this.realSub.off(e,t),this}},tt=((Me=class e extends qe.default{static __initStatic3(){this.contexts=new Map}__init5(){this.channels=new Set}__init6(){this.disconnected=!1}__init7(){this.eventListeners=new Map}constructor(t,s={}){if(super(),Me.prototype.__init5.call(this),Me.prototype.__init6.call(this),Me.prototype.__init7.call(this),this.url=t,e.contexts.has(t)){const n=e.contexts.get(t);if(!n)throw new Error("No context found");this.validateOptions(n.options,s)}else{const n=new Xe.Centrifuge(t,s);e.contexts.set(t,{refcount:0,options:s,centrifuge:n,subscriptions:new Map,reconnectPromise:null})}const n=e.contexts.get(t);if(!n)throw new Error("No context found");n.refcount++,this.attachEventListeners()}connect(){const t=e.contexts.get(this.url);t&&("connected"===t.centrifuge.state?setImmediate((()=>this.emit("connected",{}))):"connecting"===t.centrifuge.state||t.centrifuge.connect())}disconnect(){if(this.disconnected)return Promise.resolve();const t=e.contexts.get(this.url);if(!t)return Promise.resolve();this.disconnected=!0,this.emit("disconnected",{}),this.detachEventListeners();for(const e of this.channels)this.decrementChannelRef(e);return this.channels.clear(),t.refcount--,0===t.refcount?new Promise((s=>{t.centrifuge.once("disconnected",(()=>{e.contexts.delete(this.url),s()})),t.centrifuge.disconnect()})):Promise.resolve()}reconnect(){const t=e.contexts.get(this.url);return t?(t.reconnectPromise||(t.reconnectPromise=(async()=>{try{"disconnected"!==t.centrifuge.state&&await new Promise((e=>{t.centrifuge.once("disconnected",(()=>e())),t.centrifuge.disconnect()})),await new Promise(((e,s)=>{t.centrifuge.once("connected",(()=>e())),t.centrifuge.once("error",(e=>s(e.error))),t.centrifuge.connect()}))}finally{t.reconnectPromise=null}})()),t.reconnectPromise):Promise.resolve()}newSubscription(t,s={}){const n=e.contexts.get(this.url);if(!n)throw new Error("No context found");const i=n.subscriptions;if(!this.channels.has(t))if(i.has(t)){const e=i.get(t);if(!e)throw new Error(`Failed to get subscription info for channel ${t}`);e.count++}else{const e=n.centrifuge.newSubscription(t,s);i.set(t,{count:1,sub:e})}this.channels.add(t);const r=i.get(t);if(!r)throw new Error(`Failed to create or get subscription for channel ${t}`);return new et(r.sub,this)}getSubscription(t){if(!this.channels.has(t))return;const s=e.contexts.get(this.url);if(!s)return;const n=s.subscriptions.get(t);return n?new et(n.sub,this):void 0}async publish(t,s){const n=e.contexts.get(this.url);n&&await n.centrifuge.publish(t,s)}subscriptions(){const t=e.contexts.get(this.url);if(!t)return{};const s={};for(const e of this.channels){const n=t.subscriptions.get(e);n&&(s[e]=new et(n.sub,this))}return s}get real(){return Ne([e.contexts.get(this.url),"optionalAccess",e=>e.centrifuge])}get state(){if(this.disconnected)return"disconnected";const t=e.contexts.get(this.url);return s=Ne([t,"optionalAccess",e=>e.centrifuge,"access",e=>e.state]),n=()=>"disconnected",null!=s?s:n();var s,n}attachEventListeners(){if(this.eventListeners.size>0)return;const t=e.contexts.get(this.url);if(!t)return;["connecting","connected","disconnected","error"].forEach((e=>{const s=t=>{this.disconnected||this.emit(e,t)};this.eventListeners.set(e,s),t.centrifuge.on(e,s)}))}decrementChannelRef(t){const s=e.contexts.get(this.url);if(!s)return;const n=s.subscriptions,i=n.get(t);i&&(i.count--,0===i.count&&(i.sub.unsubscribe(),s.centrifuge.removeSubscription(i.sub),n.delete(t)))}detachEventListeners(){const t=e.contexts.get(this.url);if(t){for(const[e,s]of this.eventListeners)t.centrifuge.off(e,s);this.eventListeners.clear()}}validateOptions(e,t){const s=["token","websocket","minReconnectDelay","maxReconnectDelay"];for(const n of s){const s=e[n],i=t[n];void 0!==s&&void 0!==i&&s!==i&&console.warn(`SharedCentrifuge: Option '${n}' mismatch for URL ${this.url}. Using existing value: ${s}, ignoring new value: ${i}`)}}removeSubscription(e){e&&"channel"in e&&(this.decrementChannelRef(e.channel),this.channels.delete(e.channel))}}).__initStatic3(),Me),st=E,nt=class e{static async create(t){const s=e.getClientIdKey();let n=await t.get(s);return n||(n=st.v4.call(void 0),await t.set(s,n)),new e(t,n)}constructor(e,t){this.kvstore=e,this.clientId=t}getClientId(){return this.clientId}async getNextNonce(e){const t=this.getNonceKey(e),s=await this.kvstore.get(t),n=(s?parseInt(s,10):0)+1;return await this.kvstore.set(t,n.toString()),n}async getLatestNonces(e){const t=this.getLatestNoncesKey(e),s=await this.kvstore.get(t);if(s){const e=JSON.parse(s);return new Map(Object.entries(e))}return new Map}async setLatestNonces(e,t){const s=this.getLatestNoncesKey(e),n=Object.fromEntries(t);await this.kvstore.set(s,JSON.stringify(n))}async clear(e){const t=this.getNonceKey(e),s=this.getLatestNoncesKey(e);await Promise.all([this.kvstore.delete(t),this.kvstore.delete(s)])}static getClientIdKey(){return"websocket-transport-client-id"}getNonceKey(e){return`nonce:${this.clientId}:${e}`}getLatestNoncesKey(e){return`latest-nonces:${this.clientId}:${e}`}},it=je=class e extends qe.default{__init8(){this.queue=[]}__init9(){this.isProcessingQueue=!1}__init10(){this.state="disconnected"}static async create(t){const s=await nt.create(t.kvstore);return new e(s,t)}constructor(e,t){super(),je.prototype.__init8.call(this),je.prototype.__init9.call(this),je.prototype.__init10.call(this),this.storage=e;const s={minReconnectDelay:100,maxReconnectDelay:3e4};void 0!==t.websocket&&(s.websocket=t.websocket),this.centrifuge=t.useSharedConnection?new tt(t.url,s):new Xe.Centrifuge(t.url,s),this.centrifuge.on("connecting",(()=>this.setState("connecting"))),this.centrifuge.on("connected",(()=>{this.setState("connected"),this._processQueue()})),this.centrifuge.on("disconnected",(()=>this.setState("disconnected"))),this.centrifuge.on("error",(e=>this.emit("error",new Ge("UNKNOWN",e.error.message))))}connect(){return"connected"===this.state||"connecting"===this.state?Promise.resolve():(this.setState("connecting"),new Promise((e=>{this.centrifuge.once("connected",(()=>e())),this.centrifuge.connect()})))}disconnect(){return this.queue.forEach((e=>e.resolve(!1))),this.queue.length=0,"disconnected"===this.state?Promise.resolve():new Promise((e=>{const t=this.centrifuge.subscriptions();for(const e of Object.values(t))this.centrifuge.removeSubscription(e);this.centrifuge.once("disconnected",(()=>e())),this.centrifuge.disconnect()}))}reconnect(){return this.centrifuge instanceof tt&&"reconnect"in this.centrifuge?this.centrifuge.reconnect():"connecting"===this.state?new Promise((e=>this.centrifuge.once("connected",(()=>e())))):(this.centrifuge.disconnect(),new Promise(((e,t)=>{this.centrifuge.once("connected",(()=>e())),this.centrifuge.once("error",(e=>t(new Ge("TRANSPORT_RECONNECT_FAILED",e.error.message)))),this.centrifuge.connect()})))}subscribe(e){let t=this.centrifuge.getSubscription(e);if(!t){t=this.centrifuge.newSubscription(e,{recoverable:!0,positioned:!0});const s=t;t.on("subscribed",(()=>{this._fetchHistory(s,e),this._processQueue()})),t.on("publication",(t=>{this._handleIncomingMessage(e,t.data)})),t.on("error",(e=>this.emit("error",new Ge("TRANSPORT_SUBSCRIBE_FAILED",`Subscription error: ${e.error.message}`))))}if("subscribed"===t.state)return Promise.resolve();const s=t;return new Promise((e=>{s.once("subscribed",(()=>e())),s.subscribe()}))}publish(e,t){const s=new Promise(((s,n)=>{this.queue.push({channel:e,payload:t,resolve:s,reject:n})}));return this._processQueue(),s}async clear(e){await this.storage.clear(e);const t=this.centrifuge.getSubscription(e);t&&this.centrifuge.removeSubscription(t)}setState(e){this.state!==e&&(this.state=e,this.emit(e))}async _handleIncomingMessage(e,t){try{const s=JSON.parse(t);if("string"!=typeof s.clientId||"number"!=typeof s.nonce||"string"!=typeof s.payload)throw new Ge("TRANSPORT_PARSE_FAILED","Invalid message format");if(s.clientId===this.storage.getClientId())return;const n=await this.storage.getLatestNonces(e),i=n.get(s.clientId)||0;s.nonce>i&&(n.set(s.clientId,s.nonce),await this.storage.setLatestNonces(e,n),this.emit("message",{channel:e,data:s.payload}))}catch(e){this.emit("error",new Ge("TRANSPORT_PARSE_FAILED",`Failed to parse incoming message: ${e instanceof Error?e.message:"Unknown error"}`))}}async _fetchHistory(e,t){try{const s=await e.history({limit:50});for(const e of s.publications)await this._handleIncomingMessage(t,e.data)}catch(e){if(11===Ne([e,"optionalAccess",e=>e.code]))return;this.emit("error",new Ge("TRANSPORT_HISTORY_FAILED",`Failed to fetch history for channel ${t}: ${JSON.stringify(e)}`))}}async _process(e){const t={clientId:this.storage.getClientId(),nonce:await this.storage.getNextNonce(e.channel),payload:e.payload},s=JSON.stringify(t);return async function(e,t){for(let s=0;s<t.attempts;s++)try{return await e()}catch(e){if(s===t.attempts-1)throw e;const n=t.delay*2**s;await Ze(n)}throw new Ke("UNKNOWN","Retry logic failed unexpectedly.")}((async()=>{await this.centrifuge.publish(e.channel,s)}),{attempts:5,delay:100})}async _processQueue(){if(!this.isProcessingQueue&&"connected"===this.state){this.isProcessingQueue=!0;try{for(;this.queue.length>0;){const e=this.queue[0];try{await this._process(e),this.queue.shift(),e.resolve(!0)}catch(t){this.queue.shift(),e.reject(t instanceof Error?t:new Ge("TRANSPORT_PUBLISH_FAILED","Failed to publish message after all retries"))}}}finally{this.isProcessingQueue=!1}}}};var rt=i.BaseClient=$e,ot=i.CONNECTION_MODES=Ye,at=i.ClientState=ze,ct=i.CryptoError=Je,ht=i.DEFAULT_SESSION_TTL=2592e6,ut=i.ErrorCode=Ve,lt=i.ProtocolError=Ke,dt=i.SessionError=We,_t=i.SessionStore=Qe,ft=i.TransportError=Ge,pt=i.WebSocketTransport=it,bt=i.isValidConnectionMode=function(e){return"string"==typeof e&&Ye.includes(e)},gt=i.timingSafeEqual=function(e,t){if(e.length!==t.length)return!1;let s=0;for(let n=0;n<e.length;n++)s|=e.charCodeAt(n)^t.charCodeAt(n);return 0===s},mt=s({__proto__:null,BaseClient:rt,CONNECTION_MODES:ot,ClientState:at,CryptoError:ct,DEFAULT_SESSION_TTL:ht,ErrorCode:ut,ProtocolError:lt,SessionError:dt,SessionStore:_t,TransportError:ft,WebSocketTransport:pt,isValidConnectionMode:bt,timingSafeEqual:gt,default:i},[i]);export{rt as B,at as C,ht as D,ut as E,dt as S,bt as a,mt as i,gt as t};
|