@frak-labs/core-sdk 0.0.5 → 0.0.7
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/bundle.js +7 -7
- package/dist/actions/index.cjs +30 -34
- package/dist/actions/index.d.cts +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +22 -26
- package/dist/{chunk-PO6YSB4Q.cjs → chunk-665P7NO4.cjs} +0 -3
- package/dist/{chunk-IVQL5N55.cjs → chunk-7YDJDVXY.cjs} +21 -25
- package/dist/{chunk-XDZMP74U.js → chunk-GTBCSNLF.js} +18 -22
- package/dist/{chunk-ZDGHKI3S.cjs → chunk-PHVGCFDX.cjs} +19 -19
- package/dist/{chunk-GDH3M5ZC.js → chunk-U2NTN5QZ.js} +1 -3
- package/dist/{chunk-RMOFMRZR.js → chunk-VE6URIIJ.js} +1 -1
- package/dist/{context-C7RkT8hA.d.cts → context-D7aZDKLT.d.cts} +4 -0
- package/dist/{context-CJ5ByAXa.d.ts → context-rDsQbSgB.d.ts} +4 -0
- package/dist/index.cjs +44 -51
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -20
- package/dist/interactions/index.cjs +6 -6
- package/dist/interactions/index.js +1 -1
- package/package.json +6 -8
package/cdn/bundle.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var FrakSDK=(()=>{var Yr=Object.create;var he=Object.defineProperty;var Zr=Object.getOwnPropertyDescriptor;var Qr=Object.getOwnPropertyNames;var eo=Object.getPrototypeOf,to=Object.prototype.hasOwnProperty;var ro=(e,t,r)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $t=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ut=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oo=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Ot=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Qr(t))!to.call(e,a)&&a!==r&&he(e,a,{get:()=>t[a],enumerable:!(o=Zr(t,a))||o.enumerable});return e};var De=(e,t,r)=>(r=e!=null?Yr(eo(e)):{},Ot(t||!e||!e.__esModule?he(r,"default",{value:e,enumerable:!0}):r,e)),no=e=>Ot(he({},"__esModule",{value:!0}),e);var W=(e,t,r)=>ro(e,typeof t!="symbol"?t+"":t,r);var ut=Ut((ye,pt)=>{"use strict";(function(e,t){if(typeof ye=="object"&&typeof pt=="object")pt.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var o in r)(typeof ye=="object"?ye:e)[o]=r[o]}})(ye,()=>(()=>{"use strict";var e={48:function(r,o,a){var i=this&&this.__awaiter||function(s,g,n,c){return new(n||(n=Promise))(function(T,E){function h(u){try{D(c.next(u))}catch(f){E(f)}}function F(u){try{D(c.throw(u))}catch(f){E(f)}}function D(u){var f;u.done?T(u.value):(f=u.value,f instanceof n?f:new n(function(v){v(f)})).then(h,F)}D((c=c.apply(s,g||[])).next())})},p=this&&this.__generator||function(s,g){var n,c,T,E,h={label:0,sent:function(){if(1&T[0])throw T[1];return T[1]},trys:[],ops:[]};return E={next:F(0),throw:F(1),return:F(2)},typeof Symbol=="function"&&(E[Symbol.iterator]=function(){return this}),E;function F(D){return function(u){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;E&&(E=0,f[0]&&(h=0)),h;)try{if(n=1,c&&(T=2&f[0]?c.return:f[0]?c.throw||((T=c.return)&&T.call(c),0):c.next)&&!(T=T.call(c,f[1])).done)return T;switch(c=0,T&&(f=[2&f[0],T.value]),f[0]){case 0:case 1:T=f;break;case 4:return h.label++,{value:f[1],done:!1};case 5:h.label++,c=f[1],f=[0];continue;case 7:f=h.ops.pop(),h.trys.pop();continue;default:if(!((T=(T=h.trys).length>0&&T[T.length-1])||f[0]!==6&&f[0]!==2)){h=0;continue}if(f[0]===3&&(!T||f[1]>T[0]&&f[1]<T[3])){h.label=f[1];break}if(f[0]===6&&h.label<T[1]){h.label=T[1],T=f;break}if(T&&h.label<T[2]){h.label=T[2],h.ops.push(f);break}T[2]&&h.ops.pop(),h.trys.pop();continue}f=g.call(s,h)}catch(v){f=[6,v],c=0}finally{n=T=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([D,u])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.decompressFromUTF16=o.compressToUTF16=o.decompressFromBase64=o.compressToBase64=void 0;var b=a(304),l=a(134),S=new b.CompressorImpl,x=new l.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m={};o.compressToBase64=function(s){return i(this,void 0,void 0,function(){var g;return p(this,function(n){switch(n.label){case 0:return s===null?[2,""]:[4,S.compress(s,6,function(c){return d.charAt(c)})];case 1:switch((g=n.sent()).length%4){default:case 0:return[2,g];case 1:return[2,g+"==="];case 2:return[2,g+"=="];case 3:return[2,g+"="]}return[2]}})})},o.decompressFromBase64=function(s){return i(this,void 0,void 0,function(){return p(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,x.decompress(s.length,32,function(n){return function(c,T){if(!m[c]){m[c]={};for(var E=0;E<c.length;E++)m[c][c.charAt(E)]=E}return m[c][T]}(d,s.charAt(n))})];case 1:return[2,g.sent()]}})})},o.compressToUTF16=function(s){return i(this,void 0,void 0,function(){return p(this,function(g){switch(g.label){case 0:return s===null?[2,""]:[4,S.compress(s,15,function(n){return String.fromCharCode(n+32)})];case 1:return[2,g.sent()+" "]}})})},o.decompressFromUTF16=function(s){return i(this,void 0,void 0,function(){return p(this,function(g){switch(g.label){case 0:return s===null?[2,""]:s===""?[2,null]:[4,x.decompress(s.length,16384,function(n){return s.charCodeAt(n)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,o,a){var i=this&&this.__awaiter||function(x,d,m,s){return new(m||(m=Promise))(function(g,n){function c(h){try{E(s.next(h))}catch(F){n(F)}}function T(h){try{E(s.throw(h))}catch(F){n(F)}}function E(h){var F;h.done?g(h.value):(F=h.value,F instanceof m?F:new m(function(D){D(F)})).then(c,T)}E((s=s.apply(x,d||[])).next())})},p=this&&this.__generator||function(x,d){var m,s,g,n,c={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return n={next:T(0),throw:T(1),return:T(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function T(E){return function(h){return function(F){if(m)throw new TypeError("Generator is already executing.");for(;n&&(n=0,F[0]&&(c=0)),c;)try{if(m=1,s&&(g=2&F[0]?s.return:F[0]?s.throw||((g=s.return)&&g.call(s),0):s.next)&&!(g=g.call(s,F[1])).done)return g;switch(s=0,g&&(F=[2&F[0],g.value]),F[0]){case 0:case 1:g=F;break;case 4:return c.label++,{value:F[1],done:!1};case 5:c.label++,s=F[1],F=[0];continue;case 7:F=c.ops.pop(),c.trys.pop();continue;default:if(!((g=(g=c.trys).length>0&&g[g.length-1])||F[0]!==6&&F[0]!==2)){c=0;continue}if(F[0]===3&&(!g||F[1]>g[0]&&F[1]<g[3])){c.label=F[1];break}if(F[0]===6&&c.label<g[1]){c.label=g[1],g=F;break}if(g&&c.label<g[2]){c.label=g[2],c.ops.push(F);break}g[2]&&c.ops.pop(),c.trys.pop();continue}F=d.call(x,c)}catch(D){F=[6,D],s=0}finally{m=g=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([E,h])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompressorImpl=void 0;var b=a(658),l=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],S=function(){function x(){}return x.writeValueToData=function(d,m,s,g,n){if(s%4!=0||d.dataPosition+s>g-1)for(var c=0;c<s;c++)d.dataVal=d.dataVal<<1|1&m,d.dataPosition==g-1?(d.dataPosition=0,d.data.push(n(d.dataVal)),d.dataVal=0):d.dataPosition++,m>>=1;else d.dataVal<<=s,d.dataVal|=function(T,E){for(var h=0,F=0;F<E;++F)h<<=4,h|=l[15&T],T>>=4;return h}(m,s/4),d.dataPosition+=s},x.writeWToDataVal=function(d,m,s){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(x.writeValueToData(d,0,d.numBits,m,s),x.writeValueToData(d,d.w.charCodeAt(0),8,m,s)):(x.writeValueToData(d,1,d.numBits,m,s),x.writeValueToData(d,d.w.charCodeAt(0),16,m,s)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):x.writeValueToData(d,d.dictionary.get(d.w),d.numBits,m,s),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},x.loopIteration=function(d,m,s,g,n){var c=d.charAt(m);n.dictionary.has(c)||(n.dictionary.set(c,n.dictSize++),n.dictionaryToCreate.set(c,!0));var T=n.w+c;n.dictionary.has(T)?n.w=T:(this.writeWToDataVal(n,s,g),n.dictionary.set(T,n.dictSize++),n.w=String(c))},x.prototype.compress=function(d,m,s){var g=this;return new Promise(function(n){return i(g,void 0,void 0,function(){var c,T;return p(this,function(E){switch(E.label){case 0:if(d==null)return n(""),[2];c={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},T=0,E.label=1;case 1:return T<d.length?(x.loopIteration(d,T,m,s,c),T%1e4!=0?[3,3]:[4,(0,b.wait)()]):[3,4];case 2:E.sent(),E.label=3;case 3:return T+=1,[3,1];case 4:return c.w!==""&&x.writeWToDataVal(c,m,s),x.writeValueToData(c,2,c.numBits,m,s),c.dataVal<<=m-c.dataPosition,c.data.push(s(c.dataVal)),n(c.data.join("")),[2]}})})})},x}();o.CompressorImpl=S},134:function(r,o,a){var i=this&&this.__awaiter||function(S,x,d,m){return new(d||(d=Promise))(function(s,g){function n(E){try{T(m.next(E))}catch(h){g(h)}}function c(E){try{T(m.throw(E))}catch(h){g(h)}}function T(E){var h;E.done?s(E.value):(h=E.value,h instanceof d?h:new d(function(F){F(h)})).then(n,c)}T((m=m.apply(S,x||[])).next())})},p=this&&this.__generator||function(S,x){var d,m,s,g,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return g={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function c(T){return function(E){return function(h){if(d)throw new TypeError("Generator is already executing.");for(;g&&(g=0,h[0]&&(n=0)),n;)try{if(d=1,m&&(s=2&h[0]?m.return:h[0]?m.throw||((s=m.return)&&s.call(m),0):m.next)&&!(s=s.call(m,h[1])).done)return s;switch(m=0,s&&(h=[2&h[0],s.value]),h[0]){case 0:case 1:s=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,m=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(!((s=(s=n.trys).length>0&&s[s.length-1])||h[0]!==6&&h[0]!==2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){n.label=h[1];break}if(h[0]===6&&n.label<s[1]){n.label=s[1],s=h;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(h);break}s[2]&&n.ops.pop(),n.trys.pop();continue}h=x.call(S,n)}catch(F){h=[6,F],m=0}finally{d=s=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([T,E])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.DecompressorImpl=void 0;var b=a(658),l=function(){function S(){}return S.prototype.decompress=function(x,d,m){var s=this;return new Promise(function(g){return i(s,void 0,void 0,function(){var n,c,T;return p(this,function(E){switch(E.label){case 0:for(n={bits:0,c:null,dataIndex:1,dataPosition:d,dataVal:m(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},c=0;c<3;c+=1)n.dictionary.set(c,c);for(;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition===0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 2:return g(""),[2]}n.dictionary[3]=n.c,n.w=n.c,n.result.push(n.c),T=1,E.label=1;case 1:return T%2e4!=0?[3,3]:[4,(0,b.wait)()];case 2:E.sent(),E.label=3;case 3:if(n.dataIndex>x)return g(""),[2];for(n.bits=0,n.maxPower=Math.pow(2,n.numBits),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.c=n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=m(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 2:return g(n.result.join("")),[2]}if(n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),n.dictionary[n.c])n.entry=n.dictionary[n.c];else{if(n.c!==n.dictSize)return g(null),[2];n.entry=n.w+n.w.charAt(0)}return n.result.push(n.entry),n.dictionary[n.dictSize++]=n.w+n.entry.charAt(0),n.enlargeIn--,n.w=n.entry,n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),T++,[3,1];case 4:return[2]}})})})},S}();o.DecompressorImpl=l},658:function(r,o){var a=this&&this.__awaiter||function(p,b,l,S){return new(l||(l=Promise))(function(x,d){function m(n){try{g(S.next(n))}catch(c){d(c)}}function s(n){try{g(S.throw(n))}catch(c){d(c)}}function g(n){var c;n.done?x(n.value):(c=n.value,c instanceof l?c:new l(function(T){T(c)})).then(m,s)}g((S=S.apply(p,b||[])).next())})},i=this&&this.__generator||function(p,b){var l,S,x,d,m={label:0,sent:function(){if(1&x[0])throw x[1];return x[1]},trys:[],ops:[]};return d={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function s(g){return function(n){return function(c){if(l)throw new TypeError("Generator is already executing.");for(;d&&(d=0,c[0]&&(m=0)),m;)try{if(l=1,S&&(x=2&c[0]?S.return:c[0]?S.throw||((x=S.return)&&x.call(S),0):S.next)&&!(x=x.call(S,c[1])).done)return x;switch(S=0,x&&(c=[2&c[0],x.value]),c[0]){case 0:case 1:x=c;break;case 4:return m.label++,{value:c[1],done:!1};case 5:m.label++,S=c[1],c=[0];continue;case 7:c=m.ops.pop(),m.trys.pop();continue;default:if(!((x=(x=m.trys).length>0&&x[x.length-1])||c[0]!==6&&c[0]!==2)){m=0;continue}if(c[0]===3&&(!x||c[1]>x[0]&&c[1]<x[3])){m.label=c[1];break}if(c[0]===6&&m.label<x[1]){m.label=x[1],x=c;break}if(x&&m.label<x[2]){m.label=x[2],m.ops.push(c);break}x[2]&&m.ops.pop(),m.trys.pop();continue}c=b.call(p,m)}catch(T){c=[6,T],S=0}finally{l=x=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([g,n])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.wait=void 0,o.wait=function(){return a(this,void 0,void 0,function(){return i(this,function(p){return[2,new Promise(function(b){setTimeout(b,0)})]})})}}},t={};return function r(o){var a=t[o];if(a!==void 0)return a.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(48)})())});var lt=Ut((Jo,$e)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var o=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:o&&(r=self);var i=!r.JS_SHA256_NO_COMMON_JS&&typeof $e=="object"&&$e.exports,p=typeof define=="function"&&define.amd,b=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),S=[-2147483648,8388608,32768,128],x=[24,16,8,0],d=[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],m=["hex","array","digest","arrayBuffer"],s=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(u){return Object.prototype.toString.call(u)==="[object Array]"}),b&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(u){return typeof u=="object"&&u.buffer&&u.buffer.constructor===ArrayBuffer});var g=function(u,f){return function(v){return new h(f,!0).update(v)[u]()}},n=function(u){var f=g("hex",u);a&&(f=c(f,u)),f.create=function(){return new h(u)},f.update=function(A){return f.create().update(A)};for(var v=0;v<m.length;++v){var I=m[v];f[I]=g(I,u)}return f},c=function(u,f){var v=$t("crypto"),I=$t("buffer").Buffer,A=f?"sha224":"sha256",w;I.from&&!r.JS_SHA256_NO_BUFFER_FROM?w=I.from:w=function(y){return new I(y)};var C=function(y){if(typeof y=="string")return v.createHash(A).update(y,"utf8").digest("hex");if(y==null)throw new Error(e);return y.constructor===ArrayBuffer&&(y=new Uint8Array(y)),Array.isArray(y)||ArrayBuffer.isView(y)||y.constructor===I?v.createHash(A).update(w(y)).digest("hex"):u(y)};return C},T=function(u,f){return function(v,I){return new F(v,f,!0).update(I)[u]()}},E=function(u){var f=T("hex",u);f.create=function(A){return new F(A,u)},f.update=function(A,w){return f.create(A).update(w)};for(var v=0;v<m.length;++v){var I=m[v];f[I]=T(I,u)}return f};function h(u,f){f?(s[0]=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0,this.blocks=s):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],u?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=u}h.prototype.update=function(u){if(!this.finalized){var f,v=typeof u;if(v!=="string"){if(v==="object"){if(u===null)throw new Error(e);if(b&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!b||!ArrayBuffer.isView(u)))throw new Error(e)}else throw new Error(e);f=!0}for(var I,A=0,w,C=u.length,y=this.blocks;A<C;){if(this.hashed&&(this.hashed=!1,y[0]=this.block,this.block=y[16]=y[1]=y[2]=y[3]=y[4]=y[5]=y[6]=y[7]=y[8]=y[9]=y[10]=y[11]=y[12]=y[13]=y[14]=y[15]=0),f)for(w=this.start;A<C&&w<64;++A)y[w>>>2]|=u[A]<<x[w++&3];else for(w=this.start;A<C&&w<64;++A)I=u.charCodeAt(A),I<128?y[w>>>2]|=I<<x[w++&3]:I<2048?(y[w>>>2]|=(192|I>>>6)<<x[w++&3],y[w>>>2]|=(128|I&63)<<x[w++&3]):I<55296||I>=57344?(y[w>>>2]|=(224|I>>>12)<<x[w++&3],y[w>>>2]|=(128|I>>>6&63)<<x[w++&3],y[w>>>2]|=(128|I&63)<<x[w++&3]):(I=65536+((I&1023)<<10|u.charCodeAt(++A)&1023),y[w>>>2]|=(240|I>>>18)<<x[w++&3],y[w>>>2]|=(128|I>>>12&63)<<x[w++&3],y[w>>>2]|=(128|I>>>6&63)<<x[w++&3],y[w>>>2]|=(128|I&63)<<x[w++&3]);this.lastByteIndex=w,this.bytes+=w-this.start,w>=64?(this.block=y[16],this.start=w-64,this.hash(),this.hashed=!0):this.start=w}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},h.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var u=this.blocks,f=this.lastByteIndex;u[16]=this.block,u[f>>>2]|=S[f&3],this.block=u[16],f>=56&&(this.hashed||this.hash(),u[0]=this.block,u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),u[14]=this.hBytes<<3|this.bytes>>>29,u[15]=this.bytes<<3,this.hash()}},h.prototype.hash=function(){var u=this.h0,f=this.h1,v=this.h2,I=this.h3,A=this.h4,w=this.h5,C=this.h6,y=this.h7,P=this.blocks,B,N,V,Y,M,Z,Q,me,st,ct,Le;for(B=16;B<64;++B)M=P[B-15],N=(M>>>7|M<<25)^(M>>>18|M<<14)^M>>>3,M=P[B-2],V=(M>>>17|M<<15)^(M>>>19|M<<13)^M>>>10,P[B]=P[B-16]+N+P[B-7]+V<<0;for(Le=f&v,B=0;B<64;B+=4)this.first?(this.is224?(me=300032,M=P[0]-1413257819,y=M-150054599<<0,I=M+24177077<<0):(me=704751109,M=P[0]-210244248,y=M-1521486534<<0,I=M+143694565<<0),this.first=!1):(N=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),V=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),me=u&f,Y=me^u&v^Le,Q=A&w^~A&C,M=y+V+Q+d[B]+P[B],Z=N+Y,y=I+M<<0,I=M+Z<<0),N=(I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),V=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),st=I&u,Y=st^I&f^me,Q=y&A^~y&w,M=C+V+Q+d[B+1]+P[B+1],Z=N+Y,C=v+M<<0,v=M+Z<<0,N=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),V=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),ct=v&I,Y=ct^v&u^st,Q=C&y^~C&A,M=w+V+Q+d[B+2]+P[B+2],Z=N+Y,w=f+M<<0,f=M+Z<<0,N=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),V=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),Le=f&v,Y=Le^f&I^ct,Q=w&C^~w&y,M=A+V+Q+d[B+3]+P[B+3],Z=N+Y,A=u+M<<0,u=M+Z<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+u<<0,this.h1=this.h1+f<<0,this.h2=this.h2+v<<0,this.h3=this.h3+I<<0,this.h4=this.h4+A<<0,this.h5=this.h5+w<<0,this.h6=this.h6+C<<0,this.h7=this.h7+y<<0},h.prototype.hex=function(){this.finalize();var u=this.h0,f=this.h1,v=this.h2,I=this.h3,A=this.h4,w=this.h5,C=this.h6,y=this.h7,P=l[u>>>28&15]+l[u>>>24&15]+l[u>>>20&15]+l[u>>>16&15]+l[u>>>12&15]+l[u>>>8&15]+l[u>>>4&15]+l[u&15]+l[f>>>28&15]+l[f>>>24&15]+l[f>>>20&15]+l[f>>>16&15]+l[f>>>12&15]+l[f>>>8&15]+l[f>>>4&15]+l[f&15]+l[v>>>28&15]+l[v>>>24&15]+l[v>>>20&15]+l[v>>>16&15]+l[v>>>12&15]+l[v>>>8&15]+l[v>>>4&15]+l[v&15]+l[I>>>28&15]+l[I>>>24&15]+l[I>>>20&15]+l[I>>>16&15]+l[I>>>12&15]+l[I>>>8&15]+l[I>>>4&15]+l[I&15]+l[A>>>28&15]+l[A>>>24&15]+l[A>>>20&15]+l[A>>>16&15]+l[A>>>12&15]+l[A>>>8&15]+l[A>>>4&15]+l[A&15]+l[w>>>28&15]+l[w>>>24&15]+l[w>>>20&15]+l[w>>>16&15]+l[w>>>12&15]+l[w>>>8&15]+l[w>>>4&15]+l[w&15]+l[C>>>28&15]+l[C>>>24&15]+l[C>>>20&15]+l[C>>>16&15]+l[C>>>12&15]+l[C>>>8&15]+l[C>>>4&15]+l[C&15];return this.is224||(P+=l[y>>>28&15]+l[y>>>24&15]+l[y>>>20&15]+l[y>>>16&15]+l[y>>>12&15]+l[y>>>8&15]+l[y>>>4&15]+l[y&15]),P},h.prototype.toString=h.prototype.hex,h.prototype.digest=function(){this.finalize();var u=this.h0,f=this.h1,v=this.h2,I=this.h3,A=this.h4,w=this.h5,C=this.h6,y=this.h7,P=[u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255];return this.is224||P.push(y>>>24&255,y>>>16&255,y>>>8&255,y&255),P},h.prototype.array=h.prototype.digest,h.prototype.arrayBuffer=function(){this.finalize();var u=new ArrayBuffer(this.is224?28:32),f=new DataView(u);return f.setUint32(0,this.h0),f.setUint32(4,this.h1),f.setUint32(8,this.h2),f.setUint32(12,this.h3),f.setUint32(16,this.h4),f.setUint32(20,this.h5),f.setUint32(24,this.h6),this.is224||f.setUint32(28,this.h7),u};function F(u,f,v){var I,A=typeof u;if(A==="string"){var w=[],C=u.length,y=0,P;for(I=0;I<C;++I)P=u.charCodeAt(I),P<128?w[y++]=P:P<2048?(w[y++]=192|P>>>6,w[y++]=128|P&63):P<55296||P>=57344?(w[y++]=224|P>>>12,w[y++]=128|P>>>6&63,w[y++]=128|P&63):(P=65536+((P&1023)<<10|u.charCodeAt(++I)&1023),w[y++]=240|P>>>18,w[y++]=128|P>>>12&63,w[y++]=128|P>>>6&63,w[y++]=128|P&63);u=w}else if(A==="object"){if(u===null)throw new Error(e);if(b&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!b||!ArrayBuffer.isView(u)))throw new Error(e)}else throw new Error(e);u.length>64&&(u=new h(f,!0).update(u).array());var B=[],N=[];for(I=0;I<64;++I){var V=u[I]||0;B[I]=92^V,N[I]=54^V}h.call(this,f,v),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=v}F.prototype=new h,F.prototype.finalize=function(){if(h.prototype.finalize.call(this),this.inner){this.inner=!1;var u=this.array();h.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(u),h.prototype.finalize.call(this)}};var D=n();D.sha256=D,D.sha224=n(!0),D.sha256.hmac=E(),D.sha224.hmac=E(!0),i?$e.exports=D:(r.sha256=D.sha256,r.sha224=D.sha224,p&&define(function(){return D}))})()});function ee(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var Te=k(()=>{"use strict"});function O(e){return ee(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Se=k(()=>{"use strict";Te()});var ht,qt=k(()=>{"use strict";ht="2.22.10"});function Kt(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Kt(e.cause,t):t?null:e}var Fe,L,ce=k(()=>{"use strict";qt();Fe={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e!=null?e:"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${ht}`},L=class e extends Error{constructor(t,r={}){var b,l;let o=(()=>{var S;return r.cause instanceof e?r.cause.details:(S=r.cause)!=null&&S.message?r.cause.message:r.details})(),a=r.cause instanceof e&&r.cause.docsPath||r.docsPath,i=(b=Fe.getDocsUrl)==null?void 0:b.call(Fe,{...r,docsPath:a}),p=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...o?[`Details: ${o}`]:[],...Fe.version?[`Version: ${Fe.version}`]:[]].join(`
|
|
2
|
-
`);super(
|
|
3
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}
|
|
4
|
-
`),{name:"AbiEncodingLengthMismatchError"})}},
|
|
5
|
-
`),{docsPath:r,name:"InvalidAbiEncodingType"})}},
|
|
6
|
-
`),{name:"InvalidArrayError"})}}});var Ee,ve,xt=k(()=>{"use strict";ce();Ee=class extends L{constructor({offset:t,position:r,size:o}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${o}).`,{name:"SliceOffsetOutOfBoundsError"})}},ve=class extends L{constructor({size:t,targetSize:r,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function z(e,{dir:t,size:r=32}={}){return typeof e=="string"?K(e,{dir:t,size:r}):Gt(e,{dir:t,size:r})}function K(e,{dir:t,size:r=32}={}){if(r===null)return e;let o=e.replace("0x","");if(o.length>r*2)throw new ve({size:Math.ceil(o.length/2),targetSize:r,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Gt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new ve({size:e.length,targetSize:r,type:"bytes"});let o=new Uint8Array(r);for(let a=0;a<r;a++){let i=t==="right";o[i?a:r-a-1]=e[i?a:e.length-a-1]}return o}var Ae=k(()=>{"use strict";xt()});var fe,je,We=k(()=>{"use strict";ce();fe=class extends L{constructor({max:t,min:r,signed:o,size:a,value:i}){super(`Number "${i}" is not in safe ${a?`${a*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},je=class extends L{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function pe(e,{size:t}){if(O(e)>t)throw new je({givenSize:O(e),maxSize:t})}var yt=k(()=>{"use strict";We();Se()});function $(e,t={}){return typeof e=="number"||typeof e=="bigint"?J(e,t):typeof e=="string"?Ke(e,t):typeof e=="boolean"?qe(e,t):Ce(e,t)}function qe(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{size:t.size})):r}function Ce(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=so[e[a]];let o=`0x${r}`;return typeof t.size=="number"?(pe(o,{size:t.size}),z(o,{dir:"right",size:t.size})):o}function J(e,t={}){let{signed:r,size:o}=t,a=BigInt(e),i;o?r?i=(1n<<BigInt(o)*8n-1n)-1n:i=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));let p=typeof i=="bigint"&&r?-i-1n:0;if(i&&a>i||a<p){let l=typeof e=="bigint"?"n":"";throw new fe({max:i?`${i}${l}`:void 0,min:`${p}${l}`,signed:r,size:o,value:`${e}${l}`})}let b=`0x${(r&&a<0?(1n<<BigInt(o*8))+BigInt(a):a).toString(16)}`;return o?z(b,{size:o}):b}function Ke(e,t={}){let r=co.encode(e);return Ce(r,t)}var so,co,Pe=k(()=>{"use strict";We();Ae();yt();so=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));co=new TextEncoder});function gt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Zt(e,t):typeof e=="boolean"?Yt(e,t):ee(e)?Me(e,t):Je(e,t)}function Yt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{size:t.size})):r}function Xt(e){if(e>=X.zero&&e<=X.nine)return e-X.zero;if(e>=X.A&&e<=X.F)return e-(X.A-10);if(e>=X.a&&e<=X.f)return e-(X.a-10)}function Me(e,t={}){let r=e;t.size&&(pe(r,{size:t.size}),r=z(r,{dir:"right",size:t.size}));let o=r.slice(2);o.length%2&&(o=`0${o}`);let a=o.length/2,i=new Uint8Array(a);for(let p=0,b=0;p<a;p++){let l=Xt(o.charCodeAt(b++)),S=Xt(o.charCodeAt(b++));if(l===void 0||S===void 0)throw new L(`Invalid byte sequence ("${o[b-2]}${o[b-1]}" in "${o}").`);i[p]=l*16+S}return i}function Zt(e,t){let r=J(e,t);return Me(r)}function Je(e,t={}){let r=po.encode(e);return typeof t.size=="number"?(pe(r,{size:t.size}),z(r,{dir:"right",size:t.size})):r}var po,X,Ge=k(()=>{"use strict";ce();Te();Ae();yt();Pe();po=new TextEncoder;X={zero:48,nine:57,A:65,F:70,a:97,f:102}});function bt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function uo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ke(e,...t){if(!uo(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function wt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Qt(e,t){ke(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var It=k(()=>{"use strict"});function lo(e,t=!1){return t?{h:Number(e&Xe),l:Number(e>>er&Xe)}:{h:Number(e>>er&Xe)|0,l:Number(e&Xe)|0}}function tr(e,t=!1){let r=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:i,l:p}=lo(e[a],t);[r[a],o[a]]=[i,p]}return[r,o]}var Xe,er,rr,or,nr,ar,ir=k(()=>{"use strict";Xe=BigInt(4294967295),er=BigInt(32);rr=(e,t,r)=>e<<r|t>>>32-r,or=(e,t,r)=>t<<r|e>>>32-r,nr=(e,t,r)=>t<<r-32|e>>>64-r,ar=(e,t,r)=>e<<r-32|t>>>64-r});function St(e){for(let t=0;t<e.length;t++)e[t]=fo(e[t])}function mo(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ze(e){return typeof e=="string"&&(e=mo(e)),ke(e),e}function cr(e){let t=o=>e().update(Ze(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function pr(e){let t=(o,a)=>e(a).update(Ze(o)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=o=>e(o),t}var sr,Tt,fo,Ye,ur=k(()=>{"use strict";It();sr=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Tt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,fo=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;Ye=class{clone(){return this._cloneInto()}}});function To(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let p=0;p<10;p++)r[p]=e[p]^e[p+10]^e[p+20]^e[p+30]^e[p+40];for(let p=0;p<10;p+=2){let b=(p+8)%10,l=(p+2)%10,S=r[l],x=r[l+1],d=lr(S,x,1)^r[b],m=fr(S,x,1)^r[b+1];for(let s=0;s<50;s+=10)e[p+s]^=d,e[p+s+1]^=m}let a=e[2],i=e[3];for(let p=0;p<24;p++){let b=mr[p],l=lr(a,i,b),S=fr(a,i,b),x=dr[p];a=e[x],i=e[x+1],e[x]=l,e[x+1]=S}for(let p=0;p<50;p+=10){for(let b=0;b<10;b++)r[b]=e[p+b];for(let b=0;b<10;b++)e[p+b]^=~r[(b+2)%10]&r[(b+4)%10]}e[0]^=wo[o],e[1]^=Io[o]}r.fill(0)}var dr,mr,hr,ho,Re,xo,yo,go,bo,wo,Io,lr,fr,Qe,te,sa,ca,pa,ua,la,xr,fa,da,yr,ma,ha,gr=k(()=>{"use strict";It();ir();ur();dr=[],mr=[],hr=[],ho=BigInt(0),Re=BigInt(1),xo=BigInt(2),yo=BigInt(7),go=BigInt(256),bo=BigInt(113);for(let e=0,t=Re,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],dr.push(2*(5*o+r)),mr.push((e+1)*(e+2)/2%64);let a=ho;for(let i=0;i<7;i++)t=(t<<Re^(t>>yo)*bo)%go,t&xo&&(a^=Re<<(Re<<BigInt(i))-Re);hr.push(a)}[wo,Io]=tr(hr,!0),lr=(e,t,r)=>r>32?nr(e,t,r):rr(e,t,r),fr=(e,t,r)=>r>32?ar(e,t,r):or(e,t,r);Qe=class e extends Ye{constructor(t,r,o,a=!1,i=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=o,this.enableXOF=a,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,bt(o),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=sr(this.state)}keccak(){Tt||St(this.state32),To(this.state32,this.rounds),Tt||St(this.state32),this.posOut=0,this.pos=0}update(t){wt(this);let{blockLen:r,state:o}=this;t=Ze(t);let a=t.length;for(let i=0;i<a;){let p=Math.min(r-this.pos,a-i);for(let b=0;b<p;b++)o[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:o,blockLen:a}=this;t[o]^=r,r&128&&o===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){wt(this,!1),ke(t),this.finish();let r=this.state,{blockLen:o}=this;for(let a=0,i=t.length;a<i;){this.posOut>=o&&this.keccak();let p=Math.min(o-this.posOut,i-a);t.set(r.subarray(this.posOut,this.posOut+p),a),this.posOut+=p,a+=p}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return bt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Qt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:o,outputLen:a,rounds:i,enableXOF:p}=this;return t||(t=new e(r,o,a,p,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=o,t.outputLen=a,t.enableXOF=p,t.destroyed=this.destroyed,t}},te=(e,t,r)=>cr(()=>new Qe(t,e,r)),sa=te(6,144,224/8),ca=te(6,136,256/8),pa=te(6,104,384/8),ua=te(6,72,512/8),la=te(1,144,224/8),xr=te(1,136,256/8),fa=te(1,104,384/8),da=te(1,72,512/8),yr=(e,t,r)=>pr((o={})=>new Qe(t,e,o.dkLen===void 0?r:o.dkLen,!0)),ma=yr(31,168,128/8),ha=yr(31,136,256/8)});function Be(e,t){let r=t||"hex",o=xr(ee(e,{strict:!1})?gt(e):e);return r==="bytes"?o:$(o)}var Ft=k(()=>{"use strict";gr();Te();Ge();Pe()});var ue,Et=k(()=>{"use strict";ce();ue=class extends L{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var de,vt=k(()=>{"use strict";de=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let o=this.keys().next().value;o&&this.delete(o)}return this}}});function br(e,t){if(At.has(`${e}.${t}`))return At.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=Be(Je(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let p=0;p<40;p+=2)o[p>>1]>>4>=8&&a[p]&&(a[p]=a[p].toUpperCase()),(o[p>>1]&15)>=8&&a[p+1]&&(a[p+1]=a[p+1].toUpperCase());let i=`0x${a.join("")}`;return At.set(`${e}.${t}`,i),i}var At,wr=k(()=>{"use strict";Ge();Ft();vt();At=new de(8192)});function He(e,t){let{strict:r=!0}=t!=null?t:{},o=`${e}.${r}`;if(Ct.has(o))return Ct.get(o);let a=So.test(e)?e.toLowerCase()===e?!0:r?br(e)===e:!0:!1;return Ct.set(o,a),a}var So,Ct,Pt=k(()=>{"use strict";vt();wr();So=/^0x[a-fA-F0-9]{40}$/,Ct=new de(8192)});function re(e){return typeof e[0]=="string"?j(e):Ir(e)}function Ir(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),o=0;for(let a of e)r.set(a,o),o+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Mt=k(()=>{"use strict"});function Tr(e,t,r,{strict:o}={}){return ee(e,{strict:!1})?Eo(e,t,r,{strict:o}):Fo(e,t,r,{strict:o})}function Sr(e,t){if(typeof t=="number"&&t>0&&t>O(e)-1)throw new Ee({offset:t,position:"start",size:O(e)})}function Fr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&O(e)!==r-t)throw new Ee({offset:r,position:"end",size:O(e)})}function Fo(e,t,r,{strict:o}={}){Sr(e,t);let a=e.slice(t,r);return o&&Fr(a,t,r),a}function Eo(e,t,r,{strict:o}={}){Sr(e,t);let a=`0x${e.replace("0x","").slice((t!=null?t:0)*2,(r!=null?r:e.length)*2)}`;return o&&Fr(a,t,r),a}var Er=k(()=>{"use strict";xt();Te();Se()});var vr,Ar=k(()=>{"use strict";vr=/^(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 kt(e,t){if(e.length!==t.length)throw new _e({expectedLength:e.length,givenLength:t.length});let r=vo({params:e,values:t}),o=Bt(r);return o.length===0?"0x":o}function vo({params:e,values:t}){let r=[];for(let o=0;o<e.length;o++)r.push(Rt({param:e[o],value:t[o]}));return r}function Rt({param:e,value:t}){var o;let r=Ho(e.type);if(r){let[a,i]=r;return Co(t,{length:a,param:{...e,type:i}})}if(e.type==="tuple")return Bo(t,{param:e});if(e.type==="address")return Ao(t);if(e.type==="bool")return Mo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let a=e.type.startsWith("int"),[,,i="256"]=(o=vr.exec(e.type))!=null?o:[];return ko(t,{signed:a,size:Number(i)})}if(e.type.startsWith("bytes"))return Po(t,{param:e});if(e.type==="string")return Ro(t);throw new Ne(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Bt(e){let t=0;for(let i=0;i<e.length;i++){let{dynamic:p,encoded:b}=e[i];p?t+=32:t+=O(b)}let r=[],o=[],a=0;for(let i=0;i<e.length;i++){let{dynamic:p,encoded:b}=e[i];p?(r.push(J(t+a,{size:32})),o.push(b),a+=O(b)):r.push(b)}return re([...r,...o])}function Ao(e){if(!He(e))throw new ue({address:e});return{dynamic:!1,encoded:K(e.toLowerCase())}}function Co(e,{length:t,param:r}){let o=t===null;if(!Array.isArray(e))throw new Ve(e);if(!o&&e.length!==t)throw new Ue({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,i=[];for(let p=0;p<e.length;p++){let b=Rt({param:r,value:e[p]});b.dynamic&&(a=!0),i.push(b)}if(o||a){let p=Bt(i);if(o){let b=J(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?re([b,p]):b}}if(a)return{dynamic:!0,encoded:p}}return{dynamic:!1,encoded:re(i.map(({encoded:p})=>p))}}function Po(e,{param:t}){let[,r]=t.type.split("bytes"),o=O(e);if(!r){let a=e;return o%32!==0&&(a=K(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:re([K(J(o,{size:32})),a])}}if(o!==Number.parseInt(r))throw new Oe({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:K(e,{dir:"right"})}}function Mo(e){if(typeof e!="boolean")throw new L(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:K(qe(e))}}function ko(e,{signed:t,size:r=256}){if(typeof r=="number"){let o=2n**(BigInt(r)-(t?1n:0n))-1n,a=t?-o-1n:0n;if(e>o||e<a)throw new fe({max:o.toString(),min:a.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:J(e,{size:32,signed:t})}}function Ro(e){let t=Ke(e),r=Math.ceil(O(t)/32),o=[];for(let a=0;a<r;a++)o.push(K(Tr(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:re([K(J(O(t),{size:32})),...o])}}function Bo(e,{param:t}){let r=!1,o=[];for(let a=0;a<t.components.length;a++){let i=t.components[a],p=Array.isArray(e)?a:i.name,b=Rt({param:i,value:e[p]});o.push(b),b.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Bt(o):re(o.map(({encoded:a})=>a))}}function Ho(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Cr=k(()=>{"use strict";Jt();Et();ce();We();Pt();Mt();Ae();Se();Er();Pe();Ar()});function Ht(e,t){if(!He(e,{strict:!1}))throw new ue({address:e});if(!He(t,{strict:!1}))throw new ue({address:t});return e.toLowerCase()===t.toLowerCase()}var Pr=k(()=>{"use strict";Et();Pt()});var _o={};oo(_o,{ClientNotFound:()=>xe,DebugInfoGatherer:()=>ie,Deferred:()=>q,FrakContextManager:()=>oe,FrakRpcError:()=>R,PressInteractionEncoder:()=>qr,PurchaseInteractionEncoder:()=>Kr,ReferralInteractionEncoder:()=>at,RetailInteractionEncoder:()=>Gr,RpcErrorCodes:()=>H,WebShopInteractionEncoder:()=>Jr,baseIframeProps:()=>se,compressJson:()=>ge,createIFrameFrakClient:()=>Ie,createIframe:()=>we,decompressDataAndCheckHash:()=>ae,decompressJson:()=>be,displayEmbededWallet:()=>Ur,displayModal:()=>G,getProductInformation:()=>_r,hashAndCompressData:()=>ne,interactionTypes:()=>_,modalBuilder:()=>Wr,openSso:()=>Or,processReferral:()=>it,productTypes:()=>U,productTypesMask:()=>Dr,referralInteraction:()=>Xr,sendInteraction:()=>ot,sendTransaction:()=>jr,setupClient:()=>Dt,siweAuthenticate:()=>Vr,trackPurchaseStatus:()=>Nr,watchWalletStatus:()=>rt});var R=class extends Error{constructor(r,o,a){super(o);this.code=r;this.data=a}};var ze=class extends R{constructor(t){super(H.internalError,t)}},xe=class extends R{constructor(){super(H.clientNotConnected,"Client not found")}},H={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};var q=class{constructor(){W(this,"_promise");W(this,"_resolve");W(this,"_reject");W(this,"resolve",t=>{var r;(r=this._resolve)==null||r.call(this,t)});W(this,"reject",t=>{var r;(r=this._reject)==null||r.call(this,t)});this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}};var _t=De(ut(),1),ft=De(lt(),1);async function ne(e){let t=(0,ft.sha256)(JSON.stringify(e)),r={...e,validationHash:t},o=await ge(r),a=(0,ft.sha256)(o);return{compressed:o,compressedHash:a}}async function ge(e){return(0,_t.compressToBase64)(JSON.stringify(e))}var Nt=De(ut(),1),dt=De(lt(),1);async function ae(e){if(!(e!=null&&e.compressed&&(e!=null&&e.compressedHash)))throw new R(H.corruptedResponse,"Missing compressed data");let t=await be(e.compressed);if(!t)throw new R(H.corruptedResponse,"Invalid compressed data");if(!(t!=null&&t.validationHash))throw new R(H.corruptedResponse,"Missing validation hash");if((0,dt.sha256)(e.compressed)!==e.compressedHash)throw new R(H.corruptedResponse,"Invalid compressed hash");let{validationHash:o,...a}=t;if((0,dt.sha256)(JSON.stringify(a))!==t.validationHash)throw new R(H.corruptedResponse,"Invalid data validation hash");return t}async function be(e){let t=await(0,Nt.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var le="nexus-wallet-backup";var ie=class e{constructor(t,r){W(this,"config");W(this,"iframe");W(this,"isSetupDone",!1);W(this,"lastResponse",null);W(this,"lastRequest",null);this.config=t,this.iframe=r,this.lastRequest=null,this.lastResponse=null}setLastResponse(t){this.lastResponse={event:t.data,origin:t.origin,timestamp:Date.now()}}setLastRequest(t,r){this.lastRequest={event:t,target:r,timestamp:Date.now()}}updateSetupStatus(t){this.isSetupDone=t}base64Encode(t){try{return btoa(JSON.stringify(t))}catch(r){return console.warn("Failed to encode debug data",r),btoa("Failed to encode data")}}getIframeStatus(){var t;return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:(t=this.iframe.contentDocument)!=null&&t.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(t){let r=this.getIframeStatus(),o=this.getNavigatorInfo(),a="Unknown";return t instanceof R?a=`FrakRpcError: ${t.code} '${t.message}'`:t instanceof Error?a=t.message:typeof t=="string"&&(a=t),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:o?this.base64Encode(o):"no-navigator",iframeStatus:r?this.base64Encode(r):"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:a}}static empty(){return new e}formatDebugInfo(t){let r=this.gatherDebugInfo(t);return`
|
|
1
|
+
"use strict";var FrakSDK=(()=>{var Xr=Object.create;var Be=Object.defineProperty;var Yr=Object.getOwnPropertyDescriptor;var Zr=Object.getOwnPropertyNames;var Qr=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var zt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var $t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),to=(e,t)=>{for(var r in t)Be(e,r,{get:t[r],enumerable:!0})},Ut=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Zr(t))!eo.call(e,a)&&a!==r&&Be(e,a,{get:()=>t[a],enumerable:!(o=Yr(t,a))||o.enumerable});return e};var He=(e,t,r)=>(r=e!=null?Xr(Qr(e)):{},Ut(t||!e||!e.__esModule?Be(r,"default",{value:e,enumerable:!0}):r,e)),ro=e=>Ut(Be({},"__esModule",{value:!0}),e);var ct=$t((he,st)=>{"use strict";(function(e,t){if(typeof he=="object"&&typeof st=="object")st.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var r=t();for(var o in r)(typeof he=="object"?he:e)[o]=r[o]}})(he,()=>(()=>{"use strict";var e={48:function(r,o,a){var p=this&&this.__awaiter||function(i,g,n,s){return new(n||(n=Promise))(function(w,A){function m(c){try{L(s.next(c))}catch(l){A(l)}}function F(c){try{L(s.throw(c))}catch(l){A(l)}}function L(c){var l;c.done?w(c.value):(l=c.value,l instanceof n?l:new n(function(E){E(l)})).then(m,F)}L((s=s.apply(i,g||[])).next())})},u=this&&this.__generator||function(i,g){var n,s,w,A,m={label:0,sent:function(){if(1&w[0])throw w[1];return w[1]},trys:[],ops:[]};return A={next:F(0),throw:F(1),return:F(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function F(L){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;A&&(A=0,l[0]&&(m=0)),m;)try{if(n=1,s&&(w=2&l[0]?s.return:l[0]?s.throw||((w=s.return)&&w.call(s),0):s.next)&&!(w=w.call(s,l[1])).done)return w;switch(s=0,w&&(l=[2&l[0],w.value]),l[0]){case 0:case 1:w=l;break;case 4:return m.label++,{value:l[1],done:!1};case 5:m.label++,s=l[1],l=[0];continue;case 7:l=m.ops.pop(),m.trys.pop();continue;default:if(!((w=(w=m.trys).length>0&&w[w.length-1])||l[0]!==6&&l[0]!==2)){m=0;continue}if(l[0]===3&&(!w||l[1]>w[0]&&l[1]<w[3])){m.label=l[1];break}if(l[0]===6&&m.label<w[1]){m.label=w[1],w=l;break}if(w&&m.label<w[2]){m.label=w[2],m.ops.push(l);break}w[2]&&m.ops.pop(),m.trys.pop();continue}l=g.call(i,m)}catch(E){l=[6,E],s=0}finally{n=w=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([L,c])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.decompressFromUTF16=o.compressToUTF16=o.decompressFromBase64=o.compressToBase64=void 0;var S=a(304),f=a(134),T=new S.CompressorImpl,y=new f.DecompressorImpl,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h={};o.compressToBase64=function(i){return p(this,void 0,void 0,function(){var g;return u(this,function(n){switch(n.label){case 0:return i===null?[2,""]:[4,T.compress(i,6,function(s){return d.charAt(s)})];case 1:switch((g=n.sent()).length%4){default:case 0:return[2,g];case 1:return[2,g+"==="];case 2:return[2,g+"=="];case 3:return[2,g+"="]}return[2]}})})},o.decompressFromBase64=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,y.decompress(i.length,32,function(n){return function(s,w){if(!h[s]){h[s]={};for(var A=0;A<s.length;A++)h[s][s.charAt(A)]=A}return h[s][w]}(d,i.charAt(n))})];case 1:return[2,g.sent()]}})})},o.compressToUTF16=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:[4,T.compress(i,15,function(n){return String.fromCharCode(n+32)})];case 1:return[2,g.sent()+" "]}})})},o.decompressFromUTF16=function(i){return p(this,void 0,void 0,function(){return u(this,function(g){switch(g.label){case 0:return i===null?[2,""]:i===""?[2,null]:[4,y.decompress(i.length,16384,function(n){return i.charCodeAt(n)-32})];case 1:return[2,g.sent()]}})})}},304:function(r,o,a){var p=this&&this.__awaiter||function(y,d,h,i){return new(h||(h=Promise))(function(g,n){function s(m){try{A(i.next(m))}catch(F){n(F)}}function w(m){try{A(i.throw(m))}catch(F){n(F)}}function A(m){var F;m.done?g(m.value):(F=m.value,F instanceof h?F:new h(function(L){L(F)})).then(s,w)}A((i=i.apply(y,d||[])).next())})},u=this&&this.__generator||function(y,d){var h,i,g,n,s={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return n={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function w(A){return function(m){return function(F){if(h)throw new TypeError("Generator is already executing.");for(;n&&(n=0,F[0]&&(s=0)),s;)try{if(h=1,i&&(g=2&F[0]?i.return:F[0]?i.throw||((g=i.return)&&g.call(i),0):i.next)&&!(g=g.call(i,F[1])).done)return g;switch(i=0,g&&(F=[2&F[0],g.value]),F[0]){case 0:case 1:g=F;break;case 4:return s.label++,{value:F[1],done:!1};case 5:s.label++,i=F[1],F=[0];continue;case 7:F=s.ops.pop(),s.trys.pop();continue;default:if(!((g=(g=s.trys).length>0&&g[g.length-1])||F[0]!==6&&F[0]!==2)){s=0;continue}if(F[0]===3&&(!g||F[1]>g[0]&&F[1]<g[3])){s.label=F[1];break}if(F[0]===6&&s.label<g[1]){s.label=g[1],g=F;break}if(g&&s.label<g[2]){s.label=g[2],s.ops.push(F);break}g[2]&&s.ops.pop(),s.trys.pop();continue}F=d.call(y,s)}catch(L){F=[6,L],i=0}finally{h=g=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([A,m])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompressorImpl=void 0;var S=a(658),f=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],T=function(){function y(){}return y.writeValueToData=function(d,h,i,g,n){if(i%4!=0||d.dataPosition+i>g-1)for(var s=0;s<i;s++)d.dataVal=d.dataVal<<1|1&h,d.dataPosition==g-1?(d.dataPosition=0,d.data.push(n(d.dataVal)),d.dataVal=0):d.dataPosition++,h>>=1;else d.dataVal<<=i,d.dataVal|=function(w,A){for(var m=0,F=0;F<A;++F)m<<=4,m|=f[15&w],w>>=4;return m}(h,i/4),d.dataPosition+=i},y.writeWToDataVal=function(d,h,i){d.dictionaryToCreate.has(d.w)?(d.w.charCodeAt(0)<256?(y.writeValueToData(d,0,d.numBits,h,i),y.writeValueToData(d,d.w.charCodeAt(0),8,h,i)):(y.writeValueToData(d,1,d.numBits,h,i),y.writeValueToData(d,d.w.charCodeAt(0),16,h,i)),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++),d.dictionaryToCreate.delete(d.w)):y.writeValueToData(d,d.dictionary.get(d.w),d.numBits,h,i),d.enlargeIn--,d.enlargeIn==0&&(d.enlargeIn=Math.pow(2,d.numBits),d.numBits++)},y.loopIteration=function(d,h,i,g,n){var s=d.charAt(h);n.dictionary.has(s)||(n.dictionary.set(s,n.dictSize++),n.dictionaryToCreate.set(s,!0));var w=n.w+s;n.dictionary.has(w)?n.w=w:(this.writeWToDataVal(n,i,g),n.dictionary.set(w,n.dictSize++),n.w=String(s))},y.prototype.compress=function(d,h,i){var g=this;return new Promise(function(n){return p(g,void 0,void 0,function(){var s,w;return u(this,function(A){switch(A.label){case 0:if(d==null)return n(""),[2];s={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},w=0,A.label=1;case 1:return w<d.length?(y.loopIteration(d,w,h,i,s),w%1e4!=0?[3,3]:[4,(0,S.wait)()]):[3,4];case 2:A.sent(),A.label=3;case 3:return w+=1,[3,1];case 4:return s.w!==""&&y.writeWToDataVal(s,h,i),y.writeValueToData(s,2,s.numBits,h,i),s.dataVal<<=h-s.dataPosition,s.data.push(i(s.dataVal)),n(s.data.join("")),[2]}})})})},y}();o.CompressorImpl=T},134:function(r,o,a){var p=this&&this.__awaiter||function(T,y,d,h){return new(d||(d=Promise))(function(i,g){function n(A){try{w(h.next(A))}catch(m){g(m)}}function s(A){try{w(h.throw(A))}catch(m){g(m)}}function w(A){var m;A.done?i(A.value):(m=A.value,m instanceof d?m:new d(function(F){F(m)})).then(n,s)}w((h=h.apply(T,y||[])).next())})},u=this&&this.__generator||function(T,y){var d,h,i,g,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function s(w){return function(A){return function(m){if(d)throw new TypeError("Generator is already executing.");for(;g&&(g=0,m[0]&&(n=0)),n;)try{if(d=1,h&&(i=2&m[0]?h.return:m[0]?h.throw||((i=h.return)&&i.call(h),0):h.next)&&!(i=i.call(h,m[1])).done)return i;switch(h=0,i&&(m=[2&m[0],i.value]),m[0]){case 0:case 1:i=m;break;case 4:return n.label++,{value:m[1],done:!1};case 5:n.label++,h=m[1],m=[0];continue;case 7:m=n.ops.pop(),n.trys.pop();continue;default:if(!((i=(i=n.trys).length>0&&i[i.length-1])||m[0]!==6&&m[0]!==2)){n=0;continue}if(m[0]===3&&(!i||m[1]>i[0]&&m[1]<i[3])){n.label=m[1];break}if(m[0]===6&&n.label<i[1]){n.label=i[1],i=m;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(m);break}i[2]&&n.ops.pop(),n.trys.pop();continue}m=y.call(T,n)}catch(F){m=[6,F],h=0}finally{d=i=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([w,A])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.DecompressorImpl=void 0;var S=a(658),f=function(){function T(){}return T.prototype.decompress=function(y,d,h){var i=this;return new Promise(function(g){return p(i,void 0,void 0,function(){var n,s,w;return u(this,function(A){switch(A.label){case 0:for(n={bits:0,c:null,dataIndex:1,dataPosition:d,dataVal:h(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},s=0;s<3;s+=1)n.dictionary.set(s,s);for(;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition===0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.c=String.fromCharCode(n.bits);break;case 2:return g(""),[2]}n.dictionary[3]=n.c,n.w=n.c,n.result.push(n.c),w=1,A.label=1;case 1:return w%2e4!=0?[3,3]:[4,(0,S.wait)()];case 2:A.sent(),A.label=3;case 3:if(n.dataIndex>y)return g(""),[2];for(n.bits=0,n.maxPower=Math.pow(2,n.numBits),n.power=1;n.power!=n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;switch(n.c=n.bits){case 0:for(n.bits=0,n.maxPower=Math.pow(2,8),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 1:for(n.bits=0,n.maxPower=Math.pow(2,16),n.power=1;n.power!==n.maxPower;)n.resb=n.dataVal&n.dataPosition,n.dataPosition>>=1,n.dataPosition==0&&(n.dataPosition=d,n.dataVal=h(n.dataIndex++)),n.bits|=(n.resb>0?1:0)*n.power,n.power<<=1;n.dictionary[n.dictSize++]=String.fromCharCode(n.bits),n.c=n.dictSize-1,n.enlargeIn--;break;case 2:return g(n.result.join("")),[2]}if(n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),n.dictionary[n.c])n.entry=n.dictionary[n.c];else{if(n.c!==n.dictSize)return g(null),[2];n.entry=n.w+n.w.charAt(0)}return n.result.push(n.entry),n.dictionary[n.dictSize++]=n.w+n.entry.charAt(0),n.enlargeIn--,n.w=n.entry,n.enlargeIn==0&&(n.enlargeIn=Math.pow(2,n.numBits),n.numBits++),w++,[3,1];case 4:return[2]}})})})},T}();o.DecompressorImpl=f},658:function(r,o){var a=this&&this.__awaiter||function(u,S,f,T){return new(f||(f=Promise))(function(y,d){function h(n){try{g(T.next(n))}catch(s){d(s)}}function i(n){try{g(T.throw(n))}catch(s){d(s)}}function g(n){var s;n.done?y(n.value):(s=n.value,s instanceof f?s:new f(function(w){w(s)})).then(h,i)}g((T=T.apply(u,S||[])).next())})},p=this&&this.__generator||function(u,S){var f,T,y,d,h={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return d={next:i(0),throw:i(1),return:i(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function i(g){return function(n){return function(s){if(f)throw new TypeError("Generator is already executing.");for(;d&&(d=0,s[0]&&(h=0)),h;)try{if(f=1,T&&(y=2&s[0]?T.return:s[0]?T.throw||((y=T.return)&&y.call(T),0):T.next)&&!(y=y.call(T,s[1])).done)return y;switch(T=0,y&&(s=[2&s[0],y.value]),s[0]){case 0:case 1:y=s;break;case 4:return h.label++,{value:s[1],done:!1};case 5:h.label++,T=s[1],s=[0];continue;case 7:s=h.ops.pop(),h.trys.pop();continue;default:if(!((y=(y=h.trys).length>0&&y[y.length-1])||s[0]!==6&&s[0]!==2)){h=0;continue}if(s[0]===3&&(!y||s[1]>y[0]&&s[1]<y[3])){h.label=s[1];break}if(s[0]===6&&h.label<y[1]){h.label=y[1],y=s;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(s);break}y[2]&&h.ops.pop(),h.trys.pop();continue}s=S.call(u,h)}catch(w){s=[6,w],T=0}finally{f=y=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([g,n])}}};Object.defineProperty(o,"__esModule",{value:!0}),o.wait=void 0,o.wait=function(){return a(this,void 0,void 0,function(){return p(this,function(u){return[2,new Promise(function(S){setTimeout(S,0)})]})})}}},t={};return function r(o){var a=t[o];if(a!==void 0)return a.exports;var p=t[o]={exports:{}};return e[o].call(p.exports,p,p.exports,r),p.exports}(48)})())});var pt=$t((Wo,Le)=>{"use strict";(function(){"use strict";var e="input is invalid type",t=typeof window=="object",r=t?window:{};r.JS_SHA256_NO_WINDOW&&(t=!1);var o=!t&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=global:o&&(r=self);var p=!r.JS_SHA256_NO_COMMON_JS&&typeof Le=="object"&&Le.exports,u=typeof define=="function"&&define.amd,S=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),T=[-2147483648,8388608,32768,128],y=[24,16,8,0],d=[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],h=["hex","array","digest","arrayBuffer"],i=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]"}),S&&(r.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer});var g=function(c,l){return function(E){return new m(l,!0).update(E)[c]()}},n=function(c){var l=g("hex",c);a&&(l=s(l,c)),l.create=function(){return new m(c)},l.update=function(v){return l.create().update(v)};for(var E=0;E<h.length;++E){var I=h[E];l[I]=g(I,c)}return l},s=function(c,l){var E=zt("crypto"),I=zt("buffer").Buffer,v=l?"sha224":"sha256",b;I.from&&!r.JS_SHA256_NO_BUFFER_FROM?b=I.from:b=function(x){return new I(x)};var C=function(x){if(typeof x=="string")return E.createHash(v).update(x,"utf8").digest("hex");if(x==null)throw new Error(e);return x.constructor===ArrayBuffer&&(x=new Uint8Array(x)),Array.isArray(x)||ArrayBuffer.isView(x)||x.constructor===I?E.createHash(v).update(b(x)).digest("hex"):c(x)};return C},w=function(c,l){return function(E,I){return new F(E,l,!0).update(I)[c]()}},A=function(c){var l=w("hex",c);l.create=function(v){return new F(v,c)},l.update=function(v,b){return l.create(v).update(b)};for(var E=0;E<h.length;++E){var I=h[E];l[I]=w(I,c)}return l};function m(c,l){l?(i[0]=i[16]=i[1]=i[2]=i[3]=i[4]=i[5]=i[6]=i[7]=i[8]=i[9]=i[10]=i[11]=i[12]=i[13]=i[14]=i[15]=0,this.blocks=i):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=c}m.prototype.update=function(c){if(!this.finalized){var l,E=typeof c;if(E!=="string"){if(E==="object"){if(c===null)throw new Error(e);if(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);l=!0}for(var I,v=0,b,C=c.length,x=this.blocks;v<C;){if(this.hashed&&(this.hashed=!1,x[0]=this.block,this.block=x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),l)for(b=this.start;v<C&&b<64;++v)x[b>>>2]|=c[v]<<y[b++&3];else for(b=this.start;v<C&&b<64;++v)I=c.charCodeAt(v),I<128?x[b>>>2]|=I<<y[b++&3]:I<2048?(x[b>>>2]|=(192|I>>>6)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]):I<55296||I>=57344?(x[b>>>2]|=(224|I>>>12)<<y[b++&3],x[b>>>2]|=(128|I>>>6&63)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]):(I=65536+((I&1023)<<10|c.charCodeAt(++v)&1023),x[b>>>2]|=(240|I>>>18)<<y[b++&3],x[b>>>2]|=(128|I>>>12&63)<<y[b++&3],x[b>>>2]|=(128|I>>>6&63)<<y[b++&3],x[b>>>2]|=(128|I&63)<<y[b++&3]);this.lastByteIndex=b,this.bytes+=b-this.start,b>=64?(this.block=x[16],this.start=b-64,this.hash(),this.hashed=!0):this.start=b}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},m.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,l=this.lastByteIndex;c[16]=this.block,c[l>>>2]|=T[l&3],this.block=c[16],l>=56&&(this.hashed||this.hash(),c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),c[14]=this.hBytes<<3|this.bytes>>>29,c[15]=this.bytes<<3,this.hash()}},m.prototype.hash=function(){var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,P=this.blocks,B,N,V,X,k,Y,Z,de,at,it,Re;for(B=16;B<64;++B)k=P[B-15],N=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3,k=P[B-2],V=(k>>>17|k<<15)^(k>>>19|k<<13)^k>>>10,P[B]=P[B-16]+N+P[B-7]+V<<0;for(Re=l&E,B=0;B<64;B+=4)this.first?(this.is224?(de=300032,k=P[0]-1413257819,x=k-150054599<<0,I=k+24177077<<0):(de=704751109,k=P[0]-210244248,x=k-1521486534<<0,I=k+143694565<<0),this.first=!1):(N=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),V=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),de=c&l,X=de^c&E^Re,Z=v&b^~v&C,k=x+V+Z+d[B]+P[B],Y=N+X,x=I+k<<0,I=k+Y<<0),N=(I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),V=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),at=I&c,X=at^I&l^de,Z=x&v^~x&b,k=C+V+Z+d[B+1]+P[B+1],Y=N+X,C=E+k<<0,E=k+Y<<0,N=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),V=(C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7),it=E&I,X=it^E&c^at,Z=C&x^~C&v,k=b+V+Z+d[B+2]+P[B+2],Y=N+X,b=l+k<<0,l=k+Y<<0,N=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),V=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),Re=l&E,X=Re^l&I^it,Z=b&C^~b&x,k=v+V+Z+d[B+3]+P[B+3],Y=N+X,v=c+k<<0,c=k+Y<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+c<<0,this.h1=this.h1+l<<0,this.h2=this.h2+E<<0,this.h3=this.h3+I<<0,this.h4=this.h4+v<<0,this.h5=this.h5+b<<0,this.h6=this.h6+C<<0,this.h7=this.h7+x<<0},m.prototype.hex=function(){this.finalize();var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,P=f[c>>>28&15]+f[c>>>24&15]+f[c>>>20&15]+f[c>>>16&15]+f[c>>>12&15]+f[c>>>8&15]+f[c>>>4&15]+f[c&15]+f[l>>>28&15]+f[l>>>24&15]+f[l>>>20&15]+f[l>>>16&15]+f[l>>>12&15]+f[l>>>8&15]+f[l>>>4&15]+f[l&15]+f[E>>>28&15]+f[E>>>24&15]+f[E>>>20&15]+f[E>>>16&15]+f[E>>>12&15]+f[E>>>8&15]+f[E>>>4&15]+f[E&15]+f[I>>>28&15]+f[I>>>24&15]+f[I>>>20&15]+f[I>>>16&15]+f[I>>>12&15]+f[I>>>8&15]+f[I>>>4&15]+f[I&15]+f[v>>>28&15]+f[v>>>24&15]+f[v>>>20&15]+f[v>>>16&15]+f[v>>>12&15]+f[v>>>8&15]+f[v>>>4&15]+f[v&15]+f[b>>>28&15]+f[b>>>24&15]+f[b>>>20&15]+f[b>>>16&15]+f[b>>>12&15]+f[b>>>8&15]+f[b>>>4&15]+f[b&15]+f[C>>>28&15]+f[C>>>24&15]+f[C>>>20&15]+f[C>>>16&15]+f[C>>>12&15]+f[C>>>8&15]+f[C>>>4&15]+f[C&15];return this.is224||(P+=f[x>>>28&15]+f[x>>>24&15]+f[x>>>20&15]+f[x>>>16&15]+f[x>>>12&15]+f[x>>>8&15]+f[x>>>4&15]+f[x&15]),P},m.prototype.toString=m.prototype.hex,m.prototype.digest=function(){this.finalize();var c=this.h0,l=this.h1,E=this.h2,I=this.h3,v=this.h4,b=this.h5,C=this.h6,x=this.h7,P=[c>>>24&255,c>>>16&255,c>>>8&255,c&255,l>>>24&255,l>>>16&255,l>>>8&255,l&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,b>>>24&255,b>>>16&255,b>>>8&255,b&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255];return this.is224||P.push(x>>>24&255,x>>>16&255,x>>>8&255,x&255),P},m.prototype.array=m.prototype.digest,m.prototype.arrayBuffer=function(){this.finalize();var c=new ArrayBuffer(this.is224?28:32),l=new DataView(c);return l.setUint32(0,this.h0),l.setUint32(4,this.h1),l.setUint32(8,this.h2),l.setUint32(12,this.h3),l.setUint32(16,this.h4),l.setUint32(20,this.h5),l.setUint32(24,this.h6),this.is224||l.setUint32(28,this.h7),c};function F(c,l,E){var I,v=typeof c;if(v==="string"){var b=[],C=c.length,x=0,P;for(I=0;I<C;++I)P=c.charCodeAt(I),P<128?b[x++]=P:P<2048?(b[x++]=192|P>>>6,b[x++]=128|P&63):P<55296||P>=57344?(b[x++]=224|P>>>12,b[x++]=128|P>>>6&63,b[x++]=128|P&63):(P=65536+((P&1023)<<10|c.charCodeAt(++I)&1023),b[x++]=240|P>>>18,b[x++]=128|P>>>12&63,b[x++]=128|P>>>6&63,b[x++]=128|P&63);c=b}else if(v==="object"){if(c===null)throw new Error(e);if(S&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!S||!ArrayBuffer.isView(c)))throw new Error(e)}else throw new Error(e);c.length>64&&(c=new m(l,!0).update(c).array());var B=[],N=[];for(I=0;I<64;++I){var V=c[I]||0;B[I]=92^V,N[I]=54^V}m.call(this,l,E),this.update(N),this.oKeyPad=B,this.inner=!0,this.sharedMemory=E}F.prototype=new m,F.prototype.finalize=function(){if(m.prototype.finalize.call(this),this.inner){this.inner=!1;var c=this.array();m.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(c),m.prototype.finalize.call(this)}};var L=n();L.sha256=L,L.sha224=n(!0),L.sha256.hmac=A(),L.sha224.hmac=A(!0),p?Le.exports=L:(r.sha256=L.sha256,r.sha224=L.sha224,u&&define(function(){return L}))})()});function Q(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var we=M(()=>{"use strict"});function O(e){return Q(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Ie=M(()=>{"use strict";we()});var dt,Wt=M(()=>{"use strict";dt="2.22.23"});function qt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?qt(e.cause,t):t?null:e}var mt,D,se=M(()=>{"use strict";Wt();mt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${dt}`},D=class e extends Error{constructor(t,r={}){let o=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof e&&r.cause.docsPath||r.docsPath,p=mt.getDocsUrl?.({...r,docsPath:a}),u=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...p?[`Docs: ${p}`]:[],...o?[`Details: ${o}`]:[],...mt.version?[`Version: ${mt.version}`]:[]].join(`
|
|
2
|
+
`);super(u,r.cause?{cause:r.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=o,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=dt}walk(t){return qt(this,t)}}});var ze,$e,Ue,Oe,_e,Kt=M(()=>{"use strict";Ie();se();ze=class extends D{constructor({expectedLength:t,givenLength:r,type:o}){super([`ABI encoding array length mismatch for type ${o}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
|
|
3
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}},$e=class extends D{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${O(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Ue=class extends D{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
|
|
4
|
+
`),{name:"AbiEncodingLengthMismatchError"})}},Oe=class extends D{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
5
|
+
`),{docsPath:r,name:"InvalidAbiEncodingType"})}},_e=class extends D{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
6
|
+
`),{name:"InvalidArrayError"})}}});var Se,Te,ht=M(()=>{"use strict";se();Se=class extends D{constructor({offset:t,position:r,size:o}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${o}).`,{name:"SliceOffsetOutOfBoundsError"})}},Te=class extends D{constructor({size:t,targetSize:r,type:o}){super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}});function z(e,{dir:t,size:r=32}={}){return typeof e=="string"?q(e,{dir:t,size:r}):Jt(e,{dir:t,size:r})}function q(e,{dir:t,size:r=32}={}){if(r===null)return e;let o=e.replace("0x","");if(o.length>r*2)throw new Te({size:Math.ceil(o.length/2),targetSize:r,type:"hex"});return`0x${o[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Jt(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new Te({size:e.length,targetSize:r,type:"bytes"});let o=new Uint8Array(r);for(let a=0;a<r;a++){let p=t==="right";o[p?a:r-a-1]=e[p?a:e.length-a-1]}return o}var Fe=M(()=>{"use strict";ht()});var le,Ne,Ve=M(()=>{"use strict";se();le=class extends D{constructor({max:t,min:r,signed:o,size:a,value:p}){super(`Number "${p}" is not in safe ${a?`${a*8}-bit ${o?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},Ne=class extends D{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function ce(e,{size:t}){if(O(e)>t)throw new Ne({givenSize:O(e),maxSize:t})}var xt=M(()=>{"use strict";Ve();Ie()});function $(e,t={}){return typeof e=="number"||typeof e=="bigint"?K(e,t):typeof e=="string"?We(e,t):typeof e=="boolean"?je(e,t):Ee(e,t)}function je(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ce(r,{size:t.size}),z(r,{size:t.size})):r}function Ee(e,t={}){let r="";for(let a=0;a<e.length;a++)r+=ao[e[a]];let o=`0x${r}`;return typeof t.size=="number"?(ce(o,{size:t.size}),z(o,{dir:"right",size:t.size})):o}function K(e,t={}){let{signed:r,size:o}=t,a=BigInt(e),p;o?r?p=(1n<<BigInt(o)*8n-1n)-1n:p=2n**(BigInt(o)*8n)-1n:typeof e=="number"&&(p=BigInt(Number.MAX_SAFE_INTEGER));let u=typeof p=="bigint"&&r?-p-1n:0;if(p&&a>p||a<u){let f=typeof e=="bigint"?"n":"";throw new le({max:p?`${p}${f}`:void 0,min:`${u}${f}`,signed:r,size:o,value:`${e}${f}`})}let S=`0x${(r&&a<0?(1n<<BigInt(o*8))+BigInt(a):a).toString(16)}`;return o?z(S,{size:o}):S}function We(e,t={}){let r=io.encode(e);return Ee(r,t)}var ao,io,ve=M(()=>{"use strict";Ve();Fe();xt();ao=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));io=new TextEncoder});function yt(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yt(e,t):typeof e=="boolean"?Xt(e,t):Q(e)?Ae(e,t):qe(e,t)}function Xt(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ce(r,{size:t.size}),z(r,{size:t.size})):r}function Gt(e){if(e>=G.zero&&e<=G.nine)return e-G.zero;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function Ae(e,t={}){let r=e;t.size&&(ce(r,{size:t.size}),r=z(r,{dir:"right",size:t.size}));let o=r.slice(2);o.length%2&&(o=`0${o}`);let a=o.length/2,p=new Uint8Array(a);for(let u=0,S=0;u<a;u++){let f=Gt(o.charCodeAt(S++)),T=Gt(o.charCodeAt(S++));if(f===void 0||T===void 0)throw new D(`Invalid byte sequence ("${o[S-2]}${o[S-1]}" in "${o}").`);p[u]=f*16+T}return p}function Yt(e,t){let r=K(e,t);return Ae(r)}function qe(e,t={}){let r=so.encode(e);return typeof t.size=="number"?(ce(r,{size:t.size}),z(r,{dir:"right",size:t.size})):r}var so,G,Ke=M(()=>{"use strict";se();we();Fe();xt();ve();so=new TextEncoder;G={zero:48,nine:57,A:65,F:70,a:97,f:102}});function gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function co(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ce(e,...t){if(!co(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function bt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zt(e,t){Ce(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}var wt=M(()=>{"use strict"});function po(e,t=!1){return t?{h:Number(e&Je),l:Number(e>>Qt&Je)}:{h:Number(e>>Qt&Je)|0,l:Number(e&Je)|0}}function er(e,t=!1){let r=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let a=0;a<e.length;a++){let{h:p,l:u}=po(e[a],t);[r[a],o[a]]=[p,u]}return[r,o]}var Je,Qt,tr,rr,or,nr,ar=M(()=>{"use strict";Je=BigInt(4294967295),Qt=BigInt(32);tr=(e,t,r)=>e<<r|t>>>32-r,rr=(e,t,r)=>t<<r|e>>>32-r,or=(e,t,r)=>t<<r-32|e>>>64-r,nr=(e,t,r)=>e<<r-32|t>>>64-r});function ir(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function uo(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function St(e){for(let t=0;t<e.length;t++)e[t]=uo(e[t])}function lo(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Xe(e){return typeof e=="string"&&(e=lo(e)),Ce(e),e}function sr(e){let t=o=>e().update(Xe(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function cr(e){let t=(o,a)=>e(a).update(Xe(o)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=o=>e(o),t}var It,Ge,pr=M(()=>{"use strict";wt();It=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;Ge=class{clone(){return this._cloneInto()}}});function wo(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let u=0;u<10;u++)r[u]=e[u]^e[u+10]^e[u+20]^e[u+30]^e[u+40];for(let u=0;u<10;u+=2){let S=(u+8)%10,f=(u+2)%10,T=r[f],y=r[f+1],d=ur(T,y,1)^r[S],h=lr(T,y,1)^r[S+1];for(let i=0;i<50;i+=10)e[u+i]^=d,e[u+i+1]^=h}let a=e[2],p=e[3];for(let u=0;u<24;u++){let S=dr[u],f=ur(a,p,S),T=lr(a,p,S),y=fr[u];a=e[y],p=e[y+1],e[y]=f,e[y+1]=T}for(let u=0;u<50;u+=10){for(let S=0;S<10;S++)r[S]=e[u+S];for(let S=0;S<10;S++)e[u+S]^=~r[(S+2)%10]&r[(S+4)%10]}e[0]^=go[o],e[1]^=bo[o]}r.fill(0)}var fr,dr,mr,fo,Pe,mo,ho,xo,yo,go,bo,ur,lr,Ye,ee,oa,na,aa,ia,sa,hr,ca,pa,xr,ua,la,yr=M(()=>{"use strict";wt();ar();pr();fr=[],dr=[],mr=[],fo=BigInt(0),Pe=BigInt(1),mo=BigInt(2),ho=BigInt(7),xo=BigInt(256),yo=BigInt(113);for(let e=0,t=Pe,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],fr.push(2*(5*o+r)),dr.push((e+1)*(e+2)/2%64);let a=fo;for(let p=0;p<7;p++)t=(t<<Pe^(t>>ho)*yo)%xo,t&mo&&(a^=Pe<<(Pe<<BigInt(p))-Pe);mr.push(a)}[go,bo]=er(mr,!0),ur=(e,t,r)=>r>32?or(e,t,r):tr(e,t,r),lr=(e,t,r)=>r>32?nr(e,t,r):rr(e,t,r);Ye=class e extends Ge{constructor(t,r,o,a=!1,p=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=o,this.enableXOF=a,this.rounds=p,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,gt(o),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ir(this.state)}keccak(){It||St(this.state32),wo(this.state32,this.rounds),It||St(this.state32),this.posOut=0,this.pos=0}update(t){bt(this);let{blockLen:r,state:o}=this;t=Xe(t);let a=t.length;for(let p=0;p<a;){let u=Math.min(r-this.pos,a-p);for(let S=0;S<u;S++)o[this.pos++]^=t[p++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:o,blockLen:a}=this;t[o]^=r,r&128&&o===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){bt(this,!1),Ce(t),this.finish();let r=this.state,{blockLen:o}=this;for(let a=0,p=t.length;a<p;){this.posOut>=o&&this.keccak();let u=Math.min(o-this.posOut,p-a);t.set(r.subarray(this.posOut,this.posOut+u),a),this.posOut+=u,a+=u}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return gt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zt(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:r,suffix:o,outputLen:a,rounds:p,enableXOF:u}=this;return t||(t=new e(r,o,a,u,p)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=p,t.suffix=o,t.outputLen=a,t.enableXOF=u,t.destroyed=this.destroyed,t}},ee=(e,t,r)=>sr(()=>new Ye(t,e,r)),oa=ee(6,144,224/8),na=ee(6,136,256/8),aa=ee(6,104,384/8),ia=ee(6,72,512/8),sa=ee(1,144,224/8),hr=ee(1,136,256/8),ca=ee(1,104,384/8),pa=ee(1,72,512/8),xr=(e,t,r)=>cr((o={})=>new Ye(t,e,o.dkLen===void 0?r:o.dkLen,!0)),ua=xr(31,168,128/8),la=xr(31,136,256/8)});function ke(e,t){let r=t||"hex",o=hr(Q(e,{strict:!1})?yt(e):e);return r==="bytes"?o:$(o)}var Tt=M(()=>{"use strict";yr();we();Ke();ve()});var pe,Ft=M(()=>{"use strict";se();pe=class extends D{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var fe,Et=M(()=>{"use strict";fe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let o=this.keys().next().value;o&&this.delete(o)}return this}}});function gr(e,t){if(vt.has(`${e}.${t}`))return vt.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=ke(qe(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let u=0;u<40;u+=2)o[u>>1]>>4>=8&&a[u]&&(a[u]=a[u].toUpperCase()),(o[u>>1]&15)>=8&&a[u+1]&&(a[u+1]=a[u+1].toUpperCase());let p=`0x${a.join("")}`;return vt.set(`${e}.${t}`,p),p}var vt,br=M(()=>{"use strict";Ke();Tt();Et();vt=new fe(8192)});function Me(e,t){let{strict:r=!0}=t??{},o=`${e}.${r}`;if(At.has(o))return At.get(o);let a=Io.test(e)?e.toLowerCase()===e?!0:r?gr(e)===e:!0:!1;return At.set(o,a),a}var Io,At,Ct=M(()=>{"use strict";Et();br();Io=/^0x[a-fA-F0-9]{40}$/,At=new fe(8192)});function te(e){return typeof e[0]=="string"?j(e):wr(e)}function wr(e){let t=0;for(let a of e)t+=a.length;let r=new Uint8Array(t),o=0;for(let a of e)r.set(a,o),o+=a.length;return r}function j(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Pt=M(()=>{"use strict"});function Ir(e,t,r,{strict:o}={}){return Q(e,{strict:!1})?To(e,t,r,{strict:o}):So(e,t,r,{strict:o})}function Sr(e,t){if(typeof t=="number"&&t>0&&t>O(e)-1)throw new Se({offset:t,position:"start",size:O(e)})}function Tr(e,t,r){if(typeof t=="number"&&typeof r=="number"&&O(e)!==r-t)throw new Se({offset:r,position:"end",size:O(e)})}function So(e,t,r,{strict:o}={}){Sr(e,t);let a=e.slice(t,r);return o&&Tr(a,t,r),a}function To(e,t,r,{strict:o}={}){Sr(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&Tr(a,t,r),a}var Fr=M(()=>{"use strict";ht();we();Ie()});var Er,vr=M(()=>{"use strict";Er=/^(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 kt(e,t){if(e.length!==t.length)throw new Ue({expectedLength:e.length,givenLength:t.length});let r=Fo({params:e,values:t}),o=Rt(r);return o.length===0?"0x":o}function Fo({params:e,values:t}){let r=[];for(let o=0;o<e.length;o++)r.push(Mt({param:e[o],value:t[o]}));return r}function Mt({param:e,value:t}){let r=Ro(e.type);if(r){let[o,a]=r;return vo(t,{length:o,param:{...e,type:a}})}if(e.type==="tuple")return Mo(t,{param:e});if(e.type==="address")return Eo(t);if(e.type==="bool")return Co(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let o=e.type.startsWith("int"),[,,a="256"]=Er.exec(e.type)??[];return Po(t,{signed:o,size:Number(a)})}if(e.type.startsWith("bytes"))return Ao(t,{param:e});if(e.type==="string")return ko(t);throw new Oe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Rt(e){let t=0;for(let p=0;p<e.length;p++){let{dynamic:u,encoded:S}=e[p];u?t+=32:t+=O(S)}let r=[],o=[],a=0;for(let p=0;p<e.length;p++){let{dynamic:u,encoded:S}=e[p];u?(r.push(K(t+a,{size:32})),o.push(S),a+=O(S)):r.push(S)}return te([...r,...o])}function Eo(e){if(!Me(e))throw new pe({address:e});return{dynamic:!1,encoded:q(e.toLowerCase())}}function vo(e,{length:t,param:r}){let o=t===null;if(!Array.isArray(e))throw new _e(e);if(!o&&e.length!==t)throw new ze({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let a=!1,p=[];for(let u=0;u<e.length;u++){let S=Mt({param:r,value:e[u]});S.dynamic&&(a=!0),p.push(S)}if(o||a){let u=Rt(p);if(o){let S=K(p.length,{size:32});return{dynamic:!0,encoded:p.length>0?te([S,u]):S}}if(a)return{dynamic:!0,encoded:u}}return{dynamic:!1,encoded:te(p.map(({encoded:u})=>u))}}function Ao(e,{param:t}){let[,r]=t.type.split("bytes"),o=O(e);if(!r){let a=e;return o%32!==0&&(a=q(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:te([q(K(o,{size:32})),a])}}if(o!==Number.parseInt(r))throw new $e({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:q(e,{dir:"right"})}}function Co(e){if(typeof e!="boolean")throw new D(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:q(je(e))}}function Po(e,{signed:t,size:r=256}){if(typeof r=="number"){let o=2n**(BigInt(r)-(t?1n:0n))-1n,a=t?-o-1n:0n;if(e>o||e<a)throw new le({max:o.toString(),min:a.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:K(e,{size:32,signed:t})}}function ko(e){let t=We(e),r=Math.ceil(O(t)/32),o=[];for(let a=0;a<r;a++)o.push(q(Ir(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:te([q(K(O(t),{size:32})),...o])}}function Mo(e,{param:t}){let r=!1,o=[];for(let a=0;a<t.components.length;a++){let p=t.components[a],u=Array.isArray(e)?a:p.name,S=Mt({param:p,value:e[u]});o.push(S),S.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Rt(o):te(o.map(({encoded:a})=>a))}}function Ro(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Ar=M(()=>{"use strict";Kt();Ft();se();Ve();Ct();Pt();Fe();Ie();Fr();ve();vr()});function Bt(e,t){if(!Me(e,{strict:!1}))throw new pe({address:e});if(!Me(t,{strict:!1}))throw new pe({address:t});return e.toLowerCase()===t.toLowerCase()}var Cr=M(()=>{"use strict";Ft();Ct()});var Uo={};to(Uo,{ClientNotFound:()=>me,DebugInfoGatherer:()=>ae,Deferred:()=>W,FrakContextManager:()=>re,FrakRpcError:()=>R,PressInteractionEncoder:()=>Wr,PurchaseInteractionEncoder:()=>qr,ReferralInteractionEncoder:()=>ot,RetailInteractionEncoder:()=>Jr,RpcErrorCodes:()=>H,WebShopInteractionEncoder:()=>Kr,baseIframeProps:()=>ie,compressJson:()=>xe,createIFrameFrakClient:()=>be,createIframe:()=>ge,decompressDataAndCheckHash:()=>ne,decompressJson:()=>ye,displayEmbededWallet:()=>$r,displayModal:()=>J,getProductInformation:()=>Or,hashAndCompressData:()=>oe,interactionTypes:()=>_,modalBuilder:()=>jr,openSso:()=>Ur,processReferral:()=>nt,productTypes:()=>U,productTypesMask:()=>Dr,referralInteraction:()=>Gr,sendInteraction:()=>tt,sendTransaction:()=>Vr,setupClient:()=>Dt,siweAuthenticate:()=>Nr,trackPurchaseStatus:()=>_r,watchWalletStatus:()=>et});var R=class extends Error{constructor(r,o,a){super(o);this.code=r;this.data=a}};var De=class extends R{constructor(t){super(H.internalError,t)}},me=class extends R{constructor(){super(H.clientNotConnected,"Client not found")}},H={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};var W=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((t,r)=>{this._resolve=t,this._reject=r})}get promise(){return this._promise}resolve=t=>{this._resolve?.(t)};reject=t=>{this._reject?.(t)}};var Ot=He(ct(),1),ut=He(pt(),1);async function oe(e){let t=(0,ut.sha256)(JSON.stringify(e)),r={...e,validationHash:t},o=await xe(r),a=(0,ut.sha256)(o);return{compressed:o,compressedHash:a}}async function xe(e){return(0,Ot.compressToBase64)(JSON.stringify(e))}var _t=He(ct(),1),lt=He(pt(),1);async function ne(e){if(!(e?.compressed&&e?.compressedHash))throw new R(H.corruptedResponse,"Missing compressed data");let t=await ye(e.compressed);if(!t)throw new R(H.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new R(H.corruptedResponse,"Missing validation hash");if((0,lt.sha256)(e.compressed)!==e.compressedHash)throw new R(H.corruptedResponse,"Invalid compressed hash");let{validationHash:o,...a}=t;if((0,lt.sha256)(JSON.stringify(a))!==t.validationHash)throw new R(H.corruptedResponse,"Invalid data validation hash");return t}async function ye(e){let t=await(0,_t.decompressFromBase64)(e);try{return JSON.parse(t)}catch(r){return console.error("Invalid compressed data",{e:r,decompressed:t}),null}}var ue="nexus-wallet-backup";var ae=class e{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(t,r){this.config=t,this.iframe=r,this.lastRequest=null,this.lastResponse=null}setLastResponse(t){this.lastResponse={event:t.data,origin:t.origin,timestamp:Date.now()}}setLastRequest(t,r){this.lastRequest={event:t,target:r,timestamp:Date.now()}}updateSetupStatus(t){this.isSetupDone=t}base64Encode(t){try{return btoa(JSON.stringify(t))}catch(r){return console.warn("Failed to encode debug data",r),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(t){let r=this.getIframeStatus(),o=this.getNavigatorInfo(),a="Unknown";return t instanceof R?a=`FrakRpcError: ${t.code} '${t.message}'`:t instanceof Error?a=t.message:typeof t=="string"&&(a=t),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:o?this.base64Encode(o):"no-navigator",iframeStatus:r?this.base64Encode(r):"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:a}}static empty(){return new e}formatDebugInfo(t){let r=this.gatherDebugInfo(t);return`
|
|
7
7
|
Debug Information:
|
|
8
8
|
-----------------
|
|
9
9
|
Timestamp: ${r.timestamp}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Last Response: ${r.lastResponse}
|
|
16
16
|
Client Status: ${r.clientStatus}
|
|
17
17
|
Error: ${r.error}
|
|
18
|
-
`.trim()}};function Vt(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}var se={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:1e3,top:"-1000px",left:"-1000px"}};function we({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let o=document.createElement("iframe");return o.id=se.id,o.name=se.name,o.allow=se.allow,o.style.zIndex=se.style.zIndex.toString(),mt({iframe:o,isVisible:!1}),document.body.appendChild(o),new Promise(a=>{var i,p;o==null||o.addEventListener("load",()=>a(o)),o.src=`${(p=(i=t==null?void 0:t.walletUrl)!=null?i:e)!=null?p:"https://wallet.frak.id"}/listener`})}function mt({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 jt({iframe:e}){let t=new q;return{handleEvent:async o=>{var a;switch(o.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":o.data.backup?localStorage.setItem(le,o.data.backup):localStorage.removeItem(le);break;case"remove-backup":localStorage.removeItem(le);break;case"show":case"hide":mt({iframe:e,isVisible:o.iframeLifecycle==="show"});break;case"handshake":{console.log("Received handshake event",{token:o.data.token}),(a=e.contentWindow)==null||a.postMessage({clientLifecycle:"handshake-response",data:{token:o.data.token,currentUrl:window.location.href}},"*");break}}},isConnected:t.promise}}function Wt({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}){if(typeof window>"u")throw new R(H.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new R(H.configError,"The iframe does not have a product window");let i=t.contentWindow;async function p(S){if(!S.origin)return;try{if(new URL(S.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(m){console.log("Unable to check frak msg origin",m);return}if(typeof S.data!="object")return;if(a.setLastResponse(S),"iframeLifecycle"in S.data){await o.handleEvent(S.data);return}if("clientLifecycle"in S.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let x=S.data.id,d=r.getRpcResolver(x);d&&await d(S.data)}window.addEventListener("message",p);function b(S){i.postMessage(S,{targetOrigin:e}),a.setLastRequest(S,e)}function l(){window.removeEventListener("message",p)}return{sendEvent:b,cleanup:l}}function Ie({config:e,iframe:t}){var d;let r=Vt(),o=jt({iframe:t}),a=new ie(e,t),i=Wt({frakWalletUrl:(d=e==null?void 0:e.walletUrl)!=null?d:"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}),p=async m=>{if(!await o.isConnected)throw new R(H.clientNotConnected,"The iframe provider isn't connected yet");let g=new q,n=r.createChannel(async T=>{var h;let E=await ae(T.data);E.error?g.reject(new R(E.error.code,E.error.message,(h=E.error)==null?void 0:h.data)):g.resolve(E.result),r.removeChannel(n)}),c=await ne(m);return i.sendEvent({id:n,topic:m.method,data:c}),g.promise},b=async(m,s)=>{if(!await o.isConnected)throw new R(H.clientNotConnected,"The iframe provider isn't connected yet");let n=r.createChannel(async T=>{let E=await ae(T.data);if(E.result)s(E.result);else throw new ze("No valid result in the response")}),c=await ne(m);i.sendEvent({id:n,topic:m.method,data:c})},l=ao(i,o),S=async()=>{l(),r.destroy(),i.cleanup(),t.remove()},x=io({config:e,messageHandler:i,lifecycleManager:o}).then(()=>a.updateSetupStatus(!0));return{config:e,debugInfo:a,waitForConnection:o.isConnected,waitForSetup:x,request:p,listenerRequest:b,destroy:S}}function ao(e,t){let a,i,p=()=>e.sendEvent({clientLifecycle:"heartbeat"});async function b(){p(),a=setInterval(p,100),i=setTimeout(()=>{l(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,l()}function l(){a&&clearInterval(a),i&&clearTimeout(i)}return b(),l}async function io({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let o=async()=>{let i=e.metadata.css;i&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:i}})},a=async()=>{if(typeof window>"u")return;let i=window.localStorage.getItem(le);i&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:i}})};await Promise.all([o(),a()])}var et=256,tt;function Mr(e=11){if(!tt||et+e>256*2){tt="",et=0;for(let t=0;t<256;t++)tt+=(256+Math.random()*256|0).toString(16).substring(1)}return tt.substring(et,et+++e)}Cr();Ge();Pe();Mt();Pr();Ft();Ae();var Lt="fCtx";function Lo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Do(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function kr(e){if(e!=null&&e.r)try{let t=Me(e.r);return Lo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Rr(e){if(!(!e||e.length===0))try{let t=Do(e);return{r:Ce(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Br({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Lt);return r?Rr(r):null}function Hr({url:e,context:t}){if(!e)return null;let r=Br({url:e}),o=r?{...r,...t}:t;if(!o.r)return null;let a=kr(o);if(!a)return null;let i=new URL(e);return i.searchParams.set(Lt,a),i.toString()}function Lr(e){let t=new URL(e);return t.searchParams.delete(Lt),t.toString()}function zo({url:e,context:t}){var a;if(!((a=window.location)!=null&&a.href)||typeof window>"u"){console.error("No window found, can't update context");return}let r=e!=null?e:window.location.href,o;t!==null?o=Hr({url:r,context:t}):o=Lr(r),o&&window.history.replaceState(null,"",o.toString())}var oe={compress:kr,decompress:Rr,parse:Br,update:Hr,remove:Lr,replaceUrl:zo};async function Dt({config:e}){let t=await we({config:e});if(!t){console.error("Failed to create iframe");return}let r=Ie({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}var U={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Dr=Object.entries(U).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var _={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 rt(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(zr(a.interactionToken),a));let r=new q,o=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),zr(a.interactionToken),o||(r.resolve(a),o=!0)}).then(()=>r.promise)}function zr(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function $r({domain:e}){let t=e!=null?e:window.location.host;return Be($(t))}async function ot(e,{productId:t,interaction:r,validation:o}){let a=t!=null?t:$r(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,o]})}async function G(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function Ur(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function Or(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function _r(e){return await e.request({method:"frak_getProductInformation"})}async function Nr(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 zt(){return Mr(96)}async function Vr(e,{siwe:t,metadata:r}){var b,l,S,x,d,m;let o=(l=(b=e.config)==null?void 0:b.domain)!=null?l:window.location.host,a=(S=t==null?void 0:t.statement)!=null?S:`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,i={...t,statement:a,nonce:(x=t==null?void 0:t.nonce)!=null?x:zt(),uri:(d=t==null?void 0:t.uri)!=null?d:`https://${o}`,version:(m=t==null?void 0:t.version)!=null?m:"1",domain:o};return(await G(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:i}}})).siweAuthenticate}async function jr(e,{tx:t,metadata:r}){return(await G(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function Wr(e,{metadata:t,login:r,openSession:o}){let a={steps:{login:r!=null?r:{},openSession:o!=null?o:{}},metadata:t};return nt(e,a)}function nt(e,t){function r(p){return nt(e,{...t,steps:{...t.steps,sendTransaction:p}})}function o(p){return nt(e,{...t,steps:{...t.steps,final:{...p,action:{key:"reward"}}}})}function a(p,b){return nt(e,{...t,steps:{...t.steps,final:{...b,action:{key:"sharing",options:p}}}})}async function i(p){var b;return p&&(t.metadata=p((b=t.metadata)!=null?b:{})),await G(e,t)}return{params:t,sendTx:r,reward:o,sharing:a,display:i}}var qr={openArticle({articleId:e}){let t=j([_.press.openArticle,z(e,{size:32})]);return{handlerTypeDenominator:$(U.press),interactionData:t}},readArticle({articleId:e}){let t=j([_.press.readArticle,z(e,{size:32})]);return{handlerTypeDenominator:$(U.press),interactionData:t}}};var at={createLink(){return{handlerTypeDenominator:$(U.referral),interactionData:_.referral.createLink}},referred({referrer:e}){let t=j([_.referral.referred,z(e,{size:32})]);return{handlerTypeDenominator:$(U.referral),interactionData:t}}};var Kr={startPurchase({purchaseId:e}){let t=j([_.purchase.started,z(e,{size:32})]);return{handlerTypeDenominator:$(U.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=kt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),o=j([_.purchase.completed,r]);return{handlerTypeDenominator:$(U.purchase),interactionData:o}},unsafeCompletedPurchase({purchaseId:e}){let t=j([_.purchase.unsafeCompleted,z(e,{size:32})]);return{handlerTypeDenominator:$(U.purchase),interactionData:t}}};var Jr={open(){return{handlerTypeDenominator:$(U.webshop),interactionData:_.webshop.open}}};var Gr={customerMeeting({agencyId:e}){let t=j([_.retail.customerMeeting,z(e,{size:32})]);return{handlerTypeDenominator:$(U.retail),interactionData:t}}};async function it(e,{walletStatus:t,frakContext:r,modalConfig:o,productId:a,options:i}){var S,x;let p=!1;async function b(){if(!p)return p=!0,Uo(e,{modalConfig:o,walletStatus:t})}async function l(d){let m=at.referred({referrer:d});await ot(e,{productId:a,interaction:m})}try{let{status:d,currentWallet:m}=await $o({initialWalletStatus:t,getFreshWalletStatus:b,pushReferralInteraction:l,frakContext:r});return oe.replaceUrl({url:(S=window.location)==null?void 0:S.href,context:i!=null&&i.alwaysAppendUrl?{r:m}:null}),d}catch(d){return console.log("Error processing referral",{error:d}),oe.replaceUrl({url:(x=window.location)==null?void 0:x.href,context:i!=null&&i.alwaysAppendUrl?{r:t==null?void 0:t.wallet}:null}),Oo(d)}}async function $o({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:o}){let a=e==null?void 0:e.wallet;return o!=null&&o.r?(a||(a=await t()),a&&Ht(o.r,a)?{status:"self-referral",currentWallet:a}:(e!=null&&e.interactionSession||(a=await t()),await r(o.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function Uo(e,{modalConfig:t,walletStatus:r}){var o,a,i;if(!(r!=null&&r.interactionSession)){if(!t)return;let p=await G(e,t);return(a=(o=p==null?void 0:p.login)==null?void 0:o.wallet)!=null?a:void 0}return(i=r.wallet)!=null?i:void 0}function Oo(e){if(e instanceof R)switch(e.code){case H.walletNotConnected:return"no-wallet";case H.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Xr(e,{productId:t,modalConfig:r,options:o}={}){let a=oe.parse({url:window.location.href}),i=await rt(e);try{return await it(e,{walletStatus:i,frakContext:a,modalConfig:r,productId:t,options:o})}catch(p){console.warn("Error processing referral",{error:p})}}return no(_o);})();
|
|
18
|
+
`.trim()}};function Nt(){let e=new Map;return{createChannel:t=>{let r=Math.random().toString(36).substring(7);return e.set(r,t),r},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}var ie={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{width:"0",height:"0",border:"0",position:"absolute",zIndex:2000001,top:"-1000px",left:"-1000px"}};function ge({walletBaseUrl:e,config:t}){let r=document.querySelector("#nexus-wallet");r&&r.remove();let o=document.createElement("iframe");return o.id=ie.id,o.name=ie.name,o.allow=ie.allow,o.style.zIndex=ie.style.zIndex.toString(),ft({iframe:o,isVisible:!1}),document.body.appendChild(o),new Promise(a=>{o?.addEventListener("load",()=>a(o)),o.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function ft({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 Vt({iframe:e}){let t=new W;return{handleEvent:async o=>{switch(o.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":o.data.backup?localStorage.setItem(ue,o.data.backup):localStorage.removeItem(ue);break;case"remove-backup":localStorage.removeItem(ue);break;case"show":case"hide":ft({iframe:e,isVisible:o.iframeLifecycle==="show"});break;case"handshake":{e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:o.data.token,currentUrl:window.location.href}},"*");break}}},isConnected:t.promise}}function jt({frakWalletUrl:e,iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}){if(typeof window>"u")throw new R(H.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new R(H.configError,"The iframe does not have a product window");let p=t.contentWindow;async function u(T){if(!T.origin)return;try{if(new URL(T.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(h){console.log("Unable to check frak msg origin",h);return}if(typeof T.data!="object")return;if(a.setLastResponse(T),"iframeLifecycle"in T.data){await o.handleEvent(T.data);return}if("clientLifecycle"in T.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let y=T.data.id,d=r.getRpcResolver(y);d&&await d(T.data)}window.addEventListener("message",u);function S(T){p.postMessage(T,{targetOrigin:e}),a.setLastRequest(T,e)}function f(){window.removeEventListener("message",u)}return{sendEvent:S,cleanup:f}}function be({config:e,iframe:t}){let r=Nt(),o=Vt({iframe:t}),a=new ae(e,t),p=jt({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:o,debugInfo:a}),u=async d=>{if(!await o.isConnected)throw new R(H.clientNotConnected,"The iframe provider isn't connected yet");let i=new W,g=r.createChannel(async s=>{let w=await ne(s.data);w.error?i.reject(new R(w.error.code,w.error.message,w.error?.data)):i.resolve(w.result),r.removeChannel(g)}),n=await oe(d);return p.sendEvent({id:g,topic:d.method,data:n}),i.promise},S=async(d,h)=>{if(!await o.isConnected)throw new R(H.clientNotConnected,"The iframe provider isn't connected yet");let g=r.createChannel(async s=>{let w=await ne(s.data);if(w.result)h(w.result);else throw new De("No valid result in the response")}),n=await oe(d);p.sendEvent({id:g,topic:d.method,data:n})},f=oo(p,o),T=async()=>{f(),r.destroy(),p.cleanup(),t.remove()},y=no({config:e,messageHandler:p,lifecycleManager:o}).then(()=>a.updateSetupStatus(!0));return{config:e,debugInfo:a,waitForConnection:o.isConnected,waitForSetup:y,request:u,listenerRequest:S,destroy:T}}function oo(e,t){let a,p,u=()=>e.sendEvent({clientLifecycle:"heartbeat"});async function S(){u(),a=setInterval(u,100),p=setTimeout(()=>{f(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,f()}function f(){a&&clearInterval(a),p&&clearTimeout(p)}return S(),f}async function no({config:e,messageHandler:t,lifecycleManager:r}){await r.isConnected;let o=async()=>{let p=e.metadata.css;p&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:p}})},a=async()=>{if(typeof window>"u")return;let p=window.localStorage.getItem(ue);p&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:p}})};await Promise.all([o(),a()])}var Ze=256,Qe;function Pr(e=11){if(!Qe||Ze+e>256*2){Qe="",Ze=0;for(let t=0;t<256;t++)Qe+=(256+Math.random()*256|0).toString(16).substring(1)}return Qe.substring(Ze,Ze+++e)}Ar();Ke();ve();Pt();Cr();Tt();Fe();var Ht="fCtx";function Bo(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ho(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),r=>r.charCodeAt(0))}function kr(e){if(e?.r)try{let t=Ae(e.r);return Bo(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Mr(e){if(!(!e||e.length===0))try{let t=Ho(e);return{r:Ee(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Rr({url:e}){if(!e)return null;let r=new URL(e).searchParams.get(Ht);return r?Mr(r):null}function Br({url:e,context:t}){if(!e)return null;let r=Rr({url:e}),o=r?{...r,...t}:t;if(!o.r)return null;let a=kr(o);if(!a)return null;let p=new URL(e);return p.searchParams.set(Ht,a),p.toString()}function Hr(e){let t=new URL(e);return t.searchParams.delete(Ht),t.toString()}function Do({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}let r=e??window.location.href,o;t!==null?o=Br({url:r,context:t}):o=Hr(r),o&&window.history.replaceState(null,"",o.toString())}var re={compress:kr,decompress:Mr,parse:Rr,update:Br,remove:Hr,replaceUrl:Do};async function Dt({config:e}){let t=await ge({config:e});if(!t){console.error("Failed to create iframe");return}let r=be({config:e,iframe:t});if(await r.waitForSetup,!await r.waitForConnection){console.error("Failed to connect to client");return}return r}var U={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},Dr=Object.entries(U).reduce((e,[t,r])=>(e[t]=BigInt(1)<<BigInt(r),e),{});var _={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 et(e,t){if(!t)return e.request({method:"frak_listenToWalletStatus"}).then(a=>(Lr(a.interactionToken),a));let r=new W,o=!1;return e.listenerRequest({method:"frak_listenToWalletStatus"},a=>{t(a),Lr(a.interactionToken),o||(r.resolve(a),o=!0)}).then(()=>r.promise)}function Lr(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function zr({domain:e}){let t=e??window.location.host;return ke($(t))}async function tt(e,{productId:t,interaction:r,validation:o}){let a=t??zr(e.config);return await e.request({method:"frak_sendInteraction",params:[a,r,o]})}async function J(e,{steps:t,metadata:r}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,r]})}async function $r(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function Ur(e,t){let{metadata:r}=e.config;await e.request({method:"frak_sso",params:[t,r.name,r.css]})}async function Or(e){return await e.request({method:"frak_getProductInformation"})}async function _r(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 Lt(){return Pr(96)}async function Nr(e,{siwe:t,metadata:r}){let o=e.config?.domain??window.location.host,a=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`,p={...t,statement:a,nonce:t?.nonce??Lt(),uri:t?.uri??`https://${o}`,version:t?.version??"1",domain:o};return(await J(e,{metadata:r,steps:{login:{},siweAuthenticate:{siwe:p}}})).siweAuthenticate}async function Vr(e,{tx:t,metadata:r}){return(await J(e,{metadata:r,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function jr(e,{metadata:t,login:r,openSession:o}){return rt(e,{steps:{login:r??{},openSession:o??{}},metadata:t})}function rt(e,t){function r(u){return rt(e,{...t,steps:{...t.steps,sendTransaction:u}})}function o(u){return rt(e,{...t,steps:{...t.steps,final:{...u,action:{key:"reward"}}}})}function a(u,S){return rt(e,{...t,steps:{...t.steps,final:{...S,action:{key:"sharing",options:u}}}})}async function p(u){return u&&(t.metadata=u(t.metadata??{})),await J(e,t)}return{params:t,sendTx:r,reward:o,sharing:a,display:p}}var Wr={openArticle({articleId:e}){let t=j([_.press.openArticle,z(e,{size:32})]);return{handlerTypeDenominator:$(U.press),interactionData:t}},readArticle({articleId:e}){let t=j([_.press.readArticle,z(e,{size:32})]);return{handlerTypeDenominator:$(U.press),interactionData:t}}};var ot={createLink(){return{handlerTypeDenominator:$(U.referral),interactionData:_.referral.createLink}},referred({referrer:e}){let t=j([_.referral.referred,z(e,{size:32})]);return{handlerTypeDenominator:$(U.referral),interactionData:t}}};var qr={startPurchase({purchaseId:e}){let t=j([_.purchase.started,z(e,{size:32})]);return{handlerTypeDenominator:$(U.purchase),interactionData:t}},completedPurchase({purchaseId:e,proof:t}){let r=kt([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),t]),o=j([_.purchase.completed,r]);return{handlerTypeDenominator:$(U.purchase),interactionData:o}},unsafeCompletedPurchase({purchaseId:e}){let t=j([_.purchase.unsafeCompleted,z(e,{size:32})]);return{handlerTypeDenominator:$(U.purchase),interactionData:t}}};var Kr={open(){return{handlerTypeDenominator:$(U.webshop),interactionData:_.webshop.open}}};var Jr={customerMeeting({agencyId:e}){let t=j([_.retail.customerMeeting,z(e,{size:32})]);return{handlerTypeDenominator:$(U.retail),interactionData:t}}};async function nt(e,{walletStatus:t,frakContext:r,modalConfig:o,productId:a,options:p}){let u=!1;async function S(){if(!u)return u=!0,zo(e,{modalConfig:o,walletStatus:t})}async function f(T){let y=ot.referred({referrer:T});await tt(e,{productId:a,interaction:y})}try{let{status:T,currentWallet:y}=await Lo({initialWalletStatus:t,getFreshWalletStatus:S,pushReferralInteraction:f,frakContext:r});return re.replaceUrl({url:window.location?.href,context:p?.alwaysAppendUrl?{r:y}:null}),T}catch(T){return console.log("Error processing referral",{error:T}),re.replaceUrl({url:window.location?.href,context:p?.alwaysAppendUrl?{r:t?.wallet}:null}),$o(T)}}async function Lo({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:r,frakContext:o}){let a=e?.wallet;return o?.r?(a||(a=await t()),a&&Bt(o.r,a)?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await r(o.r),{status:"success",currentWallet:a})):{status:"no-referrer",currentWallet:a}}async function zo(e,{modalConfig:t,walletStatus:r}){return r?.interactionSession?r.wallet??void 0:t?(await J(e,t))?.login?.wallet??void 0:void 0}function $o(e){if(e instanceof R)switch(e.code){case H.walletNotConnected:return"no-wallet";case H.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function Gr(e,{productId:t,modalConfig:r,options:o}={}){let a=re.parse({url:window.location.href}),p=await et(e);try{return await nt(e,{walletStatus:p,frakContext:a,modalConfig:r,productId:t,options:o})}catch(u){console.warn("Error processing referral",{error:u})}}return ro(Uo);})();
|
|
19
19
|
/*! Bundled license information:
|
|
20
20
|
|
|
21
21
|
js-sha256/src/sha256.js:
|
package/dist/actions/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk7YDJDVXY_cjs = require('../chunk-7YDJDVXY.cjs');
|
|
4
|
+
var chunkPHVGCFDX_cjs = require('../chunk-PHVGCFDX.cjs');
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
var siwe = require('viem/siwe');
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ function watchWalletStatus(client, callback) {
|
|
|
13
13
|
return result;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
const firstResult = new
|
|
16
|
+
const firstResult = new chunk7YDJDVXY_cjs.Deferred();
|
|
17
17
|
let hasResolved = false;
|
|
18
18
|
return client.listenerRequest(
|
|
19
19
|
{
|
|
@@ -43,13 +43,13 @@ function savePotentialToken(interactionToken) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function computeProductId({ domain }) {
|
|
46
|
-
const effectiveDomain = domain
|
|
46
|
+
const effectiveDomain = domain ?? window.location.host;
|
|
47
47
|
return viem.keccak256(viem.toHex(effectiveDomain));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/actions/sendInteraction.ts
|
|
51
51
|
async function sendInteraction(client, { productId, interaction, validation }) {
|
|
52
|
-
const pId = productId
|
|
52
|
+
const pId = productId ?? computeProductId(client.config);
|
|
53
53
|
return await client.request({
|
|
54
54
|
method: "frak_sendInteraction",
|
|
55
55
|
params: [pId, interaction, validation]
|
|
@@ -112,15 +112,14 @@ async function trackPurchaseStatus(args) {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
async function siweAuthenticate(client, { siwe: siwe$1, metadata }) {
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
const realStatement = (_c = siwe$1 == null ? undefined : siwe$1.statement) != null ? _c : `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
|
|
115
|
+
const effectiveDomain = client.config?.domain ?? window.location.host;
|
|
116
|
+
const realStatement = siwe$1?.statement ?? `I confirm that I want to use my Frak wallet on: ${client.config.metadata.name}`;
|
|
118
117
|
const builtSiwe = {
|
|
119
118
|
...siwe$1,
|
|
120
119
|
statement: realStatement,
|
|
121
|
-
nonce:
|
|
122
|
-
uri:
|
|
123
|
-
version:
|
|
120
|
+
nonce: siwe$1?.nonce ?? siwe.generateSiweNonce(),
|
|
121
|
+
uri: siwe$1?.uri ?? `https://${effectiveDomain}`,
|
|
122
|
+
version: siwe$1?.version ?? "1",
|
|
124
123
|
domain: effectiveDomain
|
|
125
124
|
};
|
|
126
125
|
const result = await displayModal(client, {
|
|
@@ -155,8 +154,8 @@ function modalBuilder(client, {
|
|
|
155
154
|
}) {
|
|
156
155
|
const baseParams = {
|
|
157
156
|
steps: {
|
|
158
|
-
login: login
|
|
159
|
-
openSession: openSession
|
|
157
|
+
login: login ?? {},
|
|
158
|
+
openSession: openSession ?? {}
|
|
160
159
|
},
|
|
161
160
|
metadata
|
|
162
161
|
};
|
|
@@ -203,9 +202,8 @@ function modalStepsBuilder(client, params) {
|
|
|
203
202
|
);
|
|
204
203
|
}
|
|
205
204
|
async function display(metadataOverride) {
|
|
206
|
-
var _a;
|
|
207
205
|
if (metadataOverride) {
|
|
208
|
-
params.metadata = metadataOverride(
|
|
206
|
+
params.metadata = metadataOverride(params.metadata ?? {});
|
|
209
207
|
}
|
|
210
208
|
return await displayModal(client, params);
|
|
211
209
|
}
|
|
@@ -227,7 +225,6 @@ async function processReferral(client, {
|
|
|
227
225
|
productId,
|
|
228
226
|
options
|
|
229
227
|
}) {
|
|
230
|
-
var _a, _b;
|
|
231
228
|
let walletRequest = false;
|
|
232
229
|
async function getFreshWalletStatus() {
|
|
233
230
|
if (walletRequest) {
|
|
@@ -240,7 +237,7 @@ async function processReferral(client, {
|
|
|
240
237
|
});
|
|
241
238
|
}
|
|
242
239
|
async function pushReferralInteraction(referrer) {
|
|
243
|
-
const interaction =
|
|
240
|
+
const interaction = chunkPHVGCFDX_cjs.ReferralInteractionEncoder.referred({
|
|
244
241
|
referrer
|
|
245
242
|
});
|
|
246
243
|
await sendInteraction(client, { productId, interaction });
|
|
@@ -252,16 +249,16 @@ async function processReferral(client, {
|
|
|
252
249
|
pushReferralInteraction,
|
|
253
250
|
frakContext
|
|
254
251
|
});
|
|
255
|
-
|
|
256
|
-
url:
|
|
257
|
-
context:
|
|
252
|
+
chunk7YDJDVXY_cjs.FrakContextManager.replaceUrl({
|
|
253
|
+
url: window.location?.href,
|
|
254
|
+
context: options?.alwaysAppendUrl ? { r: currentWallet } : null
|
|
258
255
|
});
|
|
259
256
|
return status;
|
|
260
257
|
} catch (error) {
|
|
261
258
|
console.log("Error processing referral", { error });
|
|
262
|
-
|
|
263
|
-
url:
|
|
264
|
-
context:
|
|
259
|
+
chunk7YDJDVXY_cjs.FrakContextManager.replaceUrl({
|
|
260
|
+
url: window.location?.href,
|
|
261
|
+
context: options?.alwaysAppendUrl ? { r: walletStatus?.wallet } : null
|
|
265
262
|
});
|
|
266
263
|
return mapErrorToState(error);
|
|
267
264
|
}
|
|
@@ -272,8 +269,8 @@ async function processReferralLogic({
|
|
|
272
269
|
pushReferralInteraction,
|
|
273
270
|
frakContext
|
|
274
271
|
}) {
|
|
275
|
-
let currentWallet = initialWalletStatus
|
|
276
|
-
if (!
|
|
272
|
+
let currentWallet = initialWalletStatus?.wallet;
|
|
273
|
+
if (!frakContext?.r) {
|
|
277
274
|
return { status: "no-referrer", currentWallet };
|
|
278
275
|
}
|
|
279
276
|
if (!currentWallet) {
|
|
@@ -282,7 +279,7 @@ async function processReferralLogic({
|
|
|
282
279
|
if (currentWallet && viem.isAddressEqual(frakContext.r, currentWallet)) {
|
|
283
280
|
return { status: "self-referral", currentWallet };
|
|
284
281
|
}
|
|
285
|
-
if (!
|
|
282
|
+
if (!initialWalletStatus?.interactionSession) {
|
|
286
283
|
currentWallet = await getFreshWalletStatus();
|
|
287
284
|
}
|
|
288
285
|
await pushReferralInteraction(frakContext.r);
|
|
@@ -292,22 +289,21 @@ async function ensureWalletConnected(client, {
|
|
|
292
289
|
modalConfig,
|
|
293
290
|
walletStatus
|
|
294
291
|
}) {
|
|
295
|
-
|
|
296
|
-
if (!(walletStatus == null ? undefined : walletStatus.interactionSession)) {
|
|
292
|
+
if (!walletStatus?.interactionSession) {
|
|
297
293
|
if (!modalConfig) {
|
|
298
294
|
return undefined;
|
|
299
295
|
}
|
|
300
296
|
const result = await displayModal(client, modalConfig);
|
|
301
|
-
return
|
|
297
|
+
return result?.login?.wallet ?? undefined;
|
|
302
298
|
}
|
|
303
|
-
return
|
|
299
|
+
return walletStatus.wallet ?? undefined;
|
|
304
300
|
}
|
|
305
301
|
function mapErrorToState(error) {
|
|
306
|
-
if (error instanceof
|
|
302
|
+
if (error instanceof chunk7YDJDVXY_cjs.FrakRpcError) {
|
|
307
303
|
switch (error.code) {
|
|
308
|
-
case
|
|
304
|
+
case chunk7YDJDVXY_cjs.RpcErrorCodes.walletNotConnected:
|
|
309
305
|
return "no-wallet";
|
|
310
|
-
case
|
|
306
|
+
case chunk7YDJDVXY_cjs.RpcErrorCodes.serverErrorForInteractionDelegation:
|
|
311
307
|
return "no-session";
|
|
312
308
|
default:
|
|
313
309
|
return "error";
|
|
@@ -322,7 +318,7 @@ async function referralInteraction(client, {
|
|
|
322
318
|
modalConfig,
|
|
323
319
|
options
|
|
324
320
|
} = {}) {
|
|
325
|
-
const frakContext =
|
|
321
|
+
const frakContext = chunk7YDJDVXY_cjs.FrakContextManager.parse({
|
|
326
322
|
url: window.location.href
|
|
327
323
|
});
|
|
328
324
|
const currentWalletStatus = await watchWalletStatus(client);
|
package/dist/actions/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, j as DisplayModalParamsType, l as ModalRpcStepsResultType, D as DisplayEmbededWalletParamsType, O as OpenSsoParamsType, G as GetProductInformationReturnType, q as SiweAuthenticationParams, h as ModalRpcMetadata, r as SiweAuthenticateReturnType, t as SendTransactionModalStepType, u as SendTransactionReturnType,
|
|
1
|
+
import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, j as DisplayModalParamsType, l as ModalRpcStepsResultType, D as DisplayEmbededWalletParamsType, O as OpenSsoParamsType, G as GetProductInformationReturnType, q as SiweAuthenticationParams, h as ModalRpcMetadata, r as SiweAuthenticateReturnType, t as SendTransactionModalStepType, u as SendTransactionReturnType, n as LoginModalStepType, w as OpenInteractionSessionModalStepType, x as FinalModalStepType, y as FinalActionType, b as FrakContext } from '../context-D7aZDKLT.cjs';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-CTQ5-kqe.cjs';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
4
|
import 'viem/chains';
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, j as DisplayModalParamsType, l as ModalRpcStepsResultType, D as DisplayEmbededWalletParamsType, O as OpenSsoParamsType, G as GetProductInformationReturnType, q as SiweAuthenticationParams, h as ModalRpcMetadata, r as SiweAuthenticateReturnType, t as SendTransactionModalStepType, u as SendTransactionReturnType,
|
|
1
|
+
import { a as FrakClient, W as WalletStatusReturnType, M as ModalStepTypes, j as DisplayModalParamsType, l as ModalRpcStepsResultType, D as DisplayEmbededWalletParamsType, O as OpenSsoParamsType, G as GetProductInformationReturnType, q as SiweAuthenticationParams, h as ModalRpcMetadata, r as SiweAuthenticateReturnType, t as SendTransactionModalStepType, u as SendTransactionReturnType, n as LoginModalStepType, w as OpenInteractionSessionModalStepType, x as FinalModalStepType, y as FinalActionType, b as FrakContext } from '../context-rDsQbSgB.js';
|
|
2
2
|
import { S as SendInteractionParamsType, a as SendInteractionReturnType } from '../interaction-CTQ5-kqe.js';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
4
|
import 'viem/chains';
|