@luno-kit/ui 0.0.4 → 0.0.6
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/README.md +7 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/README.md
ADDED
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";var St=Object.create;var le=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var Tt=(e,o)=>{for(var t in o)le(e,t,{get:o[t],enumerable:!0})},Qe=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Mt(o))!At.call(e,n)&&n!==t&&le(e,n,{get:()=>o[n],enumerable:!(r=Nt(o,n))||r.enumerable});return e};var K=(e,o,t)=>(t=e!=null?St(kt(e)):{},Qe(o||!e||!e.__esModule?le(t,"default",{value:e,enumerable:!0}):t,e)),Rt=e=>Qe(le({},"__esModule",{value:!0}),e);var jt={};Tt(jt,{ConnectButton:()=>ct,LunoKitProvider:()=>Qt,useAccountModal:()=>Y,useChainModal:()=>ee,useCloseAllModals:()=>Je,useConnectModal:()=>X,useLunoTheme:()=>ze});module.exports=Rt(jt);var ie=require("react"),Q=require("@luno-kit/react");var ce=K(require("react"),1),I=K(require("@radix-ui/react-dialog"),1);var Ue=require("clsx"),je=require("tailwind-merge"),Pt=(0,je.extendTailwindMerge)({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return Pt((0,Ue.clsx)(e))}function qe(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}var oe=require("react/jsx-runtime"),Vt=({open:e,onOpenChange:o,children:t,contentClassName:r,overlayClassName:n})=>(0,oe.jsx)(I.Root,{open:e,onOpenChange:o,children:(0,oe.jsxs)(I.Portal,{children:[ce.default.createElement(I.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",n)}),(0,oe.jsx)(I.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",r),children:t})]})}),It=({children:e,className:o})=>ce.default.createElement(I.Title,{className:o},e),Bt=({children:e,className:o,onClick:t})=>ce.default.createElement(I.Close,{className:o,onClick:t},e),J=Vt,$=Bt,Z=It;var S=require("react"),U=require("@luno-kit/react"),Xe=require("react/jsx-runtime");function ye(){let[e,o]=(0,S.useState)(!1),t=(0,S.useCallback)(()=>o(!0),[]),r=(0,S.useCallback)(()=>o(!1),[]);return{isOpen:e,open:t,close:r}}var ne=(0,S.createContext)(void 0),Ke=({children:e})=>{let{isOpen:o,open:t,close:r}=ye(),{isOpen:n,open:a,close:i}=ye(),{isOpen:m,open:f,close:u}=ye(),h=(0,U.useStatus)(),l=(0,S.useCallback)(()=>{r(),i(),u()},[r,i,u]);(0,S.useEffect)(()=>{h===U.ConnectionStatus.Disconnected&&(i(),u())},[h,i,u]);let s=(0,S.useMemo)(()=>({isConnectModalOpen:o,isAccountModalOpen:n,isChainModalOpen:m,openConnectModal:h!==U.ConnectionStatus.Connected?t:void 0,closeConnectModal:r,openAccountModal:h===U.ConnectionStatus.Connected?a:void 0,closeAccountModal:i,openChainModal:h===U.ConnectionStatus.Connected?f:void 0,closeChainModal:u,closeAllModals:l}),[o,t,r,n,a,i,m,f,u,l,h]);return(0,Xe.jsx)(ne.Provider,{value:s,children:e})},X=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},Y=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},ee=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Je=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};var Se=require("react/jsx-runtime"),Et=e=>(0,Se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Se.jsx)("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"})}),re=Et;var Ne=require("react/jsx-runtime"),Dt=e=>(0,Ne.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Ne.jsx)("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),G=Dt;var Me=require("react/jsx-runtime"),Lt=e=>(0,Me.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Me.jsx)("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"})}),ke=Lt;var Ae=require("react/jsx-runtime"),Ot=e=>(0,Ae.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:(0,Ae.jsx)("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"})}),Te=Ot;var Re=require("react/jsx-runtime"),_t=e=>(0,Re.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Re.jsx)("path",{d:"M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z"})}),Pe=_t;var Ve=require("react/jsx-runtime"),Ht=e=>(0,Ve.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Ve.jsx)("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),Ie=Ht;var Be=require("react/jsx-runtime"),Gt=e=>(0,Be.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:(0,Be.jsx)("path",{d:"M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z"})}),Ee=Gt;var et=require("react");var De=require("react/jsx-runtime"),te=({chainIconUrl:e,chainName:o,className:t})=>e?(0,De.jsx)("img",{src:e,alt:o||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):(0,De.jsx)("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});var z=require("@luno-kit/react"),C=require("react/jsx-runtime"),tt=({onViewChange:e,onModalClose:o})=>{let{address:t}=(0,z.useAccount)(),{chain:r}=(0,z.useChain)(),{disconnectAsync:n}=(0,z.useDisconnect)(),a=(0,et.useMemo)(()=>[{key:"Chain Name",content:(0,C.jsx)("div",{className:"flex items-stretch w-full justify-between",children:(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("div",{className:"relative",children:(0,C.jsx)(te,{className:"w-[20px] h-[20px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name})}),(0,C.jsx)("span",{className:"text-base text-modalText",children:r?.name||"Polkadot"})]})}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Pe,{}),(0,C.jsx)("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open((0,z.getExplorerUrl)(r?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Ee,{}),(0,C.jsx)("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,r,t]),i=async()=>{await n(),o()};return(0,C.jsxs)("div",{className:"flex flex-col items-center gap-3 w-full",children:[(0,C.jsx)("div",{className:"flex flex-col gap-1.5 w-full px-4",children:a.map(m=>(0,C.jsx)(Ye,{onClick:m.onClick,children:m.content},m.key))}),(0,C.jsx)("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),(0,C.jsx)("div",{className:"w-full px-4 pb-4",children:(0,C.jsxs)(Ye,{onClick:i,children:[(0,C.jsx)(Te,{}),(0,C.jsx)("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},Ye=({children:e,onClick:o})=>(0,C.jsx)("button",{type:"button",onClick:()=>o?.(),className:d("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});var de=K(require("react"),1),O=require("@luno-kit/react");var ot=require("@luno-kit/react"),N=require("react/jsx-runtime"),Le=({onBack:e})=>{let{accounts:o,selectAccount:t}=(0,O.useAccounts)(),{address:r}=(0,O.useAccount)(),n=(0,de.useCallback)(a=>{t(a),e()},[e]);return(0,N.jsx)("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>(0,N.jsx)(Ft,{account:a,isSelected:a.address===r,selectAccount:n},a.address))})};Le.title="Switch Accounts";var Ft=de.default.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:r}=(0,O.useChain)(),n=o.address,{data:a}=(0,O.useBalance)({address:n}),i=(0,O.useActiveConnector)();return(0,N.jsxs)("button",{type:"button",onClick:()=>t(o),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":o.name||n,disabled:e,children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&(0,N.jsx)("img",{src:i?.icon,alt:"luno account"})}),(0,N.jsxs)("div",{className:"flex flex-col items-start",children:[(0,N.jsx)("span",{className:"font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||(0,ot.formatAddress)(n)}),(0,N.jsx)("span",{className:"text-xs text-modalTextSecondary font-medium",children:a===void 0?(0,N.jsx)("div",{className:"animate-pulse rounded w-[60px] h-[18px] bg-skeleton"}):(0,N.jsxs)(N.Fragment,{children:[a?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}),e&&(0,N.jsx)("div",{className:"border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:(0,N.jsx)("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});var j=K(require("react"),1);var W=require("@luno-kit/react");var v=require("react/jsx-runtime");var $t=[{key:"All",label:"All"},{key:"Mainnets",label:"Mainnets"},{key:"Testnets",label:"Testnets"}],me=({onChainSwitched:e})=>{let{chain:o}=(0,W.useChain)(),t=(0,W.useChains)(),{switchChainAsync:r}=(0,W.useSwitchChain)(),{isApiReady:n,apiError:a}=(0,W.useApi)(),[i,m]=(0,j.useState)("All"),[f,u]=(0,j.useState)(null),h=(0,j.useMemo)(()=>{switch(i){case"Mainnets":return t.filter(s=>!s.testnet);case"Testnets":return t.filter(s=>s.testnet);case"All":default:return t}},[t,i]),l=async s=>{if(s.genesisHash!==o?.genesisHash&&!(!n&&!a)){u(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(c){console.error("Failed to switch chain:",c)}finally{u(null)}}};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"flex items-center gap-1.5 w-full",children:$t.map(s=>(0,v.jsx)("button",{onClick:()=>m(s.key),className:d("px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",i===s.key?"bg-navigationButtonBackground text-modalText":"bg-transparent text-modalTextSecondary hover:text-modalText"),children:s.label},s.key))}),(0,v.jsx)("div",{className:"flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]",children:h.map(s=>(0,v.jsx)(Zt,{chain:s,isSelected:s.genesisHash===o?.genesisHash,onSelect:l,isLoading:(f===s.genesisHash||!n)&&!a},s.genesisHash))}),h.length===0&&(0,v.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,v.jsxs)("span",{className:"text-modalTextSecondary text-xs",children:["No ",i==="All"?"chains":i.toLowerCase()," available"]})})]})},Zt=j.default.memo(({chain:e,isSelected:o,isLoading:t,onSelect:r})=>(0,v.jsxs)("button",{onClick:()=>r(e),disabled:o||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(te,{className:"w-[20px] bg-modal-bg h-[20px] flex items-center justify-center",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),(0,v.jsx)("div",{className:"flex flex-col items-start",children:(0,v.jsx)("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),(0,v.jsx)("div",{className:"flex items-center justify-center h-[20px]",children:o?t?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:"Switching"}),(0,v.jsx)("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):(0,v.jsxs)("span",{className:"status-dot-container",children:[(0,v.jsx)("span",{className:"ping-animation"}),(0,v.jsx)("span",{className:"status-dot"})]}):null})]}));var Oe=require("react/jsx-runtime"),ue=({onBack:e})=>(0,Oe.jsx)("div",{className:"flex flex-col gap-3.5 p-4 pt-0",children:(0,Oe.jsx)(me,{})});ue.title="Select Networks";var pe=require("react");var ae=require("react/jsx-runtime"),fe=({copyText:e,label:o,className:t=""})=>{let[r,n]=(0,pe.useState)(!1),a=(0,pe.useCallback)(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),n(!0),setTimeout(()=>n(!1),2e3),!0):!1}catch(m){return console.error("Copy failed:",m),!1}},[]);return(0,ae.jsxs)("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?(0,ae.jsx)(Ie,{className:"text-accentColor",width:16,height:16}):(0,ae.jsx)(ke,{width:16,height:16}),o]})};var nt=require("@luno-kit/react");var F=require("react");function he({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[r,n]=(0,F.useState)(e),[a,i]=(0,F.useState)(!1),m=(0,F.useRef)(null),f=(0,F.useRef)(null),u=(0,F.useCallback)(l=>{if(l===r||a)return;if(i(!0),!m.current){n(l),i(!1);return}let s=m.current,c=s.offsetHeight;n(l),requestAnimationFrame(()=>{if(!s||!f.current){i(!1);return}let w=f.current.offsetHeight;s.animate([{height:c+"px"},{height:w+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,o,t]),h=(0,F.useCallback)(()=>{n(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:m,currentViewRef:f,handleViewChange:u,resetView:h}}var x=require("react/jsx-runtime");var rt=()=>{let{isOpen:e,close:o}=Y(),{address:t}=(0,Q.useAccount)(),{chain:r}=(0,Q.useChain)(),{data:n}=(0,Q.useBalance)({address:t}),a=(0,Q.useActiveConnector)(),{currentView:i,containerRef:m,currentViewRef:f,handleViewChange:u,resetView:h}=he({initialView:"main"}),l=(0,ie.useCallback)(()=>{o(),h()},[o]),s=(0,ie.useMemo)(()=>i==="switchAccount"?"Switch Account":i==="switchChain"?ue.title:null,[i]),c=(0,ie.useMemo)(()=>({main:(0,x.jsx)(tt,{onViewChange:u,onModalClose:l}),switchAccount:(0,x.jsx)(Le,{onBack:()=>u("main")}),switchChain:(0,x.jsx)(ue,{onBack:()=>u("main")})}),[u,l]);return(0,x.jsx)(J,{open:e,onOpenChange:l,children:(0,x.jsxs)("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText","bg-modalBackground shadow-modal",i==="main"?"gap-6":"gap-3.5"),children:[(0,x.jsxs)("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[i==="main"?(0,x.jsxs)("div",{className:"flex items-center gap-3",children:[a?.icon&&(0,x.jsx)("div",{className:"flex items-center justify-center w-[55px] h-[55px]",children:(0,x.jsx)("img",{src:a.icon,alt:""})}),(0,x.jsxs)("div",{className:"flex flex-col items-start gap-1 w-full",children:[(0,x.jsx)(Z,{className:"sr-only",children:"Account Details"}),(0,x.jsxs)("div",{className:"flex items-center gap-1.5 w-full",children:[(0,x.jsx)("span",{className:"text-base text-modalText font-semibold",children:(0,nt.formatAddress)(t)}),(0,x.jsx)(fe,{copyText:t})]}),(0,x.jsx)("div",{className:"text-sm text-modalTextSecondary font-medium min-h-[20px]",children:n===void 0?(0,x.jsx)("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-skeleton"}):(0,x.jsxs)(x.Fragment,{children:[n?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>u("main"),"aria-label":"Back",children:(0,x.jsx)(re,{})}),(0,x.jsx)(Z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:s})]}),(0,x.jsx)($,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:(0,x.jsx)(G,{})})]}),(0,x.jsx)("div",{ref:m,className:"relative overflow-hidden",children:(0,x.jsx)("div",{ref:f,children:c[i]})})]})})};var _=require("react/jsx-runtime"),at=()=>{let{isOpen:e,close:o}=ee();return(0,_.jsx)(J,{open:e,onOpenChange:t=>!t&&o(),children:(0,_.jsxs)("div",{className:"flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,_.jsx)("div",{className:"w-[30px]"})," ",(0,_.jsx)(Z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),(0,_.jsx)($,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:(0,_.jsx)(G,{})})]}),(0,_.jsx)(me,{})]})})};var q=require("react"),ve=require("@luno-kit/react");var y=require("@luno-kit/react");function it(){let e=(0,y.useStatus)(),{account:o,address:t}=(0,y.useAccount)(),{chain:r}=(0,y.useChain)(),n=(0,y.useChains)(),{data:a}=(0,y.useBalance)({address:t}),i=(0,y.useActiveConnector)(),{open:m,isOpen:f}=X(),{open:u,isOpen:h}=Y(),{open:l,isOpen:s}=ee(),c=e===y.ConnectionStatus.Connecting,w=e===y.ConnectionStatus.Connected,b=e===y.ConnectionStatus.Disconnected||e===y.ConnectionStatus.Disconnecting,D=!!r&&n.some(R=>R.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:w,isDisconnected:b,isConnecting:c,account:o,address:t,displayAddress:(0,y.formatAddress)(t),currentChain:r,configuredChains:n,isChainSupported:D,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:m,openAccountModal:u,openChainModal:l,isConnectModalOpen:f,isAccountModalOpen:h,isChainModalOpen:s}}var xe=require("react");var ge=()=>{let[e,o]=(0,xe.useState)({height:void 0,width:void 0});return(0,xe.useEffect)(()=>{let t=qe(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};var ut=K(require("react"),1);var st=require("cuer"),B=require("react/jsx-runtime"),lt=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,m=a*i,f=Math.ceil(57/2-a/2),u=f+a,h=()=>{let c=[];for(let w=0;w<57;w++)for(let b=0;b<57;b++){if(w>=f&&w<u&&b>=f&&b<u||w<8&&b<8||w<8&&b>=49||w>=49&&b<8)continue;let R=b+.5,H=w+.5;c.push((0,B.jsx)("rect",{x:R-.4,y:H-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${w}-${b}`))}return c},l=({position:c})=>{let w=7*i,b={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return(0,B.jsxs)("div",{className:"absolute z-[4]",style:{width:`${w}px`,height:`${w}px`,...b[c]},children:[(0,B.jsx)("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),(0,B.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let c=f*i;return(0,B.jsx)("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${m}px`,height:`${m}px`,left:`${c}px`,top:`${c}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:(0,B.jsx)("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return(0,B.jsxs)("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[(0,B.jsx)("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:h()}),(0,B.jsx)("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&s()]})}return(0,B.jsx)(st.Cuer,{arena:e,value:o})};var A=require("react/jsx-runtime"),se="transition-transform transition-[125] hover:scale-[1.03] transition-ease",ct=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:n=!0})=>{let{isConnected:a,isDisconnected:i,displayAddress:m,balance:f,openConnectModal:u,openAccountModal:h,openChainModal:l,chainIconUrl:s,chainName:c,currentChain:w,activeConnector:b}=it(),{width:D}=ge(),R=D&&D>768;return i||!a||!b?(0,A.jsx)("button",{type:"button",onClick:()=>u?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",se,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):(0,A.jsxs)("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&(0,A.jsxs)("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",se),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?(0,A.jsx)(te,{chainIconUrl:s,chainName:c,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&R&&(0,A.jsx)("span",{children:w?.name||"Unknown Chain"})]}),(0,A.jsxs)("button",{type:"button",onClick:()=>h?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",se),"aria-label":"Open account modal",children:[n&&R&&(0,A.jsx)("div",{className:"p-2 pl-3",children:f===void 0?(0,A.jsx)("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"}):(0,A.jsxs)("span",{className:"",children:[f?.formattedTransferable||f?.formattedTotal||0," ",w?.nativeCurrency?.symbol||""]})}),(0,A.jsxs)("div",{className:d("flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",n&&R?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&(0,A.jsx)("span",{className:"w-[24px] h-[24px]",children:(0,A.jsx)("img",{src:b.icon,alt:"luno"})}),(0,A.jsx)("span",{"aria-label":"Wallet icon placeholder",className:"",children:m})]})]})]})};var we=require("react");var mt=require("react/jsx-runtime"),dt=({size:e=160,dotCount:o=300,duration:t=3,className:r=""})=>{let n=(0,we.useRef)(null);return(0,we.useEffect)(()=>{if(!n.current)return;let a=1,i=2,m=Math.PI*(3-Math.sqrt(5)),f=e/2,u=f-i-a,h="http://www.w3.org/2000/svg";n.current.innerHTML="";let l=document.createElementNS(h,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",n.current.appendChild(l);for(let s=0;s<o;s++){let c=s+.5,w=c/o,b=Math.sqrt(w)*u,D=c*m,R=f+b*Math.cos(D),H=f+b*Math.sin(D),L=document.createElementNS(h,"circle");L.setAttribute("cx",R.toString()),L.setAttribute("cy",H.toString()),L.setAttribute("r",a.toString()),L.setAttribute("fill","currentColor"),L.setAttribute("opacity","0.6"),l.appendChild(L);let P=document.createElementNS(h,"animate");P.setAttribute("attributeName","r"),P.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),P.setAttribute("dur",`${t}s`),P.setAttribute("begin",`${w*t}s`),P.setAttribute("repeatCount","indefinite"),P.setAttribute("calcMode","spline"),P.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),L.appendChild(P);let V=document.createElementNS(h,"animate");V.setAttribute("attributeName","opacity"),V.setAttribute("values","0.2;1;0.2"),V.setAttribute("dur",`${t}s`),V.setAttribute("begin",`${w*t}s`),V.setAttribute("repeatCount","indefinite"),V.setAttribute("calcMode","spline"),V.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),L.appendChild(V)}},[e,o,t]),(0,mt.jsx)("div",{ref:n,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};var p=require("react/jsx-runtime"),_e=ut.default.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:r,connectState:n})=>{let a=e?.hasConnectionUri();return(0,p.jsxs)("div",{className:d("flex flex-col items-center",r?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[r&&(0,p.jsx)("div",{className:"w-full",children:(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsx)("div",{}),(0,p.jsx)($,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:(0,p.jsx)(G,{})})]})}),(0,p.jsx)("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?(0,p.jsxs)("div",{className:"flex flex-col items-center gap-2.5",children:[(0,p.jsx)(lt,{size:300,logoBackground:e.icon,uri:t}),(0,p.jsxs)("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with ",e.id==="nova"?"the Nova":"your phone"]}),(0,p.jsx)("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?(0,p.jsxs)("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?(0,p.jsx)(fe,{className:"text-sm leading-sm font-medium text-accentColor hover:text-modalText",copyText:t,label:"Copy Link"}):null})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"w-[80px] h-[80px]",children:(0,p.jsx)("img",{src:e.icon,className:"w-full h-full",alt:""})}),(0,p.jsxs)("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),(0,p.jsx)("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),n.isConnecting&&(0,p.jsx)("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&(0,p.jsxs)("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!n.isConnecting&&n.isError&&e.isInstalled()&&(0,p.jsx)("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",se),onClick:()=>o(e),children:"Retry"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"w-[160px] h-[160px] mb-4",children:(0,p.jsx)(dt,{})}),(0,p.jsx)("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),(0,p.jsx)("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to sign in and start using your assets."})]})}),(0,p.jsx)("div",{})]})});var Ge=K(require("react"),1),Ce=require("@luno-kit/react");var M=require("react/jsx-runtime"),pt=Ge.default.memo(({onConnect:e})=>{let o=(0,Ce.useConnectors)();if((0,Ce.isMobileDevice)()){let n=o.filter(a=>a.links.deepLink);return(0,M.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:n.map(a=>(0,M.jsx)(He,{connector:a,onConnect:()=>e(a)},`${a.id}-${a.name}`))})}let t=o.filter(n=>n.isInstalled()),r=o.filter(n=>!n.isInstalled());return(0,M.jsxs)("div",{className:"flex flex-col items-start gap-4 w-full",children:[(0,M.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,M.jsx)("div",{className:"text-sm text-accentColor font-semibold leading-base",children:"Installed"}),(0,M.jsx)("div",{className:"flex flex-col items-start gap-1.5 w-full",children:t.map(n=>(0,M.jsx)(He,{connector:n,onConnect:()=>e(n)},n.id))})]}),r.length>0&&(0,M.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,M.jsx)("div",{className:"text-sm text-modalTextSecondary font-semibold leading-base",children:"More"}),(0,M.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:r.map(n=>(0,M.jsx)(He,{connector:n,onConnect:()=>e(n)},n.id))})]})]})}),He=Ge.default.memo(({connector:e,onConnect:o})=>(0,M.jsxs)("button",{onClick:o,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[(0,M.jsx)("div",{className:"w-[28px] h-[28px]",children:(0,M.jsx)("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),(0,M.jsx)("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));var g=require("react/jsx-runtime");var ft=({size:e="wide"})=>{let{isOpen:o,close:t}=X(),{connectAsync:r,reset:n,isPending:a,isError:i}=(0,ve.useConnect)(),[m,f]=(0,q.useState)(null),[u,h]=(0,q.useState)(),{width:l}=ge(),s=l&&l>768,c=!!(e==="wide"&&s),{containerRef:w,currentViewRef:b,resetView:D,handleViewChange:R,currentView:H}=he({initialView:"Connect Wallet"}),L=async E=>{let We=await E.getConnectionUri();h(We)},P=async E=>{if((0,ve.isMobileDevice)()&&E.links.deepLink)try{await r({connectorId:E.id}),V(!1);return}catch{window.location.href=`${E.links.deepLink}?url=${window.location.href}`;return}!c&&R("walletView"),f(E),h(void 0),E.hasConnectionUri()&&L(E),await r({connectorId:E.id}),V(!1)},V=E=>{!E&&t(),n(),D(),f(null),h(void 0)},yt=(0,q.useMemo)(()=>({"Connect Wallet":(0,g.jsx)(pt,{onConnect:P}),walletView:(0,g.jsx)(_e,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:P})}),[c,m,u,P,a,i]);return(0,q.useEffect)(()=>{c&&H==="walletView"&&R("Connect Wallet")},[c,H]),(0,g.jsx)(J,{open:o,onOpenChange:V,children:(0,g.jsxs)("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[(0,g.jsxs)("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",c?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[(0,g.jsxs)("div",{className:d("flex items-center justify-between w-full",!c&&"pb-4"),children:[H==="Connect Wallet"?(0,g.jsxs)(g.Fragment,{children:[!c&&(0,g.jsx)("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),(0,g.jsx)(Z,{className:d("text-lg leading-lg text-modalText font-bold",c?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>R("Connect Wallet"),"aria-label":"Back",children:(0,g.jsx)(re,{})}),(0,g.jsx)(Z,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:m?.name})]}),!c&&(0,g.jsx)($,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:(0,g.jsx)(G,{})})]}),(0,g.jsx)("div",{ref:w,className:"relative overflow-hidden w-full",children:(0,g.jsx)("div",{ref:b,children:yt[H]})}),!c&&H==="Connect Wallet"&&(0,g.jsx)(g.Fragment,{children:(0,g.jsx)("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),c&&(0,g.jsx)(_e,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:P})]})})};var vt=require("react"),bt=require("@luno-kit/react"),be=require("@tanstack/react-query");var k=require("react");var xt=require("react"),ht=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],gt=(e,o)=>{(0,xt.useEffect)(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,n])=>{n&&t.style.setProperty(`--color-${r}`,n)}),Object.entries(e.completeTheme.fonts).forEach(([r,n])=>{n&&t.style.setProperty(`--font-${r}`,n)}),Object.entries(e.completeTheme.radii).forEach(([r,n])=>{n&&t.style.setProperty(`--radius-${r}`,n)}),Object.entries(e.completeTheme.shadows).forEach(([r,n])=>{n&&t.style.setProperty(`--shadow-${r}`,n)}),Object.entries(e.completeTheme.blurs).forEach(([r,n])=>{n&&t.style.setProperty(`--blur-${r}`,n)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(ht.forEach(n=>{t.style.removeProperty(n)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([n,a])=>{a&&t.style.setProperty(`--color-${n}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([n,a])=>{a&&t.style.setProperty(`--font-${n}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([n,a])=>{a&&t.style.setProperty(`--radius-${n}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([n,a])=>{a&&t.style.setProperty(`--shadow-${n}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([n,a])=>{a&&t.style.setProperty(`--blur-${n}`,a)}))):(t.setAttribute("data-theme",o),ht.forEach(r=>{t.style.removeProperty(r)}))},[e,o])};var Ct=require("react/jsx-runtime"),$e="luno.lastThemePreference",zt=e=>{try{localStorage.setItem($e,JSON.stringify(e))}catch{}},wt=(0,k.createContext)(void 0),Fe=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Wt=()=>{let[e,o]=(0,k.useState)(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return(0,k.useEffect)(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=n=>{o(n.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},Ze=({children:e,theme:o})=>{let t=Wt(),[r,n]=(0,k.useState)(()=>{if(typeof window<"u")try{let s=localStorage.getItem($e);if(s){let c=JSON.parse(s);if(c?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(c?.preferredTheme)return c.preferredTheme}}catch{}return!o||Fe(o)?"light":o.defaultMode||"light"}),[a,i]=(0,k.useState)(()=>{if(typeof window<"u")try{let s=localStorage.getItem($e);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!o||Fe(o)?!1:o.autoMode??!1}),m=(0,k.useMemo)(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(Fe(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let s=null;return r==="light"&&l.light?s=l.light:r==="dark"&&l.dark?s=l.dark:s={...l},{type:"partial",completeTheme:null,partialOverrides:s}},[r,o]),f=(0,k.useMemo)(()=>m.type==="complete"?m.completeTheme:null,[m]);gt(m,r);let u=(0,k.useCallback)(l=>{let s=l==="auto";i(s),n(s?t||"light":l);let c={isAuto:s,...s?{}:{preferredTheme:l}};zt(c)},[t]);(0,k.useEffect)(()=>{a&&n(t||"light")},[t,a]);let h=(0,k.useMemo)(()=>({themeMode:r,setThemeChoice:u,currentTheme:f}),[r,u,f]);return(0,Ct.jsx)(wt.Provider,{value:h,children:e})},ze=()=>{let e=(0,k.useContext)(wt);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};var T=require("react/jsx-runtime"),Qt=({children:e,config:o,queryClientConfig:t,theme:r})=>{let[n]=(0,vt.useState)(()=>new be.QueryClient(t));return(0,T.jsx)(be.QueryClientProvider,{client:n,children:(0,T.jsx)(bt.LunoProvider,{config:o,children:(0,T.jsx)(Ze,{theme:r,children:(0,T.jsxs)(Ke,{children:[(0,T.jsx)("div",{className:"font-base luno-kit",children:e}),(0,T.jsx)(Ut,{modalSize:o.modalSize})]})})})})},Ut=({modalSize:e})=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ft,{size:e}),(0,T.jsx)(rt,{}),(0,T.jsx)(at,{})]});0&&(module.exports={ConnectButton,LunoKitProvider,useAccountModal,useChainModal,useCloseAllModals,useConnectModal,useLunoTheme});
|
|
2
|
+
"use strict";var St=Object.create;var le=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var kt=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var Tt=(e,o)=>{for(var t in o)le(e,t,{get:o[t],enumerable:!0})},Qe=(e,o,t,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Mt(o))!At.call(e,n)&&n!==t&&le(e,n,{get:()=>o[n],enumerable:!(r=Nt(o,n))||r.enumerable});return e};var K=(e,o,t)=>(t=e!=null?St(kt(e)):{},Qe(o||!e||!e.__esModule?le(t,"default",{value:e,enumerable:!0}):t,e)),Rt=e=>Qe(le({},"__esModule",{value:!0}),e);var Ut={};Tt(Ut,{ConnectButton:()=>ct,LunoKitProvider:()=>Qt,useAccountModal:()=>Y,useChainModal:()=>ee,useCloseAllModals:()=>Je,useConnectModal:()=>X,useLunoTheme:()=>ze});module.exports=Rt(Ut);var ie=require("react"),Q=require("@luno-kit/react");var ce=K(require("react"),1),I=K(require("@radix-ui/react-dialog"),1);var je=require("clsx"),Ue=require("tailwind-merge"),Pt=(0,Ue.extendTailwindMerge)({extend:{classGroups:{"font-size":["text-xs","text-sm","text-base","text-lg"]}}});function d(...e){return Pt((0,je.clsx)(e))}function qe(e,o){let t;return()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=null,e()},o)}}var oe=require("react/jsx-runtime"),Vt=({open:e,onOpenChange:o,children:t,contentClassName:r,overlayClassName:n})=>(0,oe.jsx)(I.Root,{open:e,onOpenChange:o,children:(0,oe.jsxs)(I.Portal,{children:[ce.default.createElement(I.Overlay,{className:d("fixed inset-0 z-[100] bg-modalBackdrop luno-kit","data-[state=open]:[animation:overlay-in_150ms_ease-out]",n)}),(0,oe.jsx)(I.Content,{className:d("luno-kit font-body fixed z-[200] text-modalText text-base leading-base","bg-modalBackground shadow-modal focus:outline-none overflow-hidden border border-modalBorder","transition-all duration-200","rounded-t-modalMobile bottom-0 left-0 w-full","translate-y-0 -translate-x-0","data-[state=open]:[animation:slide-up_200ms_ease-out]","md:bottom-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2","md:w-auto md:rounded-modal","md:data-[state=open]:[animation:dialog-in_150ms_ease-out]",r),children:t})]})}),It=({children:e,className:o})=>ce.default.createElement(I.Title,{className:o},e),Bt=({children:e,className:o,onClick:t})=>ce.default.createElement(I.Close,{className:o,onClick:t},e),J=Vt,$=Bt,Z=It;var S=require("react"),j=require("@luno-kit/react"),Xe=require("react/jsx-runtime");function ye(){let[e,o]=(0,S.useState)(!1),t=(0,S.useCallback)(()=>o(!0),[]),r=(0,S.useCallback)(()=>o(!1),[]);return{isOpen:e,open:t,close:r}}var ne=(0,S.createContext)(void 0),Ke=({children:e})=>{let{isOpen:o,open:t,close:r}=ye(),{isOpen:n,open:a,close:i}=ye(),{isOpen:m,open:f,close:u}=ye(),h=(0,j.useStatus)(),l=(0,S.useCallback)(()=>{r(),i(),u()},[r,i,u]);(0,S.useEffect)(()=>{h===j.ConnectionStatus.Disconnected&&(i(),u())},[h,i,u]);let s=(0,S.useMemo)(()=>({isConnectModalOpen:o,isAccountModalOpen:n,isChainModalOpen:m,openConnectModal:h!==j.ConnectionStatus.Connected?t:void 0,closeConnectModal:r,openAccountModal:h===j.ConnectionStatus.Connected?a:void 0,closeAccountModal:i,openChainModal:h===j.ConnectionStatus.Connected?f:void 0,closeChainModal:u,closeAllModals:l}),[o,t,r,n,a,i,m,f,u,l,h]);return(0,Xe.jsx)(ne.Provider,{value:s,children:e})},X=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useConnectModal must be used within a ModalProvider");return{isOpen:e.isConnectModalOpen,open:e.openConnectModal,close:e.closeConnectModal}},Y=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useAccountModal must be used within a ModalProvider");return{isOpen:e.isAccountModalOpen,open:e.openAccountModal,close:e.closeAccountModal}},ee=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useChainModal must be used within a ModalProvider");return{isOpen:e.isChainModalOpen,open:e.openChainModal,close:e.closeChainModal}},Je=()=>{let e=(0,S.useContext)(ne);if(!e)throw new Error("[ModalContext]: useCloseAllModals must be used within a ModalProvider");return e.closeAllModals};var Se=require("react/jsx-runtime"),Et=e=>(0,Se.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Se.jsx)("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"})}),re=Et;var Ne=require("react/jsx-runtime"),Dt=e=>(0,Ne.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Ne.jsx)("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),G=Dt;var Me=require("react/jsx-runtime"),Lt=e=>(0,Me.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"copy_svg__icon",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",...e,children:(0,Me.jsx)("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"})}),ke=Lt;var Ae=require("react/jsx-runtime"),Ot=e=>(0,Ae.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",width:"20",height:"20",...e,children:(0,Ae.jsx)("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"})}),Te=Ot;var Re=require("react/jsx-runtime"),_t=e=>(0,Re.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"list_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Re.jsx)("path",{d:"M232,48V88a8,8,0,0,1-16,0V56H184a8,8,0,0,1,0-16h40A8,8,0,0,1,232,48ZM72,200H40V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16Zm152-40a8,8,0,0,0-8,8v32H184a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,224,160ZM32,96a8,8,0,0,0,8-8V56H72a8,8,0,0,0,0-16H32a8,8,0,0,0-8,8V88A8,8,0,0,0,32,96ZM188,167l-56,32a8,8,0,0,1-7.94,0L68,167A8,8,0,0,1,64,160V96a8,8,0,0,1,4-7l56-32a8,8,0,0,1,7.94,0l56,32a8,8,0,0,1,4,7v64A8,8,0,0,1,188,167ZM88.12,96,128,118.79,167.88,96,128,73.21ZM80,155.36l40,22.85V132.64L80,109.79Zm96,0V109.79l-40,22.85v45.57Z"})}),Pe=_t;var Ve=require("react/jsx-runtime"),Ht=e=>(0,Ve.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"success_svg__icon",viewBox:"0 0 256 256",width:"20",height:"20",fill:"currentColor",...e,children:(0,Ve.jsx)("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),Ie=Ht;var Be=require("react/jsx-runtime"),Gt=e=>(0,Be.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",className:"switch_svg__icon",viewBox:"0 0 256 256",fill:"currentColor",...e,children:(0,Be.jsx)("path",{d:"M253.66,133.66l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L216,132.69V128A88,88,0,0,0,56.49,76.67a8,8,0,0,1-13-9.34A104,104,0,0,1,232,128v4.69l10.34-10.35a8,8,0,0,1,11.32,11.32Zm-41.18,55A104,104,0,0,1,24,128v-4.69L13.66,133.66A8,8,0,0,1,2.34,122.34l24-24a8,8,0,0,1,11.32,0l24,24a8,8,0,0,1-11.32,11.32L40,123.31V128a87.62,87.62,0,0,0,22.24,58.41A79.66,79.66,0,0,1,98.3,157.66a48,48,0,1,1,59.4,0,79.59,79.59,0,0,1,36.08,28.78,89.68,89.68,0,0,0,5.71-7.11,8,8,0,0,1,13,9.34ZM128,152a32,32,0,1,0-32-32A32,32,0,0,0,128,152Zm0,64a88.2,88.2,0,0,0,53.92-18.49,64,64,0,0,0-107.84,0A87.57,87.57,0,0,0,128,216Z"})}),Ee=Gt;var et=require("react");var De=require("react/jsx-runtime"),te=({chainIconUrl:e,chainName:o,className:t})=>e?(0,De.jsx)("img",{src:e,alt:o||"Chain icon",className:d("w-full h-full object-cover rounded-full",t)}):(0,De.jsx)("div",{className:d("w-full h-full bg-gray-500 text-modalText font-semibold","flex items-center justify-center rounded-full",t),children:o?o.charAt(0).toUpperCase():"C"});var z=require("@luno-kit/react"),C=require("react/jsx-runtime"),tt=({onViewChange:e,onModalClose:o})=>{let{address:t}=(0,z.useAccount)(),{chain:r}=(0,z.useChain)(),{disconnectAsync:n}=(0,z.useDisconnect)(),a=(0,et.useMemo)(()=>[{key:"Chain Name",content:(0,C.jsx)("div",{className:"flex items-stretch w-full justify-between",children:(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("div",{className:"relative",children:(0,C.jsx)(te,{className:"w-[20px] h-[20px]",chainIconUrl:r?.chainIconUrl,chainName:r?.name})}),(0,C.jsx)("span",{className:"text-base text-modalText",children:r?.name||"Polkadot"})]})}),onClick:()=>e("switchChain")},{key:"View on Explorer",content:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Pe,{}),(0,C.jsx)("span",{className:"text-base text-accountActionItemText",children:"View on Explorer"})]}),onClick:()=>window.open((0,z.getExplorerUrl)(r?.blockExplorers?.default?.url,t,"address"))},{key:"Switch Account",content:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Ee,{}),(0,C.jsx)("span",{className:"text-base text-accountActionItemText",children:"Switch Account"})]}),onClick:()=>e("switchAccount")}],[e,r,t]),i=async()=>{await n(),o()};return(0,C.jsxs)("div",{className:"flex flex-col items-center gap-3 w-full",children:[(0,C.jsx)("div",{className:"flex flex-col gap-1.5 w-full px-4",children:a.map(m=>(0,C.jsx)(Ye,{onClick:m.onClick,children:m.content},m.key))}),(0,C.jsx)("div",{className:"w-full mx-[-100px] h-[1px] bg-separatorLine"}),(0,C.jsx)("div",{className:"w-full px-4 pb-4",children:(0,C.jsxs)(Ye,{onClick:i,children:[(0,C.jsx)(Te,{}),(0,C.jsx)("span",{className:"font-medium text-base text-accountActionItemText",children:"Disconnect"})]})})]})},Ye=({children:e,onClick:o})=>(0,C.jsx)("button",{type:"button",onClick:()=>o?.(),className:d("w-full p-2.5 rounded-accountActionItem border-none text-left flex items-center gap-2 font-medium","bg-accountActionItemBackground hover:bg-accountActionItemBackgroundHover","transition-colors duration-200",o?"cursor-pointer":"cursor-auto"),"aria-label":typeof e=="string"?e:void 0,children:e});var de=K(require("react"),1),O=require("@luno-kit/react");var ot=require("@luno-kit/react"),N=require("react/jsx-runtime"),Le=({onBack:e})=>{let{accounts:o,selectAccount:t}=(0,O.useAccounts)(),{address:r}=(0,O.useAccount)(),n=(0,de.useCallback)(a=>{t(a),e()},[e]);return(0,N.jsx)("div",{className:"flex flex-col gap-1.5 pt-3 overflow-auto max-h-[400px] no-scrollbar p-4 pt-0",children:o.map(a=>(0,N.jsx)(Ft,{account:a,isSelected:a.address===r,selectAccount:n},a.address))})};Le.title="Switch Accounts";var Ft=de.default.memo(({isSelected:e,account:o,selectAccount:t})=>{let{chain:r}=(0,O.useChain)(),n=o.address,{data:a}=(0,O.useBalance)({address:n}),i=(0,O.useActiveConnector)();return(0,N.jsxs)("button",{type:"button",onClick:()=>t(o),className:d("px-3.5 py-2.5 w-full rounded-accountSelectItem border-none","bg-accountSelectItemBackground","text-left flex items-center justify-between gap-2","transition-colors duration-200",e?"cursor-auto":"cursor-pointer hover:bg-accountSelectItemBackgroundHover"),"aria-label":o.name||n,disabled:e,children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("div",{className:"shrink-0 w-[24px] h-[24px] rounded-full flex items-center justify-center",children:i?.icon&&(0,N.jsx)("img",{src:i?.icon,alt:"luno account"})}),(0,N.jsxs)("div",{className:"flex flex-col items-start",children:[(0,N.jsx)("span",{className:"font-medium text-sm leading-sm text-accountSelectItemText",children:o.name||(0,ot.formatAddress)(n)}),(0,N.jsx)("span",{className:"text-xs text-modalTextSecondary font-medium",children:a===void 0?(0,N.jsx)("div",{className:"animate-pulse rounded w-[60px] h-[18px] bg-skeleton"}):(0,N.jsxs)(N.Fragment,{children:[a?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}),e&&(0,N.jsx)("div",{className:"border-[1px] border-solid border-accentColor rounded-full overflow-hidden flex items-center justify-center w-[18px] h-[18px]",children:(0,N.jsx)("div",{className:"rounded-full bg-accentColor w-[10px] h-[10px]"})})]})});var U=K(require("react"),1);var W=require("@luno-kit/react");var v=require("react/jsx-runtime");var $t=[{key:"All",label:"All"},{key:"Mainnets",label:"Mainnets"},{key:"Testnets",label:"Testnets"}],me=({onChainSwitched:e})=>{let{chain:o}=(0,W.useChain)(),t=(0,W.useChains)(),{switchChainAsync:r}=(0,W.useSwitchChain)(),{isApiReady:n,apiError:a}=(0,W.useApi)(),[i,m]=(0,U.useState)("All"),[f,u]=(0,U.useState)(null),h=(0,U.useMemo)(()=>{switch(i){case"Mainnets":return t.filter(s=>!s.testnet);case"Testnets":return t.filter(s=>s.testnet);case"All":default:return t}},[t,i]),l=async s=>{if(s.genesisHash!==o?.genesisHash&&!(!n&&!a)){u(s.genesisHash);try{await r({chainId:s.genesisHash}),e?.(s)}catch(c){console.error("Failed to switch chain:",c)}finally{u(null)}}};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"flex items-center gap-1.5 w-full",children:$t.map(s=>(0,v.jsx)("button",{onClick:()=>m(s.key),className:d("px-3.5 flex items-center justify-center cursor-pointer min-w-[48px] min-h-[24px] rounded-networkSelectItem text-[12px] leading-[16px] font-medium transition-colors",i===s.key?"bg-navigationButtonBackground text-modalText":"bg-transparent text-modalTextSecondary hover:text-modalText"),children:s.label},s.key))}),(0,v.jsx)("div",{className:"flex flex-col gap-1.5 overflow-y-auto custom-scrollbar max-h-[450px]",children:h.map(s=>(0,v.jsx)(Zt,{chain:s,isSelected:s.genesisHash===o?.genesisHash,onSelect:l,isLoading:(f===s.genesisHash||!n)&&!a},s.genesisHash))}),h.length===0&&(0,v.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,v.jsxs)("span",{className:"text-modalTextSecondary text-xs",children:["No ",i==="All"?"chains":i.toLowerCase()," available"]})})]})},Zt=U.default.memo(({chain:e,isSelected:o,isLoading:t,onSelect:r})=>(0,v.jsxs)("button",{onClick:()=>r(e),disabled:o||t,className:d("flex items-center justify-between p-2.5 rounded-networkSelectItem","bg-networkSelectItemBackground","transition-colors duration-200",o||t?"cursor-default":"cursor-pointer hover:bg-networkSelectItemBackgroundHover",t&&"opacity-80"),children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(te,{className:"w-[20px] h-[20px] flex items-center justify-center leading-[20px]",chainIconUrl:e?.chainIconUrl,chainName:e?.name}),(0,v.jsx)("div",{className:"flex flex-col items-start",children:(0,v.jsx)("span",{className:"font-medium text-base text-modalText",children:e.name})})]}),(0,v.jsx)("div",{className:"flex items-center justify-center h-[20px]",children:o?t?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"text-accentColor text-xs leading-xs mr-1.5",children:"Switching"}),(0,v.jsx)("div",{className:"loading text-accentColor w-[15px] h-[15px]"})]}):(0,v.jsxs)("span",{className:"status-dot-container",children:[(0,v.jsx)("span",{className:"ping-animation"}),(0,v.jsx)("span",{className:"status-dot"})]}):null})]}));var Oe=require("react/jsx-runtime"),ue=({onBack:e})=>(0,Oe.jsx)("div",{className:"flex flex-col gap-3.5 p-4 pt-0",children:(0,Oe.jsx)(me,{})});ue.title="Select Networks";var pe=require("react");var ae=require("react/jsx-runtime"),fe=({copyText:e,label:o,className:t=""})=>{let[r,n]=(0,pe.useState)(!1),a=(0,pe.useCallback)(async i=>{try{return navigator.clipboard&&navigator.clipboard.writeText?(await navigator.clipboard.writeText(i),n(!0),setTimeout(()=>n(!1),2e3),!0):!1}catch(m){return console.error("Copy failed:",m),!1}},[]);return(0,ae.jsxs)("button",{type:"button",className:d("cursor-pointer bg-transparent border-none p-0 m-0 inline-flex items-center justify-center gap-1",t),onClick:()=>!r&&e&&a(e),"aria-label":"Copy address to clipboard",disabled:r,children:[r?(0,ae.jsx)(Ie,{className:"text-accentColor",width:16,height:16}):(0,ae.jsx)(ke,{width:16,height:16}),o]})};var nt=require("@luno-kit/react");var F=require("react");function he({initialView:e,animationDuration:o=200,animationEasing:t="ease-out"}){let[r,n]=(0,F.useState)(e),[a,i]=(0,F.useState)(!1),m=(0,F.useRef)(null),f=(0,F.useRef)(null),u=(0,F.useCallback)(l=>{if(l===r||a)return;if(i(!0),!m.current){n(l),i(!1);return}let s=m.current,c=s.offsetHeight;n(l),requestAnimationFrame(()=>{if(!s||!f.current){i(!1);return}let w=f.current.offsetHeight;s.animate([{height:c+"px"},{height:w+"px"}],{duration:o,easing:t,fill:"forwards"}).addEventListener("finish",()=>{i(!1)})})},[r,a,o,t]),h=(0,F.useCallback)(()=>{n(e),i(!1)},[e]);return{currentView:r,isAnimating:a,containerRef:m,currentViewRef:f,handleViewChange:u,resetView:h}}var x=require("react/jsx-runtime");var rt=()=>{let{isOpen:e,close:o}=Y(),{address:t}=(0,Q.useAccount)(),{chain:r}=(0,Q.useChain)(),{data:n}=(0,Q.useBalance)({address:t}),a=(0,Q.useActiveConnector)(),{currentView:i,containerRef:m,currentViewRef:f,handleViewChange:u,resetView:h}=he({initialView:"main"}),l=(0,ie.useCallback)(()=>{o(),h()},[o]),s=(0,ie.useMemo)(()=>i==="switchAccount"?"Switch Account":i==="switchChain"?ue.title:null,[i]),c=(0,ie.useMemo)(()=>({main:(0,x.jsx)(tt,{onViewChange:u,onModalClose:l}),switchAccount:(0,x.jsx)(Le,{onBack:()=>u("main")}),switchChain:(0,x.jsx)(ue,{onBack:()=>u("main")})}),[u,l]);return(0,x.jsx)(J,{open:e,onOpenChange:l,children:(0,x.jsxs)("div",{className:d("flex flex-col w-full md:w-[360px] max-h-[500px] text-modalText","bg-modalBackground shadow-modal",i==="main"?"gap-6":"gap-3.5"),children:[(0,x.jsxs)("div",{className:"flex items-stretch justify-between w-full px-4 pt-4",children:[i==="main"?(0,x.jsxs)("div",{className:"flex items-center gap-3",children:[a?.icon&&(0,x.jsx)("div",{className:"flex items-center justify-center w-[55px] h-[55px]",children:(0,x.jsx)("img",{src:a.icon,alt:"",className:`w-full h-full
|
|
3
|
+
object-contain`})}),(0,x.jsxs)("div",{className:"flex flex-col items-start gap-1 w-full",children:[(0,x.jsx)(Z,{className:"sr-only",children:"Account Details"}),(0,x.jsxs)("div",{className:"flex items-center gap-1.5 w-full",children:[(0,x.jsx)("span",{className:"text-base text-modalText font-semibold",children:(0,nt.formatAddress)(t)}),(0,x.jsx)(fe,{copyText:t})]}),(0,x.jsx)("div",{className:"text-sm text-modalTextSecondary font-medium min-h-[20px]",children:n===void 0?(0,x.jsx)("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-skeleton"}):(0,x.jsxs)(x.Fragment,{children:[n?.formattedTransferable||"0.00"," ",r?.nativeCurrency?.symbol||"DOT"]})})]})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>u("main"),"aria-label":"Back",children:(0,x.jsx)(re,{})}),(0,x.jsx)(Z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:s})]}),(0,x.jsx)($,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:(0,x.jsx)(G,{})})]}),(0,x.jsx)("div",{ref:m,className:"relative overflow-hidden",children:(0,x.jsx)("div",{ref:f,children:c[i]})})]})})};var _=require("react/jsx-runtime"),at=()=>{let{isOpen:e,close:o}=ee();return(0,_.jsx)(J,{open:e,onOpenChange:t=>!t&&o(),children:(0,_.jsxs)("div",{className:"flex flex-col w-full md:w-[360px] max-h-[500px] p-4 gap-3.5 text-modalText",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,_.jsx)("div",{className:"w-[30px]"})," ",(0,_.jsx)(Z,{className:"text-lg leading-lg text-modalText font-semibold transition-opacity duration-300",children:"Select Network"}),(0,_.jsx)($,{className:"z-10 flex items-center justify-center h-[30px] w-[30px] rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200 cursor-pointer",children:(0,_.jsx)(G,{})})]}),(0,_.jsx)(me,{})]})})};var q=require("react"),ve=require("@luno-kit/react");var y=require("@luno-kit/react");function it(){let e=(0,y.useStatus)(),{account:o,address:t}=(0,y.useAccount)(),{chain:r}=(0,y.useChain)(),n=(0,y.useChains)(),{data:a}=(0,y.useBalance)({address:t}),i=(0,y.useActiveConnector)(),{open:m,isOpen:f}=X(),{open:u,isOpen:h}=Y(),{open:l,isOpen:s}=ee(),c=e===y.ConnectionStatus.Connecting,w=e===y.ConnectionStatus.Connected,b=e===y.ConnectionStatus.Disconnected||e===y.ConnectionStatus.Disconnecting,D=!!r&&n.some(R=>R.genesisHash.toLowerCase()===r.genesisHash.toLowerCase());return{activeConnector:i,connectionStatus:e,isConnected:w,isDisconnected:b,isConnecting:c,account:o,address:t,displayAddress:(0,y.formatAddress)(t),currentChain:r,configuredChains:n,isChainSupported:D,chainIconUrl:r?.chainIconUrl,chainName:r?.name,balance:a,openConnectModal:m,openAccountModal:u,openChainModal:l,isConnectModalOpen:f,isAccountModalOpen:h,isChainModalOpen:s}}var xe=require("react");var ge=()=>{let[e,o]=(0,xe.useState)({height:void 0,width:void 0});return(0,xe.useEffect)(()=>{let t=qe(()=>{o({height:window.innerHeight,width:window.innerWidth})},500);return window.addEventListener("resize",t),t(),()=>window.removeEventListener("resize",t)},[]),e};var ut=K(require("react"),1);var st=require("cuer"),B=require("react/jsx-runtime"),lt=({logoBackground:e,uri:o,size:t})=>{if(!o){let a=Math.floor(14.25),i=t/57,m=a*i,f=Math.ceil(57/2-a/2),u=f+a,h=()=>{let c=[];for(let w=0;w<57;w++)for(let b=0;b<57;b++){if(w>=f&&w<u&&b>=f&&b<u||w<8&&b<8||w<8&&b>=49||w>=49&&b<8)continue;let R=b+.5,H=w+.5;c.push((0,B.jsx)("rect",{x:R-.4,y:H-.4,width:.8,height:.8,rx:.4,fill:"var(--color-walletSelectItemBackground)"},`${w}-${b}`))}return c},l=({position:c})=>{let w=7*i,b={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0}};return(0,B.jsxs)("div",{className:"absolute z-[4]",style:{width:`${w}px`,height:`${w}px`,...b[c]},children:[(0,B.jsx)("div",{className:"absolute inset-0",style:{borderRadius:`${2*i}px`,border:`${i}px solid var(--color-walletSelectItemBackground)`}}),(0,B.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",style:{width:`${3*i}px`,height:`${3*i}px`,borderRadius:`${.5*i}px`,backgroundColor:"var(--color-walletSelectItemBackground)"}})]})},s=()=>{let c=f*i;return(0,B.jsx)("div",{className:"absolute z-[4] flex items-center justify-center box-border",style:{width:`${m}px`,height:`${m}px`,left:`${c}px`,top:`${c}px`,borderRadius:`${i}px`,padding:`${i/2}px`},children:(0,B.jsx)("img",{src:e,alt:"QR Code Logo",className:"h-full w-full object-cover",style:{borderRadius:`${i}px`}})})};return(0,B.jsxs)("div",{className:"relative overflow-hidden flex items-center justify-center",style:{width:t,height:t,borderRadius:`${2*i}px`},children:[(0,B.jsx)("svg",{className:"absolute inset-0 z-[3]",width:t,height:t,viewBox:"0 0 57 57",children:h()}),(0,B.jsx)("div",{className:"absolute inset-0 z-[100]",style:{background:"linear-gradient(90deg, transparent 50%, var(--color-walletSelectItemBackgroundHover), transparent)",backgroundSize:"200% 100%",transform:"scale(1.5) rotate(45deg)",animation:"shimmer 1000ms linear infinite both"}}),l({position:"top-left"}),l({position:"top-right"}),l({position:"bottom-left"}),e&&s()]})}return(0,B.jsx)(st.Cuer,{arena:e,value:o})};var A=require("react/jsx-runtime"),se="transition-transform transition-[125] hover:scale-[1.03] transition-ease",ct=({className:e,label:o="Connect Wallet",accountStatus:t="full",chainStatus:r="full",showBalance:n=!0})=>{let{isConnected:a,isDisconnected:i,displayAddress:m,balance:f,openConnectModal:u,openAccountModal:h,openChainModal:l,chainIconUrl:s,chainName:c,currentChain:w,activeConnector:b}=it(),{width:D}=ge(),R=D&&D>768;return i||!a||!b?(0,A.jsx)("button",{type:"button",onClick:()=>u?.(),className:d("cursor-pointer font-semibold inline-flex items-center justify-center focus:outline-none","text-connectButtonText bg-connectButtonBackground shadow-button active:scale-[0.95]","rounded-connectButton",se,"px-3.5 text-base leading-base min-h-[40px]",e),children:o}):(0,A.jsxs)("div",{className:d("text-modalText flex items-stretch bg-transparent font-semibold text-base leading-base gap-3",e),children:[r!=="none"&&(0,A.jsxs)("button",{type:"button",onClick:()=>l?.(),className:d("flex items-center rounded-currentNetworkButton cursor-pointer","bg-currentNetworkButtonBackground shadow-button","py-2 px-2.5 gap-1.5",se),"aria-label":"Switch chain",children:[r==="full"||r==="icon"?(0,A.jsx)(te,{chainIconUrl:s,chainName:c,className:"w-[24px] h-[24px]"}):null,(r==="full"||r==="name")&&R&&(0,A.jsx)("span",{children:w?.name||"Unknown Chain"})]}),(0,A.jsxs)("button",{type:"button",onClick:()=>h?.(),className:d("flex items-center cursor-pointer rounded-connectButton bg-connectButtonBackground shadow-button",se),"aria-label":"Open account modal",children:[n&&R&&(0,A.jsx)("div",{className:"p-2 pl-3",children:f===void 0?(0,A.jsx)("div",{className:"animate-pulse rounded w-[80px] h-[20px] bg-accountActionItemBackgroundHover"}):(0,A.jsxs)("span",{className:"",children:[f?.formattedTransferable||f?.formattedTotal||0," ",w?.nativeCurrency?.symbol||""]})}),(0,A.jsxs)("div",{className:d("flex items-center bg-connectButtonInnerBackground border-2 border-connectButtonBackground rounded-connectButton gap-1.5 max-h-[40px]",n&&R?"bg-connectButtonInnerBackground py-1.5 px-2":"bg-connectButtonBackground py-2 px-2.5"),children:[t==="full"&&(0,A.jsx)("span",{className:"w-[24px] h-[24px]",children:(0,A.jsx)("img",{src:b.icon,alt:"luno"})}),(0,A.jsx)("span",{"aria-label":"Wallet icon placeholder",className:"",children:m})]})]})]})};var we=require("react");var mt=require("react/jsx-runtime"),dt=({size:e=160,dotCount:o=300,duration:t=3,className:r=""})=>{let n=(0,we.useRef)(null);return(0,we.useEffect)(()=>{if(!n.current)return;let a=1,i=2,m=Math.PI*(3-Math.sqrt(5)),f=e/2,u=f-i-a,h="http://www.w3.org/2000/svg";n.current.innerHTML="";let l=document.createElementNS(h,"svg");l.setAttribute("width",e.toString()),l.setAttribute("height",e.toString()),l.setAttribute("viewBox",`0 0 ${e} ${e}`),l.style.display="block",n.current.appendChild(l);for(let s=0;s<o;s++){let c=s+.5,w=c/o,b=Math.sqrt(w)*u,D=c*m,R=f+b*Math.cos(D),H=f+b*Math.sin(D),L=document.createElementNS(h,"circle");L.setAttribute("cx",R.toString()),L.setAttribute("cy",H.toString()),L.setAttribute("r",a.toString()),L.setAttribute("fill","currentColor"),L.setAttribute("opacity","0.6"),l.appendChild(L);let P=document.createElementNS(h,"animate");P.setAttribute("attributeName","r"),P.setAttribute("values",`${a*.5};${a*1.8};${a*.5}`),P.setAttribute("dur",`${t}s`),P.setAttribute("begin",`${w*t}s`),P.setAttribute("repeatCount","indefinite"),P.setAttribute("calcMode","spline"),P.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),L.appendChild(P);let V=document.createElementNS(h,"animate");V.setAttribute("attributeName","opacity"),V.setAttribute("values","0.2;1;0.2"),V.setAttribute("dur",`${t}s`),V.setAttribute("begin",`${w*t}s`),V.setAttribute("repeatCount","indefinite"),V.setAttribute("calcMode","spline"),V.setAttribute("keySplines","0.4 0 0.6 1;0.4 0 0.6 1"),L.appendChild(V)}},[e,o,t]),(0,mt.jsx)("div",{ref:n,className:d("text-accentColor inline-flex w-full h-full justify-center align-center",r)})};var p=require("react/jsx-runtime"),_e=ut.default.memo(({selectedConnector:e,onConnect:o,qrCode:t,isWide:r,connectState:n})=>{let a=e?.hasConnectionUri();return(0,p.jsxs)("div",{className:d("flex flex-col items-center",r?"w-[450px] p-4 min-h-[472px]":"justify-center w-full min-h-[400px]"),children:[r&&(0,p.jsx)("div",{className:"w-full",children:(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsx)("div",{}),(0,p.jsx)($,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:(0,p.jsx)(G,{})})]})}),(0,p.jsx)("div",{className:d("flex items-center gap-4 flex-col grow justify-center",e&&a?"max-w-[300px]":"max-w-[360px]"),children:e?a?(0,p.jsxs)("div",{className:"flex flex-col items-center gap-2.5",children:[(0,p.jsx)(lt,{size:300,logoBackground:e.icon,uri:t}),(0,p.jsxs)("div",{className:"text-base leading-base font-medium text-center text-modalTextSecondary",children:["Scan the QR code with ",e.id==="nova"?"the Nova":"your phone"]}),(0,p.jsx)("div",{className:"min-h-[20px] flex items-center justify-center ",children:e.links?.browserExtension?(0,p.jsxs)("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don't have ",e.name,"?"]}):t?(0,p.jsx)(fe,{className:"text-sm leading-sm font-medium text-accentColor hover:text-modalText",copyText:t,label:"Copy Link"}):null})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"w-[80px] h-[80px]",children:(0,p.jsx)("img",{src:e.icon,className:"w-full h-full",alt:""})}),(0,p.jsxs)("p",{className:"text-lg leading-lg text-modalFont font-bold",children:["Opening ",e.name,"..."]}),(0,p.jsx)("p",{className:"pb-[10px] text-base text-modalTextSecondary leading-base font-medium text-center",children:"Confirm connection in the extension"}),n.isConnecting&&(0,p.jsx)("div",{className:"loading text-modalText"}),!e.isInstalled()&&e.links.browserExtension&&(0,p.jsxs)("p",{onClick:()=>window.open(e.links.browserExtension),className:"cursor-pointer pt-6 text-sm text-accentColor font-medium text-center hover:text-modalText",children:["Don\u2018t have ",e.name,"?"]}),!n.isConnecting&&n.isError&&e.isInstalled()&&(0,p.jsx)("button",{className:d("rounded-connectButton focus:outline-none py-[4px] px-[12px] cursor-pointer font-semibold text-sm text-modalText bg-connectButtonBackground shadow-connectButton active:scale-[0.95]",se),onClick:()=>o(e),children:"Retry"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"w-[160px] h-[160px] mb-4",children:(0,p.jsx)(dt,{})}),(0,p.jsx)("p",{className:"cursor-pointer text-base leading-base text-accentColor font-semibold text-center",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"}),(0,p.jsx)("p",{className:"text-modalTextSecondary w-[250px] text-sm leading-sm font-medium text-center",children:"Connect your wallet to start exploring and interacting with DApps."})]})}),(0,p.jsx)("div",{})]})});var Ge=K(require("react"),1),Ce=require("@luno-kit/react");var M=require("react/jsx-runtime"),pt=Ge.default.memo(({onConnect:e})=>{let o=(0,Ce.useConnectors)();if((0,Ce.isMobileDevice)()){let n=o.filter(a=>a.links.deepLink);return(0,M.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:n.map(a=>(0,M.jsx)(He,{connector:a,onConnect:()=>e(a)},`${a.id}-${a.name}`))})}let t=o.filter(n=>n.isInstalled()),r=o.filter(n=>!n.isInstalled());return(0,M.jsxs)("div",{className:"flex flex-col items-start gap-4 w-full",children:[(0,M.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,M.jsx)("div",{className:"text-sm text-accentColor font-semibold leading-base",children:"Installed"}),(0,M.jsx)("div",{className:"flex flex-col items-start gap-1.5 w-full",children:t.map(n=>(0,M.jsx)(He,{connector:n,onConnect:()=>e(n)},n.id))})]}),r.length>0&&(0,M.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",children:[(0,M.jsx)("div",{className:"text-sm text-modalTextSecondary font-semibold leading-base",children:"More"}),(0,M.jsx)("div",{className:"flex flex-col items-start gap-1 w-full",children:r.map(n=>(0,M.jsx)(He,{connector:n,onConnect:()=>e(n)},n.id))})]})]})}),He=Ge.default.memo(({connector:e,onConnect:o})=>(0,M.jsxs)("button",{onClick:o,className:d("cursor-pointer bg-walletSelectItemBackground p-2 w-full flex items-center gap-3 rounded-walletSelectItem border-none","hover:bg-walletSelectItemBackgroundHover transition-transform active:scale-[0.95]","text-left"),children:[(0,M.jsx)("div",{className:"w-[28px] h-[28px]",children:(0,M.jsx)("img",{src:e.icon,alt:e.name,className:"w-full h-full"})}),(0,M.jsx)("span",{className:"font-semibold leading-base text-base text-modalText",children:e.name})]}));var g=require("react/jsx-runtime");var ft=({size:e="wide"})=>{let{isOpen:o,close:t}=X(),{connectAsync:r,reset:n,isPending:a,isError:i}=(0,ve.useConnect)(),[m,f]=(0,q.useState)(null),[u,h]=(0,q.useState)(),{width:l}=ge(),s=l&&l>768,c=!!(e==="wide"&&s),{containerRef:w,currentViewRef:b,resetView:D,handleViewChange:R,currentView:H}=he({initialView:"Connect Wallet"}),L=async E=>{let We=await E.getConnectionUri();h(We)},P=async E=>{if((0,ve.isMobileDevice)()&&E.links.deepLink)try{await r({connectorId:E.id}),V(!1);return}catch{window.location.href=`${E.links.deepLink}?url=${window.location.href}`;return}!c&&R("walletView"),f(E),h(void 0),E.hasConnectionUri()&&L(E),await r({connectorId:E.id}),V(!1)},V=E=>{!E&&t(),n(),D(),f(null),h(void 0)},yt=(0,q.useMemo)(()=>({"Connect Wallet":(0,g.jsx)(pt,{onConnect:P}),walletView:(0,g.jsx)(_e,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:P})}),[c,m,u,P,a,i]);return(0,q.useEffect)(()=>{c&&H==="walletView"&&R("Connect Wallet")},[c,H]),(0,g.jsx)(J,{open:o,onOpenChange:V,children:(0,g.jsxs)("div",{className:d("flex items-stretch justify-between w-full md:max-h-[504px] md:max-w-[724px]"),children:[(0,g.jsxs)("div",{className:d("flex flex-col items-start py-4 px-5 w-full md:w-auto",c?"md:min-w-[300px] border-r-[1px] border-r-solid border-r-separatorLine":"md:min-w-[360px]"),children:[(0,g.jsxs)("div",{className:d("flex items-center justify-between w-full",!c&&"pb-4"),children:[H==="Connect Wallet"?(0,g.jsxs)(g.Fragment,{children:[!c&&(0,g.jsx)("div",{className:"w-[30px] h-[30px]","aria-hidden":!0}),(0,g.jsx)(Z,{className:d("text-lg leading-lg text-modalText font-bold",c?"pb-6":"flex-1 text-center"),children:"Connect Wallet"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("button",{className:"flex items-center justify-center w-[30px] h-[30px] cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",onClick:()=>R("Connect Wallet"),"aria-label":"Back",children:(0,g.jsx)(re,{})}),(0,g.jsx)(Z,{className:d("text-lg leading-lg text-modalText font-semibold transition-opacity duration-300"),children:m?.name})]}),!c&&(0,g.jsx)($,{className:"z-10 w-[30px] h-[30px] flex items-center justify-center cursor-pointer rounded-modalControlButton border-none hover:bg-modalControlButtonBackgroundHover transition-colors duration-200",children:(0,g.jsx)(G,{})})]}),(0,g.jsx)("div",{ref:w,className:"relative overflow-hidden w-full",children:(0,g.jsx)("div",{ref:b,children:yt[H]})}),!c&&H==="Connect Wallet"&&(0,g.jsx)(g.Fragment,{children:(0,g.jsx)("p",{className:"cursor-pointer w-full pt-4 text-sm leading-sm text-accentColor font-medium text-center hover:text-modalText",onClick:()=>window.open("https://polkadot.com/get-started/wallets/"),children:"New to wallets?"})})]}),c&&(0,g.jsx)(_e,{connectState:{isConnecting:a,isError:i},isWide:c,selectedConnector:m,qrCode:u,onConnect:P})]})})};var vt=require("react"),bt=require("@luno-kit/react"),be=require("@tanstack/react-query");var k=require("react");var xt=require("react"),ht=["--color-accentColor","--color-walletSelectItemBackground","--color-walletSelectItemBackgroundHover","--color-walletSelectItemText","--color-connectButtonBackground","--color-connectButtonInnerBackground","--color-connectButtonText","--color-accountActionItemBackground","--color-accountActionItemBackgroundHover","--color-accountActionItemText","--color-accountSelectItemBackground","--color-accountSelectItemBackgroundHover","--color-accountSelectItemText","--color-currentNetworkButtonBackground","--color-currentNetworkButtonText","--color-networkSelectItemBackground","--color-networkSelectItemBackgroundHover","--color-networkSelectItemText","--color-navigationButtonBackground","--color-separatorLine","--color-modalBackground","--color-modalBackdrop","--color-modalBorder","--color-modalText","--color-modalTextSecondary","--color-modalControlButtonBackgroundHover","--color-modalControlButtonText","--color-success","--color-successForeground","--color-warning","--color-warningForeground","--color-error","--color-errorForeground","--color-info","--color-infoForeground","--color-skeleton","--font-body","--radius-walletSelectItem","--radius-connectButton","--radius-modalControlButton","--radius-accountActionItem","--radius-accountSelectItem","--radius-currentNetworkButton","--radius-networkSelectItem","--radius-modal","--radius-modalMobile","--shadow-button","--shadow-modal","--blur-modalOverlay"],gt=(e,o)=>{(0,xt.useEffect)(()=>{if(typeof window>"u")return;let t=document.documentElement;e.type==="complete"&&e.completeTheme?(Object.entries(e.completeTheme.colors).forEach(([r,n])=>{n&&t.style.setProperty(`--color-${r}`,n)}),Object.entries(e.completeTheme.fonts).forEach(([r,n])=>{n&&t.style.setProperty(`--font-${r}`,n)}),Object.entries(e.completeTheme.radii).forEach(([r,n])=>{n&&t.style.setProperty(`--radius-${r}`,n)}),Object.entries(e.completeTheme.shadows).forEach(([r,n])=>{n&&t.style.setProperty(`--shadow-${r}`,n)}),Object.entries(e.completeTheme.blurs).forEach(([r,n])=>{n&&t.style.setProperty(`--blur-${r}`,n)}),t.removeAttribute("data-theme")):e.type==="partial"&&e.partialOverrides?(t.setAttribute("data-theme",o),Object.keys(e.partialOverrides).length>0&&(ht.forEach(n=>{t.style.removeProperty(n)}),e.partialOverrides.colors&&Object.entries(e.partialOverrides.colors).forEach(([n,a])=>{a&&t.style.setProperty(`--color-${n}`,a)}),e.partialOverrides.fonts&&Object.entries(e.partialOverrides.fonts).forEach(([n,a])=>{a&&t.style.setProperty(`--font-${n}`,a)}),e.partialOverrides.radii&&Object.entries(e.partialOverrides.radii).forEach(([n,a])=>{a&&t.style.setProperty(`--radius-${n}`,a)}),e.partialOverrides.shadows&&Object.entries(e.partialOverrides.shadows).forEach(([n,a])=>{a&&t.style.setProperty(`--shadow-${n}`,a)}),e.partialOverrides.blurs&&Object.entries(e.partialOverrides.blurs).forEach(([n,a])=>{a&&t.style.setProperty(`--blur-${n}`,a)}))):(t.setAttribute("data-theme",o),ht.forEach(r=>{t.style.removeProperty(r)}))},[e,o])};var Ct=require("react/jsx-runtime"),$e="luno.lastThemePreference",zt=e=>{try{localStorage.setItem($e,JSON.stringify(e))}catch{}},wt=(0,k.createContext)(void 0),Fe=e=>"colors"in e&&"fonts"in e&&"radii"in e&&"shadows"in e&&"blurs"in e,Wt=()=>{let[e,o]=(0,k.useState)(()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return(0,k.useEffect)(()=>{if(typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),r=n=>{o(n.matches?"dark":"light")};return r(t),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e},Ze=({children:e,theme:o})=>{let t=Wt(),[r,n]=(0,k.useState)(()=>{if(typeof window<"u")try{let s=localStorage.getItem($e);if(s){let c=JSON.parse(s);if(c?.isAuto)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(c?.preferredTheme)return c.preferredTheme}}catch{}return!o||Fe(o)?"light":o.defaultMode||"light"}),[a,i]=(0,k.useState)(()=>{if(typeof window<"u")try{let s=localStorage.getItem($e);if(s)return JSON.parse(s)?.isAuto??!1}catch{}return!o||Fe(o)?!1:o.autoMode??!1}),m=(0,k.useMemo)(()=>{if(!o)return{type:"default",completeTheme:null,partialOverrides:null};if(Fe(o))return{type:"complete",completeTheme:o,partialOverrides:null};let l=o;if(l.theme)return{type:"complete",completeTheme:l.theme,partialOverrides:null};let s=null;return r==="light"&&l.light?s=l.light:r==="dark"&&l.dark?s=l.dark:s={...l},{type:"partial",completeTheme:null,partialOverrides:s}},[r,o]),f=(0,k.useMemo)(()=>m.type==="complete"?m.completeTheme:null,[m]);gt(m,r);let u=(0,k.useCallback)(l=>{let s=l==="auto";i(s),n(s?t||"light":l);let c={isAuto:s,...s?{}:{preferredTheme:l}};zt(c)},[t]);(0,k.useEffect)(()=>{a&&n(t||"light")},[t,a]);let h=(0,k.useMemo)(()=>({themeMode:r,setThemeChoice:u,currentTheme:f}),[r,u,f]);return(0,Ct.jsx)(wt.Provider,{value:h,children:e})},ze=()=>{let e=(0,k.useContext)(wt);if(!e)throw new Error("useLunoTheme must be used within a ThemeProvider (which is part of LunoKitProvider)");return e};var T=require("react/jsx-runtime"),Qt=({children:e,config:o,queryClientConfig:t,theme:r})=>{let[n]=(0,vt.useState)(()=>new be.QueryClient(t));return(0,T.jsx)(be.QueryClientProvider,{client:n,children:(0,T.jsx)(bt.LunoProvider,{config:o,children:(0,T.jsx)(Ze,{theme:r,children:(0,T.jsxs)(Ke,{children:[(0,T.jsx)("div",{className:"font-base luno-kit",children:e}),(0,T.jsx)(jt,{modalSize:o.modalSize})]})})})})},jt=({modalSize:e})=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(ft,{size:e}),(0,T.jsx)(rt,{}),(0,T.jsx)(at,{})]});0&&(module.exports={ConnectButton,LunoKitProvider,useAccountModal,useChainModal,useCloseAllModals,useConnectModal,useLunoTheme});
|
|
3
4
|
//# sourceMappingURL=index.cjs.map
|