@frak-labs/components 0.0.23-beta.afa252b0 → 0.0.23-beta.c7e026e5

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/cdn/loader.js CHANGED
@@ -1,11 +1,9 @@
1
- /*! For license information please see loader.js.LICENSE.txt */
2
- var e,t,r,n={"../../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/@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/@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/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class s 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=s},"../../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/tslib/tslib.es6.mjs"),i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/f16.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js"),a=r("../../node_modules/@jsonjoy.com/util/lib/buffers/Reader.js"),l=n.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/sharedCachedUtf8Decoder.js"));t.CborDecoderBase=class{constructor(e=new a.Reader,t=l.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 s.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 o.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 o.JsonPackValue(e);throw 1}f16(){return(0,i.decodeF16)(this.reader.u16())}}},"../../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/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js");class s extends i.CborDecoder{readTagRaw(e){let t=this.val();return 42===e?new n.JsonPackExtension(e,t):t}}t.CborDecoderDag=s},"../../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/@jsonjoy.com/util/lib/buffers/isFloat32.js"),i=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackExtension.js"),s=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),o=r("../../node_modules/@jsonjoy.com/json-pack/lib/JsonPackValue.js");class a extends s.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 o.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/@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/@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/@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/@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 s=t.utf8(e);r<=23?n[i]=96+s:r<=255?n[i]=s:r<=65535?t.view.setUint16(i,s):t.view.setUint32(i,s)}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/@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/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),i=r("../../node_modules/@jsonjoy.com/util/lib/sort/insertion2.js"),s=r("../../node_modules/@jsonjoy.com/util/lib/objKeyCmp.js"),o=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,s.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=o(r),s=t.x,a=s+i;t.x=a;let l=t.utf8(e),c=t.uint8,u=o(l);switch(u!==i&&c.copyWithin(a+(u-i),a,a+l),u){case 1:c[s]=96+l;break;case 2:c[s]=120,c[s+1]=l;break;case 3:c[s]=121,t.view.setUint16(s+1,l);break;case 5:c[s]=122,t.view.setUint32(s+1,l)}t.x=s+u+l}writeUndef(){this.writeNull()}}t.CborEncoderStable=a},"../../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/tslib/tslib.es6.mjs");n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderFast.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderStable.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborEncoderDag.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderBase.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoder.js"),t),n.__exportStar(r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/CborDecoderDag.js"),t)},"../../node_modules/@jsonjoy.com/json-pack/lib/cbor/types.js":function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},"../../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/@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/@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/@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/@jsonjoy.com/util/lib/buffers/Slice.js"),i=new DataView(new Uint8Array([]).buffer),s="function"==typeof Buffer,o=s?Buffer.prototype.utf8Write:null,a=s?Buffer.from:null,l="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),s=new DataView(i.buffer),o=n.subarray(t,r);i.set(o,0),this.x=r-t,this.x0=0,this.uint8=i,this.size=e,this.view=s}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(o){let r=o.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&&l){let r=l.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 s=e.charCodeAt(i++);if((0xffffff80&s)==0){r[n++]=s;continue}if((0xfffff800&s)==0)r[n++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&i<t){let t=e.charCodeAt(i);(64512&t)==56320&&(i++,s=((1023&s)<<10)+(1023&t)+65536)}(0xffff0000&s)==0?r[n++]=s>>12&15|224:(r[n++]=s>>18&7|240,r[n++]=s>>12&63|128),r[n++]=s>>6&63|128}r[n++]=63&s|128}let s=n-this.x;return this.x=n,s}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/@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/@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/@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/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v10.js")),i=1+Math.round(0xfffffffe*Math.random());class s{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 s=0;s<i;s++){let i=n[s],o=i.bytes;for(let n=0;n<r;n++)if(o[n]!==e[t+n])continue e;return i.value}return null}store(e,t){let r=this.caches[e.length-1],n=new s(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 s=(0,n.default)(e,t,r),o=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(o,s),s}}},"../../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++],s=e[t++];if((128&i)>0||(128&s)>0){t-=2;return}if(n<3)return r(i,s);let o=e[t++];if((128&o)>0){t-=3;return}return r(i,s,o)}{let i=e[t++],s=e[t++],o=e[t++],a=e[t++];if((128&i)>0||(128&s)>0||(128&o)>0||(128&a)>0){t-=4;return}if(n<6)if(4===n)return r(i,s,o,a);else{let n=e[t++];if((128&n)>0){t-=5;return}return r(i,s,o,a,n)}if(n<8){let l=e[t++],c=e[t++];if((128&l)>0||(128&c)>0){t-=6;return}if(n<7)return r(i,s,o,a,l,c);let u=e[t++];if((128&u)>0){t-=7;return}return r(i,s,o,a,l,c,u)}{let l=e[t++],c=e[t++],u=e[t++],d=e[t++];if((128&l)>0||(128&c)>0||(128&u)>0||(128&d)>0){t-=8;return}if(n<10)if(8===n)return r(i,s,o,a,l,c,u,d);else{let n=e[t++];if((128&n)>0){t-=9;return}return r(i,s,o,a,l,c,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,s,o,a,l,c,u,d,f,h);let p=e[t++];if((128&p)>0){t-=11;return}return r(i,s,o,a,l,c,u,d,f,h,p)}{let f=e[t++],h=e[t++],p=e[t++],m=e[t++];if((128&f)>0||(128&h)>0||(128&p)>0||(128&m)>0){t-=12;return}if(n<14)if(12===n)return r(i,s,o,a,l,c,u,d,f,h,p,m);else{let n=e[t++];if((128&n)>0){t-=13;return}return r(i,s,o,a,l,c,u,d,f,h,p,m,n)}{let w=e[t++],b=e[t++];if((128&w)>0||(128&b)>0){t-=14;return}if(n<15)return r(i,s,o,a,l,c,u,d,f,h,p,m,w,b);let y=e[t++];if((128&y)>0){t-=15;return}return r(i,s,o,a,l,c,u,d,f,h,p,m,w,b,y)}}}}}},"../../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/tslib/tslib.es6.mjs").__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v16.js")).default},"../../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,s=i+n,o="";for(;i<s;){let t=e[i++];if((128&t)==0){o+=r(t);continue}let n=63&e[i++];if((224&t)==192){o+=r((31&t)<<6|n);continue}let s=63&e[i++];if((240&t)==224){o+=r((31&t)<<12|n<<6|s);continue}if((248&t)==240){let a=(7&t)<<18|n<<12|s<<6|63&e[i++];a>65535?o+=r((a-=65536)>>>10&1023|55296,a=56320|1023&a):o+=r(a)}else o+=r(t)}return o}},"../../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/tslib/tslib.es6.mjs"),i=r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeAscii.js"),s=n.__importDefault(r("../../node_modules/@jsonjoy.com/util/lib/buffers/utf8/decodeUtf8/v18.js")),o="undefined"!=typeof Buffer,a=o?Buffer.prototype.utf8Slice:null,l=o?Buffer.from:null,c=(e,t,r)=>(0,i.decodeAsciiMax15)(e,t,r)??(0,s.default)(e,t,r),u=(e,t,r)=>(0,i.decodeAscii)(e,t,r)??(0,s.default)(e,t,r),d=a?(e,t,r)=>a.call(e,t,t+r):l?(e,t,r)=>l(e).subarray(t,t+r).toString("utf8"):s.default;t.default=(e,t,r)=>r<16?c(e,t,r):r<32?u(e,t,r):d(e,t,r)},"../../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,s=i+n,o=[];for(;i<s;){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 s=(7&t)<<18|r<<12|n<<6|63&e[i++];if(s>65535){let e=(s-=65536)>>>10&1023|55296;t=56320|1023&s,o.push(e)}else t=s}}}o.push(t)}return r.apply(String,o)}},"../../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/@jsonjoy.com/util/lib/buffers/utf8/CachedUtf8Decoder.js")).CachedUtf8Decoder},"../../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/@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}},"../../packages/rpc/dist/index.js":function(e,t,r){r.d(t,{BH:()=>o,Cz:()=>u,i0:()=>a,j4:()=>d,ss:()=>i,u:()=>s});var n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js");let i={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};class s 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 o{_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)}}function a(e){let{emittingTransport:t,listeningTransport:r,targetOrigin:n,middleware:i=[],lifecycleHandlers:a}=e,l=new Map;async function c(e){try{"clientLifecycle"in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:n,source:null}):"iframeLifecycle"in e&&a?.iframeLifecycle&&await a.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},s=t;for(let t of i)t.onResponse&&(s=await t.onResponse(e,s,r));return s}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 c(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 s=l.get(e.data.id);s&&s(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 o;return l.set(t,e=>{e.error?r.reject(new s(e.error.code,e.error.message,e.error.data)):r.resolve(e.result),l.delete(t)}),h({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{l.delete(t),r.reject(e)}),r.promise},listen:function(e,t){let r=p();return l.set(r,e=>{e.error?(console.error("[RPC Client] Listener error:",e.error),l.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),l.delete(r)}),()=>{l.delete(r)}},sendLifecycle:function(e){t.postMessage(e,n)},cleanup:function(){r.removeEventListener("message",f),l.clear()}}}let l=new n.CborEncoder,c=new n.CborDecoder;function u(e){return l.encode(e)}function d(e){try{return c.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}},"../../packages/rpc/dist/middleware.js":function(e,t,r){r.d(t,{I:()=>v});var n=r("../../node_modules/@jsonjoy.com/json-pack/lib/cbor/index.js"),i=r("../../node_modules/@noble/hashes/esm/utils.js");class s extends i.kb{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=(0,i.GL)(this.buffer)}update(e){(0,i.$h)(this),e=(0,i.O0)(e),(0,i.gk)(e);let{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(n-this.pos,s-o);if(a===n){let t=(0,i.GL)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.$h)(this),(0,i.eB)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,i.ru)(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),s=BigInt(0xffffffff),o=Number(r>>i&s),a=Number(r&s),l=4*!!n,c=4*!n;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,i.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,u[e],s)}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:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let o=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]);var a=r("../../node_modules/@noble/hashes/esm/_u64.js");let l=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]),c=new Uint32Array(64);class u extends s{constructor(e=32){super(64,e,8,!1),this.A=0|o["0"],this.B=0|o["1"],this.C=0|o["2"],this.D=0|o["3"],this.E=0|o["4"],this.F=0|o["5"],this.G=0|o["6"],this.H=0|o["7"]}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=c[e-15],r=c[e-2],n=(0,i.np)(t,7)^(0,i.np)(t,18)^t>>>3,s=(0,i.np)(r,17)^(0,i.np)(r,19)^r>>>10;c[e]=s+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:s,D:o,E:a,F:u,G:d,H:f}=this;for(let e=0;e<64;e++){var h,p,m,w;let t=f+((0,i.np)(a,6)^(0,i.np)(a,11)^(0,i.np)(a,25))+((h=a)&u^~h&d)+l[e]+c[e]|0,b=((0,i.np)(r,2)^(0,i.np)(r,13)^(0,i.np)(r,22))+((p=r)&(m=n)^p&(w=s)^m&w)|0;f=d,d=u,u=a,a=o+t|0,o=s,s=n,n=r,r=t+b|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(r,n,s,o,a,u,d,f)}roundClean(){(0,i.ru)(c)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,i.ru)(this.buffer)}}a.Vl(["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=(0,i.V1)(()=>new u);var f=r("../../node_modules/viem/_esm/utils/data/isHex.js"),h=r("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),p=r("../../node_modules/viem/_esm/utils/encoding/toHex.js");let m={corruptedResponse:-32003};class w 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 b=new n.CborEncoder,y=new n.CborDecoder;function g(e){return function(e,t){let r=d((0,f.v)(e,{strict:!1})?(0,h.O0)(e):e);return(0,p.NC)(r)}(b.encode(e))}let v=()=>({onRequest:(e,t)=>{if(e.data instanceof Uint8Array||ArrayBuffer.isView(e.data))return t;try{var r;let t;t={...r=e.data,validationHash:g(r??{})},e.data=b.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 w(m.corruptedResponse,"Missing compressed data");let t=function(e){try{return y.decode(e)}catch(t){return console.error("Invalid compressed data",{e:t,data:e}),null}}(e);if(!t)throw new w(m.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new w(m.corruptedResponse,"Missing validation hash");let{validationHash:r,...n}=t,i=g(n);if(i!==t.validationHash)throw console.warn("Validation error",{validationHash:r,rawResultData:n,parsedData:t,expectedValidationHashes:i,recomputedHash:g(void 0)}),new w(m.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}})},"../../packages/ui/utils/onDocumentReady.ts":function(e,t,r){r.d(t,{E:()=>n});function n(e){"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&e()})}},"./src/components/ButtonWallet/utils.ts":function(e,t,r){r.d(t,{G:()=>i});var n=r("../core/dist/actions.js");function i(){if(!window.FrakSetup?.client)return void console.error("Frak client not found");"vibrate"in navigator?navigator.vibrate(10):console.log("Vibration not supported"),(0,n.s9)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}},"./src/utils/clientReady.ts":function(e,t,r){r.d(t,{D:()=>s,f:()=>i});let n="frakClientReady";function i(){let e=new CustomEvent(n);window.dispatchEvent(e)}function s(e,t){if(window.FrakSetup?.client&&"add"===e)return void t();("add"===e?window.addEventListener:window.removeEventListener)(n,t,!1)}},"./src/utils/initFrakSdk.ts":function(e,t,r){let n;r.d(t,{m:()=>eD});var i={};r.r(i),r.d(i,{DebugInfoGatherer:()=>R,FrakContextManager:()=>ee,PressInteractionEncoder:()=>eA,PurchaseInteractionEncoder:()=>eO,ReferralInteractionEncoder:()=>e_,RetailInteractionEncoder:()=>eL,WebShopInteractionEncoder:()=>eP,base64urlDecode:()=>V,base64urlEncode:()=>H,baseIframeProps:()=>F,compressJsonToB64:()=>G,createIFrameFrakClient:()=>B,createIframe:()=>D,decompressJsonFromB64:()=>W,displayEmbeddedWallet:()=>eb,displayModal:()=>ew,findIframeInOpener:()=>M,formatAmount:()=>en,generateSsoUrl:()=>es,getCurrencyAmountKey:()=>er,getProductInformation:()=>eg,getSupportedCurrency:()=>z,getSupportedLocale:()=>et,interactionTypes:()=>el,locales:()=>T,modalBuilder:()=>ej,openSso:()=>ef,prepareSso:()=>ey,processReferral:()=>eS,productTypes:()=>eo,productTypesMask:()=>ea,referralInteraction:()=>eE,sendInteraction:()=>em,sendTransaction:()=>ek,setupClient:()=>q,siweAuthenticate:()=>ex,ssoPopupFeatures:()=>eu,ssoPopupName:()=>ed,trackEvent:()=>ei,trackPurchaseStatus:()=>ev,watchWalletStatus:()=>eh});var s=r("../core/dist/index.js"),o=r("../../packages/rpc/dist/index.js"),a=r("../../packages/rpc/dist/middleware.js"),l=r("../../node_modules/@openpanel/web/dist/index.js"),c=r("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),u=r("../../node_modules/viem/_esm/utils/encoding/toHex.js"),d=r("../../node_modules/viem/_esm/utils/hash/keccak256.js"),f=r("../../node_modules/viem/_esm/utils/data/concat.js"),h=r("../../node_modules/viem/_esm/utils/data/pad.js"),p=r("../../node_modules/viem/_esm/utils/address/isAddressEqual.js"),m=r("../../node_modules/viem/_esm/utils/data/size.js"),w=r("../../node_modules/viem/_esm/errors/base.js");w.G,w.G,w.G,w.G,w.G;class b extends w.G{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}.
3
- Expected length: ${e}
4
- Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class y extends w.G{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${(0,m.d)(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class g extends w.G{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch.
5
- Expected length (params): ${e}
6
- Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G,w.G;class v extends w.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type.
7
- Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}w.G;class x extends w.G{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class k extends w.G{constructor(e){super(`"${e}" is not a valid definition type.
8
- Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}w.G;var j=r("../../node_modules/viem/_esm/errors/address.js"),_=r("../../node_modules/viem/_esm/errors/encoding.js"),S=r("../../node_modules/viem/_esm/utils/address/isAddress.js"),C=r("../../node_modules/viem/_esm/errors/data.js"),I=r("../../node_modules/viem/_esm/utils/data/isHex.js");function E(e,t){if("number"==typeof t&&t>0&&t>(0,m.d)(e)-1)throw new C.mV({offset:t,position:"start",size:(0,m.d)(e)})}function A(e,t,r){if("number"==typeof t&&"number"==typeof r&&(0,m.d)(e)!==r-t)throw new C.mV({offset:r,position:"end",size:(0,m.d)(e)})}let O=/^(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 P(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=(0,m.d)(i)}let r=[],n=[],i=0;for(let s=0;s<e.length;s++){let{dynamic:o,encoded:a}=e[s];o?(r.push((0,u.eC)(t+i,{size:32})),n.push(a),i+=(0,m.d)(a)):r.push(a)}return(0,f.zo)([...r,...n])}let L=256,U="nexus-wallet-backup";class R{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 o.u?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 R}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
1
+ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),o=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},s=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},c=t=>r.call(t,`module.exports`)?t[`module.exports`]:s(e({},`__esModule`,{value:!0}),t);function l(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener?document.addEventListener(`DOMContentLoaded`,e):document.attachEvent(`onreadystatechange`,()=>{document.readyState===`complete`&&e()})}function u(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function d(e){return u(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const f=`2.43.2`;let p={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${f}`};var m=class e extends Error{constructor(t,n={}){let r=(()=>n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details)(),i=(()=>n.cause instanceof e&&n.cause.docsPath||n.docsPath)(),a=p.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...p.version?[`Version: ${p.version}`]:[]].join(`
2
+ `);super(o,n.cause?{cause:n.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=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=f}walk(e){return h(this,e)}};function h(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?h(e.cause,t):t?null:e}var g=class extends m{constructor({expectedLength:e,givenLength:t,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${t}`].join(`
3
+ `),{name:`AbiEncodingArrayLengthMismatchError`})}},_=class extends m{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${d(t)}) does not match expected size (bytes${e}).`,{name:`AbiEncodingBytesSizeMismatchError`})}},v=class extends m{constructor({expectedLength:e,givenLength:t}){super([`ABI encoding params/values length mismatch.`,`Expected length (params): ${e}`,`Given length (values): ${t}`].join(`
4
+ `),{name:`AbiEncodingLengthMismatchError`})}},ee=class extends m{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,`Please provide a valid ABI type.`].join(`
5
+ `),{docsPath:t,name:`InvalidAbiEncodingType`})}},te=class extends m{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
6
+ `),{name:`InvalidArrayError`})}},ne=class extends m{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},re=class extends m{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function y(e,{dir:t,size:n=32}={}){return typeof e==`string`?b(e,{dir:t,size:n}):ie(e,{dir:t,size:n})}function b(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new re({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function ie(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new re({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var ae=class extends m{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},oe=class extends m{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function x(e,{size:t}){if(d(e)>t)throw new oe({givenSize:d(e),maxSize:t})}const se=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function S(e,t={}){return typeof e==`number`||typeof e==`bigint`?C(e,t):typeof e==`string`?de(e,t):typeof e==`boolean`?ce(e,t):le(e,t)}function ce(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(x(n,{size:t.size}),y(n,{size:t.size})):n}function le(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=se[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(x(r,{size:t.size}),y(r,{dir:`right`,size:t.size})):r}function C(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new ae({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?y(s,{size:r}):s}const ue=new TextEncoder;function de(e,t={}){return le(ue.encode(e),t)}const fe=new TextEncoder;function pe(e,t={}){return typeof e==`number`||typeof e==`bigint`?_e(e,t):typeof e==`boolean`?me(e,t):u(e)?ge(e,t):ve(e,t)}function me(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(x(n,{size:t.size}),y(n,{size:t.size})):n}const w={zero:48,nine:57,A:65,F:70,a:97,f:102};function he(e){if(e>=w.zero&&e<=w.nine)return e-w.zero;if(e>=w.A&&e<=w.F)return e-(w.A-10);if(e>=w.a&&e<=w.f)return e-(w.a-10)}function ge(e,t={}){let n=e;t.size&&(x(n,{size:t.size}),n=y(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=he(r.charCodeAt(t++)),i=he(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new m(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function _e(e,t){return ge(C(e,t))}function ve(e,t={}){let n=fe.encode(e);return typeof t.size==`number`?(x(n,{size:t.size}),y(n,{dir:`right`,size:t.size})):n}const T=BigInt(2**32-1),ye=BigInt(32);function be(e,t=!1){return t?{h:Number(e&T),l:Number(e>>ye&T)}:{h:Number(e>>ye&T)|0,l:Number(e&T)|0}}function xe(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=be(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const Se=(e,t,n)=>e<<n|t>>>32-n,Ce=(e,t,n)=>t<<n|e>>>32-n,we=(e,t,n)=>t<<n-32|e>>>64-n,Te=(e,t,n)=>e<<n-32|t>>>64-n;function Ee(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function De(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function E(e,...t){if(!Ee(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function D(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 Oe(e,t){E(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function ke(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function O(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ae(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function k(e,t){return e<<32-t|e>>>t}const je=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function Me(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ne(e){for(let t=0;t<e.length;t++)e[t]=Me(e[t]);return e}const Pe=je?e=>e:Ne;function Fe(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function Ie(e){return typeof e==`string`&&(e=Fe(e)),E(e),e}var Le=class{};function Re(e){let t=t=>e().update(Ie(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const ze=BigInt(0),A=BigInt(1),Be=BigInt(2),Ve=BigInt(7),He=BigInt(256),Ue=BigInt(113),We=[],Ge=[],Ke=[];for(let e=0,t=A,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],We.push(2*(5*r+n)),Ge.push((e+1)*(e+2)/2%64);let i=ze;for(let e=0;e<7;e++)t=(t<<A^(t>>Ve)*Ue)%He,t&Be&&(i^=A<<(A<<BigInt(e))-A);Ke.push(i)}const qe=xe(Ke,!0),Je=qe[0],Ye=qe[1],Xe=(e,t,n)=>n>32?we(e,t,n):Se(e,t,n),Ze=(e,t,n)=>n>32?Te(e,t,n):Ce(e,t,n);function Qe(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=Xe(a,o,1)^n[r],c=Ze(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=Ge[n],a=Xe(t,i,r),o=Ze(t,i,r),s=We[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Je[r],e[1]^=Ye[r]}O(n)}var $e=class e extends Le{constructor(e,t,n,r=!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=n,this.enableXOF=r,this.rounds=i,De(n),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=ke(this.state)}clone(){return this._cloneInto()}keccak(){Pe(this.state32),Qe(this.state32,this.rounds),Pe(this.state32),this.posOut=0,this.pos=0}update(e){D(this),e=Ie(e),E(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[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:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){D(this,!1),E(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return De(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Oe(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,O(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const et=(e,t,n)=>Re(()=>new $e(t,e,n)),tt=(()=>et(1,136,256/8))();function nt(e,t){let n=t||`hex`,r=tt(u(e,{strict:!1})?pe(e):e);return n===`bytes`?r:S(r)}var rt=class extends m{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`})}},it=class 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)&&t!==void 0&&(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}};const at=new it(8192);function ot(e,t){if(at.has(`${e}.${t}`))return at.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=nt(ve(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return at.set(`${e}.${t}`,a),a}const st=/^0x[a-fA-F0-9]{40}$/,ct=new it(8192);function lt(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(ct.has(r))return ct.get(r);let i=(()=>st.test(e)?e.toLowerCase()===e?!0:n?ot(e)===e:!0:!1)();return ct.set(r,i),i}function j(e){return typeof e[0]==`string`?M(e):ut(e)}function ut(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function M(e){return`0x${e.reduce((e,t)=>e+t.replace(`0x`,``),``)}`}function dt(e,t,n,{strict:r}={}){return u(e,{strict:!1})?ht(e,t,n,{strict:r}):mt(e,t,n,{strict:r})}function ft(e,t){if(typeof t==`number`&&t>0&&t>d(e)-1)throw new ne({offset:t,position:`start`,size:d(e)})}function pt(e,t,n){if(typeof t==`number`&&typeof n==`number`&&d(e)!==n-t)throw new ne({offset:n,position:`end`,size:d(e)})}function mt(e,t,n,{strict:r}={}){ft(e,t);let i=e.slice(t,n);return r&&pt(i,t,n),i}function ht(e,t,n,{strict:r}={}){ft(e,t);let i=`0x${e.replace(`0x`,``).slice((t??0)*2,(n??e.length)*2)}`;return r&&pt(i,t,n),i}const gt=/^(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 _t(e,t){if(e.length!==t.length)throw new v({expectedLength:e.length,givenLength:t.length});let n=bt(vt({params:e,values:t}));return n.length===0?`0x`:n}function vt({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(yt({param:e[r],value:t[r]}));return n}function yt({param:e,value:t}){let n=Ot(e.type);if(n){let[r,i]=n;return St(t,{length:r,param:{...e,type:i}})}if(e.type===`tuple`)return Dt(t,{param:e});if(e.type===`address`)return xt(t);if(e.type===`bool`)return wt(t);if(e.type.startsWith(`uint`)||e.type.startsWith(`int`)){let n=e.type.startsWith(`int`),[,,r=`256`]=gt.exec(e.type)??[];return Tt(t,{signed:n,size:Number(r)})}if(e.type.startsWith(`bytes`))return Ct(t,{param:e});if(e.type===`string`)return Et(t);throw new ee(e.type,{docsPath:`/docs/contract/encodeAbiParameters`})}function bt(e){let t=0;for(let n=0;n<e.length;n++){let{dynamic:r,encoded:i}=e[n];r?t+=32:t+=d(i)}let n=[],r=[],i=0;for(let a=0;a<e.length;a++){let{dynamic:o,encoded:s}=e[a];o?(n.push(C(t+i,{size:32})),r.push(s),i+=d(s)):n.push(s)}return j([...n,...r])}function xt(e){if(!lt(e))throw new rt({address:e});return{dynamic:!1,encoded:b(e.toLowerCase())}}function St(e,{length:t,param:n}){let r=t===null;if(!Array.isArray(e))throw new te(e);if(!r&&e.length!==t)throw new g({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1,a=[];for(let t=0;t<e.length;t++){let r=yt({param:n,value:e[t]});r.dynamic&&(i=!0),a.push(r)}if(r||i){let e=bt(a);if(r){let t=C(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?j([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:j(a.map(({encoded:e})=>e))}}function Ct(e,{param:t}){let[,n]=t.type.split(`bytes`),r=d(e);if(!n){let t=e;return r%32!=0&&(t=b(t,{dir:`right`,size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:j([b(C(r,{size:32})),t])}}if(r!==Number.parseInt(n,10))throw new _({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:b(e,{dir:`right`})}}function wt(e){if(typeof e!=`boolean`)throw new m(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:b(ce(e))}}function Tt(e,{signed:t,size:n=256}){if(typeof n==`number`){let r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new ae({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:C(e,{size:32,signed:t})}}function Et(e){let t=de(e),n=Math.ceil(d(t)/32),r=[];for(let e=0;e<n;e++)r.push(b(dt(t,e*32,(e+1)*32),{dir:`right`}));return{dynamic:!0,encoded:j([b(C(d(t),{size:32})),...r])}}function Dt(e,{param:t}){let n=!1,r=[];for(let i=0;i<t.components.length;i++){let a=t.components[i],o=yt({param:a,value:e[Array.isArray(e)?i:a.name]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?bt(r):j(r.map(({encoded:e})=>e))}}function Ot(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function kt(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function At(e,t,n){return e&t^~e&n}function jt(e,t,n){return e&t^e&n^t&n}var Mt=class extends Le{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Ae(this.buffer)}update(e){D(this),e=Ie(e),E(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=Ae(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){D(this),Oe(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,O(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;kt(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=Ae(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const N=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Nt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),P=new Uint32Array(64);var Pt=class extends Mt{constructor(e=32){super(64,e,8,!1),this.A=N[0]|0,this.B=N[1]|0,this.C=N[2]|0,this.D=N[3]|0,this.E=N[4]|0,this.F=N[5]|0,this.G=N[6]|0,this.H=N[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)P[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=P[e-15],n=P[e-2],r=k(t,7)^k(t,18)^t>>>3;P[e]=(k(n,17)^k(n,19)^n>>>10)+P[e-7]+r+P[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=k(o,6)^k(o,11)^k(o,25),u=l+t+At(o,s,c)+Nt[e]+P[e]|0,d=(k(n,2)^k(n,13)^k(n,22))+jt(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){O(P)}destroy(){this.set(0,0,0,0,0,0,0,0),O(this.buffer)}};const Ft=Re(()=>new Pt);function It(e,t){let n=t||`hex`,r=Ft(u(e,{strict:!1})?pe(e):e);return n===`bytes`?r:S(r)}function Lt(e,t){if(!lt(e,{strict:!1}))throw new rt({address:e});if(!lt(t,{strict:!1}))throw new rt({address:t});return e.toLowerCase()===t.toLowerCase()}let F=256,I;function Rt(e=11){if(!I||F+e>256*2){I=``,F=0;for(let e=0;e<256;e++)I+=(256+Math.random()*256|0).toString(16).substring(1)}return I.substring(F,F+++e)}var L=o({__addDisposableResource:()=>dn,__assign:()=>V,__asyncDelegator:()=>nn,__asyncGenerator:()=>tn,__asyncValues:()=>rn,__await:()=>z,__awaiter:()=>Jt,__classPrivateFieldGet:()=>cn,__classPrivateFieldIn:()=>un,__classPrivateFieldSet:()=>ln,__createBinding:()=>H,__decorate:()=>Vt,__disposeResources:()=>fn,__esDecorate:()=>Ut,__exportStar:()=>Xt,__extends:()=>zt,__generator:()=>Yt,__importDefault:()=>sn,__importStar:()=>on,__makeTemplateObject:()=>an,__metadata:()=>qt,__param:()=>Ht,__propKey:()=>Gt,__read:()=>Zt,__rest:()=>Bt,__rewriteRelativeImportExtension:()=>pn,__runInitializers:()=>Wt,__setFunctionName:()=>Kt,__spread:()=>Qt,__spreadArray:()=>en,__spreadArrays:()=>$t,__values:()=>R,default:()=>gn});function zt(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);B(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Bt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Vt(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Ht(e,t){return function(n,r){t(n,r,e)}}function Ut(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function Wt(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function Gt(e){return typeof e==`symbol`?e:`${e}`}function Kt(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function qt(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Jt(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Yt(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Xt(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&H(t,e,n)}function R(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Zt(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Qt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Zt(arguments[t]));return e}function $t(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function en(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function z(e){return this instanceof z?(this.v=e,this):new z(e)}function tn(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof z?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function nn(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:z(e[r](t)),done:!1}:i?i(t):t}:i}}function rn(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof R==`function`?R(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function an(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function on(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=U(e),r=0;r<n.length;r++)n[r]!==`default`&&H(t,e,n[r]);return mn(t,e),t}function sn(e){return e&&e.__esModule?e:{default:e}}function cn(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function ln(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function un(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function dn(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function fn(e){function t(t){e.error=e.hasError?new hn(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function pn(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var B,V,H,mn,U,hn,gn,W=i((()=>{B=function(e,t){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},B(e,t)},V=function(){return V=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},V.apply(this,arguments)},H=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),mn=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},U=function(e){return U=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},U(e)},hn=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},gn={__extends:zt,__assign:V,__rest:Bt,__decorate:Vt,__param:Ht,__esDecorate:Ut,__runInitializers:Wt,__propKey:Gt,__setFunctionName:Kt,__metadata:qt,__awaiter:Jt,__generator:Yt,__createBinding:H,__exportStar:Xt,__values:R,__read:Zt,__spread:Qt,__spreadArrays:$t,__spreadArray:en,__await:z,__asyncGenerator:tn,__asyncDelegator:nn,__asyncValues:rn,__makeTemplateObject:an,__importStar:on,__importDefault:sn,__classPrivateFieldGet:cn,__classPrivateFieldSet:ln,__classPrivateFieldIn:un,__addDisposableResource:dn,__disposeResources:fn,__rewriteRelativeImportExtension:pn}})),_n=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),vn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Slice=void 0,e.Slice=class{constructor(e,t,n,r){this.uint8=e,this.view=t,this.start=n,this.end=r}subarray(){return this.uint8.subarray(this.start,this.end)}}})),yn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Writer=void 0;let t=vn(),n=new Uint8Array([]),r=new DataView(n.buffer),i=typeof Buffer==`function`,a=i?Buffer.prototype.utf8Write:null,o=i?Buffer.from:null,s=typeof TextEncoder<`u`?new TextEncoder:null;e.Writer=class{constructor(e=64*1024){this.allocSize=e,this.view=r,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,n=this.x,r=this.uint8,i=new Uint8Array(e),a=new DataView(i.buffer),o=r.subarray(t,n);i.set(o,0),this.x=n-t,this.x0=0,this.uint8=i,this.size=e,this.view=a}ensureCapacity(e){let t=this.size,n=t-this.x;if(n<e){let r=t-this.x0+(e-n);this.grow(r<=this.allocSize?this.allocSize:r*2)}}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 t.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 n=this.x;this.uint8[n++]=e,this.uint8[n++]=t>>>8,this.uint8[n++]=t&255,this.x=n}u8u32(e,t){this.ensureCapacity(5);let n=this.x;this.uint8[n++]=e,this.view.setUint32(n,t),this.x=n+4}u8u64(e,t){this.ensureCapacity(9);let n=this.x;this.uint8[n++]=e,this.view.setBigUint64(n,BigInt(t)),this.x=n+8}u8f32(e,t){this.ensureCapacity(5);let n=this.x;this.uint8[n++]=e,this.view.setFloat32(n,t),this.x=n+4}u8f64(e,t){this.ensureCapacity(9);let n=this.x;this.uint8[n++]=e,this.view.setFloat64(n,t),this.x=n+8}buf(e,t){this.ensureCapacity(t);let n=this.x;this.uint8.set(e,n),this.x=n+t}utf8(e){let t=e.length*4;if(t<168)return this.utf8Native(e);if(a){let n=a.call(this.uint8,e,this.x,t);return this.x+=n,n}else if(o){let n=this.uint8,r=n.byteOffset+this.x,i=o(n.buffer).subarray(r,r+t).write(e,0,t,`utf8`);return this.x+=i,i}else if(t>1024&&s){let n=s.encodeInto(e,this.uint8.subarray(this.x,this.x+t)).written;return this.x+=n,n}return this.utf8Native(e)}utf8Native(e){let t=e.length,n=this.uint8,r=this.x,i=0;for(;i<t;){let a=e.charCodeAt(i++);if(a&4294967168)if(!(a&4294965248))n[r++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&i<t){let t=e.charCodeAt(i);(t&64512)==56320&&(i++,a=((a&1023)<<10)+(t&1023)+65536)}a&4294901760?(n[r++]=a>>18&7|240,n[r++]=a>>12&63|128,n[r++]=a>>6&63|128):(n[r++]=a>>12&15|224,n[r++]=a>>6&63|128)}else{n[r++]=a;continue}n[r++]=a&63|128}let a=r-this.x;return this.x=r,a}ascii(e){let t=e.length;this.ensureCapacity(t);let n=this.uint8,r=this.x,i=0;for(;i<t;)n[r++]=e.charCodeAt(i++);this.x=r}}})),bn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborEncoderFast=void 0;let t=yn(),n=Number.isSafeInteger;e.CborEncoderFast=class{constructor(e=new t.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);switch(e.constructor){case Array:return this.writeArr(e);default: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){n(e)?this.writeInteger(e):typeof e==`bigint`?this.writeBigInt(e):this.writeFloat(e)}writeBigInt(e){e>=0?this.writeBigUint(e):this.writeBigSint(e)}writeBigUint(e){if(e<=2**53-1)return this.writeUInteger(Number(e));this.writer.u8u64(27,e)}writeBigSint(e){if(e>=-(2**53-1))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 n=t.uint8,r=t.x;e<=23?n[r++]=0+e:e<=255?(n[r++]=24,n[r++]=e):e<=65535?(n[r++]=25,t.view.setUint16(r,e),r+=2):e<=4294967295?(n[r++]=26,t.view.setUint32(r,e),r+=4):(n[r++]=27,t.view.setBigUint64(r,BigInt(e)),r+=8),t.x=r}encodeNumber(e){this.writeNumber(e)}encodeInteger(e){this.writeInteger(e)}encodeUint(e){this.writeUInteger(e)}encodeNint(e){let t=-1-e,n=this.writer;n.ensureCapacity(9);let r=n.uint8,i=n.x;t<24?r[i++]=32+t:t<=255?(r[i++]=56,r[i++]=t):t<=65535?(r[i++]=57,n.view.setUint16(i,t),i+=2):t<=4294967295?(r[i++]=58,n.view.setUint32(i,t),i+=4):(r[i++]=59,n.view.setBigUint64(i,BigInt(t)),i+=8),n.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<=4294967295?t.u8u32(90,e):t.u8u64(91,e)}writeStr(e){let t=this.writer,n=e.length*4;t.ensureCapacity(5+n);let r=t.uint8,i=t.x;n<=23?t.x++:n<=255?(r[t.x++]=120,i=t.x,t.x++):n<=65535?(r[t.x++]=121,i=t.x,t.x+=2):(r[t.x++]=122,i=t.x,t.x+=4);let a=t.utf8(e);n<=23?r[i]=96+a:n<=255?r[i]=a:n<=65535?t.view.setUint16(i,a):t.view.setUint32(i,a)}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 n=0;n<t;n++)this.writeAny(e[n])}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<=4294967295?t.u8u32(154,e):t.u8u64(155,e)}writeObj(e){let t=Object.keys(e),n=t.length;this.writeObjHdr(n);for(let r=0;r<n;r++){let n=t[r];this.writeStr(n),this.writeAny(e[n])}}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<=4294967295?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<=4294967295?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)}}})),xn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isFloat32=void 0;let t=new DataView(new ArrayBuffer(4));e.isFloat32=e=>(t.setFloat32(0,e),e===t.getFloat32(0))})),Sn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.JsonPackExtension=void 0,e.JsonPackExtension=class{constructor(e,t){this.tag=e,this.val=t}}})),Cn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.JsonPackValue=void 0,e.JsonPackValue=class{constructor(e){this.val=e}}})),wn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborEncoder=void 0;let t=xn(),n=Sn(),r=bn(),i=Cn();e.CborEncoder=class extends r.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 n.JsonPackExtension:return this.writeTag(e.tag,e.val);case i.JsonPackValue:let t=e.val;return this.writer.buf(t,t.length);default:return e instanceof Uint8Array?this.writeBin(e):Array.isArray(e)?this.writeArr(e):e instanceof Map?this.writeMap(e):this.writeUnknown(e)}case`undefined`:return this.writeUndef();case`bigint`:return this.writeBigInt(e);default:return this.writeUnknown(e)}}writeFloat(e){(0,t.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)}}})),Tn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.sort=void 0,e.sort=(e,t)=>{let n=e.length;for(let r=1;r<n;r++){let n=e[r],i=r;for(;i!==0&&t(e[i-1],n)>0;)e[i]=e[i-1],i--;e[i]=n}return e}})),En=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.objKeyCmp=void 0,e.objKeyCmp=(e,t)=>{let n=e.length,r=t.length;return n===r?e>t?1:-1:n-r}})),Dn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborEncoderStable=void 0;let t=wn(),n=Tn(),r=En(),i=e=>e<=23?1:e<=255?2:e<=65535?3:5;e.CborEncoderStable=class extends t.CborEncoder{writeObj(e){let t=Object.keys(e);(0,n.sort)(t,r.objKeyCmp);let i=t.length;this.writeObjHdr(i);for(let n=0;n<i;n++){let r=t[n];this.writeStr(r),this.writeAny(e[r])}}writeStr(e){let t=this.writer,n=e.length,r=n*4;t.ensureCapacity(5+r);let a=i(n),o=t.x,s=o+a;t.x=s;let c=t.utf8(e),l=t.uint8,u=i(c);if(u!==a){let e=u-a;l.copyWithin(s+e,s,s+c)}switch(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);break}t.x=o+u+c}writeUndef(){this.writeNull()}}})),On=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborEncoderDag=void 0;let t=Dn();e.CborEncoderDag=class extends t.CborEncoderStable{writeUndef(){this.writeNull()}writeFloat(e){if(e!==e||!Number.isFinite(e))return this.writeNull();this.writer.u8f64(251,e)}writeTag(e,t){e===42&&this.writeTagHdr(e),this.writeAny(t)}}})),kn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.decodeF16=void 0;let t=Math.pow;e.decodeF16=e=>{let n=(e&31744)>>10,r=e&1023;return(e>>15?-1:1)*(n?n===31?r?NaN:1/0:t(2,n-15)*(1+r/1024):r/1024*6103515625e-14)}})),An=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.decodeAsciiMax15=e.decodeAscii=void 0;let t=String.fromCharCode;e.decodeAscii=(e,n,r)=>{let i=[];for(let t=0;t<r;t++){let t=e[n++];if(t&128)return;i.push(t)}return t.apply(String,i)},e.decodeAsciiMax15=(e,n,r)=>{if(r<4)if(r<2){if(r===0)return``;{let r=e[n++];if((r&128)>1){--n;return}return t(r)}}else{let i=e[n++],a=e[n++];if((i&128)>0||(a&128)>0){n-=2;return}if(r<3)return t(i,a);let o=e[n++];if((o&128)>0){n-=3;return}return t(i,a,o)}else{let i=e[n++],a=e[n++],o=e[n++],s=e[n++];if((i&128)>0||(a&128)>0||(o&128)>0||(s&128)>0){n-=4;return}if(r<6){if(r===4)return t(i,a,o,s);{let r=e[n++];if((r&128)>0){n-=5;return}return t(i,a,o,s,r)}}else if(r<8){let c=e[n++],l=e[n++];if((c&128)>0||(l&128)>0){n-=6;return}if(r<7)return t(i,a,o,s,c,l);let u=e[n++];if((u&128)>0){n-=7;return}return t(i,a,o,s,c,l,u)}else{let c=e[n++],l=e[n++],u=e[n++],d=e[n++];if((c&128)>0||(l&128)>0||(u&128)>0||(d&128)>0){n-=8;return}if(r<10){if(r===8)return t(i,a,o,s,c,l,u,d);{let r=e[n++];if((r&128)>0){n-=9;return}return t(i,a,o,s,c,l,u,d,r)}}else if(r<12){let f=e[n++],p=e[n++];if((f&128)>0||(p&128)>0){n-=10;return}if(r<11)return t(i,a,o,s,c,l,u,d,f,p);let m=e[n++];if((m&128)>0){n-=11;return}return t(i,a,o,s,c,l,u,d,f,p,m)}else{let f=e[n++],p=e[n++],m=e[n++],h=e[n++];if((f&128)>0||(p&128)>0||(m&128)>0||(h&128)>0){n-=12;return}if(r<14){if(r===12)return t(i,a,o,s,c,l,u,d,f,p,m,h);{let r=e[n++];if((r&128)>0){n-=13;return}return t(i,a,o,s,c,l,u,d,f,p,m,h,r)}}else{let g=e[n++],_=e[n++];if((g&128)>0||(_&128)>0){n-=14;return}if(r<15)return t(i,a,o,s,c,l,u,d,f,p,m,h,g,_);let v=e[n++];if((v&128)>0){n-=15;return}return t(i,a,o,s,c,l,u,d,f,p,m,h,g,_,v)}}}}}})),jn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=String.fromCharCode;e.default=(e,n,r)=>{let i=n,a=i+r,o=[];for(;i<a;){let t=e[i++];if(t&128){let n=e[i++]&63;if((t&224)==192)t=(t&31)<<6|n;else{let r=e[i++]&63;if((t&240)==224)t=(t&31)<<12|n<<6|r;else if((t&248)==240){let a=e[i++]&63,s=(t&7)<<18|n<<12|r<<6|a;if(s>65535){s-=65536;let e=s>>>10&1023|55296;t=56320|s&1023,o.push(e)}else t=s}}}o.push(t)}return t.apply(String,o)}})),Mn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(W(),c(L)),n=An(),r=t.__importDefault(jn()),i=typeof Buffer<`u`,a=i?Buffer.prototype.utf8Slice:null,o=i?Buffer.from:null,s=(e,t,i)=>(0,n.decodeAsciiMax15)(e,t,i)??(0,r.default)(e,t,i),l=(e,t,i)=>(0,n.decodeAscii)(e,t,i)??(0,r.default)(e,t,i),u=a?(e,t,n)=>a.call(e,t,t+n):o?(e,t,n)=>o(e).subarray(t,t+n).toString(`utf8`):r.default;e.default=(e,t,n)=>n<16?s(e,t,n):n<32?l(e,t,n):u(e,t,n)})),Nn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.decodeUtf8=void 0,e.decodeUtf8=(W(),c(L)).__importDefault(Mn()).default})),Pn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Reader=void 0;let t=Nn();e.Reader=class e{constructor(e=new Uint8Array([]),t=new DataView(e.buffer,e.byteOffset,e.length),n=0,r=e.length){this.uint8=e,this.view=t,this.x=n,this.end=r}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,n=t+e,r=this.uint8.subarray(t,n);return this.x=n,r}subarray(e=0,t){let n=this.x,r=n+e,i=typeof t==`number`?n+t:this.end;return this.uint8.subarray(r,i)}slice(t=0,n){let r=this.x,i=r+t,a=typeof n==`number`?r+n:this.end;return new e(this.uint8,this.view,i,a)}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 n=this.x;return this.x+=e,(0,t.decodeUtf8)(this.uint8,n,e)}ascii(e){let t=this.uint8,n=``,r=this.x+e;for(let e=this.x;e<r;e++)n+=String.fromCharCode(t[e]);return this.x=r,n}}})),Fn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=String.fromCharCode;e.default=(e,n,r)=>{let i=n,a=i+r,o=``;for(;i<a;){let n=e[i++];if(!(n&128)){o+=t(n);continue}let r=e[i++]&63;if((n&224)==192){o+=t((n&31)<<6|r);continue}let a=e[i++]&63;if((n&240)==224){o+=t((n&31)<<12|r<<6|a);continue}if((n&248)==240){let s=e[i++]&63,c=(n&7)<<18|r<<12|a<<6|s;if(c>65535){c-=65536;let e=c>>>10&1023|55296;c=56320|c&1023,o+=t(e,c)}else o+=t(c)}else o+=t(n)}return o}})),In=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CachedUtf8Decoder=void 0;let t=(W(),c(L)).__importDefault(Fn()),n=1+Math.round(Math.random()*((-1>>>0)-1));function r(e,t){return n^=n<<13,n^=n>>>17,n^=n<<5,(n>>>0)%(t-e+1)+e}var i=class{constructor(e,t){this.bytes=e,this.value=t}};e.CachedUtf8Decoder=class{constructor(){this.caches=[];for(let e=0;e<31;e++)this.caches.push([])}get(e,t,n){let r=this.caches[n-1],i=r.length;FIND_CHUNK:for(let a=0;a<i;a++){let i=r[a],o=i.bytes;for(let r=0;r<n;r++)if(o[r]!==e[t+r])continue FIND_CHUNK;return i.value}return null}store(e,t){let n=this.caches[e.length-1],a=new i(e,t);n.length>=16?n[r(0,15)]=a:n.push(a)}decode(e,n,r){if(!r)return``;let i=this.get(e,n,r);if(i!==null)return i;let a=(0,t.default)(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,a),a}}})),Ln=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=new(In()).CachedUtf8Decoder})),Rn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborDecoderBase=void 0;let t=(W(),c(L)),n=kn(),r=Sn(),i=Cn(),a=Pn(),o=t.__importDefault(Ln());e.CborDecoderBase=class{constructor(e=new a.Reader,t=o.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,n=e&31;return t<4?t<2?t===0?this.readUint(n):this.readNint(n):t===2?this.readBin(n):this.readStr(n):t<6?t===4?this.readArr(n):this.readObj(n):t===6?this.readTag(n):this.readTkn(n)}readAnyRaw(e){let t=e>>5,n=e&31;return t<4?t<2?t===0?this.readUint(n):this.readNint(n):t===2?this.readBin(n):this.readStr(n):t<6?t===4?this.readArr(n):this.readObj(n):t===6?this.readTag(n):this.readTkn(n)}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 e===24?this.reader.u8():e;if(e<27)return e===25?this.reader.u16():this.reader.u32();{let e=this.reader.u64();return e>9007199254740991?e:Number(e)}}readNint(e){if(e<25)return e===24?-this.reader.u8()-1:-e-1;if(e<27)return e===25?-this.reader.u16()-1:-this.reader.u32()-1;{let e=this.reader.u64();return e>9007199254740990?-e-BigInt(1):-Number(e)-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(;this.reader.peak()!==255;){let n=this.readBinChunk();e+=n.length,t.push(n)}this.reader.x++;let n=new Uint8Array(e),r=0,i=t.length;for(let e=0;e<i;e++){let i=t[e];n.set(i,r),r+=i.length}return n}default:throw 1}}readBinChunk(){let e=this.reader.u8(),t=e>>5,n=e&31;if(t!==2)throw 2;if(n>27)throw 3;return this.readBin(n)}readAsStr(){let e=this.reader.u8(),t=e>>5,n=e&31;if(t!==3)throw 11;return this.readStr(n)}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(;t.peak()!==255;)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=e>>5,n=e&31;if(t!==3)throw 4;if(n>27)throw 5;return this.readStr(n)}readArr(e){let t=this.readMinorLen(e);return t>=0?this.readArrRaw(t):this.readArrIndef()}readArrRaw(e){let t=[];for(let n=0;n<e;n++)t.push(this.readAny());return t}readArrIndef(){let e=[];for(;this.reader.peak()!==255;)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());break}let n={};for(let e=0;e<t;e++){let e=this.key();if(e===`__proto__`)throw 6;n[e]=this.readAny()}return n}else if(e===31)return this.readObjIndef();else throw 1}readObjRaw(e){let t={};for(let n=0;n<e;n++){let e=this.key();t[e]=this.readAny()}return t}readObjIndef(){let e={};for(;this.reader.peak()!==255;){let t=this.key();if(this.reader.peak()===255)throw 7;e[t]=this.readAny()}return this.reader.x++,e}key(){let e=this.reader.u8(),t=e>>5,n=e&31;if(t!==3)return String(this.readAnyRaw(e));let r=this.readStrLen(n);if(r>31)return this.reader.utf8(r);let i=this.keyDecoder.decode(this.reader.uint8,this.reader.x,r);return this.reader.skip(r),i}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 r.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 i.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 i.JsonPackValue(e);throw 1}f16(){return(0,n.decodeF16)(this.reader.u16())}}})),zn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborDecoder=void 0;let t=Rn(),n=Cn();e.CborDecoder=class extends t.CborDecoderBase{readAsMap(){let e=this.reader.u8(),t=e>>5,n=e&31;switch(t){case 5:return this.readMap(n);default: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 n=0;n<e;n++){let e=this.readAny(),n=this.readAny();t.set(e,n)}return t}readMapIndef(){let e=new Map;for(;this.reader.peak()!==255;){let t=this.readAny();if(this.reader.peak()===255)throw 7;let n=this.readAny();e.set(t,n)}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=e>>5,n=e&31;switch(t){case 0:case 1:this.skipUNint(n);break;case 2:this.skipBin(n);break;case 3:this.skipStr(n);break;case 4:this.skipArr(n);break;case 5:this.skipObj(n);break;case 7:this.skipTkn(n);break;case 6:this.skipTag(n);break}}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(;this.reader.peak()!==255;)this.skipBinChunk();this.reader.x++}}skipBinChunk(){let e=this.reader.u8(),t=e>>5,n=e&31;if(t!==2)throw 2;if(n>27)throw 3;this.skipBin(n)}skipStr(e){let t=this.skipMinorLen(e);if(t>=0)this.reader.skip(t);else{for(;this.reader.peak()!==255;)this.skipStrChunk();this.reader.x++}}skipStrChunk(){let e=this.reader.u8(),t=e>>5,n=e&31;if(t!==3)throw 4;if(n>27)throw 5;this.skipStr(n)}skipArr(e){let t=this.skipMinorLen(e);if(t>=0)this.skipN(t);else{for(;this.reader.peak()!==255;)this.skipAny();this.reader.x++}}skipObj(e){let t=this.readMinorLen(e);if(t>=0)return this.skipN(t*2);for(;this.reader.peak()!==255;){if(this.skipAny(),this.reader.peak()===255)throw 7;this.skipAny()}this.reader.x++}skipTag(e){if(this.skipMinorLen(e)<0)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,n=e.length){this.reader.reset(e),this.reader.x=t;let r=t;if(this.skipAny(),this.reader.x-r!==n)throw 8}decodeLevel(e){return this.reader.reset(e),this.readLevel()}readLevel(){let e=this.reader.u8(),t=e>>5,n=e&31;switch(t){case 4:return this.readArrLevel(n);case 5:return this.readObjLevel(n);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 n.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 n=0;n<e;n++){let e=this.key();t[e]=this.readPrimitiveOrVal()}return t}readObjIndefLevel(){let e={};for(;this.reader.peak()!==255;){let t=this.key();if(this.reader.peak()===255)throw 7;e[t]=this.readPrimitiveOrVal()}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 n=0;n<e;n++)t.push(this.readPrimitiveOrVal());return t}readArrIndefLevel(){let e=[];for(;this.reader.peak()!==255;)e.push(this.readPrimitiveOrVal());return this.reader.x++,e}readHdr(e){let t=this.reader.u8();if(t>>5!==e)throw 0;let n=t&31;if(n<24)return n;switch(n){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 n=0;n<t;n++){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 n=e[t];typeof n==`string`?this.findKey(n):this.findIndex(n)}return this}}})),Bn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CborDecoderDag=void 0;let t=Sn(),n=zn();e.CborDecoderDag=class extends n.CborDecoder{readTagRaw(e){let n=this.readAny();return e===42?new t.JsonPackExtension(e,n):n}}})),Vn=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(W(),c(L));t.__exportStar(_n(),e),t.__exportStar(bn(),e),t.__exportStar(wn(),e),t.__exportStar(Dn(),e),t.__exportStar(On(),e),t.__exportStar(Rn(),e),t.__exportStar(zn(),e),t.__exportStar(Bn(),e)}))();const G={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var K=class extends Error{constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}};const Hn=new Vn.CborEncoder,Un=new Vn.CborDecoder;function Wn(e){let t={...e,validationHash:Jn(e??{})};return Hn.encode(t)}function Gn(e){if(!e.length)throw new K(G.corruptedResponse,`Missing compressed data`);let t=qn(e);if(!t)throw new K(G.corruptedResponse,`Invalid compressed data`);if(!t?.validationHash)throw new K(G.corruptedResponse,`Missing validation hash`);let{validationHash:n,...r}=t,i=Jn(r);if(i!==t.validationHash)throw console.warn(`Validation error`,{validationHash:n,rawResultData:r,parsedData:t,expectedValidationHashes:i,recomputedHash:Jn(void 0)}),new K(G.corruptedResponse,`Invalid validation hash`);return t}function Kn(e){return Hn.encode(e)}function qn(e){try{return Un.decode(e)}catch(t){return console.error(`Invalid compressed data`,{e:t,data:e}),null}}function Jn(e){return It(Hn.encode(e))}const Yn=()=>({onRequest:(e,t)=>{if(e.data instanceof Uint8Array||ArrayBuffer.isView(e.data))return t;try{e.data=Wn(e.data)}catch(e){console.error(`[Compression Middleware] Failed to compress request`,e)}return t},onResponse:(e,t,n)=>{if(t.error||!(t.result instanceof Uint8Array||ArrayBuffer.isView(t.result)))return t;try{let{validationHash:e,...n}=Gn(t.result);typeof n==`object`&&n&&`result`in n?t.result=n.result:t.result=n}catch(e){console.error(`[Compression Middleware] Failed to decompress response`,e)}return t}});var Xn=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)}};function Zn(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function l(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function u(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function d(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function f(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await l(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await d(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function p(e){let n=e;try{n=await u(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function m(e){t.postMessage(e,r)}function h(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,f);function g(e){let t=h(),n=new Xn;return o.set(t,e=>{e.error?n.reject(new K(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),p({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function _(e,t){let n=h();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),p({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function v(){n.removeEventListener(`message`,f),o.clear()}return{request:g,listen:_,sendLifecycle:m,cleanup:v}}function Qn({domain:e}={}){return nt(S((e??window.location.host).replace(`www.`,``)))}function $n(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function er(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function tr(e){return $n(Kn(e))}function nr(e,t,n,r,i){let a=tr(rr({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,productId:n,metadata:{name:r,css:i,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink}})),o=new URL(e);return o.pathname=`/sso`,o.searchParams.set(`p`,a),o.toString()}function rr(e){return{r:e.redirectUrl,d:e.directExit,l:e.lang,p:e.productId,m:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}const ir=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,ar=`frak-sso`;async function or(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]});let a=t.ssoPopupUrl??nr(i??`https://wallet.frak.id`,t,Qn(),n.name,r?.css),o=window.open(a,ar,ir);if(!o)throw Error(`Popup was blocked. Please allow popups for this site.`);return o.focus(),await e.request({method:`frak_openSso`,params:[t,n.name,r?.css]})??{}}const sr=`fCtx`;function cr(e){if(e?.r)try{return $n(ge(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function lr(e){if(!(!e||e.length===0))try{return{r:le(er(e),{size:20})}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function ur({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(sr);return t?lr(t):null}function dr({url:e,context:t}){if(!e)return null;let n=ur({url:e}),r=n?{...n,...t}:t;if(!r.r)return null;let i=cr(r);if(!i)return null;let a=new URL(e);return a.searchParams.set(sr,i),a.toString()}function fr(e){let t=new URL(e);return t.searchParams.delete(sr),t.toString()}function pr({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?fr(n):dr({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const q={compress:cr,decompress:lr,parse:ur,update:dr,remove:fr,replaceUrl:pr};function mr(e,t,n={}){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}var hr=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,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},gr=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.3`,this.api=new hr({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.log(`track event`,e,t),this.send({type:`track`,payload:{name:e,profileId:t?.profileId??this.profileId,properties:{...this.global??{},...t??{}}}})}async identify(e){if(this.log(`identify user`,e),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){}async increment(e){return this.send({type:`increment`,payload:e})}async decrement(e){return this.send({type:`decrement`,payload:e})}async revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}async fetchDeviceId(){return(await this.api.fetch(`/track/device-id`,void 0,{method:`GET`,keepalive:!1}))?.deviceId??``}clear(){this.profileId=void 0}flush(){this.queue.forEach(e=>{this.send({...e,payload:{...e.payload,profileId:e.payload.profileId??this.profileId}})}),this.queue=[]}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}};function _r(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var vr=class extends gr{constructor(e){if(super({sdk:`web`,sdkVersion:`1.0.6`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),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,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[_r(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const J=`nexus-wallet-backup`;function yr(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}var br=class e{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?this.iframe.contentDocument.readyState===`complete`?1:0:-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(),n=this.getNavigatorInfo(),r=`Unknown`;return e instanceof K?r=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?r=e.message:typeof e==`string`&&(r=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):`no-config`,navigatorInfo:n?this.base64Encode(n):`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:r}}static empty(){return new e}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
9
7
  Debug Information:
10
8
  -----------------
11
9
  Timestamp: ${t.timestamp}
@@ -17,16 +15,4 @@ Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}
17
15
  Last Response: ${t.lastResponse}
18
16
  Client Status: ${t.clientStatus}
19
17
  Error: ${t.error}
20
- `.trim()}}let F={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 D({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id=F.id,n.name=F.name,n.allow=F.allow,n.style.zIndex=F.style.zIndex.toString(),N({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 N({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 M(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}};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 B({config:e,iframe:t}){let r,n=e?.walletUrl??"https://wallet.frak.id",i=function({iframe:e}){let t=new o.BH;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(U,i.backup):localStorage.removeItem(U);break;case"remove-backup":localStorage.removeItem(U);break;case"show":case"hide":N({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}),s=new R(e,t);if(!t.contentWindow)throw new o.u(o.ss.configError,"The iframe does not have a content window");let c=(0,o.i0)({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await i.isConnected)throw new o.u(o.ss.clientNotConnected,"The iframe provider isn't connected yet");return t}},(0,a.I)(),{onRequest:(e,t)=>(s.setLastRequest(e),t),onResponse:(e,t)=>(s.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 s(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,1e3),n=setTimeout(()=>{s(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,s()}(),s}(c,i),d=async()=>{u(),c.cleanup(),t.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(r=new l.J({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=$({config:e,rpcClient:c,lifecycleManager:i}).then(()=>s.updateSetupStatus(!0));return{config:e,debugInfo:s,waitForConnection:i.isConnected,waitForSetup:f,request:c.request,listenerRequest:c.listen,destroy:d,openPanel:r}}async function $({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 s(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(U);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(),s()])}let T={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function z(e){return e&&e in T?e:"eur"}async function q({config:e}){let t,r=(t=z(e.metadata?.currency),{...e,metadata:{...e.metadata,currency:t}}),n=await D({config:r});if(!n)return void console.error("Failed to create iframe");let i=B({config:r,iframe:n});return(await i.waitForSetup,await i.waitForConnection)?i:void console.error("Failed to connect to client")}function H(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function V(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 G(e){return H((0,o.Cz)(e))}function W(e){return(0,o.j4)(V(e))}let J="fCtx";function K(e){if(e?.r)try{let t=(0,c.nr)(e.r);return H(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function X(e){if(e&&0!==e.length)try{let t=V(e);return{r:(0,u.ci)(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Y({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(J);return t?X(t):null}function Q({url:e,context:t}){if(!e)return null;let r=Y({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=K(n);if(!i)return null;let s=new URL(e);return s.searchParams.set(J,i),s.toString()}function Z(e){let t=new URL(e);return t.searchParams.delete(J),t.toString()}let ee={compress:K,decompress:X,parse:Y,update:Q,remove:Z,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?Q({url:n,context:t}):Z(n))&&window.history.replaceState(null,"",r.toString())}};function et(e){return e?T[e]??T.eur:T.eur}function er(e){return e?`${e}Amount`:"eurAmount"}function en(e,t){let r=et(t),n=z(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}function ei(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 es(e,t,r,n,i){var s;let o=G({r:(s={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: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}}),a=new URL(e);return a.pathname="/sso",a.searchParams.set("p",o),a.toString()}let eo={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},ea=Object.entries(eo).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{}),el={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"}};function ec({domain:e}={}){return(0,d.w)((0,u.NC)((e??window.location.host).replace("www.","")))}let eu="menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800",ed="frak-sso";async function ef(e,t){let{metadata:r,customizations:n,walletUrl:i}=e.config;if(t.openInSameWindow??!!t.redirectUrl)return await e.request({method:"frak_openSso",params:[t,r.name,n?.css]});let s=t.ssoPopupUrl??es(i??"https://wallet.frak.id",t,ec(),r.name,n?.css),o=window.open(s,ed,eu);if(!o)throw Error("Popup was blocked. Please allow popups for this site.");return o.focus(),await e.request({method:"frak_openSso",params:[t,r.name,n?.css]})??{}}function eh(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(t=>(ep(e,t),t));let r=new o.BH,n=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},i=>{ep(e,i),t(i),n||(r.resolve(i),n=!0)}),r.promise}function ep(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 em(e,{productId:t,interaction:r,validation:n}){let i=t??ec(e.config);return await e.request({method:"frak_sendInteraction",params:[i,r,n]})}async function ew(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function eb(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}async function ey(e,t){let{metadata:r,customizations:n}=e.config;return await e.request({method:"frak_prepareSso",params:[t,r.name,n?.css]})}async function eg(e){return await e.request({method:"frak_getProductInformation"})}async function ev(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 ex(e,{siwe:t,metadata:r}){let i=e.config?.domain??window.location.host,s=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,o={...t,statement:s,nonce:t?.nonce??function(e=11){if(!n||L+e>512){n="",L=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(L,L+++e)}(96),uri:t?.uri??`https://${i}`,version:t?.version??"1",domain:i};return(await ew(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:o}}})).siweAuthenticate}async function ek(e,{tx:t,metadata:r}){return(await ew(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function ej(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await ew(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 e_={createLink:()=>({handlerTypeDenominator:(0,u.NC)(eo.referral),interactionData:el.referral.createLink}),referred({referrer:e}){let t=(0,f.SM)([el.referral.referred,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.referral),interactionData:t}}};async function eS(e,{walletStatus:t,frakContext:r,modalConfig:n,productId:i,options:s}){let a=!1;async function l(){if(!a)return a=!0,eI(e,{modalConfig:{...n,loggedIn:{action:{key:"referred"}}},walletStatus:t})}async function c(t){let r=e_.referred({referrer:t});await Promise.allSettled([em(e,{productId:i,interaction:r}),ei(e,"user_referred",{properties:{referrer:t}})])}try{let{status:e,currentWallet:n}=await eC({initialWalletStatus:t,getFreshWalletStatus:l,pushReferralInteraction:c,frakContext:r});return ee.replaceUrl({url:window.location?.href,context:s?.alwaysAppendUrl?{r:n}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),ee.replaceUrl({url:window.location?.href,context:s?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof o.u)switch(e.code){case o.ss.walletNotConnected:return"no-wallet";case o.ss.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function eC({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&(0,p.E)(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 eI(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await eb(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}async function eE(e,{productId:t,modalConfig:r,options:n}={}){let i=ee.parse({url:window.location.href}),s=await eh(e);try{return await eS(e,{walletStatus:s,frakContext:i,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}let eA={openArticle({articleId:e}){let t=(0,f.SM)([el.press.openArticle,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.press),interactionData:t}},readArticle({articleId:e}){let t=(0,f.SM)([el.press.readArticle,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.press),interactionData:t}}},eO={startPurchase({purchaseId:e}){let t=(0,f.SM)([el.purchase.started,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=function(e,t){if(e.length!==t.length)throw new g({expectedLength:e.length,givenLength:t.length});let r=P(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=function(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}(t.type);if(n){let[i,s]=n;return function(t,{length:r,param:n}){let i=null===r;if(!Array.isArray(t))throw new x(t);if(!i&&t.length!==r)throw new b({expectedLength:r,givenLength:t.length,type:`${n.type}[${r}]`});let s=!1,o=[];for(let r=0;r<t.length;r++){let i=e({param:n,value:t[r]});i.dynamic&&(s=!0),o.push(i)}if(i||s){let e=P(o);if(i){let t=(0,u.eC)(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?(0,f.zo)([t,e]):t}}if(s)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:(0,f.zo)(o.map(({encoded:e})=>e))}}(r,{length:i,param:{...t,type:s}})}if("tuple"===t.type)return function(t,{param:r}){let n=!1,i=[];for(let s=0;s<r.components.length;s++){let o=r.components[s],a=Array.isArray(t)?s:o.name,l=e({param:o,value:t[a]});i.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?P(i):(0,f.zo)(i.map(({encoded:e})=>e))}}(r,{param:t});if("address"===t.type){var i=r;if(!(0,S.U)(i))throw new j.b({address:i});return{dynamic:!1,encoded:(0,h.gc)(i.toLowerCase())}}if("bool"===t.type){var s=r;if("boolean"!=typeof s)throw new w.G(`Invalid boolean value: "${s}" (type: ${typeof s}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,h.gc)((0,u.C4)(s))}}if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,n="256"]=O.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 _.J5({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:(0,u.eC)(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=(0,m.d)(e);if(!r){let t=e;return n%32!=0&&(t=(0,h.gc)(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:(0,f.zo)([(0,h.gc)((0,u.eC)(n,{size:32})),t])}}if(n!==Number.parseInt(r))throw new y({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:(0,h.gc)(e,{dir:"right"})}}(r,{param:t});if("string"===t.type){var o=r;let e=(0,u.$G)(o),t=Math.ceil((0,m.d)(e)/32),n=[];for(let r=0;r<t;r++)n.push((0,h.gc)(function(e,t,r,{strict:n}={}){return(0,I.v)(e,{strict:!1})?function(e,t,r,{strict:n}={}){E(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&A(i,t,r),i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){E(e,t);let i=e.slice(t,r);return n&&A(i,t,r),i}(e,t,r,{strict:n})}(e,32*r,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:(0,f.zo)([(0,h.gc)((0,u.eC)((0,m.d)(e),{size:32})),...n])}}throw new v(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]),n=(0,f.SM)([el.purchase.completed,r]);return{handlerTypeDenominator:(0,u.NC)(eo.purchase),interactionData:n}},unsafeCompletedPurchase({purchaseId:e}){let t=(0,f.SM)([el.purchase.unsafeCompleted,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.purchase),interactionData:t}}},eP={open:()=>({handlerTypeDenominator:(0,u.NC)(eo.webshop),interactionData:el.webshop.open})},eL={customerMeeting({agencyId:e}){let t=(0,f.SM)([el.retail.customerMeeting,(0,h.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,u.NC)(eo.retail),interactionData:t}}};var eU=r("./src/components/ButtonWallet/utils.ts"),eR=r("./src/utils/clientReady.ts"),eF=r("./src/utils/setup.ts");async function eD(){if(window.FrakSetup.core=i,!(window.frakSetupInProgress?(console.log("[Frak SDK] Initialization already in progress"),!1):window.FrakSetup?.client?(console.log("[Frak SDK] Client already initialized"),!1):!!window.FrakSetup?.config||(console.error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set."),!1)))return;if(console.log("[Frak SDK] Starting initialization"),window.frakSetupInProgress=!0,!window.FrakSetup.config){console.error("[Frak SDK] Configuration not found"),window.frakSetupInProgress=!1;return}let e=await (0,s.lD)({config:window.FrakSetup.config});if(!e){console.error("[Frak SDK] Failed to create client"),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log("[Frak SDK] Client initialized successfully"),(0,eR.f)(),(0,eF.N3)(e),(0,eF.zK)(e),window.frakSetupInProgress=!1,function(){let e=new URLSearchParams(window.location.search).get("frakAction");e&&"share"===e&&(console.log("[Frak SDK] Auto open query param found"),(0,eU.G)())}()}},"./src/utils/setup.ts":function(e,t,r){r.d(t,{Gt:()=>o,N3:()=>i,zK:()=>s});var n=r("../core/dist/actions.js");function i(e){window.modalBuilderSteps=(0,n.jy)(e,window.FrakSetup?.modalConfig??{})}async function s(e){console.log("referral",await (0,n.KS)(e,{modalConfig:window.FrakSetup?.modalWalletConfig}))}function o(){if(!window.modalBuilderSteps)throw Error("modalBuilderSteps not found");return window.modalBuilderSteps}},"../core/dist/actions.js":function(e,t,r){r.d(t,{KS:()=>j,jy:()=>p,pO:()=>h,s9:()=>f});var n=r("../../packages/rpc/dist/index.js"),i=r("../../node_modules/viem/_esm/utils/hash/keccak256.js"),s=r("../../node_modules/viem/_esm/utils/encoding/toHex.js"),o=r("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),a=r("../../node_modules/viem/_esm/utils/data/concat.js"),l=r("../../node_modules/viem/_esm/utils/data/pad.js"),c=r("../../node_modules/viem/_esm/utils/address/isAddressEqual.js");async function u(e,{productId:t,interaction:r,validation:n}){let o=t??function({domain:e}={}){return(0,i.w)((0,s.NC)((e??window.location.host).replace("www.","")))}(e.config);return await e.request({method:"frak_sendInteraction",params:[o,r,n]})}async function d(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,r,e.config.metadata]})}async function f(e,t){return await e.request({method:"frak_displayEmbeddedWallet",params:[t,e.config.metadata]})}async function h(e){return await e.request({method:"frak_getProductInformation"})}function p(e,{metadata:t,login:r,openSession:n}){return function e(t,r){async function n(e){return e&&(r.metadata=e(r.metadata??{})),await d(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 m="fCtx";function w({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(m);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:(0,s.ci)(r,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}(t):null}let b={parse:w,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=w({url:e}),n=r?{...r,...t}:t;if(!n.r)return null;let i=function(e){if(e?.r)try{var t;return t=(0,o.nr)(e.r),btoa(Array.from(t,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}(n);if(!i)return null;let s=new URL(e);return s.searchParams.set(m,i),s.toString()}({url:i,context:t}):((n=new URL(i)).searchParams.delete(m),n.toString()))&&window.history.replaceState(null,"",r.toString())}},y={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(y).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});let g={createLink:()=>({handlerTypeDenominator:(0,s.NC)(y.referral),interactionData:"0xb2c0f17c"}),referred({referrer:e}){let t=(0,a.SM)(["0x010cc3b9",(0,l.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,s.NC)(y.referral),interactionData:t}}};async function v(e,{walletStatus:t,frakContext:r,modalConfig:i,productId:s,options:o}){let a=!1;async function l(){if(!a)return a=!0,k(e,{modalConfig:{...i,loggedIn:{action:{key:"referred"}}},walletStatus:t})}async function c(t){let r=g.referred({referrer:t});await Promise.allSettled([u(e,{productId:s,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 x({initialWalletStatus:t,getFreshWalletStatus:l,pushReferralInteraction:c,frakContext:r});return b.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:n}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),b.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof n.u)switch(e.code){case n.ss.walletNotConnected:return"no-wallet";case n.ss.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function x({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:n}){let i=e?.wallet;return n?.r?(i||(i=await t()),i&&(0,c.E)(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 k(e,{modalConfig:t,walletStatus:r}){if(!r?.interactionSession){let r=await f(e,t??{});return r?.wallet??void 0}return r.wallet??void 0}async function j(e,{productId:t,modalConfig:r,options:n}={}){var i,s;let o=b.parse({url:window.location.href}),a=await (i=e).request({method:"frak_listenToWalletStatus"}).then(e=>{var t,r;return t=i,r=e,"undefined"!=typeof window&&(t.openPanel?.setGlobalProperties({wallet:r.wallet??null}),r.interactionToken?window.sessionStorage.setItem("frak-wallet-interaction-token",r.interactionToken):window.sessionStorage.removeItem("frak-wallet-interaction-token")),e});try{return await v(e,{walletStatus:a,frakContext:o,modalConfig:r,productId:t,options:n})}catch(e){console.warn("Error processing referral",{error:e})}}},"../core/dist/index.js":function(e,t,r){r.d(t,{L9:()=>w,Up:()=>p,dN:()=>m,lD:()=>h,oC:()=>a});var n=r("../../packages/rpc/dist/index.js"),i=r("../../packages/rpc/dist/middleware.js"),s=r("../../node_modules/@openpanel/web/dist/index.js");let o="nexus-wallet-backup";class a{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(),i="Unknown";return e instanceof n.u?i=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?i=e.message:"string"==typeof e&&(i=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:i}}static empty(){return new a}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
21
- Debug Information:
22
- -----------------
23
- Timestamp: ${t.timestamp}
24
- URL: ${t.encodedUrl}
25
- Config: ${t.encodedConfig}
26
- Navigator Info: ${t.navigatorInfo}
27
- IFrame Status: ${t.iframeStatus}
28
- Last Request: ${t.lastRequest}
29
- Last Response: ${t.lastResponse}
30
- Client Status: ${t.clientStatus}
31
- Error: ${t.error}
32
- `.trim()}}let l=2000001;function c({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"}async function u({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 s(){if("undefined"==typeof window)return;let e=window.localStorage.getItem(o);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(),s()])}let d={eur:"fr-FR",usd:"en-US",gbp:"en-GB"};function f(e){return e&&e in d?e:"eur"}async function h({config:e}){let t,r=(t=f(e.metadata?.currency),{...e,metadata:{...e.metadata,currency:t}}),d=await function({walletBaseUrl:e,config:t}){let r=document.querySelector("#frak-wallet");r&&r.remove();let n=document.createElement("iframe");return n.id="frak-wallet",n.name="frak-wallet",n.allow="publickey-credentials-get *; clipboard-write; web-share *",n.style.zIndex=l.toString(),c({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`})}({config:r});if(!d)return void console.error("Failed to create iframe");let h=function({config:e,iframe:t}){let r,l=e?.walletUrl??"https://wallet.frak.id",d=function({iframe:e}){let t=new n.BH;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(o,i.backup):localStorage.removeItem(o);break;case"remove-backup":localStorage.removeItem(o);break;case"show":case"hide":c({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}),f=new a(e,t);if(!t.contentWindow)throw new n.u(n.ss.configError,"The iframe does not have a content window");let h=(0,n.i0)({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:l,middleware:[{async onRequest(e,t){if(!await d.isConnected)throw new n.u(n.ss.clientNotConnected,"The iframe provider isn't connected yet");return t}},(0,i.I)(),{onRequest:(e,t)=>(f.setLastRequest(e),t),onResponse:(e,t)=>(f.setLastResponse(e,t),t)}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await d.handleEvent(e)}}}),p=function(e,t){let r,n,i=()=>e.sendLifecycle({clientLifecycle:"heartbeat"});function s(){r&&clearInterval(r),n&&clearTimeout(n)}return async function(){i(),r=setInterval(i,1e3),n=setTimeout(()=>{s(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,s()}(),s}(h,d),m=async()=>{p(),h.cleanup(),t.remove()};console.log("[Frak SDK] Initializing OpenPanel"),(r=new s.J({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 w=u({config:e,rpcClient:h,lifecycleManager:d}).then(()=>f.updateSetupStatus(!0));return{config:e,debugInfo:f,waitForConnection:d.isConnected,waitForSetup:w,request:h.request,listenerRequest:h.listen,destroy:m,openPanel:r}}({config:r,iframe:d});return(await h.waitForSetup,await h.waitForConnection)?h:void console.error("Failed to connect to client")}function p(e){return e?`${e}Amount`:"eurAmount"}function m(e,t){let r=t?d[t]??d.eur:d.eur,n=f(t);return e.toLocaleString(r,{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2})}function w(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)}}Object.entries({dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31}).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{})},"../../node_modules/@noble/hashes/esm/_u64.js":function(e,t,r){r.d(t,{$p:()=>d,EP:()=>f,FL:()=>u,Fn:()=>y,IH:()=>w,Iq:()=>a,NI:()=>o,Ou:()=>c,SD:()=>p,Vl:()=>s,Xb:()=>g,ac:()=>b,gm:()=>h,m_:()=>l,mk:()=>m,pp:()=>k,u8:()=>v,zP:()=>x});let n=BigInt(0x100000000-1),i=BigInt(32);function s(e,t=!1){let r=e.length,o=new Uint32Array(r),a=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l}=function(e,t=!1){return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}(e[s],t);[o[s],a[s]]=[r,l]}return[o,a]}let o=(e,t,r)=>e>>>r,a=(e,t,r)=>e<<32-r|t>>>r,l=(e,t,r)=>e>>>r|t<<32-r,c=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e<<64-r|t>>>r-32,d=(e,t,r)=>e>>>r-32|t<<64-r,f=(e,t,r)=>e<<r|t>>>32-r,h=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,m=(e,t,r)=>e<<r-32|t>>>64-r;function w(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/0x100000000|0)|0,l:0|i}}let b=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),y=(e,t,r,n)=>t+r+n+(e/0x100000000|0)|0,g=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),v=(e,t,r,n,i)=>t+r+n+i+(e/0x100000000|0)|0,x=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),k=(e,t,r,n,i,s)=>t+r+n+i+s+(e/0x100000000|0)|0},"../../node_modules/@noble/hashes/esm/utils.js":function(e,t,r){function n(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function i(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 s(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 o(e,t){i(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function l(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function u(e,t){return e<<32-t|e>>>t}r.d(t,{$h:()=>s,GL:()=>c,Jq:()=>a,O0:()=>f,Ux:()=>d,V1:()=>p,eB:()=>o,gk:()=>i,k8:()=>n,kb:()=>h,np:()=>u,ru:()=>l});let d=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 f(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),i(e),e}class h{}function p(e){let t=t=>e().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}},"../../node_modules/@openpanel/web/dist/index.js":function(e,t,r){r.d(t,{J:()=>s});var n=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)}},i=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 n({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=[]}},s=class extends i{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})))}}},"../../node_modules/tslib/tslib.es6.mjs":function(e,t,r){r.r(t),r.d(t,{__addDisposableResource:()=>F,__assign:()=>s,__asyncDelegator:()=>S,__asyncGenerator:()=>_,__asyncValues:()=>C,__await:()=>j,__awaiter:()=>p,__classPrivateFieldGet:()=>L,__classPrivateFieldIn:()=>R,__classPrivateFieldSet:()=>U,__createBinding:()=>w,__decorate:()=>a,__disposeResources:()=>N,__esDecorate:()=>c,__exportStar:()=>b,__extends:()=>i,__generator:()=>m,__importDefault:()=>P,__importStar:()=>O,__makeTemplateObject:()=>I,__metadata:()=>h,__param:()=>l,__propKey:()=>d,__read:()=>g,__rest:()=>o,__rewriteRelativeImportExtension:()=>M,__runInitializers:()=>u,__setFunctionName:()=>f,__spread:()=>v,__spreadArray:()=>k,__spreadArrays:()=>x,__values:()=>y,default:()=>B});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 s=function(){return(s=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 o(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,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function l(e,t){return function(r,n){t(r,n,e)}}function c(e,t,r,n,i,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,l=n.kind,c="getter"===l?"get":"setter"===l?"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 m in n)p[m]="access"===m?{}:n[m];for(var m in n.access)p.access[m]=n.access[m];p.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var w=(0,r[h])("accessor"===l?{get:d.get,set:d.set}:d[c],p);if("accessor"===l){if(void 0===w)continue;if(null===w||"object"!=typeof w)throw TypeError("Object expected");(a=o(w.get))&&(d.get=a),(a=o(w.set))&&(d.set=a),(a=o(w.init))&&i.unshift(a)}else(a=o(w))&&("field"===l?i.unshift(a):d[c]=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,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}function m(e,t){var r,n,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var c=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&c[0]?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,n=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(6===c[0]&&s.label<i[1]){s.label=i[1],i=c;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(c);break}i[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],n=0}finally{r=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var w=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 b(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||w(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,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function v(){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 s=arguments[t],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function k(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;i<s;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 j(e){return this instanceof j?(this.v=e,this):new j(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),s=[];return n=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){i[e]&&(n[e]=function(t){return new Promise(function(r,n){s.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 j?Promise.resolve(r.value.v).then(l,c):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[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:j(e[n](t)),done:!1}:i?i(t):t}:i}}function C(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 s,o,a;s=n,o=i,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:a})},o)})}}}function I(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var E=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},A=function(e){return(A=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=A(e),n=0;n<r.length;n++)"default"!==r[n]&&w(t,e,r[n]);return E(t,e),t}function P(e){return e&&e.__esModule?e:{default:e}}function L(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 U(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 F(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 D="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function N(e){function t(t){e.error=e.hasError?new D(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 s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).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 M(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,n,i,s){return r?t?".jsx":".js":!n||i&&s?n+i+"."+s.toLowerCase()+"js":e}):e}let B={__extends:i,__assign:s,__rest:o,__decorate:a,__param:l,__esDecorate:c,__runInitializers:u,__propKey:d,__setFunctionName:f,__metadata:h,__awaiter:p,__generator:m,__createBinding:w,__exportStar:b,__values:y,__read:g,__spread:v,__spreadArrays:x,__spreadArray:k,__await:j,__asyncGenerator:_,__asyncDelegator:S,__asyncValues:C,__makeTemplateObject:I,__importStar:O,__importDefault:P,__classPrivateFieldGet:L,__classPrivateFieldSet:U,__classPrivateFieldIn:R,__addDisposableResource:F,__disposeResources:N,__rewriteRelativeImportExtension:M}},"../../node_modules/viem/_esm/errors/address.js":function(e,t,r){r.d(t,{b:()=>i});var n=r("../../node_modules/viem/_esm/errors/base.js");class i extends n.G{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"})}}},"../../node_modules/viem/_esm/errors/base.js":function(e,t,r){r.d(t,{G:()=>s});let n="2.31.2",i={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${n}`};class s extends Error{constructor(e,t={}){let r=t.cause instanceof s?t.cause.details:t.cause?.message?t.cause.message:t.details,o=t.cause instanceof s&&t.cause.docsPath||t.docsPath,a=i.getDocsUrl?.({...t,docsPath:o});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...i.version?[`Version: ${i.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=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=n}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)}}},"../../node_modules/viem/_esm/errors/data.js":function(e,t,r){r.d(t,{$s:()=>s,mV:()=>i});var n=r("../../node_modules/viem/_esm/errors/base.js");class i extends n.G{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 s extends n.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}n.G},"../../node_modules/viem/_esm/errors/encoding.js":function(e,t,r){r.d(t,{J5:()=>i,M6:()=>s});var n=r("../../node_modules/viem/_esm/errors/base.js");class i extends n.G{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"})}}n.G,n.G,n.G;class s extends n.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}},"../../node_modules/viem/_esm/utils/address/isAddress.js":function(e,t,r){r.d(t,{U:()=>c});class n 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}}var i=r("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),s=r("../../node_modules/viem/_esm/utils/hash/keccak256.js");let o=new n(8192),a=/^0x[a-fA-F0-9]{40}$/,l=new n(8192);function c(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(l.has(n))return l.get(n);let c=!!a.test(e)&&(e.toLowerCase()===e||!r||function(e,t){if(o.has(`${e}.undefined`))return o.get(`${e}.${void 0}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=(0,s.w)((0,i.qX)(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&a[e]&&(a[e]=a[e].toUpperCase()),(15&n[e>>1])>=8&&a[e+1]&&(a[e+1]=a[e+1].toUpperCase());let l=`0x${a.join("")}`;return o.set(`${e}.${t}`,l),l}(e)===e);return l.set(n,c),c}},"../../node_modules/viem/_esm/utils/address/isAddressEqual.js":function(e,t,r){r.d(t,{E:()=>s});var n=r("../../node_modules/viem/_esm/errors/address.js"),i=r("../../node_modules/viem/_esm/utils/address/isAddress.js");function s(e,t){if(!(0,i.U)(e,{strict:!1}))throw new n.b({address:e});if(!(0,i.U)(t,{strict:!1}))throw new n.b({address:t});return e.toLowerCase()===t.toLowerCase()}},"../../node_modules/viem/_esm/utils/data/concat.js":function(e,t,r){function n(e){return"string"==typeof e[0]?i(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 i(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}r.d(t,{SM:()=>i,zo:()=>n})},"../../node_modules/viem/_esm/utils/data/isHex.js":function(e,t,r){r.d(t,{v:()=>n});function n(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}},"../../node_modules/viem/_esm/utils/data/pad.js":function(e,t,r){r.d(t,{gc:()=>s,vk:()=>i});var n=r("../../node_modules/viem/_esm/errors/data.js");function i(e,{dir:t,size:r=32}={}){return"string"==typeof e?s(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new n.$s({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;n<r;n++){let s="right"===t;i[s?n:r-n-1]=e[s?n:e.length-n-1]}return i}(e,{dir:t,size:r})}function s(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new n.$s({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}},"../../node_modules/viem/_esm/utils/data/size.js":function(e,t,r){r.d(t,{d:()=>i});var n=r("../../node_modules/viem/_esm/utils/data/isHex.js");function i(e){return(0,n.v)(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}},"../../node_modules/viem/_esm/utils/encoding/fromHex.js":function(e,t,r){r.d(t,{Yf:()=>s});var n=r("../../node_modules/viem/_esm/errors/encoding.js"),i=r("../../node_modules/viem/_esm/utils/data/size.js");function s(e,{size:t}){if((0,i.d)(e)>t)throw new n.M6({givenSize:(0,i.d)(e),maxSize:t})}},"../../node_modules/viem/_esm/utils/encoding/toBytes.js":function(e,t,r){r.d(t,{O0:()=>c,nr:()=>f,qX:()=>h});var n=r("../../node_modules/viem/_esm/errors/base.js"),i=r("../../node_modules/viem/_esm/utils/data/isHex.js"),s=r("../../node_modules/viem/_esm/utils/data/pad.js"),o=r("../../node_modules/viem/_esm/utils/encoding/fromHex.js"),a=r("../../node_modules/viem/_esm/utils/encoding/toHex.js");let l=new TextEncoder;function c(e,t={}){var r,n;return"number"==typeof e||"bigint"==typeof e?(r=e,n=t,f((0,a.eC)(r,n))):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?((0,o.Yf)(r,{size:t.size}),(0,s.vk)(r,{size:t.size})):r}(e,t):(0,i.v)(e)?f(e,t):h(e,t)}let u={zero:48,nine:57,A:65,F:70,a:97,f:102};function d(e){return e>=u.zero&&e<=u.nine?e-u.zero:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function f(e,t={}){let r=e;t.size&&((0,o.Yf)(r,{size:t.size}),r=(0,s.vk)(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let a=i.length/2,l=new Uint8Array(a);for(let e=0,t=0;e<a;e++){let r=d(i.charCodeAt(t++)),s=d(i.charCodeAt(t++));if(void 0===r||void 0===s)throw new n.G(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);l[e]=16*r+s}return l}function h(e,t={}){let r=l.encode(e);return"number"==typeof t.size?((0,o.Yf)(r,{size:t.size}),(0,s.vk)(r,{dir:"right",size:t.size})):r}},"../../node_modules/viem/_esm/utils/encoding/toHex.js":function(e,t,r){r.d(t,{$G:()=>f,C4:()=>l,NC:()=>a,ci:()=>c,eC:()=>u});var n=r("../../node_modules/viem/_esm/errors/encoding.js"),i=r("../../node_modules/viem/_esm/utils/data/pad.js"),s=r("../../node_modules/viem/_esm/utils/encoding/fromHex.js");let o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function a(e,t={}){return"number"==typeof e||"bigint"==typeof e?u(e,t):"string"==typeof e?f(e,t):"boolean"==typeof e?l(e,t):c(e,t)}function l(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?((0,s.Yf)(r,{size:t.size}),(0,i.vk)(r,{size:t.size})):r}function c(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=o[e[t]];let n=`0x${r}`;return"number"==typeof t.size?((0,s.Yf)(n,{size:t.size}),(0,i.vk)(n,{dir:"right",size:t.size})):n}function u(e,t={}){let r,{signed:s,size:o}=t,a=BigInt(e);o?r=s?(1n<<8n*BigInt(o)-1n)-1n:2n**(8n*BigInt(o))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let l="bigint"==typeof r&&s?-r-1n:0;if(r&&a>r||a<l){let t="bigint"==typeof e?"n":"";throw new n.J5({max:r?`${r}${t}`:void 0,min:`${l}${t}`,signed:s,size:o,value:`${e}${t}`})}let c=`0x${(s&&a<0?(1n<<BigInt(8*o))+BigInt(a):a).toString(16)}`;return o?(0,i.vk)(c,{size:o}):c}let d=new TextEncoder;function f(e,t={}){return c(d.encode(e),t)}},"../../node_modules/viem/_esm/utils/hash/keccak256.js":function(e,t,r){let n,i,s;r.d(t,{w:()=>I});var o=r("../../node_modules/@noble/hashes/esm/_u64.js"),a=r("../../node_modules/@noble/hashes/esm/utils.js");let l=BigInt(0),c=BigInt(1),u=BigInt(2),d=BigInt(7),f=BigInt(256),h=BigInt(113),p=[],m=[],w=[];for(let e=0,t=c,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],p.push(2*(5*n+r)),m.push((e+1)*(e+2)/2%64);let i=l;for(let e=0;e<7;e++)(t=(t<<c^(t>>d)*h)%f)&u&&(i^=c<<(c<<BigInt(e))-c);w.push(i)}let b=(0,o.Vl)(w,!0),y=b[0],g=b[1],v=(e,t,r)=>r>32?(0,o.SD)(e,t,r):(0,o.EP)(e,t,r),x=(e,t,r)=>r>32?(0,o.mk)(e,t,r):(0,o.gm)(e,t,r);class k extends a.kb{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,(0,a.k8)(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,a.Jq)(this.state)}clone(){return this._cloneInto()}keccak(){(0,a.Ux)(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,s=r[i],o=r[i+1],a=v(s,o,1)^r[n],l=x(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=m[r],s=v(t,i,n),o=x(t,i,n),a=p[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}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]^=y[n],e[1]^=g[n]}(0,a.ru)(r)}(this.state32,this.rounds),(0,a.Ux)(this.state32),this.posOut=0,this.pos=0}update(e){(0,a.$h)(this),e=(0,a.O0)(e),(0,a.gk)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;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){(0,a.$h)(this,!1),(0,a.gk)(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 s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,a.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,a.eB)(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,(0,a.ru)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new k(t,r,n,s,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=s,e.destroyed=this.destroyed,e}}let j=(n=1,i=136,s=32,(0,a.V1)(()=>new k(i,n,s)));var _=r("../../node_modules/viem/_esm/utils/data/isHex.js"),S=r("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),C=r("../../node_modules/viem/_esm/utils/encoding/toHex.js");function I(e,t){let r=j((0,_.v)(e,{strict:!1})?(0,S.O0)(e):e);return"bytes"===(t||"hex")?r:(0,C.NC)(r)}}},i={};function s(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,s),r.exports}if(s.m=n,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+(({438:"button-wallet",766:"button-share"})[e]||e)+"."+({438:"0a2b7d12",564:"74bbd23d",766:"4d8a18a0"})[e]+".js",s.miniCssF=e=>""+({438:"button-wallet",766:"button-share"})[e]+"."+({438:"390d543a",766:"823884d0"})[e]+".css",s.h=()=>"5b55fb74b8b755cb",s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},"string"==typeof import.meta.url&&(e=import.meta.url),!e)throw Error("Automatic publicPath is not supported in this browser");if(s.p=e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),"undefined"!=typeof document){var o=function(e,t,r,n,i){var o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",s.nc&&(o.nonce=s.nc),o.onerror=o.onload=function(r){if(o.onerror=o.onload=null,"load"===r.type)n();else{var s=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.href||t,l=Error("Loading CSS chunk "+e+" failed.\\n("+a+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=s,l.request=a,o.parentNode&&o.parentNode.removeChild(o),i(l)}},o.href=t,r?r.parentNode.insertBefore(o,r.nextSibling):document.head.appendChild(o),o},a=function(e,t){for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var i=r[n],s=i.getAttribute("data-href")||i.getAttribute("href");if("stylesheet"===i.rel&&(s===e||s===t))return i}for(var o=document.getElementsByTagName("style"),n=0;n<o.length;n++){var i=o[n],s=i.getAttribute("data-href");if(s===e||s===t)return i}},l={276:0};s.f.miniCss=function(e,t){if(l[e])t.push(l[e]);else 0!==l[e]&&({438:1,766:1})[e]&&t.push(l[e]=new Promise(function(t,r){var n=s.miniCssF(e),i=s.p+n;if(a(n,i))return t();o(e,i,null,t,r)}).then(function(){l[e]=0},function(t){throw delete l[e],t}))}}t={276:0},r=e=>{var r,n,i=e.__webpack_ids__,o=e.__webpack_modules__,a=e.__webpack_runtime__,l=0;for(r in o)s.o(o,r)&&(s.m[r]=o[r]);for(a&&a(s);l<i.length;l++)n=i[l],s.o(t,n)&&t[n]&&t[n][0](),t[i[l]]=0},s.f.j=function(e,n){var i=s.o(t,e)?t[e]:void 0;if(0!==i)if(i)n.push(i[1]);else{var o=import("./"+s.u(e)).then(r,r=>{throw 0!==t[e]&&(t[e]=void 0),r}),o=Promise.race([o,new Promise(r=>{i=t[e]=[r]})]);n.push(i[1]=o)}};var c=s("../../packages/ui/utils/onDocumentReady.ts"),u=s("./src/utils/initFrakSdk.ts");(0,c.E)(u.m);const d={"button-share":()=>Promise.all([s.e("564"),s.e("766")]).then(s.bind(s,"./src/components/ButtonShare/index.ts")),"button-wallet":()=>Promise.all([s.e("564"),s.e("438")]).then(s.bind(s,"./src/components/ButtonWallet/index.ts"))},f=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&h(e)});async function h(e){let t=e instanceof Element?e.tagName.toLowerCase():"",r=t?.startsWith("frak-"),n=Array.from(e.querySelectorAll(":not(:defined)")).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith("frak-"));r&&!customElements.get(t)&&n.push(t);let i=[...new Set(n)];await Promise.allSettled(i.map(e=>p(e)))}async function p(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,"");if(!(t in d))throw Error(`Component ${e} is not supported.`);await d[t]()}catch(e){console.error(e)}}h(document.body),f.observe(document.documentElement,{subtree:!0,childList:!0});
18
+ `.trim()}};const Y={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 xr({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);return r.id=Y.id,r.name=Y.name,r.allow=Y.allow,r.style.zIndex=Y.style.zIndex.toString(),Sr({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(n=>{r?.addEventListener(`load`,()=>n(r)),r.src=`${t?.walletUrl??e??`https://wallet.frak.id`}/listener`})}function Sr({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 Cr(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 n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function wr({iframe:e}){let t=new Xn;return{handleEvent:async n=>{if(!(`iframeLifecycle`in n))return;let{iframeLifecycle:r,data:i}=n;switch(r){case`connected`:t.resolve(!0);break;case`do-backup`:i.backup?localStorage.setItem(J,i.backup):localStorage.removeItem(J);break;case`remove-backup`:localStorage.removeItem(J);break;case`show`:case`hide`:Sr({iframe:e,isVisible:r===`show`});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;break}}},isConnected:t.promise}}function Tr({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=wr({iframe:t}),i=new br(e,t);if(!t.contentWindow)throw new K(G.configError,`The iframe does not have a content window`);let a=Zn({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await r.isConnected)throw new K(G.clientNotConnected,`The iframe provider isn't connected yet`);return t}},Yn(),{onRequest(e,t){return i.setLastRequest(e),t},onResponse(e,t){return i.setLastResponse(e,t),t}}],lifecycleHandlers:{iframeLifecycle:async(e,t)=>{await r.handleEvent(e)}}}),o=Er(a,r),s=async()=>{o(),a.cleanup(),t.remove()},c;console.log(`[Frak SDK] Initializing OpenPanel`),c=new vr({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdkVersion`in t.properties||(t.properties={...t.properties,sdkVersion:`0.1.0`}),!0)}),c.setGlobalProperties({sdkVersion:`0.1.0`}),c.init();let l=Dr({config:e,rpcClient:a,lifecycleManager:r}).then(()=>i.updateSetupStatus(!0));return{config:e,debugInfo:i,waitForConnection:r.isConnected,waitForSetup:l,request:a.request,listenerRequest:a.listen,destroy:s,openPanel:c}}function Er(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,1e3),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function Dr({config:e,rpcClient:t,lifecycleManager:n}){await n.isConnected,yr(t,n.isConnected);async function r(){let n=e.customizations?.css;if(!n)return;let r={clientLifecycle:`modal-css`,data:{cssLink:n}};t.sendLifecycle(r)}async function i(){let n=e.customizations?.i18n;if(!n)return;let r={clientLifecycle:`modal-i18n`,data:{i18n:n}};t.sendLifecycle(r)}async function a(){if(typeof window>`u`)return;let e=window.localStorage.getItem(J);if(!e)return;let n={clientLifecycle:`restore-backup`,data:{backup:e}};t.sendLifecycle(n)}await Promise.allSettled([r(),i(),a()])}function Or(e){return qn(er(e))}const X={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function kr(e){return e&&e in X?e:`eur`}function Ar(e){return e?X[e]??X.eur:X.eur}function jr(e,t){let n=Ar(t),r=kr(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Mr(e){return e?`${e}Amount`:`eurAmount`}async function Nr({config:e}){let t=Pr(e),n=await xr({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=Tr({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function Pr(e){let t=kr(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}const Z={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`}},Q={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Fr=Object.entries(Q).reduce((e,[t,n])=>(e[t]=BigInt(1)<<BigInt(n),e),{}),Ir={openArticle({articleId:e}){let t=M([Z.press.openArticle,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.press),interactionData:t}},readArticle({articleId:e}){let t=M([Z.press.readArticle,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.press),interactionData:t}}},Lr={startPurchase({purchaseId:e}){let t=M([Z.purchase.started,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let n=_t([{type:`uint256`},{type:`bytes32[]`}],[BigInt(e),t]),r=M([Z.purchase.completed,n]);return{handlerTypeDenominator:S(Q.purchase),interactionData:r}},unsafeCompletedPurchase({purchaseId:e}){let t=M([Z.purchase.unsafeCompleted,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.purchase),interactionData:t}}},Rr={createLink(){return{handlerTypeDenominator:S(Q.referral),interactionData:Z.referral.createLink}},referred({referrer:e}){let t=M([Z.referral.referred,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.referral),interactionData:t}}},zr={customerMeeting({agencyId:e}){let t=M([Z.retail.customerMeeting,y(e,{size:32})]);return{handlerTypeDenominator:S(Q.retail),interactionData:t}}},Br={open(){return{handlerTypeDenominator:S(Q.webshop),interactionData:Z.webshop.open}}};function Vr(){return Rt(96)}async function $(e,t){return await e.request({method:`frak_displayEmbeddedWallet`,params:[t,e.config.metadata]})}async function Hr(e,{steps:t,metadata:n}){return await e.request({method:`frak_displayModal`,params:[t,n,e.config.metadata]})}async function Ur(e){return await e.request({method:`frak_getProductInformation`})}async function Wr(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Gr(e,{walletStatus:t,frakContext:n,modalConfig:r,productId:i,options:a}){let o=!1;async function s(){if(!o)return o=!0,qr(e,{modalConfig:{...r,loggedIn:{action:{key:`referred`}}},walletStatus:t})}async function c(t){let n=Rr.referred({referrer:t});await Promise.allSettled([Xr(e,{productId:i,interaction:n}),mr(e,`user_referred`,{properties:{referrer:t}})])}try{let{status:e,currentWallet:r}=await Kr({initialWalletStatus:t,getFreshWalletStatus:s,pushReferralInteraction:c,frakContext:n});return q.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r}:null}),e}catch(e){return console.log(`Error processing referral`,{error:e}),q.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r:t?.wallet}:null}),Jr(e)}}async function Kr({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:n,frakContext:r}){let i=e?.wallet;return r?.r?(i||=await t(),i&&Lt(r.r,i)?{status:`self-referral`,currentWallet:i}:(e?.interactionSession||(i=await t()),await n(r.r),{status:`success`,currentWallet:i})):{status:`no-referrer`,currentWallet:i}}async function qr(e,{modalConfig:t,walletStatus:n}){return n?.interactionSession?n.wallet??void 0:(await $(e,t??{}))?.wallet??void 0}function Jr(e){if(e instanceof K)switch(e.code){case G.walletNotConnected:return`no-wallet`;case G.serverErrorForInteractionDelegation:return`no-session`;default:return`error`}return`error`}async function Yr(e,{productId:t,modalConfig:n,options:r}={}){let i=q.parse({url:window.location.href}),a=await Qr(e);try{return await Gr(e,{walletStatus:a,frakContext:i,modalConfig:n,productId:t,options:r})}catch(e){console.warn(`Error processing referral`,{error:e})}}async function Xr(e,{productId:t,interaction:n,validation:r}){let i=t??Qn(e.config);return await e.request({method:`frak_sendInteraction`,params:[i,n,r]})}async function Zr(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`);if(!t){console.warn(`[Frak] No frak session found, skipping purchase check`);return}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)})}function Qr(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>($r(e,t),t));let n=new Xn,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{$r(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function $r(e,t){typeof window>`u`||(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 ei(e,{metadata:t,login:n,openSession:r}){return ti(e,{steps:{login:n??{},openSession:r??{}},metadata:t})}function ti(e,t){function n(n){return ti(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return ti(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return ti(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n){return n&&(t.metadata=n(t.metadata??{})),await Hr(e,t)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function ni(e,{tx:t,metadata:n}){return(await Hr(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}async function ri(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await Hr(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??Vr(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var ii=o({DebugInfoGatherer:()=>br,FrakContextManager:()=>q,PressInteractionEncoder:()=>Ir,PurchaseInteractionEncoder:()=>Lr,ReferralInteractionEncoder:()=>Rr,RetailInteractionEncoder:()=>zr,WebShopInteractionEncoder:()=>Br,base64urlDecode:()=>er,base64urlEncode:()=>$n,baseIframeProps:()=>Y,compressJsonToB64:()=>tr,createIFrameFrakClient:()=>Tr,createIframe:()=>xr,decompressJsonFromB64:()=>Or,displayEmbeddedWallet:()=>$,displayModal:()=>Hr,findIframeInOpener:()=>Cr,formatAmount:()=>jr,generateSsoUrl:()=>nr,getCurrencyAmountKey:()=>Mr,getProductInformation:()=>Ur,getSupportedCurrency:()=>kr,getSupportedLocale:()=>Ar,interactionTypes:()=>Z,locales:()=>X,modalBuilder:()=>ei,openSso:()=>or,prepareSso:()=>Wr,processReferral:()=>Gr,productTypes:()=>Q,productTypesMask:()=>Fr,referralInteraction:()=>Yr,sendInteraction:()=>Xr,sendTransaction:()=>ni,setupClient:()=>Nr,siweAuthenticate:()=>ri,ssoPopupFeatures:()=>ir,ssoPopupName:()=>ar,trackEvent:()=>mr,trackPurchaseStatus:()=>Zr,watchWalletStatus:()=>Qr});function ai(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function oi(){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}ai(),$(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}const si=`frakClientReady`;function ci(){let e=new CustomEvent(si);window.dispatchEvent(e)}function li(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(si,t,!1)}function ui(e){window.modalBuilderSteps=ei(e,window.FrakSetup?.modalConfig??{})}async function di(e){let t=await Yr(e,{modalConfig:window.FrakSetup?.modalWalletConfig});console.log(`referral`,t)}function fi(){if(!window.modalBuilderSteps)throw Error(`modalBuilderSteps not found`);return window.modalBuilderSteps}async function pi(){if(window.FrakSetup.core=ii,!mi())return;if(console.log(`[Frak SDK] Starting initialization`),window.frakSetupInProgress=!0,!window.FrakSetup.config){console.error(`[Frak SDK] Configuration not found`),window.frakSetupInProgress=!1;return}let e=await Nr({config:window.FrakSetup.config});if(!e){console.error(`[Frak SDK] Failed to create client`),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),ci(),ui(e),di(e),window.frakSetupInProgress=!1,hi()}function mi(){return window.frakSetupInProgress?(console.log(`[Frak SDK] Initialization already in progress`),!1):window.FrakSetup?.client?(console.log(`[Frak SDK] Client already initialized`),!1):window.FrakSetup?.config?!0:(console.error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`),!1)}function hi(){let e=new URLSearchParams(window.location.search).get(`frakAction`);e&&e===`share`&&(console.log(`[Frak SDK] Auto open query param found`),oi())}function gi(){let e=`frak-components-styles`;if(document.getElementById(e))return;let t=import.meta.url,n=t.substring(0,t.lastIndexOf(`/`)),r=document.createElement(`link`);r.id=e,r.rel=`stylesheet`,r.href=`${n}/loader.css`,document.head.appendChild(r)}gi(),l(pi);const _i={"button-share":()=>import(`./ButtonShare.B47PURL1.js`),"button-wallet":()=>import(`./ButtonWallet.mI8LYqkU.js`)},vi=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&yi(e)});async function yi(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>bi(e)))}async function bi(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in _i))throw Error(`Component ${e} is not supported.`);await _i[t]()}catch(e){console.error(e)}}yi(document.body),vi.observe(document.documentElement,{subtree:!0,childList:!0});export{Ur as a,br as c,K as d,G as f,oi as i,Mr as l,fi as n,$ as o,l as p,li as r,jr as s,pi as t,mr as u};
@@ -1 +1,2 @@
1
- .spinner-KHk8mw{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.spinner__leaf-xtOJmT{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:rt-spinner-leaf-fade-OXYBVY var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%}.spinner__leaf-xtOJmT:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}.spinner__leaf-xtOJmT:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}.spinner__leaf-xtOJmT:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}.spinner__leaf-xtOJmT:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}.spinner__leaf-xtOJmT:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}.spinner__leaf-xtOJmT:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}.spinner__leaf-xtOJmT:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}.spinner__leaf-xtOJmT:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}.spinner__leaf-xtOJmT:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}@keyframes rt-spinner-leaf-fade-OXYBVY{0%{opacity:1}to{opacity:.25}}.buttonShare-F23Y9m{justify-content:center;align-items:center;gap:10px;display:flex}
1
+ .M4fSKa_spinner{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.M4fSKa_spinner__leaf{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:M4fSKa_rt-spinner-leaf-fade var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%;&:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}&:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}&:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}&:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}&:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}&:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}&:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}&:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}&:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}}@keyframes M4fSKa_rt-spinner-leaf-fade{0%{opacity:1}to{opacity:.25}}
2
+ .nOB7Uq_buttonShare{justify-content:center;align-items:center;gap:10px;display:flex}