PageSourceSearch

https://subtopia.io/_next/static/chunks/8408.3d9ab3954849e824.js

js subtopia.io collected 2026-09-25 22:10:23 UTC 29,022 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8408],{4229:(e,t,n)=>{n.d(t,{L:()=>p});var r=n(64527),i=n(1889),s=n(79142),a=n(93647),o=n(41710),l=n(44508),c=n(79246),d=n(3535),u=n(93614),m=n(20906);let p=()=>{let{activeAddress:e,transactionSigner:t}=(0,i.vT)(),{chainType:n}=(0,r.useContext)(u.Ay),{profile:p,isLoading:x}=(0,m.x)(),h=async()=>{if(!p||!e)return;let r=(0,d.u9)(n),i=await c.e.getLocker({registryID:(0,a.uQ)(n),algodClient:r,ownerAddress:s.pVw.fromString(e),lockerType:a.dE.USER});if(i)return l.c.init({lockerID:i,algodClient:r,creator:{addr:s.pVw.fromString(e),signer:t},chainType:n})},{data:f,error:g,mutate:b}=(0,o.Ay)(p?["userLocker",e]:null,h);return{lockerClient:f,isLoading:x||!g&&!f,isError:g,refresh:b}}},25042:(e,t,n)=>{n.d(t,{n:()=>r});let r=e=>window.btoa(e)},26339:(e,t,n)=>{n.d(t,{s:()=>i});var r=n(93647);let i=e=>e===r.ch.TOKEN_BASED?"Token based":e},41872:(e,t,n)=>{n.d(t,{A:()=>o});var r=n(40813),i=n.n(r),s=n(86236),a=n.n(s);i().extend(a());let o=i()},48408:(e,t,n)=>{n.r(t),n.d(t,{UserPanel:()=>em});var r=n(79175),i=n(64527),s=n(10909),a=n(21895),o=n(15552),l=n(15064),c=n(54312),d=n(47677),u=n(1889),m=n(83022),p=n(93647),x=n(13246),h=n(35926),f=n(89408),g=n(81786),b=n(82776),y=n(22262),w=n(345),v=n(61418),j=n(88699),k=n(29640),A=n(82248),I=n(4279),S=n(99993),T=n(42309),D=n(96936),C=n(53867),E=n(63257),L=n(60182),B=n.n(L);function U(e){if(null==e||0===e||0n===e||e===p.dw.UNLIMITED)return"Unlimited";let t="bigint"==typeof e?Number(e):e;if(t<2592e3){let e=Math.round(t/86400);return"".concat(e," ").concat(e>1?"Days":"Day")}if(t<31536e3){let e=Math.round(t/2592e3);return"".concat(e," ").concat(e>1?"Months":"Month")}if(t>=31536e3){let e=Math.round(t/31536e3);return"".concat(e," ").concat(e>1?"Years":"Year")}return"Unlimited"}var N=n(5614),M=n(26339),P=n(47741),F=n(50295),z=n(25042),O=n(66204),_=n(20906),V=n(3535),W=n(93614),G=n(61092),Y=n(32960),R=n.n(Y),Q=n(42108),Z=n(76830),$=n(78059),q=n(28359),H=n(79142),X=n(51959),K=n(89540),J=n(4229);let ee=()=>{let{activeAddress:e,transactionSigner:t}=(0,u.vT)(),{chainType:n,setLoadingState:s}=(0,i.useContext)(W.Ay),{profile:a,refresh:o}=(0,_.x)(),{lockerClient:l,refresh:c}=(0,J.L)(),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Transaction successful!";$.$e.show({title:"Success",message:(0,r.jsxs)(R(),{href:(0,K.A)(n,e,X.A.Transaction),target:"_blank",rel:"noopener noreferrer",children:[t," View on Transaction Explorer"]}),autoClose:!0,color:"green"})},m=e=>{$.$e.show({title:"Error",message:e,color:"red",autoClose:!1})},x=(0,i.useMemo)(()=>!!l,[l]);return{isLockerOptedIn:e=>!!l&&!!e&&l.products.some(t=>t.client.appID===BigInt(e)),hasUserLocker:x,canOptInToLocker:(0,i.useMemo)(()=>!!(e&&(null==a?void 0:a.registryClient)),[e,a]),createUserLocker:async()=>{if(!e||!(null==a?void 0:a.registryClient)||!t)return m("Wallet not connected or profile not loaded"),!1;s({loading:!0,message:"Creating your User Locker. This is a one-time setup."});try{let n=await a.registryClient.createLocker({creator:{addr:H.pVw.fromString(e),signer:t},lockerType:p.dE.USER});if(!n)return m("Failed to create User Locker"),!1;return d(n.txID,"User Locker created successfully!"),await Promise.all([o(),c()]),!0}catch(t){return q.v4(r=>{r.setTag("operation","locker.create_user"),r.setExtra("chainType",n),r.setExtra("activeAddress",null!=e?e:null),O.Cp(t)}),m("Failed to create User Locker: ".concat(t instanceof Error?t.message:"Unknown error")),!1}finally{s({loading:!1,message:void 0})}},optInProductToLocker:async t=>{if(!e||!l)return m("User Locker not available"),!1;s({loading:!0,message:"Adding product to your User Locker"});try{let e=await l.optInProduct({productID:t});if(!e)return m("Failed to add product to locker"),!1;return d(e.txID,"Product added to your locker successfully!"),await c(),!0}catch(r){return q.v4(i=>{i.setTag("operation","locker.opt_in_product"),i.setExtra("chainType",n),i.setExtra("activeAddress",null!=e?e:null),i.setExtra("productID",String(t)),O.Cp(r)}),m("Failed to add product to locker: ".concat(r instanceof Error?r.message:"Unknown error")),!1}finally{s({loading:!1,message:void 0})}},optOutProductFromLocker:async t=>{if(!e||!l)return m("User Locker not available"),!1;s({loading:!0,message:"Removing product from your User Locker"});try{let e=await l.optOutProduct({productID:t});if(!e)return m("Failed to remove product from locker"),!1;return d(e.txID,"Product removed from your locker successfully!"),await c(),!0}catch(r){return q.v4(i=>{i.setTag("operation","locker.opt_out_product"),i.setExtra("chainType",n),i.setExtra("activeAddress",null!=e?e:null),i.setExtra("productID",String(t)),O.Cp(r)}),m("Failed to remove product from locker: ".concat(r instanceof Error?r.message:"Unknown error")),!1}finally{s({loading:!1,message:void 0})}},hasClaimedSubscription:e=>{var t,n;return!!a&&!!e&&[...null!=(t=a.nfts)?t:[],...null!=(n=a.assets)?n:[]].some(t=>t.index===BigInt(e))}}};var et=n(64684);let en=(e,t)=>
1{let[n,s]=(0,i.useState)(!1),{activeAddress:a,transactionSigner:o}=(0,u.vT)(),{chainType:l,setLoadingState:c}=(0,i.useContext)(W.Ay),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Transaction successful!";$.$e.show({title:"Success",message:(0,r.jsxs)(R(),{href:(0,K.A)(l,e,X.A.Transaction),target:"_blank",rel:"noopener noreferrer",children:[t," View on Transaction Explorer"]}),autoClose:!0,color:"green"})},m=e=>{$.$e.show({title:"Error",message:e,color:"red",autoClose:!1})};return{isProcessing:n,subscribe:async()=>{if(!a||!e||!o)return m("Wallet not connected"),!1;s(!0),c({loading:!0,message:"Please sign the subscription transaction in your wallet"});try{let n=await e.createSubscription({subscriber:{addr:H.pVw.fromString(a),signer:o}});if(!n)return m("Failed to create subscription"),!1;return d(n.txID,"Subscription created successfully!"),t&&await t(),!0}catch(e){return q.v4(t=>{t.setTag("operation","subscription.subscribe"),t.setExtra("chainType",l),t.setExtra("activeAddress",null!=a?a:null),O.Cp(e)}),m("Subscription failed: ".concat(e instanceof Error?e.message:"Unknown error")),!1}finally{s(!1),c({loading:!1,message:void 0})}},unsubscribe:async n=>{if(!a||!e||!o)return m("Wallet not connected"),!1;s(!0),c({loading:!0,message:"Please sign the unsubscription transaction in your wallet"});try{let r=await e.deleteSubscription({subscriber:{addr:H.pVw.fromString(a),signer:o},subscriptionID:n.subscriptionID});return d(r.txID,"Unsubscribed successfully!"),await new Promise(e=>{setTimeout(()=>e(),2e3)}),t&&await t(),!0}catch(e){return q.v4(t=>{t.setTag("operation","subscription.unsubscribe"),t.setExtra("chainType",l),t.setExtra("activeAddress",null!=a?a:null),t.setExtra("subscriptionID",String(n.subscriptionID)),O.Cp(e)}),m("Unsubscription failed: ".concat(e instanceof Error?e.message:"Unknown error")),!1}finally{s(!1),c({loading:!1,message:void 0})}},transferSubscription:async(n,r)=>{if(!a||!e||!o)return m("Wallet not connected"),!1;s(!0),c({loading:!0,message:"Please sign the transfer transaction in your wallet"});try{let i=await e.transferSubscription({newSubscriberAddress:H.pVw.fromString(r),oldSubscriber:{addr:H.pVw.fromString(a),signer:o},subscriptionID:n.subscriptionID});return d(i.txID,"Subscription transferred successfully!"),t&&await t(),!0}catch(e){return q.v4(t=>{t.setTag("operation","subscription.transfer"),t.setExtra("chainType",l),t.setExtra("activeAddress",null!=a?a:null),t.setExtra("subscriptionID",String(n.subscriptionID)),t.setExtra("newOwnerAddress",r),O.Cp(e)}),m("Transfer failed: ".concat(e instanceof Error?e.message:"Unknown error")),!1}finally{s(!1),c({loading:!1,message:void 0})}},claimSubscription:async n=>{if(!a||!e||!o)return m("Wallet not connected"),!1;s(!0),c({loading:!0,message:"Please sign the claim transaction in your wallet"});try{let r=await e.claimSubscription({subscriber:{addr:H.pVw.fromString(a),signer:o},subscriptionID:n.subscriptionID});return d(r.txID,"Subscription claimed successfully!"),t&&await t(),!0}catch(e){return q.v4(t=>{t.setTag("operation","subscription.claim"),t.setExtra("chainType",l),t.setExtra("activeAddress",null!=a?a:null),t.setExtra("subscriptionID",String(n.subscriptionID)),O.Cp(e)}),m("Claim failed: ".concat(e instanceof Error?e.message:"Unknown error")),!1}finally{s(!1),c({loading:!1,message:void 0})}}}};var er=n(41872),ei=n(65111),es=n(49729),ea=n(40813),eo=n.n(ea),el=n(71512),ec=n(65165);let ed=e=>{var t,n,i,s;let{price:a,showExpiryDate:o=!0,isExpired:l=!1,expirationTimestamp:c}=e;return a?(0,r.jsxs)(el.r,{cols:1,spacing:"xs",style:{justifyItems:"center"},children:[(0,r.jsx)(ec.C,{mt:2,inline:!0,label:"".concat(0n===a.value?"Free":(null==(t=a.discount)?void 0:t.discountType)===p.oQ.FIXED?"Discount applied":"".concat(null==(n=a.discount)?void 0:n.discountValue,"% discount")),disabled:!a.discount,size:16,children:(0,r.jsx)(b.Text,{fw:900,fz:40,style:{display:"flex",alignItems:"center",maxWidth:"100%",overflowWrap:"anywhere"},children:a.discount&&a.discount.discountType===p.oQ.FIXED&&a.value>0n?(0,r.jsxs)(r.Fragment,{children:[a.value," (",(0,r.jsx)("del",{children:a.basePrice}),") ",a.asset.unitName]}):"".concat(a.value," ").concat(null!=(s=null!=(i=a.asset.unitName)?i:a.asset.name)?s:a.asset.amount)})}),(0,r.jsx)(w.Group,{justify:"center",mb:"sm",dir:"col",fs:"italic",fw:"500",children:l&&c?(0,r.jsxs)(b.Text,{c:"red",children:["Expired on ",eo().unix(c).utc().format("MMM D, YYYY HH:mm")," UTC"]}):o?a.duration?"Valid for ".concat(U(a.duration)):"Lifetime access":null})]}):(0,r.jsx)(ei.E,{h:"100%",w:"60%",children:(0,r.jsx)("div",{style:{position:"relative",height:100}})})};function eu(e){let{product:t,refreshSubscriptionBox:n,price:s}=e,{profile:a}=(0,_.x)(),{balance:o}=(0,C.A)(),l=ee(),c=en(t.client,async()=>{await n()}),[d,u]=(0,i.useState)(!0),m=(0,i.useMemo)(()=>o?o.rawAmount:0n,[o]),x=(0,i.useMemo)(()=>
1{if(0n===t.state.coinID)return{index:0n,creator:"",name:"Algo",imageUrl:"",decimals:6n,unitName:"Algo",amount:m,frozen:!1,total:0n};let e=null==a?void 0:a.assets.find(e=>e.index===BigInt(t.state.coinID));if(e)return e},[a,m,t.state.coinID]),h=async()=>{try{if(d&&!l.hasUserLocker&&!await l.createUserLocker()||!await c.subscribe())return;d&&l.hasUserLocker&&await l.optInProductToLocker(BigInt(t.client.appID)),(0,Z.s7)()}catch(e){}};return(0,r.jsxs)(r.Fragment,{children:[!a&&(0,r.jsx)("br",{}),(0,r.jsxs)(ei.E,{visible:!a&&!x,radius:"lg",children:[s&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(w.Group,{justify:"center",mt:"lg",dir:"col",children:(0,r.jsx)(ed,{price:s})})}),(0,r.jsx)("div",{style:{fontSize:"var(--mantine-font-size-xs)",margin:"var(--mantine-spacing-md)"},children:(0,r.jsxs)("ul",{style:{margin:0,paddingLeft:"1.2rem"},children:[(0,r.jsxs)("li",{children:["Proceeding will initiate your subscription to"," ",(0,r.jsx)("strong",{children:t.state.productName})," for the defined period."]}),t.state.duration!==p.dw.UNLIMITED&&(0,r.jsx)("li",{children:"Subscriptions can be renewed upon expiration or cancellation by returning to this page and processing a new payment."}),(0,r.jsx)("li",{children:"Subscriptions do not auto-renew. Manual renewal is required before expiration to maintain access."}),(0,r.jsx)("li",{children:"By confirming, you agree to our terms and conditions."})]})}),(0,r.jsx)(j.m,{color:"dark",label:"Make visible in user portal, additional fee for locker setup.",children:(0,r.jsx)(es.S,{m:"md",label:"Add to my subscriptions dashboard",checked:d,onChange:e=>u(e.currentTarget.checked)})}),(0,r.jsxs)(w.Group,{grow:!0,children:[!l.hasUserLocker&&d&&(0,r.jsx)(y.Button,{"data-testid":"create-user-locker-button",m:"md",onClick:l.createUserLocker,disabled:!l.canOptInToLocker,children:"Initialize locker"}),(0,r.jsx)(y.Button,{m:"md",onClick:h,disabled:!s.duration&&Number(s.duration)!==Number(p.dw.UNLIMITED)||!x||c.isProcessing||!l.hasUserLocker&&d||!l.hasUserLocker&&d&&!l.canOptInToLocker,loading:c.isProcessing,children:"Confirm"})]})]})]})}function em(e){let{productID:t}=e,[n,L]=(0,i.useState)(!1),{activeAddress:Y}=(0,u.vT)(),{balance:q}=(0,C.A)(),{product:J,productLoading:ei,productError:es,retryProductLoad:ea,maxSubsLimitReached:eo,subscriptionStatus:el,algoRawAmount:ec,profile:ed,lockerIntegration:em,handleSubscribe:ep,handleUnsubscribe:ex,handleTransfer:eh,handleVanityClaim:ef,handleOptIn:eg}=(e=>{let{activeAddress:t}=(0,u.vT)(),{chainType:n}=(0,i.useContext)(W.Ay),{balance:s}=(0,C.A)(),{profile:a}=(0,_.x)(),{product:o,isLoading:l,error:c,retryLoading:d}=(e=>{let[t,n]=(0,i.useState)(null),[r,s]=(0,i.useState)(!1),[a,o]=(0,i.useState)(null),{chainType:l}=(0,i.useContext)(W.Ay),c=(0,i.useCallback)(async()=>{if(!r){s(!0),o(null);try{let t=await (0,et.BA)(l),r=await p.HF.init({algodClient:(0,V.u9)(l),chainType:l,productID:BigInt(e),creator:{addr:"string"==typeof t?H.pVw.fromString(t):t,signer:(0,H.WZG)()}}),i=await r.getAppState(!1);n({state:i,client:r}),o(null)}catch(e){o("Subscription Product not found"),n(null)}finally{s(!1)}}},[l,e,r]);return(0,i.useEffect)(()=>{t||r||a||c()},[e,l,t,r,a,c]),{product:t,isLoading:r,error:a,retryLoading:()=>{c()}}})(e),m=async()=>{await Promise.all([x.refreshSubscriptionStatus()])},x=((e,t)=>{let[n,r]=(0,i.useState)(null),[s,a]=(0,i.useState)(!1),[o,l]=(0,i.useState)(null),{chainType:c}=(0,i.useContext)(W.Ay),d=(0,i.useCallback)(async()=>{if(!e||!t){r(null),a(!1);return}a(!0),l(null);try{let n=await e.getSubscription({algodClient:(0,V.u9)(c),subscriberAddress:H.pVw.fromString(t)});r(n||null)}catch(e){r(null),l(null)}finally{a(!1)}},[e,t,c]),u=async()=>{await d()},m=(0,i.useMemo)(()=>!!n&&(!n.expiresAt||Number(n.expiresAt)>(0,er.A)().utc().unix()),[n]),p=(0,i.useMemo)(()=>!!(null==n?void 0:n.expiresAt)&&Number(n.expiresAt)<=(0,er.A)().utc().unix(),[n]),x=(0,i.useMemo)(()=>
1{if(!t)return"Connect wallet to check subscription";if(!n)return"Not subscribed";if(!n.expiresAt)return"Lifetime access";if(Number(n.expiresAt)<=(0,er.A)().utc().unix())return null;let e=Number(n.expiresAt)-(0,er.A)().utc().unix(),r=Math.floor(e/86400),i=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return r>0?"".concat(r,"d ").concat(i,"h remaining"):i>0?"".concat(i,"h ").concat(s,"m remaining"):s>0?"".concat(s,"m remaining"):"Expires soon"},[n,t]);return(0,i.useEffect)(()=>{d()},[d]),{subscriptionBox:n,isLoading:s,error:o,isSubscribed:m,isExpired:p,timeLeft:x,refreshSubscriptionStatus:u}})((null==o?void 0:o.client)||null,t),h=en((null==o?void 0:o.client)||null,m),f=ee(),g=(0,i.useMemo)(()=>o?(0,K.A)(n,String(o.client.appID),X.A.Application):"",[o,n]),w=(0,i.useMemo)(()=>!!o&&0n!==o.state.maxSubs&&o.state.totalSubs>=o.state.maxSubs,[o]);return{product:o,productLoading:l,productError:c,retryProductLoad:d,productExplorerUrl:g,maxSubsLimitReached:w,subscriptionStatus:x,algoRawAmount:(0,i.useMemo)(()=>{if(a&&s)return s.rawAmount},[a,s]),profile:a,lockerIntegration:f,handleSubscribe:e=>{if(!o||!t)return;let n=async()=>{await x.refreshSubscriptionStatus()};(0,Z.qf)({title:"Please confirm",centered:!0,children:(0,r.jsx)(eu,{product:o,price:e,refreshSubscriptionBox:n})})},handleUnsubscribe:()=>{x.subscriptionBox&&(0,Z.GE)({title:"Are you sure?",centered:!0,children:(0,r.jsxs)(b.Text,{size:"sm",children:["Clicking confirm will unsubscribe you from"," ",(0,r.jsx)(R(),{href:g,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:null==o?void 0:o.state.productName}),". Please note, that you will not be able to use the service until you subscribe again and you will not receive a refund for subscription! Lastly, clicking confirm will also assume that you have read and agree to the"," ",(0,r.jsx)(R(),{href:"/terms",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:"terms and conditions"}),"."]}),labels:{confirm:"Confirm",cancel:"Cancel"},onConfirm:async()=>{x.subscriptionBox&&(await h.unsubscribe(x.subscriptionBox),(0,Z.s7)())}})},handleTransfer:()=>{var e,t;if(!x.subscriptionBox)return;let i="",s=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Q.k,{label:"New owner",placeholder:"Enter Algorand wallet address","data-autofocus":!0,mb:2,onChange:e=>{i=e.target.value}}),(0,r.jsxs)(b.Text,{size:"sm",mt:5,pt:2,children:["Clicking confirm will transfer the"," ",(0,r.jsx)(R(),{href:(0,K.A)(n,String(null==(e=x.subscriptionBox)?void 0:e.subscriptionID),X.A.Asset),target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:null==(t=x.subscriptionBox)?void 0:t.subscriptionID}),". Please note, clicking confirm will also assume that you have read and agree to the"," ",(0,r.jsx)(R(),{href:"/terms",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:"terms and conditions"}),"."]}),(0,r.jsx)(y.Button,{fullWidth:!0,onClick:async()=>{if(!i||58!==i.length)return void $.$e.show({title:"Error",message:"Please enter a valid Algorand Wallet address",color:"red"});x.subscriptionBox&&await h.transferSubscription(x.subscriptionBox,i.trim())&&(0,Z.s7)()},mt:"md",children:"Confirm and transfer"})]});(0,Z.qf)({centered:!0,title:"Transfer ownership",children:s})},handleVanityClaim:()=>{var e,t;if(!x.subscriptionBox)return;let i=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(b.Text,{size:"sm",children:["Confirming will transfer the"," ",(0,r.jsx)(R(),{href:(0,K.A)(n,String(null==(e=x.subscriptionBox)?void 0:e.subscriptionID),X.A.Asset),target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:null==(t=x.subscriptionBox)?void 0:t.subscriptionID})," ","to your wallet. Note, you can't sell the Asset on marketplaces since the product owner reserve rights to clawback the Asset if you unsubscribe or your subscription is expired. A dedicated Marketplace on Subtopia will be available for selling subscriptions in later versions. Confirming also means you agree to the"," ",(0,r.jsx)(R(),{href:"/terms",target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",color:"cyan"},children:"terms and conditions"}),"."]}),(0,r.jsx)(y.Button,{fullWidth:!0,onClick:async()=>{x.subscriptionBox&&await h.claimSubscription(x.subscriptionBox)&&(0,Z.s7)()},mt:"md",children:"Confirm and claim"})]});(0,Z.qf)({title:"Send to my wallet",children:i,centered:!0})},handleOptIn:()=>{(0,Z.GE)({title:"Are you sure?",centered:!0,labels:{confirm:"Confirm",cancel:"Cancel"},onConfirm:async()=>{await f.optInProductToLocker(e)},children:(0,r.jsxs)(b.Text,{size:"sm",children:["By confirming, you'll add this ",(0,r.jsx)("b",{children:"Product"})," to your ",(0,r.jsx)("b",{children:"User Locker"}),". All subscriptions bought from this product can then be managed from the ",(0,r.jsx)("b",{children:"Subscriptions"})," ","page on the ",(0,r.jsx)("b",{children:"Creator Portal"}),". This is a one-time setup. Once a product is added, you won't need to do it again for the same product."]})})},isPerformingAction:h.isProcessing}})(t),{mappedComputedPrices:eb,coinAsset:ey}=function(e){var t,n,r;let[s,a]=(0,i.useState)({}),[o,l]=(0,i.useState)("loading"),c=(0,i.useRef)(!1),{chainType:d}=(0,i.useContext)(W.Ay),{profile:u}=(0,_.x)(),{balance:m}=(0,C.A)(),x=(0,i.useMemo)(()=>{var t;if(!u||!(null==e?void 0:e.state))return 0n;let n=u.assets.find(t=>t.index===e.state.coinID);return null!=(t=null==n?void 0:n.amount)?t:0n},[u,null==e?void 0:e.state]),[h,f]=(0,i.useState)(void 0),g=(0,i.useMemo)(()=>
1{if(null==e?void 0:e.state)return e.state.duration},[null==e?void 0:e.state]);(0,i.useEffect)(()=>{(async()=>{if(!(null==e?void 0:e.state)){f(void 0),l("loading"),c.current=!1;return}if(0n===e.state.coinID){var t;f({index:0n,decimals:6n,unitName:"ALGO",amount:null!=(t=null==m?void 0:m.rawAmount)?t:0n}),l("confirmed"),c.current=!1}else try{let t=await (0,G.L)((0,V.u9)(d),BigInt(e.state.coinID),E.r.PINATA);t?(f({...t,amount:x}),l("confirmed"),c.current=!1):(O.wd("Failed to fetch asset ".concat(e.state.coinID,", using fallback"),"warning"),f((0,P.pO)(e.state.coinID,x)),l("fallback"),c.current||(O.wd("Fallback decimals used for asset",{level:"warning",extra:{assetId:e.state.coinID,productId:e.client.appID,chainType:d,decimals:6}}),c.current=!0))}catch(t){O.Cp(t),f((0,P.pO)(e.state.coinID,x)),l("fallback"),c.current||(O.wd("Fallback decimals used for asset",{level:"warning",extra:{assetId:e.state.coinID,productId:e.client.appID,chainType:d,decimals:6}}),c.current=!0)}})()},[null==e||null==(t=e.state)?void 0:t.coinID,null==e?void 0:e.state,null==e||null==(n=e.client)?void 0:n.appID,d,null==m?void 0:m.rawAmount,x]),(0,i.useEffect)(()=>{(async()=>{var t;if(!(null==e?void 0:e.state)||!h||void 0===g||Object.keys(s).length>0)return;let n="confirmed"===o||(null==e||null==(t=e.state)?void 0:t.coinID)===0n;(0,P.uV)(n,e.state.coinID,"price computation");let r=async()=>{var t,n,r;let{discount:i}=null!=(n=null==e?void 0:e.state)?n:{},s=null!=(r=null==e||null==(t=e.state)?void 0:t.price)?r:0n,a=s;i||(i=await e.client.getDiscount());let{discountedRaw:o}=(0,P.w9)(s,i);return a=(0,P.GY)(o,Number(h.decimals),4),s=(0,P.GY)(s,Number(h.decimals),2),{title:function(e){switch(e){case p.dw.MONTH:return"Monthly";case p.dw.QUARTER:return"Quarterly";case p.dw.SEMI_ANNUAL:return"Semi-Annual";case p.dw.ANNUAL:return"Annual";case p.dw.DAY:return"Day"}return 604800===Number(e)?"Week":"Unlimited"}(g),value:a,rawValue:o,basePrice:s,duration:g,discount:i,asset:h}},i=await r();a({[String(g)]:i})})()},[g,null==e?void 0:e.state,null==e?void 0:e.client,h,s,o]);let b=(0,i.useMemo)(()=>h&&0n!==h.index?(0,P.GY)(h.amount,Number(h.decimals)):0n,[h]);return{mappedComputedPrices:s,asaBalance:b,algoBalance:m,coinAsset:h,decimalsReady:"confirmed"===o||(null==e||null==(r=e.state)?void 0:r.coinID)===0n,fallbackDecimalsUsed:"fallback"===o}}(J||void 0),[ew,ev]=(0,i.useState)(void 0),ej=(0,i.useMemo)(()=>{if(void 0!==ew)return eb[ew]},[ew,eb]),ek=(0,i.useMemo)(()=>{var e;if(!ey||!ej||!ed||!ec)return!0;let t=0n===ey.index?ec:ey.amount;return 0n===ey.index?!(0,P.O7)(t,null!=(e=null==q?void 0:q.minBalance)?e:0n,ej.rawValue):!(0,P.n_)(t,ej.rawValue)},[ey,ej,ed,ec,null==q?void 0:q.minBalance]),{isSubscribed:eA,isExpired:eI,timeLeft:eS,subscriptionBox:eT}=el;return((0,i.useEffect)(()=>{J&&ev(String(J.state.duration))},[J]),es)?(0,r.jsx)(x.Container,{size:"xs",px:"xs",children:(0,r.jsx)(h.Z,{shadow:"sm",padding:"lg",radius:"md",withBorder:!0,bg:"dark.8",children:(0,r.jsxs)(f.B,{align:"center",gap:"md",children:[(0,r.jsx)(g.Title,{order:3,c:"red",children:"Error"}),(0,r.jsx)(b.Text,{c:"red",ta:"center",children:es}),(0,r.jsx)(y.Button,{onClick:ea,variant:"outline",children:"Try Again"})]})})}):ei?(0,r.jsx)(x.Container,{size:"xs",px:"xs",children:(0,r.jsxs)(f.B,{align:"center",gap:"md",children:[(0,r.jsx)(g.Title,{order:3,style:{fontFamily:B().style.fontFamily}
1,children:"Subtopia.io"}),(0,r.jsx)(m.P.div,{initial:{scale:1},animate:{scale:[1,1.1,1]},transition:{duration:1,ease:"easeInOut",repeat:1/0},children:(0,r.jsx)(b.Text,{style:{fontFamily:B().style.fontFamily},children:"Loading Product..."})})]})}):J?el.error?(0,r.jsx)(x.Container,{size:"xs",px:"xs",children:(0,r.jsxs)(f.B,{align:"center",gap:"md",children:[(0,r.jsx)(g.Title,{order:3,style:{fontFamily:B().style.fontFamily},children:"Subtopia.io"}),(0,r.jsx)(b.Text,{c:"red",ta:"center",children:"Error loading subscription details"}),(0,r.jsx)(y.Button,{onClick:()=>el.refreshSubscriptionStatus(),variant:"outline",children:"Try Again"})]})}):(0,r.jsxs)(x.Container,{size:"xs",px:"xs",children:[(0,r.jsx)(D._,{opened:n,centered:!0,setOpened:L}),(0,r.jsxs)(h.Z,{shadow:"sm",padding:"lg",radius:"md",withBorder:!0,bg:"dark.8",className:"transition-all duration-200 hover:transform hover:scale-102",children:[(0,r.jsx)(h.Z.Section,{children:(0,r.jsxs)(w.Group,{justify:"space-between",p:"sm",children:[(0,r.jsx)(b.Text,{size:"sm",fw:500,c:"dimmed",style:{fontFamily:B().style.fontFamily},children:"SUBTOPIA.IO"}),(0,r.jsxs)(v.W,{position:"bottom-end",shadow:"sm",children:[(0,r.jsx)(v.W.Target,{children:(0,r.jsx)(j.m,{label:"More options",children:(0,r.jsx)(k.M,{variant:"subtle",color:"gray",children:(0,r.jsx)(s.A,{style:{width:(0,A.D)(16),height:(0,A.D)(16)},"data-testid":"manage-sub-btn"})})})}),(0,r.jsxs)(v.W.Dropdown,{children:[(0,r.jsx)(v.W.Item,{onClick:eg,disabled:!Y||!eT||em.isLockerOptedIn(t),leftSection:(0,r.jsx)(a.A,{style:{width:(0,A.D)(14),height:(0,A.D)(14)}}),children:"Opt-in to locker"}),(0,r.jsx)(v.W.Item,{onClick:ef,disabled:!Y||!eT||em.hasClaimedSubscription((null==eT?void 0:eT.subscriptionID)||0n),leftSection:(0,r.jsx)(o.A,{style:{width:(0,A.D)(14),height:(0,A.D)(14)}}),children:"Send to my wallet"}),(0,r.jsx)(v.W.Item,{onClick:eh,disabled:!Y||!eT,leftSection:(0,r.jsx)(l.A,{style:{width:(0,A.D)(14),height:(0,A.D)(14)}}),children:"Transfer ownership"}),(0,r.jsx)(v.W.Item,{onClick:()=>{L(!n)},leftSection:(0,r.jsx)(c.A,{style:{width:(0,A.D)(14),height:(0,A.D)(14)}}),children:Y?"Account":"Login"})]})]})]})}),(0,r.jsx)(h.Z.Section,{p:"md",pos:"relative",children:(0,r.jsx)(I._,{src:(0,N.z)(J.state.imageURL,E.r.PINATA),fit:"contain",crossOrigin:"anonymous",alt:"Subscription product image",referrerPolicy:"no-referrer",loading:"lazy",h:"220px",radius:"md",style:{borderRadius:"var(--mantine-radius-md)",background:"linear-gradient(135deg, var(--mantine-color-dark-9), var(--mantine-color-dark-9))",padding:"var(--mantine-spacing-sm)",pointerEvents:"none",mixBlendMode:"normal"},fallbackSrc:"data:image/svg+xml;base64,".concat((0,z.n)((0,F.i)(240,240)))})}),(0,r.jsxs)(f.B,{gap:"xs",mt:"md",children:[(0,r.jsx)(g.Title,{order:2,fw:700,size:"h4",children:J.state.productName}),(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:J.state.subscriptionName}),eS&&(0,r.jsxs)(w.Group,{gap:"xs",children:[(0,r.jsx)(d.A,{style:{width:(0,A.D)(16),height:(0,A.D)(16)}}),(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:eS})]})]}),(0,r.jsxs)(S.x,{grow:!0,gutter:"sm",mt:"md",children:[(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"ID"}),(0,r.jsx)(b.Text,{fw:500,children:J.client.appID})]})}),(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"Name"}),(0,r.jsx)(b.Text,{fw:500,children:J.state.productName})]})}),(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"Type"}),(0,r.jsx)(T.E,{variant:"light",radius:"sm",children:(0,M.s)(J.state.productType)})]})}),(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"Duration"}),(0,r.jsx)(T.E,{variant:"light",radius:"sm",children:U(J.state.duration)})]})}),(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"Price"}),J.state.discount?(0,r.jsxs)(w.Group,{gap:4,children:[(0,r.jsx)(b.Text,{fw:500,c:"dimmed",td:"line-through",fz:"sm",children:(0,P.GY)(J.state.price,(null==ey?void 0:ey.decimals)!==void 0?Number(ey.decimals):6,1)}),(0,r.jsx)(b.Text,{fw:500,children:(()=>{let{discountedRaw:e}=(0,P.w9)(J.state.price,J.state.discount);return(0,P.GY)(e,(null==ey?void 0:ey.decimals)!==void 0?Number(ey.decimals):6,1)})()}),(0,r.jsxs)(b.Text,{fz:"xs",c:"dimmed",children:["(",J.state.discount.discountType===p.oQ.FIXED?"Discount applied":"".concat(J.state.discount.discountValue,"% off"),")"]})]}):(0,r.jsx)(b.Text,{fw:500,children:0n===J.client.price?"Free":(0,P.GY)(J.client.price,(null==ey?void 0:ey.decimals)!==void 0?Number(ey.decimals):6)})]})}),(0,r.jsx)(S.x.Col,{span:6,children:(0,r.jsxs)(f.B,{gap:0,children:[(0,r.jsx)(b.Text,{size:"sm",c:"dimmed",children:"Asset"}),(0,r.jsx)(b.Text,{fw:500,children:0n===J.state.coinID?"Algo":"ASA ".concat(J.state.coinID)})]})})]}),eo&&!eA&&(0,r.jsx)(b.Text,{c:"red",ta:"center",mt:"md",children:"Maximum number of active subscribers reached"}),(0,r.jsx)(y.Button,{fullWidth:!0,color:eT?eI?void 0:"red":void 0,mt:"xl",onClick:()=>
1{if(!Y)return void L(!0);eT&&!eI?ex():ep(ej)},disabled:(!eT||!!eI)&&(eo&&!eA||ek&&null!==Y),loading:!J,children:eT?eI?"Renew subscription":"Cancel subscription":ek&&null!==Y?"Insufficient funds":"Subscribe"})]})]}):null}},50295:(e,t,n)=>{n.d(t,{i:()=>r});let r=(e,t)=>'\n<svg width="'.concat(e,'" height="').concat(t,'" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n  <defs>\n    <linearGradient id="g">\n      <stop stop-color="#333" offset="20%" />\n      <stop stop-color="#222" offset="50%" />\n      <stop stop-color="#333" offset="70%" />\n    </linearGradient>\n  </defs>\n  <rect width="').concat(e,'" height="').concat(t,'" fill="#333" />\n  <rect id="r" width="').concat(e,'" height="').concat(t,'" fill="url(#g)" />\n  <animate xlink:href="#r" attributeName="x" from="-').concat(e,'" to="').concat(e,'" dur="1s" repeatCount="indefinite"  />\n</svg>')},96936:(e,t,n)=>{n.d(t,{_:()=>a});var r=n(79175),i=n(71060),s=n(46620);function a(e){let{opened:t,setOpened:n,centered:a}=e;return(0,r.jsx)(i.a,{withCloseButton:!0,opened:t,centered:a,onClose:()=>n(!1),children:(0,r.jsx)(s.E,{setOpened:n})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.