@frak-labs/components 0.0.9 → 0.0.11
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/364.js +13 -0
- package/cdn/413.js +2 -0
- package/cdn/413.js.LICENSE.txt +10 -0
- package/cdn/button-share.css +1 -0
- package/cdn/button-share.js +1 -0
- package/cdn/button-wallet.css +1 -0
- package/cdn/button-wallet.js +1 -0
- package/cdn/components.js +1 -21
- package/cdn/loader.js +1 -0
- package/dist/buttonShare.css +1 -0
- package/dist/buttonShare.d.ts +85 -0
- package/dist/buttonShare.js +1 -0
- package/dist/buttonWallet.css +1 -0
- package/dist/buttonWallet.d.ts +64 -0
- package/dist/buttonWallet.js +1 -0
- package/package.json +11 -13
- package/cdn/components.css +0 -1
package/cdn/364.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const ids=["364"];export const modules={"./src/hooks/useClientReady.ts":function(e,t,n){n.d(t,{t:()=>o});var r=n("./src/utils/clientReady.ts"),a=n("../../node_modules/preact/hooks/dist/hooks.module.js");function o(){let[e,t]=(0,a.eJ)(!0),n=(0,a.I4)(()=>{t(!1)},[]);return(0,a.d4)(()=>((0,r.D)("add",n),()=>(0,r.D)("remove",n)),[n]),{isClientReady:!e}}},"./src/hooks/useReward.ts":function(e,t,n){n.d(t,{w:()=>i});var r=n("../core/dist/actions.js");async function a(e){let t=window.FrakSetup?.client;if(!t){console.warn("Frak client not ready yet");return}let n=await (0,r.pO)(t);if(!n?.estimatedEurReward)return;let a=n.estimatedEurReward;if(e){let t=n.rewards.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer.eurAmount).reduce((e,t)=>t>e?t:e,0);t>0&&(a=Math.ceil(t).toString())}return a}var o=n("../../node_modules/preact/hooks/dist/hooks.module.js");function i(e,t){let[n,r]=(0,o.eJ)(void 0);return(0,o.d4)(()=>{e&&a(t).then(e=>{e&&r(`${e}€`)})},[e,t]),{reward:n}}},"./src/utils/clientReady.ts":function(e,t,n){n.d(t,{D:()=>o,f:()=>a});let r="frakClientReady";function a(){let e=new CustomEvent(r);window.dispatchEvent(e)}function o(e,t){if(window.FrakSetup?.client&&"add"===e){t();return}("add"===e?window.addEventListener:window.removeEventListener)(r,t,!1)}},"./src/utils/registerWebComponent.ts":function(e,t,n){n.d(t,{A:()=>l});var r=n("../../node_modules/preact-custom-element/dist/preact-custom-element.esm.js"),a=n("../core/dist/index.js"),o=n("./src/utils/clientReady.ts"),i=n("./src/utils/setup.ts");async function s(){if(!(window.frakSetupInProgress?(console.log("[Frak SDK] Initialization already in progress"),!1):window.FrakSetup?.client?(console.log("[Frak SDK] Client already initialized"),!1):!!window.FrakSetup?.config||(console.error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set."),!1)))return;console.log("[Frak SDK] Starting initialization"),window.frakSetupInProgress=!0;let e=await (0,a.lD)({config:{...window.FrakSetup.config,metadata:{name:"Frak SDK"}}});if(!e){console.error("[Frak SDK] Failed to create client"),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log("[Frak SDK] Client initialized successfully"),(0,o.f)(),(0,i.N3)(e),(0,i.zK)(e),window.frakSetupInProgress=!1}function l(e,t,n=[],a={shadow:!1}){if("undefined"!=typeof window){var o;o=async function(){await s()},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(o,1):document.addEventListener?document.addEventListener("DOMContentLoaded",o):document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&o()}),customElements.get(t)||(0,r.Z)(e,t,n,a)}}},"./src/utils/setup.ts":function(e,t,n){n.d(t,{Gt:()=>i,N3:()=>a,zK:()=>o});var r=n("../core/dist/actions.js");function a(e){window.modalBuilderSteps=(0,r.jy)(e,window.FrakSetup?.modalConfig??{})}async function o(e){if(!window.modalBuilderSteps){console.error("modalBuilderSteps not found");return}console.log("referral",await (0,r.KS)(e,{modalConfig:window.modalBuilderSteps.reward().params}))}function i(){if(!window.modalBuilderSteps)throw Error("modalBuilderSteps not found");return window.modalBuilderSteps}},"?2fd0":function(){},"?81fa":function(){},"../core/dist/actions.js":function(e,t,n){n.d(t,{Hq:()=>u,KS:()=>E,jy:()=>w,pO:()=>f});var r=n("../../node_modules/viem/_esm/utils/hash/keccak256.js"),a=n("../../node_modules/viem/_esm/utils/encoding/toHex.js"),o=n("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),i=n("../../node_modules/viem/_esm/utils/data/concat.js"),s=n("../../node_modules/viem/_esm/utils/data/pad.js"),l=n("../../node_modules/viem/_esm/utils/address/isAddressEqual.js");async function c(e,{productId:t,interaction:n,validation:o}){let i=t??function({domain:e}){let t=e??window.location.host;return(0,r.w)((0,a.NC)(t))}(e.config);return await e.request({method:"frak_sendInteraction",params:[i,n,o]})}async function d(e,{steps:t,metadata:n}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,n]})}async function u(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function f(e){return await e.request({method:"frak_getProductInformation"})}function w(e,{metadata:t,login:n,openSession:r}){return function e(t,n){async function r(e){return e&&(n.metadata=e(n.metadata??{})),await d(t,n)}return{params:n,sendTx:function(r){return e(t,{...n,steps:{...n.steps,sendTransaction:r}})},reward:function(r){return e(t,{...n,steps:{...n.steps,final:{...r,action:{key:"reward"}}}})},sharing:function(r,a){return e(t,{...n,steps:{...n.steps,final:{...a,action:{key:"sharing",options:r}}}})},display:r}}(e,{steps:{login:n??{},openSession:r??{}},metadata:t})}let m="fCtx";function p({url:e}){if(!e)return null;let t=new URL(e).searchParams.get(m);return t?function(e){if(e&&0!==e.length)try{let t;let n=(t=e.length%4,Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(0===t?0:4-t),"=")),e=>e.charCodeAt(0)));return{r:(0,a.ci)(n,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}(t):null}let g={parse:p,replaceUrl:function({url:e,context:t}){let n,r;if(!window.location?.href||"undefined"==typeof window){console.error("No window found, can't update context");return}let a=e??window.location.href;(n=null!==t?function({url:e,context:t}){if(!e)return null;let n=p({url:e}),r=n?{...n,...t}:t;if(!r.r)return null;let a=function(e){if(e?.r)try{var t;return t=(0,o.nr)(e.r),btoa(Array.from(t,e=>String.fromCharCode(e)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}(r);if(!a)return null;let i=new URL(e);return i.searchParams.set(m,a),i.toString()}({url:a,context:t}):((r=new URL(a)).searchParams.delete(m),r.toString()))&&window.history.replaceState(null,"",n.toString())}},h={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31};Object.entries(h).reduce((e,[t,n])=>(e[t]=BigInt(1)<<BigInt(n),e),{});let y={createLink:()=>({handlerTypeDenominator:(0,a.NC)(h.referral),interactionData:"0xb2c0f17c"}),referred({referrer:e}){let t=(0,i.SM)(["0x010cc3b9",(0,s.vk)(e,{size:32})]);return{handlerTypeDenominator:(0,a.NC)(h.referral),interactionData:t}}};class v extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}}let S={walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};async function k(e,{walletStatus:t,frakContext:n,modalConfig:r,productId:a,options:o}){let i=!1;async function s(){if(!i)return i=!0,b(e,{modalConfig:r,walletStatus:t})}async function l(t){let n=y.referred({referrer:t});await c(e,{productId:a,interaction:n})}try{let{status:e,currentWallet:r}=await C({initialWalletStatus:t,getFreshWalletStatus:s,pushReferralInteraction:l,frakContext:n});return g.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:r}:null}),e}catch(e){return console.log("Error processing referral",{error:e}),g.replaceUrl({url:window.location?.href,context:o?.alwaysAppendUrl?{r:t?.wallet}:null}),function(e){if(e instanceof v)switch(e.code){case S.walletNotConnected:return"no-wallet";case S.serverErrorForInteractionDelegation:return"no-session"}return"error"}(e)}}async function C({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:n,frakContext:r}){let a=e?.wallet;return r?.r?(a||(a=await t()),a&&(0,l.E)(r.r,a))?{status:"self-referral",currentWallet:a}:(e?.interactionSession||(a=await t()),await n(r.r),{status:"success",currentWallet:a}):{status:"no-referrer",currentWallet:a}}async function b(e,{modalConfig:t,walletStatus:n}){if(!n?.interactionSession){if(!t)return;let n=await d(e,t);return n?.login?.wallet??void 0}return n.wallet??void 0}async function E(e,{productId:t,modalConfig:n,options:r}={}){var a;let o=g.parse({url:window.location.href}),i=await e.request({method:"frak_listenToWalletStatus"}).then(e=>{var t;return t=e.interactionToken,"undefined"!=typeof window&&(t?window.sessionStorage.setItem("frak-wallet-interaction-token",t):window.sessionStorage.removeItem("frak.interaction-token")),e});try{return await k(e,{walletStatus:i,frakContext:o,modalConfig:n,productId:t,options:r})}catch(e){console.warn("Error processing referral",{error:e})}}},"../core/dist/index.js":function(e,t,n){n.d(t,{lD:()=>y,oC:()=>l,ss:()=>s,u:()=>o});var r=n("../../node_modules/async-lz-string/libs/async-lz-string.js"),a=n("../../node_modules/js-sha256/src/sha256.js");class o extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}}class i extends o{constructor(e){super(s.internalError,e)}}let s={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006};class l{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(e,t){this.config=e,this.iframe=t,this.lastRequest=null,this.lastResponse=null}setLastResponse(e){this.lastResponse={event:e.data,origin:e.origin,timestamp:Date.now()}}setLastRequest(e,t){this.lastRequest={event:e,target:t,timestamp:Date.now()}}updateSetupStatus(e){this.isSetupDone=e}base64Encode(e){try{return btoa(JSON.stringify(e))}catch(e){return console.warn("Failed to encode debug data",e),btoa("Failed to encode data")}}getIframeStatus(){return this.iframe?{loading:this.iframe.hasAttribute("loading"),url:this.iframe.src,readyState:this.iframe.contentDocument?.readyState?+("complete"===this.iframe.contentDocument.readyState):-1,contentWindow:!!this.iframe.contentWindow,isConnected:this.iframe.isConnected}:null}getNavigatorInfo(){return navigator?{userAgent:navigator.userAgent,language:navigator.language,onLine:navigator.onLine,screenWidth:window.screen.width,screenHeight:window.screen.height,pixelRatio:window.devicePixelRatio}:null}gatherDebugInfo(e){let t=this.getIframeStatus(),n=this.getNavigatorInfo(),r="Unknown";return e instanceof o?r=`FrakRpcError: ${e.code} '${e.message}'`:e instanceof Error?r=e.message:"string"==typeof e&&(r=e),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:n?this.base64Encode(n):"no-navigator",iframeStatus:t?this.base64Encode(t):"not-iframe",lastRequest:this.lastRequest?this.base64Encode(this.lastRequest):"No Frak request logged",lastResponse:this.lastResponse?this.base64Encode(this.lastResponse):"No Frak response logged",clientStatus:this.isSetupDone?"setup":"not-setup",error:r}}static empty(){return new l}formatDebugInfo(e){let t=this.gatherDebugInfo(e);return`
|
|
2
|
+
Debug Information:
|
|
3
|
+
-----------------
|
|
4
|
+
Timestamp: ${t.timestamp}
|
|
5
|
+
URL: ${t.encodedUrl}
|
|
6
|
+
Config: ${t.encodedConfig}
|
|
7
|
+
Navigator Info: ${t.navigatorInfo}
|
|
8
|
+
IFrame Status: ${t.iframeStatus}
|
|
9
|
+
Last Request: ${t.lastRequest}
|
|
10
|
+
Last Response: ${t.lastResponse}
|
|
11
|
+
Client Status: ${t.clientStatus}
|
|
12
|
+
Error: ${t.error}
|
|
13
|
+
`.trim()}}class c{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}}async function d(e){if(!(e?.compressed&&e?.compressedHash))throw new o(s.corruptedResponse,"Missing compressed data");let t=await u(e.compressed);if(!t)throw new o(s.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new o(s.corruptedResponse,"Missing validation hash");if((0,a.sha256)(e.compressed)!==e.compressedHash)throw new o(s.corruptedResponse,"Invalid compressed hash");let{validationHash:n,...r}=t;if((0,a.sha256)(JSON.stringify(r))!==t.validationHash)throw new o(s.corruptedResponse,"Invalid data validation hash");return t}async function u(e){let t=await (0,r.decompressFromBase64)(e);try{return JSON.parse(t)}catch(e){return console.error("Invalid compressed data",{e,decompressed:t}),null}}async function f(e){let t=(0,a.sha256)(JSON.stringify(e)),n={...e,validationHash:t},r=await w(n),o=(0,a.sha256)(r);return{compressed:r,compressedHash:o}}async function w(e){return(0,r.compressToBase64)(JSON.stringify(e))}let m="nexus-wallet-backup",p=2000001;function g({iframe:e,isVisible:t}){if(!t){e.style.width="0",e.style.height="0",e.style.border="0",e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px";return}e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.pointerEvents="auto"}async function h({config:e,messageHandler:t,lifecycleManager:n}){await n.isConnected;let r=async()=>{let n=e.metadata.css;n&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:n}})},a=async()=>{if("undefined"==typeof window)return;let e=window.localStorage.getItem(m);e&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:e}})};await Promise.all([r(),a()])}async function y({config:e}){let t=await function({walletBaseUrl:e,config:t}){let n=document.querySelector("#nexus-wallet");n&&n.remove();let r=document.createElement("iframe");return r.id="nexus-wallet",r.name="nexus-wallet",r.allow="publickey-credentials-get *; clipboard-write; web-share *",r.style.zIndex=p.toString(),g({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(n=>{r?.addEventListener("load",()=>n(r)),r.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}({config:e});if(!t){console.error("Failed to create iframe");return}let n=function({config:e,iframe:t}){let n;let r=(n=new Map,{createChannel:e=>{let t=Math.random().toString(36).substring(7);return n.set(t,e),t},getRpcResolver:e=>n.get(e),removeChannel:e=>n.delete(e),destroy:()=>n.clear()}),a=function({iframe:e}){let t=new c;return{handleEvent:async n=>{switch(n.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":n.data.backup?localStorage.setItem(m,n.data.backup):localStorage.removeItem(m);break;case"remove-backup":localStorage.removeItem(m);break;case"show":case"hide":g({iframe:e,isVisible:"show"===n.iframeLifecycle});break;case"handshake":e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:n.data.token,currentUrl:window.location.href}},"*")}},isConnected:t.promise}}({iframe:t}),u=new l(e,t),w=function({frakWalletUrl:e,iframe:t,channelManager:n,iframeLifecycleManager:r,debugInfo:a}){if("undefined"==typeof window)throw new o(s.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new o(s.configError,"The iframe does not have a product window");let i=t.contentWindow;async function l(t){if(!t.origin)return;try{if(new URL(t.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(e){console.log("Unable to check frak msg origin",e);return}if("object"!=typeof t.data)return;if(a.setLastResponse(t),"iframeLifecycle"in t.data){await r.handleEvent(t.data);return}if("clientLifecycle"in t.data){console.error("Client lifecycle event received on the client side, dismissing it");return}let o=t.data.id,i=n.getRpcResolver(o);i&&await i(t.data)}return window.addEventListener("message",l),{sendEvent:function(t){i.postMessage(t,{targetOrigin:e}),a.setLastRequest(t,e)},cleanup:function(){window.removeEventListener("message",l)}}}({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:r,iframeLifecycleManager:a,debugInfo:u}),p=async e=>{if(!await a.isConnected)throw new o(s.clientNotConnected,"The iframe provider isn't connected yet");let t=new c,n=r.createChannel(async e=>{let a=await d(e.data);a.error?t.reject(new o(a.error.code,a.error.message,a.error?.data)):t.resolve(a.result),r.removeChannel(n)}),i=await f(e);return w.sendEvent({id:n,topic:e.method,data:i}),t.promise},y=async(e,t)=>{if(!await a.isConnected)throw new o(s.clientNotConnected,"The iframe provider isn't connected yet");let n=r.createChannel(async e=>{let n=await d(e.data);if(n.result)t(n.result);else throw new i("No valid result in the response")}),l=await f(e);w.sendEvent({id:n,topic:e.method,data:l})},v=function(e,t){let n,r;let a=()=>e.sendEvent({clientLifecycle:"heartbeat"});function o(){n&&clearInterval(n),r&&clearTimeout(r)}return async function(){a(),n=setInterval(a,100),r=setTimeout(()=>{o(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,o()}(),o}(w,a),S=async()=>{v(),r.destroy(),w.cleanup(),t.remove()},k=h({config:e,messageHandler:w,lifecycleManager:a}).then(()=>u.updateSetupStatus(!0));return{config:e,debugInfo:u,waitForConnection:a.isConnected,waitForSetup:k,request:p,listenerRequest:y,destroy:S}}({config:e,iframe:t});if(await n.waitForSetup,!await n.waitForConnection){console.error("Failed to connect to client");return}return n}Object.entries({dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31}).reduce((e,[t,n])=>(e[t]=BigInt(1)<<BigInt(n),e),{})}};
|
package/cdn/413.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 413.js.LICENSE.txt */
|
|
2
|
+
export const ids=["413"];export const modules={"../../node_modules/async-lz-string/libs/async-lz-string.js":function(e){var t;t=()=>{var e,t;return e={48:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.decompressFromUTF16=t.compressToUTF16=t.decompressFromBase64=t.compressToBase64=void 0;var o=n(304),s=n(134),a=new o.CompressorImpl,u=new s.DecompressorImpl,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c={};t.compressToBase64=function(e){return r(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return null===e?[2,""]:[4,a.compress(e,6,function(e){return l.charAt(e)})];case 1:switch((t=n.sent()).length%4){default:case 0:return[2,t];case 1:return[2,t+"==="];case 2:return[2,t+"=="];case 3:return[2,t+"="]}return[2]}})})},t.decompressFromBase64=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return null===e?[2,""]:""===e?[2,null]:[4,u.decompress(e.length,32,function(t){return function(e,t){if(!c[e]){c[e]={};for(var n=0;n<e.length;n++)c[e][e.charAt(n)]=n}return c[e][t]}(l,e.charAt(t))})];case 1:return[2,t.sent()]}})})},t.compressToUTF16=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return null===e?[2,""]:[4,a.compress(e,15,function(e){return String.fromCharCode(e+32)})];case 1:return[2,t.sent()+" "]}})})},t.decompressFromUTF16=function(e){return r(this,void 0,void 0,function(){return i(this,function(t){switch(t.label){case 0:return null===e?[2,""]:""===e?[2,null]:[4,u.decompress(e.length,16384,function(t){return e.charCodeAt(t)-32})];case 1:return[2,t.sent()]}})})}},304:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompressorImpl=void 0;var o=n(658),s=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],a=function(){function e(){}return e.writeValueToData=function(e,t,n,r,i){if(n%4!=0||e.dataPosition+n>r-1)for(var o=0;o<n;o++)e.dataVal=e.dataVal<<1|1&t,e.dataPosition==r-1?(e.dataPosition=0,e.data.push(i(e.dataVal)),e.dataVal=0):e.dataPosition++,t>>=1;else e.dataVal<<=n,e.dataVal|=function(e,t){for(var n=0,r=0;r<t;++r)n<<=4,n|=s[15&e],e>>=4;return n}(t,n/4),e.dataPosition+=n},e.writeWToDataVal=function(t,n,r){t.dictionaryToCreate.has(t.w)?(256>t.w.charCodeAt(0)?(e.writeValueToData(t,0,t.numBits,n,r),e.writeValueToData(t,t.w.charCodeAt(0),8,n,r)):(e.writeValueToData(t,1,t.numBits,n,r),e.writeValueToData(t,t.w.charCodeAt(0),16,n,r)),t.enlargeIn--,0==t.enlargeIn&&(t.enlargeIn=Math.pow(2,t.numBits),t.numBits++),t.dictionaryToCreate.delete(t.w)):e.writeValueToData(t,t.dictionary.get(t.w),t.numBits,n,r),t.enlargeIn--,0==t.enlargeIn&&(t.enlargeIn=Math.pow(2,t.numBits),t.numBits++)},e.loopIteration=function(e,t,n,r,i){var o=e.charAt(t);i.dictionary.has(o)||(i.dictionary.set(o,i.dictSize++),i.dictionaryToCreate.set(o,!0));var s=i.w+o;i.dictionary.has(s)?i.w=s:(this.writeWToDataVal(i,n,r),i.dictionary.set(s,i.dictSize++),i.w=String(o))},e.prototype.compress=function(t,n,s){var a=this;return new Promise(function(u){return r(a,void 0,void 0,function(){var r,a;return i(this,function(i){switch(i.label){case 0:if(null==t)return u(""),[2];r={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},a=0,i.label=1;case 1:return a<t.length?(e.loopIteration(t,a,n,s,r),a%1e4!=0?[3,3]:[4,(0,o.wait)()]):[3,4];case 2:i.sent(),i.label=3;case 3:return a+=1,[3,1];case 4:return""!==r.w&&e.writeWToDataVal(r,n,s),e.writeValueToData(r,2,r.numBits,n,s),r.dataVal<<=n-r.dataPosition,r.data.push(s(r.dataVal)),u(r.data.join("")),[2]}})})})},e}();t.CompressorImpl=a},134:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DecompressorImpl=void 0;var o=n(658),s=function(){function e(){}return e.prototype.decompress=function(e,t,n){var s=this;return new Promise(function(a){return r(s,void 0,void 0,function(){var r,s,u;return i(this,function(i){switch(i.label){case 0:for(r={bits:0,c:null,dataIndex:1,dataPosition:t,dataVal:n(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:4,numBits:3,power:1,resb:null,result:[],w:null},s=0;s<3;s+=1)r.dictionary.set(s,s);for(;r.power!=r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0==r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;switch(r.bits){case 0:for(r.bits=0,r.maxPower=256,r.power=1;r.power!=r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0==r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;r.c=String.fromCharCode(r.bits);break;case 1:for(r.bits=0,r.maxPower=65536,r.power=1;r.power!==r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0===r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;r.c=String.fromCharCode(r.bits);break;case 2:return a(""),[2]}r.dictionary[3]=r.c,r.w=r.c,r.result.push(r.c),u=1,i.label=1;case 1:return u%2e4!=0?[3,3]:[4,(0,o.wait)()];case 2:i.sent(),i.label=3;case 3:if(r.dataIndex>e)return a(""),[2];for(r.bits=0,r.maxPower=Math.pow(2,r.numBits),r.power=1;r.power!=r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0==r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;switch(r.c=r.bits){case 0:for(r.bits=0,r.maxPower=256,r.power=1;r.power!==r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0==r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;r.dictionary[r.dictSize++]=String.fromCharCode(r.bits),r.c=r.dictSize-1,r.enlargeIn--;break;case 1:for(r.bits=0,r.maxPower=65536,r.power=1;r.power!==r.maxPower;)r.resb=r.dataVal&r.dataPosition,r.dataPosition>>=1,0==r.dataPosition&&(r.dataPosition=t,r.dataVal=n(r.dataIndex++)),r.bits|=+(r.resb>0)*r.power,r.power<<=1;r.dictionary[r.dictSize++]=String.fromCharCode(r.bits),r.c=r.dictSize-1,r.enlargeIn--;break;case 2:return a(r.result.join("")),[2]}if(0==r.enlargeIn&&(r.enlargeIn=Math.pow(2,r.numBits),r.numBits++),r.dictionary[r.c])r.entry=r.dictionary[r.c];else{if(r.c!==r.dictSize)return a(null),[2];r.entry=r.w+r.w.charAt(0)}return r.result.push(r.entry),r.dictionary[r.dictSize++]=r.w+r.entry.charAt(0),r.enlargeIn--,r.w=r.entry,0==r.enlargeIn&&(r.enlargeIn=Math.pow(2,r.numBits),r.numBits++),u++,[3,1];case 4:return[2]}})})})},e}();t.DecompressorImpl=s},658:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.wait=void 0,t.wait=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,new Promise(function(e){setTimeout(e,0)})]})})}}},t={},function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}(48)},e.exports=t()},"../../node_modules/js-sha256/src/sha256.js":function(e,t,n){!function(){"use strict";var t="input is invalid type",r="object"==typeof window,i=r?window:{};i.JS_SHA256_NO_WINDOW&&(r=!1);var o=!r&&"object"==typeof self,s=!i.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;s?i=n.g:o&&(i=self);var a=!i.JS_SHA256_NO_COMMON_JS&&e.exports,u="function"==typeof define&&define.amd,l=!i.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),f=[-0x80000000,8388608,32768,128],_=[24,16,8,0],h=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2],d=["hex","array","digest","arrayBuffer"],p=[];(i.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),l&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var m=function(e,t){return function(n){return new g(t,!0).update(n)[e]()}},v=function(e){var t=m("hex",e);s&&(t=y(t,e)),t.create=function(){return new g(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<d.length;++n){var r=d[n];t[r]=m(r,e)}return t},y=function(e,r){var o,s=n("?81fa"),a=n("?2fd0").Buffer,u=r?"sha224":"sha256";return o=a.from&&!i.JS_SHA256_NO_BUFFER_FROM?a.from:function(e){return new a(e)},function(n){if("string"==typeof n)return s.createHash(u).update(n,"utf8").digest("hex");if(null==n)throw Error(t);return n.constructor===ArrayBuffer&&(n=new Uint8Array(n)),Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===a?s.createHash(u).update(o(n)).digest("hex"):e(n)}},b=function(e,t){return function(n,r){return new x(n,t,!0).update(r)[e]()}},w=function(e){var t=b("hex",e);t.create=function(t){return new x(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<d.length;++n){var r=d[n];t[r]=b(r,e)}return t};function g(e,t){t?(p[0]=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0,this.blocks=p):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=0xc1059ed8,this.h1=0x367cd507,this.h2=0x3070dd17,this.h3=0xf70e5939,this.h4=0xffc00b31,this.h5=0x68581511,this.h6=0x64f98fa7,this.h7=0xbefa4fa4):(this.h0=0x6a09e667,this.h1=0xbb67ae85,this.h2=0x3c6ef372,this.h3=0xa54ff53a,this.h4=0x510e527f,this.h5=0x9b05688c,this.h6=0x1f83d9ab,this.h7=0x5be0cd19),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function x(e,n,r){var i,o=typeof e;if("string"===o){var s,a=[],u=e.length,c=0;for(i=0;i<u;++i)(s=e.charCodeAt(i))<128?a[c++]=s:(s<2048?a[c++]=192|s>>>6:(s<55296||s>=57344?a[c++]=224|s>>>12:(s=65536+((1023&s)<<10|1023&e.charCodeAt(++i)),a[c++]=240|s>>>18,a[c++]=128|s>>>12&63),a[c++]=128|s>>>6&63),a[c++]=128|63&s);e=a}else if("object"===o){if(null===e)throw Error(t);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);e.length>64&&(e=new g(n,!0).update(e).array());var f=[],_=[];for(i=0;i<64;++i){var h=e[i]||0;f[i]=92^h,_[i]=54^h}g.call(this,n,r),this.update(_),this.oKeyPad=f,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(e){if(!this.finalized){var n,r=typeof e;if("string"!==r){if("object"===r){if(null===e)throw Error(t);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);n=!0}for(var i,o,s=0,a=e.length,u=this.blocks;s<a;){if(this.hashed&&(this.hashed=!1,u[0]=this.block,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),n)for(o=this.start;s<a&&o<64;++s)u[o>>>2]|=e[s]<<_[3&o++];else for(o=this.start;s<a&&o<64;++s)(i=e.charCodeAt(s))<128?u[o>>>2]|=i<<_[3&o++]:(i<2048?u[o>>>2]|=(192|i>>>6)<<_[3&o++]:(i<55296||i>=57344?u[o>>>2]|=(224|i>>>12)<<_[3&o++]:(i=65536+((1023&i)<<10|1023&e.charCodeAt(++s)),u[o>>>2]|=(240|i>>>18)<<_[3&o++],u[o>>>2]|=(128|i>>>12&63)<<_[3&o++]),u[o>>>2]|=(128|i>>>6&63)<<_[3&o++]),u[o>>>2]|=(128|63&i)<<_[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=u[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>0xffffffff&&(this.hBytes+=this.bytes/0x100000000<<0,this.bytes=this.bytes%0x100000000),this}},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=f[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var e,t,n,r,i,o,s,a,u,l,c,f=this.h0,_=this.h1,d=this.h2,p=this.h3,m=this.h4,v=this.h5,y=this.h6,b=this.h7,w=this.blocks;for(e=16;e<64;++e)t=((i=w[e-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=w[e-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,w[e]=w[e-16]+t+w[e-7]+n<<0;for(e=0,c=_&d;e<64;e+=4)this.first?(this.is224?(a=300032,b=(i=w[0]-0x543c9a5b)-0x8f1a6c7<<0,p=i+0x170e9b5<<0):(a=0x2a01a605,b=(i=w[0]-0xc881298)-0x5ab00ac6<<0,p=i+0x8909ae5<<0),this.first=!1):(t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),r=(a=f&_)^f&d^c,i=b+n+(m&v^~m&y)+h[e]+w[e],o=t+r,b=p+i<<0,p=i+o<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(b>>>6|b<<26)^(b>>>11|b<<21)^(b>>>25|b<<7),r=(u=p&f)^p&_^a,i=y+n+(b&m^~b&v)+h[e+1]+w[e+1],o=t+r,y=d+i<<0,t=((d=i+o<<0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),r=(l=d&p)^d&f^u,i=v+n+(y&b^~y&m)+h[e+2]+w[e+2],o=t+r,v=_+i<<0,t=((_=i+o<<0)>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),r=(c=_&d)^_&p^l,i=m+n+(v&y^~v&b)+h[e+3]+w[e+3],o=t+r,m=f+i<<0,f=i+o<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+f<<0,this.h1=this.h1+_<<0,this.h2=this.h2+d<<0,this.h3=this.h3+p<<0,this.h4=this.h4+m<<0,this.h5=this.h5+v<<0,this.h6=this.h6+y<<0,this.h7=this.h7+b<<0},g.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,s=this.h6,a=this.h7,u=c[e>>>28&15]+c[e>>>24&15]+c[e>>>20&15]+c[e>>>16&15]+c[e>>>12&15]+c[e>>>8&15]+c[e>>>4&15]+c[15&e]+c[t>>>28&15]+c[t>>>24&15]+c[t>>>20&15]+c[t>>>16&15]+c[t>>>12&15]+c[t>>>8&15]+c[t>>>4&15]+c[15&t]+c[n>>>28&15]+c[n>>>24&15]+c[n>>>20&15]+c[n>>>16&15]+c[n>>>12&15]+c[n>>>8&15]+c[n>>>4&15]+c[15&n]+c[r>>>28&15]+c[r>>>24&15]+c[r>>>20&15]+c[r>>>16&15]+c[r>>>12&15]+c[r>>>8&15]+c[r>>>4&15]+c[15&r]+c[i>>>28&15]+c[i>>>24&15]+c[i>>>20&15]+c[i>>>16&15]+c[i>>>12&15]+c[i>>>8&15]+c[i>>>4&15]+c[15&i]+c[o>>>28&15]+c[o>>>24&15]+c[o>>>20&15]+c[o>>>16&15]+c[o>>>12&15]+c[o>>>8&15]+c[o>>>4&15]+c[15&o]+c[s>>>28&15]+c[s>>>24&15]+c[s>>>20&15]+c[s>>>16&15]+c[s>>>12&15]+c[s>>>8&15]+c[s>>>4&15]+c[15&s];return this.is224||(u+=c[a>>>28&15]+c[a>>>24&15]+c[a>>>20&15]+c[a>>>16&15]+c[a>>>12&15]+c[a>>>8&15]+c[a>>>4&15]+c[15&a]),u},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,o=this.h5,s=this.h6,a=this.h7,u=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s>>>24&255,s>>>16&255,s>>>8&255,255&s];return this.is224||u.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),u},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e},x.prototype=new g,x.prototype.finalize=function(){if(g.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();g.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),g.prototype.finalize.call(this)}};var k=v();k.sha256=k,k.sha224=v(!0),k.sha256.hmac=w(),k.sha224.hmac=w(!0),a?e.exports=k:(i.sha256=k.sha256,i.sha224=k.sha224,u&&define(function(){return k}))}()},"../../node_modules/preact-custom-element/dist/preact-custom-element.esm.js":function(e,t,n){n.d(t,{Z:()=>_});var r=n("../../node_modules/preact/dist/preact.module.js");function i(){return(i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var o=["context","children"];function s(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,o);return(0,r.Tm)(t,n)}function a(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=(0,r.h)(s,i({},this._props,{context:e.detail.context}),function e(t,n){if(3===t.nodeType)return t.data;if(1!==t.nodeType)return null;var i=[],o={},s=0,a=t.attributes,l=t.childNodes;for(s=a.length;s--;)"slot"!==a[s].name&&(o[a[s].name]=a[s].value,o[u(a[s].name)]=a[s].value);for(s=l.length;s--;){var c=e(l[s],null),_=l[s].slot;_?o[_]=(0,r.h)(f,{name:_},c):i[s]=c}var h=n?(0,r.h)(f,null,i):i;return(0,r.h)(n||t.nodeName.toLowerCase(),o,h)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?r.ZB:r.sY)(this._vdom,this._root)}function u(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():""})}function l(e,t,n){if(this._vdom){var i={};i[e]=n=null==n?void 0:n,i[u(e)]=n,this._vdom=(0,r.Tm)(this._vdom,i),(0,r.sY)(this._vdom,this._root)}}function c(){(0,r.sY)(this._vdom=null,this._root)}function f(e,t){var n=this;return(0,r.h)("slot",i({},e,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function _(e,t,n,r){function i(){var t=Reflect.construct(HTMLElement,[],i);return t._vdomComponent=e,t._root=r&&r.shadow?t.attachShadow({mode:r.mode||"open"}):t,t}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=a,i.prototype.attributeChangedCallback=l,i.prototype.disconnectedCallback=c,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom.props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||(this._props={}),this._props[e]=t,this.connectedCallback());var n=typeof t;null!=t&&"string"!==n&&"boolean"!==n&&"number"!==n||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i)}},"../../node_modules/preact/dist/preact.module.js":function(e,t,n){n.d(t,{HY:()=>x,Tm:()=>H,YM:()=>i,ZB:()=>$,az:()=>w,bR:()=>function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(v(t)?t.some(function(t){e(t,n)}):n.push(t)),n},h:()=>w,sY:()=>T,wA:()=>k});var r,i,o,s,a,u,l,c,f,_,h,d={},p=[],m=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function w(e,t,n){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?r.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return g(e,a,i,o,null)}function g(e,t,n,r,s){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++o:s,__i:-1,__u:0};return null==s&&null!=i.vnode&&i.vnode(a),a}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function A(e,t){if(null==t)return e.__?A(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?A(e):null}function P(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!S.__r++||a!==i.debounceRendering)&&((a=i.debounceRendering)||u)(S)}function S(){for(var e,t,n,r,o,a,u=1;s.length;)s.length>u&&s.sort(l),e=s.shift(),u=s.length,e.__d&&(t=void 0,r=(n=e.__v).__e,o=[],a=[],e.__P&&((t=y({},n)).__v=n.__v+1,i.vnode&&i.vnode(t),B(e.__P,t,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,null==r?A(n):r,!!(32&n.__u),a),t.__v=n.__v,t.__.__k[t.__i]=t,E(o,t,a),t.__e!=r&&function e(t){var n,r;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,n=0;n<t.__k.length;n++)if(null!=(r=t.__k[n])&&null!=r.__e){t.__e=t.__c.base=r.__e;break}return e(t)}}(t)));S.__r=0}function C(e,t,n,r,o,s,a,u,l,c,f){var _,h,m,y,w,k,P=r&&r.__k||p,S=t.length;for(l=function(e,t,n,r,o){var s,a,u,l,c,f=n.length,_=f,h=0;for(e.__k=Array(o),s=0;s<o;s++)null!=(a=t[s])&&"boolean"!=typeof a&&"function"!=typeof a?(l=s+h,(a=e.__k[s]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?g(null,a,null,null,null):v(a)?g(x,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?g(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,u=null,-1!==(c=a.__i=function(e,t,n,r){var i,o,s=e.key,a=e.type,u=t[n];if(null===u&&null==e.key||u&&s==u.key&&a===u.type&&0==(2&u.__u))return n;if(r>+(null!=u&&0==(2&u.__u)))for(i=n-1,o=n+1;i>=0||o<t.length;){if(i>=0){if((u=t[i])&&0==(2&u.__u)&&s==u.key&&a===u.type)return i;i--}if(o<t.length){if((u=t[o])&&0==(2&u.__u)&&s==u.key&&a===u.type)return o;o++}}return -1}(a,n,l,_))&&(_--,(u=n[c])&&(u.__u|=2)),null==u||null===u.__v?(-1==c&&(o>f?h--:o<f&&h++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[s]=null;if(_)for(s=0;s<f;s++)null!=(u=n[s])&&0==(2&u.__u)&&(u.__e==r&&(r=A(u)),function e(t,n,r){var o,s;if(i.unmount&&i.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||U(o,null,n)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){i.__e(e,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&e(o[s],n,r||"function"!=typeof t.type);r||b(t.__e),t.__c=t.__=t.__e=void 0}(u,u));return r}(n,t,P,l,S),_=0;_<S;_++)null!=(m=n.__k[_])&&(h=-1===m.__i?d:P[m.__i]||d,m.__i=_,k=B(e,m,h,o,s,a,u,l,c,f),y=m.__e,m.ref&&h.ref!=m.ref&&(h.ref&&U(h.ref,null,m),f.push(m.ref,m.__c||y,m)),null==w&&null!=y&&(w=y),4&m.__u||h.__k===m.__k?l=function e(t,n,r){var i,o;if("function"==typeof t.type){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,n=e(i[o],n,r));return n}t.__e!=n&&(n&&t.type&&!r.contains(n)&&(n=A(t)),r.insertBefore(t.__e,n||null),n=t.__e);do n=n&&n.nextSibling;while(null!=n&&8==n.nodeType);return n}(m,l,e):"function"==typeof m.type&&void 0!==k?l=k:y&&(l=y.nextSibling),m.__u&=-7);return n.__e=w,l}function I(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||m.test(t)?n:n+"px"}function j(e,t,n,r,i){var o;e:if("style"==t){if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||I(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||I(e.style,t,n[t])}}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(c,"$1")),t=t.toLowerCase()in e||"onFocusOut"==t||"onFocusIn"==t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,o?h:_,o)):e.removeEventListener(t,o?h:_,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function z(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=f++;else if(t.t<n.u)return;return n(i.event?i.event(t):t)}}}function B(e,t,n,o,s,a,u,l,c,f){var _,h,p,m,w,g,P,S,I,z,B,E,U,T,$,H,M,N,V=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=i.__b)&&_(t);e:if("function"==typeof V)try{if(S=t.props,I="prototype"in V&&V.prototype.render,z=(_=V.contextType)&&o[_.__c],B=_?z?z.props.value:_.__:o,n.__c?P=(h=t.__c=n.__c).__=h.__E:(I?t.__c=h=new V(S,B):(t.__c=h=new k(S,B),h.constructor=V,h.render=O),z&&z.sub(h),h.props=S,h.state||(h.state={}),h.context=B,h.__n=o,p=h.__d=!0,h.__h=[],h._sb=[]),I&&null==h.__s&&(h.__s=h.state),I&&null!=V.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=y({},h.__s)),y(h.__s,V.getDerivedStateFromProps(S,h.__s))),m=h.props,w=h.state,h.__v=t,p)I&&null==V.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),I&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(I&&null==V.getDerivedStateFromProps&&S!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(S,B),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(S,h.__s,B)||t.__v==n.__v)){for(t.__v!=n.__v&&(h.props=S,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),E=0;E<h._sb.length;E++)h.__h.push(h._sb[E]);h._sb=[],h.__h.length&&u.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(S,h.__s,B),I&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(m,w,g)})}if(h.context=B,h.props=S,h.__P=e,h.__e=!1,U=i.__r,T=0,I){for(h.state=h.__s,h.__d=!1,U&&U(t),_=h.render(h.props,h.state,h.context),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[]}else do h.__d=!1,U&&U(t),_=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++T<25);h.state=h.__s,null!=h.getChildContext&&(o=y(y({},o),h.getChildContext())),I&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,w)),M=(H=null!=_&&_.type===x&&null==_.key)?_.props.children:_,H&&(_.props.children=null),l=C(e,v(M)?M:[M],t,n,o,s,a,u,l,c,f),h.base=t.__e,t.__u&=-161,h.__h.length&&u.push(h),P&&(h.__E=h.__=null)}catch(e){if(t.__v=null,c||null!=a){if(e.then){for(t.__u|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,t.__e=l}else for(N=a.length;N--;)b(a[N])}else t.__e=n.__e,t.__k=n.__k;i.__e(e,t,n)}else null==a&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=function(e,t,n,o,s,a,u,l,c){var f,_,h,p,m,y,w,g=n.props,x=t.props,k=t.type;if("svg"==k?s="http://www.w3.org/2000/svg":"math"==k?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a){for(f=0;f<a.length;f++)if((m=a[f])&&"setAttribute"in m==!!k&&(k?m.localName==k:3==m.nodeType)){e=m,a[f]=null;break}}if(null==e){if(null==k)return document.createTextNode(x);e=document.createElementNS(s,k,x.is&&x),l&&(i.__m&&i.__m(t,a),l=!1),a=null}if(null===k)g===x||l&&e.data===x||(e.data=x);else{if(a=a&&r.call(e.childNodes),g=n.props||d,!l&&null!=a)for(g={},f=0;f<e.attributes.length;f++)g[(m=e.attributes[f]).name]=m.value;for(f in g)if(m=g[f],"children"==f);else if("dangerouslySetInnerHTML"==f)h=m;else if(!(f in x)){if("value"==f&&"defaultValue"in x||"checked"==f&&"defaultChecked"in x)continue;j(e,f,null,m,s)}for(f in x)m=x[f],"children"==f?p=m:"dangerouslySetInnerHTML"==f?_=m:"value"==f?y=m:"checked"==f?w=m:l&&"function"!=typeof m||g[f]===m||j(e,f,m,g[f],s);if(_)l||h&&(_.__html===h.__html||_.__html===e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(h&&(e.innerHTML=""),C("template"===t.type?e.content:e,v(p)?p:[p],t,n,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,u,a?a[0]:n.__k&&A(n,0),l,c),null!=a)for(f=a.length;f--;)b(a[f]);l||(f="value","progress"==k&&null==y?e.removeAttribute("value"):void 0===y||y===e[f]&&("progress"!=k||y)&&("option"!=k||y===g[f])||j(e,f,y,g[f],s),f="checked",void 0!==w&&w!==e[f]&&j(e,f,w,g[f],s))}return e}(n.__e,t,n,o,s,a,u,c,f);return(_=i.diffed)&&_(t),128&t.__u?void 0:l}function E(e,t,n){for(var r=0;r<n.length;r++)U(n[r],n[++r],n[++r]);i.__c&&i.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){i.__e(e,t.__v)}})}function U(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){i.__e(e,n)}}function O(e,t,n){return this.constructor(e,n)}function T(e,t,n){var o,s,a,u;t==document&&(t=document.documentElement),i.__&&i.__(e,t),s=(o="function"==typeof n)?null:n&&n.__k||t.__k,a=[],u=[],B(t,e=(!o&&n||t).__k=w(x,null,[e]),s||d,d,t.namespaceURI,!o&&n?[n]:s?null:t.firstChild?r.call(t.childNodes):null,a,!o&&n?n:s?s.__e:t.firstChild,o,u),E(a,e,u)}function $(e,t){T(e,t,$)}function H(e,t,n){var i,o,s,a,u=y({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==s?i=t[s]:"ref"==s?o=t[s]:u[s]=void 0===t[s]&&void 0!==a?a[s]:t[s];return arguments.length>2&&(u.children=arguments.length>3?r.call(arguments,2):n),g(e.type,u,i||e.key,o||e.ref,null)}r=p.slice,i={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},o=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=y({},this.state),"function"==typeof e&&(e=e(y({},n),this.props)),e&&y(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=x,s=[],u="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.__v.__b-t.__v.__b},S.__r=0,c=/(PointerCapture)$|Capture$/i,f=0,_=z(!1),h=z(!0)},"../../node_modules/preact/hooks/dist/hooks.module.js":function(e,t,n){n.d(t,{I4:()=>x,Ye:()=>g,d4:()=>b,eJ:()=>y,sO:()=>w});var r,i,o,s,a=n("../../node_modules/preact/dist/preact.module.js"),u=0,l=[],c=a.YM,f=c.__b,_=c.__r,h=c.diffed,d=c.__c,p=c.unmount,m=c.__;function v(e,t){c.__h&&c.__h(i,e,u||t),u=0;var n=i.__H||(i.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function y(e){return u=1,function(e,t,n){var o=v(r++,2);if(o.t=e,!o.__c&&(o.__=[I(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=i,!i.__f)){var s=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter(function(e){return!!e.__c});if(r.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var i=o.__c.props!==e;return r.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),a&&a.call(this,e,t,n)||i};i.__f=!0;var a=i.shouldComponentUpdate,u=i.componentWillUpdate;i.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,s(e,t,n),a=r}u&&u.call(this,e,t,n)},i.shouldComponentUpdate=s}return o.__N||o.__}(I,e)}function b(e,t){var n=v(r++,3);!c.__s&&C(n.__H,t)&&(n.__=e,n.u=t,i.__H.__h.push(n))}function w(e){return u=5,g(function(){return{current:e}},[])}function g(e,t){var n=v(r++,7);return C(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function x(e,t){return u=8,g(function(){return e},t)}function k(){for(var e;e=l.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(P),e.__H.__h.forEach(S),e.__H.__h=[]}catch(t){e.__H.__h=[],c.__e(t,e.__v)}}c.__b=function(e){i=null,f&&f(e)},c.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),m&&m(e,t)},c.__r=function(e){_&&_(e),r=0;var t=(i=e.__c).__H;t&&(o===i?(t.__h=[],i.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(P),t.__h.forEach(S),t.__h=[],r=0)),o=i},c.diffed=function(e){h&&h(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==l.push(t)&&s===c.requestAnimationFrame||((s=c.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),A&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);A&&(t=requestAnimationFrame(n))})(k)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),o=i=null},c.__c=function(e,t){t.some(function(e){try{e.__h.forEach(P),e.__h=e.__h.filter(function(e){return!e.__||S(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],c.__e(n,e.__v)}}),d&&d(e,t)},c.unmount=function(e){p&&p(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{P(e)}catch(e){t=e}}),n.__H=void 0,t&&c.__e(t,n.__v))};var A="function"==typeof requestAnimationFrame;function P(e){var t=i,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),i=t}function S(e){var t=i;e.__c=e.__(),i=t}function C(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function I(e,t){return"function"==typeof t?t(e):t}},"../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js":function(e,t,n){n.d(t,{BX:()=>o,HY:()=>r.HY,tZ:()=>o});var r=n("../../node_modules/preact/dist/preact.module.js"),i=0;function o(e,t,n,o,s,a){t||(t={});var u,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?u=t[l]:c[l]=t[l];var f={type:e,props:c,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--i,__i:-1,__u:0,__source:s,__self:a};if("function"==typeof e&&(u=e.defaultProps))for(l in u)void 0===c[l]&&(c[l]=u[l]);return r.YM.vnode&&r.YM.vnode(f),f}},"../../node_modules/viem/_esm/errors/base.js":function(e,t,n){n.d(t,{G:()=>o});let r="2.22.23",i={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${r}`};class o extends Error{constructor(e,t={}){let n=t.cause instanceof o?t.cause.details:t.cause?.message?t.cause.message:t.details,s=t.cause instanceof o&&t.cause.docsPath||t.docsPath,a=i.getDocsUrl?.({...t,docsPath:s});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...n?[`Details: ${n}`]:[],...i.version?[`Version: ${i.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=r}walk(e){return function e(t,n){return n?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,n):n?null:t}(this,e)}}},"../../node_modules/viem/_esm/errors/encoding.js":function(e,t,n){n.d(t,{J5:()=>i,M6:()=>o});var r=n("../../node_modules/viem/_esm/errors/base.js");class i extends r.G{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${8*r}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}r.G,r.G,r.G;class o extends r.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}},"../../node_modules/viem/_esm/utils/address/isAddressEqual.js":function(e,t,n){n.d(t,{E:()=>_});var r=n("../../node_modules/viem/_esm/errors/base.js");class i extends r.G{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class o extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}var s=n("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),a=n("../../node_modules/viem/_esm/utils/hash/keccak256.js");let u=new o(8192),l=/^0x[a-fA-F0-9]{40}$/,c=new o(8192);function f(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(c.has(r))return c.get(r);let i=!!l.test(e)&&(e.toLowerCase()===e||!n||function(e,t){if(u.has(`${e}.undefined`))return u.get(`${e}.${void 0}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=(0,a.w)((0,s.qX)(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&r[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let o=`0x${i.join("")}`;return u.set(`${e}.${t}`,o),o}(e)===e);return c.set(r,i),i}function _(e,t){if(!f(e,{strict:!1}))throw new i({address:e});if(!f(t,{strict:!1}))throw new i({address:t});return e.toLowerCase()===t.toLowerCase()}},"../../node_modules/viem/_esm/utils/data/concat.js":function(e,t,n){n.d(t,{SM:()=>r});function r(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}},"../../node_modules/viem/_esm/utils/data/isHex.js":function(e,t,n){n.d(t,{v:()=>r});function r(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}},"../../node_modules/viem/_esm/utils/data/pad.js":function(e,t,n){n.d(t,{vk:()=>o});var r=n("../../node_modules/viem/_esm/errors/base.js");r.G;class i extends r.G{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function o(e,{dir:t,size:n=32}={}){return"string"==typeof e?function(e,{dir:t,size:n=32}={}){if(null===n)return e;let r=e.replace("0x","");if(r.length>2*n)throw new i({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new i({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let i=0;i<n;i++){let o="right"===t;r[o?i:n-i-1]=e[o?i:e.length-i-1]}return r}(e,{dir:t,size:n})}r.G},"../../node_modules/viem/_esm/utils/encoding/fromHex.js":function(e,t,n){n.d(t,{Yf:()=>s});var r=n("../../node_modules/viem/_esm/errors/encoding.js"),i=n("../../node_modules/viem/_esm/utils/data/isHex.js");function o(e){return(0,i.v)(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function s(e,{size:t}){if(o(e)>t)throw new r.M6({givenSize:o(e),maxSize:t})}},"../../node_modules/viem/_esm/utils/encoding/toBytes.js":function(e,t,n){n.d(t,{O0:()=>l,nr:()=>_,qX:()=>h});var r=n("../../node_modules/viem/_esm/errors/base.js"),i=n("../../node_modules/viem/_esm/utils/data/isHex.js"),o=n("../../node_modules/viem/_esm/utils/data/pad.js"),s=n("../../node_modules/viem/_esm/utils/encoding/fromHex.js"),a=n("../../node_modules/viem/_esm/utils/encoding/toHex.js");let u=new TextEncoder;function l(e,t={}){var n,r;return"number"==typeof e||"bigint"==typeof e?(n=e,r=t,_((0,a.eC)(n,r))):"boolean"==typeof e?function(e,t={}){let n=new Uint8Array(1);return(n[0]=Number(e),"number"==typeof t.size)?((0,s.Yf)(n,{size:t.size}),(0,o.vk)(n,{size:t.size})):n}(e,t):(0,i.v)(e)?_(e,t):h(e,t)}let c={zero:48,nine:57,A:65,F:70,a:97,f:102};function f(e){return e>=c.zero&&e<=c.nine?e-c.zero:e>=c.A&&e<=c.F?e-(c.A-10):e>=c.a&&e<=c.f?e-(c.a-10):void 0}function _(e,t={}){let n=e;t.size&&((0,s.Yf)(n,{size:t.size}),n=(0,o.vk)(n,{dir:"right",size:t.size}));let i=n.slice(2);i.length%2&&(i=`0${i}`);let a=i.length/2,u=new Uint8Array(a);for(let e=0,t=0;e<a;e++){let n=f(i.charCodeAt(t++)),o=f(i.charCodeAt(t++));if(void 0===n||void 0===o)throw new r.G(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);u[e]=16*n+o}return u}function h(e,t={}){let n=u.encode(e);return"number"==typeof t.size?((0,s.Yf)(n,{size:t.size}),(0,o.vk)(n,{dir:"right",size:t.size})):n}},"../../node_modules/viem/_esm/utils/encoding/toHex.js":function(e,t,n){n.d(t,{NC:()=>a,ci:()=>u,eC:()=>l});var r=n("../../node_modules/viem/_esm/errors/encoding.js"),i=n("../../node_modules/viem/_esm/utils/data/pad.js"),o=n("../../node_modules/viem/_esm/utils/encoding/fromHex.js");let s=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function a(e,t={}){return"number"==typeof e||"bigint"==typeof e?l(e,t):"string"==typeof e?function(e,t={}){return u(c.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let n=`0x${Number(e)}`;return"number"==typeof t.size?((0,o.Yf)(n,{size:t.size}),(0,i.vk)(n,{size:t.size})):n}(e,t):u(e,t)}function u(e,t={}){let n="";for(let t=0;t<e.length;t++)n+=s[e[t]];let r=`0x${n}`;return"number"==typeof t.size?((0,o.Yf)(r,{size:t.size}),(0,i.vk)(r,{dir:"right",size:t.size})):r}function l(e,t={}){let n;let{signed:o,size:s}=t,a=BigInt(e);s?n=o?(1n<<8n*BigInt(s)-1n)-1n:2n**(8n*BigInt(s))-1n:"number"==typeof e&&(n=BigInt(Number.MAX_SAFE_INTEGER));let u="bigint"==typeof n&&o?-n-1n:0;if(n&&a>n||a<u){let t="bigint"==typeof e?"n":"";throw new r.J5({max:n?`${n}${t}`:void 0,min:`${u}${t}`,signed:o,size:s,value:`${e}${t}`})}let c=`0x${(o&&a<0?(1n<<BigInt(8*s))+BigInt(a):a).toString(16)}`;return s?(0,i.vk)(c,{size:s}):c}let c=new TextEncoder},"../../node_modules/viem/_esm/utils/hash/keccak256.js":function(e,t,n){function r(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function i(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}n.d(t,{w:()=>O});let s=BigInt(0x100000000-1),a=BigInt(32),u=(e,t,n)=>e<<n|t>>>32-n,l=(e,t,n)=>t<<n|e>>>32-n,c=(e,t,n)=>t<<n-32|e>>>64-n,f=(e,t,n)=>e<<n-32|t>>>64-n,_=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function h(e){for(let n=0;n<e.length;n++){var t;e[n]=(t=e[n])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function d(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),i(e),e}class p{clone(){return this._cloneInto()}}let m=[],v=[],y=[],b=BigInt(0),w=BigInt(1),g=BigInt(2),x=BigInt(7),k=BigInt(256),A=BigInt(113);for(let e=0,t=w,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],m.push(2*(5*r+n)),v.push((e+1)*(e+2)/2%64);let i=b;for(let e=0;e<7;e++)(t=(t<<w^(t>>x)*A)%k)&g&&(i^=w<<(w<<BigInt(e))-w);y.push(i)}let[P,S]=function(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:u}=function(e,t=!1){return t?{h:Number(e&s),l:Number(e>>a&s)}:{h:0|Number(e>>a&s),l:0|Number(e&s)}}(e[i],t);[n[i],r[i]]=[o,u]}return[n,r]}(y,!0),C=(e,t,n)=>n>32?c(e,t,n):u(e,t,n),I=(e,t,n)=>n>32?f(e,t,n):l(e,t,n);class j extends p{constructor(e,t,n,i=!1,o=24){var s;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,r(n),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}keccak(){_||h(this.state32),function(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,o=n[i],s=n[i+1],a=C(o,s,1)^n[r],u=I(o,s,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=a,e[t+n+1]^=u}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=v[n],o=C(t,i,r),s=I(t,i,r),a=m[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=P[r],e[1]^=S[r]}n.fill(0)}(this.state32,this.rounds),_||h(this.state32),this.posOut=0,this.pos=0}update(e){o(this);let{blockLen:t,state:n}=this,r=(e=d(e)).length;for(let i=0;i<r;){let o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,(128&t)!=0&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){o(this,!1),i(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return r(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(!function(e,t){i(e);let n=t.outputLen;if(e.length<n)throw Error("digestInto() expects output buffer of length at least "+n)}(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new j(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}let z=function(e){let t=t=>e().update(d(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}(()=>new j(136,1,32));var B=n("../../node_modules/viem/_esm/utils/data/isHex.js"),E=n("../../node_modules/viem/_esm/utils/encoding/toBytes.js"),U=n("../../node_modules/viem/_esm/utils/encoding/toHex.js");function O(e,t){let n=z((0,B.v)(e,{strict:!1})?(0,E.O0)(e):e);return"bytes"===(t||"hex")?n:(0,U.NC)(n)}}};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
5
|
+
*
|
|
6
|
+
* @version 0.11.0
|
|
7
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
8
|
+
* @copyright Chen, Yi-Cyuan 2014-2024
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spinner-KHk8mw{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.spinner__leaf-xtOJmT{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:rt-spinner-leaf-fade-OXYBVY var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%}.spinner__leaf-xtOJmT:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}.spinner__leaf-xtOJmT:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}.spinner__leaf-xtOJmT:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}.spinner__leaf-xtOJmT:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}.spinner__leaf-xtOJmT:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}.spinner__leaf-xtOJmT:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}.spinner__leaf-xtOJmT:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}.spinner__leaf-xtOJmT:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}.spinner__leaf-xtOJmT:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}@keyframes rt-spinner-leaf-fade-OXYBVY{0%{opacity:1}to{opacity:.25}}.buttonShare-F23Y9m{justify-content:center;align-items:center;gap:10px;display:flex}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ids=["766"];export const modules={"./src/components/ButtonShare/index.ts":function(e,t,o){o.r(t),o.d(t,{ButtonShare:()=>S});var n=o("./src/utils/registerWebComponent.ts"),r=o("../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js");let i=function(){for(var e,t,o=0,n="",r=arguments.length;o<r;o++)(e=arguments[o])&&(t=function e(t){var o,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t){if(Array.isArray(t)){var i=t.length;for(o=0;o<i;o++)t[o]&&(n=e(t[o]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n)}return r}(e))&&(n&&(n+=" "),n+=t);return n},a="spinner__leaf-xtOJmT",s=({ref:e,className:t,...o})=>(0,r.BX)("span",{...o,ref:e,className:i("spinner-KHk8mw"),children:[(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a}),(0,r.tZ)("span",{className:a})]});s.displayName="Spinner";var l=o("./src/hooks/useClientReady.ts"),c=o("./src/hooks/useReward.ts"),d=o("../core/dist/actions.js"),p=o("../../node_modules/preact/hooks/dist/hooks.module.js");let u={marginTop:"16px",padding:"16px",backgroundColor:"#FEE2E2",border:"1px solid #FCA5A5",borderRadius:"4px",color:"#991B1B"},m={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},f={margin:0,fontSize:"16px",fontWeight:500},h={fontSize:"14px",lineHeight:"1.5",margin:"0 0 12px 0"},b={color:"#991B1B",textDecoration:"underline",textUnderlineOffset:"2px"},x={display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"10px",padding:"8px 12px",backgroundColor:"white",border:"1px solid #D1D5DB",borderRadius:"4px",color:"black",fontSize:"14px",fontWeight:500};function y({debugInfo:e}){let[t,o]=(0,p.eJ)(!1);return(0,r.BX)("div",{children:[(0,r.tZ)("button",{type:"button",style:x,onClick:()=>o(!t),children:"Ouvrir les informations"}),t&&(0,r.tZ)("textarea",{style:{display:"block",width:"100%",height:"200px",fontSize:"12px"},children:e})]})}function g({debugInfo:e}){let{copied:t,copy:o}=function(e={}){let{successDuration:t=2e3}=e,[o,n]=(0,p.eJ)(!1);return{copy:(0,p.I4)(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),n(!0);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy"),n(!0)}catch(e){return console.error("Failed to copy text:",e),!1}finally{t.remove()}}return setTimeout(()=>{n(!1)},t),!0}catch(e){return console.error("Failed to copy text:",e),!1}},[t]),copied:o}}();return(0,r.BX)("div",{style:u,children:[(0,r.tZ)("div",{style:m,children:(0,r.tZ)("h3",{style:f,children:"Oups ! Nous avons rencontr\xe9 un petit probl\xe8me"})}),(0,r.BX)("p",{style:h,children:["Impossible d'ouvrir le menu de partage pour le moment. Si le probl\xe8me persiste, copiez les informations ci-dessous et collez-les dans votre mail \xe0"," ",(0,r.tZ)("a",{href:"mailto:help@frak-labs.com?subject=Debug",style:b,children:"help@frak-labs.com"})," ",(0,r.tZ)("br",{}),"Merci pour votre retour, nous traitons votre demande dans les plus brefs d\xe9lais."]}),(0,r.tZ)("button",{type:"button",onClick:()=>o(e??""),style:x,children:t?"Informations copi\xe9es !":"Copier les informations de d\xe9bogage"}),(0,r.tZ)(y,{debugInfo:e})]})}var w=o("./src/utils/setup.ts"),k=o("../core/dist/index.js");async function v(){if(!window.FrakSetup?.client)throw Error("Frak client not found");await (0,d.Hq)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function S({text:e="Share and earn!",classname:t="",useReward:o,noRewardText:n,targetInteraction:a,showWallet:d}){let u=(0,p.Ye)(()=>void 0!==o,[o]),m=(0,p.Ye)(()=>void 0!==d,[d]),{isClientReady:f}=(0,l.t)(),{reward:h}=(0,c.w)(u&&f,a),{handleShare:b,isError:x,debugInfo:y}=function(e){let[t,o]=(0,p.eJ)(void 0),[n,r]=(0,p.eJ)(!1);return{handleShare:(0,p.I4)(async()=>{if(!window.FrakSetup?.client){console.error("Frak client not found"),o(k.oC.empty().formatDebugInfo("Frak client not found")),r(!0);return}let t=(0,w.Gt)();if(!t)throw Error("modalBuilderSteps not found");try{await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof k.u&&e.code===k.ss.clientAborted){console.debug("User aborted the modal");return}o(window.FrakSetup.client.debugInfo.formatDebugInfo(e)),r(!0),console.error("Error while opening the modal",e)}},[e]),isError:n,debugInfo:t}}(a),S=(0,p.Ye)(()=>u?h?e.includes("{REWARD}")?e.replace("{REWARD}",h):`${e} ${h}`:n??e.replace("{REWARD}",""):e,[u,e,n,h]),Z=(0,p.I4)(async()=>await (m?v():b()),[m,b]);return(0,r.BX)(r.HY,{children:[(0,r.BX)("button",{type:"button",className:i("buttonShare-F23Y9m",t),onClick:Z,children:[!f&&(0,r.tZ)(s,{})," ",S]}),x&&(0,r.tZ)(g,{debugInfo:y})]})}(0,n.A)(S,"frak-button-share",["text"],{shadow:!1})}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
frak-button-wallet{z-index:2000000;position:fixed;bottom:20px}frak-button-wallet.left{left:20px}frak-button-wallet.right{right:20px}frak-button-wallet button,frak-button-wallet [type=button]{all:unset;cursor:pointer;text-align:center;background-color:#3e557e;border-radius:50%;justify-content:center;align-items:center;width:45px;height:45px;display:flex;position:relative}frak-button-wallet span{color:#fff;white-space:nowrap;background:#ff3f3f;border-radius:5px;padding:2px 3px;font-size:9px;font-weight:600;line-height:9px;position:absolute;top:-4px;right:27px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ids=["438"];export const modules={"./src/components/ButtonWallet/index.ts":function(e,t,n){n.r(t),n.d(t,{ButtonWallet:()=>W});var o=n("./src/utils/registerWebComponent.ts"),r=n("../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js"),i=n("./src/hooks/useClientReady.ts"),l=n("./src/hooks/useReward.ts"),a=n("../../node_modules/preact/hooks/dist/hooks.module.js"),_=n("../../node_modules/preact/dist/preact.module.js");function u(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function c(e,t){this.props=e,this.context=t}(c.prototype=new _.wA).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return u(this.props,e)||u(this.state,t)};var s=_.YM.__b;_.YM.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),s&&s(e)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var p=_.YM.__e;_.YM.__e=function(e,t,n,o){if(e.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}p(e,t,n,o)};var f=_.YM.unmount;function d(){this.__u=0,this.o=null,this.__b=null}function v(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function h(){this.i=null,this.l=null}_.YM.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),f&&f(e)},(d.prototype=new _.wA).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=v(o.__v),i=!1,l=function(){i||(i=!0,n.__R=null,r?r(a):a())};n.__R=l;var a=function(){if(!--o.__u){if(o.state.__a){var e,t=o.state.__a;o.__v.__k[0]=function e(t,n,o){return t&&o&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)}),t.__c&&t.__c.__P===n&&(t.__e&&o.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=o)),t}(t,t.__c.__P,t.__c.__O)}for(o.setState({__a:o.__b=null});e=o.o.pop();)e.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(l,l)},d.prototype.componentWillUnmount=function(){this.o=[]},d.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,o){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),t.__c.__H=null),null!=(t=function(e,t){for(var n in t)e[n]=t[n];return e}({},t)).__c&&(t.__c.__P===o&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)})),t}(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&(0,_.az)(_.HY,null,e.fallback);return r&&(r.__u&=-33),[(0,_.az)(_.HY,null,t.__a?null:e.children),r]};var m=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(h.prototype=new _.wA).__a=function(e){var t=this,n=v(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),m(t,e,o)):r()};n?n(i):i()}},h.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,_.bR)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},h.prototype.componentDidUpdate=h.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){m(e,n,t)})};var b="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,y=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,w=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,k=/[A-Z0-9]/g,g="undefined"!=typeof document;_.wA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(_.wA.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var M=_.YM.event;function S(){}function Y(){return this.cancelBubble}function x(){return this.defaultPrevented}_.YM.event=function(e){return M&&(e=M(e)),e.persist=S,e.isPropagationStopped=Y,e.isDefaultPrevented=x,e.nativeEvent=e};var P={enumerable:!1,configurable:!0,get:function(){return this.class}},R=_.YM.vnode;_.YM.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1===n.indexOf("-");for(var i in t){var l=t[i];if(!("value"===i&&"defaultValue"in t&&null==l||g&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var a,u=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===l?l="":"translate"===u&&"no"===l?l=!1:"o"===u[0]&&"n"===u[1]?"ondoubleclick"===u?i="ondblclick":"onchange"!==u||"input"!==n&&"textarea"!==n||(a=t.type,("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(a))?"onfocus"===u?i="onfocusin":"onblur"===u?i="onfocusout":w.test(i)&&(i=u):u=i="oninput":r&&y.test(i)?i=i.replace(k,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===u&&o[i=u]&&(i="oninputCapture"),o[i]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,_.bR)(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=(0,_.bR)(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",P)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=b,R&&R(e)};var C=_.YM.__r;_.YM.__r=function(e){C&&C(e),e.__c};var O=_.YM.diffed;_.YM.diffed=function(e){O&&O(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};let A=e=>(0,r.tZ)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 28 28",...e,children:(0,r.tZ)("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M23.143 14v11.428H4.857V14M14 25.428V8.286m0 0H8.857a2.857 2.857 0 0 1 0-5.715c4 0 5.143 5.715 5.143 5.715m0 0h5.143a2.857 2.857 0 1 0 0-5.715c-4 0-5.143 5.715-5.143 5.715m-11.429 0h22.857V14H2.571z"})});var j=n("../core/dist/actions.js");function H(){if(!window.FrakSetup?.client){console.error("Frak client not found");return}"vibrate"in navigator?navigator.vibrate(10):console.log("Vibration not supported"),(0,j.Hq)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function W({classname:e="",useReward:t,targetInteraction:n}){let o=(0,a.Ye)(()=>void 0!==t,[t]),_=(0,a.sO)(null),{isClientReady:u}=(0,i.t)(),{reward:c}=(0,l.w)(o&&u,n);return(0,a.d4)(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;_.current?.parentElement?.classList.add(e??"right")},[]),(0,r.BX)("button",{ref:_,type:"button",class:e,disabled:!u,onClick:H,children:[(0,r.tZ)(A,{}),c&&(0,r.tZ)("span",{children:c})]})}(0,o.A)(W,"frak-button-wallet",[],{shadow:!1})}};
|
package/cdn/components.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
(
|
|
2
|
-
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
3
|
-
*
|
|
4
|
-
* @version 0.11.0
|
|
5
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
6
|
-
* @copyright Chen, Yi-Cyuan 2014-2024
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/var st;function Vn(){return st||(st=1,function(e){(function(){var t="input is invalid type",n=typeof window=="object",r=n?window:{};r.JS_SHA256_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",a=!r.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;a?r=Dn:o&&(r=self);var s=!r.JS_SHA256_NO_COMMON_JS&&!0&&e.exports,l=!r.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),_=[-2147483648,8388608,32768,128],v=[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],w=["hex","array","digest","arrayBuffer"],f=[];(r.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(u){return Object.prototype.toString.call(u)==="[object Array]"}),l&&(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 b=function(u,S){return function(E){return new g(S,!0).update(E)[u]()}},p=function(u){var S=b("hex",u);a&&(S=m(S,u)),S.create=function(){return new g(u)},S.update=function(A){return S.create().update(A)};for(var E=0;E<w.length;++E){var y=w[E];S[y]=b(y,u)}return S},m=function(u,S){var E=at,y=at.Buffer,A=S?"sha224":"sha256",x;y.from&&!r.JS_SHA256_NO_BUFFER_FROM?x=y.from:x=function(F){return new y(F)};var P=function(F){if(typeof F=="string")return E.createHash(A).update(F,"utf8").digest("hex");if(F==null)throw new Error(t);return F.constructor===ArrayBuffer&&(F=new Uint8Array(F)),Array.isArray(F)||ArrayBuffer.isView(F)||F.constructor===y?E.createHash(A).update(x(F)).digest("hex"):u(F)};return P},i=function(u,S){return function(E,y){return new C(E,S,!0).update(y)[u]()}},h=function(u){var S=i("hex",u);S.create=function(A){return new C(A,u)},S.update=function(A,x){return S.create(A).update(x)};for(var E=0;E<w.length;++E){var y=w[E];S[y]=i(y,u)}return S};function g(u,S){S?(f[0]=f[16]=f[1]=f[2]=f[3]=f[4]=f[5]=f[6]=f[7]=f[8]=f[9]=f[10]=f[11]=f[12]=f[13]=f[14]=f[15]=0,this.blocks=f):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}g.prototype.update=function(u){if(!this.finalized){var S,E=typeof u;if(E!=="string"){if(E==="object"){if(u===null)throw new Error(t);if(l&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!l||!ArrayBuffer.isView(u)))throw new Error(t)}else throw new Error(t);S=!0}for(var y,A=0,x,P=u.length,F=this.blocks;A<P;){if(this.hashed&&(this.hashed=!1,F[0]=this.block,this.block=F[16]=F[1]=F[2]=F[3]=F[4]=F[5]=F[6]=F[7]=F[8]=F[9]=F[10]=F[11]=F[12]=F[13]=F[14]=F[15]=0),S)for(x=this.start;A<P&&x<64;++A)F[x>>>2]|=u[A]<<v[x++&3];else for(x=this.start;A<P&&x<64;++A)y=u.charCodeAt(A),y<128?F[x>>>2]|=y<<v[x++&3]:y<2048?(F[x>>>2]|=(192|y>>>6)<<v[x++&3],F[x>>>2]|=(128|y&63)<<v[x++&3]):y<55296||y>=57344?(F[x>>>2]|=(224|y>>>12)<<v[x++&3],F[x>>>2]|=(128|y>>>6&63)<<v[x++&3],F[x>>>2]|=(128|y&63)<<v[x++&3]):(y=65536+((y&1023)<<10|u.charCodeAt(++A)&1023),F[x>>>2]|=(240|y>>>18)<<v[x++&3],F[x>>>2]|=(128|y>>>12&63)<<v[x++&3],F[x>>>2]|=(128|y>>>6&63)<<v[x++&3],F[x>>>2]|=(128|y&63)<<v[x++&3]);this.lastByteIndex=x,this.bytes+=x-this.start,x>=64?(this.block=F[16],this.start=x-64,this.hash(),this.hashed=!0):this.start=x}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var u=this.blocks,S=this.lastByteIndex;u[16]=this.block,u[S>>>2]|=_[S&3],this.block=u[16],S>=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()}},g.prototype.hash=function(){var u=this.h0,S=this.h1,E=this.h2,y=this.h3,A=this.h4,x=this.h5,P=this.h6,F=this.h7,$=this.blocks,R,U,L,K,T,G,X,le,et,tt,Ae;for(R=16;R<64;++R)T=$[R-15],U=(T>>>7|T<<25)^(T>>>18|T<<14)^T>>>3,T=$[R-2],L=(T>>>17|T<<15)^(T>>>19|T<<13)^T>>>10,$[R]=$[R-16]+U+$[R-7]+L<<0;for(Ae=S&E,R=0;R<64;R+=4)this.first?(this.is224?(le=300032,T=$[0]-1413257819,F=T-150054599<<0,y=T+24177077<<0):(le=704751109,T=$[0]-210244248,F=T-1521486534<<0,y=T+143694565<<0),this.first=!1):(U=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),L=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),le=u&S,K=le^u&E^Ae,X=A&x^~A&P,T=F+L+X+d[R]+$[R],G=U+K,F=y+T<<0,y=T+G<<0),U=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),L=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),et=y&u,K=et^y&S^le,X=F&A^~F&x,T=P+L+X+d[R+1]+$[R+1],G=U+K,P=E+T<<0,E=T+G<<0,U=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),L=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7),tt=E&y,K=tt^E&u^et,X=P&F^~P&A,T=x+L+X+d[R+2]+$[R+2],G=U+K,x=S+T<<0,S=T+G<<0,U=(S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10),L=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),Ae=S&E,K=Ae^S&y^tt,X=x&P^~x&F,T=A+L+X+d[R+3]+$[R+3],G=U+K,A=u+T<<0,u=T+G<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+u<<0,this.h1=this.h1+S<<0,this.h2=this.h2+E<<0,this.h3=this.h3+y<<0,this.h4=this.h4+A<<0,this.h5=this.h5+x<<0,this.h6=this.h6+P<<0,this.h7=this.h7+F<<0},g.prototype.hex=function(){this.finalize();var u=this.h0,S=this.h1,E=this.h2,y=this.h3,A=this.h4,x=this.h5,P=this.h6,F=this.h7,$=c[u>>>28&15]+c[u>>>24&15]+c[u>>>20&15]+c[u>>>16&15]+c[u>>>12&15]+c[u>>>8&15]+c[u>>>4&15]+c[u&15]+c[S>>>28&15]+c[S>>>24&15]+c[S>>>20&15]+c[S>>>16&15]+c[S>>>12&15]+c[S>>>8&15]+c[S>>>4&15]+c[S&15]+c[E>>>28&15]+c[E>>>24&15]+c[E>>>20&15]+c[E>>>16&15]+c[E>>>12&15]+c[E>>>8&15]+c[E>>>4&15]+c[E&15]+c[y>>>28&15]+c[y>>>24&15]+c[y>>>20&15]+c[y>>>16&15]+c[y>>>12&15]+c[y>>>8&15]+c[y>>>4&15]+c[y&15]+c[A>>>28&15]+c[A>>>24&15]+c[A>>>20&15]+c[A>>>16&15]+c[A>>>12&15]+c[A>>>8&15]+c[A>>>4&15]+c[A&15]+c[x>>>28&15]+c[x>>>24&15]+c[x>>>20&15]+c[x>>>16&15]+c[x>>>12&15]+c[x>>>8&15]+c[x>>>4&15]+c[x&15]+c[P>>>28&15]+c[P>>>24&15]+c[P>>>20&15]+c[P>>>16&15]+c[P>>>12&15]+c[P>>>8&15]+c[P>>>4&15]+c[P&15];return this.is224||($+=c[F>>>28&15]+c[F>>>24&15]+c[F>>>20&15]+c[F>>>16&15]+c[F>>>12&15]+c[F>>>8&15]+c[F>>>4&15]+c[F&15]),$},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var u=this.h0,S=this.h1,E=this.h2,y=this.h3,A=this.h4,x=this.h5,P=this.h6,F=this.h7,$=[u>>>24&255,u>>>16&255,u>>>8&255,u&255,S>>>24&255,S>>>16&255,S>>>8&255,S&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255];return this.is224||$.push(F>>>24&255,F>>>16&255,F>>>8&255,F&255),$},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var u=new ArrayBuffer(this.is224?28:32),S=new DataView(u);return S.setUint32(0,this.h0),S.setUint32(4,this.h1),S.setUint32(8,this.h2),S.setUint32(12,this.h3),S.setUint32(16,this.h4),S.setUint32(20,this.h5),S.setUint32(24,this.h6),this.is224||S.setUint32(28,this.h7),u};function C(u,S,E){var y,A=typeof u;if(A==="string"){var x=[],P=u.length,F=0,$;for(y=0;y<P;++y)$=u.charCodeAt(y),$<128?x[F++]=$:$<2048?(x[F++]=192|$>>>6,x[F++]=128|$&63):$<55296||$>=57344?(x[F++]=224|$>>>12,x[F++]=128|$>>>6&63,x[F++]=128|$&63):($=65536+(($&1023)<<10|u.charCodeAt(++y)&1023),x[F++]=240|$>>>18,x[F++]=128|$>>>12&63,x[F++]=128|$>>>6&63,x[F++]=128|$&63);u=x}else if(A==="object"){if(u===null)throw new Error(t);if(l&&u.constructor===ArrayBuffer)u=new Uint8Array(u);else if(!Array.isArray(u)&&(!l||!ArrayBuffer.isView(u)))throw new Error(t)}else throw new Error(t);u.length>64&&(u=new g(S,!0).update(u).array());var R=[],U=[];for(y=0;y<64;++y){var L=u[y]||0;R[y]=92^L,U[y]=54^L}g.call(this,S,E),this.update(U),this.oKeyPad=R,this.inner=!0,this.sharedMemory=E}C.prototype=new g,C.prototype.finalize=function(){if(g.prototype.finalize.call(this),this.inner){this.inner=!1;var u=this.array();g.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(u),g.prototype.finalize.call(this)}};var k=p();k.sha256=k,k.sha224=p(!0),k.sha256.hmac=h(),k.sha224.hmac=h(!0),s?e.exports=k:(r.sha256=k.sha256,r.sha224=k.sha224)})()}(Pe)),Pe.exports}var de=Vn();function $e(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ct(e){return $e(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const ut="2.22.23";let Te={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${ut}`};class q extends Error{constructor(t,n={}){const r=n.cause instanceof q?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof q&&n.cause.docsPath||n.docsPath,a=Te.getDocsUrl?.({...n,docsPath:o}),s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Te.version?[`Version: ${Te.version}`]:[]].join(`
|
|
9
|
-
`);super(s,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=ut}walk(t){return lt(this,t)}}function lt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?lt(e.cause,t):t?null:e}class ft extends q{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function Y(e,{dir:t,size:n=32}={}){return typeof e=="string"?Wn(e,{dir:t,size:n}):qn(e,{dir:t,size:n})}function Wn(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ft({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function qn(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ft({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o<n;o++){const a=t==="right";r[a?o:n-o-1]=e[a?o:e.length-o-1]}return r}class Jn extends q{constructor({max:t,min:n,signed:r,size:o,value:a}){super(`Number "${a}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Kn extends q{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function re(e,{size:t}){if(ct(e)>t)throw new Kn({givenSize:ct(e),maxSize:t})}const Gn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function he(e,t={}){return typeof e=="number"||typeof e=="bigint"?dt(e,t):typeof e=="string"?Zn(e,t):typeof e=="boolean"?Xn(e,t):Oe(e,t)}function Xn(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(re(n,{size:t.size}),Y(n,{size:t.size})):n}function Oe(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=Gn[e[o]];const r=`0x${n}`;return typeof t.size=="number"?(re(r,{size:t.size}),Y(r,{dir:"right",size:t.size})):r}function dt(e,t={}){const{signed:n,size:r}=t,o=BigInt(e);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const s=typeof a=="bigint"&&n?-a-1n:0;if(a&&o>a||o<s){const c=typeof e=="bigint"?"n":"";throw new Jn({max:a?`${a}${c}`:void 0,min:`${s}${c}`,signed:n,size:r,value:`${e}${c}`})}const l=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?Y(l,{size:r}):l}const Yn=new TextEncoder;function Zn(e,t={}){const n=Yn.encode(e);return Oe(n,t)}const Qn=new TextEncoder;function er(e,t={}){return typeof e=="number"||typeof e=="bigint"?nr(e,t):typeof e=="boolean"?tr(e,t):$e(e)?Re(e,t):_t(e,t)}function tr(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(re(n,{size:t.size}),Y(n,{size:t.size})):n}const D={zero:48,nine:57,A:65,F:70,a:97,f:102};function ht(e){if(e>=D.zero&&e<=D.nine)return e-D.zero;if(e>=D.A&&e<=D.F)return e-(D.A-10);if(e>=D.a&&e<=D.f)return e-(D.a-10)}function Re(e,t={}){let n=e;t.size&&(re(n,{size:t.size}),n=Y(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,a=new Uint8Array(o);for(let s=0,l=0;s<o;s++){const c=ht(r.charCodeAt(l++)),_=ht(r.charCodeAt(l++));if(c===void 0||_===void 0)throw new q(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);a[s]=c*16+_}return a}function nr(e,t){const n=dt(e,t);return Re(n)}function _t(e,t={}){const n=Qn.encode(e);return typeof t.size=="number"?(re(n,{size:t.size}),Y(n,{dir:"right",size:t.size})):n}function pt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function rr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Be(e,...t){if(!rr(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 yt(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 or(e,t){Be(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const _e=BigInt(2**32-1),wt=BigInt(32);function ir(e,t=!1){return t?{h:Number(e&_e),l:Number(e>>wt&_e)}:{h:Number(e>>wt&_e)|0,l:Number(e&_e)|0}}function ar(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:s}=ir(e[o],t);[n[o],r[o]]=[a,s]}return[n,r]}const sr=(e,t,n)=>e<<n|t>>>32-n,cr=(e,t,n)=>t<<n|e>>>32-n,ur=(e,t,n)=>t<<n-32|e>>>64-n,lr=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fr(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}const mt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function dr(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function bt(e){for(let t=0;t<e.length;t++)e[t]=dr(e[t])}function hr(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function gt(e){return typeof e=="string"&&(e=hr(e)),Be(e),e}class _r{clone(){return this._cloneInto()}}function pr(e){const t=r=>e().update(gt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const vt=[],xt=[],Ft=[],yr=BigInt(0),oe=BigInt(1),wr=BigInt(2),mr=BigInt(7),br=BigInt(256),gr=BigInt(113);for(let e=0,t=oe,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],vt.push(2*(5*r+n)),xt.push((e+1)*(e+2)/2%64);let o=yr;for(let a=0;a<7;a++)t=(t<<oe^(t>>mr)*gr)%br,t&wr&&(o^=oe<<(oe<<BigInt(a))-oe);Ft.push(o)}const[vr,xr]=ar(Ft,!0),kt=(e,t,n)=>n>32?ur(e,t,n):sr(e,t,n),St=(e,t,n)=>n>32?lr(e,t,n):cr(e,t,n);function Fr(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const l=(s+8)%10,c=(s+2)%10,_=n[c],v=n[c+1],d=kt(_,v,1)^n[l],w=St(_,v,1)^n[l+1];for(let f=0;f<50;f+=10)e[s+f]^=d,e[s+f+1]^=w}let o=e[2],a=e[3];for(let s=0;s<24;s++){const l=xt[s],c=kt(o,a,l),_=St(o,a,l),v=vt[s];o=e[v],a=e[v+1],e[v]=c,e[v+1]=_}for(let s=0;s<50;s+=10){for(let l=0;l<10;l++)n[l]=e[s+l];for(let l=0;l<10;l++)e[s+l]^=~n[(l+2)%10]&n[(l+4)%10]}e[0]^=vr[r],e[1]^=xr[r]}n.fill(0)}class He extends _r{constructor(t,n,r,o=!1,a=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,pt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=fr(this.state)}keccak(){mt||bt(this.state32),Fr(this.state32,this.rounds),mt||bt(this.state32),this.posOut=0,this.pos=0}update(t){yt(this);const{blockLen:n,state:r}=this;t=gt(t);const o=t.length;for(let a=0;a<o;){const s=Math.min(n-this.pos,o-a);for(let l=0;l<s;l++)r[this.pos++]^=t[a++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){yt(this,!1),Be(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,a=t.length;o<a;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,a-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return pt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(or(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){const{blockLen:n,suffix:r,outputLen:o,rounds:a,enableXOF:s}=this;return t||(t=new He(n,r,o,s,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}}const kr=((e,t,n)=>pr(()=>new He(t,e,n)))(1,136,256/8);function Et(e,t){const n=t||"hex",r=kr($e(e,{strict:!1})?er(e):e);return n==="bytes"?r:he(r)}class Ct extends q{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"})}}class At extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Me=new At(8192);function Sr(e,t){if(Me.has(`${e}.${t}`))return Me.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Et(_t(n),"bytes"),o=n.split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&o[s]&&(o[s]=o[s].toUpperCase()),(r[s>>1]&15)>=8&&o[s+1]&&(o[s+1]=o[s+1].toUpperCase());const a=`0x${o.join("")}`;return Me.set(`${e}.${t}`,a),a}const Er=/^0x[a-fA-F0-9]{40}$/,Ne=new At(8192);function It(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Ne.has(r))return Ne.get(r);const o=Er.test(e)?e.toLowerCase()===e?!0:n?Sr(e)===e:!0:!1;return Ne.set(r,o),o}function Cr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Ar(e,t){if(!It(e,{strict:!1}))throw new Ct({address:e});if(!It(t,{strict:!1}))throw new Ct({address:t});return e.toLowerCase()===t.toLowerCase()}var Pt=Ln({"../../node_modules/async-lz-string/libs/async-lz-string.js"(e,t){(function(n,r){if(typeof e=="object"&&typeof t=="object")t.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var o=r();for(var a in o)(typeof e=="object"?e:n)[a]=o[a]}})(e,()=>(()=>{var n={48:function(o,a,s){var l=this&&this.__awaiter||function(p,m,i,h){return new(i||(i=Promise))(function(g,C){function k(E){try{S(h.next(E))}catch(y){C(y)}}function u(E){try{S(h.throw(E))}catch(y){C(y)}}function S(E){var y;E.done?g(E.value):(y=E.value,y instanceof i?y:new i(function(A){A(y)})).then(k,u)}S((h=h.apply(p,m||[])).next())})},c=this&&this.__generator||function(p,m){var i,h,g,C,k={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return C={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(C[Symbol.iterator]=function(){return this}),C;function u(S){return function(E){return function(y){if(i)throw new TypeError("Generator is already executing.");for(;C&&(C=0,y[0]&&(k=0)),k;)try{if(i=1,h&&(g=2&y[0]?h.return:y[0]?h.throw||((g=h.return)&&g.call(h),0):h.next)&&!(g=g.call(h,y[1])).done)return g;switch(h=0,g&&(y=[2&y[0],g.value]),y[0]){case 0:case 1:g=y;break;case 4:return k.label++,{value:y[1],done:!1};case 5:k.label++,h=y[1],y=[0];continue;case 7:y=k.ops.pop(),k.trys.pop();continue;default:if(!((g=(g=k.trys).length>0&&g[g.length-1])||y[0]!==6&&y[0]!==2)){k=0;continue}if(y[0]===3&&(!g||y[1]>g[0]&&y[1]<g[3])){k.label=y[1];break}if(y[0]===6&&k.label<g[1]){k.label=g[1],g=y;break}if(g&&k.label<g[2]){k.label=g[2],k.ops.push(y);break}g[2]&&k.ops.pop(),k.trys.pop();continue}y=m.call(p,k)}catch(A){y=[6,A],h=0}finally{i=g=0}if(5&y[0])throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}([S,E])}}};Object.defineProperty(a,"__esModule",{value:!0}),a.decompressFromUTF16=a.compressToUTF16=a.decompressFromBase64=a.compressToBase64=void 0;var _=s(304),v=s(134),d=new _.CompressorImpl,w=new v.DecompressorImpl,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b={};a.compressToBase64=function(p){return l(this,void 0,void 0,function(){var m;return c(this,function(i){switch(i.label){case 0:return p===null?[2,""]:[4,d.compress(p,6,function(h){return f.charAt(h)})];case 1:switch((m=i.sent()).length%4){default:case 0:return[2,m];case 1:return[2,m+"==="];case 2:return[2,m+"=="];case 3:return[2,m+"="]}return[2]}})})},a.decompressFromBase64=function(p){return l(this,void 0,void 0,function(){return c(this,function(m){switch(m.label){case 0:return p===null?[2,""]:p===""?[2,null]:[4,w.decompress(p.length,32,function(i){return function(h,g){if(!b[h]){b[h]={};for(var C=0;C<h.length;C++)b[h][h.charAt(C)]=C}return b[h][g]}(f,p.charAt(i))})];case 1:return[2,m.sent()]}})})},a.compressToUTF16=function(p){return l(this,void 0,void 0,function(){return c(this,function(m){switch(m.label){case 0:return p===null?[2,""]:[4,d.compress(p,15,function(i){return String.fromCharCode(i+32)})];case 1:return[2,m.sent()+" "]}})})},a.decompressFromUTF16=function(p){return l(this,void 0,void 0,function(){return c(this,function(m){switch(m.label){case 0:return p===null?[2,""]:p===""?[2,null]:[4,w.decompress(p.length,16384,function(i){return p.charCodeAt(i)-32})];case 1:return[2,m.sent()]}})})}},304:function(o,a,s){var l=this&&this.__awaiter||function(w,f,b,p){return new(b||(b=Promise))(function(m,i){function h(k){try{C(p.next(k))}catch(u){i(u)}}function g(k){try{C(p.throw(k))}catch(u){i(u)}}function C(k){var u;k.done?m(k.value):(u=k.value,u instanceof b?u:new b(function(S){S(u)})).then(h,g)}C((p=p.apply(w,f||[])).next())})},c=this&&this.__generator||function(w,f){var b,p,m,i,h={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return i={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function g(C){return function(k){return function(u){if(b)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(h=0)),h;)try{if(b=1,p&&(m=2&u[0]?p.return:u[0]?p.throw||((m=p.return)&&m.call(p),0):p.next)&&!(m=m.call(p,u[1])).done)return m;switch(p=0,m&&(u=[2&u[0],m.value]),u[0]){case 0:case 1:m=u;break;case 4:return h.label++,{value:u[1],done:!1};case 5:h.label++,p=u[1],u=[0];continue;case 7:u=h.ops.pop(),h.trys.pop();continue;default:if(!((m=(m=h.trys).length>0&&m[m.length-1])||u[0]!==6&&u[0]!==2)){h=0;continue}if(u[0]===3&&(!m||u[1]>m[0]&&u[1]<m[3])){h.label=u[1];break}if(u[0]===6&&h.label<m[1]){h.label=m[1],m=u;break}if(m&&h.label<m[2]){h.label=m[2],h.ops.push(u);break}m[2]&&h.ops.pop(),h.trys.pop();continue}u=f.call(w,h)}catch(S){u=[6,S],p=0}finally{b=m=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([C,k])}}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompressorImpl=void 0;var _=s(658),v=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],d=function(){function w(){}return w.writeValueToData=function(f,b,p,m,i){if(p%4!=0||f.dataPosition+p>m-1)for(var h=0;h<p;h++)f.dataVal=f.dataVal<<1|1&b,f.dataPosition==m-1?(f.dataPosition=0,f.data.push(i(f.dataVal)),f.dataVal=0):f.dataPosition++,b>>=1;else f.dataVal<<=p,f.dataVal|=function(g,C){for(var k=0,u=0;u<C;++u)k<<=4,k|=v[15&g],g>>=4;return k}(b,p/4),f.dataPosition+=p},w.writeWToDataVal=function(f,b,p){f.dictionaryToCreate.has(f.w)?(f.w.charCodeAt(0)<256?(w.writeValueToData(f,0,f.numBits,b,p),w.writeValueToData(f,f.w.charCodeAt(0),8,b,p)):(w.writeValueToData(f,1,f.numBits,b,p),w.writeValueToData(f,f.w.charCodeAt(0),16,b,p)),f.enlargeIn--,f.enlargeIn==0&&(f.enlargeIn=Math.pow(2,f.numBits),f.numBits++),f.dictionaryToCreate.delete(f.w)):w.writeValueToData(f,f.dictionary.get(f.w),f.numBits,b,p),f.enlargeIn--,f.enlargeIn==0&&(f.enlargeIn=Math.pow(2,f.numBits),f.numBits++)},w.loopIteration=function(f,b,p,m,i){var h=f.charAt(b);i.dictionary.has(h)||(i.dictionary.set(h,i.dictSize++),i.dictionaryToCreate.set(h,!0));var g=i.w+h;i.dictionary.has(g)?i.w=g:(this.writeWToDataVal(i,p,m),i.dictionary.set(g,i.dictSize++),i.w=String(h))},w.prototype.compress=function(f,b,p){var m=this;return new Promise(function(i){return l(m,void 0,void 0,function(){var h,g;return c(this,function(C){switch(C.label){case 0:if(f==null)return i(""),[2];h={data:[],dataPosition:0,dataVal:0,dictionary:new Map,dictionaryToCreate:new Map,dictSize:3,enlargeIn:2,numBits:2,w:""},g=0,C.label=1;case 1:return g<f.length?(w.loopIteration(f,g,b,p,h),g%1e4!=0?[3,3]:[4,(0,_.wait)()]):[3,4];case 2:C.sent(),C.label=3;case 3:return g+=1,[3,1];case 4:return h.w!==""&&w.writeWToDataVal(h,b,p),w.writeValueToData(h,2,h.numBits,b,p),h.dataVal<<=b-h.dataPosition,h.data.push(p(h.dataVal)),i(h.data.join("")),[2]}})})})},w}();a.CompressorImpl=d},134:function(o,a,s){var l=this&&this.__awaiter||function(d,w,f,b){return new(f||(f=Promise))(function(p,m){function i(C){try{g(b.next(C))}catch(k){m(k)}}function h(C){try{g(b.throw(C))}catch(k){m(k)}}function g(C){var k;C.done?p(C.value):(k=C.value,k instanceof f?k:new f(function(u){u(k)})).then(i,h)}g((b=b.apply(d,w||[])).next())})},c=this&&this.__generator||function(d,w){var f,b,p,m,i={label:0,sent:function(){if(1&p[0])throw p[1];return p[1]},trys:[],ops:[]};return m={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function h(g){return function(C){return function(k){if(f)throw new TypeError("Generator is already executing.");for(;m&&(m=0,k[0]&&(i=0)),i;)try{if(f=1,b&&(p=2&k[0]?b.return:k[0]?b.throw||((p=b.return)&&p.call(b),0):b.next)&&!(p=p.call(b,k[1])).done)return p;switch(b=0,p&&(k=[2&k[0],p.value]),k[0]){case 0:case 1:p=k;break;case 4:return i.label++,{value:k[1],done:!1};case 5:i.label++,b=k[1],k=[0];continue;case 7:k=i.ops.pop(),i.trys.pop();continue;default:if(!((p=(p=i.trys).length>0&&p[p.length-1])||k[0]!==6&&k[0]!==2)){i=0;continue}if(k[0]===3&&(!p||k[1]>p[0]&&k[1]<p[3])){i.label=k[1];break}if(k[0]===6&&i.label<p[1]){i.label=p[1],p=k;break}if(p&&i.label<p[2]){i.label=p[2],i.ops.push(k);break}p[2]&&i.ops.pop(),i.trys.pop();continue}k=w.call(d,i)}catch(u){k=[6,u],b=0}finally{f=p=0}if(5&k[0])throw k[1];return{value:k[0]?k[1]:void 0,done:!0}}([g,C])}}};Object.defineProperty(a,"__esModule",{value:!0}),a.DecompressorImpl=void 0;var _=s(658),v=function(){function d(){}return d.prototype.decompress=function(w,f,b){var p=this;return new Promise(function(m){return l(p,void 0,void 0,function(){var i,h,g;return c(this,function(C){switch(C.label){case 0:for(i={bits:0,c:null,dataIndex:1,dataPosition:f,dataVal:b(0),dictionary:new Map,dictSize:4,enlargeIn:4,entry:"",maxPower:Math.pow(2,2),numBits:3,power:1,resb:null,result:[],w:null},h=0;h<3;h+=1)i.dictionary.set(h,h);for(;i.power!=i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition==0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;switch(i.bits){case 0:for(i.bits=0,i.maxPower=Math.pow(2,8),i.power=1;i.power!=i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition==0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;i.c=String.fromCharCode(i.bits);break;case 1:for(i.bits=0,i.maxPower=Math.pow(2,16),i.power=1;i.power!==i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition===0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;i.c=String.fromCharCode(i.bits);break;case 2:return m(""),[2]}i.dictionary[3]=i.c,i.w=i.c,i.result.push(i.c),g=1,C.label=1;case 1:return g%2e4!=0?[3,3]:[4,(0,_.wait)()];case 2:C.sent(),C.label=3;case 3:if(i.dataIndex>w)return m(""),[2];for(i.bits=0,i.maxPower=Math.pow(2,i.numBits),i.power=1;i.power!=i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition==0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;switch(i.c=i.bits){case 0:for(i.bits=0,i.maxPower=Math.pow(2,8),i.power=1;i.power!==i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition==0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;i.dictionary[i.dictSize++]=String.fromCharCode(i.bits),i.c=i.dictSize-1,i.enlargeIn--;break;case 1:for(i.bits=0,i.maxPower=Math.pow(2,16),i.power=1;i.power!==i.maxPower;)i.resb=i.dataVal&i.dataPosition,i.dataPosition>>=1,i.dataPosition==0&&(i.dataPosition=f,i.dataVal=b(i.dataIndex++)),i.bits|=(i.resb>0?1:0)*i.power,i.power<<=1;i.dictionary[i.dictSize++]=String.fromCharCode(i.bits),i.c=i.dictSize-1,i.enlargeIn--;break;case 2:return m(i.result.join("")),[2]}if(i.enlargeIn==0&&(i.enlargeIn=Math.pow(2,i.numBits),i.numBits++),i.dictionary[i.c])i.entry=i.dictionary[i.c];else{if(i.c!==i.dictSize)return m(null),[2];i.entry=i.w+i.w.charAt(0)}return i.result.push(i.entry),i.dictionary[i.dictSize++]=i.w+i.entry.charAt(0),i.enlargeIn--,i.w=i.entry,i.enlargeIn==0&&(i.enlargeIn=Math.pow(2,i.numBits),i.numBits++),g++,[3,1];case 4:return[2]}})})})},d}();a.DecompressorImpl=v},658:function(o,a){var s=this&&this.__awaiter||function(c,_,v,d){return new(v||(v=Promise))(function(w,f){function b(i){try{m(d.next(i))}catch(h){f(h)}}function p(i){try{m(d.throw(i))}catch(h){f(h)}}function m(i){var h;i.done?w(i.value):(h=i.value,h instanceof v?h:new v(function(g){g(h)})).then(b,p)}m((d=d.apply(c,_||[])).next())})},l=this&&this.__generator||function(c,_){var v,d,w,f,b={label:0,sent:function(){if(1&w[0])throw w[1];return w[1]},trys:[],ops:[]};return f={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function p(m){return function(i){return function(h){if(v)throw new TypeError("Generator is already executing.");for(;f&&(f=0,h[0]&&(b=0)),b;)try{if(v=1,d&&(w=2&h[0]?d.return:h[0]?d.throw||((w=d.return)&&w.call(d),0):d.next)&&!(w=w.call(d,h[1])).done)return w;switch(d=0,w&&(h=[2&h[0],w.value]),h[0]){case 0:case 1:w=h;break;case 4:return b.label++,{value:h[1],done:!1};case 5:b.label++,d=h[1],h=[0];continue;case 7:h=b.ops.pop(),b.trys.pop();continue;default:if(!((w=(w=b.trys).length>0&&w[w.length-1])||h[0]!==6&&h[0]!==2)){b=0;continue}if(h[0]===3&&(!w||h[1]>w[0]&&h[1]<w[3])){b.label=h[1];break}if(h[0]===6&&b.label<w[1]){b.label=w[1],w=h;break}if(w&&b.label<w[2]){b.label=w[2],b.ops.push(h);break}w[2]&&b.ops.pop(),b.trys.pop();continue}h=_.call(c,b)}catch(g){h=[6,g],d=0}finally{v=w=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([m,i])}}};Object.defineProperty(a,"__esModule",{value:!0}),a.wait=void 0,a.wait=function(){return s(this,void 0,void 0,function(){return l(this,function(c){return[2,new Promise(function(_){setTimeout(_,0)})]})})}}},r={};return function o(a){var s=r[a];if(s!==void 0)return s.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}(48)})())}}),M=class extends Error{constructor(e,t,n){super(t),this.code=e,this.data=n}},Ir=class extends M{constructor(e){super(N.internalError,e)}},N={internalError:-32603,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006},$t=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}},Pr=ot(Pt());async function Tt(e){const t=de.sha256(JSON.stringify(e)),n={...e,validationHash:t},r=await $r(n),o=de.sha256(r);return{compressed:r,compressedHash:o}}async function $r(e){return(0,Pr.compressToBase64)(JSON.stringify(e))}var Tr=ot(Pt());async function Ot(e){if(!(e?.compressed&&e?.compressedHash))throw new M(N.corruptedResponse,"Missing compressed data");const t=await Or(e.compressed);if(!t)throw new M(N.corruptedResponse,"Invalid compressed data");if(!t?.validationHash)throw new M(N.corruptedResponse,"Missing validation hash");if(de.sha256(e.compressed)!==e.compressedHash)throw new M(N.corruptedResponse,"Invalid compressed hash");const{validationHash:r,...o}=t;if(de.sha256(JSON.stringify(o))!==t.validationHash)throw new M(N.corruptedResponse,"Invalid data validation hash");return t}async function Or(e){const t=await(0,Tr.decompressFromBase64)(e);try{return JSON.parse(t)}catch(n){return console.error("Invalid compressed data",{e:n,decompressed:t}),null}}var pe={id:"nexus-wallet",name:"nexus-wallet",allow:"publickey-credentials-get *; clipboard-write; web-share *",style:{zIndex:2000001}};function Rr({walletBaseUrl:e,config:t}){const n=document.querySelector("#nexus-wallet");n&&n.remove();const r=document.createElement("iframe");return r.id=pe.id,r.name=pe.name,r.allow=pe.allow,r.style.zIndex=pe.style.zIndex.toString(),Rt({iframe:r,isVisible:!1}),document.body.appendChild(r),new Promise(o=>{r?.addEventListener("load",()=>o(r)),r.src=`${t?.walletUrl??e??"https://wallet.frak.id"}/listener`})}function Rt({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"}var Ue="fCtx";function Br(e){return btoa(Array.from(e,t=>String.fromCharCode(t)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Hr(e){const t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(t===0?0:4-t),"=")),n=>n.charCodeAt(0))}function Bt(e){if(e?.r)try{const t=Re(e.r);return Br(t)}catch(t){console.error("Error compressing Frak context",{e:t,context:e})}}function Ht(e){if(!(!e||e.length===0))try{const t=Hr(e);return{r:Oe(t,{size:20})}}catch(t){console.error("Error decompressing Frak context",{e:t,context:e})}}function Mt({url:e}){if(!e)return null;const n=new URL(e).searchParams.get(Ue);return n?Ht(n):null}function Nt({url:e,context:t}){if(!e)return null;const n=Mt({url:e}),r=n?{...n,...t}:t;if(!r.r)return null;const o=Bt(r);if(!o)return null;const a=new URL(e);return a.searchParams.set(Ue,o),a.toString()}function Ut(e){const t=new URL(e);return t.searchParams.delete(Ue),t.toString()}function Mr({url:e,context:t}){if(!window.location?.href||typeof window>"u"){console.error("No window found, can't update context");return}const n=e??window.location.href;let r;t!==null?r=Nt({url:n,context:t}):r=Ut(n),r&&window.history.replaceState(null,"",r.toString())}var Le={compress:Bt,decompress:Ht,parse:Mt,update:Nt,remove:Ut,replaceUrl:Mr},ye="nexus-wallet-backup",Lt=class Hn{config;iframe;isSetupDone=!1;lastResponse=null;lastRequest=null;constructor(t,n){this.config=t,this.iframe=n,this.lastRequest=null,this.lastResponse=null}setLastResponse(t){this.lastResponse={event:t.data,origin:t.origin,timestamp:Date.now()}}setLastRequest(t,n){this.lastRequest={event:t,target:n,timestamp:Date.now()}}updateSetupStatus(t){this.isSetupDone=t}base64Encode(t){try{return btoa(JSON.stringify(t))}catch(n){return console.warn("Failed to encode debug data",n),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){const n=this.getIframeStatus(),r=this.getNavigatorInfo();let o="Unknown";return t instanceof M?o=`FrakRpcError: ${t.code} '${t.message}'`:t instanceof Error?o=t.message:typeof t=="string"&&(o=t),{timestamp:new Date().toISOString(),encodedUrl:btoa(window.location.href),encodedConfig:this.config?this.base64Encode(this.config):"no-config",navigatorInfo:r?this.base64Encode(r):"no-navigator",iframeStatus:n?this.base64Encode(n):"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:o}}static empty(){return new Hn}formatDebugInfo(t){const n=this.gatherDebugInfo(t);return`
|
|
10
|
-
Debug Information:
|
|
11
|
-
-----------------
|
|
12
|
-
Timestamp: ${n.timestamp}
|
|
13
|
-
URL: ${n.encodedUrl}
|
|
14
|
-
Config: ${n.encodedConfig}
|
|
15
|
-
Navigator Info: ${n.navigatorInfo}
|
|
16
|
-
IFrame Status: ${n.iframeStatus}
|
|
17
|
-
Last Request: ${n.lastRequest}
|
|
18
|
-
Last Response: ${n.lastResponse}
|
|
19
|
-
Client Status: ${n.clientStatus}
|
|
20
|
-
Error: ${n.error}
|
|
21
|
-
`.trim()}};function Nr(){const e=new Map;return{createChannel:t=>{const n=Math.random().toString(36).substring(7);return e.set(n,t),n},getRpcResolver:t=>e.get(t),removeChannel:t=>e.delete(t),destroy:()=>e.clear()}}function Ur({iframe:e}){const t=new $t;return{handleEvent:async r=>{switch(r.iframeLifecycle){case"connected":t.resolve(!0);break;case"do-backup":r.data.backup?localStorage.setItem(ye,r.data.backup):localStorage.removeItem(ye);break;case"remove-backup":localStorage.removeItem(ye);break;case"show":case"hide":Rt({iframe:e,isVisible:r.iframeLifecycle==="show"});break;case"handshake":{e.contentWindow?.postMessage({clientLifecycle:"handshake-response",data:{token:r.data.token,currentUrl:window.location.href}},"*");break}}},isConnected:t.promise}}function Lr({frakWalletUrl:e,iframe:t,channelManager:n,iframeLifecycleManager:r,debugInfo:o}){if(typeof window>"u")throw new M(N.configError,"iframe client should be used in the browser");if(!t.contentWindow)throw new M(N.configError,"The iframe does not have a product window");const a=t.contentWindow;async function s(_){if(!_.origin)return;try{if(new URL(_.origin).origin.toLowerCase()!==new URL(e).origin.toLowerCase())return}catch(w){console.log("Unable to check frak msg origin",w);return}if(typeof _.data!="object")return;if(o.setLastResponse(_),"iframeLifecycle"in _.data){await r.handleEvent(_.data);return}if("clientLifecycle"in _.data){console.error("Client lifecycle event received on the client side, dismissing it");return}const v=_.data.id,d=n.getRpcResolver(v);d&&await d(_.data)}window.addEventListener("message",s);function l(_){a.postMessage(_,{targetOrigin:e}),o.setLastRequest(_,e)}function c(){window.removeEventListener("message",s)}return{sendEvent:l,cleanup:c}}function zr({config:e,iframe:t}){const n=Nr(),r=Ur({iframe:t}),o=new Lt(e,t),a=Lr({frakWalletUrl:e?.walletUrl??"https://wallet.frak.id",iframe:t,channelManager:n,iframeLifecycleManager:r,debugInfo:o}),s=async d=>{if(!await r.isConnected)throw new M(N.clientNotConnected,"The iframe provider isn't connected yet");const f=new $t,b=n.createChannel(async m=>{const i=await Ot(m.data);i.error?f.reject(new M(i.error.code,i.error.message,i.error?.data)):f.resolve(i.result),n.removeChannel(b)}),p=await Tt(d);return a.sendEvent({id:b,topic:d.method,data:p}),f.promise},l=async(d,w)=>{if(!await r.isConnected)throw new M(N.clientNotConnected,"The iframe provider isn't connected yet");const b=n.createChannel(async m=>{const i=await Ot(m.data);if(i.result)w(i.result);else throw new Ir("No valid result in the response")}),p=await Tt(d);a.sendEvent({id:b,topic:d.method,data:p})},c=Dr(a,r),_=async()=>{c(),n.destroy(),a.cleanup(),t.remove()},v=jr({config:e,messageHandler:a,lifecycleManager:r}).then(()=>o.updateSetupStatus(!0));return{config:e,debugInfo:o,waitForConnection:r.isConnected,waitForSetup:v,request:s,listenerRequest:l,destroy:_}}function Dr(e,t){let o,a;const s=()=>e.sendEvent({clientLifecycle:"heartbeat"});async function l(){s(),o=setInterval(s,100),a=setTimeout(()=>{c(),console.log("Heartbeat timeout: connection failed")},3e4),await t.isConnected,c()}function c(){o&&clearInterval(o),a&&clearTimeout(a)}return l(),c}async function jr({config:e,messageHandler:t,lifecycleManager:n}){await n.isConnected;const r=async()=>{const a=e.metadata.css;a&&t.sendEvent({clientLifecycle:"modal-css",data:{cssLink:a}})},o=async()=>{if(typeof window>"u")return;const a=window.localStorage.getItem(ye);a&&t.sendEvent({clientLifecycle:"restore-backup",data:{backup:a}})};await Promise.all([r(),o()])}async function Vr({config:e}){const t=await Rr({config:e});if(!t){console.error("Failed to create iframe");return}const n=zr({config:e,iframe:t});if(await n.waitForSetup,!await n.waitForConnection){console.error("Failed to connect to client");return}return n}function Wr(e){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(e,1):document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&e()})}var ie,I,zt,Z,Dt,jt,ze,Vt,De,je,Ve,ae={},Wt=[],qr=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,we=Array.isArray;function j(e,t){for(var n in t)e[n]=t[n];return e}function We(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function z(e,t,n){var r,o,a,s={};for(a in t)a=="key"?r=t[a]:a=="ref"?o=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?ie.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return se(e,s,r,o,null)}function se(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++zt,__i:-1,__u:0};return o==null&&I.vnode!=null&&I.vnode(a),a}function Q(e){return e.children}function V(e,t){this.props=e,this.context=t}function te(e,t){if(t==null)return e.__?te(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?te(e):null}function qt(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return qt(e)}}function Jt(e){(!e.__d&&(e.__d=!0)&&Z.push(e)&&!me.__r++||Dt!==I.debounceRendering)&&((Dt=I.debounceRendering)||jt)(me)}function me(){var e,t,n,r,o,a,s,l;for(Z.sort(ze);e=Z.shift();)e.__d&&(t=Z.length,r=void 0,a=(o=(n=e).__v).__e,s=[],l=[],n.__P&&((r=j({},o)).__v=o.__v+1,I.vnode&&I.vnode(r),qe(n.__P,r,o,n.__n,n.__P.namespaceURI,32&o.__u?[a]:null,s,a??te(o),!!(32&o.__u),l),r.__v=o.__v,r.__.__k[r.__i]=r,Zt(s,r,l),r.__e!=a&&qt(r)),Z.length>t&&Z.sort(ze));me.__r=0}function Kt(e,t,n,r,o,a,s,l,c,_,v){var d,w,f,b,p,m,i=r&&r.__k||Wt,h=t.length;for(c=Jr(n,t,i,c,h),d=0;d<h;d++)(f=n.__k[d])!=null&&(w=f.__i===-1?ae:i[f.__i]||ae,f.__i=d,m=qe(e,f,w,o,a,s,l,c,_,v),b=f.__e,f.ref&&w.ref!=f.ref&&(w.ref&&Je(w.ref,null,f),v.push(f.ref,f.__c||b,f)),p==null&&b!=null&&(p=b),4&f.__u||w.__k===f.__k?c=Gt(f,c,e):typeof f.type=="function"&&m!==void 0?c=m:b&&(c=b.nextSibling),f.__u&=-7);return n.__e=p,c}function Jr(e,t,n,r,o){var a,s,l,c,_,v=n.length,d=v,w=0;for(e.__k=new Array(o),a=0;a<o;a++)(s=t[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(c=a+w,(s=e.__k[a]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?se(null,s,null,null,null):we(s)?se(Q,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?se(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,l=null,(_=s.__i=Kr(s,n,c,d))!==-1&&(d--,(l=n[_])&&(l.__u|=2)),l==null||l.__v===null?(_==-1&&w--,typeof s.type!="function"&&(s.__u|=4)):_!=c&&(_==c-1?w--:_==c+1?w++:(_>c?w--:w++,s.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<v;a++)(l=n[a])!=null&&!(2&l.__u)&&(l.__e==r&&(r=te(l)),Qt(l,l));return r}function Gt(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=Gt(r[o],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=te(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function be(e,t){return t=t||[],e==null||typeof e=="boolean"||(we(e)?e.some(function(n){be(n,t)}):t.push(e)),t}function Kr(e,t,n,r){var o,a,s=e.key,l=e.type,c=t[n];if(c===null||c&&s==c.key&&l===c.type&&!(2&c.__u))return n;if(r>(c!=null&&!(2&c.__u)?1:0))for(o=n-1,a=n+1;o>=0||a<t.length;){if(o>=0){if((c=t[o])&&!(2&c.__u)&&s==c.key&&l===c.type)return o;o--}if(a<t.length){if((c=t[a])&&!(2&c.__u)&&s==c.key&&l===c.type)return a;a++}}return-1}function Xt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||qr.test(t)?n:n+"px"}function ge(e,t,n,r,o){var a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Xt(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Xt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Vt,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n.u=r.u:(n.u=De,e.addEventListener(t,a?Ve:je,a)):e.removeEventListener(t,a?Ve:je,a);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Yt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=De++;else if(t.t<n.u)return;return n(I.event?I.event(t):t)}}}function qe(e,t,n,r,o,a,s,l,c,_){var v,d,w,f,b,p,m,i,h,g,C,k,u,S,E,y,A,x=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(v=I.__b)&&v(t);e:if(typeof x=="function")try{if(i=t.props,h="prototype"in x&&x.prototype.render,g=(v=x.contextType)&&r[v.__c],C=v?g?g.props.value:v.__:r,n.__c?m=(d=t.__c=n.__c).__=d.__E:(h?t.__c=d=new x(i,C):(t.__c=d=new V(i,C),d.constructor=x,d.render=Xr),g&&g.sub(d),d.props=i,d.state||(d.state={}),d.context=C,d.__n=r,w=d.__d=!0,d.__h=[],d._sb=[]),h&&d.__s==null&&(d.__s=d.state),h&&x.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=j({},d.__s)),j(d.__s,x.getDerivedStateFromProps(i,d.__s))),f=d.props,b=d.state,d.__v=t,w)h&&x.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),h&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(h&&x.getDerivedStateFromProps==null&&i!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(i,C),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(i,d.__s,C)===!1||t.__v==n.__v)){for(t.__v!=n.__v&&(d.props=i,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(P){P&&(P.__=t)}),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&s.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(i,d.__s,C),h&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,b,p)})}if(d.context=C,d.props=i,d.__P=e,d.__e=!1,u=I.__r,S=0,h){for(d.state=d.__s,d.__d=!1,u&&u(t),v=d.render(d.props,d.state,d.context),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[]}else do d.__d=!1,u&&u(t),v=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++S<25);d.state=d.__s,d.getChildContext!=null&&(r=j(j({},r),d.getChildContext())),h&&!w&&d.getSnapshotBeforeUpdate!=null&&(p=d.getSnapshotBeforeUpdate(f,b)),l=Kt(e,we(y=v!=null&&v.type===Q&&v.key==null?v.props.children:v)?y:[y],t,n,r,o,a,s,l,c,_),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),m&&(d.__E=d.__=null)}catch(P){if(t.__v=null,c||a!=null)if(P.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,t.__e=l}else for(A=a.length;A--;)We(a[A]);else t.__e=n.__e,t.__k=n.__k;I.__e(P,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=Gr(n.__e,t,n,r,o,a,s,c,_);return(v=I.diffed)&&v(t),128&t.__u?void 0:l}function Zt(e,t,n){for(var r=0;r<n.length;r++)Je(n[r],n[++r],n[++r]);I.__c&&I.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){I.__e(a,o.__v)}})}function Gr(e,t,n,r,o,a,s,l,c){var _,v,d,w,f,b,p,m=n.props,i=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(_=0;_<a.length;_++)if((f=a[_])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,a[_]=null;break}}if(e==null){if(h==null)return document.createTextNode(i);e=document.createElementNS(o,h,i.is&&i),l&&(I.__m&&I.__m(t,a),l=!1),a=null}if(h===null)m===i||l&&e.data===i||(e.data=i);else{if(a=a&&ie.call(e.childNodes),m=n.props||ae,!l&&a!=null)for(m={},_=0;_<e.attributes.length;_++)m[(f=e.attributes[_]).name]=f.value;for(_ in m)if(f=m[_],_!="children"){if(_=="dangerouslySetInnerHTML")d=f;else if(!(_ in i)){if(_=="value"&&"defaultValue"in i||_=="checked"&&"defaultChecked"in i)continue;ge(e,_,null,f,o)}}for(_ in i)f=i[_],_=="children"?w=f:_=="dangerouslySetInnerHTML"?v=f:_=="value"?b=f:_=="checked"?p=f:l&&typeof f!="function"||m[_]===f||ge(e,_,f,m[_],o);if(v)l||d&&(v.__html===d.__html||v.__html===e.innerHTML)||(e.innerHTML=v.__html),t.__k=[];else if(d&&(e.innerHTML=""),Kt(e,we(w)?w:[w],t,n,r,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,s,a?a[0]:n.__k&&te(n,0),l,c),a!=null)for(_=a.length;_--;)We(a[_]);l||(_="value",h=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[_]||h=="progress"&&!b||h=="option"&&b!==m[_])&&ge(e,_,b,m[_],o),_="checked",p!==void 0&&p!==e[_]&&ge(e,_,p,m[_],o))}return e}function Je(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){I.__e(o,n)}}function Qt(e,t,n){var r,o;if(I.unmount&&I.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Je(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){I.__e(a,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Qt(r[o],t,n||typeof e.type!="function");n||We(e.__e),e.__c=e.__=e.__e=void 0}function Xr(e,t,n){return this.constructor(e,n)}function ve(e,t,n){var r,o,a,s;t==document&&(t=document.documentElement),I.__&&I.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],qe(t,e=(!r&&n||t).__k=z(Q,null,[e]),o||ae,ae,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?ie.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,s),Zt(a,e,s)}function en(e,t){ve(e,t,en)}function tn(e,t,n){var r,o,a,s,l=j({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)a=="key"?r=t[a]:a=="ref"?o=t[a]:l[a]=t[a]===void 0&&s!==void 0?s[a]:t[a];return arguments.length>2&&(l.children=arguments.length>3?ie.call(arguments,2):n),se(e.type,l,r||e.key,o||e.ref,null)}ie=Wt.slice,I={__e:function(e,t,n,r){for(var o,a,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(l){e=l}throw e}},zt=0,V.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=j({},this.state),typeof e=="function"&&(e=e(j({},n),this.props)),e&&j(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Jt(this))},V.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Jt(this))},V.prototype.render=Q,Z=[],jt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ze=function(e,t){return e.__v.__b-t.__v.__b},me.__r=0,Vt=/(PointerCapture)$|Capture$/i,De=0,je=Yt(!1),Ve=Yt(!0);function Ke(){return(Ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Yr=["context","children"];function Zr(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var a,s,l={},c=Object.keys(r);for(s=0;s<c.length;s++)o.indexOf(a=c[s])>=0||(l[a]=r[a]);return l}(e,Yr);return tn(t,n)}function Qr(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=z(Zr,Ke({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],a={},s=0,l=n.attributes,c=n.childNodes;for(s=l.length;s--;)l[s].name!=="slot"&&(a[l[s].name]=l[s].value,a[nn(l[s].name)]=l[s].value);for(s=c.length;s--;){var _=t(c[s],null),v=c[s].slot;v?a[v]=z(rn,{name:v},_):o[s]=_}var d=r?z(rn,null,o):o;return z(r||n.nodeName.toLowerCase(),a,d)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?en:ve)(this._vdom,this._root)}function nn(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function eo(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[nn(e)]=n,this._vdom=tn(this._vdom,r),ve(this._vdom,this._root)}}function to(){ve(this._vdom=null,this._root)}function rn(e,t){var n=this;return z("slot",Ke({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function on(e,t,n,r){function o(){var a=Reflect.construct(HTMLElement,[],o);return a._vdomComponent=e,a._root=r&&r.shadow?a.attachShadow({mode:r.mode||"open"}):a,a}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Qr,o.prototype.attributeChangedCallback=eo,o.prototype.disconnectedCallback=to,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(a){Object.defineProperty(o.prototype,a,{get:function(){return this._vdom.props[a]},set:function(s){this._vdom?this.attributeChangedCallback(a,null,s):(this._props||(this._props={}),this._props[a]=s,this.connectedCallback());var l=typeof s;s!=null&&l!=="string"&&l!=="boolean"&&l!=="number"||this.setAttribute(a,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}var no=0;function O(e,t,n,r,o,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)l=="ref"?s=t[l]:c[l]=t[l];var _={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--no,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return I.vnode&&I.vnode(_),_}var ro={createLink(){return{handlerTypeDenominator:he(Ie.referral),interactionData:it.referral.createLink}},referred({referrer:e}){const t=Cr([it.referral.referred,Y(e,{size:32})]);return{handlerTypeDenominator:he(Ie.referral),interactionData:t}}};function oo(e,t){return e.request({method:"frak_listenToWalletStatus"}).then(n=>(io(n.interactionToken),n))}function io(e){typeof window>"u"||(e?window.sessionStorage.setItem("frak-wallet-interaction-token",e):window.sessionStorage.removeItem("frak.interaction-token"))}function ao({domain:e}){const t=e??window.location.host;return Et(he(t))}async function so(e,{productId:t,interaction:n,validation:r}){const o=t??ao(e.config);return await e.request({method:"frak_sendInteraction",params:[o,n,r]})}async function an(e,{steps:t,metadata:n}){return await e.request({method:"frak_displayModal",params:[t,e.config.metadata.name,n]})}async function sn(e,t){await e.request({method:"frak_displayEmbededWallet",params:[t,e.config.metadata.name]})}async function co(e){return await e.request({method:"frak_getProductInformation"})}function uo(e,{metadata:t,login:n,openSession:r}){return xe(e,{steps:{login:n??{},openSession:r??{}},metadata:t})}function xe(e,t){function n(s){return xe(e,{...t,steps:{...t.steps,sendTransaction:s}})}function r(s){return xe(e,{...t,steps:{...t.steps,final:{...s,action:{key:"reward"}}}})}function o(s,l){return xe(e,{...t,steps:{...t.steps,final:{...l,action:{key:"sharing",options:s}}}})}async function a(s){return s&&(t.metadata=s(t.metadata??{})),await an(e,t)}return{params:t,sendTx:n,reward:r,sharing:o,display:a}}async function lo(e,{walletStatus:t,frakContext:n,modalConfig:r,productId:o,options:a}){let s=!1;async function l(){if(!s)return s=!0,ho(e,{modalConfig:r,walletStatus:t})}async function c(_){const v=ro.referred({referrer:_});await so(e,{productId:o,interaction:v})}try{const{status:_,currentWallet:v}=await fo({initialWalletStatus:t,getFreshWalletStatus:l,pushReferralInteraction:c,frakContext:n});return Le.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r:v}:null}),_}catch(_){return console.log("Error processing referral",{error:_}),Le.replaceUrl({url:window.location?.href,context:a?.alwaysAppendUrl?{r:t?.wallet}:null}),_o(_)}}async function fo({initialWalletStatus:e,getFreshWalletStatus:t,pushReferralInteraction:n,frakContext:r}){let o=e?.wallet;return r?.r?(o||(o=await t()),o&&Ar(r.r,o)?{status:"self-referral",currentWallet:o}:(e?.interactionSession||(o=await t()),await n(r.r),{status:"success",currentWallet:o})):{status:"no-referrer",currentWallet:o}}async function ho(e,{modalConfig:t,walletStatus:n}){return n?.interactionSession?n.wallet??void 0:t?(await an(e,t))?.login?.wallet??void 0:void 0}function _o(e){if(e instanceof M)switch(e.code){case N.walletNotConnected:return"no-wallet";case N.serverErrorForInteractionDelegation:return"no-session";default:return"error"}return"error"}async function po(e,{productId:t,modalConfig:n,options:r}={}){const o=Le.parse({url:window.location.href}),a=await oo(e);try{return await lo(e,{walletStatus:a,frakContext:o,modalConfig:n,productId:t,options:r})}catch(s){console.warn("Error processing referral",{error:s})}}function cn(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=cn(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function yo(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=cn(e))&&(r&&(r+=" "),r+=t);return r}const un=yo;var ce,B,Ge,ln,ue=0,fn=[],H=I,dn=H.__b,hn=H.__r,_n=H.diffed,pn=H.__c,yn=H.unmount,wn=H.__;function Xe(e,t){H.__h&&H.__h(B,e,ue||t),ue=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return ue=1,wo(gn,e)}function wo(e,t,n){var r=Xe(ce++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):gn(void 0,t),function(l){var c=r.__N?r.__N[0]:r.__[0],_=r.t(c,l);c!==_&&(r.__N=[_,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.u)){var o=function(l,c,_){if(!r.__c.__H)return!0;var v=r.__c.__H.__.filter(function(w){return!!w.__c});if(v.every(function(w){return!w.__N}))return!a||a.call(this,l,c,_);var d=r.__c.props!==l;return v.forEach(function(w){if(w.__N){var f=w.__[0];w.__=w.__N,w.__N=void 0,f!==w.__[0]&&(d=!0)}}),a&&a.call(this,l,c,_)||d};B.u=!0;var a=B.shouldComponentUpdate,s=B.componentWillUpdate;B.componentWillUpdate=function(l,c,_){if(this.__e){var v=a;a=void 0,o(l,c,_),a=v}s&&s.call(this,l,c,_)},B.shouldComponentUpdate=o}return r.__N||r.__}function Ye(e,t){var n=Xe(ce++,3);!H.__s&&bn(n.__H,t)&&(n.__=e,n.i=t,B.__H.__h.push(n))}function mo(e){return ue=5,ne(function(){return{current:e}},[])}function ne(e,t){var n=Xe(ce++,7);return bn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Fe(e,t){return ue=8,ne(function(){return e},t)}function bo(){for(var e;e=fn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ke),e.__H.__h.forEach(Ze),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){B=null,dn&&dn(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),wn&&wn(e,t)},H.__r=function(e){hn&&hn(e),ce=0;var t=(B=e.__c).__H;t&&(Ge===B?(t.__h=[],B.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(ke),t.__h.forEach(Ze),t.__h=[],ce=0)),Ge=B},H.diffed=function(e){_n&&_n(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(fn.push(t)!==1&&ln===H.requestAnimationFrame||((ln=H.requestAnimationFrame)||go)(bo)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),Ge=B=null},H.__c=function(e,t){t.some(function(n){try{n.__h.forEach(ke),n.__h=n.__h.filter(function(r){return!r.__||Ze(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],H.__e(r,n.__v)}}),pn&&pn(e,t)},H.unmount=function(e){yn&&yn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{ke(r)}catch(o){t=o}}),n.__H=void 0,t&&H.__e(t,n.__v))};var mn=typeof requestAnimationFrame=="function";function go(e){var t,n=function(){clearTimeout(r),mn&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);mn&&(t=requestAnimationFrame(n))}function ke(e){var t=B,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),B=t}function Ze(e){var t=B;e.__c=e.__(),B=t}function bn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function gn(e,t){return typeof t=="function"?t(e):t}const W={spinner:"_spinner_1gez9_1",spinner__leaf:"_spinner__leaf_1gez9_10"},vn=({ref:e,className:t,...n})=>O("span",{...n,ref:e,className:un(W.spinner),children:[O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf}),O("span",{className:W.spinner__leaf})]});vn.displayName="Spinner";function vo(e={}){const{successDuration:t=2e3}=e,[n,r]=J(!1);return{copy:Fe(async a=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(a),r(!0);else{const s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();try{document.execCommand("copy"),r(!0)}catch(l){return console.error("Failed to copy text:",l),!1}finally{s.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(s){return console.error("Failed to copy text:",s),!1}},[t]),copied:n}}const xn="frakClientReady";let Se;function xo(){const e=new CustomEvent(xn);window.dispatchEvent(e)}function Ee(e,t){if(window.FrakSetup?.client&&e==="add"){t();return}(e==="add"?window.addEventListener:window.removeEventListener)(xn,t,!1)}function Fo(e){Se=uo(e,window.FrakSetup?.modalConfig??{})}async function ko(e){if(!Se){console.error("modalBuilderSteps not found");return}const t=await po(e,{modalConfig:Se.reward().params});console.log("referral",t)}function So(){return Se}function Eo(){"vibrate"in navigator?navigator.vibrate(200):console.log("Vibration not supported")}async function Fn(e){const t=window.FrakSetup?.client;if(!t){console.warn("Frak client not ready yet");return}const n=await co(t);if(!n?.estimatedEurReward)return;let r=n.estimatedEurReward;if(e){const o=n.rewards.filter(a=>a.interactionTypeKey===e).map(a=>a.referrer.eurAmount).reduce((a,s)=>s>a?s:a,0);o>0&&(r=Math.ceil(o).toString())}return r}const Co={buttonShare:"_buttonShare_i4e8j_1"};async function Ao(e){const t=So();if(!t)throw new Error("modalBuilderSteps not found");await t.sharing(window.FrakSetup?.modalShareConfig??{}).display(n=>({...n,targetInteraction:e}))}async function Io(){if(!window.FrakSetup?.client)throw new Error("Frak client not found");await sn(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function Po({text:e="Share and earn!",classname:t="",useReward:n,noRewardText:r,targetInteraction:o,showWallet:a}){const s=ne(()=>n!==void 0,[n]),l=ne(()=>a!==void 0,[a]),[c,_]=J(void 0),[v,d]=J(void 0),[w,f]=J(!1),[b,p]=J(!1),m=Fe(()=>{p(!0),s&&Fn(o).then(g=>{g&&d(`${g}€`)})},[s,o]);Ye(()=>(Ee("add",m),()=>Ee("remove",m)),[m]);const i=ne(()=>s?v?e.includes("{REWARD}")?e.replace("{REWARD}",v):`${e} ${v}`:r??e.replace("{REWARD}",""):e,[s,e,r,v]),h=Fe(async()=>{if(!window.FrakSetup?.client){console.error("Frak client not found"),_(Lt.empty().formatDebugInfo("Frak client not found")),f(!0);return}try{l?await Io():await Ao(o)}catch(g){if(g instanceof M&&g.code===N.clientAborted){console.debug("User aborted the modal");return}const C=window.FrakSetup.client.debugInfo.formatDebugInfo(g);_(C),f(!0),console.error("Error while opening the modal",g);return}},[l,o]);return O(Q,{children:[O("button",{type:"button",className:un(Co.buttonShare,t),onClick:h,children:[!b&&O(vn,{})," ",i]}),w&&O($o,{debugInfo:c})]})}const ee={errorContainer:{marginTop:"16px",padding:"16px",backgroundColor:"#FEE2E2",border:"1px solid #FCA5A5",borderRadius:"4px",color:"#991B1B"},header:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},title:{margin:0,fontSize:"16px",fontWeight:500},message:{fontSize:"14px",lineHeight:"1.5",margin:"0 0 12px 0"},link:{color:"#991B1B",textDecoration:"underline",textUnderlineOffset:"2px"},copyButton:{display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"10px",padding:"8px 12px",backgroundColor:"white",border:"1px solid #D1D5DB",borderRadius:"4px",color:"black",fontSize:"14px",fontWeight:500}};function $o({debugInfo:e}){const{copied:t,copy:n}=vo();return O("div",{style:ee.errorContainer,children:[O("div",{style:ee.header,children:O("h3",{style:ee.title,children:"Oups ! Nous avons rencontré un petit problème"})}),O("p",{style:ee.message,children:["Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à"," ",O("a",{href:"mailto:help@frak-labs.com?subject=Debug",style:ee.link,children:"help@frak-labs.com"})," ",O("br",{}),"Merci pour votre retour, nous traitons votre demande dans les plus brefs délais."]}),O("button",{type:"button",onClick:()=>n(e??""),style:ee.copyButton,children:t?"Informations copiées !":"Copier les informations de débogage"}),O(To,{debugInfo:e})]})}function To({debugInfo:e}){const[t,n]=J(!1);return O("div",{children:[O("button",{type:"button",style:ee.copyButton,onClick:()=>n(!t),children:"Ouvrir les informations"}),t&&O("textarea",{style:{display:"block",width:"100%",height:"200px",fontSize:"12px"},children:e})]})}function Oo(){customElements.get("frak-button-share")||on(Po,"frak-button-share",["text"],{shadow:!1})}function Ro(e,t){for(var n in t)e[n]=t[n];return e}function kn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Sn(e,t){this.props=e,this.context=t}(Sn.prototype=new V).isPureReactComponent=!0,Sn.prototype.shouldComponentUpdate=function(e,t){return kn(this.props,e)||kn(this.state,t)};var En=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),En&&En(e)};var Bo=I.__e;I.__e=function(e,t,n,r){if(e.then){for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Bo(e,t,n,r)};var Cn=I.unmount;function An(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ro({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return An(r,t,n)})),e}function In(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return In(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Qe(){this.__u=0,this.o=null,this.__b=null}function Pn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ce(){this.i=null,this.l=null}I.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Cn&&Cn(e)},(Qe.prototype=new V).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var o=Pn(r.__v),a=!1,s=function(){a||(a=!0,n.__R=null,o?o(l):l())};n.__R=s;var l=function(){if(!--r.__u){if(r.state.__a){var c=r.state.__a;r.__v.__k[0]=In(c,c.__c.__P,c.__c.__O)}var _;for(r.setState({__a:r.__b=null});_=r.o.pop();)_.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},Qe.prototype.componentWillUnmount=function(){this.o=[]},Qe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=An(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&z(Q,null,e.fallback);return o&&(o.__u&=-33),[z(Q,null,t.__a?null:e.children),o]};var $n=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ce.prototype=new V).__a=function(e){var t=this,n=Pn(t.__v),r=t.l.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),$n(t,e,r)):o()};n?n(a):a()}},Ce.prototype.render=function(e){this.i=null,this.l=new Map;var t=be(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ce.prototype.componentDidUpdate=Ce.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){$n(e,n,t)})};var Ho=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Mo=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,No=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Uo=/[A-Z0-9]/g,Lo=typeof document<"u",zo=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};V.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(V.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Tn=I.event;function Do(){}function jo(){return this.cancelBubble}function Vo(){return this.defaultPrevented}I.event=function(e){return Tn&&(e=Tn(e)),e.persist=Do,e.isPropagationStopped=jo,e.isDefaultPrevented=Vo,e.nativeEvent=e};var Wo={enumerable:!1,configurable:!0,get:function(){return this.class}},On=I.vnode;I.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={},a=r.indexOf("-")===-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||Lo&&s==="children"&&r==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||zo(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":No.test(s)&&(s=c):c=s="oninput":a&&Mo.test(s)?s=s.replace(Uo,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&o[s=c]&&(s="oninputCapture"),o[s]=l}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=be(n.children).forEach(function(_){_.props.selected=o.value.indexOf(_.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=be(n.children).forEach(function(_){_.props.selected=o.multiple?o.defaultValue.indexOf(_.props.value)!=-1:o.defaultValue==_.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",Wo)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=Ho,On&&On(e)};var Rn=I.__r;I.__r=function(e){Rn&&Rn(e),e.__c};var Bn=I.diffed;I.diffed=function(e){Bn&&Bn(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value)};const qo=e=>z("svg",{fill:"none",height:24,viewBox:"0 0 28 28",width:24,xmlns:"http://www.w3.org/2000/svg",...e},z("path",{d:"m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round"}));function Jo(){if(!window.FrakSetup?.client){console.error("Frak client not found");return}Eo(),sn(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function Ko({classname:e="",useReward:t,targetInteraction:n}){const r=ne(()=>t!==void 0,[t]),[o,a]=J(!0),[s,l]=J(void 0),c=mo(null),_=Fe(()=>{a(!1),r&&Fn(n).then(v=>{v&&l(`${v}€`)})},[r,n]);return Ye(()=>(Ee("add",_),()=>Ee("remove",_)),[_]),Ye(()=>{const v=window.FrakSetup.modalWalletConfig?.metadata?.position;c.current?.parentElement?.classList.add(v??"right")},[]),O("button",{ref:c,type:"button",class:e,disabled:o,onClick:Jo,children:[O(qo,{}),s&&O("span",{children:s})]})}function Go(){customElements.get("frak-button-wallet")||on(Ko,"frak-button-wallet",[],{shadow:!1})}Oo(),Go(),Wr(async function(){if(!window.FrakSetup?.config){console.error("window.FrakSetup.config not found");return}const t=await Vr({config:window.FrakSetup.config});if(!t){console.error("Failed to create Frak client");return}window.FrakSetup.client=t,xo(),Fo(t),ko(t)})});
|
|
1
|
+
import("https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/loader.js");
|
package/cdn/loader.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,t,r={},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return r[e].call(i.exports,i,i.exports,o),i.exports}o.m=r,o.d=function(e,t){for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.f={},o.e=function(e){return Promise.all(Object.keys(o.f).reduce(function(t,r){return o.f[r](e,t),t},[]))},o.u=function(e){return""+(({438:"button-wallet",766:"button-share"})[e]||e)+".js"},o.miniCssF=function(e){return""+({438:"button-wallet",766:"button-share"})[e]+".css"},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if("undefined"!=typeof document){var e=function(e,t,r,n,i){var a=document.createElement("link");return a.rel="stylesheet",a.type="text/css",o.nc&&(a.nonce=o.nc),a.onerror=a.onload=function(r){if(a.onerror=a.onload=null,"load"===r.type)n();else{var o=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.href||t,s=Error("Loading CSS chunk "+e+" failed.\\n("+u+")");s.code="CSS_CHUNK_LOAD_FAILED",s.type=o,s.request=u,a.parentNode&&a.parentNode.removeChild(a),i(s)}},a.href=t,r?r.parentNode.insertBefore(a,r.nextSibling):document.head.appendChild(a),a},t=function(e,t){for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=r[n],i=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(i===e||i===t))return o}for(var a=document.getElementsByTagName("style"),n=0;n<a.length;n++){var o=a[n],i=o.getAttribute("data-href");if(i===e||i===t)return o}},r={276:0};o.f.miniCss=function(n,i){if(r[n])i.push(r[n]);else if(0!==r[n]&&({438:1,766:1})[n])i.push(r[n]=new Promise(function(r,i){var a=o.miniCssF(n),u=o.p+a;if(t(a,u))return r();e(n,u,null,r,i)}).then(function(){r[n]=0},function(e){throw delete r[n],e}))}}})(),e={276:0},t=function(t){var r,n,i=t.ids,a=t.modules,u=t.runtime,s=0;for(r in a)o.o(a,r)&&(o.m[r]=a[r]);for(u&&u(o);s<i.length;s++)n=i[s],o.o(e,n)&&e[n]&&e[n][0](),e[i[s]]=0},o.f.j=function(r,n){var i=o.o(e,r)?e[r]:void 0;if(0!==i){if(i)n.push(i[1]);else{var a=import("./"+o.u(r)).then(t,function(t){throw 0!==e[r]&&(e[r]=void 0),t}),a=Promise.race([a,new Promise(function(t){i=e[r]=[t]})]);n.push(i[1]=a)}}};const i={"button-share":()=>Promise.all([o.e("413"),o.e("364"),o.e("766")]).then(o.bind(o,"./src/components/ButtonShare/index.ts")),"button-wallet":()=>Promise.all([o.e("413"),o.e("364"),o.e("438")]).then(o.bind(o,"./src/components/ButtonWallet/index.ts"))},a=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&u(e)});async function u(e){let t=e instanceof Element?e.tagName.toLowerCase():"",r=t?.startsWith("frak-"),n=Array.from(e.querySelectorAll(":not(:defined)")).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith("frak-"));r&&!customElements.get(t)&&n.push(t);let o=[...new Set(n)];await Promise.allSettled(o.map(e=>s(e)))}async function s(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,"");if(!(t in i))throw Error(`Component ${e} is not supported.`);await i[t]()}catch(e){console.error(e)}}u(document.body),a.observe(document.documentElement,{subtree:!0,childList:!0});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spinner-KHk8mw{--spinner-opacity:.65;opacity:var(--spinner-opacity);width:16px;height:16px;display:block;position:relative}.spinner__leaf-xtOJmT{--spinner-animation-duration:.8s;width:12.5%;height:100%;animation:rt-spinner-leaf-fade-OXYBVY var(--spinner-animation-duration)linear infinite;position:absolute;top:0;left:43.75%}.spinner__leaf-xtOJmT:before{content:"";background-color:currentColor;border-radius:3px;width:100%;height:30%;display:block}.spinner__leaf-xtOJmT:where(:first-child){animation-delay:calc(-8/8*var(--spinner-animation-duration));transform:rotate(0)}.spinner__leaf-xtOJmT:where(:nth-child(2)){animation-delay:calc(-7/8*var(--spinner-animation-duration));transform:rotate(45deg)}.spinner__leaf-xtOJmT:where(:nth-child(3)){animation-delay:calc(-6/8*var(--spinner-animation-duration));transform:rotate(90deg)}.spinner__leaf-xtOJmT:where(:nth-child(4)){animation-delay:calc(-5/8*var(--spinner-animation-duration));transform:rotate(135deg)}.spinner__leaf-xtOJmT:where(:nth-child(5)){animation-delay:calc(-4/8*var(--spinner-animation-duration));transform:rotate(180deg)}.spinner__leaf-xtOJmT:where(:nth-child(6)){animation-delay:calc(-3/8*var(--spinner-animation-duration));transform:rotate(225deg)}.spinner__leaf-xtOJmT:where(:nth-child(7)){animation-delay:calc(-2/8*var(--spinner-animation-duration));transform:rotate(270deg)}.spinner__leaf-xtOJmT:where(:nth-child(8)){animation-delay:calc(-1/8*var(--spinner-animation-duration));transform:rotate(315deg)}@keyframes rt-spinner-leaf-fade-OXYBVY{0%{opacity:1}to{opacity:.25}}.buttonShare-F23Y9m{justify-content:center;align-items:center;gap:10px;display:flex}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { FullInteractionTypesKey } from '@frak-labs/core-sdk';
|
|
2
|
+
import { JSX } from 'preact';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Button to share the current page
|
|
6
|
+
*
|
|
7
|
+
* @param args
|
|
8
|
+
* @returns The share button with `<button>` tag
|
|
9
|
+
*
|
|
10
|
+
* @group components
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Basic usage:
|
|
14
|
+
* ```html
|
|
15
|
+
* <frak-button-share></frak-button-share>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Using a custom text:
|
|
20
|
+
* ```html
|
|
21
|
+
* <frak-button-share text="Share and earn!"></frak-button-share>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* Using a custom class:
|
|
26
|
+
* ```html
|
|
27
|
+
* <frak-button-share classname="button button-primary"></frak-button-share>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Using reward information and fallback text:
|
|
32
|
+
* ```html
|
|
33
|
+
* <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!"></frak-button-share>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* Using reward information for specific reward and fallback text:
|
|
38
|
+
* ```html
|
|
39
|
+
* <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="retail.customerMeeting"></frak-button-share>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @see {@link @frak-labs/core-sdk!actions.modalBuilder | `modalBuilder()`} for more info about the modal display
|
|
43
|
+
* @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the estimated reward fetching
|
|
44
|
+
*/
|
|
45
|
+
export declare function ButtonShare({ text, classname, useReward: rawUseReward, noRewardText, targetInteraction, showWallet: rawShowWallet, }: ButtonShareProps): JSX.Element;
|
|
46
|
+
|
|
47
|
+
export declare interface ButtonShareElement extends HTMLElement, ButtonShareProps {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The props type for {@link ButtonShare}.
|
|
52
|
+
* @inline
|
|
53
|
+
*/
|
|
54
|
+
declare type ButtonShareProps = {
|
|
55
|
+
/**
|
|
56
|
+
* Text to display on the button
|
|
57
|
+
* - To specify where the reward should be displayed, use the placeholder `{REWARD}`, e.g. `Share and earn up to {REWARD}!`
|
|
58
|
+
* @defaultValue `"Share and earn!"`
|
|
59
|
+
*/
|
|
60
|
+
text?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Classname to apply to the button
|
|
63
|
+
*/
|
|
64
|
+
classname?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Do we display the reward on the share modal?
|
|
67
|
+
* @defaultValue `false`
|
|
68
|
+
*/
|
|
69
|
+
useReward?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Fallback text if the reward isn't found
|
|
72
|
+
*/
|
|
73
|
+
noRewardText?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Target interaction behind this sharing action (will be used to get the right reward to display)
|
|
76
|
+
*/
|
|
77
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
78
|
+
/**
|
|
79
|
+
* Do we display the wallet modal instead of the share modal?
|
|
80
|
+
* @defaultValue `false`
|
|
81
|
+
*/
|
|
82
|
+
showWallet?: boolean;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"preact-custom-element";import*as t from"@frak-labs/core-sdk";import*as n from"@frak-labs/core-sdk/actions";import*as r from"preact/jsx-runtime";import*as o from"preact/hooks";let a="frakClientReady";function i(e,t){if(window.FrakSetup?.client&&"add"===e){t();return}("add"===e?window.addEventListener:window.removeEventListener)(a,t,!1)}async function s(e){if(!window.modalBuilderSteps){console.error("modalBuilderSteps not found");return}console.log("referral",await (0,n.referralInteraction)(e,{modalConfig:window.modalBuilderSteps.reward().params}))}async function l(){if(!(window.frakSetupInProgress?(console.log("[Frak SDK] Initialization already in progress"),!1):window.FrakSetup?.client?(console.log("[Frak SDK] Client already initialized"),!1):!!window.FrakSetup?.config||(console.error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set."),!1)))return;console.log("[Frak SDK] Starting initialization"),window.frakSetupInProgress=!0;let e=await (0,t.setupClient)({config:{...window.FrakSetup.config,metadata:{name:"Frak SDK"}}});if(!e){console.error("[Frak SDK] Failed to create client"),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log("[Frak SDK] Client initialized successfully"),function(){let e=new CustomEvent(a);window.dispatchEvent(e)}(),window.modalBuilderSteps=(0,n.modalBuilder)(e,window.FrakSetup?.modalConfig??{}),s(e),window.frakSetupInProgress=!1}let d=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=function e(t){var n,r,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t){if(Array.isArray(t)){var a=t.length;for(n=0;n<a;n++)t[n]&&(r=e(t[n]))&&(o&&(o+=" "),o+=r)}else for(r in t)t[r]&&(o&&(o+=" "),o+=r)}return o}(e))&&(r&&(r+=" "),r+=t);return r},c="spinner__leaf-xtOJmT",u=({ref:e,className:t,...n})=>(0,r.jsxs)("span",{...n,ref:e,className:d("spinner-KHk8mw"),children:[(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c}),(0,r.jsx)("span",{className:c})]});async function p(e){let t=window.FrakSetup?.client;if(!t){console.warn("Frak client not ready yet");return}let r=await (0,n.getProductInformation)(t);if(!r?.estimatedEurReward)return;let o=r.estimatedEurReward;if(e){let t=r.rewards.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer.eurAmount).reduce((e,t)=>t>e?t:e,0);t>0&&(o=Math.ceil(t).toString())}return o}u.displayName="Spinner";let f={marginTop:"16px",padding:"16px",backgroundColor:"#FEE2E2",border:"1px solid #FCA5A5",borderRadius:"4px",color:"#991B1B"},m={display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},w={margin:0,fontSize:"16px",fontWeight:500},g={fontSize:"14px",lineHeight:"1.5",margin:"0 0 12px 0"},x={color:"#991B1B",textDecoration:"underline",textUnderlineOffset:"2px"},y={display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"10px",padding:"8px 12px",backgroundColor:"white",border:"1px solid #D1D5DB",borderRadius:"4px",color:"black",fontSize:"14px",fontWeight:500};function S({debugInfo:e}){let[t,n]=(0,o.useState)(!1);return(0,r.jsxs)("div",{children:[(0,r.jsx)("button",{type:"button",style:y,onClick:()=>n(!t),children:"Ouvrir les informations"}),t&&(0,r.jsx)("textarea",{style:{display:"block",width:"100%",height:"200px",fontSize:"12px"},children:e})]})}function h({debugInfo:e}){let{copied:t,copy:n}=function(e={}){let{successDuration:t=2e3}=e,[n,r]=(0,o.useState)(!1);return{copy:(0,o.useCallback)(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy"),r(!0)}catch(e){return console.error("Failed to copy text:",e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error("Failed to copy text:",e),!1}},[t]),copied:n}}();return(0,r.jsxs)("div",{style:f,children:[(0,r.jsx)("div",{style:m,children:(0,r.jsx)("h3",{style:w,children:"Oups ! Nous avons rencontr\xe9 un petit probl\xe8me"})}),(0,r.jsxs)("p",{style:g,children:["Impossible d'ouvrir le menu de partage pour le moment. Si le probl\xe8me persiste, copiez les informations ci-dessous et collez-les dans votre mail \xe0"," ",(0,r.jsx)("a",{href:"mailto:help@frak-labs.com?subject=Debug",style:x,children:"help@frak-labs.com"})," ",(0,r.jsx)("br",{}),"Merci pour votre retour, nous traitons votre demande dans les plus brefs d\xe9lais."]}),(0,r.jsx)("button",{type:"button",onClick:()=>n(e??""),style:y,children:t?"Informations copi\xe9es !":"Copier les informations de d\xe9bogage"}),(0,r.jsx)(S,{debugInfo:e})]})}async function k(){if(!window.FrakSetup?.client)throw Error("Frak client not found");await (0,n.displayEmbededWallet)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function b({text:e="Share and earn!",classname:n="",useReward:a,noRewardText:s,targetInteraction:l,showWallet:c}){let f=(0,o.useMemo)(()=>void 0!==a,[a]),m=(0,o.useMemo)(()=>void 0!==c,[c]),{isClientReady:w}=function(){let[e,t]=(0,o.useState)(!0),n=(0,o.useCallback)(()=>{t(!1)},[]);return(0,o.useEffect)(()=>(i("add",n),()=>i("remove",n)),[n]),{isClientReady:!e}}(),{reward:g}=function(e,t){let[n,r]=(0,o.useState)(void 0);return(0,o.useEffect)(()=>{e&&p(t).then(e=>{e&&r(`${e}€`)})},[e,t]),{reward:n}}(f&&w,l),{handleShare:x,isError:y,debugInfo:S}=function(e){let[n,r]=(0,o.useState)(void 0),[a,i]=(0,o.useState)(!1);return{handleShare:(0,o.useCallback)(async()=>{if(!window.FrakSetup?.client){console.error("Frak client not found"),r(t.DebugInfoGatherer.empty().formatDebugInfo("Frak client not found")),i(!0);return}let n=function(){if(!window.modalBuilderSteps)throw Error("modalBuilderSteps not found");return window.modalBuilderSteps}();if(!n)throw Error("modalBuilderSteps not found");try{await n.sharing(window.FrakSetup?.modalShareConfig??{}).display(t=>({...t,targetInteraction:e}))}catch(e){if(e instanceof t.FrakRpcError&&e.code===t.RpcErrorCodes.clientAborted){console.debug("User aborted the modal");return}r(window.FrakSetup.client.debugInfo.formatDebugInfo(e)),i(!0),console.error("Error while opening the modal",e)}},[e]),isError:a,debugInfo:n}}(l),b=(0,o.useMemo)(()=>f?g?e.includes("{REWARD}")?e.replace("{REWARD}",g):`${e} ${g}`:s??e.replace("{REWARD}",""):e,[f,e,s,g]),F=(0,o.useCallback)(async()=>await (m?k():x()),[m,x]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",className:d("buttonShare-F23Y9m",n),onClick:F,children:[!w&&(0,r.jsx)(u,{})," ",b]}),y&&(0,r.jsx)(h,{debugInfo:S})]})}!function(t,n,r=[],o={shadow:!1}){if("undefined"!=typeof window){var a;a=async function(){await l()},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(a,1):document.addEventListener?document.addEventListener("DOMContentLoaded",a):document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&a()}),customElements.get(n)||(0,e.default)(t,n,r,o)}}(b,"frak-button-share",["text"],{shadow:!1});export{b as ButtonShare};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
frak-button-wallet{z-index:2000000;position:fixed;bottom:20px}frak-button-wallet.left{left:20px}frak-button-wallet.right{right:20px}frak-button-wallet button,frak-button-wallet [type=button]{all:unset;cursor:pointer;text-align:center;background-color:#3e557e;border-radius:50%;justify-content:center;align-items:center;width:45px;height:45px;display:flex;position:relative}frak-button-wallet span{color:#fff;white-space:nowrap;background:#ff3f3f;border-radius:5px;padding:2px 3px;font-size:9px;font-weight:600;line-height:9px;position:absolute;top:-4px;right:27px}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { FullInteractionTypesKey } from '@frak-labs/core-sdk';
|
|
2
|
+
import { JSX } from 'preact';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Button to open wallet modal
|
|
6
|
+
*
|
|
7
|
+
* @param args
|
|
8
|
+
* @returns The wallet button with `<button>` tag
|
|
9
|
+
*
|
|
10
|
+
* @group components
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Basic usage:
|
|
14
|
+
* ```html
|
|
15
|
+
* <frak-button-wallet></frak-button-wallet>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Using a custom class:
|
|
20
|
+
* ```html
|
|
21
|
+
* <frak-button-wallet classname="button button-primary"></frak-button-wallet>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* Using reward information:
|
|
26
|
+
* ```html
|
|
27
|
+
* <frak-button-wallet use-reward></frak-button-wallet>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Using reward information for specific reward:
|
|
32
|
+
* ```html
|
|
33
|
+
* <frak-button-wallet use-reward target-interaction="retail.customerMeeting"></frak-button-wallet>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see {@link @frak-labs/core-sdk!actions.modalBuilder | `modalBuilder()`} for more info about the modal display
|
|
37
|
+
* @see {@link @frak-labs/core-sdk!actions.getProductInformation | `getProductInformation()`} for more info about the estimated reward fetching
|
|
38
|
+
*/
|
|
39
|
+
export declare function ButtonWallet({ classname, useReward: rawUseReward, targetInteraction, }: ButtonWalletProps): JSX.Element;
|
|
40
|
+
|
|
41
|
+
export declare interface ButtonWalletElement extends HTMLElement, ButtonWalletProps {
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The props type for {@link ButtonWallet}.
|
|
46
|
+
* @inline
|
|
47
|
+
*/
|
|
48
|
+
declare type ButtonWalletProps = {
|
|
49
|
+
/**
|
|
50
|
+
* Classname to apply to the button
|
|
51
|
+
*/
|
|
52
|
+
classname?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Do we display the reward on the button?
|
|
55
|
+
* @defaultValue `false`
|
|
56
|
+
*/
|
|
57
|
+
useReward?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Target interaction behind this sharing action (will be used to get the right reward to display)
|
|
60
|
+
*/
|
|
61
|
+
targetInteraction?: FullInteractionTypesKey;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"preact-custom-element";import*as t from"@frak-labs/core-sdk";import*as n from"@frak-labs/core-sdk/actions";import*as o from"preact/jsx-runtime";import*as r from"preact/hooks";import*as i from"preact";let a="frakClientReady";function l(e,t){if(window.FrakSetup?.client&&"add"===e){t();return}("add"===e?window.addEventListener:window.removeEventListener)(a,t,!1)}async function u(e){if(!window.modalBuilderSteps){console.error("modalBuilderSteps not found");return}console.log("referral",await (0,n.referralInteraction)(e,{modalConfig:window.modalBuilderSteps.reward().params}))}async function s(){if(!(window.frakSetupInProgress?(console.log("[Frak SDK] Initialization already in progress"),!1):window.FrakSetup?.client?(console.log("[Frak SDK] Client already initialized"),!1):!!window.FrakSetup?.config||(console.error("[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set."),!1)))return;console.log("[Frak SDK] Starting initialization"),window.frakSetupInProgress=!0;let e=await (0,t.setupClient)({config:{...window.FrakSetup.config,metadata:{name:"Frak SDK"}}});if(!e){console.error("[Frak SDK] Failed to create client"),window.frakSetupInProgress=!1;return}window.FrakSetup.client=e,console.log("[Frak SDK] Client initialized successfully"),function(){let e=new CustomEvent(a);window.dispatchEvent(e)}(),window.modalBuilderSteps=(0,n.modalBuilder)(e,window.FrakSetup?.modalConfig??{}),u(e),window.frakSetupInProgress=!1}async function c(e){let t=window.FrakSetup?.client;if(!t){console.warn("Frak client not ready yet");return}let o=await (0,n.getProductInformation)(t);if(!o?.estimatedEurReward)return;let r=o.estimatedEurReward;if(e){let t=o.rewards.filter(t=>t.interactionTypeKey===e).map(e=>e.referrer.eurAmount).reduce((e,t)=>t>e?t:e,0);t>0&&(r=Math.ceil(t).toString())}return r}function _(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function f(e,t){this.props=e,this.context=t}(f.prototype=new i.Component).isPureReactComponent=!0,f.prototype.shouldComponentUpdate=function(e,t){return _(this.props,e)||_(this.state,t)};var p=i.options.__b;i.options.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),p&&p(e)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var d=i.options.__e;i.options.__e=function(e,t,n,o){if(e.then){for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t)}d(e,t,n,o)};var m=i.options.unmount;function v(){this.__u=0,this.o=null,this.__b=null}function h(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function w(){this.i=null,this.l=null}i.options.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),m&&m(e)},(v.prototype=new i.Component).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=h(o.__v),i=!1,a=function(){i||(i=!0,n.__R=null,r?r(l):l())};n.__R=a;var l=function(){if(!--o.__u){if(o.state.__a){var e,t=o.state.__a;o.__v.__k[0]=function e(t,n,o){return t&&o&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)}),t.__c&&t.__c.__P===n&&(t.__e&&o.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=o)),t}(t,t.__c.__P,t.__c.__O)}for(o.setState({__a:o.__b=null});e=o.o.pop();)e.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(a,a)},v.prototype.componentWillUnmount=function(){this.o=[]},v.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,o){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),t.__c.__H=null),null!=(t=function(e,t){for(var n in t)e[n]=t[n];return e}({},t)).__c&&(t.__c.__P===o&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map(function(t){return e(t,n,o)})),t}(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&(0,i.createElement)(i.Fragment,null,e.fallback);return r&&(r.__u&=-33),[(0,i.createElement)(i.Fragment,null,t.__a?null:e.children),r]};var y=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(w.prototype=new i.Component).__a=function(e){var t=this,n=h(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),y(t,e,o)):r()};n?n(i):i()}},w.prototype.render=function(e){this.i=null,this.l=new Map;var t=(0,i.toChildArray)(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},w.prototype.componentDidUpdate=w.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){y(e,n,t)})};var k="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,g=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,S=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,b=/[A-Z0-9]/g,C="undefined"!=typeof document;i.Component.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(i.Component.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var E=i.options.event;function F(){}function P(){return this.cancelBubble}function x(){return this.defaultPrevented}i.options.event=function(e){return E&&(e=E(e)),e.persist=F,e.isPropagationStopped=P,e.isDefaultPrevented=x,e.nativeEvent=e};var O={enumerable:!1,configurable:!0,get:function(){return this.class}},R=i.options.vnode;i.options.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1===n.indexOf("-");for(var a in t){var l=t[a];if(!("value"===a&&"defaultValue"in t&&null==l||C&&"children"===a&&"noscript"===n||"class"===a||"className"===a)){var u,s=a.toLowerCase();"defaultValue"===a&&"value"in t&&null==t.value?a="value":"download"===a&&!0===l?l="":"translate"===s&&"no"===l?l=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?a="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||(u=t.type,("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(u))?"onfocus"===s?a="onfocusin":"onblur"===s?a="onfocusout":S.test(a)&&(a=s):s=a="oninput":r&&g.test(a)?a=a.replace(b,"-$&").toLowerCase():null===l&&(l=void 0),"oninput"===s&&o[a=s]&&(a="oninputCapture"),o[a]=l}}"select"==n&&o.multiple&&Array.isArray(o.value)&&(o.value=(0,i.toChildArray)(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),"select"==n&&null!=o.defaultValue&&(o.value=(0,i.toChildArray)(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value})),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",O)):(t.className&&!t.class||t.class&&t.className)&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=k,R&&R(e)};var D=i.options.__r;i.options.__r=function(e){D&&D(e),e.__c};var L=i.options.diffed;i.options.diffed=function(e){L&&L(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};let j=e=>(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 28 28",...e,children:(0,o.jsx)("path",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",d:"M23.143 14v11.428H4.857V14M14 25.428V8.286m0 0H8.857a2.857 2.857 0 0 1 0-5.715c4 0 5.143 5.715 5.143 5.715m0 0h5.143a2.857 2.857 0 1 0 0-5.715c-4 0-5.143 5.715-5.143 5.715m-11.429 0h22.857V14H2.571z"})});function A(){if(!window.FrakSetup?.client){console.error("Frak client not found");return}"vibrate"in navigator?navigator.vibrate(10):console.log("Vibration not supported"),(0,n.displayEmbededWallet)(window.FrakSetup.client,window.FrakSetup?.modalWalletConfig??{})}function B({classname:e="",useReward:t,targetInteraction:n}){let i=(0,r.useMemo)(()=>void 0!==t,[t]),a=(0,r.useRef)(null),{isClientReady:u}=function(){let[e,t]=(0,r.useState)(!0),n=(0,r.useCallback)(()=>{t(!1)},[]);return(0,r.useEffect)(()=>(l("add",n),()=>l("remove",n)),[n]),{isClientReady:!e}}(),{reward:s}=function(e,t){let[n,o]=(0,r.useState)(void 0);return(0,r.useEffect)(()=>{e&&c(t).then(e=>{e&&o(`${e}€`)})},[e,t]),{reward:n}}(i&&u,n);return(0,r.useEffect)(()=>{let e=window.FrakSetup?.modalWalletConfig?.metadata?.position;a.current?.parentElement?.classList.add(e??"right")},[]),(0,o.jsxs)("button",{ref:a,type:"button",class:e,disabled:!u,onClick:A,children:[(0,o.jsx)(j,{}),s&&(0,o.jsx)("span",{children:s})]})}!function(t,n,o=[],r={shadow:!1}){if("undefined"!=typeof window){var i;i=async function(){await s()},"complete"===document.readyState||"interactive"===document.readyState?setTimeout(i,1):document.addEventListener?document.addEventListener("DOMContentLoaded",i):document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&i()}),customElements.get(n)||(0,e.default)(t,n,o,r)}}(B,"frak-button-wallet",[],{shadow:!1});export{B as ButtonWallet};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.
|
|
14
|
+
"version": "0.0.11",
|
|
15
15
|
"description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"type": "module",
|
|
37
37
|
"files": [
|
|
38
|
-
"/cdn"
|
|
38
|
+
"/cdn",
|
|
39
|
+
"/dist"
|
|
39
40
|
],
|
|
40
41
|
"main": "./cdn/components.js",
|
|
41
42
|
"browser": "./cdn/components.js",
|
|
@@ -43,29 +44,26 @@
|
|
|
43
44
|
"lint": "biome lint .",
|
|
44
45
|
"format:check": "biome check .",
|
|
45
46
|
"format": "biome check --write .",
|
|
46
|
-
"clean": "rimraf cdn",
|
|
47
|
-
"build": "
|
|
48
|
-
"build:watch": "
|
|
47
|
+
"clean": "rimraf cdn dist",
|
|
48
|
+
"build": "rslib build",
|
|
49
|
+
"build:watch": "rslib build --watch",
|
|
49
50
|
"typecheck": "tsc --noEmit",
|
|
50
51
|
"prepublish": "bun run lint && bun run build",
|
|
51
52
|
"publish": "echo 'Publishing components...'"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@frak-labs/core-sdk": "0.0.7",
|
|
55
|
-
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
56
56
|
"preact": "^10.25.4",
|
|
57
57
|
"preact-custom-element": "^4.3.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@
|
|
60
|
+
"@rsbuild/plugin-preact": "^1.3.1",
|
|
61
|
+
"@rsbuild/plugin-svgr": "^1.0.7",
|
|
62
|
+
"@rslib/core": "^0.5.2",
|
|
61
63
|
"@types/node": "^22",
|
|
62
64
|
"@types/preact-custom-element": "^4.0.4",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"typescript": "^5",
|
|
66
|
-
"vite": "^6.1.0",
|
|
67
|
-
"vite-plugin-svgr": "^4.3.0",
|
|
68
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
65
|
+
"ts-checker-rspack-plugin": "^1.1.1",
|
|
66
|
+
"typescript": "^5"
|
|
69
67
|
},
|
|
70
68
|
"browserslist": [
|
|
71
69
|
"extends @frak-labs/browserslist-config"
|
package/cdn/components.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._spinner_1gez9_1{--spinner-opacity: .65;display:block;position:relative;opacity:var(--spinner-opacity);width:16px;height:16px}._spinner__leaf_1gez9_10{--spinner-animation-duration: .8s;position:absolute;top:0;left:43.75%;width:12.5%;height:100%;animation:_rt-spinner-leaf-fade_1gez9_1 var(--spinner-animation-duration) linear infinite}._spinner__leaf_1gez9_10:before{content:"";display:block;width:100%;height:30%;border-radius:3px;background-color:currentColor}._spinner__leaf_1gez9_10:where(:nth-child(1)){transform:rotate(0);animation-delay:calc(-8 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(2)){transform:rotate(45deg);animation-delay:calc(-7 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(3)){transform:rotate(90deg);animation-delay:calc(-6 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(4)){transform:rotate(135deg);animation-delay:calc(-5 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(5)){transform:rotate(180deg);animation-delay:calc(-4 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(6)){transform:rotate(225deg);animation-delay:calc(-3 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(7)){transform:rotate(270deg);animation-delay:calc(-2 / 8 * var(--spinner-animation-duration))}._spinner__leaf_1gez9_10:where(:nth-child(8)){transform:rotate(315deg);animation-delay:calc(-1 / 8 * var(--spinner-animation-duration))}@keyframes _rt-spinner-leaf-fade_1gez9_1{0%{opacity:1}to{opacity:.25}}._buttonShare_i4e8j_1{display:flex;align-items:center;justify-content:center;gap:10px}frak-button-wallet{position:fixed;bottom:20px;z-index:2000000}frak-button-wallet.left{left:20px}frak-button-wallet.right{right:20px}frak-button-wallet button,frak-button-wallet [type=button]{all:unset;display:flex;justify-content:center;align-items:center;position:relative;background-color:#3e557e;width:45px;height:45px;border-radius:50%;cursor:pointer;text-align:center}frak-button-wallet span{position:absolute;top:-4px;right:27px;padding:2px 3px;border-radius:5px;background:#ff3f3f;font-size:9px;color:#fff;font-weight:600;white-space:nowrap;line-height:9px}
|