@tonconnect/ui 2.0.1 → 2.0.2-beta.0

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.
@@ -554,7 +554,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
554
554
  `,Ca=e=>Tt(pa,{header:{translationKey:"notifications.transactionSent.header"},text:{translationKey:"notifications.transactionSent.text"},get icon(){return Tt(ba,{})},get class(){return e.class},"data-tc-notification-tx-sent":"true",children:"Transaction sent"}),xa=Sn`
555
555
  transform: translateY(-8px);
556
556
  margin-bottom: 12px;
557
- `,_a={timeout:4500},[Sa,ka]=Xe(null);function Ea(e){const{timeout:t}=__spreadValues(__spreadValues({},_a),e),[n,r]=Xe([]),[o,i]=Xe([]);return nt(function(e,t,n){const r=Array.isArray(e);let o,i=n&&n.defer;return n=>{let s;if(r){s=Array(e.length);for(let t=0;t<e.length;t++)s[t]=e[t]()}else s=e();if(i)return void(i=!1);const a=st((()=>t(s,o,n)));return o=s,a}}(pr,(e=>{if(!e||!e.showNotification)return;if(Sa()===e)return;ka(e),r((e=>e.filter((e=>"confirm-transaction"!==e.action))));const n={action:e.name};r((e=>[...e,n]));const o=setTimeout((()=>{r((e=>e.filter((e=>e!==n)))),i((e=>e.filter((e=>e!==o))))}),t);i((e=>[...e,o]))}))),at((()=>{o().forEach((e=>clearTimeout(e)))})),n}const Ra=Zt('<div data-tc-list-notifications="true"></div>'),La=Tn(xo)`
557
+ `,_a={timeout:4500},[Sa,ka]=Xe(null);function Ea(e){const{timeout:t}=__spreadValues(__spreadValues({},_a),e),[n,r]=Xe([]),[o,i]=Xe([]);return nt(function(e,t,n){const r=Array.isArray(e);let o,i=n&&n.defer;return n=>{let s;if(r){s=Array(e.length);for(let t=0;t<e.length;t++)s[t]=e[t]()}else s=e();if(i)return void(i=!1);const a=st((()=>t(s,o,n)));return o=s,a}}(pr,(e=>{var n;if(!e||!e.showNotification)return;if(Sa()===e)return;if("confirm-transaction"===(null==(n=Sa())?void 0:n.name)&&"confirm-transaction"===e.name)return;ka(e),r((e=>e.filter((e=>"confirm-transaction"!==e.action))));const o={action:e.name};r((e=>[...e,o]));const s=setTimeout((()=>{r((e=>e.filter((e=>e!==o)))),i((e=>e.filter((e=>e!==s))))}),t);i((e=>[...e,s]))}))),at((()=>{o().forEach((e=>clearTimeout(e)))})),n}const Ra=Zt('<div data-tc-list-notifications="true"></div>'),La=Tn(xo)`
558
558
  background-color: ${e=>e.theme.colors.connectButton.background};
559
559
  color: ${e=>e.theme.colors.connectButton.foreground};
560
560
  box-shadow: ${e=>`0 4px 24px ${Nn(e.theme.colors.constant.black,.16)}`};
@@ -732,7 +732,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
732
732
  width: 32px;
733
733
  height: 32px;
734
734
  border-radius: ${e=>jl[e.theme.borderRadius]};
735
- `,ec=e=>{const[t]=xi();return rt((()=>{var n;return t(e.translationKey,e.translationValues,null==(n=e.children)?void 0:n.toString())}))};function tc(e,t){let n;n="string"==typeof t?t:so()?t.twaReturnUrl||t.returnStrategy:"none";const r=function(e,t,n){const r=new URL(e);return r.searchParams.append(t,n),r.toString()}(e,"ret",n);if(!re(e))return r;const o=r.slice(r.lastIndexOf("&")+1);return r.slice(0,r.lastIndexOf("&"))+"-"+oe(o)}function nc(e,t){t=__spreadValues({},t);const n=function(e){const t=new URL(e);t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start");return t.toString()}(e),r=new URL(n);if(r.searchParams.has("startapp")||r.searchParams.append("startapp","tonconnect"),so())io("ios","android")?(t.returnStrategy="back",t.twaReturnUrl=void 0,lo(tc(r.toString(),t))):io("macos","tdesktop")||io("weba")?lo(tc(r.toString(),t)):io("web")?(t.returnStrategy="back",t.twaReturnUrl=void 0,lo(tc(r.toString(),t))):Vn(tc(r.toString(),t));else if(Jn("ios")){"back"===t.returnStrategy&&(t.returnStrategy=location.href);const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("android")){t.returnStrategy="none";const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("ipad")){"back"===t.returnStrategy&&(t.returnStrategy="back");const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("macos","windows","linux"))if(t.returnStrategy="none",t.twaReturnUrl=void 0,t.forceRedirect)Vn(tc(r.toString(),t));else{const e=tc(r.toString(),t);qn(oc(e),(()=>Vn(e)))}else Vn(tc(r.toString(),t))}function rc(e,t,n,r){if(n=__spreadValues({},n),so())if(io("ios","android")){"back"===n.returnStrategy&&(n.returnStrategy="tg://resolve"),r("universal-link");const t=tc(e,n.returnStrategy);lo(t,(()=>{r("universal-link"),Vn(t)}))}else if(io("macos","tdesktop")){"back"===n.returnStrategy&&(n.returnStrategy="tg://resolve");const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else if(io("weba")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy=location.href:Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href);const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else if(io("web")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy=location.href:Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href);const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else{r("universal-link");Vn(tc(e,n.returnStrategy))}else if(Jn("ios"))"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy=location.href:Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href),Xn("chrome")?(r("universal-link"),Fn(tc(e,n.returnStrategy),"_self")):(r("universal-link"),Vn(tc(e,n.returnStrategy)));else if(Jn("android"))"back"===n.returnStrategy&&(Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href),r("universal-link"),Vn(tc(e,n.returnStrategy));else if(Jn("ipad"))"back"===n.returnStrategy&&(n.returnStrategy="back"),Xn("chrome")?(r("universal-link"),Fn(tc(e,n.returnStrategy),"_self")):(r("universal-link"),Vn(tc(e,n.returnStrategy)));else if(Jn("macos","windows","linux")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy="none":Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy="none");const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else r("universal-link"),Vn(tc(e,n.returnStrategy))}function oc(e){const t=new URL(e),[,n,r]=t.pathname.split("/");return`tg://resolve?domain=${n}&appname=${r}&startapp=${t.searchParams.get("startapp")}`}const ic=e=>{const[t,n]=Xe("mobile"),[r,o]=Xe(!1),[i,s]=Xe(),[a,l]=Xe(!0),c=ut(br);at(c.onStatusChange((()=>{}),(()=>{e.wallet.appName!==js&&o(!0)})));const u=()=>{s(c.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest))};nt((()=>{"extension"!==st(t)&&(Ll(e.wallet)||Rl(e.wallet))&&u()}));const d=()=>{o(!1),"extension"===t()&&u(),n("mobile"),gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:"qrcode"}))},h=()=>{o(!1),"extension"===t()&&u(),n("desktop");const r=!a();l(!1),rc(i(),e.wallet.deepLink,{returnStrategy:_l.returnStrategy,forceRedirect:r},(t=>{gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:t}))}))},f=()=>{const t=!a();l(!1),gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:"universal-link"})),nc(i(),{returnStrategy:_l.returnStrategy,twaReturnUrl:_l.twaReturnUrl,forceRedirect:t})},g=()=>{o(!1),n("extension"),xe(e.wallet)&&(gr(e.wallet),c.connect({jsBridgeKey:e.wallet.jsBridgeKey},e.additionalRequest))};return Ll(e.wallet)?d():Ml(e.wallet)?g():h(),Tt(Bl,{"data-tc-wallets-modal-connection-desktop":"true",get children(){return[Tt(Ut,{get when(){return!e.backDisabled},get children(){return Tt(Vl,{icon:"arrow",onClick:()=>e.onBackClick()})}}),Tt(Dl,{get children(){return e.wallet.name}}),Tt(Ut,{get when(){return"mobile"===t()},get children(){return Tt(Fl,{translationKey:"walletModal.desktopConnectionModal.scanQR",get translationValues(){return{name:e.wallet.name}},get children(){return["Scan the QR code below with your phone’s or ",rt((()=>e.wallet.name)),"’s camera"]}})}}),Tt(Hl,{get qr(){return"mobile"===t()},get children(){return Tt(Wt,{get children(){return[Tt(jt,{get when(){return"mobile"===t()},get children(){return Tt(Kl,{disableCopy:!1,get sourceUrl(){return tc(i(),"none")},get imageUrl(){return e.wallet.imageUrl}})}}),Tt(jt,{get when(){return r()},get children(){return[Tt(Yl,{size:"s"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.connectionDeclined",children:"Connection declined"}),Tt(ql,{get children(){return Tt(xo,{get leftIcon(){return Tt(ps,{})},get onClick(){return"extension"===t()?g:h},get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}})}})]}}),Tt(jt,{get when(){return"extension"===t()},get children(){return[Tt(Ut,{get when(){return xe(e.wallet)},get children(){return[Tt(Gl,{size:"s"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.continueInExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",rt((()=>e.wallet.name))," browser extension…"]}}),Tt(ql,{get children(){return Tt(xo,{get leftIcon(){return Tt(ps,{})},onClick:g,get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}})}})]}}),Tt(Ut,{get when(){return!xe(e.wallet)},get children(){return[Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.dontHaveExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Seems you don't have installed ",rt((()=>e.wallet.name))," browser extension"]}}),Tt(ql,{get children(){return Tt(Js,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return Tt(xo,{get rightIcon(){return Tt(ms,{})},onClick:g,get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",rt((()=>e.wallet.name))]}})}})}})}})]}})]}}),Tt(jt,{get when(){return"desktop"===t()},get children(){return[Tt(rs,{size:"m"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.continueOnDesktop",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",rt((()=>e.wallet.name))," on desktop…"]}}),Tt(ql,{get children(){return[Tt(xo,{get leftIcon(){return Tt(ps,{})},onClick:h,get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}}),Tt(Js,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return Tt(xo,{get rightIcon(){return Tt(ms,{})},get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",rt((()=>e.wallet.name))]}})}})}})]}})]}})]}})}}),Tt(Ut,{get when(){return e.wallet.appName===js},get children(){return Tt(Jl,{get rightIcon(){return Tt(Xl,{get src(){return Hs}})},scale:"s",onClick:f,get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.openWalletOnTelegram",children:"Open Wallet in Telegram on desktop"})}})}}),Tt(Ut,{get when(){return e.wallet.appName!==js},get children(){return Tt(zl,{get children(){return[Tt(Ut,{get when(){return rt((()=>"mobile"!==t()))()&&Ll(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(ds,{})},onClick:d,get children(){return Tt(ec,{translationKey:"common.mobile",children:"Mobile"})}})}}),Tt(Ut,{get when(){return rt((()=>"extension"!==t()))()&&Ml(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(cs,{})},onClick:g,get children(){return Tt(ec,{translationKey:"common.browserExtension",children:"Browser Extension"})}})}}),Tt(Ut,{get when(){return rt((()=>"desktop"!==t()))()&&Rl(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(fs,{})},onClick:h,get children(){return Tt(ec,{translationKey:"common.desktop",children:"Desktop"})}})}})]}})}})]}})},sc=Tn.div``,ac=Tn(Uo)`
735
+ `,ec=e=>{const[t]=xi();return rt((()=>{var n;return t(e.translationKey,e.translationValues,null==(n=e.children)?void 0:n.toString())}))};function tc(e,t){let n;n="string"==typeof t?t:so()?t.twaReturnUrl||t.returnStrategy:"none";const r=function(e,t,n){const r=new URL(e);return r.searchParams.append(t,n),r.toString()}(e,"ret",n);if(!re(e))return r;const o=r.slice(r.lastIndexOf("&")+1);return r.slice(0,r.lastIndexOf("&"))+"-"+oe(o)}function nc(e,t){t=__spreadValues({},t);const n=function(e){const t=new URL(e);t.searchParams.has("attach")&&(t.searchParams.delete("attach"),t.pathname+="/start");return t.toString()}(e),r=new URL(n);if(r.searchParams.has("startapp")||r.searchParams.append("startapp","tonconnect"),so())io("ios","android")?(t.returnStrategy="back",t.twaReturnUrl=void 0,lo(tc(r.toString(),t))):io("macos","tdesktop")||io("weba")?lo(tc(r.toString(),t)):io("web")?(t.returnStrategy="back",t.twaReturnUrl=void 0,lo(tc(r.toString(),t))):Vn(tc(r.toString(),t));else if(Jn("ios")){"back"===t.returnStrategy&&(Xn("safari")?t.returnStrategy="back":Xn("chrome")?t.returnStrategy="googlechrome://":Xn("firefox")?t.returnStrategy="firefox://":Xn("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("android")){t.returnStrategy="none";const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("ipad")){"back"===t.returnStrategy&&(Xn("safari")?t.returnStrategy="back":Xn("chrome")?t.returnStrategy="googlechrome://":Xn("firefox")?t.returnStrategy="firefox://":Xn("opera")?t.returnStrategy="opera-http://":t.returnStrategy=location.href);const e=Xn("chrome"),n=Xn("firefox");if((e||n)&&!t.forceRedirect){const e=tc(r.toString(),t.returnStrategy);qn(oc(e),(()=>Vn(e)))}else{Vn(tc(r.toString(),t.returnStrategy))}}else if(Jn("macos","windows","linux"))if(t.returnStrategy="none",t.twaReturnUrl=void 0,t.forceRedirect)Vn(tc(r.toString(),t));else{const e=tc(r.toString(),t);qn(oc(e),(()=>Vn(e)))}else Vn(tc(r.toString(),t))}function rc(e,t,n,r){if(n=__spreadValues({},n),so())if(io("ios","android")){"back"===n.returnStrategy&&(n.returnStrategy="tg://resolve"),r("universal-link");const t=tc(e,n.returnStrategy);lo(t,(()=>{r("universal-link"),Vn(t)}))}else if(io("macos","tdesktop")){"back"===n.returnStrategy&&(n.returnStrategy="tg://resolve");const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else if(io("weba")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy=location.href:Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href);const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else if(io("web")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy=location.href:Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href);const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else{r("universal-link");Vn(tc(e,n.returnStrategy))}else if(Jn("ios"))"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy="none":Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href),Xn("chrome")?(r("universal-link"),Fn(tc(e,n.returnStrategy),"_self")):(r("universal-link"),Vn(tc(e,n.returnStrategy)));else if(Jn("android"))"back"===n.returnStrategy&&(Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href),r("universal-link"),Vn(tc(e,n.returnStrategy));else if(Jn("ipad"))"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy="none":Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy=location.href),Xn("chrome")?(r("universal-link"),Fn(tc(e,n.returnStrategy),"_self")):(r("universal-link"),Vn(tc(e,n.returnStrategy)));else if(Jn("macos","windows","linux")){"back"===n.returnStrategy&&(Xn("safari")?n.returnStrategy="none":Xn("chrome")?n.returnStrategy="googlechrome://":Xn("firefox")?n.returnStrategy="firefox://":Xn("opera")?n.returnStrategy="opera-http://":n.returnStrategy="none");const o=tc(e,n.returnStrategy);!!t&&!n.forceRedirect?(r("custom-deeplink"),qn(er(o,t),(()=>{r("universal-link"),Vn(o)}))):(r("universal-link"),Vn(o))}else r("universal-link"),Vn(tc(e,n.returnStrategy))}function oc(e){const t=new URL(e),[,n,r]=t.pathname.split("/");return`tg://resolve?domain=${n}&appname=${r}&startapp=${t.searchParams.get("startapp")}`}const ic=e=>{const[t,n]=Xe("mobile"),[r,o]=Xe(!1),[i,s]=Xe(),[a,l]=Xe(!0),c=ut(br);at(c.onStatusChange((()=>{}),(()=>{e.wallet.appName!==js&&o(!0)})));const u=()=>{s(c.connect({universalLink:e.wallet.universalLink,bridgeUrl:e.wallet.bridgeUrl},e.additionalRequest))};nt((()=>{"extension"!==st(t)&&(Ll(e.wallet)||Rl(e.wallet))&&u()}));const d=()=>{o(!1),"extension"===t()&&u(),n("mobile"),gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:"qrcode"}))},h=()=>{o(!1),"extension"===t()&&u(),n("desktop");const r=!a();l(!1),rc(i(),e.wallet.deepLink,{returnStrategy:_l.returnStrategy,forceRedirect:r},(t=>{gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:t}))}))},f=()=>{const t=!a();l(!1),gr(__spreadProps(__spreadValues({},e.wallet),{openMethod:"universal-link"})),nc(i(),{returnStrategy:_l.returnStrategy,twaReturnUrl:_l.twaReturnUrl,forceRedirect:t})},g=()=>{o(!1),n("extension"),xe(e.wallet)&&(gr(e.wallet),c.connect({jsBridgeKey:e.wallet.jsBridgeKey},e.additionalRequest))};return Ll(e.wallet)?d():Ml(e.wallet)?g():h(),Tt(Bl,{"data-tc-wallets-modal-connection-desktop":"true",get children(){return[Tt(Ut,{get when(){return!e.backDisabled},get children(){return Tt(Vl,{icon:"arrow",onClick:()=>e.onBackClick()})}}),Tt(Dl,{get children(){return e.wallet.name}}),Tt(Ut,{get when(){return"mobile"===t()},get children(){return Tt(Fl,{translationKey:"walletModal.desktopConnectionModal.scanQR",get translationValues(){return{name:e.wallet.name}},get children(){return["Scan the QR code below with your phone’s or ",rt((()=>e.wallet.name)),"’s camera"]}})}}),Tt(Hl,{get qr(){return"mobile"===t()},get children(){return Tt(Wt,{get children(){return[Tt(jt,{get when(){return"mobile"===t()},get children(){return Tt(Kl,{disableCopy:!1,get sourceUrl(){return tc(i(),"none")},get imageUrl(){return e.wallet.imageUrl}})}}),Tt(jt,{get when(){return r()},get children(){return[Tt(Yl,{size:"s"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.connectionDeclined",children:"Connection declined"}),Tt(ql,{get children(){return Tt(xo,{get leftIcon(){return Tt(ps,{})},get onClick(){return"extension"===t()?g:h},get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}})}})]}}),Tt(jt,{get when(){return"extension"===t()},get children(){return[Tt(Ut,{get when(){return xe(e.wallet)},get children(){return[Tt(Gl,{size:"s"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.continueInExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",rt((()=>e.wallet.name))," browser extension…"]}}),Tt(ql,{get children(){return Tt(xo,{get leftIcon(){return Tt(ps,{})},onClick:g,get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}})}})]}}),Tt(Ut,{get when(){return!xe(e.wallet)},get children(){return[Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.dontHaveExtension",get translationValues(){return{name:e.wallet.name}},get children(){return["Seems you don't have installed ",rt((()=>e.wallet.name))," browser extension"]}}),Tt(ql,{get children(){return Tt(Js,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return Tt(xo,{get rightIcon(){return Tt(ms,{})},onClick:g,get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",rt((()=>e.wallet.name))]}})}})}})}})]}})]}}),Tt(jt,{get when(){return"desktop"===t()},get children(){return[Tt(rs,{size:"m"}),Tt(Ql,{translationKey:"walletModal.desktopConnectionModal.continueOnDesktop",get translationValues(){return{name:e.wallet.name}},get children(){return["Continue in ",rt((()=>e.wallet.name))," on desktop…"]}}),Tt(ql,{get children(){return[Tt(xo,{get leftIcon(){return Tt(ps,{})},onClick:h,get children(){return Tt(ec,{translationKey:"common.retry",children:"Retry"})}}),Tt(Js,{get href(){return e.wallet.aboutUrl},blank:!0,get children(){return Tt(xo,{get rightIcon(){return Tt(ms,{})},get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.getWallet",get translationValues(){return{name:e.wallet.name}},get children(){return["Get ",rt((()=>e.wallet.name))]}})}})}})]}})]}})]}})}}),Tt(Ut,{get when(){return e.wallet.appName===js},get children(){return Tt(Jl,{get rightIcon(){return Tt(Xl,{get src(){return Hs}})},scale:"s",onClick:f,get children(){return Tt(ec,{translationKey:"walletModal.desktopConnectionModal.openWalletOnTelegram",children:"Open Wallet in Telegram on desktop"})}})}}),Tt(Ut,{get when(){return e.wallet.appName!==js},get children(){return Tt(zl,{get children(){return[Tt(Ut,{get when(){return rt((()=>"mobile"!==t()))()&&Ll(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(ds,{})},onClick:d,get children(){return Tt(ec,{translationKey:"common.mobile",children:"Mobile"})}})}}),Tt(Ut,{get when(){return rt((()=>"extension"!==t()))()&&Ml(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(cs,{})},onClick:g,get children(){return Tt(ec,{translationKey:"common.browserExtension",children:"Browser Extension"})}})}}),Tt(Ut,{get when(){return rt((()=>"desktop"!==t()))()&&Rl(e.wallet)},get children(){return Tt(Zl,{appearance:"secondary",get leftIcon(){return Tt(fs,{})},onClick:h,get children(){return Tt(ec,{translationKey:"common.desktop",children:"Desktop"})}})}})]}})}})]}})},sc=Tn.div``,ac=Tn(Uo)`
736
736
  position: absolute;
737
737
  top: 16px;
738
738
  left: 16px;
@@ -1020,5 +1020,5 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
1020
1020
  width: 16px;
1021
1021
  `,du=Tn(xo)`
1022
1022
  margin-top: 32px;
1023
- `,hu=e=>{const t=Co(e),n=ut(Xs),[r,o]=Xe(!0),[i,s]=Xe(!1);let a,l;nt((()=>{const e=pr();s(!!e&&"sent"in e&&e.sent)})),(null==n?void 0:n.wallet)&&"universalLink"in n.wallet&&("universal-link"===n.wallet.openMethod||re(n.wallet.universalLink)&&so())&&(a=n.wallet.universalLink),(null==n?void 0:n.wallet)&&"deepLink"in n.wallet&&("custom-deeplink"===n.wallet.openMethod||re(n.wallet.deepLink)&&so())&&(l=n.wallet.deepLink);const c=()=>{const e=pr(),t="returnStrategy"in e?e.returnStrategy:_l.returnStrategy,n=!r();o(!1),re(a)?nc(a,{returnStrategy:t,twaReturnUrl:"twaReturnUrl"in e?e.twaReturnUrl:_l.twaReturnUrl,forceRedirect:n}):rc(a,l,{returnStrategy:t,forceRedirect:n},(()=>{}))};return Tt(su,Pt(t,{get children(){return[rt((()=>e.icon)),Tt(au,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),Tt(lu,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),Tt(Ut,{get when(){return!i()},get children(){return Tt(cu,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Tt(uu,{})}})}}),Tt(Ut,{get when(){return i()},get children(){return[Tt(Ut,{get when(){return"open-wallet"!==e.showButton},get children(){return Tt(du,{onClick:()=>e.onClose(),get children(){return Tt(ec,{translationKey:"common.close",children:"Close"})}})}}),Tt(Ut,{get when(){return"open-wallet"===e.showButton&&a},get children(){return Tt(du,{onClick:c,get children(){return Tt(ec,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},fu=e=>{const t=ut(Xs),[n]=xi();return Tt(hu,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:t.wallet&&"name"in t.wallet?t.wallet.name:n("common.yourWallet",{},"Your wallet")}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return Tt(rs,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},gu=e=>Tt(hu,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return Tt(Xi,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),pu=e=>Tt(hu,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return Tt(Gi,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),wu=()=>Tt(Xo,{get opened(){var e;return rt((()=>null!==pr()))()&&!0===(null==(e=pr())?void 0:e.openModal)},get enableAndroidBackHandler(){return _l.enableAndroidBackHandler},onClose:()=>wr(null),"data-tc-actions-modal-container":"true",get children(){return Tt(Wt,{get children(){return[Tt(jt,{get when(){return"transaction-sent"===pr().name},get children(){return Tt(pu,{onClose:()=>wr(null)})}}),Tt(jt,{get when(){return"transaction-canceled"===pr().name},get children(){return Tt(gu,{onClose:()=>wr(null)})}}),Tt(jt,{get when(){return"confirm-transaction"===pr().name},get children(){return Tt(fu,{onClose:()=>wr(null)})}})]}})}}),mu=()=>{const{locale:e}=xi()[1];nt((()=>e(_l.language))),nt((()=>{cr()&&Gs()}));const t=ut(br),[n,r]=Xe(!1),o=()=>{var e;return"loading"===(null==(e=_l.connectRequestParameters)?void 0:e.state)},i=rt((()=>{var e;if(!o())return null==(e=_l.connectRequestParameters)?void 0:e.value})),s=e=>{lr({status:"closed",closeReason:e}),r(!1)};return at(t.onStatusChange((e=>{e&&s("wallet-selected")}))),Tt(bl,{get opened(){return cr()},get enableAndroidBackHandler(){return _l.enableAndroidBackHandler},onClose:()=>s("action-cancelled"),onClickQuestion:()=>r((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[Tt(Ut,{get when(){return n()},get children(){return Tt(pc,{onBackClick:()=>r(!1)})}}),Tt(Ut,{get when(){return!n()},get children(){return[Tt(Ut,{get when(){return o()},get children(){return[Tt(Cl,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),Tt(xl,{get children(){return Tt(rs,{size:"m"})}})]}}),Tt(Ut,{get when(){return!o()},get children(){return Tt(hn,{get component(){return zs()?Ac:ic},get wallet(){return ur()},get additionalRequest(){return i()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},vu=e=>{const t=bi(vr,_l.language);return customElements.define(On,class extends HTMLElement{}),document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart",""),Tt(Ci.Provider,{value:t,get children(){return Tt(Xs.Provider,{get value(){return e.tonConnectUI},get children(){return Tt(br.Provider,{get value(){return _l.connector},get children(){return[Tt(In,{}),Tt(Rn,{theme:Gr,get children(){return[Tt(Ut,{get when(){return _l.buttonRootId},get children(){return Tt(dn,{get mount(){return document.getElementById(_l.buttonRootId)},get children(){return Tt(yl,{})}})}}),Tt(hn,{component:On,get children(){return[Tt(iu,{}),Tt(mu,{}),Tt(wu,{})]}})]}})]}})}})}})},yu=()=>{setTimeout((()=>ir({status:"opened",closeReason:null})))},bu=e=>{setTimeout((()=>ir({status:"closed",closeReason:e})))},Cu=e=>{setTimeout((()=>lr({status:"opened",closeReason:null,walletInfo:e})))},xu=e=>{setTimeout((()=>lr({status:"closed",closeReason:e})))},_u=e=>{setTimeout((()=>wr(e)))},Su=()=>{setTimeout((()=>wr(null)))},ku=()=>hr(),Eu=()=>gr(null),Ru=(e,t)=>function(e,t,n,r={}){let o;return Je((r=>{o=r,t===document?e():Xt(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{o(),t.textContent=""}}((()=>Tt(vu,{tonConnectUI:t})),document.getElementById(e));class Lu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"state",or()),this.connector=e.connector,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,nt((()=>{const e=or();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(){return __async(this,null,(function*(){const e=(yield this.connector.getWallets()).find(_e);return e?this.connectEmbeddedWallet(e):this.openWalletsModal()}))}close(){bu("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openWalletsModal(){return __async(this,null,(function*(){return so()&&ao(),yu(),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class Mu{constructor(e){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=e.connector,nt((()=>{const e=pr();this.consumers.forEach((t=>t(e)))}))}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}}class Tu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"state",ar()),this.connector=e.connector,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,nt((()=>{const e=ar();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(e){return __async(this,null,(function*(){const t=El(yield this.connector.getWallets(),_l.walletsListConfiguration),n=t.find(_e);if(!!n)return this.connectEmbeddedWallet(n);const r=t.filter(ke).find((t=>Tl(t,e)));if(!!r)return this.openSingleWalletModal(r);throw new Kn(`Trying to open modal window with unknown wallet "${e}".`)}))}close(){xu("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openSingleWalletModal(e){return __async(this,null,(function*(){return so()&&ao(),Cu(e),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}e.BadRequestError=K,e.FetchWalletsError=q,e.LocalstorageNotFoundError=V,e.ParseHexError=Z,e.THEME=fn,e.TonConnect=Te,e.TonConnectError=I,e.TonConnectUI=class{constructor(e){if(__publicField(this,"walletInfoStorage",new tr),__publicField(this,"preferredWalletStorage",new nr),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),e&&"connector"in e&&e.connector)this.connector=e.connector;else{if(!(e&&"manifestUrl"in e&&e.manifestUrl))throw new Kn("You have to specify a `manifestUrl` or a `connector` in the options.");this.connector=new Te({manifestUrl:e.manifestUrl})}this.modal=new Lu({connector:this.connector,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.singleWalletModal=new Tu({connector:this.connector,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.transactionModal=new Mu({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then((e=>{return Zn((t=e.map((e=>e.imageUrl)),[...new Set(t)]));var t}));const t=this.normalizeWidgetRoot(null==e?void 0:e.widgetRootId);this.subscribeToWalletChange(),!1!==(null==e?void 0:e.restoreConnection)&&(this.connectionRestored=new Promise((e=>__async(this,null,(function*(){yield this.connector.restoreConnection(),this.connector.connected||this.walletInfoStorage.removeWalletInfo(),e(this.connector.connected)}))))),this.uiOptions=Zr(e,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();Sl({connector:this.connector,preferredWalletAppName:n}),Ru(t,this)}static getWallets(){return Te.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues(__spreadValues({},this.connector.wallet),this.walletInfo):null}set uiOptions(e){var t,n,r,o,i,s,a;this.checkButtonRootExist(e.buttonRootId),this.actionsConfiguration=e.actionsConfiguration,(null==(t=e.uiPreferences)?void 0:t.theme)?"SYSTEM"!==(null==(n=e.uiPreferences)?void 0:n.theme)?(null==(r=this.systemThemeChangeUnsubscribe)||r.call(this),Xr(e.uiPreferences.theme,e.uiPreferences.colorsSet)):(Xr(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?fn.LIGHT:fn.DARK,e.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=function(e){const t=t=>e(t.matches?fn.DARK:fn.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}(Xr))):(null==(o=e.uiPreferences)?void 0:o.colorsSet)&&(s=e.uiPreferences.colorsSet,Jr[fn.DARK]=Zr(s[fn.DARK],Jr[fn.DARK]),Jr[fn.LIGHT]=Zr(s[fn.LIGHT],Jr[fn.LIGHT]),Yr((e=>({colors:Zr(Jr[e.theme],Qr[e.theme])})))),(null==(i=e.uiPreferences)?void 0:i.borderRadius)&&(a=e.uiPreferences.borderRadius,Yr({borderRadius:a})),Sl((t=>{var n,r;const o=Zr(__spreadValues(__spreadValues(__spreadValues(__spreadValues({},e.language&&{language:e.language}),!!(null==(n=e.actionsConfiguration)?void 0:n.returnStrategy)&&{returnStrategy:e.actionsConfiguration.returnStrategy}),!!(null==(r=e.actionsConfiguration)?void 0:r.twaReturnUrl)&&{twaReturnUrl:e.actionsConfiguration.twaReturnUrl}),!!e.walletsListConfiguration&&{walletsListConfiguration:e.walletsListConfiguration}),Er(t));return void 0!==e.buttonRootId&&(o.buttonRootId=e.buttonRootId),void 0!==e.enableAndroidBackHandler&&(o.enableAndroidBackHandler=e.enableAndroidBackHandler),o}))}setConnectRequestParameters(e){var t;Sl({connectRequestParameters:e}),"ready"!==(null==e?void 0:e.state)&&e||null==(t=this.connectRequestParametersCallback)||t.call(this,null==e?void 0:e.value)}getWallets(){return __async(this,null,(function*(){return this.connector.getWallets()}))}onStatusChange(e,t){return this.connector.onStatusChange((t=>__async(this,null,(function*(){if(t){const n=yield this.getSelectedWalletInfo(t);e(__spreadValues(__spreadValues({},t),n||this.walletInfoStorage.getWalletInfo()))}else e(t)}))),t)}openModal(){return __async(this,null,(function*(){return this.modal.open()}))}closeModal(){this.modal.close()}onModalStateChange(e){return this.modal.onStateChange(e)}get modalState(){return this.modal.state}openSingleWalletModal(e){return __async(this,null,(function*(){return this.singleWalletModal.open(e)}))}closeSingleWalletModal(){this.singleWalletModal.close()}onSingleWalletModalStateChange(e){return this.singleWalletModal.onStateChange(e)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,(function*(){const e=(yield this.getWallets()).find(_e);return e?yield this.connectEmbeddedWallet(e):yield this.connectExternalWallet()}))}disconnect(){return Su(),Eu(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(e,t){return __async(this,null,(function*(){if(!this.connected)throw new Kn("Connect wallet to send a transaction.");so()&&ao();const{notifications:n,modals:r,returnStrategy:o,twaReturnUrl:i,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(t);_u({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!1});const a=()=>{if(l.signal.aborted)return;_u({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!0});const e="ios"===Qn().os,t="ios"===s&&e||"always"===s;this.walletInfo&&"universalLink"in this.walletInfo&&"universal-link"===this.walletInfo.openMethod&&!t&&(re(this.walletInfo.universalLink)?nc(this.walletInfo.universalLink,{returnStrategy:o,twaReturnUrl:i||_l.twaReturnUrl,forceRedirect:!1}):Vn(tc(this.walletInfo.universalLink,o)))},l=new AbortController,c=this.onTransactionModalStateChange((e=>{(null==e?void 0:e.openModal)||(c(),e||l.abort())}));try{const t=yield this.waitForSendTransaction({transaction:e,signal:l.signal},a);return _u({name:"transaction-sent",showNotification:n.includes("success"),openModal:r.includes("success")}),t}catch(Au){throw _u({name:"transaction-canceled",showNotification:n.includes("error"),openModal:r.includes("error")}),Au instanceof I?Au:(console.error(Au),new Kn("Unhandled error:"+Au))}finally{c()}}))}connectEmbeddedWallet(e){return __async(this,null,(function*(){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;return"loading"===(null==n?void 0:n.state)?this.connectRequestParametersCallback=t:t(null==n?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})}))}connectExternalWallet(){return __async(this,null,(function*(){const e=new AbortController;yu();const t=this.onModalStateChange((n=>{const{status:r,closeReason:o}=n;"opened"!==r&&(t(),"action-cancelled"===o&&e.abort())}));return yield this.waitForWalletConnection({ignoreErrors:!0,signal:e.signal})}))}waitForWalletConnection(e){return __async(this,null,(function*(){return new Promise(((t,n)=>{const{ignoreErrors:r=!1,signal:o=null}=e;if(o&&o.aborted)return n(new Kn("Wallet was not connected"));const i=e=>__async(this,null,(function*(){if(e)s(),t(e);else{if(r)return;s(),n(new Kn("Wallet was not connected"))}})),s=this.onStatusChange((e=>i(e)),(e=>(e=>{r||(s(),n(e))})(e)));o&&o.addEventListener("abort",(()=>{s(),n(new Kn("Wallet was not connected"))}),{once:!0})}))}))}waitForSendTransaction(e,t){return __async(this,null,(function*(){return new Promise(((n,r)=>{const{transaction:o,signal:i}=e;if(i.aborted)return r(new Kn("Transaction was not sent"));const s=e=>__async(this,null,(function*(){n(e)}));this.connector.sendTransaction(o,{onRequestSent:t,signal:i}).then((e=>s(e))).catch((e=>(e=>{r(e)})(e))),i.addEventListener("abort",(()=>{r(new Kn("Transaction was not sent"))}),{once:!0})}))}))}onTransactionModalStateChange(e){return this.transactionModal.onStateChange(e)}subscribeToWalletChange(){this.connector.onStatusChange((e=>__async(this,null,(function*(){var t;e?(yield this.updateWalletInfo(e),this.setPreferredWalletAppName((null==(t=this.walletInfo)?void 0:t.appName)||e.device.appName)):this.walletInfoStorage.removeWalletInfo()}))))}setPreferredWalletAppName(e){this.preferredWalletStorage.setPreferredWalletAppName(e),Sl({preferredWalletAppName:e})}getSelectedWalletInfo(e){return __async(this,null,(function*(){let t,n=ku();if(!n)return null;if("name"in n)t=n;else{const r=El(yield this.walletsList,_l.walletsListConfiguration).find((t=>Tl(t,e.device.appName)));if(!r)throw new Kn(`Cannot find WalletInfo for the '${e.device.appName}' wallet`);t=__spreadValues(__spreadValues({},r),n)}return t}))}updateWalletInfo(e){return __async(this,null,(function*(){const t=yield this.getSelectedWalletInfo(e);if(t)return this.walletInfo=t,void this.walletInfoStorage.setWalletInfo(t);const n=this.walletInfoStorage.getWalletInfo();this.walletInfo=n||((yield this.walletsList).find((t=>Tl(t,e.device.appName)))||null)}))}normalizeWidgetRoot(e){if(!e||!document.getElementById(e)){e="tc-widget-root";const t=document.createElement("div");t.id=e,document.body.appendChild(t)}return e}checkButtonRootExist(e){if(null!=e&&!document.getElementById(e))throw new Kn(`${e} element not found in the document.`)}getModalsAndNotificationsConfiguration(e){var t,n,r,o,i,s;const a=["before","success","error"];let l=a;(null==(t=this.actionsConfiguration)?void 0:t.notifications)&&"all"!==(null==(n=this.actionsConfiguration)?void 0:n.notifications)&&(l=this.actionsConfiguration.notifications),(null==e?void 0:e.notifications)&&(l="all"===e.notifications?a:e.notifications);let c=["before"];(null==(r=this.actionsConfiguration)?void 0:r.modals)&&(c="all"===this.actionsConfiguration.modals?a:this.actionsConfiguration.modals),(null==e?void 0:e.modals)&&(c="all"===e.modals?a:e.modals);const u=(null==e?void 0:e.returnStrategy)||(null==(o=this.actionsConfiguration)?void 0:o.returnStrategy)||"back",d=(null==e?void 0:e.twaReturnUrl)||(null==(i=this.actionsConfiguration)?void 0:i.twaReturnUrl);let h=(null==e?void 0:e.skipRedirectToWallet)||(null==(s=this.actionsConfiguration)?void 0:s.skipRedirectToWallet)||"ios";return so()&&(h="never"),{notifications:l,modals:c,returnStrategy:u,twaReturnUrl:d,skipRedirectToWallet:h}}},e.TonConnectUIError=Kn,e.UnknownAppError=D,e.UnknownError=G,e.UserRejectsError=H,e.WalletAlreadyConnectedError=j,e.WalletNotConnectedError=B,e.WalletNotInjectedError=F,e.WalletsListManager=Re,e.WrongAddressError=z,e.encodeTelegramUrlParameters=oe,e.isTelegramUrl=re,e.isWalletInfoCurrentlyEmbedded=_e,e.isWalletInfoCurrentlyInjected=xe,e.isWalletInfoInjectable=Se,e.isWalletInfoInjected=function(e){return"jsBridgeKey"in e},e.isWalletInfoRemote=ke,e.toUserFriendlyAddress=$e,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1023
+ `,hu=e=>{const t=Co(e),n=ut(Xs),[r,o]=Xe(!0),[i,s]=Xe(!1);let a,l;nt((()=>{const e=pr();s(!!e&&"sent"in e&&e.sent)})),(null==n?void 0:n.wallet)&&"universalLink"in n.wallet&&("universal-link"===n.wallet.openMethod||re(n.wallet.universalLink)&&so())&&(a=n.wallet.universalLink),(null==n?void 0:n.wallet)&&"deepLink"in n.wallet&&("custom-deeplink"===n.wallet.openMethod||re(n.wallet.deepLink)&&so())&&(l=n.wallet.deepLink);const c=()=>{const e=pr(),t="returnStrategy"in e?e.returnStrategy:_l.returnStrategy,n=!r();o(!1),re(a)?nc(a,{returnStrategy:t,twaReturnUrl:"twaReturnUrl"in e?e.twaReturnUrl:_l.twaReturnUrl,forceRedirect:n}):rc(a,l,{returnStrategy:t,forceRedirect:n},(()=>{}))};return Tt(su,Pt(t,{get children(){return[rt((()=>e.icon)),Tt(au,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),Tt(lu,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),Tt(Ut,{get when(){return!i()&&("open-wallet"===e.showButton&&a||"open-wallet"!==e.showButton)},get children(){return Tt(cu,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Tt(uu,{})}})}}),Tt(Ut,{get when(){return i()},get children(){return[Tt(Ut,{get when(){return"open-wallet"!==e.showButton},get children(){return Tt(du,{onClick:()=>e.onClose(),get children(){return Tt(ec,{translationKey:"common.close",children:"Close"})}})}}),Tt(Ut,{get when(){return"open-wallet"===e.showButton&&a},get children(){return Tt(du,{onClick:c,get children(){return Tt(ec,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},fu=e=>{const t=ut(Xs),[n]=xi();return Tt(hu,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:t.wallet&&"name"in t.wallet?t.wallet.name:n("common.yourWallet",{},"Your wallet")}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return Tt(rs,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},gu=e=>Tt(hu,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return Tt(Xi,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),pu=e=>Tt(hu,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return Tt(Gi,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),wu=()=>Tt(Xo,{get opened(){var e;return rt((()=>null!==pr()))()&&!0===(null==(e=pr())?void 0:e.openModal)},get enableAndroidBackHandler(){return _l.enableAndroidBackHandler},onClose:()=>wr(null),"data-tc-actions-modal-container":"true",get children(){return Tt(Wt,{get children(){return[Tt(jt,{get when(){return"transaction-sent"===pr().name},get children(){return Tt(pu,{onClose:()=>wr(null)})}}),Tt(jt,{get when(){return"transaction-canceled"===pr().name},get children(){return Tt(gu,{onClose:()=>wr(null)})}}),Tt(jt,{get when(){return"confirm-transaction"===pr().name},get children(){return Tt(fu,{onClose:()=>wr(null)})}})]}})}}),mu=()=>{const{locale:e}=xi()[1];nt((()=>e(_l.language))),nt((()=>{cr()&&Gs()}));const t=ut(br),[n,r]=Xe(!1),o=()=>{var e;return"loading"===(null==(e=_l.connectRequestParameters)?void 0:e.state)},i=rt((()=>{var e;if(!o())return null==(e=_l.connectRequestParameters)?void 0:e.value})),s=e=>{lr({status:"closed",closeReason:e}),r(!1)};return at(t.onStatusChange((e=>{e&&s("wallet-selected")}))),Tt(bl,{get opened(){return cr()},get enableAndroidBackHandler(){return _l.enableAndroidBackHandler},onClose:()=>s("action-cancelled"),onClickQuestion:()=>r((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[Tt(Ut,{get when(){return n()},get children(){return Tt(pc,{onBackClick:()=>r(!1)})}}),Tt(Ut,{get when(){return!n()},get children(){return[Tt(Ut,{get when(){return o()},get children(){return[Tt(Cl,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),Tt(xl,{get children(){return Tt(rs,{size:"m"})}})]}}),Tt(Ut,{get when(){return!o()},get children(){return Tt(hn,{get component(){return zs()?Ac:ic},get wallet(){return ur()},get additionalRequest(){return i()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},vu=e=>{const t=bi(vr,_l.language);return customElements.define(On,class extends HTMLElement{}),document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart",""),Tt(Ci.Provider,{value:t,get children(){return Tt(Xs.Provider,{get value(){return e.tonConnectUI},get children(){return Tt(br.Provider,{get value(){return _l.connector},get children(){return[Tt(In,{}),Tt(Rn,{theme:Gr,get children(){return[Tt(Ut,{get when(){return _l.buttonRootId},get children(){return Tt(dn,{get mount(){return document.getElementById(_l.buttonRootId)},get children(){return Tt(yl,{})}})}}),Tt(hn,{component:On,get children(){return[Tt(iu,{}),Tt(mu,{}),Tt(wu,{})]}})]}})]}})}})}})},yu=()=>{setTimeout((()=>ir({status:"opened",closeReason:null})))},bu=e=>{setTimeout((()=>ir({status:"closed",closeReason:e})))},Cu=e=>{setTimeout((()=>lr({status:"opened",closeReason:null,walletInfo:e})))},xu=e=>{setTimeout((()=>lr({status:"closed",closeReason:e})))},_u=e=>{setTimeout((()=>wr(e)))},Su=()=>{setTimeout((()=>wr(null)))},ku=()=>hr(),Eu=()=>gr(null),Ru=(e,t)=>function(e,t,n,r={}){let o;return Je((r=>{o=r,t===document?e():Xt(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{o(),t.textContent=""}}((()=>Tt(vu,{tonConnectUI:t})),document.getElementById(e));class Lu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"state",or()),this.connector=e.connector,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,nt((()=>{const e=or();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(){return __async(this,null,(function*(){const e=(yield this.connector.getWallets()).find(_e);return e?this.connectEmbeddedWallet(e):this.openWalletsModal()}))}close(){bu("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openWalletsModal(){return __async(this,null,(function*(){return so()&&ao(),yu(),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class Mu{constructor(e){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=e.connector,nt((()=>{const e=pr();this.consumers.forEach((t=>t(e)))}))}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}}class Tu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"state",ar()),this.connector=e.connector,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,nt((()=>{const e=ar();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(e){return __async(this,null,(function*(){const t=El(yield this.connector.getWallets(),_l.walletsListConfiguration),n=t.find(_e);if(!!n)return this.connectEmbeddedWallet(n);const r=t.filter(ke).find((t=>Tl(t,e)));if(!!r)return this.openSingleWalletModal(r);throw new Kn(`Trying to open modal window with unknown wallet "${e}".`)}))}close(){xu("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openSingleWalletModal(e){return __async(this,null,(function*(){return so()&&ao(),Cu(e),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}e.BadRequestError=K,e.FetchWalletsError=q,e.LocalstorageNotFoundError=V,e.ParseHexError=Z,e.THEME=fn,e.TonConnect=Te,e.TonConnectError=I,e.TonConnectUI=class{constructor(e){if(__publicField(this,"walletInfoStorage",new tr),__publicField(this,"preferredWalletStorage",new nr),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),e&&"connector"in e&&e.connector)this.connector=e.connector;else{if(!(e&&"manifestUrl"in e&&e.manifestUrl))throw new Kn("You have to specify a `manifestUrl` or a `connector` in the options.");this.connector=new Te({manifestUrl:e.manifestUrl})}this.modal=new Lu({connector:this.connector,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.singleWalletModal=new Tu({connector:this.connector,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.transactionModal=new Mu({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then((e=>{return Zn((t=e.map((e=>e.imageUrl)),[...new Set(t)]));var t}));const t=this.normalizeWidgetRoot(null==e?void 0:e.widgetRootId);this.subscribeToWalletChange(),!1!==(null==e?void 0:e.restoreConnection)&&(this.connectionRestored=new Promise((e=>__async(this,null,(function*(){yield this.connector.restoreConnection(),this.connector.connected||this.walletInfoStorage.removeWalletInfo(),e(this.connector.connected)}))))),this.uiOptions=Zr(e,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();Sl({connector:this.connector,preferredWalletAppName:n}),Ru(t,this)}static getWallets(){return Te.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues(__spreadValues({},this.connector.wallet),this.walletInfo):null}set uiOptions(e){var t,n,r,o,i,s,a;this.checkButtonRootExist(e.buttonRootId),this.actionsConfiguration=e.actionsConfiguration,(null==(t=e.uiPreferences)?void 0:t.theme)?"SYSTEM"!==(null==(n=e.uiPreferences)?void 0:n.theme)?(null==(r=this.systemThemeChangeUnsubscribe)||r.call(this),Xr(e.uiPreferences.theme,e.uiPreferences.colorsSet)):(Xr(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?fn.LIGHT:fn.DARK,e.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=function(e){const t=t=>e(t.matches?fn.DARK:fn.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}(Xr))):(null==(o=e.uiPreferences)?void 0:o.colorsSet)&&(s=e.uiPreferences.colorsSet,Jr[fn.DARK]=Zr(s[fn.DARK],Jr[fn.DARK]),Jr[fn.LIGHT]=Zr(s[fn.LIGHT],Jr[fn.LIGHT]),Yr((e=>({colors:Zr(Jr[e.theme],Qr[e.theme])})))),(null==(i=e.uiPreferences)?void 0:i.borderRadius)&&(a=e.uiPreferences.borderRadius,Yr({borderRadius:a})),Sl((t=>{var n,r;const o=Zr(__spreadValues(__spreadValues(__spreadValues(__spreadValues({},e.language&&{language:e.language}),!!(null==(n=e.actionsConfiguration)?void 0:n.returnStrategy)&&{returnStrategy:e.actionsConfiguration.returnStrategy}),!!(null==(r=e.actionsConfiguration)?void 0:r.twaReturnUrl)&&{twaReturnUrl:e.actionsConfiguration.twaReturnUrl}),!!e.walletsListConfiguration&&{walletsListConfiguration:e.walletsListConfiguration}),Er(t));return void 0!==e.buttonRootId&&(o.buttonRootId=e.buttonRootId),void 0!==e.enableAndroidBackHandler&&(o.enableAndroidBackHandler=e.enableAndroidBackHandler),o}))}setConnectRequestParameters(e){var t;Sl({connectRequestParameters:e}),"ready"!==(null==e?void 0:e.state)&&e||null==(t=this.connectRequestParametersCallback)||t.call(this,null==e?void 0:e.value)}getWallets(){return __async(this,null,(function*(){return this.connector.getWallets()}))}onStatusChange(e,t){return this.connector.onStatusChange((t=>__async(this,null,(function*(){if(t){const n=yield this.getSelectedWalletInfo(t);e(__spreadValues(__spreadValues({},t),n||this.walletInfoStorage.getWalletInfo()))}else e(t)}))),t)}openModal(){return __async(this,null,(function*(){return this.modal.open()}))}closeModal(){this.modal.close()}onModalStateChange(e){return this.modal.onStateChange(e)}get modalState(){return this.modal.state}openSingleWalletModal(e){return __async(this,null,(function*(){return this.singleWalletModal.open(e)}))}closeSingleWalletModal(){this.singleWalletModal.close()}onSingleWalletModalStateChange(e){return this.singleWalletModal.onStateChange(e)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,(function*(){const e=(yield this.getWallets()).find(_e);return e?yield this.connectEmbeddedWallet(e):yield this.connectExternalWallet()}))}disconnect(){return Su(),Eu(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(e,t){return __async(this,null,(function*(){if(!this.connected)throw new Kn("Connect wallet to send a transaction.");so()&&ao();const{notifications:n,modals:r,returnStrategy:o,twaReturnUrl:i,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(t);_u({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!1});const a=()=>{l.signal.aborted||(_u({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&("universal-link"===this.walletInfo.openMethod||"custom-deeplink"===this.walletInfo.openMethod)&&(re(this.walletInfo.universalLink)?nc(this.walletInfo.universalLink,{returnStrategy:o,twaReturnUrl:i||_l.twaReturnUrl,forceRedirect:!1}):rc(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:o,forceRedirect:!1},(()=>{}))))},l=new AbortController,c=this.onTransactionModalStateChange((e=>{(null==e?void 0:e.openModal)||(c(),e||l.abort())}));try{const t=yield this.waitForSendTransaction({transaction:e,signal:l.signal},a);return _u({name:"transaction-sent",showNotification:n.includes("success"),openModal:r.includes("success")}),t}catch(Au){throw _u({name:"transaction-canceled",showNotification:n.includes("error"),openModal:r.includes("error")}),Au instanceof I?Au:(console.error(Au),new Kn("Unhandled error:"+Au))}finally{c()}}))}connectEmbeddedWallet(e){return __async(this,null,(function*(){const t=t=>{gr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=_l.connectRequestParameters;return"loading"===(null==n?void 0:n.state)?this.connectRequestParametersCallback=t:t(null==n?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})}))}connectExternalWallet(){return __async(this,null,(function*(){const e=new AbortController;yu();const t=this.onModalStateChange((n=>{const{status:r,closeReason:o}=n;"opened"!==r&&(t(),"action-cancelled"===o&&e.abort())}));return yield this.waitForWalletConnection({ignoreErrors:!0,signal:e.signal})}))}waitForWalletConnection(e){return __async(this,null,(function*(){return new Promise(((t,n)=>{const{ignoreErrors:r=!1,signal:o=null}=e;if(o&&o.aborted)return n(new Kn("Wallet was not connected"));const i=e=>__async(this,null,(function*(){if(e)s(),t(e);else{if(r)return;s(),n(new Kn("Wallet was not connected"))}})),s=this.onStatusChange((e=>i(e)),(e=>(e=>{r||(s(),n(e))})(e)));o&&o.addEventListener("abort",(()=>{s(),n(new Kn("Wallet was not connected"))}),{once:!0})}))}))}waitForSendTransaction(e,t){return __async(this,null,(function*(){return new Promise(((n,r)=>{const{transaction:o,signal:i}=e;if(i.aborted)return r(new Kn("Transaction was not sent"));const s=e=>__async(this,null,(function*(){n(e)}));this.connector.sendTransaction(o,{onRequestSent:t,signal:i}).then((e=>s(e))).catch((e=>(e=>{r(e)})(e))),i.addEventListener("abort",(()=>{r(new Kn("Transaction was not sent"))}),{once:!0})}))}))}onTransactionModalStateChange(e){return this.transactionModal.onStateChange(e)}subscribeToWalletChange(){this.connector.onStatusChange((e=>__async(this,null,(function*(){var t;e?(yield this.updateWalletInfo(e),this.setPreferredWalletAppName((null==(t=this.walletInfo)?void 0:t.appName)||e.device.appName)):this.walletInfoStorage.removeWalletInfo()}))))}setPreferredWalletAppName(e){this.preferredWalletStorage.setPreferredWalletAppName(e),Sl({preferredWalletAppName:e})}getSelectedWalletInfo(e){return __async(this,null,(function*(){let t,n=ku();if(!n)return null;if("name"in n)t=n;else{const r=El(yield this.walletsList,_l.walletsListConfiguration).find((t=>Tl(t,e.device.appName)));if(!r)throw new Kn(`Cannot find WalletInfo for the '${e.device.appName}' wallet`);t=__spreadValues(__spreadValues({},r),n)}return t}))}updateWalletInfo(e){return __async(this,null,(function*(){const t=yield this.getSelectedWalletInfo(e);if(t)return this.walletInfo=t,void this.walletInfoStorage.setWalletInfo(t);const n=this.walletInfoStorage.getWalletInfo();this.walletInfo=n||((yield this.walletsList).find((t=>Tl(t,e.device.appName)))||null)}))}normalizeWidgetRoot(e){if(!e||!document.getElementById(e)){e="tc-widget-root";const t=document.createElement("div");t.id=e,document.body.appendChild(t)}return e}checkButtonRootExist(e){if(null!=e&&!document.getElementById(e))throw new Kn(`${e} element not found in the document.`)}getModalsAndNotificationsConfiguration(e){var t,n,r,o,i,s;const a=["before","success","error"];let l=a;(null==(t=this.actionsConfiguration)?void 0:t.notifications)&&"all"!==(null==(n=this.actionsConfiguration)?void 0:n.notifications)&&(l=this.actionsConfiguration.notifications),(null==e?void 0:e.notifications)&&(l="all"===e.notifications?a:e.notifications);let c=["before"];(null==(r=this.actionsConfiguration)?void 0:r.modals)&&(c="all"===this.actionsConfiguration.modals?a:this.actionsConfiguration.modals),(null==e?void 0:e.modals)&&(c="all"===e.modals?a:e.modals);const u=(null==e?void 0:e.returnStrategy)||(null==(o=this.actionsConfiguration)?void 0:o.returnStrategy)||"back",d=(null==e?void 0:e.twaReturnUrl)||(null==(i=this.actionsConfiguration)?void 0:i.twaReturnUrl);let h=(null==e?void 0:e.skipRedirectToWallet)||(null==(s=this.actionsConfiguration)?void 0:s.skipRedirectToWallet)||"ios";return so()&&(h="never"),{notifications:l,modals:c,returnStrategy:u,twaReturnUrl:d,skipRedirectToWallet:h}}},e.TonConnectUIError=Kn,e.UnknownAppError=D,e.UnknownError=G,e.UserRejectsError=H,e.WalletAlreadyConnectedError=j,e.WalletNotConnectedError=B,e.WalletNotInjectedError=F,e.WalletsListManager=Re,e.WrongAddressError=z,e.encodeTelegramUrlParameters=oe,e.isTelegramUrl=re,e.isWalletInfoCurrentlyEmbedded=_e,e.isWalletInfoCurrentlyInjected=xe,e.isWalletInfoInjectable=Se,e.isWalletInfoInjected=function(e){return"jsBridgeKey"in e},e.isWalletInfoRemote=ke,e.toUserFriendlyAddress=$e,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1024
1024
  //# sourceMappingURL=tonconnect-ui.min.js.map