@frak-labs/nexus-sdk 0.0.41-beta.dd44738a → 0.0.41-beta.ebc9d3a3
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/bundle/bundle.js +5 -5
- package/package.json +4 -4
package/dist/bundle/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NexusSDK=t():e.NexusSDK=t()}(globalThis,()=>(()=>{"use strict";var e={"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackExtension=void 0,t.JsonPackExtension=class{constructor(e,t){this.tag=e,this.val=t}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackValue=void 0,t.JsonPackValue=class{constructor(e){this.val=e}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoder=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class o extends n.CborDecoderBase{readAsMap(){let e=this.reader.u8();if(e>>5==5)return this.readMap(31&e);throw 0}readMap(e){let t=this.readMinorLen(e);return t>=0?this.readMapRaw(t):this.readMapIndef()}readMapRaw(e){let t=new Map;for(let r=0;r<e;r++){let e=this.val(),r=this.val();t.set(e,r)}return t}readMapIndef(){let e=new Map;for(;255!==this.reader.peak();){let t=this.val();if(255===this.reader.peak())throw 7;let r=this.val();e.set(t,r)}return this.reader.x++,e}skipN(e){for(let t=0;t<e;t++)this.skipAny()}skipAny(){this.skipAnyRaw(this.reader.u8())}skipAnyRaw(e){let t=31&e;switch(e>>5){case 0:case 1:this.skipUNint(t);break;case 2:this.skipBin(t);break;case 3:this.skipStr(t);break;case 4:this.skipArr(t);break;case 5:this.skipObj(t);break;case 7:this.skipTkn(t);break;case 6:this.skipTag(t)}}skipMinorLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}skipUNint(e){if(!(e<=23))switch(e){case 24:return this.reader.skip(1);case 25:return this.reader.skip(2);case 26:return this.reader.skip(4);case 27:return this.reader.skip(8);default:throw 1}}skipBin(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipBinChunk();this.reader.x++}}skipBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;this.skipBin(t)}skipStr(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipStrChunk();this.reader.x++}}skipStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;this.skipStr(t)}skipArr(e){let t=this.skipMinorLen(e);if(t>=0)this.skipN(t);else{for(;255!==this.reader.peak();)this.skipAny();this.reader.x++}}skipObj(e){let t=this.readMinorLen(e);if(t>=0)return this.skipN(2*t);for(;255!==this.reader.peak();){if(this.skipAny(),255===this.reader.peak())throw 7;this.skipAny()}this.reader.x++}skipTag(e){if(0>this.skipMinorLen(e))throw 1;this.skipAny()}skipTkn(e){switch(e){case 24:this.reader.skip(1);return;case 25:this.reader.skip(2);return;case 26:this.reader.skip(4);return;case 27:this.reader.skip(8);return}if(!(e<=23))throw 1}validate(e,t=0,r=e.length){if(this.reader.reset(e),this.reader.x=t,this.skipAny(),this.reader.x-t!==r)throw 8}decodeLevel(e){return this.reader.reset(e),this.readLevel()}readLevel(){let e=this.reader.u8(),t=e>>5,r=31&e;switch(t){case 4:return this.readArrLevel(r);case 5:return this.readObjLevel(r);default:return super.readAnyRaw(e)}}readPrimitiveOrVal(){switch(this.reader.peak()>>5){case 4:case 5:return this.readAsValue();default:return this.val()}}readAsValue(){let e=this.reader,t=e.x;this.skipAny();let r=e.x;return new i.JsonPackValue(e.uint8.subarray(t,r))}readObjLevel(e){let t=this.readMinorLen(e);return t>=0?this.readObjRawLevel(t):this.readObjIndefLevel()}readObjRawLevel(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.readPrimitiveOrVal();t[e]=r}return t}readObjIndefLevel(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.readPrimitiveOrVal();e[t]=r}return this.reader.x++,e}readArrLevel(e){let t=this.readMinorLen(e);return t>=0?this.readArrRawLevel(t):this.readArrIndefLevel()}readArrRawLevel(e){let t=[];for(let r=0;r<e;r++)t.push(this.readPrimitiveOrVal());return t}readArrIndefLevel(){let e=[];for(;255!==this.reader.peak();)e.push(this.readPrimitiveOrVal());return this.reader.x++,e}readHdr(e){let t=this.reader.u8();if(t>>5!==e)throw 0;let r=31&t;if(r<24)return r;switch(r){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1}throw 1}readStrHdr(){return this.readHdr(3)}readObjHdr(){return this.readHdr(5)}readArrHdr(){return this.readHdr(4)}findKey(e){let t=this.readObjHdr();for(let r=0;r<t;r++){if(this.key()===e)return this;this.skipAny()}throw 9}findIndex(e){if(e>=this.readArrHdr())throw 10;for(let t=0;t<e;t++)this.skipAny();return this}find(e){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r?this.findKey(r):this.findIndex(r)}return this}}t.CborDecoder=o},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderBase=void 0;let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/f16.js"),o=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),s=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js"),a=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Reader.js"),c=n.__importDefault(r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js"));t.CborDecoderBase=class{constructor(e=new a.Reader,t=c.default){this.reader=e,this.keyDecoder=t}read(e){return this.reader.reset(e),this.val()}decode(e){return this.reader.reset(e),this.val()}val(){let e=this.reader.u8(),t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readAnyRaw(e){let t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readMinorLen(e){if(e<24)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}readUint(e){if(e<25)return 24===e?this.reader.u8():e;{if(e<27)return 25===e?this.reader.u16():this.reader.u32();let t=this.reader.u64();return t>0x1fffffffffffff?t:Number(t)}}readNint(e){if(e<25)return 24===e?-this.reader.u8()-1:-e-1;{if(e<27)return 25===e?-this.reader.u16()-1:-this.reader.u32()-1;let t=this.reader.u64();return t>0x1ffffffffffffe?-t-BigInt(1):-Number(t)-1}}readBin(e){let t=this.reader;if(e<=23)return t.buf(e);switch(e){case 24:return t.buf(t.u8());case 25:return t.buf(t.u16());case 26:return t.buf(t.u32());case 27:return t.buf(Number(t.u64()));case 31:{let e=0,t=[];for(;255!==this.reader.peak();){let r=this.readBinChunk();e+=r.length,t.push(r)}this.reader.x++;let r=new Uint8Array(e),n=0,i=t.length;for(let e=0;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r}default:throw 1}}readBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;return this.readBin(t)}readAsStr(){let e=this.reader.u8();if(3!=e>>5)throw 11;return this.readStr(31&e)}readStr(e){let t=this.reader;if(e<=23)return t.utf8(e);switch(e){case 24:return t.utf8(t.u8());case 25:return t.utf8(t.u16());case 26:return t.utf8(t.u32());case 27:return t.utf8(Number(t.u64()));case 31:{let e="";for(;255!==t.peak();)e+=this.readStrChunk();return this.reader.x++,e}default:throw 1}}readStrLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());default:throw 1}}readStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;return this.readStr(t)}readArr(e){let t=this.readMinorLen(e);return t>=0?this.readArrRaw(t):this.readArrIndef()}readArrRaw(e){let t=[];for(let r=0;r<e;r++)t.push(this.val());return t}readArrIndef(){let e=[];for(;255!==this.reader.peak();)e.push(this.val());return this.reader.x++,e}readObj(e){if(e<28){let t=e;switch(e){case 24:t=this.reader.u8();break;case 25:t=this.reader.u16();break;case 26:t=this.reader.u32();break;case 27:t=Number(this.reader.u64())}let r={};for(let e=0;e<t;e++){let e=this.key();if("__proto__"===e)throw 6;let t=this.val();r[e]=t}return r}if(31===e)return this.readObjIndef();throw 1}readObjRaw(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.val();t[e]=r}return t}readObjIndef(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.val();e[t]=r}return this.reader.x++,e}key(){let e=this.reader.u8();if(3!=e>>5)return String(this.readAnyRaw(e));let t=this.readStrLen(31&e);if(t>31)return this.reader.utf8(t);let r=this.keyDecoder.decode(this.reader.uint8,this.reader.x,t);return this.reader.skip(t),r}readTag(e){if(e<=23)return this.readTagRaw(e);switch(e){case 24:return this.readTagRaw(this.reader.u8());case 25:return this.readTagRaw(this.reader.u16());case 26:return this.readTagRaw(this.reader.u32());case 27:return this.readTagRaw(Number(this.reader.u64()));default:throw 1}}readTagRaw(e){return new o.JsonPackExtension(e,this.val())}readTkn(e){switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;case 24:return new s.JsonPackValue(this.reader.u8());case 25:return this.f16();case 26:return this.reader.f32();case 27:return this.reader.f64()}if(e<=23)return new s.JsonPackValue(e);throw 1}f16(){return(0,i.decodeF16)(this.reader.u16())}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderDag=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js");class o extends i.CborDecoder{readTagRaw(e){let t=this.val();return 42===e?new n.JsonPackExtension(e,t):t}}t.CborDecoderDag=o},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoder=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),o=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),s=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class a extends o.CborEncoderFast{writeUnknown(e){this.writeNull()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);switch(e.constructor){case Object:return this.writeObj(e);case Array:return this.writeArr(e);case Uint8Array:return this.writeBin(e);case Map:return this.writeMap(e);case i.JsonPackExtension:return this.writeTag(e.tag,e.val);case s.JsonPackValue:let t=e.val;return this.writer.buf(t,t.length);default:if(e instanceof Uint8Array)return this.writeBin(e);if(Array.isArray(e))return this.writeArr(e);if(e instanceof Map)return this.writeMap(e);return this.writeUnknown(e)}case"undefined":return this.writeUndef();case"bigint":return this.writeBigInt(e);default:return this.writeUnknown(e)}}writeFloat(e){(0,n.isFloat32)(e)?this.writer.u8f32(250,e):this.writer.u8f64(251,e)}writeMap(e){this.writeMapHdr(e.size),e.forEach((e,t)=>{this.writeAny(t),this.writeAny(e)})}writeUndef(){this.writer.u8(247)}}t.CborEncoder=a},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderDag=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js");class i extends n.CborEncoderStable{writeUndef(){this.writeNull()}writeFloat(e){if(e!=e||!Number.isFinite(e))return this.writeNull();this.writer.u8f64(251,e)}writeTag(e,t){42===e&&this.writeTagHdr(e),this.writeAny(t)}}t.CborEncoderDag=i},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderFast=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Writer.js"),i=Number.isSafeInteger;t.CborEncoderFast=class{constructor(e=new n.Writer){this.writer=e}encode(e){return this.writeAny(e),this.writer.flush()}encodeToSlice(e){return this.writeAny(e),this.writer.flushSlice()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);if(e.constructor===Array)return this.writeArr(e);return this.writeObj(e)}}writeCbor(){this.writer.u8u16(217,55799)}writeEnd(){this.writer.u8(255)}writeNull(){this.writer.u8(246)}writeBoolean(e){e?this.writer.u8(245):this.writer.u8(244)}writeNumber(e){i(e)?this.writeInteger(e):"bigint"==typeof e?this.writeBigInt(e):this.writeFloat(e)}writeBigInt(e){e>=0?this.writeBigUint(e):this.writeBigSint(e)}writeBigUint(e){if(e<=Number.MAX_SAFE_INTEGER)return this.writeUInteger(Number(e));this.writer.u8u64(27,e)}writeBigSint(e){if(e>=Number.MIN_SAFE_INTEGER)return this.encodeNint(Number(e));let t=-BigInt(1)-e;this.writer.u8u64(59,t)}writeInteger(e){e>=0?this.writeUInteger(e):this.encodeNint(e)}writeUInteger(e){let t=this.writer;t.ensureCapacity(9);let r=t.uint8,n=t.x;e<=23?r[n++]=0+e:e<=255?(r[n++]=24,r[n++]=e):e<=65535?(r[n++]=25,t.view.setUint16(n,e),n+=2):e<=0xffffffff?(r[n++]=26,t.view.setUint32(n,e),n+=4):(r[n++]=27,t.view.setBigUint64(n,BigInt(e)),n+=8),t.x=n}encodeNumber(e){this.writeNumber(e)}encodeInteger(e){this.writeInteger(e)}encodeUint(e){this.writeUInteger(e)}encodeNint(e){let t=-1-e,r=this.writer;r.ensureCapacity(9);let n=r.uint8,i=r.x;t<24?n[i++]=32+t:t<=255?(n[i++]=56,n[i++]=t):t<=65535?(n[i++]=57,r.view.setUint16(i,t),i+=2):t<=0xffffffff?(n[i++]=58,r.view.setUint32(i,t),i+=4):(n[i++]=59,r.view.setBigUint64(i,BigInt(t)),i+=8),r.x=i}writeFloat(e){this.writer.u8f64(251,e)}writeBin(e){let t=e.length;this.writeBinHdr(t),this.writer.buf(e,t)}writeBinHdr(e){let t=this.writer;e<=23?t.u8(64+e):e<=255?t.u16(22528+e):e<=65535?t.u8u16(89,e):e<=0xffffffff?t.u8u32(90,e):t.u8u64(91,e)}writeStr(e){let t=this.writer,r=4*e.length;t.ensureCapacity(5+r);let n=t.uint8,i=t.x;r<=23?t.x++:r<=255?(n[t.x++]=120,i=t.x,t.x++):r<=65535?(n[t.x++]=121,i=t.x,t.x+=2):(n[t.x++]=122,i=t.x,t.x+=4);let o=t.utf8(e);r<=23?n[i]=96+o:r<=255?n[i]=o:r<=65535?t.view.setUint16(i,o):t.view.setUint32(i,o)}writeStrHdr(e){let t=this.writer;e<=23?t.u8(96+e):e<=255?t.u16(30720+e):e<=65535?t.u8u16(121,e):t.u8u32(122,e)}writeAsciiStr(e){this.writeStrHdr(e.length),this.writer.ascii(e)}writeArr(e){let t=e.length;this.writeArrHdr(t);for(let r=0;r<t;r++)this.writeAny(e[r])}writeArrHdr(e){let t=this.writer;e<=23?t.u8(128+e):e<=255?t.u16(38912+e):e<=65535?t.u8u16(153,e):e<=0xffffffff?t.u8u32(154,e):t.u8u64(155,e)}writeObj(e){let t=Object.keys(e),r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeObjHdr(e){let t=this.writer;e<=23?t.u8(160+e):e<=255?t.u16(47104+e):e<=65535?t.u8u16(185,e):e<=0xffffffff?t.u8u32(186,e):t.u8u64(187,e)}writeMapHdr(e){this.writeObjHdr(e)}writeStartMap(){this.writer.u8(191)}writeTag(e,t){this.writeTagHdr(e),this.writeAny(t)}writeTagHdr(e){let t=this.writer;e<=23?t.u8(192+e):e<=255?t.u16(55296+e):e<=65535?t.u8u16(217,e):e<=0xffffffff?t.u8u32(218,e):t.u8u64(219,e)}writeTkn(e){let t=this.writer;e<=23?t.u8(224+e):e<=255&&t.u16(63488+e)}writeStartStr(){this.writer.u8(127)}writeStrChunk(e){throw Error("Not implemented")}writeEndStr(){throw Error("Not implemented")}writeStartBin(){this.writer.u8(95)}writeBinChunk(e){throw Error("Not implemented")}writeEndBin(){throw Error("Not implemented")}writeStartArr(){this.writer.u8(159)}writeArrChunk(e){throw Error("Not implemented")}writeEndArr(){this.writer.u8(255)}writeStartObj(){this.writer.u8(191)}writeObjChunk(e,t){throw Error("Not implemented")}writeEndObj(){this.writer.u8(255)}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderStable=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),i=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/sort/insertion2.js"),o=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/objKeyCmp.js"),s=e=>e<=23?1:e<=255?2:e<=65535?3:5;class a extends n.CborEncoder{writeObj(e){let t=Object.keys(e);(0,i.sort)(t,o.objKeyCmp);let r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeStr(e){let t=this.writer,r=e.length,n=4*r;t.ensureCapacity(5+n);let i=s(r),o=t.x,a=o+i;t.x=a;let c=t.utf8(e),l=t.uint8,u=s(c);switch(u!==i&&l.copyWithin(a+(u-i),a,a+c),u){case 1:l[o]=96+c;break;case 2:l[o]=120,l[o+1]=c;break;case 3:l[o]=121,t.view.setUint16(o+1,c);break;case 5:l[o]=122,t.view.setUint32(o+1,c)}t.x=o+u+c}writeUndef(){this.writeNull()}}t.CborEncoderStable=a},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs");n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js"),t)},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Reader.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Reader=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js");t.Reader=class{constructor(){this.uint8=new Uint8Array([]),this.view=new DataView(this.uint8.buffer),this.x=0}reset(e){this.x=0,this.uint8=e,this.view=new DataView(e.buffer,e.byteOffset,e.length)}peak(){return this.view.getUint8(this.x)}skip(e){this.x+=e}buf(e){let t=this.x+e,r=this.uint8.subarray(this.x,t);return this.x=t,r}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let e=this.x,t=(this.uint8[e++]<<8)+this.uint8[e++];return this.x=e,t}i16(){let e=this.view.getInt16(this.x);return this.x+=2,e}u32(){let e=this.view.getUint32(this.x);return this.x+=4,e}i32(){let e=this.view.getInt32(this.x);return this.x+=4,e}u64(){let e=this.view.getBigUint64(this.x);return this.x+=8,e}i64(){let e=this.view.getBigInt64(this.x);return this.x+=8,e}f32(){let e=this.x;return this.x+=4,this.view.getFloat32(e)}f64(){let e=this.x;return this.x+=8,this.view.getFloat64(e)}utf8(e){let t=this.x;return this.x+=e,(0,n.decodeUtf8)(this.uint8,t,e)}ascii(e){let t=this.uint8,r="",n=this.x+e;for(let e=this.x;e<n;e++)r+=String.fromCharCode(t[e]);return this.x=n,r}}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Slice.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Slice=void 0,t.Slice=class{constructor(e,t,r,n){this.uint8=e,this.view=t,this.start=r,this.end=n}subarray(){return this.uint8.subarray(this.start,this.end)}}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Writer.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Writer=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/Slice.js"),i=new DataView(new Uint8Array([]).buffer),o="function"==typeof Buffer,s=o?Buffer.prototype.utf8Write:null,a=o?Buffer.from:null,c="undefined"!=typeof TextEncoder?new TextEncoder:null;t.Writer=class{constructor(e=65536){this.allocSize=e,this.view=i,this.x0=0,this.x=0,this.uint8=new Uint8Array(e),this.size=e,this.view=new DataView(this.uint8.buffer)}grow(e){let t=this.x0,r=this.x,n=this.uint8,i=new Uint8Array(e),o=new DataView(i.buffer),s=n.subarray(t,r);i.set(s,0),this.x=r-t,this.x0=0,this.uint8=i,this.size=e,this.view=o}ensureCapacity(e){let t=this.size,r=t-this.x;if(r<e){let n=t-this.x0+(e-r);this.grow(n<=this.allocSize?this.allocSize:2*n)}}move(e){this.ensureCapacity(e),this.x+=e}reset(){this.x0=this.x}newBuffer(e){let t=this.uint8=new Uint8Array(e);this.size=e,this.view=new DataView(t.buffer),this.x=this.x0=0}flush(){let e=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,e}flushSlice(){let e=new n.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,e}u8(e){this.ensureCapacity(1),this.uint8[this.x++]=e}u16(e){this.ensureCapacity(2),this.view.setUint16(this.x,e),this.x+=2}u32(e){this.ensureCapacity(4),this.view.setUint32(this.x,e),this.x+=4}i32(e){this.ensureCapacity(4),this.view.setInt32(this.x,e),this.x+=4}u64(e){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(e)),this.x+=8}f64(e){this.ensureCapacity(8),this.view.setFloat64(this.x,e),this.x+=8}u8u16(e,t){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=e,this.uint8[r++]=t>>>8,this.uint8[r++]=255&t,this.x=r}u8u32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setUint32(r,t),this.x=r+4}u8u64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setBigUint64(r,BigInt(t)),this.x=r+8}u8f32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setFloat32(r,t),this.x=r+4}u8f64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setFloat64(r,t),this.x=r+8}buf(e,t){this.ensureCapacity(t);let r=this.x;this.uint8.set(e,r),this.x=r+t}utf8(e){let t=4*e.length;if(t<168)return this.utf8Native(e);if(s){let r=s.call(this.uint8,e,this.x,t);return this.x+=r,r}if(a){let r=this.uint8,n=r.byteOffset+this.x,i=a(r.buffer).subarray(n,n+t).write(e,0,t,"utf8");return this.x+=i,i}if(t>1024&&c){let r=c.encodeInto(e,this.uint8.subarray(this.x,this.x+t)).written;return this.x+=r,r}return this.utf8Native(e)}utf8Native(e){let t=e.length,r=this.uint8,n=this.x,i=0;for(;i<t;){let o=e.charCodeAt(i++);if((0xffffff80&o)==0){r[n++]=o;continue}if((0xfffff800&o)==0)r[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<t){let t=e.charCodeAt(i);(64512&t)==56320&&(i++,o=((1023&o)<<10)+(1023&t)+65536)}(0xffff0000&o)==0?r[n++]=o>>12&15|224:(r[n++]=o>>18&7|240,r[n++]=o>>12&63|128),r[n++]=o>>6&63|128}r[n++]=63&o|128}let o=n-this.x;return this.x=n,o}ascii(e){let t=e.length;this.ensureCapacity(t);let r=this.uint8,n=this.x,i=0;for(;i<t;)r[n++]=e.charCodeAt(i++);this.x=n}}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/f16.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeF16=void 0;let r=Math.pow;t.decodeF16=e=>{let t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:r(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/isFloat32.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFloat32=void 0;let r=new DataView(new ArrayBuffer(4));t.isFloat32=e=>(r.setFloat32(0,e),e===r.getFloat32(0))},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CachedUtf8Decoder=void 0;let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js")),i=1+Math.round(0xfffffffe*Math.random());class o{constructor(e,t){this.bytes=e,this.value=t}}t.CachedUtf8Decoder=class{constructor(){this.caches=[];for(let e=0;e<31;e++)this.caches.push([])}get(e,t,r){let n=this.caches[r-1],i=n.length;e:for(let o=0;o<i;o++){let i=n[o],s=i.bytes;for(let n=0;n<r;n++)if(s[n]!==e[t+n])continue e;return i.value}return null}store(e,t){let r=this.caches[e.length-1],n=new o(e,t);if(r.length>=16)r[i^=i<<13,i^=i>>>17,((i^=i<<5)>>>0)%16+0]=n;else r.push(n)}decode(e,t,r){if(!r)return"";let i=this.get(e,t,r);if(null!==i)return i;let o=(0,n.default)(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o}}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeAsciiMax15=t.decodeAscii=void 0;let r=String.fromCharCode;t.decodeAscii=(e,t,n)=>{let i=[];for(let r=0;r<n;r++){let r=e[t++];if(128&r)return;i.push(r)}return r.apply(String,i)},t.decodeAsciiMax15=(e,t,n)=>{if(n<4)if(n<2)if(0===n)return"";else{let n=e[t++];if((128&n)>1){t-=1;return}return r(n)}else{let i=e[t++],o=e[t++];if((128&i)>0||(128&o)>0){t-=2;return}if(n<3)return r(i,o);let s=e[t++];if((128&s)>0){t-=3;return}return r(i,o,s)}{let i=e[t++],o=e[t++],s=e[t++],a=e[t++];if((128&i)>0||(128&o)>0||(128&s)>0||(128&a)>0){t-=4;return}if(n<6)if(4===n)return r(i,o,s,a);else{let n=e[t++];if((128&n)>0){t-=5;return}return r(i,o,s,a,n)}if(n<8){let c=e[t++],l=e[t++];if((128&c)>0||(128&l)>0){t-=6;return}if(n<7)return r(i,o,s,a,c,l);let u=e[t++];if((128&u)>0){t-=7;return}return r(i,o,s,a,c,l,u)}{let c=e[t++],l=e[t++],u=e[t++],d=e[t++];if((128&c)>0||(128&l)>0||(128&u)>0||(128&d)>0){t-=8;return}if(n<10)if(8===n)return r(i,o,s,a,c,l,u,d);else{let n=e[t++];if((128&n)>0){t-=9;return}return r(i,o,s,a,c,l,u,d,n)}if(n<12){let f=e[t++],h=e[t++];if((128&f)>0||(128&h)>0){t-=10;return}if(n<11)return r(i,o,s,a,c,l,u,d,f,h);let p=e[t++];if((128&p)>0){t-=11;return}return r(i,o,s,a,c,l,u,d,f,h,p)}{let f=e[t++],h=e[t++],p=e[t++],b=e[t++];if((128&f)>0||(128&h)>0||(128&p)>0||(128&b)>0){t-=12;return}if(n<14)if(12===n)return r(i,o,s,a,c,l,u,d,f,h,p,b);else{let n=e[t++];if((128&n)>0){t-=13;return}return r(i,o,s,a,c,l,u,d,f,h,p,b,n)}{let m=e[t++],w=e[t++];if((128&m)>0||(128&w)>0){t-=14;return}if(n<15)return r(i,o,s,a,c,l,u,d,f,h,p,b,m,w);let y=e[t++];if((128&y)>0){t-=15;return}return r(i,o,s,a,c,l,u,d,f,h,p,b,m,w,y)}}}}}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/index.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUtf8=void 0,t.decodeUtf8=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js")).default},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s="";for(;i<o;){let t=e[i++];if((128&t)==0){s+=r(t);continue}let n=63&e[i++];if((224&t)==192){s+=r((31&t)<<6|n);continue}let o=63&e[i++];if((240&t)==224){s+=r((31&t)<<12|n<<6|o);continue}if((248&t)==240){let a=(7&t)<<18|n<<12|o<<6|63&e[i++];a>65535?s+=r((a-=65536)>>>10&1023|55296,a=56320|1023&a):s+=r(a)}else s+=r(t)}return s}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js"),o=n.__importDefault(r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js")),s="undefined"!=typeof Buffer,a=s?Buffer.prototype.utf8Slice:null,c=s?Buffer.from:null,l=(e,t,r)=>(0,i.decodeAsciiMax15)(e,t,r)??(0,o.default)(e,t,r),u=(e,t,r)=>(0,i.decodeAscii)(e,t,r)??(0,o.default)(e,t,r),d=a?(e,t,r)=>a.call(e,t,t+r):c?(e,t,r)=>c(e).subarray(t,t+r).toString("utf8"):o.default;t.default=(e,t,r)=>r<16?l(e,t,r):r<32?u(e,t,r):d(e,t,r)},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s=[];for(;i<o;){let t=e[i++];if((128&t)!=0){let r=63&e[i++];if((224&t)==192)t=(31&t)<<6|r;else{let n=63&e[i++];if((240&t)==224)t=(31&t)<<12|r<<6|n;else if((248&t)==240){let o=(7&t)<<18|r<<12|n<<6|63&e[i++];if(o>65535){let e=(o-=65536)>>>10&1023|55296;t=56320|1023&o,s.push(e)}else t=o}}}s.push(t)}return r.apply(String,s)}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=new(r("../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js")).CachedUtf8Decoder},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/objKeyCmp.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.objKeyCmp=void 0,t.objKeyCmp=(e,t)=>{let r=e.length,n=t.length;return r===n?e>t?1:-1:r-n}},"../../node_modules/.bun/@jsonjoy.com+util@1.5.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/sort/insertion2.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sort=void 0,t.sort=(e,t)=>{let r=e.length;for(let n=1;n<r;n++){let r=e[n],i=n;for(;0!==i&&t(e[i-1],r)>0;)e[i]=e[i-1],i--;e[i]=r}return e}},"../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs":function(e,t,r){r.r(t),r.d(t,{__addDisposableResource:()=>D,__assign:()=>o,__asyncDelegator:()=>S,__asyncGenerator:()=>_,__asyncValues:()=>A,__await:()=>k,__awaiter:()=>p,__classPrivateFieldGet:()=>U,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>L,__createBinding:()=>m,__decorate:()=>a,__disposeResources:()=>T,__esDecorate:()=>l,__exportStar:()=>w,__extends:()=>i,__generator:()=>b,__importDefault:()=>P,__importStar:()=>O,__makeTemplateObject:()=>E,__metadata:()=>h,__param:()=>c,__propKey:()=>d,__read:()=>g,__rest:()=>s,__rewriteRelativeImportExtension:()=>B,__runInitializers:()=>u,__setFunctionName:()=>f,__spread:()=>j,__spreadArray:()=>v,__spreadArrays:()=>x,__values:()=>y,default:()=>F});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function c(e,t){return function(r,n){t(r,n,e)}}function l(e,t,r,n,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?n.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),f=!1,h=r.length-1;h>=0;h--){var p={};for(var b in n)p[b]="access"===b?{}:n[b];for(var b in n.access)p.access[b]=n.access[b];p.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var m=(0,r[h])("accessor"===c?{get:d.get,set:d.set}:d[l],p);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(a=s(m.get))&&(d.get=a),(a=s(m.set))&&(d.set=a),(a=s(m.init))&&i.unshift(a)}else(a=s(m))&&("field"===c?i.unshift(a):d[l]=a)}u&&Object.defineProperty(u,n.name,d),f=!0}function u(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})}function b(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){var l=[a,c];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var m=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function w(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||m(t,e,r)}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function j(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n}function v(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=i[e](t)).value instanceof k?Promise.resolve(r.value.v).then(c,l):u(o[0][2],r)}catch(e){u(o[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:k(e[n](t)),done:!1}:i?i(t):t}:i}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=y(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var o,s,a;o=n,s=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:a})},s)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},C=function(e){return(C=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=C(e),n=0;n<r.length;n++)"default"!==r[n]&&m(t,e,r[n]);return I(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function U(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function L(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){var n,i;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var M="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function T(e){function t(t){e.error=e.hasError?new M(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function i(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(i);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(o).then(i,function(e){return t(e),i()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function B(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,o){return r?t?".jsx":".js":!n||i&&o?n+i+"."+o.toLowerCase()+"js":e}):e}let F={__extends:i,__assign:o,__rest:s,__decorate:a,__param:c,__esDecorate:l,__runInitializers:u,__propKey:d,__setFunctionName:f,__metadata:h,__awaiter:p,__generator:b,__createBinding:m,__exportStar:w,__values:y,__read:g,__spread:j,__spreadArrays:x,__spreadArray:v,__await:k,__asyncGenerator:_,__asyncDelegator:S,__asyncValues:A,__makeTemplateObject:E,__importStar:O,__importDefault:P,__classPrivateFieldGet:U,__classPrivateFieldSet:L,__classPrivateFieldIn:R,__addDisposableResource:D,__disposeResources:T,__rewriteRelativeImportExtension:B}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{let e,t,i,o;r.r(n),r.d(n,{decompressJsonFromB64:()=>eO,PressInteractionEncoder:()=>tq,getProductInformation:()=>tx,findIframeInOpener:()=>ex,createIFrameFrakClient:()=>ev,generateSsoUrl:()=>ez,getCurrencyAmountKey:()=>eF,createIFrameNexusClient:()=>tX,sendInteraction:()=>tb,FrakContextManager:()=>eT,getSupportedLocale:()=>eB,compressJsonToB64:()=>eC,baseIframeProps:()=>ey,DebugInfoGatherer:()=>ew,base64urlEncode:()=>eE,processReferral:()=>tP,ReferralInteractionEncoder:()=>tW,modalBuilder:()=>tS,productTypes:()=>eV,referralInteraction:()=>tR,prepareSso:()=>tj,siweAuthenticate:()=>tk,locales:()=>e_,ssoPopupName:()=>eJ,productTypesMask:()=>eH,trackPurchaseStatus:()=>tv,interactionTypes:()=>eq,getSupportedCurrency:()=>eS,PurchaseInteractionEncoder:()=>tJ,sendTransaction:()=>t_,formatAmount:()=>eN,trackEvent:()=>e$,base64urlDecode:()=>eI,displayEmbeddedWallet:()=>tw,displayModal:()=>tm,watchWalletStatus:()=>tf,ssoPopupFeatures:()=>eW,RetailInteractionEncoder:()=>tK,setupClient:()=>eA,createIframe:()=>eg,openSso:()=>tg,WebShopInteractionEncoder:()=>tG});var s=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.2.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js");let a={clientNotConnected:-32001,configError:-32002,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};class c extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}toJSON(){return{code:this.code,message:this.message,data:this.data}}}class l{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}}let u=new s.CborEncoder,d=new s.CborDecoder;function f(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function h(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function p(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function b(e,t){h(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function m(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function w(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return e<<32-t|e>>>t}let g=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}return e};function j(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),h(e),e}class x{}function v(e){let t=t=>e().update(j(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class k extends x{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=w(this.buffer)}update(e){p(this),h(e=j(e));let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let t=w(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){p(this),b(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,m(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(0xffffffff),s=Number(r>>i&o),a=Number(r&o),c=4*!!n,l=4*!n;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);let s=w(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let _=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),S=BigInt(0x100000000-1),A=BigInt(32);function E(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:r,l:s}=function(e,t=!1){return t?{h:Number(e&S),l:Number(e>>A&S)}:{h:0|Number(e>>A&S),l:0|Number(e&S)}}(e[o],t);[n[o],i[o]]=[r,s]}return[n,i]}let I=(e,t,r)=>e<<r|t>>>32-r,C=(e,t,r)=>t<<r|e>>>32-r,O=(e,t,r)=>t<<r-32|e>>>64-r,P=(e,t,r)=>e<<r-32|t>>>64-r,U=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),L=new Uint32Array(64);class R extends k{constructor(e=32){super(64,e,8,!1),this.A=0|_["0"],this.B=0|_["1"],this.C=0|_["2"],this.D=0|_["3"],this.E=0|_["4"],this.F=0|_["5"],this.G=0|_["6"],this.H=0|_["7"]}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)L[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=L[e-15],r=L[e-2],n=y(t,7)^y(t,18)^t>>>3,i=y(r,17)^y(r,19)^r>>>10;L[e]=i+L[e-7]+n+L[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var u,d,f,h;let t=l+(y(s,6)^y(s,11)^y(s,25))+((u=s)&a^~u&c)+U[e]+L[e]|0,p=(y(r,2)^y(r,13)^y(r,22))+((d=r)&(f=n)^d&(h=i)^f&h)|0;l=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+p|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,a,c,l)}roundClean(){m(L)}destroy(){this.set(0,0,0,0,0,0,0,0),m(this.buffer)}}E(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e)));let D=v(()=>new R);function M(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}let T="2.31.2",B={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${T}`};class F extends Error{constructor(e,t={}){let r=t.cause instanceof F?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof F&&t.cause.docsPath||t.docsPath,i=B.getDocsUrl?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...B.version?[`Version: ${B.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=T}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class N extends F{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class $ extends F{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function z(e,{dir:t,size:r=32}={}){return"string"==typeof e?V(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new $({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i<r;i++){let o="right"===t;n[o?i:r-i-1]=e[o?i:e.length-i-1]}return n}(e,{dir:t,size:r})}function V(e,{dir:t,size:r=32}={}){if(null===r)return e;let n=e.replace("0x","");if(n.length>2*r)throw new $({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}class H extends F{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class q extends F{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function W(e){return M(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function J(e,{size:t}){if(W(e)>t)throw new q({givenSize:W(e),maxSize:t})}let G=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function K(e,t={}){return"number"==typeof e||"bigint"==typeof e?Y(e,t):"string"==typeof e?ee(e,t):"boolean"==typeof e?X(e,t):Q(e,t)}function X(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(J(r,{size:t.size}),z(r,{size:t.size})):r}function Q(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=G[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(J(n,{size:t.size}),z(n,{dir:"right",size:t.size})):n}function Y(e,t={}){let r,{signed:n,size:i}=t,o=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let s="bigint"==typeof r&&n?-r-1n:0;if(r&&o>r||o<s){let t="bigint"==typeof e?"n":"";throw new H({max:r?`${r}${t}`:void 0,min:`${s}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=`0x${(n&&o<0?(1n<<BigInt(8*i))+BigInt(o):o).toString(16)}`;return i?z(a,{size:i}):a}let Z=new TextEncoder;function ee(e,t={}){return Q(Z.encode(e),t)}let et=new TextEncoder;function er(e,t={}){return"number"==typeof e||"bigint"==typeof e?eo(Y(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(J(r,{size:t.size}),z(r,{size:t.size})):r}(e,t):M(e)?eo(e,t):es(e,t)}let en={zero:48,nine:57,A:65,F:70,a:97,f:102};function ei(e){return e>=en.zero&&e<=en.nine?e-en.zero:e>=en.A&&e<=en.F?e-(en.A-10):e>=en.a&&e<=en.f?e-(en.a-10):void 0}function eo(e,t={}){let r=e;t.size&&(J(r,{size:t.size}),r=z(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let r=ei(n.charCodeAt(t++)),i=ei(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new F(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);o[e]=16*r+i}return o}function es(e,t={}){let r=et.encode(e);return"number"==typeof t.size?(J(r,{size:t.size}),z(r,{dir:"right",size:t.size})):r}let ea={corruptedResponse:-32003};class ec extends Error{code;data;constructor(e,t,r){super(t),this.code=e,this.data=r}toJSON(){return{code:this.code,message:this.message,data:this.data}}}let el=new s.CborEncoder,eu=new s.CborDecoder;function ed(e){var t,r;return K(D(M(t=el.encode(e),{strict:!1})?er(t):t))}let ef=()=>({onRequest:(e,t)=>{if(e.data instanceof Uint8Array||ArrayBuffer.isView(e.data))return t;try{e.data=function(e){let t={...e,validationHash:ed(e??{})};return el.encode(t)}(e.data)}catch(e){console.error("[Compression Middleware] Failed to compress request",e)}return t},onResponse:(e,t,r)=>{if(t.error||!(t.result instanceof Uint8Array||ArrayBuffer.isView(t.result)))return t;try{let{validationHash:e,...r}=function(e){if(!e.length)throw new ec(ea.corruptedResponse,"Missing compressed data");let t=function(e){try{return eu.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}(e);if(!t)throw new ec(ea.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new ec(ea.corruptedResponse,"Missing validation hash");let{validationHash:r,...n}=t,i=ed(n);if(i!==t.validationHash)throw console.warn("Validation error",{validationHash:r,rawResultData:n,parsedData:t,expectedValidationHashes:i,recomputedHash:ed(void 0)}),new ec(ea.corruptedResponse,"Invalid validation hash");return t}(t.result);"object"==typeof r&&null!==r&&"result"in r?t.result=r.result:t.result=r}catch(e){console.error("[Compression Middleware] Failed to decompress response",e)}return t}});var eh=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":"application/json",...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,r]of Object.entries(this.headers)){let n=await r;null!==n&&(e[t]=n)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,r,n){try{let n=await fetch(e,{method:"POST",headers:await this.resolveHeaders(),body:JSON.stringify(t??{}),keepalive:!0,...r});if(401===n.status)return null;if(200!==n.status&&202!==n.status)throw Error(`HTTP error! status: ${n.status}`);let i=await n.text();return i?JSON.parse(i):null}catch(i){if(n<this.maxRetries){let i=this.initialRetryDelay*Math.pow(2,n);return await new Promise(e=>setTimeout(e,i)),this.post(e,t,r,n+1)}return console.error("Max retries reached:",i),null}}async fetch(e,t,r={}){let n=`${this.baseUrl}${e}`;return this.post(n,t,r,0)}},ep=class{constructor(e){this.options=e,this.queue=[];let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t["openpanel-client-secret"]=e.clientSecret),t["openpanel-sdk-name"]=e.sdk||"node",t["openpanel-sdk-version"]=e.sdkVersion||"1.0.0",this.api=new eh({baseUrl:e.apiUrl||"https://api.openpanel.dev",defaultHeaders:t})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send(e){return this.options.disabled||this.options.filter&&!this.options.filter(e)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push(e),Promise.resolve()):this.api.fetch("/track",e)}setGlobalProperties(e){this.global={...this.global,...e}}async track(e,t){return this.send({type:"track",payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async identify(e){if(e.profileId&&(this.profileId=e.profileId,this.flush()),Object.keys(e).length>1)return this.send({type:"identify",payload:{...e,properties:{...this.global,...e.properties}}})}async alias(e){return this.send({type:"alias",payload:e})}async increment(e){return this.send({type:"increment",payload:e})}async decrement(e){return this.send({type:"decrement",payload:e})}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}},eb=class extends ep{constructor(e){super({sdk:"web",sdkVersion:"1.0.1",...e}),this.options=e,this.lastPath="",this.isServer()||(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&this.trackScreenViews(),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes())}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>"u"}trackOutgoingLinks(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("a");if(r&&t){let e=r.getAttribute("href");e?.startsWith("http")&&super.track("link_out",{href:e,text:r.innerText||r.getAttribute("title")||t.getAttribute("alt")||t.getAttribute("title")})}})}trackScreenViews(){if(this.isServer())return;this.screenView();let e=history.pushState;history.pushState=function(...t){let r=e.apply(this,t);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),r};let t=history.replaceState;history.replaceState=function(...e){let r=t.apply(this,e);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),r},window.addEventListener("popstate",()=>{window.dispatchEvent(new Event("locationchange"))});let r=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener("hashchange",r):window.addEventListener("locationchange",r)}trackAttributes(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("button"),n=t.closest("a"),i=r?.getAttribute("data-track")?r:n?.getAttribute("data-track")?n:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith("data-")&&"data-track"!==t.name&&(e[t.name.replace(/^data-/,"").replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""))]=t.value);let t=i.getAttribute("data-track");t&&super.track(t,e)}})}screenView(e,t){let r,n;this.isServer()||("string"==typeof e?(r=e,n=t):(r=window.location.href,n=e),this.lastPath!==r&&(this.lastPath=r,super.track("screen_view",{...n??{},__path:r,__title:document.title})))}};let em="nexus-wallet-backup";class ew{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),r=this.getNavigatorInfo(),n="Unknown";return e instanceof c?n=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?n=e.message:"string"==typeof e&&(n=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:t?this.base64Encode(t):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:n}}static empty(){return new ew}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.NexusSDK=t():e.NexusSDK=t()}(globalThis,()=>(()=>{"use strict";var e={"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Reader.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Reader=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/index.js");class i{constructor(e=new Uint8Array([]),t=new DataView(e.buffer,e.byteOffset,e.length),r=0,n=e.length){this.uint8=e,this.view=t,this.x=r,this.end=n}reset(e){this.x=0,this.uint8=e,this.view=new DataView(e.buffer,e.byteOffset,e.length)}size(){return this.end-this.x}peek(){return this.view.getUint8(this.x)}peak(){return this.peek()}skip(e){this.x+=e}buf(e=this.size()){let t=this.x,r=t+e,n=this.uint8.subarray(t,r);return this.x=r,n}subarray(e=0,t){let r=this.x,n="number"==typeof t?r+t:this.end;return this.uint8.subarray(r+e,n)}slice(e=0,t){let r=this.x,n="number"==typeof t?r+t:this.end;return new i(this.uint8,this.view,r+e,n)}cut(e=this.size()){let t=this.slice(0,e);return this.skip(e),t}u8(){return this.uint8[this.x++]}i8(){return this.view.getInt8(this.x++)}u16(){let e=this.x,t=(this.uint8[e++]<<8)+this.uint8[e++];return this.x=e,t}i16(){let e=this.view.getInt16(this.x);return this.x+=2,e}u32(){let e=this.view.getUint32(this.x);return this.x+=4,e}i32(){let e=this.view.getInt32(this.x);return this.x+=4,e}u64(){let e=this.view.getBigUint64(this.x);return this.x+=8,e}i64(){let e=this.view.getBigInt64(this.x);return this.x+=8,e}f32(){let e=this.x;return this.x+=4,this.view.getFloat32(e)}f64(){let e=this.x;return this.x+=8,this.view.getFloat64(e)}utf8(e){let t=this.x;return this.x+=e,(0,n.decodeUtf8)(this.uint8,t,e)}ascii(e){let t=this.uint8,r="",n=this.x+e;for(let e=this.x;e<n;e++)r+=String.fromCharCode(t[e]);return this.x=n,r}}t.Reader=i},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Slice.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Slice=void 0,t.Slice=class{constructor(e,t,r,n){this.uint8=e,this.view=t,this.start=r,this.end=n}subarray(){return this.uint8.subarray(this.start,this.end)}}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Writer.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.Writer=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Slice.js"),i=new DataView(new Uint8Array([]).buffer),o="function"==typeof Buffer,s=o?Buffer.prototype.utf8Write:null,a=o?Buffer.from:null,c="undefined"!=typeof TextEncoder?new TextEncoder:null;t.Writer=class{constructor(e=65536){this.allocSize=e,this.view=i,this.x0=0,this.x=0,this.uint8=new Uint8Array(e),this.size=e,this.view=new DataView(this.uint8.buffer)}grow(e){let t=this.x0,r=this.x,n=this.uint8,i=new Uint8Array(e),o=new DataView(i.buffer),s=n.subarray(t,r);i.set(s,0),this.x=r-t,this.x0=0,this.uint8=i,this.size=e,this.view=o}ensureCapacity(e){let t=this.size,r=t-this.x;if(r<e){let n=t-this.x0+(e-r);this.grow(n<=this.allocSize?this.allocSize:2*n)}}move(e){this.ensureCapacity(e),this.x+=e}reset(){this.x0=this.x}newBuffer(e){let t=this.uint8=new Uint8Array(e);this.size=e,this.view=new DataView(t.buffer),this.x=this.x0=0}flush(){let e=this.uint8.subarray(this.x0,this.x);return this.x0=this.x,e}flushSlice(){let e=new n.Slice(this.uint8,this.view,this.x0,this.x);return this.x0=this.x,e}u8(e){this.ensureCapacity(1),this.uint8[this.x++]=e}u16(e){this.ensureCapacity(2),this.view.setUint16(this.x,e),this.x+=2}u32(e){this.ensureCapacity(4),this.view.setUint32(this.x,e),this.x+=4}i32(e){this.ensureCapacity(4),this.view.setInt32(this.x,e),this.x+=4}u64(e){this.ensureCapacity(8),this.view.setBigUint64(this.x,BigInt(e)),this.x+=8}f64(e){this.ensureCapacity(8),this.view.setFloat64(this.x,e),this.x+=8}u8u16(e,t){this.ensureCapacity(3);let r=this.x;this.uint8[r++]=e,this.uint8[r++]=t>>>8,this.uint8[r++]=255&t,this.x=r}u8u32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setUint32(r,t),this.x=r+4}u8u64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setBigUint64(r,BigInt(t)),this.x=r+8}u8f32(e,t){this.ensureCapacity(5);let r=this.x;this.uint8[r++]=e,this.view.setFloat32(r,t),this.x=r+4}u8f64(e,t){this.ensureCapacity(9);let r=this.x;this.uint8[r++]=e,this.view.setFloat64(r,t),this.x=r+8}buf(e,t){this.ensureCapacity(t);let r=this.x;this.uint8.set(e,r),this.x=r+t}utf8(e){let t=4*e.length;if(t<168)return this.utf8Native(e);if(s){let r=s.call(this.uint8,e,this.x,t);return this.x+=r,r}if(a){let r=this.uint8,n=r.byteOffset+this.x,i=a(r.buffer).subarray(n,n+t).write(e,0,t,"utf8");return this.x+=i,i}if(t>1024&&c){let r=c.encodeInto(e,this.uint8.subarray(this.x,this.x+t)).written;return this.x+=r,r}return this.utf8Native(e)}utf8Native(e){let t=e.length,r=this.uint8,n=this.x,i=0;for(;i<t;){let o=e.charCodeAt(i++);if((0xffffff80&o)==0){r[n++]=o;continue}if((0xfffff800&o)==0)r[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<t){let t=e.charCodeAt(i);(64512&t)==56320&&(i++,o=((1023&o)<<10)+(1023&t)+65536)}(0xffff0000&o)==0?r[n++]=o>>12&15|224:(r[n++]=o>>18&7|240,r[n++]=o>>12&63|128),r[n++]=o>>6&63|128}r[n++]=63&o|128}let o=n-this.x;return this.x=n,o}ascii(e){let t=e.length;this.ensureCapacity(t);let r=this.uint8,n=this.x,i=0;for(;i<t;)r[n++]=e.charCodeAt(i++);this.x=n}}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/f16.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeF16=void 0;let r=Math.pow;t.decodeF16=e=>{let t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:r(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/isFloat32.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFloat32=void 0;let r=new DataView(new ArrayBuffer(4));t.isFloat32=e=>(r.setFloat32(0,e),e===r.getFloat32(0))},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/CachedUtf8Decoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CachedUtf8Decoder=void 0;let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v10.js")),i=1+Math.round(0xfffffffe*Math.random());class o{constructor(e,t){this.bytes=e,this.value=t}}t.CachedUtf8Decoder=class{constructor(){this.caches=[];for(let e=0;e<31;e++)this.caches.push([])}get(e,t,r){let n=this.caches[r-1],i=n.length;e:for(let o=0;o<i;o++){let i=n[o],s=i.bytes;for(let n=0;n<r;n++)if(s[n]!==e[t+n])continue e;return i.value}return null}store(e,t){let r=this.caches[e.length-1],n=new o(e,t);if(r.length>=16)r[i^=i<<13,i^=i>>>17,((i^=i<<5)>>>0)%16+0]=n;else r.push(n)}decode(e,t,r){if(!r)return"";let i=this.get(e,t,r);if(null!==i)return i;let o=(0,n.default)(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,o),o}}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeAscii.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeAsciiMax15=t.decodeAscii=void 0;let r=String.fromCharCode;t.decodeAscii=(e,t,n)=>{let i=[];for(let r=0;r<n;r++){let r=e[t++];if(128&r)return;i.push(r)}return r.apply(String,i)},t.decodeAsciiMax15=(e,t,n)=>{if(n<4)if(n<2)if(0===n)return"";else{let n=e[t++];if((128&n)>1){t-=1;return}return r(n)}else{let i=e[t++],o=e[t++];if((128&i)>0||(128&o)>0){t-=2;return}if(n<3)return r(i,o);let s=e[t++];if((128&s)>0){t-=3;return}return r(i,o,s)}{let i=e[t++],o=e[t++],s=e[t++],a=e[t++];if((128&i)>0||(128&o)>0||(128&s)>0||(128&a)>0){t-=4;return}if(n<6)if(4===n)return r(i,o,s,a);else{let n=e[t++];if((128&n)>0){t-=5;return}return r(i,o,s,a,n)}if(n<8){let c=e[t++],u=e[t++];if((128&c)>0||(128&u)>0){t-=6;return}if(n<7)return r(i,o,s,a,c,u);let l=e[t++];if((128&l)>0){t-=7;return}return r(i,o,s,a,c,u,l)}{let c=e[t++],u=e[t++],l=e[t++],d=e[t++];if((128&c)>0||(128&u)>0||(128&l)>0||(128&d)>0){t-=8;return}if(n<10)if(8===n)return r(i,o,s,a,c,u,l,d);else{let n=e[t++];if((128&n)>0){t-=9;return}return r(i,o,s,a,c,u,l,d,n)}if(n<12){let f=e[t++],h=e[t++];if((128&f)>0||(128&h)>0){t-=10;return}if(n<11)return r(i,o,s,a,c,u,l,d,f,h);let b=e[t++];if((128&b)>0){t-=11;return}return r(i,o,s,a,c,u,l,d,f,h,b)}{let f=e[t++],h=e[t++],b=e[t++],p=e[t++];if((128&f)>0||(128&h)>0||(128&b)>0||(128&p)>0){t-=12;return}if(n<14)if(12===n)return r(i,o,s,a,c,u,l,d,f,h,b,p);else{let n=e[t++];if((128&n)>0){t-=13;return}return r(i,o,s,a,c,u,l,d,f,h,b,p,n)}{let m=e[t++],y=e[t++];if((128&m)>0||(128&y)>0){t-=14;return}if(n<15)return r(i,o,s,a,c,u,l,d,f,h,b,p,m,y);let w=e[t++];if((128&w)>0){t-=15;return}return r(i,o,s,a,c,u,l,d,f,h,b,p,m,y,w)}}}}}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/index.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeUtf8=void 0,t.decodeUtf8=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v16.js")).default},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v10.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s="";for(;i<o;){let t=e[i++];if((128&t)==0){s+=r(t);continue}let n=63&e[i++];if((224&t)==192){s+=r((31&t)<<6|n);continue}let o=63&e[i++];if((240&t)==224){s+=r((31&t)<<12|n<<6|o);continue}if((248&t)==240){let a=(7&t)<<18|n<<12|o<<6|63&e[i++];a>65535?s+=r((a-=65536)>>>10&1023|55296,a=56320|1023&a):s+=r(a)}else s+=r(t)}return s}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v16.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeAscii.js"),o=n.__importDefault(r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v18.js")),s="undefined"!=typeof Buffer,a=s?Buffer.prototype.utf8Slice:null,c=s?Buffer.from:null,u=a?(e,t,r)=>a.call(e,t,t+r):c?(e,t,r)=>c(e).subarray(t,t+r).toString("utf8"):o.default;t.default=(e,t,r)=>{if(r<16)return(0,i.decodeAsciiMax15)(e,t,r)??(0,o.default)(e,t,r);if(r<32)return(0,i.decodeAscii)(e,t,r)??(0,o.default)(e,t,r);return u(e,t,r)}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/decodeUtf8/v18.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0});let r=String.fromCharCode;t.default=(e,t,n)=>{let i=t,o=i+n,s=[];for(;i<o;){let t=e[i++];if((128&t)!=0){let r=63&e[i++];if((224&t)==192)t=(31&t)<<6|r;else{let n=63&e[i++];if((240&t)==224)t=(31&t)<<12|r<<6|n;else if((248&t)==240){let o=(7&t)<<18|r<<12|n<<6|63&e[i++];if(o>65535){let e=(o-=65536)>>>10&1023|55296;t=56320|1023&o,s.push(e)}else t=o}}}s.push(t)}return r.apply(String,s)}},"../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/sharedCachedUtf8Decoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=new(r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/CachedUtf8Decoder.js")).CachedUtf8Decoder},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackExtension=void 0,t.JsonPackExtension=class{constructor(e,t){this.tag=e,this.val=t}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.JsonPackValue=void 0,t.JsonPackValue=class{constructor(e){this.val=e}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoder=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class o extends n.CborDecoderBase{readAsMap(){let e=this.reader.u8();if(e>>5==5)return this.readMap(31&e);throw 0}readMap(e){let t=this.readMinorLen(e);return t>=0?this.readMapRaw(t):this.readMapIndef()}readMapRaw(e){let t=new Map;for(let r=0;r<e;r++){let e=this.readAny(),r=this.readAny();t.set(e,r)}return t}readMapIndef(){let e=new Map;for(;255!==this.reader.peak();){let t=this.readAny();if(255===this.reader.peak())throw 7;let r=this.readAny();e.set(t,r)}return this.reader.x++,e}skipN(e){for(let t=0;t<e;t++)this.skipAny()}skipAny(){this.skipAnyRaw(this.reader.u8())}skipAnyRaw(e){let t=31&e;switch(e>>5){case 0:case 1:this.skipUNint(t);break;case 2:this.skipBin(t);break;case 3:this.skipStr(t);break;case 4:this.skipArr(t);break;case 5:this.skipObj(t);break;case 7:this.skipTkn(t);break;case 6:this.skipTag(t)}}skipMinorLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}skipUNint(e){if(!(e<=23))switch(e){case 24:return this.reader.skip(1);case 25:return this.reader.skip(2);case 26:return this.reader.skip(4);case 27:return this.reader.skip(8);default:throw 1}}skipBin(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipBinChunk();this.reader.x++}}skipBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;this.skipBin(t)}skipStr(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;255!==this.reader.peak();)this.skipStrChunk();this.reader.x++}}skipStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;this.skipStr(t)}skipArr(e){let t=this.skipMinorLen(e);if(t>=0)this.skipN(t);else{for(;255!==this.reader.peak();)this.skipAny();this.reader.x++}}skipObj(e){let t=this.readMinorLen(e);if(t>=0)return this.skipN(2*t);for(;255!==this.reader.peak();){if(this.skipAny(),255===this.reader.peak())throw 7;this.skipAny()}this.reader.x++}skipTag(e){if(0>this.skipMinorLen(e))throw 1;this.skipAny()}skipTkn(e){switch(e){case 24:this.reader.skip(1);return;case 25:this.reader.skip(2);return;case 26:this.reader.skip(4);return;case 27:this.reader.skip(8);return}if(!(e<=23))throw 1}validate(e,t=0,r=e.length){if(this.reader.reset(e),this.reader.x=t,this.skipAny(),this.reader.x-t!==r)throw 8}decodeLevel(e){return this.reader.reset(e),this.readLevel()}readLevel(){let e=this.reader.u8(),t=e>>5,r=31&e;switch(t){case 4:return this.readArrLevel(r);case 5:return this.readObjLevel(r);default:return super.readAnyRaw(e)}}readPrimitiveOrVal(){switch(this.reader.peak()>>5){case 4:case 5:return this.readAsValue();default:return this.readAny()}}readAsValue(){let e=this.reader,t=e.x;this.skipAny();let r=e.x;return new i.JsonPackValue(e.uint8.subarray(t,r))}readObjLevel(e){let t=this.readMinorLen(e);return t>=0?this.readObjRawLevel(t):this.readObjIndefLevel()}readObjRawLevel(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.readPrimitiveOrVal();t[e]=r}return t}readObjIndefLevel(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.readPrimitiveOrVal();e[t]=r}return this.reader.x++,e}readArrLevel(e){let t=this.readMinorLen(e);return t>=0?this.readArrRawLevel(t):this.readArrIndefLevel()}readArrRawLevel(e){let t=[];for(let r=0;r<e;r++)t.push(this.readPrimitiveOrVal());return t}readArrIndefLevel(){let e=[];for(;255!==this.reader.peak();)e.push(this.readPrimitiveOrVal());return this.reader.x++,e}readHdr(e){let t=this.reader.u8();if(t>>5!==e)throw 0;let r=31&t;if(r<24)return r;switch(r){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1}throw 1}readStrHdr(){return this.readHdr(3)}readObjHdr(){return this.readHdr(5)}readArrHdr(){return this.readHdr(4)}findKey(e){let t=this.readObjHdr();for(let r=0;r<t;r++){if(this.key()===e)return this;this.skipAny()}throw 9}findIndex(e){if(e>=this.readArrHdr())throw 10;for(let t=0;t<e;t++)this.skipAny();return this}find(e){for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r?this.findKey(r):this.findIndex(r)}return this}}t.CborDecoder=o},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderBase=void 0;let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs"),i=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/f16.js"),o=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),s=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js"),a=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Reader.js"),c=n.__importDefault(r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/utf8/sharedCachedUtf8Decoder.js"));t.CborDecoderBase=class{constructor(e=new a.Reader,t=c.default){this.reader=e,this.keyDecoder=t}read(e){return this.reader.reset(e),this.readAny()}decode(e){return this.reader.reset(e),this.readAny()}val(){return this.readAny()}readAny(){let e=this.reader.u8(),t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readAnyRaw(e){let t=e>>5,r=31&e;if(t<4)if(t<2)return 0===t?this.readUint(r):this.readNint(r);else return 2===t?this.readBin(r):this.readStr(r);return t<6?4===t?this.readArr(r):this.readObj(r):6===t?this.readTag(r):this.readTkn(r)}readMinorLen(e){if(e<24)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());case 31:return -1;default:throw 1}}readUint(e){if(e<25)return 24===e?this.reader.u8():e;{if(e<27)return 25===e?this.reader.u16():this.reader.u32();let t=this.reader.u64();return t>0x1fffffffffffff?t:Number(t)}}readNint(e){if(e<25)return 24===e?-this.reader.u8()-1:-e-1;{if(e<27)return 25===e?-this.reader.u16()-1:-this.reader.u32()-1;let t=this.reader.u64();return t>0x1ffffffffffffe?-t-BigInt(1):-Number(t)-1}}readBin(e){let t=this.reader;if(e<=23)return t.buf(e);switch(e){case 24:return t.buf(t.u8());case 25:return t.buf(t.u16());case 26:return t.buf(t.u32());case 27:return t.buf(Number(t.u64()));case 31:{let e=0,t=[];for(;255!==this.reader.peak();){let r=this.readBinChunk();e+=r.length,t.push(r)}this.reader.x++;let r=new Uint8Array(e),n=0,i=t.length;for(let e=0;e<i;e++){let i=t[e];r.set(i,n),n+=i.length}return r}default:throw 1}}readBinChunk(){let e=this.reader.u8(),t=31&e;if(2!=e>>5)throw 2;if(t>27)throw 3;return this.readBin(t)}readAsStr(){let e=this.reader.u8();if(3!=e>>5)throw 11;return this.readStr(31&e)}readStr(e){let t=this.reader;if(e<=23)return t.utf8(e);switch(e){case 24:return t.utf8(t.u8());case 25:return t.utf8(t.u16());case 26:return t.utf8(t.u32());case 27:return t.utf8(Number(t.u64()));case 31:{let e="";for(;255!==t.peak();)e+=this.readStrChunk();return this.reader.x++,e}default:throw 1}}readStrLen(e){if(e<=23)return e;switch(e){case 24:return this.reader.u8();case 25:return this.reader.u16();case 26:return this.reader.u32();case 27:return Number(this.reader.u64());default:throw 1}}readStrChunk(){let e=this.reader.u8(),t=31&e;if(3!=e>>5)throw 4;if(t>27)throw 5;return this.readStr(t)}readArr(e){let t=this.readMinorLen(e);return t>=0?this.readArrRaw(t):this.readArrIndef()}readArrRaw(e){let t=[];for(let r=0;r<e;r++)t.push(this.readAny());return t}readArrIndef(){let e=[];for(;255!==this.reader.peak();)e.push(this.readAny());return this.reader.x++,e}readObj(e){if(e<28){let t=e;switch(e){case 24:t=this.reader.u8();break;case 25:t=this.reader.u16();break;case 26:t=this.reader.u32();break;case 27:t=Number(this.reader.u64())}let r={};for(let e=0;e<t;e++){let e=this.key();if("__proto__"===e)throw 6;let t=this.readAny();r[e]=t}return r}if(31===e)return this.readObjIndef();throw 1}readObjRaw(e){let t={};for(let r=0;r<e;r++){let e=this.key(),r=this.readAny();t[e]=r}return t}readObjIndef(){let e={};for(;255!==this.reader.peak();){let t=this.key();if(255===this.reader.peak())throw 7;let r=this.readAny();e[t]=r}return this.reader.x++,e}key(){let e=this.reader.u8();if(3!=e>>5)return String(this.readAnyRaw(e));let t=this.readStrLen(31&e);if(t>31)return this.reader.utf8(t);let r=this.keyDecoder.decode(this.reader.uint8,this.reader.x,t);return this.reader.skip(t),r}readTag(e){if(e<=23)return this.readTagRaw(e);switch(e){case 24:return this.readTagRaw(this.reader.u8());case 25:return this.readTagRaw(this.reader.u16());case 26:return this.readTagRaw(this.reader.u32());case 27:return this.readTagRaw(Number(this.reader.u64()));default:throw 1}}readTagRaw(e){return new o.JsonPackExtension(e,this.readAny())}readTkn(e){switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;case 24:return new s.JsonPackValue(this.reader.u8());case 25:return this.f16();case 26:return this.reader.f32();case 27:return this.reader.f64()}if(e<=23)return new s.JsonPackValue(e);throw 1}f16(){return(0,i.decodeF16)(this.reader.u16())}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborDecoderDag=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js");class o extends i.CborDecoder{readTagRaw(e){let t=this.readAny();return 42===e?new n.JsonPackExtension(e,t):t}}t.CborDecoderDag=o},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoder=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/isFloat32.js"),i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),o=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),s=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class a extends o.CborEncoderFast{writeUnknown(e){this.writeNull()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);switch(e.constructor){case Object:return this.writeObj(e);case Array:return this.writeArr(e);case Uint8Array:return this.writeBin(e);case Map:return this.writeMap(e);case i.JsonPackExtension:return this.writeTag(e.tag,e.val);case s.JsonPackValue:let t=e.val;return this.writer.buf(t,t.length);default:if(e instanceof Uint8Array)return this.writeBin(e);if(Array.isArray(e))return this.writeArr(e);if(e instanceof Map)return this.writeMap(e);return this.writeUnknown(e)}case"undefined":return this.writeUndef();case"bigint":return this.writeBigInt(e);default:return this.writeUnknown(e)}}writeFloat(e){(0,n.isFloat32)(e)?this.writer.u8f32(250,e):this.writer.u8f64(251,e)}writeMap(e){this.writeMapHdr(e.size),e.forEach((e,t)=>{this.writeAny(t),this.writeAny(e)})}writeUndef(){this.writer.u8(247)}}t.CborEncoder=a},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderDag=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js");class i extends n.CborEncoderStable{writeUndef(){this.writeNull()}writeFloat(e){if(e!=e||!Number.isFinite(e))return this.writeNull();this.writer.u8f64(251,e)}writeTag(e,t){42===e&&this.writeTagHdr(e),this.writeAny(t)}}t.CborEncoderDag=i},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderFast=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+buffers@1.2.1+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/buffers/lib/Writer.js"),i=Number.isSafeInteger;t.CborEncoderFast=class{constructor(e=new n.Writer){this.writer=e}encode(e){return this.writeAny(e),this.writer.flush()}encodeToSlice(e){return this.writeAny(e),this.writer.flushSlice()}writeAny(e){switch(typeof e){case"number":return this.writeNumber(e);case"string":return this.writeStr(e);case"boolean":return this.writer.u8(244+ +e);case"object":if(!e)return this.writer.u8(246);if(e.constructor===Array)return this.writeArr(e);return this.writeObj(e)}}writeCbor(){this.writer.u8u16(217,55799)}writeEnd(){this.writer.u8(255)}writeNull(){this.writer.u8(246)}writeBoolean(e){e?this.writer.u8(245):this.writer.u8(244)}writeNumber(e){i(e)?this.writeInteger(e):"bigint"==typeof e?this.writeBigInt(e):this.writeFloat(e)}writeBigInt(e){e>=0?this.writeBigUint(e):this.writeBigSint(e)}writeBigUint(e){if(e<=Number.MAX_SAFE_INTEGER)return this.writeUInteger(Number(e));this.writer.u8u64(27,e)}writeBigSint(e){if(e>=Number.MIN_SAFE_INTEGER)return this.encodeNint(Number(e));let t=-BigInt(1)-e;this.writer.u8u64(59,t)}writeInteger(e){e>=0?this.writeUInteger(e):this.encodeNint(e)}writeUInteger(e){let t=this.writer;t.ensureCapacity(9);let r=t.uint8,n=t.x;e<=23?r[n++]=0+e:e<=255?(r[n++]=24,r[n++]=e):e<=65535?(r[n++]=25,t.view.setUint16(n,e),n+=2):e<=0xffffffff?(r[n++]=26,t.view.setUint32(n,e),n+=4):(r[n++]=27,t.view.setBigUint64(n,BigInt(e)),n+=8),t.x=n}encodeNumber(e){this.writeNumber(e)}encodeInteger(e){this.writeInteger(e)}encodeUint(e){this.writeUInteger(e)}encodeNint(e){let t=-1-e,r=this.writer;r.ensureCapacity(9);let n=r.uint8,i=r.x;t<24?n[i++]=32+t:t<=255?(n[i++]=56,n[i++]=t):t<=65535?(n[i++]=57,r.view.setUint16(i,t),i+=2):t<=0xffffffff?(n[i++]=58,r.view.setUint32(i,t),i+=4):(n[i++]=59,r.view.setBigUint64(i,BigInt(t)),i+=8),r.x=i}writeFloat(e){this.writer.u8f64(251,e)}writeBin(e){let t=e.length;this.writeBinHdr(t),this.writer.buf(e,t)}writeBinHdr(e){let t=this.writer;e<=23?t.u8(64+e):e<=255?t.u16(22528+e):e<=65535?t.u8u16(89,e):e<=0xffffffff?t.u8u32(90,e):t.u8u64(91,e)}writeStr(e){let t=this.writer,r=4*e.length;t.ensureCapacity(5+r);let n=t.uint8,i=t.x;r<=23?t.x++:r<=255?(n[t.x++]=120,i=t.x,t.x++):r<=65535?(n[t.x++]=121,i=t.x,t.x+=2):(n[t.x++]=122,i=t.x,t.x+=4);let o=t.utf8(e);r<=23?n[i]=96+o:r<=255?n[i]=o:r<=65535?t.view.setUint16(i,o):t.view.setUint32(i,o)}writeStrHdr(e){let t=this.writer;e<=23?t.u8(96+e):e<=255?t.u16(30720+e):e<=65535?t.u8u16(121,e):t.u8u32(122,e)}writeAsciiStr(e){this.writeStrHdr(e.length),this.writer.ascii(e)}writeArr(e){let t=e.length;this.writeArrHdr(t);for(let r=0;r<t;r++)this.writeAny(e[r])}writeArrHdr(e){let t=this.writer;e<=23?t.u8(128+e):e<=255?t.u16(38912+e):e<=65535?t.u8u16(153,e):e<=0xffffffff?t.u8u32(154,e):t.u8u64(155,e)}writeObj(e){let t=Object.keys(e),r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeObjHdr(e){let t=this.writer;e<=23?t.u8(160+e):e<=255?t.u16(47104+e):e<=65535?t.u8u16(185,e):e<=0xffffffff?t.u8u32(186,e):t.u8u64(187,e)}writeMapHdr(e){this.writeObjHdr(e)}writeStartMap(){this.writer.u8(191)}writeTag(e,t){this.writeTagHdr(e),this.writeAny(t)}writeTagHdr(e){let t=this.writer;e<=23?t.u8(192+e):e<=255?t.u16(55296+e):e<=65535?t.u8u16(217,e):e<=0xffffffff?t.u8u32(218,e):t.u8u64(219,e)}writeTkn(e){let t=this.writer;e<=23?t.u8(224+e):e<=255&&t.u16(63488+e)}writeStartStr(){this.writer.u8(127)}writeStrChunk(e){throw Error("Not implemented")}writeEndStr(){throw Error("Not implemented")}writeStartBin(){this.writer.u8(95)}writeBinChunk(e){throw Error("Not implemented")}writeEndBin(){throw Error("Not implemented")}writeStartArr(){this.writer.u8(159)}writeArrChunk(e){throw Error("Not implemented")}writeEndArr(){this.writer.u8(255)}writeStartObj(){this.writer.u8(191)}writeObjChunk(e,t){throw Error("Not implemented")}writeEndObj(){this.writer.u8(255)}}},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CborEncoderStable=void 0;let n=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),i=r("../../node_modules/.bun/@jsonjoy.com+util@1.9.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/sort/insertion2.js"),o=r("../../node_modules/.bun/@jsonjoy.com+util@1.9.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/objKeyCmp.js"),s=e=>e<=23?1:e<=255?2:e<=65535?3:5;class a extends n.CborEncoder{writeObj(e){let t=Object.keys(e);(0,i.sort)(t,o.objKeyCmp);let r=t.length;this.writeObjHdr(r);for(let n=0;n<r;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeStr(e){let t=this.writer,r=e.length,n=4*r;t.ensureCapacity(5+n);let i=s(r),o=t.x,a=o+i;t.x=a;let c=t.utf8(e),u=t.uint8,l=s(c);switch(l!==i&&u.copyWithin(a+(l-i),a,a+c),l){case 1:u[o]=96+c;break;case 2:u[o]=120,u[o+1]=c;break;case 3:u[o]=121,t.view.setUint16(o+1,c);break;case 5:u[o]=122,t.view.setUint32(o+1,c)}t.x=o+l+c}writeUndef(){this.writeNull()}}t.CborEncoderStable=a},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js":function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let n=r("../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs");n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js"),t),n.__exportStar(r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js"),t)},"../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},"../../node_modules/.bun/@jsonjoy.com+util@1.9.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/objKeyCmp.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.objKeyCmp=void 0,t.objKeyCmp=(e,t)=>{let r=e.length,n=t.length;return r===n?e>t?1:-1:r-n}},"../../node_modules/.bun/@jsonjoy.com+util@1.9.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/util/lib/sort/insertion2.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sort=void 0,t.sort=(e,t)=>{let r=e.length;for(let n=1;n<r;n++){let r=e[n],i=n;for(;0!==i&&t(e[i-1],r)>0;)e[i]=e[i-1],i--;e[i]=r}return e}},"../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs":function(e,t,r){r.r(t),r.d(t,{__addDisposableResource:()=>D,__assign:()=>o,__asyncDelegator:()=>S,__asyncGenerator:()=>_,__asyncValues:()=>A,__await:()=>k,__awaiter:()=>b,__classPrivateFieldGet:()=>U,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>L,__createBinding:()=>m,__decorate:()=>a,__disposeResources:()=>T,__esDecorate:()=>u,__exportStar:()=>y,__extends:()=>i,__generator:()=>p,__importDefault:()=>P,__importStar:()=>O,__makeTemplateObject:()=>E,__metadata:()=>h,__param:()=>c,__propKey:()=>d,__read:()=>g,__rest:()=>s,__rewriteRelativeImportExtension:()=>B,__runInitializers:()=>l,__setFunctionName:()=>f,__spread:()=>j,__spreadArray:()=>v,__spreadArrays:()=>x,__values:()=>w,default:()=>z});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function c(e,t){return function(r,n){t(r,n,e)}}function u(e,t,r,n,i,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f=!1,h=r.length-1;h>=0;h--){var b={};for(var p in n)b[p]="access"===p?{}:n[p];for(var p in n.access)b.access[p]=n.access[p];b.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var m=(0,r[h])("accessor"===c?{get:d.get,set:d.set}:d[u],b);if("accessor"===c){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(a=s(m.get))&&(d.get=a),(a=s(m.set))&&(d.set=a),(a=s(m.init))&&i.unshift(a)}else(a=s(m))&&("field"===c?i.unshift(a):d[u]=a)}l&&Object.defineProperty(l,n.name,d),f=!0}function l(e,t,r){for(var n=arguments.length>2,i=0;i<t.length;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function b(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})}function p(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){var u=[a,c];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var m=Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function y(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||m(t,e,r)}function w(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function j(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function x(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n}function v(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){o.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=i[e](t)).value instanceof k?Promise.resolve(r.value.v).then(c,u):l(o[0][2],r)}catch(e){l(o[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:k(e[n](t)),done:!1}:i?i(t):t}:i}}function A(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=w(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){var o,s,a;o=n,s=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){o({value:e,done:a})},s)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},C=function(e){return(C=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=C(e),n=0;n<r.length;n++)"default"!==r[n]&&m(t,e,r[n]);return I(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function U(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function L(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function R(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){var n,i;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(i=n)}if("function"!=typeof n)throw TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var M="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function T(e){function t(t){e.error=e.hasError?new M(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,n=0;return function i(){for(;r=e.stack.pop();)try{if(!r.async&&1===n)return n=0,e.stack.push(r),Promise.resolve().then(i);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(o).then(i,function(e){return t(e),i()})}else n|=1}catch(e){t(e)}if(1===n)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function B(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,o){return r?t?".jsx":".js":!n||i&&o?n+i+"."+o.toLowerCase()+"js":e}):e}let z={__extends:i,__assign:o,__rest:s,__decorate:a,__param:c,__esDecorate:u,__runInitializers:l,__propKey:d,__setFunctionName:f,__metadata:h,__awaiter:b,__generator:p,__createBinding:m,__exportStar:y,__values:w,__read:g,__spread:j,__spreadArrays:x,__spreadArray:v,__await:k,__asyncGenerator:_,__asyncDelegator:S,__asyncValues:A,__makeTemplateObject:E,__importStar:O,__importDefault:P,__classPrivateFieldGet:U,__classPrivateFieldSet:L,__classPrivateFieldIn:R,__addDisposableResource:D,__disposeResources:T,__rewriteRelativeImportExtension:B}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{let e;r.r(n),r.d(n,{decompressJsonFromB64:()=>ek,PressInteractionEncoder:()=>tL,getProductInformation:()=>tr,findIframeInOpener:()=>ed,createIFrameFrakClient:()=>ef,generateSsoUrl:()=>eL,getCurrencyAmountKey:()=>eR,locales:()=>eb,sendInteraction:()=>tf,FrakContextManager:()=>eO,getSupportedLocale:()=>eP,compressJsonToB64:()=>ev,baseIframeProps:()=>ec,DebugInfoGatherer:()=>ea,base64urlEncode:()=>ej,openSso:()=>to,processReferral:()=>th,ReferralInteractionEncoder:()=>tD,modalBuilder:()=>tj,productTypes:()=>ew,referralInteraction:()=>tw,prepareSso:()=>ts,siweAuthenticate:()=>tv,ssoPopupName:()=>eo,trackPurchaseStatus:()=>tg,productTypesMask:()=>eg,interactionTypes:()=>ey,getSupportedCurrency:()=>ep,PurchaseInteractionEncoder:()=>tR,sendTransaction:()=>tx,formatAmount:()=>eU,trackEvent:()=>eD,base64urlDecode:()=>ex,displayEmbeddedWallet:()=>te,displayModal:()=>tt,watchWalletStatus:()=>tm,ssoPopupFeatures:()=>ei,RetailInteractionEncoder:()=>tM,setupClient:()=>em,createIframe:()=>eu,WebShopInteractionEncoder:()=>tT,createIFrameNexusClient:()=>tB});var t,i=r("../../node_modules/.bun/@jsonjoy.com+json-pack@1.21.0+2bdbff6ebab26a9c/node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js");function o(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function s(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function c(e,t){s(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function l(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function d(e,t){return e<<32-t|e>>>t}let f=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}return e};function h(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),s(e),e}class b{}function p(e){let t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class m extends b{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=l(this.buffer)}update(e){a(this),s(e=h(e));let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let t=l(e);for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){a(this),c(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,u(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(0xffffffff),s=Number(r>>i&o),a=Number(r&o),c=4*!!n,u=4*!n;e.setUint32(t+c,s,n),e.setUint32(t+u,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);let s=l(e),d=this.outputLen;if(d%4)throw Error("_sha2: outputLen should be aligned to 32bit");let f=d/4,h=this.get();if(f>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<f;e++)s.setUint32(4*e,h[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let y=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),w=BigInt(0x100000000-1),g=BigInt(32);function j(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:r,l:s}=function(e,t=!1){return t?{h:Number(e&w),l:Number(e>>g&w)}:{h:0|Number(e>>g&w),l:0|Number(e&w)}}(e[o],t);[n[o],i[o]]=[r,s]}return[n,i]}let x=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),v=new Uint32Array(64);class k extends m{constructor(e=32){super(64,e,8,!1),this.A=0|y["0"],this.B=0|y["1"],this.C=0|y["2"],this.D=0|y["3"],this.E=0|y["4"],this.F=0|y["5"],this.G=0|y["6"],this.H=0|y["7"]}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)v[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=v[e-15],r=v[e-2],n=d(t,7)^d(t,18)^t>>>3,i=d(r,17)^d(r,19)^r>>>10;v[e]=i+v[e-7]+n+v[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){var l,f,h,b;let t=u+(d(s,6)^d(s,11)^d(s,25))+((l=s)&a^~l&c)+x[e]+v[e]|0,p=(d(r,2)^d(r,13)^d(r,22))+((f=r)&(h=n)^f&(b=i)^h&b)|0;u=c,c=a,a=s,s=o+t|0,o=i,i=n,n=r,r=t+p|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,s,a,c,u)}roundClean(){u(v)}destroy(){this.set(0,0,0,0,0,0,0,0),u(this.buffer)}}j(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e)));let _=p(()=>new k);function S(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}let A=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,E="viem@2.38.5";class I extends Error{constructor(e,t={}){const r=t.cause instanceof I?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof I&&t.cause.docsPath||t.docsPath,i=A?.({...t,docsPath:n});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...E?[`Version: ${E}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version="2.38.5"}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class C extends I{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class O extends I{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function P(e,{dir:t,size:r=32}={}){return"string"==typeof e?U(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new O({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i<r;i++){let o="right"===t;n[o?i:r-i-1]=e[o?i:e.length-i-1]}return n}(e,{dir:t,size:r})}function U(e,{dir:t,size:r=32}={}){if(null===r)return e;let n=e.replace("0x","");if(n.length>2*r)throw new O({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}class L extends I{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class R extends I{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function D(e){return S(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function M(e,{size:t}){if(D(e)>t)throw new R({givenSize:D(e),maxSize:t})}let T=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function B(e,t={}){return"number"==typeof e||"bigint"==typeof e?N(e,t):"string"==typeof e?V(e,t):"boolean"==typeof e?z(e,t):F(e,t)}function z(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(M(r,{size:t.size}),P(r,{size:t.size})):r}function F(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=T[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(M(n,{size:t.size}),P(n,{dir:"right",size:t.size})):n}function N(e,t={}){let r,{signed:n,size:i}=t,o=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let s="bigint"==typeof r&&n?-r-1n:0;if(r&&o>r||o<s){let t="bigint"==typeof e?"n":"";throw new L({max:r?`${r}${t}`:void 0,min:`${s}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=`0x${(n&&o<0?(1n<<BigInt(8*i))+BigInt(o):o).toString(16)}`;return i?P(a,{size:i}):a}let $=new TextEncoder;function V(e,t={}){return F($.encode(e),t)}let H=new TextEncoder;function q(e,t={}){return"number"==typeof e||"bigint"==typeof e?G(N(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(M(r,{size:t.size}),P(r,{size:t.size})):r}(e,t):S(e)?G(e,t):J(e,t)}function W(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function G(e,t={}){let r=e;t.size&&(M(r,{size:t.size}),r=P(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let r=W(n.charCodeAt(t++)),i=W(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new I(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);o[e]=16*r+i}return o}function J(e,t={}){let r=H.encode(e);return"number"==typeof t.size?(M(r,{size:t.size}),P(r,{dir:"right",size:t.size})):r}var K=class extends Error{constructor(e,t,r){super(t),this.code=e,this.data=r}toJSON(){return{code:this.code,message:this.message,data:this.data}}};let X=new i.CborEncoder,Q=new i.CborDecoder;function Y(e){try{return Q.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}function Z(e){var t;return B(_(S(t=X.encode(e),{strict:!1})?q(t):t))}var ee=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}},et=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":"application/json",...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,r]of Object.entries(this.headers)){let n=await r;null!==n&&(e[t]=n)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,r,n){try{let n=await fetch(e,{method:"POST",headers:await this.resolveHeaders(),body:JSON.stringify(t??{}),keepalive:!0,...r});if(401===n.status)return null;if(200!==n.status&&202!==n.status)throw Error(`HTTP error! status: ${n.status}`);let i=await n.text();return i?JSON.parse(i):null}catch(i){if(n<this.maxRetries){let i=this.initialRetryDelay*Math.pow(2,n);return await new Promise(e=>setTimeout(e,i)),this.post(e,t,r,n+1)}return console.error("Max retries reached:",i),null}}async fetch(e,t,r={}){let n=`${this.baseUrl}${e}`;return this.post(n,t,r,0)}},er=class{constructor(e){this.options=e,this.queue=[];let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t["openpanel-client-secret"]=e.clientSecret),t["openpanel-sdk-name"]=e.sdk||"node",t["openpanel-sdk-version"]=e.sdkVersion||"1.0.0",this.api=new et({baseUrl:e.apiUrl||"https://api.openpanel.dev",defaultHeaders:t})}init(){}ready(){this.options.waitForProfile=!1,this.flush()}async send(e){return this.options.disabled||this.options.filter&&!this.options.filter(e)?Promise.resolve():this.options.waitForProfile&&!this.profileId?(this.queue.push(e),Promise.resolve()):this.api.fetch("/track",e)}setGlobalProperties(e){this.global={...this.global,...e}}async track(e,t){return this.send({type:"track",payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async identify(e){if(e.profileId&&(this.profileId=e.profileId,this.flush()),Object.keys(e).length>1)return this.send({type:"identify",payload:{...e,properties:{...this.global,...e.properties}}})}async alias(e){return this.send({type:"alias",payload:e})}async increment(e){return this.send({type:"increment",payload:e})}async decrement(e){return this.send({type:"decrement",payload:e})}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}},en=class extends er{constructor(e){super({sdk:"web",sdkVersion:"1.0.1",...e}),this.options=e,this.lastPath="",this.isServer()||(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&this.trackScreenViews(),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes())}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>"u"}trackOutgoingLinks(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("a");if(r&&t){let e=r.getAttribute("href");e?.startsWith("http")&&super.track("link_out",{href:e,text:r.innerText||r.getAttribute("title")||t.getAttribute("alt")||t.getAttribute("title")})}})}trackScreenViews(){if(this.isServer())return;this.screenView();let e=history.pushState;history.pushState=function(...t){let r=e.apply(this,t);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),r};let t=history.replaceState;history.replaceState=function(...e){let r=t.apply(this,e);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),r},window.addEventListener("popstate",()=>{window.dispatchEvent(new Event("locationchange"))});let r=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener("hashchange",r):window.addEventListener("locationchange",r)}trackAttributes(){this.isServer()||document.addEventListener("click",e=>{let t=e.target,r=t.closest("button"),n=t.closest("a"),i=r?.getAttribute("data-track")?r:n?.getAttribute("data-track")?n:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith("data-")&&"data-track"!==t.name&&(e[t.name.replace(/^data-/,"").replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_",""))]=t.value);let t=i.getAttribute("data-track");t&&super.track(t,e)}})}screenView(e,t){let r,n;this.isServer()||("string"==typeof e?(r=e,n=t):(r=window.location.href,n=e),this.lastPath!==r&&(this.lastPath=r,super.track("screen_view",{...n??{},__path:r,__title:document.title})))}};let ei="menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800",eo="frak-sso",es="nexus-wallet-backup";class ea{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e,t){this.lastResponse={message:e,response:t,timestamp:Date.now()}}setLastRequest(e){this.lastRequest={event:e,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),r=this.getNavigatorInfo(),n="Unknown";return e instanceof K?n=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?n=e.message:"string"==typeof e&&(n=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:t?this.base64Encode(t):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:n}}static empty(){return new ea}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
3
3
|
Debug Information:
|
|
4
4
|
-----------------
|
|
5
5
|
Timestamp: ${t.timestamp}
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
Last Response: ${t.lastResponse}
|
|
12
12
|
Client Status: ${t.clientStatus}
|
|
13
13
|
Error: ${t.error}
|
|
14
|
-
`.trim()}}let ey={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function eg({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ey.id,n.name=ey.name,n.allow=ey.allow,n.style.zIndex=ey.style.zIndex.toString(),ej({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(r=>{n?.addEventListener("load",()=>r(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function ej({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function ex(e="/listener"){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let r=0;r<e.length;r++)if(t(e[r]))return e[r];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function ev({config:e,iframe:t}){let r,n=e?.walletUrl??"https://wallet.frak.id",i=function({iframe:e}){let t=new l;return{handleEvent:async r=>{if(!("iframeLifecycle"in r))return;let{iframeLifecycle:n,data:i}=r;switch(n){case"connected":t.resolve(!0);break;case"do-backup":i.backup?localStorage.setItem(em,i.backup):localStorage.removeItem(em);break;case"remove-backup":localStorage.removeItem(em);break;case"show":case"hide":ej({iframe:e,isVisible:"show"===n});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:i.token,currentUrl:window.location.href}},"*");break;case"redirect":{let e=new URL(i.baseRedirectUrl);e.searchParams.has("u")?(e.searchParams.delete("u"),e.searchParams.append("u",window.location.href),window.location.href=e.toString()):window.location.href=i.baseRedirectUrl}}},isConnected:t.promise}}({iframe:t}),o=new ew(e,t);if(!t.contentWindow)throw new c(a.configError,"The iframe does not have a content window");let s=function(e){let{emittingTransport:t,listeningTransport:r,targetOrigin:n,middleware:i=[],lifecycleHandlers:o}=e,s=new Map;async function a(e){try{"clientLifecycle"in e&&o?.clientLifecycle?await o.clientLifecycle(e,{origin:n,source:null}):"iframeLifecycle"in e&&o?.iframeLifecycle&&await o.iframeLifecycle(e,{origin:n,source:null})}catch(e){console.error("[RPC Client] Lifecycle handler error:",e)}}async function u(e){let t={origin:n,source:null};for(let r of i)r.onRequest&&await r.onRequest(e,t);return e}async function d(e,t){let r={origin:n,source:null},o=t;for(let t of i)t.onResponse&&(o=await t.onResponse(e,o,r));return o}async function f(e){var t,r;let i;try{let t=new URL(e.origin).origin.toLowerCase(),r=new URL(n).origin.toLowerCase();if(t!==r)return void console.log("Not expected origin",t,r)}catch(e){console.error("[RPC Client] Invalid origin",e);return}if("object"==typeof(t=e.data)&&t&&("clientLifecycle"in t||"iframeLifecycle"in t))return void await a(e.data);if(!("object"==typeof(r=e.data)&&r&&"id"in r&&"topic"in r&&"data"in r))return;try{let t=e.data.data,r=t instanceof Uint8Array||ArrayBuffer.isView(t);i=await d(e.data,r?{result:t}:t)}catch(e){console.error("[RPC Client] Middleware error on response:",e);return}let o=s.get(e.data.id);o&&o(i)}async function h(e){let r=e;try{r=await u(e)}catch(e){throw console.error("[RPC Client] Middleware error on request:",e),e}t.postMessage(r,n)}function p(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}return r.addEventListener("message",f),{request:function(e){let t=p(),r=new l;return s.set(t,e=>{e.error?r.reject(new c(e.error.code,e.error.message,e.error.data)):r.resolve(e.result),s.delete(t)}),h({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{s.delete(t),r.reject(e)}),r.promise},listen:function(e,t){let r=p();return s.set(r,e=>{e.error?(console.error("[RPC Client] Listener error:",e.error),s.delete(r)):t(e.result)}),h({id:r,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error("[RPC Client] Failed to send listener request:",e),s.delete(r)}),()=>{s.delete(r)}},sendLifecycle:function(e){t.postMessage(e,n)},cleanup:function(){r.removeEventListener("message",f),s.clear()}}}({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await i.isConnected)throw new c(a.clientNotConnected,"The iframe provider isn't connected yet");return t}},ef(),{onRequest:(e,t)=>(o.setLastRequest(e),t),onResponse:(e,t)=>(o.setLastResponse(e,t),t)}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await i.handleEvent(e)}}}),u=function(e,t){let r,n,i=()=>e.sendLifecycle({clientLifecycle:"heartbeat"});function o(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,1e3),n=setTimeout(()=>{o(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,o()}(),o}(s,i),d=async()=>{u(),s.cleanup(),t.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(r=new eb({apiUrl:"https://op-api.gcp.frak.id",clientId:"6eacc8d7-49ac-4936-95e9-81ef29449570",trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>!("track"===e&&t?.properties)||("sdkVersion"in t.properties||(t.properties={...t.properties,sdkVersion:"0.1.0"}),!0)})).setGlobalProperties({sdkVersion:"0.1.0"}),r.init();let f=ek({config:e,rpcClient:s,lifecycleManager:i}).then(()=>o.updateSetupStatus(!0));return{config:e,debugInfo:o,waitForConnection:i.isConnected,waitForSetup:f,request:s.request,listenerRequest:s.listen,destroy:d,openPanel:r}}async function ek({config:e,rpcClient:t,lifecycleManager:r}){async function n(){let r=e.customizations?.css;r&&t.sendLifecycle({clientLifecycle:"modal-css",data:{cssLink:r}})}async function i(){let r=e.customizations?.i18n;r&&t.sendLifecycle({clientLifecycle:"modal-i18n",data:{i18n:r}})}async function o(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(em);e&&t.sendLifecycle({clientLifecycle:"restore-backup",data:{backup:e}})}await r.isConnected,function(e,t){if("undefined"==typeof window)return;let r=new URL(window.location.href),n=r.searchParams.get("sso");n&&(t.then(()=>{e.sendLifecycle({clientLifecycle:"sso-redirect-complete",data:{compressed:n}}),console.log("[SSO URL Listener] Forwarded compressed SSO data to iframe")}).catch(e=>{console.error("[SSO URL Listener] Failed to forward SSO data:",e)}),r.searchParams.delete("sso"),window.history.replaceState({},"",r.toString()),console.log("[SSO URL Listener] SSO parameter detected and URL cleaned"))}(t,r.isConnected),await Promise.allSettled([n(),i(),o()])}let e_={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function eS(e){return e&&e in e_?e:"eur"}async function eA({config:e}){let t,r=(t=eS(e.metadata?.currency),{...e,metadata:{...e.metadata,currency:t}}),n=await eg({config:r});if(!n)return void console.error("Failed to create iframe");let i=ev({config:r,iframe:n});return(await i.waitForSetup,await i.waitForConnection)?i:void console.error("Failed to connect to client")}function eE(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function eI(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function eC(e){return eE(u.encode(e))}function eO(e){var t=eI(e);try{return d.decode(t)}catch(e){return console.error("Invalid compressed data",{e:e,data:t}),null}}let eP="fCtx";function eU(e){if(e?.r)try{let t=eo(e.r);return eE(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function eL(e){if(e&&0!==e.length)try{let t=eI(e);return{r:Q(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function eR({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(eP);return t?eL(t):null}function eD({url:e,context:t}){if(!e)return null;let r=eR({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=eU(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(eP,i),o.toString()}function eM(e){let t=new URL(e);return t.searchParams.delete(eP),t.toString()}let eT={compress:eU,decompress:eL,parse:eR,update:eD,remove:eM,replaceUrl:function({url:e,context:t}){let r;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let n=e??window.location.href;(r=null!==t?eD({url:n,context:t}):eM(n))&&window.history.replaceState(null,"",r.toString())}};function eB(e){return e?e_[e]??e_.eur:e_.eur}function eF(e){return e?`${e}Amount`:"eurAmount"}function eN(e,t){let r=eB(t),n=eS(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}function e$(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}function ez(e,t,r,n,i){var o;let s=eC({r:(o={redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:r,metadata:{name:n,css:i,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}}).redirectUrl,d:o.directExit,l:o.lang,p:o.productId,m:{n:o.metadata?.name,css:o.metadata?.css,l:o.metadata?.logoUrl,h:o.metadata?.homepageLink}}),a=new URL(e);return a.pathname="/sso",a.searchParams.set("p",s),a.toString()}let eV={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},eH=Object.entries(eV).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),eq={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}},eW="menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800",eJ="frak-sso";async function eG(e,t,r="text/javascript"){return document.getElementById(e)?Promise.resolve(!0):new Promise((n,i)=>{let o=document.createElement("script");o.id=e,o.src=t,o.defer=!0,o.type=r,o.onload=()=>n(!0),o.onerror=()=>i(Error(`Script load error for ${t}`)),document.head.appendChild(o)})}let eK={"gapianne.com":function(){window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Gapianne",lang:"fr",currency:"eur",logoUrl:"https://gapianne.com/cdn/shop/files/logo-gapianne_7a65f4c4-54e8-4831-afa2-0849e4c5f8de.png",homepageLink:"https://gapianne.com/"},customizations:{i18n:{"sharing.title":"Pr\xeat(e) \xe0 r\xe9v\xe9ler un secret bien-\xeatre ?","sharing.text":"D\xe9couvre ce produit chez Gapianne","sdk.wallet.login.text":"Cr\xe9ez votre porte-monnaie avec **{{ productName }}** et recevez **{{ estimatedReward }}** par ami(e) parrain\xe9(e)"}},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0},metadata:{isDismissible:!0}},window.FrakSetup.modalShareConfig={link:window.location.href},window.FrakSetup.modalWalletConfig={metadata:{position:"left"}},function(){for(let e of Array.from(document.querySelectorAll("#nexus-share-button > button"))){let t=document.createElement("frak-button-share");t.setAttribute("text","PARTAGE ET GAGNE {REWARD} !"),t.setAttribute("no-reward-text","PARTAGE ET GAGNE"),t.setAttribute("use-reward","true"),t.setAttribute("show-wallet","true"),t.setAttribute("classname","button w-full"),e.replaceWith(t)}}()}},eX=BigInt(0),eQ=BigInt(1),eY=BigInt(2),eZ=BigInt(7),e0=BigInt(256),e2=BigInt(113),e1=[],e6=[],e8=[];for(let e=0,t=eQ,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],e1.push(2*(5*n+r)),e6.push((e+1)*(e+2)/2%64);let i=eX;for(let e=0;e<7;e++)(t=(t<<eQ^(t>>eZ)*e2)%e0)&eY&&(i^=eQ<<(eQ<<BigInt(e))-eQ);e8.push(i)}let e5=E(e8,!0),e3=e5[0],e4=e5[1],e9=(e,t,r)=>r>32?O(e,t,r):I(e,t,r),e7=(e,t,r)=>r>32?P(e,t,r):C(e,t,r);class te extends x{constructor(e,t,r,n=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,f(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}clone(){return this._cloneInto()}keccak(){g(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=e9(o,s,1)^r[n],c=e7(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=e6[r],o=e9(t,i,n),s=e7(t,i,n),a=e1[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=e3[n],e[1]^=e4[n]}m(r)}(this.state32,this.rounds),g(this.state32),this.posOut=0,this.pos=0}update(e){p(this),h(e=j(e));let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){p(this,!1),h(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return f(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(b(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,m(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new te(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}let tt=(t=1,i=136,o=32,v(()=>new te(i,t,o)));function tr(e,t){let r=tt(M(e,{strict:!1})?er(e):e);return"bytes"===(t||"hex")?r:K(r)}function tn(e){return"string"==typeof e[0]?ti(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}(e)}function ti(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}class to extends F{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class ts extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let ta=new ts(8192),tc=/^0x[a-fA-F0-9]{40}$/,tl=new ts(8192);function tu(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(tl.has(n))return tl.get(n);let i=!!tc.test(e)&&(e.toLowerCase()===e||!r||function(e,t){if(ta.has(`${e}.${void 0}`))return ta.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=tr(es(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let o=`0x${i.join("")}`;return ta.set(`${e}.${t}`,o),o}(e)===e);return tl.set(n,i),i}let td=256;function tf(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(t=>(th(e,t),t));let r=new l,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},i=>{th(e,i),t(i),n||(r.resolve(i),n=!0)}),r.promise}function th(e,t){"undefined"!=typeof window&&(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?window.sessionStorage.setItem("frak-wallet-interaction-token",t.interactionToken):window.sessionStorage.removeItem("frak-wallet-interaction-token"))}function tp({domain:e}={}){return tr(K((e??window.location.host).replace("www.","")))}async function tb(e,{productId:t,interaction:r,validation:n}){let i=t??tp(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,n]})}async function tm(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function tw(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}function ty(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function tg(e,t){var r,n,i,o,s,a;let c,l,{metadata:d,customizations:f,walletUrl:h}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:"frak_openSso",params:[t,d.name,f?.css]});let p=t.ssoPopupUrl??(r=h??"https://wallet.frak.id",n=tp(),i=d.name,o=f?.css,c=ty((a={r:(s={redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:n,metadata:{name:i,css:o,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}}).redirectUrl,d:s.directExit,l:s.lang,p:s.productId,m:{n:s.metadata?.name,css:s.metadata?.css,l:s.metadata?.logoUrl,h:s.metadata?.homepageLink}},u.encode(a))),(l=new URL(r)).pathname="/sso",l.searchParams.set("p",c),l.toString()),b=window.open(p,"frak-sso","menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800");if(!b)throw Error("Popup was blocked. Please allow popups for this site.");return b.focus(),await e.request({method:"frak_openSso",params:[t,d.name,f?.css]})??{}}async function tj(e,t){let{metadata:r,customizations:n}=e.config;return await e.request({method:"frak_prepareSso",params:[t,r.name,n?.css]})}async function tx(e){return await e.request({method:"frak_getProductInformation"})}async function tv(e){if("undefined"==typeof window)return void console.warn("[Frak] No window found, can't track purchase");let t=window.sessionStorage.getItem("frak-wallet-interaction-token");if(!t)return void console.warn("[Frak] No frak session found, skipping purchase check");await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)})}async function tk(t,{siwe:r,metadata:n}){let i=t.config?.domain??window.location.host,o=r?.statement??`I confirm that I want to use my Frak wallet on: ${t.config.metadata.name}`,s={...r,statement:o,nonce:r?.nonce??function(t=11){if(!e||td+t>512){e="",td=0;for(let t=0;t<256;t++)e+=(256+256*Math.random()|0).toString(16).substring(1)}return e.substring(td,td+++t)}(96),uri:r?.uri??`https://${i}`,version:r?.version??"1",domain:i};return(await tm(t,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:s}}})).siweAuthenticate}async function t_(e,{tx:t,metadata:r}){return(await tm(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function tS(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await tm(t,r)}return{params:r,sendTx:function(n){return e(t,{...r,steps:{...r.steps,sendTransaction:n}})},reward:function(n){return e(t,{...r,steps:{...r.steps,final:{...n,action:{key:"reward"}}}})},sharing:function(n,i){return e(t,{...r,steps:{...r.steps,final:{...i,action:{key:"sharing",options:n}}}})},display:n}}(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}let tA="fCtx";function tE({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(tA);return t?function(e){if(e&&0!==e.length)try{let t,r=(t=e.length%4,Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0)));return{r:Q(r,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}(t):null}let tI={parse:tE,replaceUrl:function({url:e,context:t}){let r,n;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let i=e??window.location.href;(r=null!==t?function({url:e,context:t}){if(!e)return null;let r=tE({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=function(e){if(e?.r)try{let t=eo(e.r);return ty(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(tA,i),o.toString()}({url:i,context:t}):((n=new URL(i)).searchParams.delete(tA),n.toString()))&&window.history.replaceState(null,"",r.toString())}},tC={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(tC).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});let tO={createLink:()=>({handlerTypeDenominator:K(tC.referral),interactionData:"0xb2c0f17c"}),referred({referrer:e}){let t=ti(["0x010cc3b9",z(e,{size:32})]);return{handlerTypeDenominator:K(tC.referral),interactionData:t}}};async function tP(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i,options:o}){let s=!1;async function l(){if(!s)return s=!0,tL(e,{modalConfig:{...n,loggedIn:{action:{key:"referred"}}},walletStatus:t})}async function u(t){let r=tO.referred({referrer:t});await Promise.allSettled([tb(e,{productId:i,interaction:r}),function(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}(e,"user_referred",{properties:{referrer:t}})])}try{let{status:e,currentWallet:n}=await tU({initialWalletStatus:t,getFreshWalletStatus:l,pushReferralInteraction:u,frakContext:r});return tI.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:n}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),tI.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof c)switch(e.code){case a.walletNotConnected:return"no-wallet";case a.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function tU({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&function(e,t){if(!tu(e,{strict:!1}))throw new to({address:e});if(!tu(t,{strict:!1}))throw new to({address:t});return e.toLowerCase()===t.toLowerCase()}(n.r,i))?{status:"self-referral",currentWallet:i}:(e?.interactionSession||(i=await t()),await r(n.r),{status:"success",currentWallet:i}):{status:"no-referrer",currentWallet:i}}async function tL(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await tw(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}async function tR(e,{productId:t,modalConfig:r,options:n}={}){let i=tI.parse({url:window.location.href}),o=await tf(e);try{return await tP(e,{walletStatus:o,frakContext:i,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}class tD extends F{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}.
|
|
14
|
+
`.trim()}}let ec={id:"frak-wallet",name:"frak-wallet",title:"Frak Wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px",colorScheme:"auto"}};function eu({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=ec.id,n.name=ec.name,n.allow=ec.allow,n.style.zIndex=ec.style.zIndex.toString(),el({iframe:n,isVisible:!1}),document.body.appendChild(n),new Promise(r=>{n?.addEventListener("load",()=>r(n)),n.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function el({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}function ed(e="/listener"){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let r=0;r<e.length;r++)if(t(e[r]))return e[r];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function ef({config:e,iframe:t}){let r,n=e?.walletUrl??"https://wallet.frak.id",i=function({iframe:e}){let t=new ee;return{handleEvent:async r=>{if(!("iframeLifecycle"in r))return;let{iframeLifecycle:n,data:i}=r;switch(n){case"connected":t.resolve(!0);break;case"do-backup":i.backup?localStorage.setItem(es,i.backup):localStorage.removeItem(es);break;case"remove-backup":localStorage.removeItem(es);break;case"show":case"hide":el({iframe:e,isVisible:"show"===n});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:i.token,currentUrl:window.location.href}},"*");break;case"redirect":{let e=new URL(i.baseRedirectUrl);e.searchParams.has("u")?(e.searchParams.delete("u"),e.searchParams.append("u",window.location.href),window.location.href=e.toString()):window.location.href=i.baseRedirectUrl}}},isConnected:t.promise}}({iframe:t}),o=new ea(e,t);if(!t.contentWindow)throw new K(-32002,"The iframe does not have a content window");let s=function(e){let{emittingTransport:t,listeningTransport:r,targetOrigin:n,middleware:i=[],lifecycleHandlers:o}=e,s=new Map;async function a(e){try{"clientLifecycle"in e&&o?.clientLifecycle?await o.clientLifecycle(e,{origin:n,source:null}):"iframeLifecycle"in e&&o?.iframeLifecycle&&await o.iframeLifecycle(e,{origin:n,source:null})}catch(e){console.error("[RPC Client] Lifecycle handler error:",e)}}async function c(e){let t={origin:n,source:null};for(let r of i)r.onRequest&&await r.onRequest(e,t);return e}async function u(e,t){let r={origin:n,source:null},o=t;for(let t of i)t.onResponse&&(o=await t.onResponse(e,o,r));return o}async function l(e){var t,r;let i;try{let t=new URL(e.origin).origin.toLowerCase(),r=new URL(n).origin.toLowerCase();if(t!==r)return void console.log("Not expected origin",t,r)}catch(e){console.error("[RPC Client] Invalid origin",e);return}if("object"==typeof(t=e.data)&&t&&("clientLifecycle"in t||"iframeLifecycle"in t))return void await a(e.data);if(!("object"==typeof(r=e.data)&&r&&"id"in r&&"topic"in r&&"data"in r))return;try{let t=e.data.data,r=t instanceof Uint8Array||ArrayBuffer.isView(t)?{result:t}:t;i=await u(e.data,r)}catch(e){console.error("[RPC Client] Middleware error on response:",e);return}let o=s.get(e.data.id);o&&o(i)}async function d(e){let r=e;try{r=await c(e)}catch(e){throw console.error("[RPC Client] Middleware error on request:",e),e}t.postMessage(r,n)}function f(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}return r.addEventListener("message",l),{request:function(e){let t=f(),r=new ee;return s.set(t,e=>{e.error?r.reject(new K(e.error.code,e.error.message,e.error.data)):r.resolve(e.result),s.delete(t)}),d({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{s.delete(t),r.reject(e)}),r.promise},listen:function(e,t){let r=f();return s.set(r,e=>{e.error?(console.error("[RPC Client] Listener error:",e.error),s.delete(r)):t(e.result)}),d({id:r,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error("[RPC Client] Failed to send listener request:",e),s.delete(r)}),()=>{s.delete(r)}},sendLifecycle:function(e){t.postMessage(e,n)},cleanup:function(){r.removeEventListener("message",l),s.clear()}}}({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await i.isConnected)throw new K(-32001,"The iframe provider isn't connected yet");return t}},{onRequest:(e,t)=>{if(e.data instanceof Uint8Array||ArrayBuffer.isView(e.data))return t;try{var r;let t;t={...r=e.data,validationHash:Z(r??{})},e.data=X.encode(t)}catch(e){console.error("[Compression Middleware] Failed to compress request",e)}return t},onResponse:(e,t,r)=>{if(t.error||!(t.result instanceof Uint8Array||ArrayBuffer.isView(t.result)))return t;try{let{validationHash:e,...r}=function(e){if(!e.length)throw new K(-32003,"Missing compressed data");let t=Y(e);if(!t)throw new K(-32003,"Invalid compressed data");if(!t?.validationHash)throw new K(-32003,"Missing validation hash");let{validationHash:r,...n}=t,i=Z(n);if(i!==t.validationHash)throw console.warn("Validation error",{validationHash:r,rawResultData:n,parsedData:t,expectedValidationHashes:i,recomputedHash:Z(void 0)}),new K(-32003,"Invalid validation hash");return t}(t.result);"object"==typeof r&&r&&"result"in r?t.result=r.result:t.result=r}catch(e){console.error("[Compression Middleware] Failed to decompress response",e)}return t}},{onRequest:(e,t)=>(o.setLastRequest(e),t),onResponse:(e,t)=>(o.setLastResponse(e,t),t)}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await i.handleEvent(e)}}}),a=function(e,t){let r,n,i=()=>e.sendLifecycle({clientLifecycle:"heartbeat"});function o(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,1e3),n=setTimeout(()=>{o(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,o()}(),o}(s,i),c=async()=>{a(),s.cleanup(),t.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(r=new en({apiUrl:"https://op-api.gcp.frak.id",clientId:"6eacc8d7-49ac-4936-95e9-81ef29449570",trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>!("track"===e&&t?.properties)||("sdkVersion"in t.properties||(t.properties={...t.properties,sdkVersion:"0.1.0"}),!0)})).setGlobalProperties({sdkVersion:"0.1.0"}),r.init();let u=eh({config:e,rpcClient:s,lifecycleManager:i}).then(()=>o.updateSetupStatus(!0));return{config:e,debugInfo:o,waitForConnection:i.isConnected,waitForSetup:u,request:s.request,listenerRequest:s.listen,destroy:c,openPanel:r}}async function eh({config:e,rpcClient:t,lifecycleManager:r}){async function n(){let r=e.customizations?.css;r&&t.sendLifecycle({clientLifecycle:"modal-css",data:{cssLink:r}})}async function i(){let r=e.customizations?.i18n;r&&t.sendLifecycle({clientLifecycle:"modal-i18n",data:{i18n:r}})}async function o(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(es);e&&t.sendLifecycle({clientLifecycle:"restore-backup",data:{backup:e}})}await r.isConnected,function(e,t){if("undefined"==typeof window)return;let r=new URL(window.location.href),n=r.searchParams.get("sso");n&&(t.then(()=>{e.sendLifecycle({clientLifecycle:"sso-redirect-complete",data:{compressed:n}}),console.log("[SSO URL Listener] Forwarded compressed SSO data to iframe")}).catch(e=>{console.error("[SSO URL Listener] Failed to forward SSO data:",e)}),r.searchParams.delete("sso"),window.history.replaceState({},"",r.toString()),console.log("[SSO URL Listener] SSO parameter detected and URL cleaned"))}(t,r.isConnected),await Promise.allSettled([n(),i(),o()])}let eb={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function ep(e){return e&&e in eb?e:"eur"}async function em({config:e}){let t,r=(t=ep(e.metadata?.currency),{...e,metadata:{...e.metadata,currency:t}}),n=await eu({config:r});if(!n)return void console.error("Failed to create iframe");let i=ef({config:r,iframe:n});return(await i.waitForSetup,await i.waitForConnection)?i:void console.error("Failed to connect to client")}let ey={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}},ew={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},eg=Object.entries(ew).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});function ej(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ex(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0))}function ev(e){return ej(X.encode(e))}function ek(e){return Y(ex(e))}let e_="fCtx";function eS(e){if(e?.r)try{let t=G(e.r);return ej(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function eA(e){if(e&&0!==e.length)try{let t=ex(e);return{r:F(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function eE({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(e_);return t?eA(t):null}function eI({url:e,context:t}){if(!e)return null;let r=eE({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=eS(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(e_,i),o.toString()}function eC(e){let t=new URL(e);return t.searchParams.delete(e_),t.toString()}let eO={compress:eS,decompress:eA,parse:eE,update:eI,remove:eC,replaceUrl:function({url:e,context:t}){let r;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let n=e??window.location.href;(r=null!==t?eI({url:n,context:t}):eC(n))&&window.history.replaceState(null,"",r.toString())}};function eP(e){return e?eb[e]??eb.eur:eb.eur}function eU(e,t){let r=eP(t),n=ep(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}function eL(e,t,r,n,i){var o;let s=ev({r:(o={redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:r,metadata:{name:n,css:i,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}}).redirectUrl,d:o.directExit,l:o.lang,p:o.productId,m:{n:o.metadata?.name,css:o.metadata?.css,l:o.metadata?.logoUrl,h:o.metadata?.homepageLink}}),a=new URL(e);return a.pathname="/sso",a.searchParams.set("p",s),a.toString()}function eR(e){return e?`${e}Amount`:"eurAmount"}function eD(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}async function eM(e,t,r="text/javascript"){return document.getElementById(e)?Promise.resolve(!0):new Promise((n,i)=>{let o=document.createElement("script");o.id=e,o.src=t,o.defer=!0,o.type=r,o.onload=()=>n(!0),o.onerror=()=>i(Error(`Script load error for ${t}`)),document.head.appendChild(o)})}let eT={"gapianne.com":function(){window.FrakSetup.config={walletUrl:"https://wallet.frak.id",metadata:{name:"Gapianne",lang:"fr",currency:"eur",logoUrl:"https://gapianne.com/cdn/shop/files/logo-gapianne_7a65f4c4-54e8-4831-afa2-0849e4c5f8de.png",homepageLink:"https://gapianne.com/"},customizations:{i18n:{"sharing.title":"Pr\xeat(e) \xe0 r\xe9v\xe9ler un secret bien-\xeatre ?","sharing.text":"D\xe9couvre ce produit chez Gapianne","sdk.wallet.login.text":"Cr\xe9ez votre porte-monnaie avec **{{ productName }}** et recevez **{{ estimatedReward }}** par ami(e) parrain\xe9(e)"}},domain:window.location.host},window.FrakSetup.modalConfig={login:{allowSso:!0},metadata:{isDismissible:!0}},window.FrakSetup.modalShareConfig={link:window.location.href},window.FrakSetup.modalWalletConfig={metadata:{position:"left"}},function(){for(let e of Array.from(document.querySelectorAll("#nexus-share-button > button"))){let t=document.createElement("frak-button-share");t.setAttribute("text","PARTAGE ET GAGNE {REWARD} !"),t.setAttribute("no-reward-text","PARTAGE ET GAGNE"),t.setAttribute("use-reward","true"),t.setAttribute("show-wallet","true"),t.setAttribute("classname","button w-full"),e.replaceWith(t)}}()}},eB=BigInt(0),ez=BigInt(1),eF=BigInt(2),eN=BigInt(7),e$=BigInt(256),eV=BigInt(113),eH=[],eq=[],eW=[];for(let e=0,t=ez,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],eH.push(2*(5*n+r)),eq.push((e+1)*(e+2)/2%64);let i=eB;for(let e=0;e<7;e++)(t=(t<<ez^(t>>eN)*eV)%e$)&eF&&(i^=ez<<(ez<<BigInt(e))-ez);eW.push(i)}let eG=j(eW,!0),eJ=eG[0],eK=eG[1],eX=(e,t,r)=>r>32?t<<r-32|e>>>64-r:e<<r|t>>>32-r,eQ=(e,t,r)=>r>32?e<<r-32|t>>>64-r:t<<r|e>>>32-r;class eY extends b{constructor(e,t,r,n=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,o(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}clone(){return this._cloneInto()}keccak(){f(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=eX(o,s,1)^r[n],c=eQ(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=eq[r],o=eX(t,i,n),s=eQ(t,i,n),a=eH[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=eJ[n],e[1]^=eK[n]}u(r)}(this.state32,this.rounds),f(this.state32),this.posOut=0,this.pos=0}update(e){a(this),s(e=h(e));let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){a(this,!1),s(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return o(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(c(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,u(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new eY(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}let eZ=p(()=>new eY(136,1,32));function e0(e,t){let r=eZ(S(e,{strict:!1})?q(e):e);return"bytes"===(t||"hex")?r:B(r)}function e2(e){return"string"==typeof e[0]?e1(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}(e)}function e1(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}class e6 extends I{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class e8 extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let e3=new e8(8192),e5=/^0x[a-fA-F0-9]{40}$/,e4=new e8(8192);function e9(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(e4.has(n))return e4.get(n);let i=!!e5.test(e)&&(e.toLowerCase()===e||!r||function(e,t){if(e3.has(`${e}.undefined`))return e3.get(`${e}.undefined`);let r=e.substring(2).toLowerCase(),n=e0(J(r),"bytes"),i=r.split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let o=`0x${i.join("")}`;return e3.set(`${e}.undefined`,o),o}(e)===e);return e4.set(n,i),i}let e7=256;async function te(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}async function tt(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function tr(e){return await e.request({method:"frak_getProductInformation"})}function tn({domain:e}={}){return e0(B((e??window.location.host).replace("www.","")))}function ti(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function to(e,t){var r,n,i,o,s,a;let c,u,{metadata:l,customizations:d,walletUrl:f}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:"frak_openSso",params:[t,l.name,d?.css]});let h=t.ssoPopupUrl??(r=f??"https://wallet.frak.id",n=tn(),i=l.name,o=d?.css,c=ti((a={r:(s={redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:n,metadata:{name:i,css:o,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}}).redirectUrl,d:s.directExit,l:s.lang,p:s.productId,m:{n:s.metadata?.name,css:s.metadata?.css,l:s.metadata?.logoUrl,h:s.metadata?.homepageLink}},X.encode(a))),(u=new URL(r)).pathname="/sso",u.searchParams.set("p",c),u.toString()),b=window.open(h,"frak-sso","menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800");if(!b)throw Error("Popup was blocked. Please allow popups for this site.");return b.focus(),await e.request({method:"frak_openSso",params:[t,l.name,d?.css]})??{}}async function ts(e,t){let{metadata:r,customizations:n}=e.config;return await e.request({method:"frak_prepareSso",params:[t,r.name,n?.css]})}let ta={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(ta).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});let tc={createLink:()=>({handlerTypeDenominator:B(ta.referral),interactionData:"0xb2c0f17c"}),referred({referrer:e}){let t=e1(["0x010cc3b9",P(e,{size:32})]);return{handlerTypeDenominator:B(ta.referral),interactionData:t}}},tu="fCtx";function tl({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(tu);return t?function(e){if(e&&0!==e.length)try{let t,r=(t=e.length%4,Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0)));return{r:F(r,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}(t):null}let td=function({url:e,context:t}){let r,n;if(!window.location?.href||"undefined"==typeof window)return void console.error("No window found, can't update context");let i=e??window.location.href;(r=null!==t?function({url:e,context:t}){if(!e)return null;let r=tl({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=function(e){if(e?.r)try{let t=G(e.r);return ti(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}(n);if(!i)return null;let o=new URL(e);return o.searchParams.set(tu,i),o.toString()}({url:i,context:t}):((n=new URL(i)).searchParams.delete(tu),n.toString()))&&window.history.replaceState(null,"",r.toString())};async function tf(e,{productId:t,interaction:r,validation:n}){let i=t??tn(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,n]})}async function th(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i,options:o}){let s=!1;async function a(){if(!s)return s=!0,tp(e,{modalConfig:{...n,loggedIn:{action:{key:"referred"}}},walletStatus:t})}async function c(t){let r=tc.referred({referrer:t});await Promise.allSettled([tf(e,{productId:i,interaction:r}),function(e,t,r={}){if(!e)return void console.debug("[Frak] No client provided, skipping event tracking");try{e.openPanel?.track(t,r)}catch(e){console.debug("[Frak] Failed to track event:",t,e)}}(e,"user_referred",{properties:{referrer:t}})])}try{let{status:e,currentWallet:n}=await tb({initialWalletStatus:t,getFreshWalletStatus:a,pushReferralInteraction:c,frakContext:r});return td({url:window.location?.href,context:o?.alwaysAppendUrl?{r:n}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),td({url:window.location?.href,context:o?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof K)switch(e.code){case -32005:return"no-wallet";case -32006:return"no-session"}return"error"}(e)}}async function tb({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&function(e,t){if(!e9(e,{strict:!1}))throw new e6({address:e});if(!e9(t,{strict:!1}))throw new e6({address:t});return e.toLowerCase()===t.toLowerCase()}(n.r,i))?{status:"self-referral",currentWallet:i}:(e?.interactionSession||(i=await t()),await r(n.r),{status:"success",currentWallet:i}):{status:"no-referrer",currentWallet:i}}async function tp(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await te(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}function tm(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(t=>(ty(e,t),t));let r=new ee,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},i=>{ty(e,i),t(i),n||(r.resolve(i),n=!0)}),r.promise}function ty(e,t){"undefined"!=typeof window&&(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?window.sessionStorage.setItem("frak-wallet-interaction-token",t.interactionToken):window.sessionStorage.removeItem("frak-wallet-interaction-token"))}async function tw(e,{productId:t,modalConfig:r,options:n}={}){let i=tl({url:window.location.href}),o=await tm(e);try{return await th(e,{walletStatus:o,frakContext:i,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}async function tg(e){if("undefined"==typeof window)return void console.warn("[Frak] No window found, can't track purchase");let t=window.sessionStorage.getItem("frak-wallet-interaction-token");t?await fetch("https://backend.frak.id/interactions/listenForPurchase",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","x-wallet-sdk-auth":t},body:JSON.stringify(e)}):console.warn("[Frak] No frak session found, skipping purchase check")}function tj(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await tt(t,r)}return{params:r,sendTx:function(n){return e(t,{...r,steps:{...r.steps,sendTransaction:n}})},reward:function(n){return e(t,{...r,steps:{...r.steps,final:{...n,action:{key:"reward"}}}})},sharing:function(n,i){return e(t,{...r,steps:{...r.steps,final:{...i,action:{key:"sharing",options:n}}}})},display:n}}(e,{steps:{login:r??{},openSession:n??{}},metadata:t})}async function tx(e,{tx:t,metadata:r}){return(await tt(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function tv(t,{siwe:r,metadata:n}){let i=t.config?.domain??window.location.host,o=r?.statement??`I confirm that I want to use my Frak wallet on: ${t.config.metadata.name}`,s={...r,statement:o,nonce:r?.nonce??function(t=11){if(!e||e7+t>512){e="",e7=0;for(let t=0;t<256;t++)e+=(256+256*Math.random()|0).toString(16).substring(1)}return e.substring(e7,e7+++t)}(96),uri:r?.uri??`https://${i}`,version:r?.version??"1",domain:i};return(await tt(t,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:s}}})).siweAuthenticate}class tk extends I{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}.
|
|
15
15
|
Expected length: ${e}
|
|
16
|
-
Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class
|
|
16
|
+
Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class t_ extends I{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${D(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class tS extends I{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch.
|
|
17
17
|
Expected length (params): ${e}
|
|
18
|
-
Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class
|
|
19
|
-
Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class
|
|
18
|
+
Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class tA extends I{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type.
|
|
19
|
+
Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class tE extends I{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}function tI(e,t){if("number"==typeof t&&t>0&&t>D(e)-1)throw new C({offset:t,position:"start",size:D(e)})}function tC(e,t,r){if("number"==typeof t&&"number"==typeof r&&D(e)!==r-t)throw new C({offset:r,position:"end",size:D(e)})}let tO=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function tP(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=D(i)}let r=[],n=[],i=0;for(let o=0;o<e.length;o++){let{dynamic:s,encoded:a}=e[o];s?(r.push(N(t+i,{size:32})),n.push(a),i+=D(a)):r.push(a)}return e2([...r,...n])}let tU={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(tU).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});let tL={openArticle({articleId:e}){let t=e1(["0xc0a24ffb",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.press),interactionData:t}},readArticle({articleId:e}){let t=e1(["0xd5bd0fbe",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.press),interactionData:t}}},tR={startPurchase({purchaseId:e}){let t=e1(["0xd87e90c3",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=e1(["0x8403aeb4",function(e,t){if(e.length!==t.length)throw new tS({expectedLength:e.length,givenLength:t.length});let r=tP(function({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(function e({param:t,value:r}){let n,i=(n=t.type.match(/^(.*)\[(\d+)?\]$/))?[n[2]?Number(n[2]):null,n[1]]:void 0;if(i){let[n,o]=i;return function(t,{length:r,param:n}){let i=null===r;if(!Array.isArray(t))throw new tE(t);if(!i&&t.length!==r)throw new tk({expectedLength:r,givenLength:t.length,type:`${n.type}[${r}]`});let o=!1,s=[];for(let r=0;r<t.length;r++){let i=e({param:n,value:t[r]});i.dynamic&&(o=!0),s.push(i)}if(i||o){let e=tP(s);if(i){let t=N(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?e2([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:e2(s.map(({encoded:e})=>e))}}(r,{length:n,param:{...t,type:o}})}if("tuple"===t.type)return function(t,{param:r}){let n=!1,i=[];for(let o=0;o<r.components.length;o++){let s=r.components[o],a=Array.isArray(t)?o:s.name,c=e({param:s,value:t[a]});i.push(c),c.dynamic&&(n=!0)}return{dynamic:n,encoded:n?tP(i):e2(i.map(({encoded:e})=>e))}}(r,{param:t});if("address"===t.type){var o=r;if(!e9(o))throw new e6({address:o});return{dynamic:!1,encoded:U(o.toLowerCase())}}if("bool"===t.type){var s=r;if("boolean"!=typeof s)throw new I(`Invalid boolean value: "${s}" (type: ${typeof s}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:U(z(s))}}if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,n="256"]=tO.exec(t.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){let n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e<i)throw new L({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:N(e,{size:32,signed:t})}}(r,{signed:e,size:Number(n)})}if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,r]=t.type.split("bytes"),n=D(e);if(!r){let t=e;return n%32!=0&&(t=U(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:e2([U(N(n,{size:32})),t])}}if(n!==Number.parseInt(r,10))throw new t_({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:U(e,{dir:"right"})}}(r,{param:t});if("string"===t.type){var a=r;let e=V(a),t=Math.ceil(D(e)/32),n=[];for(let r=0;r<t;r++)n.push(U(function(e,t,r,{strict:n}={}){return S(e,{strict:!1})?function(e,t,r,{strict:n}={}){tI(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&tC(i,t,r),i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){tI(e,t);let i=e.slice(t,r);return n&&tC(i,t,r),i}(e,t,r,{strict:n})}(e,32*r,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:e2([U(N(D(e),{size:32})),...n])}}throw new tA(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[n],value:t[n]}));return r}({params:e,values:t}));return 0===r.length?"0x":r}([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t])]);return{handlerTypeDenominator:B(tU.purchase),interactionData:r}},unsafeCompletedPurchase({purchaseId:e}){let t=e1(["0x4d5b14e0",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.purchase),interactionData:t}}},tD={createLink:()=>({handlerTypeDenominator:B(tU.referral),interactionData:"0xb2c0f17c"}),referred({referrer:e}){let t=e1(["0x010cc3b9",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.referral),interactionData:t}}},tM={customerMeeting({agencyId:e}){let t=e1(["0x74489004",P(e,{size:32})]);return{handlerTypeDenominator:B(tU.retail),interactionData:t}}},tT={open:()=>({handlerTypeDenominator:B(tU.webshop),interactionData:"0xb311798f"})},tB=ef;t=function(){let e=eT[window.location.host];e&&(e(),eM("frak-components","https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/components.js","module"))},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(t,1):document.addEventListener?document.addEventListener("DOMContentLoaded",t):document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&t()})})(),n})());
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.41-beta.
|
|
14
|
+
"version": "0.0.41-beta.ebc9d3a3",
|
|
15
15
|
"description": "Legacy SDK, only used here to provide nice wrapper and redirection for older implementation, to not break anything and keep them updated with latest security updates.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@frak-labs/browserslist-config": "0.0.1",
|
|
59
59
|
"@frak-labs/dev-tooling": "0.0.0",
|
|
60
|
-
"@microsoft/api-extractor": "^7.
|
|
61
|
-
"@rslib/core": "^0.
|
|
62
|
-
"typescript": "^5.
|
|
60
|
+
"@microsoft/api-extractor": "^7.53.3",
|
|
61
|
+
"@rslib/core": "^0.16.1",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
63
|
}
|
|
64
64
|
}
|