1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9053],{3463:(e,t,n)=>{n.d(t,{BF:()=>g,DO:()=>b,Hu:()=>a.Hu,O3:()=>x,Os:()=>a.Os,Po:()=>p});var r=n(6203),a=n(69303),s=n(43);function o(e){return"object"==typeof e&&null!==e}function i(e){return(e||s.yY.CLOB.BASE).replace(/\/+$/,"")}function l(e){return(null==e?void 0:e.useUnifiedSdk)!==!1&&(null==e||!e.fetchImpl)&&(null==e||!e.headers)&&(null==e||!e.requestInit)&&i(null==e?void 0:e.host)===i(s.yY.CLOB.BASE)}async function c(e,t){let n=await (0,r.g5)(e,65536).catch(()=>null);if(o(n)){if("string"==typeof n.error&&n.error)return n.error;if("string"==typeof n.message&&n.message)return n.message}return t}function d(e){if(!o(e))return null;let{price:t,size:n}=e;if("string"!=typeof t&&"number"!=typeof t||"string"!=typeof n&&"number"!=typeof n)return null;let r=String(t),a=String(n);return r&&a?{price:r,size:a}:null}function u(e){return Array.isArray(e)?e.map(d).filter(e=>null!==e):[]}function m(e){return"string"==typeof e?e:"number"==typeof e||"bigint"==typeof e?String(e):void 0}function f(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e&&e.trim()){let t=Number(e);return Number.isFinite(t)?t:void 0}}function p(e){var t,n,r;let a=o(e)?e:{};return{market:m(a.market),asset_id:m(null!=(t=a.asset_id)?t:a.tokenId),hash:m(a.hash),timestamp:m(a.timestamp),bids:u(a.bids),asks:u(a.asks),min_order_size:m(null!=(n=a.min_order_size)?n:a.minOrderSize),tick_size:m(null!=(r=a.tick_size)?r:a.tickSize),spread:f(a.spread),midpoint:f(a.midpoint)}}async function h(e,t,n,a){let s=await (function(e){var t;let n=null!=(t=null==e?void 0:e.fetchImpl)?t:globalThis.fetch;if(!n)throw Error("CLOB fetch implementation unavailable");return n})(n)(function(e,t,n){let[r,a]=(e.startsWith("/")?e:"/".concat(e)).split("?",2),s=[a,!t?"":Object.entries(t).filter(e=>{let[,t]=e;return null!=t}).map(e=>{let[t,n]=e;return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(String(n)))}).join("&")].filter(Boolean).join("&");return"".concat(i(null==n?void 0:n.host)).concat(r).concat(s?"?".concat(s):"")}(e,t,n),function(e){var t,n,r,a,s;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{...null!=(n=null==e?void 0:e.requestInit)?n:{},...o,headers:{Accept:"application/json",...null!=(r=null==e?void 0:e.headers)?r:{},...null!=(a=null==e||null==(t=e.requestInit)?void 0:t.headers)?a:{},...null!=(s=o.headers)?s:{}}}}(n,a));if(!s.ok)throw function(e,t){let n=Error(e);return n.name="ClobRequestError",n.status=t.status,n.statusText=t.statusText,n}(await c(s,"CLOB request failed: ".concat(s.statusText||s.status)),s);return await (0,r.g5)(s,r.Ko)}async function x(e,t){if(l(t)){if(null==t?void 0:t.unifiedClient)return p(await t.unifiedClient.fetchOrderBook({tokenId:e}));let{fetchUnifiedClobOrderBook:r}=await Promise.resolve().then(n.bind(n,36568));return r(e)}return p(await h("book",{token_id:e},t))}async function b(e,t){if(0===e.length)return[];if(l(t)){var r;if(null==t||null==(r=t.unifiedClient)?void 0:r.fetchOrderBooks){let n=await t.unifiedClient.fetchOrderBooks(e.map(e=>({tokenId:e})));return Array.isArray(n)?n.map(p):[]}let{fetchUnifiedClobOrderBooks:a}=await Promise.resolve().then(n.bind(n,36568));return a(e)}let a=await h("books?token_ids",void 0,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.map(e=>({token_id:e})))});return Array.isArray(a)?a.map(p):[]}async function g(e,t){var r,a,s;if(!e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e)return{maker:0,taker:0};if(l(t)){if(null==t||null==(r=t.unifiedClient)?void 0:r.fetchBuilderFeeRates){var i=await t.unifiedClient.fetchBuilderFeeRates({builderCode:e});if(!o(i))throw Error("Malformed builder fee rates payload");return{maker:w(i.maker,"maker"),taker:w(i.taker,"taker")}}let{fetchUnifiedClobBuilderFeeRates:a}=await Promise.resolve().then(n.bind(n,36568));return a(e)}
1let c=await h("fees/builder-fees/".concat(encodeURIComponent(e)),void 0,t);return{maker:w(null!=(a=c.builder_maker_fee_rate_bps)?a:0,"builder_maker_fee_rate_bps")/1e4,taker:w(null!=(s=c.builder_taker_fee_rate_bps)?s:0,"builder_taker_fee_rate_bps")/1e4}}function w(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw Error("Malformed builder fee rate: ".concat(t," must be a finite non-negative number"));return e}},6203:(e,t,n)=>{n.d(t,{Gb:()=>a,Ko:()=>r,g5:()=>i});let r=4194304;class a extends Error{constructor(e){super("too_large"===e?"Response body exceeded its byte limit":"Response body contained malformed JSON"),this.name="BoundedJsonError",this.reason=e}}async function s(e,t){if(!Number.isSafeInteger(t)||t<1)throw RangeError("maxBytes must be a positive safe integer");let n=e.headers.get("content-length");if(null!==n&&/^\d+$/u.test(n)&&BigInt(n)>BigInt(t)){var r;throw await (null==(r=e.body)?void 0:r.cancel()),new a("too_large")}if(!e.body)return new Uint8Array;let s=e.body.getReader(),o=[],i=0;for(;;){let{done:e,value:n}=await s.read();if(e)break;if(n){if((i+=n.byteLength)>t)throw await s.cancel(),new a("too_large");o.push(n)}}let l=new Uint8Array(i),c=0;for(let e of o)l.set(e,c),c+=e.byteLength;return l}async function o(e,t){var n;return n=await s(e,t),new globalThis.TextDecoder().decode(n)}async function i(e,t){let n=await o(e,t);try{return JSON.parse(n)}catch(e){throw new a("invalid_json")}}},6719:(e,t,n)=>{function r(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:75;if(e.startsWith("/")||e.startsWith("data:")||e.startsWith("blob:"))return e;let r=new URL("/api/image","https://knoww.app");return r.searchParams.set("url",e),r.searchParams.set("q",String(n)),r.searchParams.set("w",String(t)),r.searchParams.set("v","2"),"".concat(r.pathname,"?").concat(r.searchParams.toString())}n.d(t,{i:()=>r}),n(37811).env.NEXT_PUBLIC_IMAGE_OPTIMIZER_URL},23357:(e,t,n)=>{n.d(t,{x:()=>r});async function r(e,t){let n=await fetch(e,t),r=null;try{r=await n.json()}catch(e){}let a=r;if(!n.ok){var s;throw Error("".concat(e," failed (").concat(n.status,"): ").concat(null!=(s=null==a?void 0:a.error)?s:n.statusText))}if(a&&!1===a.success)throw Error(a.error||"".concat(e," returned success=false"));return r}},24644:(e,t,n)=>{n.d(t,{ThemeToggle:()=>p});var r=n(9775),a=n(52521),s=n(22739),o=n(99306),i=n(67169),l=n(37209),c=n(83655),d=n(84638),u=n(30547);let m=[{value:"light",label:"Light",preview:"#ffffff",isDark:!1},{value:"dark",label:"Dark",preview:"#171717",isDark:!0},{value:"midnight",label:"Midnight",preview:"#1a1a2e",isDark:!0},{value:"ocean",label:"Ocean",preview:"#0d1b2a",isDark:!0},{value:"slate",label:"Slate",preview:"#1e293b",isDark:!0},{value:"softpop",label:"Soft Pop",preview:"#051414",isDark:!0},{value:"sunset",label:"Sunset",preview:"#fef3e2",isDark:!1},{value:"forest",label:"Forest",preview:"#ecfdf5",isDark:!1},{value:"lavender",label:"Lavender",preview:"#f5f3ff",isDark:!1}];var f=n(99085);function p(){var e,t;let n,p,b,g,w,y,k,v,j,N,C,S,E,A,D=(0,a.c)(30),{theme:_,setTheme:F}=(0,l.D)(),[U,T]=(0,c.useState)(!1);if(D[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{T(!0)},p=[],D[0]=n,D[1]=p):(n=D[0],p=D[1]),(0,c.useEffect)(n,p),!U){let e;return D[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(d.$,{variant:"ghost",size:"icon",className:"h-9 w-9",children:(0,r.jsx)(s.A,{className:"h-4 w-4"})}),D[2]=e):e=D[2],e}D[3]!==_?(b=m.find(e=>e.value===_),D[3]=_,D[4]=b):b=D[4];let P=b,O=null!=(e=null==P?void 0:P.isDark)&&e,I=null!=(t=null==P?void 0:P.label)?t:"System";return D[5]!==O?(g=O?(0,r.jsx)(o.A,{className:"h-4 w-4"}):(0,r.jsx)(s.A,{className:"h-4 w-4"}),D[5]=O,D[6]=g):g=D[6],D[7]!==I?(w=(0,r.jsx)("span",{className:"hidden sm:inline",children:I}),D[7]=I,D[8]=w):w=D[8],D[9]===Symbol.for("react.memo_cache_sentinel")?(y=(0,r.jsx)("span",{className:"sr-only",children:"Toggle theme"}),D[9]=y):y=D[9],D[10]!==g||D[11]!==w?(k=(0,r.jsx)(u.ty,{asChild:!0,children:(0,r.jsxs)(d.$,{variant:"ghost",size:"sm",className:"h-9 gap-2 px-2 text-xs font-medium",children:[g,w,y]})}),D[10]=g,D[11]=w,D[12]=k):k=D[12],D[13]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(u.lp,{className:"text-xs text-muted-foreground font-normal",children:"Theme"}
1),D[13]=v):v=D[13],D[14]!==F||D[15]!==_?(j=m.filter(x).map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>F(e.value),className:(0,f.cn)("flex items-center gap-2 px-2 py-1.5 rounded-md text-xs font-medium transition-colors",_===e.value?"bg-primary/15 text-primary ring-1 ring-primary/30":"hover:bg-muted"),children:[(0,r.jsx)("div",{className:"h-4 w-4 rounded-full border border-border/50 shrink-0",style:{backgroundColor:e.preview}}),(0,r.jsx)("span",{className:"truncate",children:e.label}),_===e.value&&(0,r.jsx)(i.A,{className:"h-3 w-3 ml-auto shrink-0 text-primary"})]},e.value)),D[14]=F,D[15]=_,D[16]=j):j=D[16],D[17]!==j?(N=(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 p-1",children:j}),D[17]=j,D[18]=N):N=D[18],D[19]!==F||D[20]!==_?(C=m.filter(h).map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>F(e.value),className:(0,f.cn)("flex items-center gap-2 px-2 py-1.5 rounded-md text-xs font-medium transition-colors",_===e.value?"bg-primary/15 text-primary ring-1 ring-primary/30":"hover:bg-muted"),children:[(0,r.jsx)("div",{className:"h-4 w-4 rounded-full border border-border/50 shrink-0",style:{backgroundColor:e.preview}}),(0,r.jsx)("span",{className:"truncate",children:e.label}),_===e.value&&(0,r.jsx)(i.A,{className:"h-3 w-3 ml-auto shrink-0 text-primary"})]},e.value)),D[19]=F,D[20]=_,D[21]=C):C=D[21],D[22]!==C?(S=(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1 p-1",children:C}),D[22]=C,D[23]=S):S=D[23],D[24]!==S||D[25]!==N?(E=(0,r.jsxs)(u.SQ,{align:"end",className:"w-56",children:[v,N,S]}),D[24]=S,D[25]=N,D[26]=E):E=D[26],D[27]!==E||D[28]!==k?(A=(0,r.jsxs)(u.rI,{modal:!1,children:[k,E]}),D[27]=E,D[28]=k,D[29]=A):A=D[29],A}function h(e){return e.isDark}function x(e){return!e.isDark}},32726:(e,t,n)=>{n.d(t,{VE:()=>b,gc:()=>f});var r=n(76496),a=n(28606),s=n(25765),o=n(21107),i=n(83655),l=n(87587),c=n(11137),d=n(37811);function u(){return{builderCode:d.env.NEXT_PUBLIC_POLY_BUILDER_CODE}}async function m(){return(0,r.Kr)(u())}async function f(e){return(0,r.TZ)(e,u())}async function p(e){return(0,r.V2)(e,u())}async function h(e){return(0,r.wt)(e,u())}async function x(e){return(0,r.z8)(e,u())}function b(){var e,t,n,d,u;let{proxyAddress:b}=(0,c.h)(),g=(0,a.jE)(),w=(0,s.I)({queryKey:l.qk.bridge.supportedAssets(),queryFn:m,staleTime:3e5}),y=(0,s.I)({queryKey:l.qk.bridge.depositAddresses(b||""),queryFn:()=>{if(!b)throw Error("No wallet address provided. Please complete trading setup first.");return x(b)},enabled:!!b,staleTime:6e5}),k=(0,o.n)({mutationFn:x,onSuccess:(e,t)=>{g.setQueryData(l.qk.bridge.depositAddresses(t),e)}}),v=(0,o.n)({mutationFn:f}),j=(0,o.n)({mutationFn:p}),N=(0,o.n)({mutationFn:h}),C=(0,i.useRef)(w);C.current=w;let S=(0,i.useCallback)(async()=>{let e=C.current;return await e.refetch(),e.data||[]},[]),E=(0,i.useCallback)(async e=>{let t=e||b;if(!t)throw Error("No wallet address provided. Please complete trading setup first.");let n=g.getQueryData(l.qk.bridge.depositAddresses(t));return n||k.mutateAsync(t)},[b,g,k]),A=(0,i.useCallback)(e=>r.CX[e]||{name:"Chain ".concat(e),icon:"\uD83D\uDD17",color:"#888888"},[]),D=(0,i.useCallback)(()=>{b&&g.removeQueries({queryKey:l.qk.bridge.depositAddresses(b)})},[b,g]),_=(0,i.useRef)(v);_.current=v;let F=(0,i.useCallback)(async e=>_.current.mutateAsync(e),[]),U=(0,i.useRef)(j);U.current=j;let T=(0,i.useCallback)(async e=>U.current.mutateAsync(e),[]),P=(0,i.useRef)(N);P.current=N;let O=(0,i.useCallback)(async e=>P.current.mutateAsync(e),[]);return{isLoading:w.isLoading||k.isPending,error:(null==(e=k.error)?void 0:e.message)||(null==(t=w.error)?void 0:t.message)||null,supportedAssets:w.data||[],depositAddresses:y.data||[],proxyAddress:b,getSupportedAssets:S,createDepositAddresses:E,getChainMetadata:A,clearDepositAddresses:D,getQuote:F,isLoadingQuote:v.isPending,quoteError:(null==(n=v.error)?void 0:n.message)||null,getDepositStatus:T,isLoadingDepositStatus:j.isPending,depositStatusError:(null==(d=j.error)?void 0:d.message)||null,getWithdrawalAddresses:O,isLoadingWithdrawal:N.isPending,withdrawalError:(null==(u=N.error)?void 0:u.message)||null}}},33684:(e,t,n)=>{n.d(t,{p:()=>F});var r=n(9775),a=n(52521),s=n(11410),o=n(25709),i=n(82308),l=n(36487),c=n(49924),d=n(61329),u=n(89091),m=n(73432),f=n(83655),p=n(18388),h=n(95420),x=n(89048),b=n(33321),g=n(87597),w=n(85808),y=n(43986),k=n(432),v=n(50691),j=n(82821),N=n(11137),C=n(45462),S=n(99085),E=n(4753),A=n(41310),D=n(90806);async function _(e){if(!e)return!1;try{return await (0,D.u)(e,{eth_accounts:{}}),!0}catch(e){if((0,A.xt)(e))return!0;
1if((0,A.bq)(e))return!1;if((0,A.q8)(e))return!0;throw e}}function F(e){let t,n,s,o,i,l,c,d,u=(0,a.c)(17),{children:m,align:p}=e,h=void 0===p?"end":p,[x,b]=(0,f.useState)(!1),[g,w]=(0,f.useState)(!1),y=(0,f.useRef)(null);u[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>b(!1),u[0]=t):t=u[0];let k=t;u[1]!==x?(n=()=>{if(!x)return;let e=e=>{y.current&&!y.current.contains(e.target)&&b(!1)},t=e=>{"Escape"===e.key&&b(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},s=[x],u[1]=x,u[2]=n,u[3]=s):(n=u[2],s=u[3]),(0,f.useEffect)(n,s),u[4]!==m?(o=(0,f.isValidElement)(m)?(0,f.cloneElement)(m,{onClick:e=>{var t,n;null==(t=(n=m.props).onClick)||t.call(n,e),b(U)}}):m,u[4]=m,u[5]=o):o=u[5];let j=o;return u[6]!==h||u[7]!==x?(i=x&&(0,r.jsx)(T,{align:h,onClose:k,onOpenDeposit:()=>{b(!1),w(!0)}}),u[6]=h,u[7]=x,u[8]=i):i=u[8],u[9]!==i||u[10]!==j?(l=(0,r.jsxs)("div",{ref:y,className:"relative inline-block",children:[j,i]}),u[9]=i,u[10]=j,u[11]=l):l=u[11],u[12]!==g?(c=(0,r.jsx)(v.q,{open:g,onOpenChange:w}),u[12]=g,u[13]=c):c=u[13],u[14]!==l||u[15]!==c?(d=(0,r.jsxs)(r.Fragment,{children:[l,c]}),u[14]=l,u[15]=c,u[16]=d):d=u[16],d}function U(e){return!e}function T(e){let t,n,d,u,f,h,v,A,D,F,U,T,R,z,K,q,$,W,V,Y,Q,H,G,J,X,Z,ee,et,en,er,ea,es,eo,ei,el=(0,a.c)(73),{align:ec,onClose:ed,onOpenDeposit:eu}=e,em=(0,m.useRouter)(),{address:ef}=(0,x.useConnection)(),{mutate:ep}=(0,b.useDisconnect)(),{data:eh}=(0,g.useWalletClient)();el[0]!==ef?(t={address:ef,chainId:C.mainnet.id},el[0]=ef,el[1]=t):t=el[1];let{data:ex}=(0,w.useEnsName)(t),eb=null!=ex?ex:void 0;el[2]!==eb?(n={name:eb,chainId:C.mainnet.id},el[2]=eb,el[3]=n):n=el[3];let{data:eg}=(0,y.useEnsAvatar)(n);el[4]!==ef?(d={address:ef,chainId:C.polygon.id},el[4]=ef,el[5]=d):d=el[5];let{data:ew}=(0,k.useBalance)(d),{proxyAddress:ey,usdcBalance:ek,isEoaMode:ev}=(0,N.h)();if(!ef)return null;el[6]!==ef?(u=async()=>{try{await navigator.clipboard.writeText(ef),p.oR.success("Address copied")}catch(e){p.oR.error("Couldn't copy")}},el[6]=ef,el[7]=u):u=el[7];let ej=u;el[8]!==ep||el[9]!==ed?(f=()=>{ep(),ed()},el[8]=ep,el[9]=ed,el[10]=f):f=el[10];let eN=f;el[11]!==ed||el[12]!==em?(h=()=>{em.push("/portfolio"),ed()},el[11]=ed,el[12]=em,el[13]=h):h=el[13];let eC=h;el[14]!==ed||el[15]!==eh?(v=async()=>{ed();try{await _(eh)||await (0,E.hI)()}catch(e){p.oR.error("Couldn't open wallet switcher")}},el[14]=ed,el[15]=eh,el[16]=v):v=el[16];let eS=v,eE="end"===ec?"right-0":"left-0";el[17]!==eE?(A=(0,S.cn)("absolute top-[calc(100%+8px)] z-50 w-[300px] max-w-[calc(100vw-24px)]","bg-background border border-border/60 shadow-2xl shadow-black/40","animate-in fade-in slide-in-from-top-1 duration-150",eE),el[17]=eE,el[18]=A):A=el[18],el[19]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)("span",{className:"font-editorial italic font-medium text-[14px] tracking-tight text-foreground",children:"Wallet"}),el[19]=D):D=el[19];let eA=ex?"ENS":"EOA";el[20]!==eA?(F=(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4 pb-3",children:[D,(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-muted-foreground/70",children:eA})]}),el[20]=eA,el[21]=F):F=el[21],el[22]===Symbol.for("react.memo_cache_sentinel")?(U=(0,r.jsx)(P,{}),el[22]=U):U=el[22];let eD=null!=eg?eg:null;el[23]!==ef||el[24]!==eD?(T=(0,r.jsx)(O,{ensAvatar:eD,address:ef}),el[23]=ef,el[24]=eD,el[25]=T):T=el[25],el[26]!==ef||el[27]!==ex||el[28]!==ej?(R=(0,r.jsx)("div",{className:"min-w-0 flex-1",children:ex?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"truncate text-[14px] font-semibold text-foreground",children:ex}),(0,r.jsxs)("button",{type:"button",onClick:ej,className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-[11px] tabular-nums text-muted-foreground hover:text-foreground transition-colors",children:[(0,r.jsx)("span",{children:M(ef)}),(0,r.jsx)(s.A,{className:"h-3 w-3"})]})]}):(0,r.jsxs)("button",{type:"button",onClick:ej,className:"group inline-flex items-center gap-2 text-[14px] font-semibold text-foreground transition-colors",children:[(0,r.jsx)("span",{className:"font-mono tabular-nums",children:M(ef)}),(0,r.jsx)(s.A,{className:"h-3 w-3 text-muted-foreground transition-colors group-hover:text-foreground"})]})}),el[26]=ef,el[27]=ex,el[28]=ej,el[29]=R):R=el[29],el[30]!==T||el[31]!==R?(z=(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-4",children:[T,R]}),el[30]=T,el[31]=R,el[32]=z):z=el[32],el[33]===Symbol.for("react.memo_cache_sentinel")?(K=(0,r.jsx)(P,{}),el[33]=K):K=el[33],el[34]!==ew?(q=ew?B(ew.value,ew.decimals,4):"â",el[34]=ew,el[35]=q):q=el[35],el[36]!==q?($=(0,r.jsx)(I,{label:"POL",value:q}),el[36]=q,el[37]=$):$=el[37],el[38]!==ek?(W=B(ek?BigInt(Math.round(ek*10**j.uj)):BigInt(0),j.uj,2),el[38]=ek,el[39]=W):W=el[39];let e_=ey?ev?"Connected wallet":"Trading wallet":null;return el[40]!==W||el[41]!==e_?(V=(0,r.jsx)(I,{label:"PUSD",value:W,sublabel:e_}),el[40]=W,el[41]=e_,el[42]=V):V=el[42],el[43]!==$||el[44]!==V?(Y=(0,r.jsxs)("div",{className:"px-4 py-3 space-y-2.5",children:[$,V]}),el[43]=$,el[44]=V,el[45]=Y):Y=el[45],el[46]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,r.jsx)(P,{}),el[46]=Q):Q=el[46],el[47]===Symbol.for("react.memo_cache_sentinel")?(H=(0,r.jsx)(o.A,{className:"h-4 w-4"}),el[47]=H):H=el[47],el[48]!==eu?(G=(0,r.jsx)(L,{icon:H,label:"Deposit",onClick:eu}),el[48]=eu,el[49]=G):G=el[49],el[50]===Symbol.for("react.memo_cache_sentinel")?(J=(0,r.jsx)(i.A,{className:"h-4 w-4"}),el[50]=J):J=el[50],el[51]!==eC?(X=(0,r.jsx)(L,{icon:J,label:"Portfolio",onClick:eC}),el[51]=eC,el[52]=X):X=el[52],el[53]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,r.jsx)(l.A,{className:"h-4 w-4"}),el[53]=Z):Z=el[53],el[54]!==eS?(ee=(0,r.jsx)(L,{icon:Z,label:"Switch wallet",onClick:eS}),el[54]=eS,el[55]=ee):ee=el[55],el[56]!==G||el[57]!==X||el[58]!==ee?(et=(0,r.jsxs)("div",{className:"py-1",children:[G,X,ee]}),el[56]=G,el[57]=X,el[58]=ee,el[59]=et):et=el[59],el[60]===Symbol.for("react.memo_cache_sentinel")?(en=(0,r.jsx)(P,{}),el[60]=en):en=el[60],el[61]===Symbol.for("react.memo_cache_sentinel")?(er=(0,r.jsx)(c.A,{className:"h-4 w-4"}),el[61]=er):er=el[61],el[62]!==eN?(ea=(0,r.jsx)("div",{className:"py-1",children:(0,r.jsx)(L,{icon:er,label:"Disconnect",onClick:eN})}),el[62]=eN,el[63]=ea):ea=el[63],el[64]===Symbol.for("react.memo_cache_sentinel")?(es=(0,r.jsx)(P,{}
1),el[64]=es):es=el[64],el[65]===Symbol.for("react.memo_cache_sentinel")?(eo=(0,r.jsxs)("div",{className:"px-4 py-2.5 flex items-center justify-between font-mono text-[9px] uppercase tracking-[0.16em] text-muted-foreground/50",children:[(0,r.jsx)("span",{children:"Polygon"}),(0,r.jsx)("span",{children:"Mainnet"})]}),el[65]=eo):eo=el[65],el[66]!==A||el[67]!==F||el[68]!==z||el[69]!==Y||el[70]!==et||el[71]!==ea?(ei=(0,r.jsxs)("div",{role:"menu","aria-label":"Wallet menu",className:A,children:[F,U,z,K,Y,Q,et,en,ea,es,eo]}),el[66]=A,el[67]=F,el[68]=z,el[69]=Y,el[70]=et,el[71]=ea,el[72]=ei):ei=el[72],ei}function P(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("div",{"aria-hidden":"true",className:"h-px bg-linear-to-r from-transparent via-border/60 to-transparent"}),t[0]=e):e=t[0],e}function O(e){let t,n=(0,a.c)(4),{ensAvatar:s,address:o}=e;if(s){let e;return n[0]!==s?(e=(0,r.jsx)(u.default,{src:s,alt:"",width:36,height:36,className:"shrink-0 select-none",unoptimized:!0}),n[0]=s,n[1]=e):e=n[1],e}return n[2]!==o?(t=(0,r.jsx)(u.default,{src:"/logo-256x256.png",alt:"",width:36,height:36,className:"shrink-0 select-none",title:o,unoptimized:!0}),n[2]=o,n[3]=t):t=n[3],t}function I(e){let t,n,s,o,i,l=(0,a.c)(12),{label:c,value:d,sublabel:u}=e;return l[0]!==c?(t=(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-muted-foreground",children:c}),l[0]=c,l[1]=t):t=l[1],l[2]!==u?(n=u?(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:u}):null,l[2]=u,l[3]=n):n=l[3],l[4]!==t||l[5]!==n?(s=(0,r.jsxs)("div",{className:"flex flex-col",children:[t,n]}),l[4]=t,l[5]=n,l[6]=s):s=l[6],l[7]!==d?(o=(0,r.jsx)("span",{className:"font-mono text-[16px] font-medium tabular-nums text-foreground",children:d}),l[7]=d,l[8]=o):o=l[8],l[9]!==s||l[10]!==o?(i=(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[s,o]}),l[9]=s,l[10]=o,l[11]=i):i=l[11],i}function L(e){let t,n,s,o,i=(0,a.c)(9),{icon:l,label:c,onClick:u}=e;return i[0]!==l?(t=(0,r.jsx)("span",{className:"text-muted-foreground",children:l}),i[0]=l,i[1]=t):t=i[1],i[2]!==c?(n=(0,r.jsx)("span",{className:"flex-1 text-[14px] text-foreground",children:c}),i[2]=c,i[3]=n):n=i[3],i[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(d.A,{className:"h-3 w-3 text-muted-foreground/60"}),i[4]=s):s=i[4],i[5]!==u||i[6]!==t||i[7]!==n?(o=(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:u,className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-foreground
1/5 focus-visible:bg-foreground/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[t,n,s]}),i[5]=u,i[6]=t,i[7]=n,i[8]=o):o=i[8],o}function M(e){return"".concat(e.slice(0,6),"â¦").concat(e.slice(-4))}function B(e,t,n){let r=Number((0,h.J)(e,t));return Number.isFinite(r)?r.toLocaleString("en-US",{minimumFractionDigits:n,maximumFractionDigits:n}):"â"}},36568:(e,t,n)=>{n.r(t),n.d(t,{adaptUnifiedSecureClientForLegacyClob:()=>S,createUnifiedPolymarketCredentialsOnlySigner:()=>b,createUnifiedPolymarketPublicClient:()=>m,createUnifiedPolymarketSecureClient:()=>E,createUnifiedPolymarketViemSigner:()=>h,fetchUnifiedClobBuilderFeeRates:()=>I,fetchUnifiedClobMarket:()=>T,fetchUnifiedClobOrderBook:()=>A,fetchUnifiedClobOrderBooks:()=>U,fetchUnifiedClobPrice:()=>P,fetchUnifiedClobPriceHistory:()=>O,isPolymarketFreshAuthenticationRequiredError:()=>u});var r=n(43265),a=n(19156),s=n(47299),o=n(3463),i=n(43),l=n(69303);let c="Stored Polymarket API credentials require explicit re-authentication.",d="PolymarketFreshAuthenticationRequiredError";function u(e){if(!D(e))return!1;let t="string"==typeof e.name?e.name:"",n="string"==typeof e.message?e.message:"";return t===d||n.includes(c)}function m(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.lhn)(e)}function f(e){if(!e.account)throw Error("Polymarket signer requires a wallet client with account");return e.account}async function p(e,t){var n,r;let a=null!=(r=null==(n=e.chain)?void 0:n.id)?r:await e.getChainId();if(a!==t)throw Error("Wallet client is connected to chain ".concat(a,", expected ").concat(t))}function h(e){let t=f(e);return{getAddress:async()=>(function(e){let t=f(e);return"string"==typeof t?t:t.address})(e),signTypedData:async n=>await e.signTypedData({account:t,...n}),signMessage:async n=>await e.signMessage({account:t,message:{raw:n}}),async sendTransaction(n){var r;let a;return await p(e,n.chainId),r=await e.sendTransaction({account:t,to:n.to,data:n.data,value:n.value}),a=r,{transactionId:null,get transactionHash(){return a},async wait(){let t=await (0,s.n)(e,{hash:a});if(a=t.transactionHash,"reverted"===t.status)throw Error("Transaction ".concat(a," reverted"));return{transactionHash:a,transactionId:null}}}}}}function x(){throw function(){let e=Error(c);return e.name=d,e}()}function b(e){return{getAddress:async()=>e,async signTypedData(e){x()},async signMessage(e){x()},async sendTransaction(e){x()}}}function g(e){if(!e.tokenId)throw Error("Polymarket order token id is required");return e.tokenId}function w(e,t){return t?{...e,builderCode:t}:e}function y(e){let{assetType:t,tokenId:n}=e;if(!t)throw Error("Polymarket balance allowance asset type is required");return n?{assetType:t,tokenId:n}:{assetType:t}}function k(e){return Array.isArray(e.items)?e.items:Array.isArray(e.data)?e.data:[]}async function v(e,t){let n=[],r="number"==typeof t&&Number.isFinite(t)?Math.max(1,Math.floor(t)):void 0,a=()=>void 0!==r&&n.length>=r,s=()=>void 0===r?n:n.slice(0,r);if("function"==typeof e.firstPage){let t=await e.firstPage();if(n.push(...k(t).map(C)),!a()&&t.nextCursor&&"function"==typeof e.from){for await(let r of e.from(t.nextCursor))if(n.push(...k(r).map(C)),a())break}return s()}for await(let t of e)if(n.push(...k(t).map(C)),a())break;return s()}function j(e,t){let n=e[t];return"string"==typeof n?n:void 0}function N(e,t){let n=e[t];return"string"==typeof n||"number"==typeof n?n:void 0}function C(e){var t,n,r,a,s,o,i,l,c,d,u,m,f,p,h,x,b,g,w;if(!D(e))return{};let y={id:j(e,"id"),order_id:null!=(t=j(e,"order_id"))?t:j(e,"orderId"),maker:null!=(a=null!=(r=null!=(n=j(e,"maker"))?n:j(e,"maker_address"))?r:j(e,"makerAddress"))?a:j(e,"owner"),asset_id:null!=(o=null!=(s=j(e,"asset_id"))?s:j(e,"assetId"))?o:j(e,"tokenId"),token_id:null!=(l=null!=(i=j(e,"token_id"))?i:j(e,"tokenId"))?l:j(e,"asset_id"),tokenId:null!=(c=j(e,"tokenId"))?c:j(e,"asset_id"),side:j(e,"side"),price:N(e,"price"),original_size:null!=(u=null!=(d=N(e,"original_size"))?d:N(e,"originalSize"))?u:N(e,"size"),originalSize:null!=(f=null!=(m=N(e,"originalSize"))?m:N(e,"original_size"))?f:N(e,"size"),size_matched:null!=(p=N(e,"size_matched"))?p:N(e,"sizeMatched"),sizeMatched:null!=(h=N(e,"sizeMatched"))?h:N(e,"size_matched"),status:j(e,"status"),created_at:null!=(x=N(e,"created_at"))?x:N(e,"createdAt"),createdAt:null!=(b=N(e,"createdAt"))?b:N(e,"created_at"),expiration:null!=(g=N(e,"expiration"))?g:N(e,"expiresAt"),expiresAt:null!=(w=N(e,"expiresAt"))?w:N(e,"expiration")};for(let e of Object.keys(y))void 0===y[e]&&delete y[e];return y}function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={async createMarketOrder(n){var r;let a=g(n),s=function(e){if(void 0!==e){if(e===i.EC.FAK||e===i.EC.FOK)return e;throw Error("Polymarket market orders cannot be ".concat(e,"; use createOrder for resting GTC/GTD orders"))}}(n.orderType),o=function(e){if(null==e||""===e)return;let t="number"==typeof e?e:Number(e);if(Number.isFinite(t)&&!(t<=0))return e}(n.price),l=n.side===i.X9.SELL?{tokenId:a,side:n.side,shares:null!=(r=n.amount)?r:n.size,...void 0!==o?{minPrice:o}:{}}:{tokenId:a,side:n.side,amount:n.amount,...void 0!==n.maxSpend?{maxSpend:n.maxSpend}:{},...void 0!==o?{maxPrice:o}:{}};return s&&(l.orderType=s),e.createMarketOrder(w(l,t.builderCode))},async createOrder(n){if(void 0===n.price)throw Error("Polymarket limit order price is required");if(void 0===n.size)throw Error("Polymarket limit order size is required");if(n.orderType===i.EC.FAK||n.orderType===i.EC.FOK)throw Error("Polymarket limit orders cannot be ".concat(n.orderType,"; use createMarketOrder with a price bound instead"));let r={tokenId:g(n),price:n.price,size:n.size,side:n.side,...n.expiration?{expiration:n.expiration}:{}};return e.createLimitOrder(w(r,t.builderCode))},postOrder:async(t,n)=>(!function(e,t){if("string"!=typeof t||!D(e))return;let n=e.orderType;if("string"==typeof n&&n!==t)throw Error("Polymarket order was created as ".concat(n," but posted as ").concat(t,"; set the order type when creating the order"))}(t,n),e.postOrder(t)),getOpenOrders:async t=>e.listOpenOrders?v(e.listOpenOrders(),null==t?void 0:t.limit):[],async fetchOrder(t){if(!e.fetchOrder)throw Error("Order reads unavailable");return e.fetchOrder(t)},async fetchTrade(t){if(!e.listAccountTrades)throw Error("Trade reads unavailable");for await(let n of e.listAccountTrades(t)){let e=k(n).find(e=>D(e)&&e.id===t.id);if(D(e))return{...e,status:"string"==typeof e.status?e.status.replace(/^TRADE_STATUS_/,""):e.status}}return null},updateBalanceAllowance:async t=>e.updateBalanceAllowance?e.updateBalanceAllowance(y(t)):(0,a.ca)(e,y(t)),getBalanceAllowance:async t=>e.fetchBalanceAllowance?e.fetchBalanceAllowance(y(t)):(0,a.aa)(e,y(t)),async cancelOrder(t){if(!e.cancelOrder)throw Error("Unified Polymarket SDK client cannot cancel orders");if(!t.orderId)throw Error("Polymarket order id is required");return e.cancelOrder({orderId:t.orderId})},async isOrderScoring(t){if(!e.fetchOrderScoring)return{scoring:!1};if(!t.orderId)throw Error("Polymarket order id is required");return{scoring:await e.fetchOrderScoring({orderId:t.orderId})}},async areOrdersScoring(t){var n;return e.fetchOrdersScoring?e.fetchOrdersScoring({orderIds:null!=(n=t.orderIds)?n:[]}):{}}},r=e.fetchMarketInfo?e.fetchMarketInfo.bind(e):t=>(0,a.Kb)(e,t);return n.fetchMarketInfo=e=>r(e),n.getClobMarketInfo=e=>r({conditionId:e}),n}async function E(e){var t,n,a;let s={signer:e.credentials&&!1===e.allowFreshAuthentication?D(n=e.signer)||"function"==typeof n?new Proxy(n,{get:(e,t,n)=>"signTypedData"===t||"signMessage"===t||"sendTransaction"===t?async()=>{x()}:Reflect.get(e,t,n)}):n:e.signer};(e.wallet&&(s.wallet=e.wallet),e.apiKey&&(s.apiKey=e.apiKey),e.environment&&(s.environment=e.environment),e.credentials)?s.credentials={key:(a=e.credentials).apiKey,secret:a.apiSecret,passphrase:a.apiPassphrase}:void 0!==e.nonce&&(s.nonce=e.nonce);let o=null!=(t=e.createSecureClientImpl)?t:e=>(0,r.vGH)(e),l=await o(s);return{client:l,appCredentials:function(e){if(!D(e))throw Error("Unified Polymarket SDK client did not return credentials");return(0,i.mS)(e.credentials)}(l)}}async function A(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null!=(t=n.client)?t:m({apiKey:n.apiKey,environment:n.environment}),a=await r.fetchOrderBook({tokenId:e});return(0,o.Po)(a)}function D(e){return"object"==typeof e&&null!==e}function _(e){if(!D(e))throw Error("Malformed builder fee rates payload");return{maker:F(e.maker,"maker"),taker:F(e.taker,"taker")}}function F(e,t){if("number"!=typeof e||!Number.isFinite(e)||e<0)throw Error("Malformed builder fee rate: ".concat(t," must be a finite non-negative number"));return e}async function U(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===e.length)return[];let r=null!=(t=n.client)?t:m({apiKey:n.apiKey,environment:n.environment});if(!r.fetchOrderBooks)throw Error("Unified Polymarket SDK client cannot fetch order books");let a=await r.fetchOrderBooks(e.map(e=>({tokenId:e})));return Array.isArray(a)?a.map(o.Po):[]}async function T(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null!=(t=n.client)?t:m({apiKey:n.apiKey,environment:n.environment});
1return r.fetchMarketInfo?await r.fetchMarketInfo({conditionId:e}):await (0,a.Kb)(r,{conditionId:e})}async function P(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=null!=(n=r.client)?n:m({apiKey:r.apiKey,environment:r.environment});if(!a.fetchPrice)throw Error("Unified Polymarket SDK client cannot fetch price");return await a.fetchPrice({tokenId:e,side:t})}async function O(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=null!=(t=r.client)?t:m({apiKey:r.apiKey,environment:r.environment});return{history:(await (0,l._C)(a,e,n)).map(e=>{let{t,p:n}=e;return{t,p:Number(n)}})}}async function I(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null!=(t=n.client)?t:m({apiKey:n.apiKey,environment:n.environment});return r.fetchBuilderFeeRates?_(await r.fetchBuilderFeeRates({builderCode:e})):_(await (0,a.Mb)(r,{builderCode:e}))}},44110:(e,t,n)=>{n.d(t,{Zw:()=>L});var r=n(9775),a=n(52521),s=n(83655),o=n(84638);n(68079);var i=n(77546),l=n(89048),c=n(88472),d=n(63272);async function u(e){try{let t=await (0,d.aY)(e),n=await t.fetchNotifications();return Array.isArray(n)?n:[]}catch(t){throw(0,c.gg)(t)&&(0,d.T2)(e),t}}async function m(e,t){let n=await (0,d.aY)(e),r={ids:t.map(e=>String(e))};await n.dropNotifications(r)}var f=n(40822),p=n(11137),h=function(e){return e[e.ORDER_CANCELLATION=1]="ORDER_CANCELLATION",e[e.ORDER_FILL=2]="ORDER_FILL",e[e.MARKET_RESOLVED=4]="MARKET_RESOLVED",e}({});let x=(0,i.h)("notifications"),b=new Set([h.ORDER_CANCELLATION,h.ORDER_FILL,h.MARKET_RESOLVED]);var g=n(74333),w=n(57322),y=n(58972),k=n(76394),v=n(45597),j=n(57079),N=n(99085),C=n(48411),S=n(79426),E=n(59366),A=n(26866),D=n(99680),_=n(60386),F=n(4459),U=n(65165),T=n(55679);function P(e){let t,n,s,i,l,c,d,u,m,f,p,x,b,g,w,y,k,v,j,C=(0,a.c)(54),{notification:S,onDismiss:P,showDismiss:O,compact:I}=e,L=void 0===O||O,M=void 0!==I&&I;C[0]!==S.type?(t=function(e){switch(e){case h.ORDER_FILL:return{icon:E.A,bgColor:"bg-emerald-500/10",iconColor:"text-emerald-500",label:"Order Filled"};case h.ORDER_CANCELLATION:return{icon:A.A,bgColor:"bg-amber-500/10",iconColor:"text-amber-500",label:"Order Canceled"};case h.MARKET_RESOLVED:return{icon:D.A,bgColor:"bg-blue-500/10",iconColor:"text-blue-500",label:"Market Resolved"};default:return{icon:_.A,bgColor:"bg-muted",iconColor:"text-muted-foreground",label:"Notification"}}}(S.type),C[0]=S.type,C[1]=t):t=C[1];let B=t;C[2]!==S?(n=function(e){let{type:t,payload:n}=e;switch(t){case h.ORDER_FILL:{var r,a;let e="BUY"===n.side?"bought":"sold",t=n.trader_side?"MAKER"===n.trader_side?"(maker)":"(taker)":"",s=null!=(a=null!=(r=n.matched_size)?r:n.size)?a:"0",o=n.outcome?" ".concat(n.outcome):"",i=Number.parseFloat(n.price),l=Number.isNaN(i)?n.price:i.toFixed(2);return"You ".concat(e," ").concat(s).concat(o," shares at $").concat(l).concat(t?" ".concat(t):"")}case h.ORDER_CANCELLATION:{let e=n.reason?": ".concat(n.reason):"";return"Order was canceled".concat(e)}case h.MARKET_RESOLVED:{let e=n.winning_outcome||n.outcome||"Unknown";return"Market resolved: ".concat(e)}default:var s=n;if(s&&"object"==typeof s){for(let e of["message","title","text","description","body"]){let t=s[e];if("string"==typeof t&&t.trim())return t.trim()}if("string"==typeof s.outcome&&s.outcome.trim())return"Outcome: ".concat(s.outcome.trim())}return"New notification"}}(S),C[2]=S,C[3]=n):n=C[3];let R=n;C[4]!==S?(s=function(e){let{payload:t}=e;if(!t||"object"!=typeof t)return null;for(let e of["question","name","market","title"]){let n=t[e];if("string"!=typeof n)continue;let r=n.trim();if(!(!r||/^0x[a-fA-F0-9]{32,}$/.test(r)))return r}return null}(S),C[4]=S,C[5]=s):s=C[5];let z=s;C[6]!==S.timestamp?(i=S.timestamp?(0,T.KW)(1e3*S.timestamp,"verbose"):"",C[6]=S.timestamp,C[7]=i):i=C[7];let K=i,q=B.icon,$=M?"p-2":"p-3";C[8]!==$?(l=(0,N.cn)("group relative flex items-start gap-3 rounded-xl transition-colors",$,"hover:bg-muted/50"),C[8]=$,C[9]=l):l=C[9];let W=M?"h-8 w-8":"h-10 w-10";C[10]!==B.bgColor||C[11]!==W?(c=(0,N.cn)("flex shrink-0 items-center justify-center rounded-lg",W,B.bgColor),C[10]=B.bgColor,C[11]=W,C[12]=c):c=C[12],C[13]!==B.iconColor?(d=(0,N.cn)("h-4 w-4",B.iconColor),C[13]=B.iconColor,C[14]=d):d=C[14],C[15]!==q||C[16]!==d?(u=(0,r.jsx)(q,{className:d}
1),C[15]=q,C[16]=d,C[17]=u):u=C[17],C[18]!==c||C[19]!==u?(m=(0,r.jsx)("div",{className:c,children:u}),C[18]=c,C[19]=u,C[20]=m):m=C[20];let V=M?"text-xs":"text-sm";C[21]!==B.iconColor||C[22]!==V?(f=(0,N.cn)("font-semibold",V,B.iconColor),C[21]=B.iconColor,C[22]=V,C[23]=f):f=C[23],C[24]!==B.label||C[25]!==f?(p=(0,r.jsx)("span",{className:f,children:B.label}),C[24]=B.label,C[25]=f,C[26]=p):p=C[26],C[27]!==K?(x=K&&(0,r.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(F.A,{className:"h-3 w-3"}),K]}),C[27]=K,C[28]=x):x=C[28],C[29]!==p||C[30]!==x?(b=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[p,x]}),C[29]=p,C[30]=x,C[31]=b):b=C[31],C[32]!==M||C[33]!==z?(g=z&&(0,r.jsx)("p",{className:(0,N.cn)("font-medium leading-snug text-foreground",M?"text-xs":"text-sm","line-clamp-2"),children:z}),C[32]=M,C[33]=z,C[34]=g):g=C[34];let Y=M?"text-xs":"text-sm";return C[35]!==Y?(w=(0,N.cn)("text-muted-foreground leading-snug",Y,"line-clamp-2"),C[35]=Y,C[36]=w):w=C[36],C[37]!==R||C[38]!==w?(y=(0,r.jsx)("p",{className:w,children:R}),C[37]=R,C[38]=w,C[39]=y):y=C[39],C[40]!==b||C[41]!==g||C[42]!==y?(k=(0,r.jsxs)("div",{className:"flex-1 min-w-0 space-y-1",children:[b,g,y]}),C[40]=b,C[41]=g,C[42]=y,C[43]=k):k=C[43],C[44]!==M||C[45]!==S.id||C[46]!==P||C[47]!==L?(v=L&&P&&(0,r.jsxs)(o.$,{variant:"ghost",size:"icon",className:(0,N.cn)("shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",M?"h-6 w-6":"h-8 w-8"),onClick:e=>{e.stopPropagation(),P(S.id)},children:[(0,r.jsx)(U.A,{className:(0,N.cn)(M?"h-3 w-3":"h-4 w-4")}),(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"})]}),C[44]=M,C[45]=S.id,C[46]=P,C[47]=L,C[48]=v):v=C[48],C[49]!==m||C[50]!==k||C[51]!==v||C[52]!==l?(j=(0,r.jsxs)("div",{className:l,children:[m,k,v]}),C[49]=m,C[50]=k,C[51]=v,C[52]=l,C[53]=j):j=C[53],j}function O(e){let t,n,s,o,i=(0,a.c)(32),{notifications:l,isLoading:c,onDismiss:d,showDismiss:u,compact:m,emptyMessage:f,maxItems:p,className:h}=e,x=void 0===u||u,b=void 0!==m&&m,g=void 0===f?"No notifications":f;i[0]!==p||i[1]!==l?(t=p?l.slice(0,p):l,i[0]=p,i[1]=l,i[2]=t):t=i[2];let w=t;if(void 0!==c&&c){let e,t,n,a;return i[3]!==h?(e=(0,N.cn)("flex flex-col items-center justify-center py-8 text-muted-foreground",h),i[3]=h,i[4]=e):e=i[4],i[5]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)(C.A,{className:"h-6 w-6 animate-spin mb-2"}),n=(0,r.jsx)("p",{className:"text-sm",children:"Loading notifications..."}),i[5]=t,i[6]=n):(t=i[5],n=i[6]),i[7]!==e?(a=(0,r.jsxs)("div",{className:e,children:[t,n]}),i[7]=e,i[8]=a):a=i[8],a}if(0===l.length){let e,t,n,a,s;return i[9]!==h?(e=(0,N.cn)("flex flex-col items-center justify-center py-8 text-muted-foreground",h),i[9]=h,i[10]=e):e=i[10],i[11]===Symbol.for("react.memo_cache_sentinel")?(t=(0,r.jsx)("div",{className:"flex items-center justify-center h-12 w-12 rounded-full bg-muted mb-3",children:(0,r.jsx)(S.A,{className:"h-6 w-6"})}),i[11]=t):t=i[11],i[12]!==g?(n=(0,r.jsx)("p",{className:"text-sm font-medium text-center",children:g}),i[12]=g,i[13]=n):n=i[13],i[14]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("p",{className:"text-xs mt-1 text-center text-balance max-w-60",children:"You'll see order fills, cancellations, and market resolutions here"}),i[14]=a):a=i[14],i[15]!==e||i[16]!==n?(s=(0,r.jsxs)("div",{className:e,children:[t,n,a]}),i[15]=e,i[16]=n,i[17]=s):s=i[17],s}if(i[18]!==h?(n=(0,N.cn)("divide-y divide-border/50",h),i[18]=h,i[19]=n):n=i[19],i[20]!==b||i[21]!==w||i[22]!==d||i[23]!==x){let e;i[25]!==b||i[26]!==d||i[27]!==x?(e=e=>(0,r.jsx)(P,{notification:e,onDismiss:d,showDismiss:x,compact:b},e.id),i[25]=b,i[26]=d,i[27]=x,i[28]=e):e=i[28],s=w.map(e),i[20]=b,i[21]=w,i[22]=d,i[23]=x,i[24]=s}else s=i[24];return i[29]!==n||i[30]!==s?(o=(0,r.jsx)("div",{className:n,children:s}),i[29]=n,i[30]=s,i[31]=o):o=i[31],o}function I(e){let t,n,s,i,l,c,d,u,m,f=(0,a.c)(34),{notifications:p,isLoading:h,onDismiss:x,onDismissAll:b,onRefresh:C,children:S,open:E,onOpenChange:A,side:D,align:_,needsSetup:F}=e,U=void 0!==h&&h,T=void 0===D?"right":D,P=void 0===_?"start":_,I=void 0!==F&&F,{setShowOnboarding:L}=(0,j.z)(),M=p.length>0;f[0]!==A||f[1]!==L?(t=()=>{null==A||A(!1),L(!0)},f[0]=A,f[1]=L,f[2]=t):t=f[2];let B=t;return f[3]!==S?(n=(0,r.jsx)(v.Wv,{asChild:!0,children:S}),f[3]=S,f[4]=n):n=f[4],f[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h3",{className:"font-semibold text-sm",children:"Notifications"}),f[5]=s):s=f[5],f[6]!==U||f[7]!==I||f[8]!==C?(i=!I&&C&&(0,r.jsxs)(o.$,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,disabled:U,children:[(0,r.jsx)(g.A,{className:(0,N.cn)("h-3.5 w-3.5",U&&"animate-spin")}),(0,r.jsx)("span",{className:"sr-only",children:"Refresh"})]}),f[6]=U,f[7]=I,f[8]=C,f[9]=i):i=f[9],f[10]!==M||f[11]!==I||f[12]!==b?(l=!I&&M&&b&&(0,r.jsxs)(o.$,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:b,title:"Mark all as read",children:[(0,r.jsx)(w.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"sr-only",children:"Mark all as read"})]}),f[10]=M,f[11]=I,f[12]=b,f[13]=l):l=f[13],f[14]!==i||f[15]!==l?(c=(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/50",children:[s,(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[i,l]})]}),f[14]=i,f[15]=l,f[16]=c):c=f[16],f[17]!==B||f[18]!==M||f[19]!==U||f[20]!==I||f[21]!==p||f[22]!==x?(d=I?(0,r.jsxs)("div",{className:"p-6 text-center",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 border border-border/60 mb-4",children:(0,r.jsx)(y.A,{className:"h-5 w-5 text-foreground"})}),(0,r.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground mb-2",children:"\xa7 Setup Required"}),(0,r.jsx)("h4",{className:"font-editorial italic font-medium text-xl mb-3",children:"Sign in to see what moved."}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-5 max-w-[220px] mx-auto",children:"Complete trading account setup to receive notifications about your orders and positions."}),(0,r.jsxs)(o.$,{size:"sm",className:"gap-2 font-mono text-[11px] uppercase tracking-[0.14em] font-semibold",onClick:B,children:[(0,r.jsx)(k.A,{className:"h-3.5 w-3.5"}),"Setup Trading"]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"max-h-[420px] overflow-y-auto",children:(0,r.jsx)(O,{notifications:p,isLoading:U,onDismiss:x,showDismiss:!0,compact:!0,maxItems:20,emptyMessage:"All caught up!"})}),M&&(0,r.jsx)("div",{className:"border-t border-border/50 px-4 py-2",children:(0,r.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground text-center",children:"Auto-clears after 48h"})})]}),f[17]=B,f[18]=M,f[19]=U,f[20]=I,f[21]=p,f[22]=x,f[23]=d):d=f[23],f[24]!==P||f[25]!==T||f[26]!==c||f[27]!==d?(u=(0,r.jsxs)(v.hl,{align:P,side:T,sideOffset:12,collisionPadding:16,className:"w-80 max-w-[calc(100vw-2rem)] p-0 rounded-xl shadow-xl border-border/50",children:[c,d]}),f[24]=P,f[25]=T,f[26]=c,f[27]=d,f[28]=u):u=f[28],f[29]!==A||f[30]!==E||f[31]!==u||f[32]!==n?(m=(0,r.jsxs)(v.AM,{open:E,onOpenChange:A,children:[n,u]}),f[29]=A,f[30]=E,f[31]=u,f[32]=n,f[33]=m):m=f[33],m}
1function L(){let e,t,n,i,d,h,g=(0,a.c)(20),[w,y]=(0,s.useState)(!1),{isConnected:k}=(0,l.useConnection)(),{notifications:v,unreadCount:j,isLoading:C,canViewNotifications:E,dismissNotification:A,dismissAll:D,fetchNotifications:_}=function(){let{address:e,isConnected:t}=(0,l.useConnection)(),{credentials:n,hasCredentials:r,clearCredentials:a}=(0,f.K)(),{proxyAddress:o,isDeployed:i}=(0,p.h)(),[d,h]=(0,s.useState)([]),[g,w]=(0,s.useState)(!1),[y,k]=(0,s.useState)(null),[v,j]=(0,s.useState)("all"),[N,C]=(0,s.useState)(new Set),S=(0,s.useRef)(null),E=(0,s.useCallback)(()=>{if(!n)throw Error("API credentials required. Please derive credentials first.");if(!o)throw Error("Trading wallet address required for notifications");if(!e)throw Error("Wallet not connected");return{signerAddress:e,walletAddress:o,credentials:n}},[e,n,o]),A=(0,s.useCallback)(async()=>{if(r&&t){w(!0),k(null);try{let e=[...(await u(E())).map((e,t)=>(function(e,t){var n;let r=Number(e.type);return b.has(r)||x.warn("notification.unrecognized_type",{type:e.type,payload:e.payload}),{id:null!=(n=e.id)?n:t,type:r,owner:e.owner,payload:e.payload,timestamp:e.timestamp}})(e,t))].sort((e,t)=>{var n,r;let a=null!=(n=e.timestamp)?n:0,s=null!=(r=t.timestamp)?r:0;return s!==a?s-a:t.id-e.id});h(e),C(new Set)}catch(t){let e=t instanceof Error?t:Error("Failed to fetch notifications");k(e),(0,c.gg)(t)?(a(),x.debug("fetch.skipped",{reason:"credentials_invalid"})):(0,c.bM)(t)?x.debug("fetch.skipped",{reason:e.message}):x.error("fetch.failed",{error:t})}finally{w(!1)}}},[r,t,E,a]),D=(0,s.useCallback)(async e=>{if(r&&0!==e.length){C(t=>{let n=new Set(t);for(let t of e)n.add(t);return n});try{await m(E(),e),h(t=>t.filter(t=>!e.includes(t.id))),C(new Set)}catch(t){throw C(t=>{let n=new Set(t);for(let t of e)n.delete(t);return n}),x.error("dismiss.failed",{error:t}),t}}},[r,E]),_=(0,s.useCallback)(async e=>{await D([e])},[D]),F=(0,s.useCallback)(async()=>{let e=d.map(e=>e.id);await D(e)},[d,D]),U=(0,s.useMemo)(()=>{let e=d.filter(e=>!N.has(e.id));return"all"===v?e:e.filter(e=>e.type===v)},[d,v,N]),T=(0,s.useMemo)(()=>d.filter(e=>!N.has(e.id)).length,[d,N]),P=(0,s.useMemo)(()=>t&&r&&i&&!!o,[t,r,i,o]);return(0,s.useEffect)(()=>{P&&A()},[P,A]),(0,s.useEffect)(()=>{if(!P){S.current&&(clearInterval(S.current),S.current=null);return}return S.current=setInterval(()=>{A()},3e4),()=>{S.current&&(clearInterval(S.current),S.current=null)}},[P,A]),(0,s.useEffect)(()=>{t||(h([]),C(new Set),k(null))},[t]),{notifications:U,allNotifications:d,unreadCount:T,isLoading:g,error:y,filter:v,canViewNotifications:P,fetchNotifications:A,dismissNotification:_,dismissNotifications:D,dismissAll:F,setFilter:j}}();if(!k)return null;let F=!E,U=j>0;return g[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(S.A,{className:"h-4 w-4"}),g[0]=e):e=g[0],g[1]!==F?(t=F&&(0,r.jsx)("span",{className:(0,N.cn)("absolute top-1 right-1 flex items-center justify-center w-2.5 h-2.5 rounded-full","bg-red-500 border-2 border-background","animate-pulse")}),g[1]=F,g[2]=t):t=g[2],g[3]!==U||g[4]!==F||g[5]!==j?(n=!F&&U&&(0,r.jsx)("span",{className:(0,N.cn)("absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[16px] h-[16px] px-1 text-[9px] font-bold rounded-full","bg-emerald-500 text-white"),children:j>99?"99+":j}),g[3]=U,g[4]=F,g[5]=j,g[6]=n):n=g[6],g[7]===Symbol.for("react.memo_cache_sentinel")?(i=(0,r.jsx)("span",{className:"sr-only",children:"Notifications"}),g[7]=i):i=g[7],g[8]!==t||g[9]!==n?(d=(0,r.jsxs)(o.$,{variant:"ghost",size:"icon",className:"relative h-9 w-9",children:[e,t,n,i]}),g[8]=t,g[9]=n,g[10]=d):d=g[10],g[11]!==D||g[12]!==A||g[13]!==_||g[14]!==C||g[15]!==w||g[16]!==F||g[17]!==v||g[18]!==d?(h=(0,r.jsx)(I,{notifications:v,isLoading:C,onDismiss:A,onDismissAll:D,onRefresh:_,open:w,onOpenChange:y,side:"bottom",align:"end",needsSetup:F,children:d}),g[11]=D,g[12]=A,g[13]=_,g[14]=C,g[15]=w,g[16]=F,g[17]=v,g[18]=d,g[19]=h):h=g[19],h}},45597:(e,t,n)=>{n.d(t,{AM:()=>i,Wv:()=>l,hl:()=>c});var r=n(9775),a=n(52521),s=n(48632),o=n(99085);function i(e){let t,n,o=(0,a.c)(4);return o[0]!==e?({...t}=e,o[0]=e,o[1]=t):t=o[1],o[2]!==t?(n=(0,r.jsx)(s.bL,{"data-slot":"popover",...t}),o[2]=t,o[3]=n):n=o[3],n}function l(e){let t,n,o=(0,a.c)(4);return o[0]!==e?({...t}=e,o[0]=e,o[1]=t):t=o[1],o[2]!==t?(n=(0,r.jsx)(s.l9,{"data-slot":"popover-trigger",...t}),o[2]=t,o[3]=n):n=o[3],n}function c(e){let t,n,i,l,c,d,u=(0,a.c)(12);u[0]!==e?({className:t,align:i,sideOffset:l,...n}=e,u[0]=e,u[1]=t,u[2]=n,u[3]=i,u[4]=l):(t=u[1],n=u[2],i=u[3],l=u[4]);let m=void 0===i?"center":i,f=void 0===l?4:l;return u[5]!==t?(c=(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),u[5]=t,u[6]=c):c=u[6],u[7]!==m||u[8]!==n||u[9]!==f||u[10]!==c?(d=(0,r.jsx)(s.ZL,{children:(0,r.jsx)(s.UC,{"data-slot":"popover-content",align:m,sideOffset:f,className:c,...n})}),u[7]=m,u[8]=n,u[9]=f,u[10]=c,u[11]=d):d=u[11],d}},50691:(e,t,n)=>{n.d(t,{q:()=>ei});var r=n(9775),a=n(77546),s=n(76496),o=n(59845),i=n(71774),l=n(65165),c=n(20556),d=n(83655),u=n(19136),m=n(32082),f=n(3964),p=n(18130),h=n(86303),x=n(89048),b=n(87597),g=n(18810),w=n(82821),y=n(32726),k=n(11137),v=n(25765),j=n(87587),N=n(52521),C=n(23357);let S={POL:.5,MATIC:.5,WMATIC:.5,ETH:3500,WETH:3500,BTC:1e5,WBTC:1e5,USDC:1,"USDC.e":1,pUSD:1,USDT:1,DAI:1};async function E(){return(0,C.x)("/api/polymarket/price/tokens",{method:"GET",headers:{Accept:"application/json"}})}function A(e){return e}let D=[{symbol:"pUSD",name:"Polymarket USD",address:w.QU,decimals:w.uj,logoUrl:"/usdc-token.webp"},{symbol:"USDC",name:"USD Coin",address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",decimals:6,logoUrl:"/usdc-token.webp"},{symbol:"USDC.e",name:"Bridged USDC",address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",decimals:6,logoUrl:"/usdc-token.webp"},{symbol:"DAI",name:"Dai Stablecoin",address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",decimals:18,logoUrl:"https://cryptologos.cc/logos/multi-collateral-dai-dai-logo.png"},{symbol:"USDT",name:"Tether USD",address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",decimals:6,logoUrl:"https://cryptologos.cc/logos/tether-usdt-logo.png"},{symbol:"WETH",name:"Wrapped Ether",address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",decimals:18,logoUrl:"https://cryptologos.cc/logos/ethereum-eth-logo.png"},{symbol:"WMATIC",name:"Wrapped Matic",address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",decimals:18,logoUrl:"https://cryptologos.cc/logos/polygon-matic-logo.png"},{symbol:"WBTC",name:"Wrapped Bitcoin",address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",decimals:8,logoUrl:"https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.png"}],_=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}];async function F(){let{createPublicClient:e,http:t}=await Promise.all([n.e(3773),n.e(8953)]).then(n.bind(n,43773)),{polygon:r}=await Promise.resolve().then(n.bind(n,45462));return e({chain:r,transport:t("/api/rpc/polygon",{timeout:15e3,retryCount:2,retryDelay:1e3}),batch:{multicall:!0}})}let U=null;async function T(){return U||(U=F()),U}async function P(e,t){let{formatUnits:r}=await Promise.all([n.e(3773),n.e(8953)]).then(n.bind(n,43773)),a=await T(),s=D.map(t=>({address:t.address,abi:_,functionName:"balanceOf",args:[e]})),[o,i]=await Promise.all([a.getBalance({address:e}),a.multicall({contracts:s,allowFailure:!0})]),l=Number(r(o,18)),c=[];if(i.forEach((e,n)=>{let a=D[n];if("success"===e.status&&void 0!==e.result){let n=e.result,s=Number(r(n,a.decimals));if(s>1e-6){let e=t(a.symbol);c.push({symbol:a.symbol,name:a.name,address:a.address,decimals:a.decimals,balance:s,balanceRaw:n.toString(),usdValue:s*e,logoUrl:a.logoUrl,depositSupported:!0})}}}),l>1e-6){let e=t("POL");c.push({symbol:"POL",name:"Polygon",address:"0x0000000000000000000000000000000000000000",decimals:18,balance:l,balanceRaw:o.toString(),usdValue:l*e,logoUrl:"https://cryptologos.cc/logos/polygon-matic-logo.png"})}return c.sort((e,t)=>t.usdValue-e.usdValue),{tokens:c,nativeBalance:l}}var O=n(45462),I=n(17001),L=n(31348),M=n(78563),B=n(89091),R=n(99085);let z=[{value:25,label:"25"},{value:50,label:"50"},{value:75,label:"75"},{value:100,label:"Max"}];function K(e){let t,n,a,s,o,i,l,c,d,u,m,f,p,h,x,b,g,w,y,k,v,j=(0,N.c)(46),{amount:C,selectedToken:S,isBelowMinimum:E,selectedTokenMinDeposit:A,enteredAmountUsd:D,isValidAmount:_,onAmountChange:F,onPercentage:U,onContinue:T}=e;j[0]===Symbol.for("react.memo_cache_sentinel")?(t={opacity:0,x:20},n={opacity:1,x:0},a={opacity:0,x:-20},j[0]=t,j[1]=n,j[2]=a):(t=j[0],n=j[1],a=j[2]),j[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-3",children:"You Deposit"}),j[3]=s):s=j[3],j[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)("span",{className:"font-(family-name:--font-geist) text-4xl leading-none text-(--kwm-ink-3) font-medium tracking-tight",children:"$"}),j[4]=o):o=j[4],j[5]!==F?(i=e=>{F(e.target.value.replace(/[^0-9.]/g,""))},j[5]=F,j[6]=i):i=j[6],j[7]!==C||j[8]!==i?(l=(0,r.jsxs)("div",{className:"flex flex-col items-center py-7 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[s,(0,r.jsxs)("div",{className:"flex items-baseline gap-1",children:[o,(0,r.jsx)("input",{type:"text",value:C,onChange:i,placeholder:"0.00",className:"font-(family-name:--font-geist) text-4xl leading-none text-(--kwm-ink) bg-transparent border-none outline-none w-44 text-center tabular-nums placeholder:text-(--kwm-ink-dim) font-medium tracking-tight"})]})]}),j[7]=C,j[8]=i,j[9]=l):l=j[9],j[10]!==U?(c=z.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>U(e.value),className:"h-8 px-3 rounded-md border border-(--kwm-hl) font-mono text-[11px] uppercase tracking-[0.14em] text-(--kwm-ink-3) hover:text-(--kwm-ink) hover:border-(--kwm-hl-3) hover:bg-(--kwm-bg-2) transition-colors",children:e.label},e.value)),j[10]=U,j[11]=c):c=j[11],j[12]!==c?(d=(0,r.jsx)("div",{className:"grid grid-cols-4 gap-2 mt-3",children:c}),j[12]=c,j[13]=d):d=j[13],j[14]!==S.logoUrl||j[15]!==S.symbol?(u=(0,r.jsx)("div",{className:"w-7 h-7 rounded-full bg-(--kwm-bg-3) flex items-center justify-center overflow-hidden shrink-0 border border-(--kwm-hl)",children:S.logoUrl?(0,r.jsx)(B.default,{src:S.logoUrl,alt:S.symbol,width:28,height:28,className:"w-full h-full object-cover",unoptimized:!0}):(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase text-(--kwm-ink-2)",children:S.symbol.slice(0,2)})}),j[14]=S.logoUrl,j[15]=S.symbol,j[16]=u):u=j[16],j[17]===Symbol.for("react.memo_cache_sentinel")?(m=(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-(--kwm-ink-dim)",children:"You Send"}),j[17]=m):m=j[17],j[18]!==S.symbol?(f=(0,r.jsxs)("div",{className:"flex flex-col min-w-0 gap-0.5",children:[m,(0,r.jsx)("span",{className:"text-sm font-medium leading-snug text-(--kwm-ink) truncate",children:S.symbol})]}),j[18]=S.symbol,j[19]=f):f=j[19],j[20]!==u||j[21]!==f?(p=(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[u,f]}),j[20]=u,j[21]=f,j[22]=p):p=j[22],j[23]===Symbol.for("react.memo_cache_sentinel")?(h=(0,r.jsx)(M.A,{className:"h-3.5 w-3.5 text-(--kwm-ink-3) shrink-0"}),j[23]=h):h=j[23],j[24]===Symbol.for("react.memo_cache_sentinel")?(x=(0,r.jsx)("div",{className:"w-7 h-7 rounded-full bg-(--kwm-bg-3) flex items-center justify-center overflow-hidden shrink-0 border border-(--kwm-hl)",children:(0,r.jsx)(B.default,{src:"/usdc-token.webp",alt:"pUSD",width:28,height:28,className:"w-full h-full object-cover"})}),j[24]=x):x=j[24],j[25]===Symbol.for("react.memo_cache_sentinel")?(b=(0,r.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[x,(0,r.jsxs)("div",{className:"flex flex-col min-w-0 gap-0.5",children:[(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-(--kwm-ink-dim)",children:"You Receive"}),(0,r.jsx)("span",{className:"text-sm font-medium leading-snug text-(--kwm-ink)",children:"pUSD"})]})]}),j[25]=b):b=j[25],j[26]!==p?(g=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 mt-4 px-3.5 py-3 border border-(--kwm-hl) rounded-md",children:[p,h,b]}),j[26]=p,j[27]=g):g=j[27],j[28]!==C||j[29]!==D||j[30]!==E||j[31]!==A?(w=E&&C&&(0,r.jsxs)("div",{className:"mt-3 px-3 py-2 border border-(--kwm-warn-border) bg-(--kwm-warn-soft) rounded-md",children:[(0,r.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-warn) mb-1",children:"Below Minimum"}),(0,r.jsxs)("p",{className:"text-sm text-(--kwm-ink) leading-snug",children:["Minimum deposit is"," ",(0,r.jsxs)("span",{className:"tabular-nums font-medium",children:["$",A]}),". You entered"," ",(0,r.jsxs)("span",{className:"tabular-nums",children:["$",D.toFixed(2)]}),"."]})]}),j[28]=C,j[29]=D,j[30]=E,j[31]=A,j[32]=w):w=j[32];let P=!_,O=_?"bg-(--kwm-ink) text-(--kwm-bg) hover:opacity-90":"bg-(--kwm-bg-3) text-(--kwm-ink-dim) cursor-not-allowed border border-(--kwm-hl)";j[33]!==O?(y=(0,R.cn)("mt-5 w-full h-11 rounded-md font-mono text-[11px] uppercase tracking-[0.18em] font-semibold transition-colors",O),j[33]=O,j[34]=y):y=j[34];let I=E?"Min \xb7 $".concat(A," Required"):"Continue";return j[35]!==T||j[36]!==P||j[37]!==y||j[38]!==I?(k=(0,r.jsx)("button",{type:"button",onClick:T,disabled:P,className:y,children:I}),j[35]=T,j[36]=P,j[37]=y,j[38]=I,j[39]=k):k=j[39],j[40]!==g||j[41]!==w||j[42]!==k||j[43]!==l||j[44]!==d?(v=(0,r.jsxs)(L.m.div,{initial:t,animate:n,exit:a,className:"flex flex-col",children:[l,d,g,w,k]},"amount"),j[40]=g,j[41]=w,j[42]=k,j[43]=l,j[44]=d,j[45]=v):v=j[45],v}var q=n(73601),$=n(48411),W=n(61329);function V(e){let t,n,a,s,o,i,l,c,d,u=(0,N.c)(18),{isLoading:m,searchQuery:f,filteredBridgeAssets:p,isProcessing:h,onSearchChange:x,onSelectAsset:b}=e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(t={opacity:0,x:20},n={opacity:1,x:0},a={opacity:0,x:-20},u[0]=t,u[1]=n,u[2]=a):(t=u[0],n=u[1],a=u[2]),u[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(q.A,{className:"h-3.5 w-3.5 text-(--kwm-ink-3) shrink-0"}),u[3]=s):s=u[3],u[4]!==x?(o=e=>x(e.target.value),u[4]=x,u[5]=o):o=u[5],u[6]!==f||u[7]!==o?(i=(0,r.jsxs)("div",{className:"relative flex items-center h-9 px-3 gap-2 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2) focus-within:border-(--kwm-hl-3) transition-colors mb-4",children:[s,(0,r.jsx)("input",{type:"text",placeholder:"Search chain or token",value:f,onChange:o,className:"flex-1 h-full bg-transparent border-none focus:outline-none text-sm text-(--kwm-ink) placeholder:text-(--kwm-ink-dim)"})]}),u[6]=f,u[7]=o,u[8]=i):i=u[8],u[9]===Symbol.for("react.memo_cache_sentinel")?(l=(0,r.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-3",children:"Auto-converted \xb7 pUSD on Polygon"}),u[9]=l):l=u[9],u[10]!==p||u[11]!==m||u[12]!==h||u[13]!==b?(c=m?(0,r.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,r.jsx)($.A,{className:"h-5 w-5 animate-spin text-(--kwm-ink-3)"})}):(0,r.jsx)("div",{className:"flex flex-col gap-2 max-h-[400px] overflow-y-auto pr-1",children:p.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>b(e),disabled:h,className:"group w-full flex items-center justify-between gap-4 px-3.5 py-3 border border-(--kwm-hl) rounded-md text-left transition-colors hover:border-(--kwm-hl-3) hover:bg-(--kwm-bg-2) disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3 min-w-0",children:[(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-dim) shrink-0 w-16 truncate",children:e.chainName}),(0,r.jsx)("span",{className:"text-[14px] font-medium leading-snug text-(--kwm-ink) truncate",children:e.token.symbol})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-(--kwm-ink-dim)",children:"Min"}),(0,r.jsxs)("span",{className:"font-mono text-xs text-(--kwm-ink-2) tabular-nums",children:["$",e.minCheckoutUsd]})]}),(0,r.jsx)(W.A,{className:"h-3.5 w-3.5 text-(--kwm-ink-3) group-hover:text-(--kwm-ink) transition-colors"})]})]},"".concat(e.chainId,"-").concat(e.token.symbol,"-").concat(e.token.address)))}),u[10]=p,u[11]=m,u[12]=h,u[13]=b,u[14]=c):c=u[14],u[15]!==i||u[16]!==c?(d=(0,r.jsxs)(L.m.div,{initial:t,animate:n,exit:a,className:"flex flex-col",children:[i,l,c]},"bridge-select"),u[15]=i,u[16]=c,u[17]=d):d=u[17],d}var Y=n(67169),Q=n(11410),H=n(55679);function G(e){let t,n,a,s,o=(0,N.c)(10),{label:i,children:l,muted:c}=e;o[0]!==i?(t=(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) shrink-0",children:i}),o[0]=i,o[1]=t):t=o[1];let d=c?"text-(--kwm-ink-dim)":"text-(--kwm-ink)";return o[2]!==d?(n=(0,R.cn)("font-mono text-xs tabular-nums text-right min-w-0 truncate",d),o[2]=d,o[3]=n):n=o[3],o[4]!==l||o[5]!==n?(a=(0,r.jsx)("span",{className:n,children:l}),o[4]=l,o[5]=n,o[6]=a):a=o[6],o[7]!==t||o[8]!==a?(s=(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-4 py-2 border-b border-(--kwm-hl) last:border-b-0",children:[t,a]}),o[7]=t,o[8]=a,o[9]=s):s=o[9],s}function J(e){let t,n,a,s,o,i=(0,N.c)(12),{tone:l,caption:c,children:d}=e;
1if(i[0]!==l){let e={info:{border:"border-(--kwm-accent)/40",bg:"bg-(--kwm-accent-soft)",text:"text-(--kwm-accent)"},warn:{border:"border-(--kwm-warn-border)",bg:"bg-(--kwm-warn-soft)",text:"text-(--kwm-warn)"},error:{border:"border-(--kwm-down)/40",bg:"bg-(--kwm-down-soft)",text:"text-(--kwm-down)"},success:{border:"border-(--kwm-up-border)",bg:"bg-(--kwm-up-soft)",text:"text-(--kwm-up)"}}[l];n=(0,R.cn)("mt-4 px-3 py-2 border rounded-md",e.border,e.bg),t=(0,R.cn)("font-mono text-[10px] uppercase tracking-[0.14em] mb-1 tabular-nums",e.text),i[0]=l,i[1]=t,i[2]=n}else t=i[1],n=i[2];return i[3]!==c||i[4]!==t?(a=(0,r.jsx)("p",{className:t,children:c}),i[3]=c,i[4]=t,i[5]=a):a=i[5],i[6]!==d?(s=(0,r.jsx)("p",{className:"text-sm text-(--kwm-ink) leading-snug",children:d}),i[6]=d,i[7]=s):s=i[7],i[8]!==n||i[9]!==a||i[10]!==s?(o=(0,r.jsxs)("div",{className:n,children:[a,s]}),i[8]=n,i[9]=a,i[10]=s,i[11]=o):o=i[11],o}function X(e){let t,n,a,o,i,l,c,d,u=(0,N.c)(37),{selectedMethod:m,selectedBridgeAsset:f,selectedToken:p,isProcessing:h,bridgeAddress:x,amount:b,address:g,receiveAmount:w,depositError:y,isPending:k,isConfirming:v,isOnChainConfirmed:j,isConfirmed:C,isWalletReady:S,copied:E,onCopy:A,onDeposit:D,quote:_,isLoadingQuote:F,depositTransactions:U,isLoadingDepositStatus:T}=e;u[0]!==p?(t=!!p&&(0,s.Es)(p.symbol,p.address),u[0]=p,u[1]=t):t=u[1];let P=t;u[2]!==_||u[3]!==w?(n=_?(Number(_.estToTokenBaseUnit)/1e6).toFixed(2):w,u[2]=_,u[3]=w,u[4]=n):n=u[4];let O=n;u[5]!==P||u[6]!==_?(a=_?(0,s.tV)(_.estCheckoutTimeMs):P?"On-chain":"< 2 min",u[5]=P,u[6]=_,u[7]=a):a=u[7];let I=a;return u[8]===Symbol.for("react.memo_cache_sentinel")?(o={opacity:0,x:20},i={opacity:1,x:0},l={opacity:0,x:-20},u[8]=o,u[9]=i,u[10]=l):(o=u[8],i=u[9],l=u[10]),u[11]!==g||u[12]!==b||u[13]!==x||u[14]!==E||u[15]!==y||u[16]!==U||u[17]!==O||u[18]!==I||u[19]!==C||u[20]!==v||u[21]!==P||u[22]!==T||u[23]!==F||u[24]!==j||u[25]!==k||u[26]!==h||u[27]!==S||u[28]!==A||u[29]!==D||u[30]!==_||u[31]!==f||u[32]!==m||u[33]!==p?(c="bridge"===m&&f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col items-center py-5 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-2",children:f.chainName}),(0,r.jsxs)("span",{className:"text-2xl font-semibold leading-none text-(--kwm-ink) tracking-tight",children:["Deposit ",f.token.symbol]})]}),h?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)($.A,{className:"h-5 w-5 animate-spin text-(--kwm-ink-3)"})}):x?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mt-4 px-3.5 py-3 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsxs)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-2",children:["Send ",f.token.symbol," to"]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("code",{className:"flex-1 font-mono text-xs break-all text-(--kwm-ink) leading-relaxed",children:x}),(0,r.jsx)("button",{type:"button",onClick:A,className:"shrink-0 text-(--kwm-ink-3) hover:text-(--kwm-ink) transition-colors","aria-label":"Copy address",children:E?(0,r.jsx)(Y.A,{className:"h-4 w-4 text-(--kwm-up)"}):(0,r.jsx)(Q.A,{className:"h-4 w-4"})})]})]}),(0,r.jsx)("button",{type:"button",onClick:A,className:"mt-4 w-full h-11 rounded-md bg-(--kwm-ink) text-(--kwm-bg) font-mono text-[11px] uppercase tracking-[0.18em] font-semibold hover:opacity-90 transition-colors",children:E?"Address Copied":"Copy Deposit Address"}),(0,r.jsx)(J,{tone:"warn",caption:"Minimum \xb7 $".concat(f.minCheckoutUsd),children:"Assets will be converted to pUSD on Polygon â Polymarket's V2 trading token."})]}):(0,r.jsx)("div",{className:"py-12 text-center text-sm text-(--kwm-ink-3)",children:"Failed to get deposit address. Please try again."})]}):p?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col items-center py-5 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-2",children:"You Deposit"}),(0,r.jsxs)("div",{className:"flex items-baseline gap-0.5 font-(family-name:--font-geist) font-semibold tracking-tight",children:[(0,r.jsx)("span",{className:"text-3xl leading-none text-(--kwm-ink-3)",children:"$"}),(0,r.jsx)("span",{className:"text-4xl leading-none text-(--kwm-ink) tabular-nums",children:Number.parseFloat(b||"0").toFixed(2)})]})]}),!P&&(0,r.jsxs)(J,{tone:"info",caption:"Auto-Conversion",children:["Your ",p.symbol," routes through Polymarket Bridge and lands as pUSD on Polygon."]}),(0,r.jsxs)("div",{className:"mt-4 px-3.5 py-1 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsxs)(G,{label:"Source",children:["Wallet \xb7 ",g?(0,H.M0)(g):"â"]}),(0,r.jsx)(G,{label:"Via",children:P?"Direct transfer":"Polymarket Bridge"}),(0,r.jsx)(G,{label:"Destination",children:"Polymarket Wallet"}),(0,r.jsx)(G,{label:"Est. Time",children:I})]}),(0,r.jsxs)("div",{className:"mt-3 px-3.5 py-1 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsxs)(G,{label:"You Send",children:[b," ",p.symbol]}),(0,r.jsx)(G,{label:_?"You Receive":"You Receive ~",children:F?(0,r.jsx)($.A,{className:"h-3 w-3 animate-spin inline"}):"".concat(_?"":"~").concat(O," pUSD")}),P?(0,r.jsx)(G,{label:"Network Cost",muted:!0,children:"Polygon gas"}):(null==_?void 0:_.estFeeBreakdown)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(G,{label:"Gas Fee",muted:!0,children:["$",_.estFeeBreakdown.gasUsd.toFixed(4)]}),_.estFeeBreakdown.swapImpactUsd>0?(0,r.jsxs)(G,{label:"Swap Impact",muted:!0,children:["$",_.estFeeBreakdown.swapImpactUsd.toFixed(4)]}):null,_.estFeeBreakdown.appFeeUsd>0?(0,r.jsxs)(G,{label:_.estFeeBreakdown.appFeeLabel||"App Fee",muted:!0,children:["$",_.estFeeBreakdown.appFeeUsd.toFixed(4)]}):null,_.estFeeBreakdown.maxSlippage>0?(0,r.jsxs)(G,{label:"Max Slippage",muted:!0,children:[(100*_.estFeeBreakdown.maxSlippage).toFixed(2),"%"]}):null,(0,r.jsxs)(G,{label:"Min. Received",children:[_.estFeeBreakdown.minReceived.toFixed(2)," pUSD"]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G,{label:"Network Cost",muted:!0,children:"~$0.01"}),(0,r.jsx)(G,{label:"Bridge Fee",muted:!0,children:"~0.1%"})]})]}),y&&(0,r.jsx)(J,{tone:"error",caption:"Transaction Failed",children:y.length>150?"".concat(y.slice(0,150),"â¦"):y}),!x&&!h&&(0,r.jsx)(J,{tone:"warn",caption:"Bridge Address Missing",children:"Go back and try again."}),j&&v&&!C&&(0,r.jsx)(J,{tone:"info",caption:"On-Chain Confirmed",children:P?"Waiting for the direct pUSD transfer to finalize.":"Waiting for the bridge to credit pUSD to your Polymarket wallet."}),C&&(0,r.jsx)(J,{tone:"success",caption:"Deposit Complete",children:"pUSD has been credited to your Polymarket wallet."}),(j||C)&&U&&U.length>0?(0,r.jsxs)("div",{className:"mt-4 px-3.5 py-2 border border-(--kwm-hl) rounded-md bg-(--kwm-bg-2)",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between py-1.5 border-b border-(--kwm-hl)",children:[(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3)",children:"Bridge Status"}),T?(0,r.jsx)($.A,{className:"h-3 w-3 animate-spin text-(--kwm-ink-3)"}):null]}),U.slice(0,3).map(Z)]}):null,(0,r.jsxs)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-dim) text-center mt-5 mb-3",children:["By confirming you agree to our"," ",(0,r.jsx)("span",{className:"text-(--kwm-ink-3) cursor-pointer underline underline-offset-4 decoration-(--kwm-hl)",children:"Terms"})]}),(0,r.jsx)("button",{type:"button",onClick:D,disabled:!x||!S||h||k||v||j||C,className:(0,R.cn)("w-full h-11 rounded-md font-mono text-[11px] uppercase tracking-[0.18em] font-semibold transition-colors",C?"bg-(--kwm-up-soft) text-(--kwm-up) cursor-default border border-(--kwm-up-border)":!x||!S||h||k||v||j?"bg-(--kwm-bg-3) text-(--kwm-ink-dim) cursor-not-allowed border border-(--kwm-hl)":"bg-(--kwm-up) text-(--kwm-bg) hover:opacity-90"),children:k?(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)($.A,{className:"h-3.5 w-3.5 animate-spin"}),"Confirm in Wallet"]}):j&&v?(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)($.A,{className:"h-3.5 w-3.5 animate-spin"}),P?"Finalizing":"Waiting for Bridge"]}):v?(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)($.A,{className:"h-3.5 w-3.5 animate-spin"}),"Confirming On-Chain"]}):j?P?"Finalizing":"Bridge Update Pending":C?(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)(Y.A,{className:"h-3.5 w-3.5"}),"Deposit Complete"]}
1):x?S?"Confirm Deposit":"Wallet Loading":P?"Loading Wallet":"Loading Bridge"})]}):null,u[11]=g,u[12]=b,u[13]=x,u[14]=E,u[15]=y,u[16]=U,u[17]=O,u[18]=I,u[19]=C,u[20]=v,u[21]=P,u[22]=T,u[23]=F,u[24]=j,u[25]=k,u[26]=h,u[27]=S,u[28]=A,u[29]=D,u[30]=_,u[31]=f,u[32]=m,u[33]=p,u[34]=c):c=u[34],u[35]!==c?(d=(0,r.jsx)(L.m.div,{initial:o,animate:i,exit:l,className:"flex flex-col",children:c},"confirm"),u[35]=c,u[36]=d):d=u[36],d}function Z(e,t){let n=(0,s.TJ)(e.status),a="success"===n.tone?"text-(--kwm-up)":"error"===n.tone?"text-(--kwm-down)":"warn"===n.tone?"text-(--kwm-warn)":"text-(--kwm-accent)";return(0,r.jsxs)("div",{className:"flex items-center justify-between py-2 border-b border-(--kwm-hl) last:border-b-0",children:[(0,r.jsx)("span",{className:(0,R.cn)("font-mono text-[11px] uppercase tracking-[0.14em]",a),children:n.text}),(0,r.jsxs)("span",{className:"font-mono text-xs tabular-nums text-(--kwm-ink-3)",children:[(Number(e.fromAmountBaseUnit)/1e6).toFixed(2)," USDC"]})]},"".concat(e.fromAmountBaseUnit,"-").concat(e.createdTimeMs||t))}function ee(e){let t,n=(0,N.c)(3),{tone:a,children:s}=e,o="up"===a?"text-(--kwm-up)":"accent"===a?"text-(--kwm-accent)":"text-(--kwm-ink-3)";return n[0]!==s||n[1]!==o?(t=(0,r.jsx)("span",{className:o,children:s}),n[0]=s,n[1]=o,n[2]=t):t=n[2],t}function et(){let e,t=(0,N.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)("span",{className:"text-(--kwm-ink-dim) mx-1.5",children:"\xb7"}),t[0]=e):e=t[0],e}function en(e){let t,n,a,s,o,i,l,c,d,u=(0,N.c)(25),{index:m,label:f,detail:p,comingSoon:h,disabled:x,recommended:b,onClick:g}=e,w=x||h,y=x||h?"border-(--kwm-hl) cursor-not-allowed opacity-50":b?"border-(--kwm-up-border) bg-(--kwm-up-soft) hover:bg-(--kwm-up-soft) hover:border-(--kwm-up)":"border-(--kwm-hl) hover:border-(--kwm-hl-3) hover:bg-(--kwm-bg-2)";return u[0]!==y?(t=(0,R.cn)("group relative w-full flex items-center justify-between gap-4 px-3.5 py-3 border rounded-md text-left transition-colors overflow-hidden",y),u[0]=y,u[1]=t):t=u[1],u[2]!==b?(n=b&&(0,r.jsx)("span",{"aria-hidden":"true",className:"absolute left-0 top-0 bottom-0 w-[3px] bg-(--kwm-up)"}),u[2]=b,u[3]=n):n=u[3],u[4]!==m?(a=(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-dim) tabular-nums shrink-0",children:m}),u[4]=m,u[5]=a):a=u[5],u[6]!==f?(s=(0,r.jsx)("span",{className:"text-[14px] font-medium leading-snug text-(--kwm-ink) truncate",children:f}),u[6]=f,u[7]=s):s=u[7],u[8]!==p?(o=(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] truncate",children:p}),u[8]=p,u[9]=o):o=u[9],u[10]!==s||u[11]!==o?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s,o]}),u[10]=s,u[11]=o,u[12]=i):i=u[12],u[13]!==a||u[14]!==i?(l=(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[a,i]}),u[13]=a,u[14]=i,u[15]=l):l=u[15],u[16]!==h?(c=(0,r.jsx)("div",{className:"flex items-center gap-3 shrink-0",children:h?(0,r.jsx)("span",{className:"font-mono text-[9px] uppercase tracking-[0.16em] text-(--kwm-warn) border border-(--kwm-warn-border) bg-(--kwm-warn-soft) rounded-sm px-1.5 py-0.5",children:"Soon"}):(0,r.jsx)(W.A,{className:"h-3.5 w-3.5 text-(--kwm-ink-3) group-hover:text-(--kwm-ink) transition-colors"})}),u[16]=h,u[17]=c):c=u[17],u[18]!==g||u[19]!==w||u[20]!==c||u[21]!==t||u[22]!==n||u[23]!==l?(d=(0,r.jsxs)("button",{type:"button",onClick:g,disabled:w,className:t,children:[n,l,c]}),u[18]=g,u[19]=w,u[20]=c,u[21]=t,u[22]=n,u[23]=l,u[24]=d):d=u[24],d}function er(e){let{isConnected:t,address:n,walletTokens:a,walletIsTradingWallet:s,onSelectMethod:o}=e,i=a.reduce((e,t)=>e+t.usdValue,0),l=n?"Wallet \xb7 ".concat((0,H.M0)(n)):"Connect wallet",c=0,d=()=>String(++c).padStart(2,"0");return(0,r.jsxs)(L.m.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"flex flex-col gap-2",children:[!s&&(0,r.jsx)(en,{index:d(),label:l,detail:t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(ee,{tone:"accent",children:["$",i.toFixed(2)]}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{tone:"up",children:"Instant"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ee,{children:"Not connected"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{tone:"up",children:"Instant"})]}),disabled:!t,recommended:t,onClick:e=>o("wallet",e)}
1),(0,r.jsx)(en,{index:d(),label:"Transfer Crypto",detail:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ee,{tone:"accent",children:"No limit"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{tone:"up",children:"Instant"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{tone:"accent",children:"All chains"})]}),onClick:e=>o("bridge",e)}),(0,r.jsx)(en,{index:d(),label:"Deposit with Card",detail:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ee,{children:"Up to $50,000"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{children:"~5 min"})]}),comingSoon:!0}),(0,r.jsx)(en,{index:d(),label:"Connect Exchange",detail:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ee,{tone:"accent",children:"No limit"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{children:"~2 min"})]}),comingSoon:!0}),(0,r.jsx)(en,{index:d(),label:"Deposit with PayPal",detail:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ee,{children:"Up to $10,000"}),(0,r.jsx)(et,{}),(0,r.jsx)(ee,{children:"~5 min"})]}),comingSoon:!0})]},"method")}var ea=n(74333);function es(e){let t,n,a,o,i=(0,N.c)(10),{isLoading:l,walletTokens:c,defaultMinDeposit:d,onRefresh:u,onSelectToken:m,getMinDepositForToken:f}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t={opacity:0,x:20},n={opacity:1,x:0},a={opacity:0,x:-20},i[0]=t,i[1]=n,i[2]=a):(t=i[0],n=i[1],a=i[2]),i[3]!==d||i[4]!==f||i[5]!==l||i[6]!==u||i[7]!==m||i[8]!==c?(o=(0,r.jsx)(L.m.div,{initial:t,animate:n,exit:a,className:"flex flex-col",children:l?(0,r.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,r.jsx)($.A,{className:"h-5 w-5 animate-spin text-(--kwm-ink-3)"})}):0===c.length?(0,r.jsxs)("div",{className:"py-12 text-center border border-(--kwm-hl) rounded-md",children:[(0,r.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-3",children:"No Supported Tokens"}),(0,r.jsx)("p",{className:"text-sm text-(--kwm-ink) mb-5 max-w-[280px] mx-auto leading-relaxed",children:"Your wallet is empty on Polygon â or we can't see it yet."}),(0,r.jsxs)("button",{type:"button",onClick:u,className:"inline-flex items-center gap-2 px-3 h-8 rounded-md border border-(--kwm-hl) font-mono text-[11px] uppercase tracking-[0.14em] text-(--kwm-ink) hover:border-(--kwm-hl-2) hover:bg-(--kwm-bg-2) transition-colors",children:[(0,r.jsx)(ea.A,{className:"h-3 w-3"}),"Retry"]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) mb-3",children:["Minimum varies by token \xb7 typically $",d,"+"]}),(0,r.jsx)("div",{className:"flex flex-col gap-2",children:c.map(e=>{let t=(0,s.Es)(e.symbol,e.address),n=f(e.symbol),a=!1===e.depositSupported&&!t,o=e.usdValue<n,i=a||o;return(0,r.jsxs)("button",{type:"button",onClick:()=>!i&&m(e),disabled:i,className:(0,R.cn)("group w-full flex items-center justify-between gap-4 px-3.5 py-3 border border-(--kwm-hl) rounded-md text-left transition-colors",i?"cursor-not-allowed opacity-50":"hover:border-(--kwm-hl-3) hover:bg-(--kwm-bg-2)"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.jsx)("div",{className:"w-8 h-8 rounded-full bg-(--kwm-bg-3) flex items-center justify-center overflow-hidden shrink-0 border border-(--kwm-hl)",children:e.logoUrl?(0,r.jsx)(B.default,{src:e.logoUrl,alt:e.symbol,width:32,height:32,className:"w-full h-full object-cover",unoptimized:!0}):(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-widest text-(--kwm-ink-2)",children:e.symbol.slice(0,3)})}),(0,r.jsxs)("div",{className:"flex flex-col min-w-0 gap-0.5",children:[(0,r.jsx)("span",{className:"text-[14px] font-medium leading-snug text-(--kwm-ink) truncate",children:e.symbol}),(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-(--kwm-ink-3) tabular-nums",children:e.balance.toFixed(5)})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[a?(0,r.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3) tabular-nums",children:e.depositDisabledReason||"Unsupported"}):o?(0,r.jsxs)("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-warn) tabular-nums",children:["Min \xb7 $",n]}):null,(0,r.jsxs)("span",{className:(0,R.cn)("font-mono text-sm tabular-nums",i?"text-(--kwm-ink-3)":"text-(--kwm-ink)"),children:["$",e.usdValue.toFixed(2)]})]})]},e.address)})})]})},"token"),i[3]=d,i[4]=f,i[5]=l,i[6]=u,i[7]=m,i[8]=c,i[9]=o):o=i[9],o}let eo=(0,a.h)("deposit-modal");function ei(e){var t;let{open:a,onOpenChange:C,onDepositComplete:D}=e,{address:_,isConnected:F}=(0,x.useConnection)(),{data:U}=(0,b.useWalletClient)(),{usdcBalance:T,walletMode:L,refresh:M}=(0,k.h)(),{tokens:B,isLoading:R,refresh:z}=function(e){var t,n,r,a,s,o;let{address:i,isConnected:l}=(0,x.useConnection)(),c=null==(a=null==e?void 0:e.enabled)||a,{getPrice
1:u,isLoading:m,isStale:f}=function(e){var t,n,r,a,s,o,i,l,c,d,u,m;let f,p,h,x,b,g=(0,N.c)(16);g[0]!==e?(f=null!=e?e:{},g[0]=e,g[1]=f):f=g[1];let{enabled:w}=f,y=void 0===w||w;g[2]===Symbol.for("react.memo_cache_sentinel")?(p=j.qk.tokenPrices(),g[2]=p):p=g[2],g[3]!==y?(h={queryKey:p,queryFn:E,enabled:y,staleTime:3e5,refetchInterval:3e5,refetchOnWindowFocus:!0,refetchOnReconnect:!0,placeholderData:A,retry:2,retryDelay:1e3},g[3]=y,g[4]=h):h=g[4];let k=(0,v.I)(h);g[5]!==(null==(t=k.data)?void 0:t.prices)?(x=e=>{var t,n,r;let a=null==(n=k.data)||null==(t=n.prices)?void 0:t[e];return void 0!==a&&a>0?a:null!=(r=S[e])?r:1},g[5]=null==(i=k.data)?void 0:i.prices,g[6]=x):x=g[6];let C=x,D=null!=(l=null==(n=k.data)?void 0:n.prices)?l:S,_=null!=(c=null==(r=k.data)?void 0:r.cached)&&c,F=null!=(d=null==(a=k.data)?void 0:a.stale)?d:!k.data,U=null!=(u=null==(s=k.error)?void 0:s.message)?u:null,T=null!=(m=null==(o=k.data)?void 0:o.timestamp)?m:null;return g[7]!==C||g[8]!==k.isLoading||g[9]!==k.refetch||g[10]!==D||g[11]!==_||g[12]!==F||g[13]!==U||g[14]!==T?(b={getPrice:C,prices:D,isLoading:k.isLoading,isCached:_,isStale:F,error:U,timestamp:T,refetch:k.refetch},g[7]=C,g[8]=k.isLoading,g[9]=k.refetch,g[10]=D,g[11]=_,g[12]=F,g[13]=U,g[14]=T,g[15]=b):b=g[15],b}({enabled:c}),p=(0,v.I)({queryKey:j.qk.wallet.tokens(null!=i?i:""),queryFn:()=>{if(!i)throw Error("No address provided");return P(i,u)},enabled:c&&!!i&&l,staleTime:6e4,refetchOnWindowFocus:!1}),h=(0,d.useMemo)(()=>{var e;return(null==(e=p.data)?void 0:e.tokens)?p.data.tokens.map(e=>({...e,usdValue:e.balance*u(e.symbol)})):[]},[null==(t=p.data)?void 0:t.tokens,u]),b=(0,d.useMemo)(()=>h.reduce((e,t)=>e+t.usdValue,0),[h]);return{tokens:h,nativeBalance:null!=(s=null==(n=p.data)?void 0:n.nativeBalance)?s:0,totalUsdValue:b,isLoading:p.isLoading||m,isPricesStale:f,error:null!=(o=null==(r=p.error)?void 0:r.message)?o:null,refresh:p.refetch}}({enabled:a}),{supportedAssets:q,isLoading:$,proxyAddress:W,getSupportedAssets:Y,createDepositAddresses:Q,getDepositStatus:H,isLoadingDepositStatus:G}=(0,y.VE)(),[J,Z]=(0,d.useState)(!1),[ee,et]=(0,d.useState)(!1),[en,ea]=(0,d.useState)(!1),[ei,el]=(0,d.useState)(!1),[ec,ed]=(0,d.useState)(null),[eu,em]=(0,d.useState)("method"),[ef,ep]=(0,d.useState)(null),[eh,ex]=(0,d.useState)(null),[eb,eg]=(0,d.useState)(null),[ew,ey]=(0,d.useState)(""),[ek,ev]=(0,d.useState)(""),[ej,eN]=(0,d.useState)(null),[eC,eS]=(0,d.useState)(!1),[eE,eA]=(0,d.useState)(""),[eD,e_]=(0,d.useState)(!1),[eF,eU]=(0,d.useState)(null),[eT,eP]=(0,d.useState)(null),[eO,eI]=(0,d.useState)([]),eL=(0,d.useRef)(null),eM=(0,d.useRef)(!1),[eB,eR]=(0,d.useState)(!1),ez=(0,d.useRef)({address:_,selectedToken:eh,amount:ew,selectedMethod:ef});ez.current={address:_,selectedToken:eh,amount:ew,selectedMethod:ef},(0,d.useEffect)(()=>{a||(em("method"),ep(null),ex(null),eg(null),ey(""),ev(""),eN(null),eS(!1),eA(""),e_(!1),eU(null),Z(!1),et(!1),ea(!1),el(!1),ed(null),eP(null),eI([]),eL.current=null,eM.current=!1,eR(!1))},[a]),(0,d.useEffect)(()=>{if(!ei||eM.current)return;eM.current=!0,e_(!1),z(),M(),null==D||D();let e=setTimeout(()=>C(!1),1500);return()=>clearTimeout(e)},[ei,z,M,D,C]),(0,d.useEffect)(()=>{if(ec){let e=(null==ec?void 0:ec.message)||"Transaction failed";e.includes("Timed out while waiting for transaction")?e="Transaction confirmation timed out. Please check your wallet or Polygonscan for the transaction status.":e.includes("User rejected")||e.includes("user rejected")?e="Transaction was rejected.":e.includes("insufficient funds")&&(e="Insufficient funds for this transaction."),eU(e),e_(!1)}},[ec]),(0,d.useEffect)(()=>{a&&("bridge-select"===eu||"token"===eu)&&0===q.length&&Y()},[a,eu,q.length,Y]);let eK=(0,d.useCallback)(e=>(0,s.VQ)(q,e),[q]),eq=(0,d.useMemo)(()=>(0,s.E4)(q),[q]),e$=(0,d.useMemo)(()=>{let e=q.filter(e=>!(0,s.Es)(e.token.symbol,e.token.address));if(!eE.trim())return e;let t=eE.toLowerCase();return e.filter(e=>e.token.symbol.toLowerCase().includes(t)||e.token.name.toLowerCase().includes(t)||e.chainName.toLowerCase().includes(t))},[q,eE]),eW=(0,d.useCallback)((e,t)=>{null==t||t.preventDefault(),null==t||t.stopPropagation(),ep(e),"wallet"===e?em("token"):"bridge"===e&&em("bridge-select")},[]),eV=(0,d.useCallback)(async e=>{if(!1===e.depositSupported&&!(0,s.Es)(e.symbol,e.address))return void eU("".concat(e.symbol," is not supported for Polygon deposits."));ex(e),e_(!0),eU(null),ev(""),eN(null);let t="";try{let n=(0,s.Es)(e.symbol,e.address);if(n&&!W)return void eU("Trading wallet is still loading. Try again in a moment.");let r=n?[]:q.length>0?q:await Y(),a=[];!n&&(0,s.Fd)(r,s.hx,e.symbol,e.address)&&(a=await Q());let o=(0,s.r9)({chainId:s.hx,tokenSymbol:e.symbol,tokenAddress:e.address,recipientAddress:null!=W?W:void 0,supportedAssets:r,depositAddresses:a});o?(t=o.depositAddress,eN(o)):eU("".concat(e.symbol," is not supported for Polygon deposits."))}catch(e){eU(e instanceof Error?e.message:"Failed to get deposit address.")}finally{e_(!1)}t&&(ev(t),em("amount"))},[Q,Y,W,q]),eY=(0,d.useCallback)(async e=>{if((0,s.Es)(e.token.symbol,e.token.address))return void eU("Use Wallet deposit to send pUSD directly from your Polygon wallet.");eg(e),eN(null),e_(!0);try{let t=await Q();if(t&&t.length>0){let n=t.find(t=>t.chainId===e.chainId&&t.tokenSymbol===e.token.symbol)||t.find(t=>t.chainId===e.chainId);n&&ev(n.depositAddress),n&&eN({kind:"bridge",depositAddress:n.depositAddress,minUsd:e.minCheckoutUsd})}}catch(e){eo.error("bridge_address.fetch_failed",{error:e})}finally{e_(!1),em("confirm")}},[Q]),eQ=(0,d.useCallback)(e=>{if(!eh)return;let t=eh.balance*e/100,n=eh.decimals>6?6:eh.decimals,r=t.toFixed(n);r.includes(".")&&(r=r.replace(/0+$/,"").replace(/\.$/,"")),ey(r)},[eh]),eH=(0,d.useCallback)(()=>{ek&&(navigator.clipboard.writeText(ek),eS(!0),setTimeout(()=>eS(!1),2e3))},[ek]),eG=(0,d.useCallback)(async()=>
1{if(!eh||!ew||!ek)return;let e=!1;eU(null),e_(!0),Z(!0),ed(null),ea(!1),el(!1),eI([]);try{var t,r;let a,s=(0,u.X)(ew,eh.decimals);if(!U||!_)throw Error("Wallet not connected. Please reconnect and try again.");let o=await (0,I.w)(U,_),i=null!=(r=null==(t=o.account)?void 0:t.address)?r:(await o.requestAddresses())[0];if(!i||(0,m.b)(i)!==(0,m.b)(_))throw Error("Connected wallet changed. Please reconnect and try again.");let l=(0,m.b)(_);a="POL"===eh.symbol||"MATIC"===eh.symbol||"0x0000000000000000000000000000000000000000"===eh.address||"native"===eh.address?await o.sendTransaction({account:l,to:ek,value:s,chain:O.polygon}):await o.writeContract({account:l,address:eh.address,abi:f.xw,functionName:"transfer",args:[ek,s],chain:O.polygon}),Z(!1),et(!0);let{getRpcUrl:d}=await Promise.resolve().then(n.bind(n,34552)),x=(0,p.l)({chain:O.polygon,transport:(0,h.L)(d(),{retryCount:2,retryDelay:2e3})}),b=await x.waitForTransactionReceipt({hash:a,pollingInterval:5e3,timeout:18e4,confirmations:1});if("success"===b.status)ea(!0),c.Ay.capture("deposit_initiated",{token_symbol
1:eh.symbol,amount:ew,wallet_address:_,deposit_method:ef}),(null==ej?void 0:ej.kind)==="direct"?(et(!1),el(!0),e_(!1)):e=!0;else throw Error("Transaction failed on-chain")}catch(e){ed(e instanceof Error?e:Error("Transaction failed")),e_(!1)}finally{Z(!1),e||et(!1)}},[eh,ew,ek,ef,_,U,null==ej?void 0:ej.kind]),eJ=(0,d.useCallback)(()=>{"token"===eu||"bridge-select"===eu?(em("method"),ep(null),eA("")):"amount"===eu?(em("token"),ex(null),ey(""),eP(null),eN(null)):"confirm"===eu&&("bridge"===ef?(em("bridge-select"),eg(null),ev(""),eN(null)):(em("amount"),eP(null)))},[eu,ef]),eX=null==eh?void 0:eh.address,eZ=null==eh?void 0:eh.decimals;(0,d.useEffect)(()=>{if("confirm"!==eu||!eX||void 0===eZ||!ew||!ek||(null==ej?void 0:ej.kind)==="direct")return;let e=Number.parseFloat(ew);if(Number.isNaN(e)||e<=0)return;let t=(0,u.X)(ew,eZ).toString(),n="".concat(eX,"-").concat(t,"-").concat(ek);if(eL.current===n)return;eL.current=n;let r=!1;return eR(!0),(0,y.gc)({fromAmountBaseUnit:t,fromChainId:s.hx,fromTokenAddress:eX,recipientAddress:ek,toChainId:s.hx,toTokenAddress:w.QU}).then(e=>{r||(eP(e),eR(!1))}).catch(e=>{r||(eo.warn("quote.fetch_failed",{error:e instanceof Error?e.message:String(e)}),eP(null),eR(!1))}),()=>{r=!0}},[eu,ew,ek,eX,eZ,null==ej?void 0:ej.kind]),(0,d.useEffect)(()=>{"confirm"!==eu&&(eL.current=null)},[eu]);let e0=en&&ee&&!ei&&!!ek&&(null==ej?void 0:ej.kind)!=="direct";(0,d.useEffect)(()=>{if(!e0)return;let e=!1,t=Date.now(),n=()=>{!e&&Date.now()-t>=18e4&&(e=!0,eU("Transaction confirmed on-chain, but bridge credit is taking longer than expected. Please check again shortly."),et(!1),e_(!1))},r=()=>{H(ek).then(t=>{if(!e){if(eI(t),t.some(e=>"FAILED"===e.status)){e=!0,eU("Transaction confirmed on-chain, but bridge processing failed. Contact support if funds do n
1ot arrive."),et(!1),e_(!1);return}if(t.some(e=>"COMPLETED"===e.status)){var n;e=!0,et(!1),el(!0),e_(!1);let t=ez.current;c.Ay.capture("deposit_completed",{wallet_address:t.address,token_symbol:null==(n=t.selectedToken)?void 0:n.symbol,amount:t.amount,deposit_method:t.selectedMethod})}}}).catch(()=>{}).finally(n)};r();let a=setInterval(r,5e3);return()=>{e=!0,clearInterval(a)}},[e0,ek,H]);let e1=(0,d.useMemo)(()=>{if(!ew||!eh)return"0";let e=Number.parseFloat(ew);return Number.isNaN(e)?"0":["USDC","USDC.e","pUSD","DAI","USDT"].includes(eh.symbol)?e.toFixed(2):(e*(eh.usdValue/eh.balance)).toFixed(2)},[ew,eh]),e2=(0,d.useMemo)(()=>{if(!ew||!eh)return 0;let e=Number.parseFloat(ew);return Number.isNaN(e)?0:["USDC","USDC.e","pUSD","DAI","USDT"].includes(eh.symbol)?e:e*(eh.usdValue/eh.balance)},[ew,eh]),e3=(0,d.useMemo)(()=>eh?(0,s.Es)(eh.symbol,eh.address)?0:ej?ej.minUsd:eK(eh.symbol):eq,[eh,eq,ej,eK]),e5=(0,d.useMemo)(()=>!!ew&&0!==e2&&e2<e3,[ew,e2,e3]),e4=(0,d.useMemo)(()=>{if(!ew||!eh)return!1;let e=Number.parseFloat(ew);return!Number.isNaN(e)&&!(e<=0)&&!(e>eh.balance)&&!e5},[ew,eh,e5]),e6=null!=(t=({method:"Method",token:"Token","bridge-select":"Bridge",amount:"Amount",confirm:"Confirm"})[eu])?t:"Method";return(0,r.jsx)(g.lG,{open:a,onOpenChange:C,children:(0,r.jsx)(g.Cf,{showCloseButton:!1,overlayClassName:"bg-black/60 backdrop-blur-md",className:"sm:max-w-[440px] max-h-[calc(100dvh-32px)] p-0 gap-0 overflow-hidden rounded-md border border-border shadow-[0_40px_80px_-30px_rgba(0,0,0,0.55)] flex flex-col bg-(--kwm-panel)",onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:(0,r.jsxs)("div",{className:"kw-app flex flex-col flex-1 min-h-0 bg-(--kwm-panel) text-(--kwm-ink)",children:[(0,r.jsxs)("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-4 pb-3 border-b border-(--kwm-hl) shrink-0",children:[(0,r.jsx)("div",{className:"w-7 flex items-center justify-start",children:"method"!==eu&&(0,r.jsx)("button",{type:"button",onClick:eJ,className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-(--kwm-hl) text-(--kwm-ink-2) hover:text-(--kwm-ink) hover:border-(--kwm-hl-2) transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--kwm-ink) focus-visible:ring-offset-2 focus-visible:ring-offset-(--kwm-panel)","aria-label":"Go back",children:(0,r.jsx)(i.A,{className:"h-3.5 w-3.5",strokeWidth:1.4})})}),(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-w-0 gap-0.5",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.14em] text-(--kwm-ink-3)",children:[(0,r.jsx)("span",{className:"text-(--kwm-ink-2)",children:"\xa7"}),(0,r.jsx)("span",{children:"Deposit"}),(0,r.jsx)("span",{className:"text-(--kwm-ink-dim)",children:"\xb7"}),(0,r.jsx)("span",{className:"text-(--kwm-ink-3)",children:e6})]}),(0,r.jsxs)(g.L3,{className:"font-(family-name:--font-geist) text-[15px] font-semibold tracking-tight text-(--kwm-ink) leading-tight truncate max-w-full",children:["$",(null==T?void 0:T.toFixed(2))||"0.00"," ",(0,r.jsx)("span",{className:"font-normal text-(--kwm-ink-3) text-[12px]",children:"balance"})]}),(0,r.jsx)(g.rr,{className:"sr-only",children:"Deposit funds into your Polymarket trading wallet."})]}),(0,r.jsx)("div",{className:"w-7 flex items-center justify-end",children:(0,r.jsx)("button",{type:"button",onClick:()=>C(!1),className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-(--kwm-hl) text-(--kwm-ink-2) hover:text-(--kwm-ink) hover:border-(--kwm-hl-2) transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--kwm-ink) focus-visible:ring-offset-2 focus-visible:ring-offset-(--kwm-panel)","aria-label":"Close",children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5",strokeWidth:1.4})})})]}),(0,r.jsx)("div",{className:"px-5 py-5 flex-1 min-h-0 overflow-y-auto",children:(0,r.jsxs)(o.N,{mode:"wait",children:["method"===eu&&(0,r.jsx)(er,{isConnected:F,address:_,walletTokens:B,walletIsTradingWallet:"eoa"===L,onSelectMethod:eW}),"token"===eu&&(0,r.jsx)(es,{isLoading:R,walletTokens:B,defaultMinDeposit:eq,onRefresh:z,onSelectToken:eV,getMinDepositForToken:eK}),"bridge-select"===eu&&(0,r.jsx)(V,{isLoading:$,searchQuery:eE,filteredBridgeAssets:e$,isProcessing:eD,onSearchChange:eA,onSelectAsset:eY}),"amount"===eu&&eh&&(0,r.jsx)(K,{amount:ew,selectedToken:eh,isBelowMinimum:e5,selectedTokenMinDeposit:e3,enteredAmountUsd:e2,isValidAmount:e4,onAmountChange:ey,onPercentage:eQ,onContinue:()=>em("confirm")}),"confirm"===eu&&(0,r.jsx)(X,{selectedMethod:ef,selectedBridgeAsset:eb,selectedToken:eh,isProcessing:eD,bridgeAddress:ek,amount:ew,address:_,receiveAmount:e1,depositError:eF,isPending:J,isConfirming:ee,isOnChainConfirmed:en,isConfirmed:ei,isWalletReady:!!(U&&_),
1copied:eC,onCopy:eH,onDeposit:eG,quote:eT,isLoadingQuote:eB,depositTransactions:eO,isLoadingDepositStatus:G})]})})]})})})}},55679:(e,t,n)=>{n.d(t,{$5:()=>o,$g:()=>s,KW:()=>m,M0:()=>u,Qt:()=>a,Yo:()=>c,fF:()=>f,l9:()=>d,sy:()=>i,vv:()=>l});var r=n(57705);function a(e){if(null==e||""===e)return"N/A";let t="string"==typeof e?Number.parseFloat(e):e;return Number.isNaN(t)?"N/A":t>=1e9?"$".concat((t/1e9).toFixed(2),"B"):t>=1e6?"$".concat((t/1e6).toFixed(2),"M"):t>=1e3?"$".concat((t/1e3).toFixed(2),"K"):"$".concat(t.toLocaleString(void 0,{maximumFractionDigits:0}))}function s(e){try{let t=new r.A(e);if(!t.isFinite())return"0.0\xa2";return"".concat(t.mul(100).toDecimalPlaces(1,r.A.ROUND_HALF_UP).toFixed(1),"\xa2")}catch(e){return"0.0\xa2"}}function o(e){try{let t=new r.A(e).mul(100);if(!t.isFinite())return"0\xa2";let n=t.toDecimalPlaces(1,r.A.ROUND_HALF_UP);return n.isInteger()?"".concat(n.toFixed(0),"\xa2"):"".concat(n.toFixed(1),"\xa2")}catch(e){return"0\xa2"}}function i(e,t){let n=new r.A(e).sub(t),a=n.abs().toFixed(2),s=n.isNegative()&&"0.00"!==a?"-":"";return"".concat(s,"$").concat(a)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Math.abs(e).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return"".concat(e<0?"-":e>0&&t?"+":"","$").concat(n)}function c(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Math.abs(e),r=e<0?"-":e>0&&t?"+":"";return n>=1e9?"".concat(r,"$").concat((n/1e9).toFixed(2),"B"):n>=1e6?"".concat(r,"$").concat((n/1e6).toFixed(2),"M"):n>=1e3?"".concat(r,"$").concat((n/1e3).toFixed(2),"K"):"".concat(r,"$").concat(n.toFixed(2))}function d(e){return"".concat(e.toFixed(2),"%")}function u(e){return e?"".concat(e.slice(0,6),"...").concat(e.slice(-4)):""}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"verbose",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Date.now(),r=Math.floor((n-new Date(e).getTime())/6e4);if("verbose"===t&&r<1)return"just now";for(let[e,n]of[[518400,"y"],[43200,"mo"],[1440,"d"],[60,"h"],[1,"m"]])if(r>=e){let a="".concat(Math.floor(r/e)).concat(n);return"compact"===t?a:"".concat(a," ago")}return"compact"===t?"0m":"just now"}function f(e){let t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),a=Math.floor(r/6e4),s=Math.floor(r/36e5),o=Math.floor(r/864e5),i=Math.floor(o/30);return a<60?"".concat(a,"m ago"):s<24?"".concat(s,"h ago"):o<30?"".concat(o," days ago"):i<12?"".concat(i," mo ago"):n.toLocaleDateString()}},63272:(e,t,n)=>{n.d(t,{T2:()=>m,aY:()=>u,gz:()=>d});var r=n(36568),a=n(37811);let s=new Map,o=new Map;function i(e){return"".concat(e.signerAddress.toLowerCase(),":").concat(e.walletAddress.toLowerCase(),":").concat(e.credentials.apiKey)}function l(e){return(0,r.createUnifiedPolymarketSecureClient)({signer:(0,r.createUnifiedPolymarketCredentialsOnlySigner)(e.signerAddress),wallet:e.walletAddress,credentials:e.credentials,allowFreshAuthentication:!1})}function c(e,t,n){let r=e.get(t);if(r)return r;let a=n();return e.set(t,a),a.catch(()=>{e.get(t)===a&&e.delete(t)}),a}function d(e){return c(s,i(e),()=>l(e).then(e=>{let{client:t}=e;return(0,r.adaptUnifiedSecureClientForLegacyClob)(t,{builderCode:a.env.NEXT_PUBLIC_POLY_BUILDER_CODE})}))}function u(e){return c(o,i(e),()=>l(e).then(e=>{let{client:t}=e;return t}))}function m(e){let t=i(e);s.delete(t),o.delete(t)}},66559:(e,t,n)=>{n.d(t,{F:()=>z});var r=n(9775),a=n(43449),s=n(66392),o=n(15942),i=n(71559),l=n.n(i),c=n(20556),d=n(83655),u=n(89048),m=n(50691),f=n(81159),p=n(44110),h=n(46320),x=n(73432),b=n(84638),g=n(52521),w=n(66318),y=n(54268),k=n(65165),v=n(99085);function j(e){let t,n,a=(0,g.c)(4);return a[0]!==e?({...t}=e,a[0]=e,a[1]=t):t=a[1],a[2]!==t?(n=(0,r.jsx)(w.bL,{...t}),a[2]=t,a[3]=n):n=a[3],n}function N(e){let t,n,a=(0,g.c)(4);return a[0]!==e?({...t}=e,a[0]=e,a[1]=t):t=a[1],a[2]!==t?(n=(0,r.jsx)(w.l9,{"data-slot":"sheet-trigger",...t}),a[2]=t,a[3]=n):n=a[3],n}function C(e){let t,n=(0,g.c)(2);return n[0]!==e?(t=(0,r.jsx)(w.ZL,{...e}),n[0]=e,n[1]=t):t=n[1],t}function S(e){let t,n,a,s,o=(0,g.c)(8);return o[0]!==e?({className:t,...n}=e,o[0]=e,o[1]=t,o[2]=n):(t=o[1],n=o[2]),o[3]!==t?(a=(0,v.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),o[3]=t,o[4]=a):a=o[4],o[5]!==n||o[6]!==a?(s=(0,r.jsx)(w.hJ,{"data-slot":"sheet-overlay",className:a,...n}),o[5]=n,o[6]=a,o[7]=s):s=o[7],s}let E=(0,y.F)("fixed z-50 gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}});function A(e){let t,n,a,s,o,i,l,c,d,u,m,f,p=(0,g.c)(23);p[0]!==e?({side:l,className:n,children:t,showClose:c,closeClassName:a,closeElement:s,closeProps:o,...i}=e,p[0]=e,p[1]=t,p[2]=n,p[3]=a,p[4]=s,p[5]=o,p[6]=i,p[7]=l,p[8]=c):(t=p[1],n=p[2],a=p[3],s=p[4],o=p[5],i=p[6],l=p[7],c=p[8]);let h=void 0===l?"right":l,x=void 0===c||c;return p[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(S,{}),p[9]=d):d=p[9],p[10]!==n||p[11]!==h?(u=(0,v.cn)(E({side:h}),n),p[10]=n,p[11]=h,p[12]=u):u=p[12],p[13]!==a||p[14]!==s||p[15]!==o||p[16]!==x?(m=x&&(0,r.jsx)(w.bm,{...o,className:(0,v.cn)("absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",a,null==o?void 0:o.className),children:null!=s?s:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k.A,{className:"h-5 w-5"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})}),p[13]=a,p[14]=s,p[15]=o,p[16]=x,p[17]=m):m=p[17],p[18]!==t||p[19]!==i||p[20]!==u||p[21]!==m?(f=(0,r.jsxs)(C,{children:[d,(0,r.jsxs)(w.UC,{"data-slot":"sheet-content",className:u,...i,children:[m,t]})]}),p[18]=t,p[19]=i,p[20]=u,p[21]=m,p[22]=f):f=p[22],f}function D(e){let t,n,a,s,o=(0,g.c)(8);return o[0]!==e?({className:t,...n}=e,o[0]=e,o[1]=t,o[2]=n):(t=o[1],n=o[2]),o[3]!==t?(a=(0,v.cn)("text-lg font-semibold text-foreground",t),o[3]=t,o[4]=a):a=o[4],o[5]!==n||o[6]!==a?(s=(0,r.jsx)(w.hE,{"data-slot":"sheet-title",className:a,...n}),o[5]=n,o[6]=a,o[7]=s):s=o[7],s}function _(e){let t,n,a,s,o=(0,g.c)(8);return o[0]!==e?({className:t,...n}=e,o[0]=e,o[1]=t,o[2]=n):(t=o[1],n=o[2]),o[3]!==t?(a=(0,v.cn)("text-sm text-muted-foreground",t),o[3]=t,o[4]=a):a=o[4],o[5]!==n||o[6]!==a?(s=(0,r.jsx)(w.VY,{"data-slot":"sheet-description",className:a,...n}),o[5]=n,o[6]=a,o[7]=s):s=o[7],s}var F=n(11137),U=n(77793),T=n(4753);let P=[{label:"Markets",href:"/markets"},{label:"Live",href:"/events/sports/live"},{label:"Whales",href:"/whales"},{label:"Leaderboard",href:"/leaderboard"},{label:"Portfolio",href:"/portfolio"},{label:"Search",href:"/search"}],O=[{label:"Politics",href:"/events/politics"},{label:"Sports",href:"/events/sports/live"},{label:"Crypto",href:"/events/crypto"},{label:"Finance",href:"/events/finance"},{label:"Geopolitics",href:"/events/geopolitics"},{label:"Earnings",href:"/events/earnings"},{label:"Tech",href:"/events/tech"},{label:"Culture",href:"/events/pop-culture"},{label:"World",href:"/events/world"},{label:"Economy",href:"/events/economy"},{label:"Elections",href:"/events/elections"},{label:"Mentions",href:"/events/mention-markets"}];function I(){let e=(0,x.useRouter)(),t=(0,x.usePathname)(),{isConnected:n}=(0,u.useConnection)(),[a,s]=(0,d.useState)(!1),[i,l]=(0,d.useState)(!1),[c,p]=(0,d.useState)(!1),g=async()=>{if(!c){p(!0);try{await (0,T.hI)()}finally{p(!1)}}},{proxyAddress:w,isDeployed:y,usdcBalance:k}=(0,F.h)(),{proxyAddress:C,hasDeployedSafe:S}=(0,U.V)(),E=t=>{e.push(t),s(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(j,{open:a,onOpenChange:s,children:[(0,r.jsx)(N,{asChild:!0,children:(0,r.jsxs)(b.$,{variant:"ghost",size:"icon",className:"xl:hidden",children:[(0,r.jsx)(h.A,{className:"h-5 w-5"}),(0,r.jsx)("span",{className:"sr-only",children:"Open menu"})]})}),(0,r.jsxs)(A,{side:"left",className:"w-72 p-0 flex flex-col bg-background",children:[(0,r.jsx)(_,{className:"sr-only",children:"Knoww navigation â browse markets, view your portfolio, and manage your trading wallet."}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 h-14 border-b border-border/60",children:[(0,r.jsx)(f.U,{}),(0,r.jsx)(D,{className:"font-bold text-[14px] tracking-tight",children:"Knoww"})]}),(0,r.jsxs)("nav",{className:"flex-1 overflow-y-auto py-6 px-3",children:[(0,r.jsxs)("div",{className:"mb-7",children:[(0,r.jsx)("p",{className:"px-3 mb-3 font-mono text-[10px] uppercase tracking-[0.2em] text-muted-foreground/70",children:"\xa7\xa0\xa0Navigate"}),(0,r.jsx)("div",{children:P.map(e=>{let n=t===e.href||"/"!==e.href&&(null==t?void 0:t.startsWith(e.href));return(0,r.jsxs)("button",{type:"button",onClick:()=>E(e.href),className:(0,v.cn)("w-full flex items-center justify-between px-3 py-2.5 font-mono text-[11px] uppercase tracking-[0.15em] border-b border-border/40 transition-colors text-left",n?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,r.jsx)("span",{children:e.label}),n&&(0,r.jsx)("span",{"aria-hidden":"true",className:"font-sans text-foreground/60",children:"â"})]},e.href)})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"px-3 mb-3 font-mono text-[10px] uppercase tracking-[0.2em] text-muted-foreground
1/70",children:"\xa7\xa0\xa0Browse"}),(0,r.jsx)("div",{children:O.map(e=>{let n=t===e.href;return(0,r.jsxs)("button",{type:"button",onClick:()=>E(e.href),className:(0,v.cn)("w-full flex items-center justify-between px-3 py-2.5 border-b border-border/40 transition-colors text-left",n?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[(0,r.jsx)("span",{className:"font-editorial italic text-base",children:e.label}),n&&(0,r.jsx)("span",{"aria-hidden":"true",className:"font-sans text-foreground/60",children:"â"})]},e.href)})})]})]}),(0,r.jsx)("div",{className:"border-t border-border/60 px-4 py-5 space-y-4",children:n&&(S||y)&&(C||w)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.2em] text-muted-foreground/70",children:[(0,r.jsx)(o.A,{className:"h-3 w-3"}),"Balance"]})}),(0,r.jsxs)("p",{className:"font-editorial italic text-4xl leading-none tracking-tight text-foreground tabular-nums",children:["$",k.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{l(!0),s(!1)},className:"group inline-flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.15em] text-foreground transition-colors hover:text-muted-foreground",children:[(0,r.jsx)("span",{className:"underline underline-offset-4 decoration-border group-hover:decoration-foreground transition-colors",children:"Deposit"}),(0,r.jsx)("span",{"aria-hidden":"true",className:"translate-y-px transition-transform group-hover:translate-x-0.5",children:"â"})]})]}):n?null:(0,r.jsxs)("button",{type:"button",disabled:c,onMouseEnter:T.KI,onFocus:T.KI,onClick:()=>{g(),s(!1)},className:"w-full flex items-center justify-center gap-2 bg-foreground text-background px-3 py-2.5 font-mono text-[11px] uppercase tracking-[0.18em] hover:bg-foreground
1/90 transition-colors",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),c?"Connectingâ¦":"Connect Wallet"]})})]})]}),(0,r.jsx)(m.q,{open:i,onOpenChange:l})]})}var L=n(24644),M=n(33684),B=n(57079),R=n(55679);function z(){let{address:e,isConnected:t}=(0,u.useConnection)(),[n,i]=(0,d.useState)(!1),[h,x]=(0,d.useState)(!1),b=async()=>{if(!h){x(!0);try{c.Ay.capture("wallet_connect_clicked"),await (0,T.hI)()}finally{x(!1)}}},{setShowOnboarding:g,needsTradingSetup:w}=(0,B.z)(),{proxyAddress:y,isDeployed:k}=(0,F.h)();return(0,r.jsxs)("nav",{className:"xl:hidden sticky top-0 z-50 w-full border-b border-border/60 bg-background/95 backdrop-blur supports-backdrop-filter:bg-background/60",children:[(0,r.jsxs)("div",{className:"flex h-14 items-center gap-3 px-3 sm:px-4",children:[(0,r.jsx)(I,{}),(0,r.jsxs)(l(),{href:"/",className:"flex items-center gap-2 font-bold text-[14px] tracking-tight hover:opacity-80 transition-opacity",children:[(0,r.jsx)(f.U,{}),"Knoww"]}),(0,r.jsxs)("div",{"data-nosnippet":!0,className:"flex items-center gap-2 ml-auto",children:[t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Zw,{}),w&&(0,r.jsxs)("button",{type:"button",onClick:()=>{c.Ay.capture("trading_account_setup_clicked",{wallet_address:e}),g(!0)},className:"inline-flex items-center gap-1.5 bg-foreground text-background px-2.5 py-1.5 font-mono text-[11px] uppercase tracking-[0.08em] hover:bg-foreground
1/90 transition-colors",children:[(0,r.jsx)(a.A,{className:"h-3 w-3"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Setup Trading"}),(0,r.jsx)("span",{className:"sm:hidden",children:"Setup"})]}),k&&y&&!w&&(0,r.jsxs)("button",{type:"button",onClick:()=>i(!0),className:"hidden sm:inline-flex items-center gap-1.5 border border-border hover:border-foreground/40 px-2.5 py-1.5 font-mono text-[11px] uppercase tracking-[0.08em] text-foreground transition-colors",children:[(0,r.jsx)(s.A,{className:"h-3 w-3"}),"Deposit"]}),(0,r.jsx)(M.p,{children:(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-2 px-2.5 py-1.5 border border-border hover:border-foreground/40 transition-colors font-mono text-[12px] uppercase tracking-[0.08em]",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"hidden sm:inline tabular-nums normal-case tracking-normal text-[12px]",children:(0,R.M0)(e||"")})]})})]}):(0,r.jsxs)("button",{type:"button",disabled:h,onMouseEnter:T.KI,onFocus:T.KI,onClick:()=>void b(),className:"flex items-center gap-2 bg-foreground text-background px-3 py-1.5 font-mono text-[12px] uppercase tracking-[0.08em] hover:bg-foreground
1/90 transition-colors",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"}),h?"Connectingâ¦":"Connect"]}),(0,r.jsx)("div",{className:"[&_button]:h-9 [&_button]:w-9 [&_button]:px-0 [&_button]:justify-center [&_button>span:not(.sr-only)]:hidden",children:(0,r.jsx)(L.ThemeToggle,{})})]})]}),(0,r.jsx)(m.q,{open:n,onOpenChange:i})]})}},68079:(e,t,n)=>{n.d(t,{Bc:()=>i,ZI:()=>d,k$:()=>c,m_:()=>l});var r=n(9775),a=n(52521),s=n(8699),o=n(99085);function i(e){let t,n,o,i=(0,a.c)(6);i[0]!==e?({delayDuration:n,...t}=e,i[0]=e,i[1]=t,i[2]=n):(t=i[1],n=i[2]);let l=void 0===n?0:n;return i[3]!==l||i[4]!==t?(o=(0,r.jsx)(s.Kq,{"data-slot":"tooltip-provider",delayDuration:l,...t}),i[3]=l,i[4]=t,i[5]=o):o=i[5],o}function l(e){let t,n,o=(0,a.c)(4);return o[0]!==e?({...t}=e,o[0]=e,o[1]=t):t=o[1],o[2]!==t?(n=(0,r.jsx)(i,{children:(0,r.jsx)(s.bL,{"data-slot":"tooltip",...t})}),o[2]=t,o[3]=n):n=o[3],n}function c(e){let t,n,o=(0,a.c)(4);return o[0]!==e?({...t}=e,o[0]=e,o[1]=t):t=o[1],o[2]!==t?(n=(0,r.jsx)(s.l9,{"data-slot":"tooltip-trigger",...t}),o[2]=t,o[3]=n):n=o[3],n}function d(e){let t,n,i,l,c,d,u,m=(0,a.c)(13);m[0]!==e?({className:n,sideOffset:l,children:t,...i}=e,m[0]=e,m[1]=t,m[2]=n,m[3]=i,m[4]=l):(t=m[1],n=m[2],i=m[3],l=m[4]);let f=void 0===l?0:l;return m[5]!==n?(c=(0,o.cn)("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",n),m[5]=n,m[6]=c):c=m[6],m[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,r.jsx)(s.i3,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),m[7]=d):d=m[7],m[8]!==t||m[9]!==i||m[10]!==f||m[11]!==c?(u=(0,r.jsx)(s.ZL,{children:(0,r.jsxs)(s.UC,{"data-slot":"tooltip-content",sideOffset:f,className:c,...i,children:[t,d]})}),m[8]=t,m[9]=i,m[10]=f,m[11]=c,m[12]=u):u=m[12],u}},69303:(e,t,n)=>{n.d(t,{Hu:()=>s,Os:()=>a,_C:()=>o});var r=n(57705);function a(e,t){var n;let r=(e,t)=>{if(void 0===e)return;let n=Number(e);if(!Number.isSafeInteger(n)||n<=0)throw Error("Invalid price history ".concat(t));return n},a=void 0!==t.startTs&&0===Number(t.startTs),s=a?void 0:r(t.startTs,"start"),o=null!=(n=r(t.endTs,"end"))?n:void 0===s?void 0:Math.floor(Date.now()/1e3),i=r(t.fidelity,"fidelity"),l=void 0===i?void 0:60*i;if(void 0!==l&&l>86400)throw Error("Price history fidelity exceeds one day");let c={assetId:e,...void 0===l?{}:{bucketSeconds:l}};if(void 0===s){if(void 0!==o&&!a)throw Error("Price history end requires start");return[{...c,interval:"max"}]}if(void 0===o||o<=s)throw Error("Price history end must be after start");let d=[];for(let e=s;e<o;e+=1296e3){if(d.length>=256)throw Error("Price history window is too large");d.push({...c,start:e,end:Math.min(e+1296e3,o)})}return d}function s(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"object"!=typeof e)throw Error("Malformed price history point");let n="number"==typeof e.timestamp?e.timestamp/(t?1e3:1):NaN;if(!Number.isSafeInteger(n)||n<=0||"number"!=typeof e.price&&"string"!=typeof e.price)throw Error("Malformed price history point");let a=new r.A(e.price);if(!a.isFinite()||a.lt(0)||a.gt(1))throw Error("Malformed price history price");return{t:n,p:a.toString()}}async function o(e,t,n){if(!e.listPriceHistory)throw Error("Unified Polymarket SDK client cannot list price history");let r=new Map;for(let o of a(t,n)){let t=0;for await(let n of e.listPriceHistory(o)){if(++t>1e3)throw Error("Price history pagination exceeded limit");for(let e of n.items){let t=s(e,!0);if(void 0!==o.start&&(t.t<o.start||void 0!==o.end&&t.t>o.end))throw Error("Price history point outside requested window");r.set(t.t,t)}}}return[...r.values()].filter(e=>void 0===n.endTs||e.t<=Number(n.endTs)).sort((e,t)=>e.t-t.t)}},76496:(e,t,n)=>{n.d(t,{$V:()=>F,Ax:()=>A,CX:()=>l,E4:()=>N,Es:()=>p,Fd:()=>h,G6:()=>O,Kr:()=>g,LP:()=>E,OT:()=>_,QR:()=>I,TJ:()=>S,TZ:()=>y,V2:()=>k,VQ:()=>j,YJ:()=>U,hx:()=>s,r9:()=>x,s:()=>T,tV:()=>C,wt:()=>v,z8:()=>w});var r=n(54336);let a="https://bridge.polymarket.com",s="137",o="1151111081099710",i=["1","137","42161","10","8453","43114","56","324"],l={1:{name:"Ethereum",icon:"â ",color:"#627EEA",gradient:"from-blue-500 to-indigo-600"},137:{name:"Polygon",icon:"⬡",color:"#8247E5",gradient:"from-purple-500 to-violet-600"},42161:{name:"Arbitrum",icon:"\uD83D\uDD37",color:"#28A0F0",gradient:"from-sky-4
100 to-blue-600"},10:{name:"Optimism",icon:"\uD83D\uDD34",color:"#FF0420",gradient:"from-red-500 to-rose-600"},8453:{name:"Base",icon:"\uD83D\uDD35",color:"#0052FF",gradient:"from-blue-500 to-blue-700"},43114:{name:"Avalanche",icon:"\uD83D\uDD3A",color:"#E84142",gradient:"from-red-500 to-red-700"},56:{name:"BNB Chain",icon:"âï¸",color:"#F0B90B",gradient:"from-yellow-400 to-amber-600"},324:{name:"zkSync",icon:"â¡",color:"#8C8DFC",gradient:"from-sky-400 to-indigo-500"},[o]:{name:"Solana",icon:"â",color:"#9945FF",gradient:"from-purple-500 to-violet-600",rpc:"https://api.mainnet-beta.solana.com",url:"https://solana.com",tokenSymbol:"USDC"}};function c(e){var t;let n=null!=(t=null==e?void 0:e.fetchImpl)?t:globalThis.fetch;if(!n)throw Error("Bridge fetch implementation unavailable");return n}function d(e,t){var n;return{...null!=(n=null==e?void 0:e.headers)?n:{},...null!=t?t:{},"X-Builder-Code":(null==e?void 0:e.builderCode)||"0xbfd2aaab2ffd43d8247ee99fcfd89231fbb6086aeeb46eceedf263a7e1982457"}}function u(e){return e.trim().toUpperCase()}function m(e){return e.trim().toLowerCase()}function f(e,t){return e.startsWith("0x")&&t.startsWith("0x")&&m(e)===m(t)}function p(e,t){return"PUSD"===u(e)||f(t,r.QU)}function h(e,t,n,r){let a=u(n);return e.find(e=>e.chainId===t&&(u(e.token.symbol)===a||f(e.token.address,r)))}function x(e){let{chainId:t,tokenSymbol:n,tokenAddress:r,recipientAddress:a,supportedAssets:o,depositAddresses:i}=e;if(p(n,r))return t===s&&a?{kind:"direct",depositAddress:a,minUsd:0}:null;let l=h(o,t,n,r),c=function(e,t,n){if(n){let r=u(n.token.symbol),a=e.find(e=>e.chainId===t&&(u(e.tokenSymbol)===r||f(e.tokenAddress,n.token.address)));return a||e.find(e=>e.chainId===t&&""===e.tokenAddress.trim())}return e.find(e=>e.chainId===t)}(i,t,l);return l&&c?{kind:"bridge",depositAddress:c.depositAddress,minUsd:l.minCheckoutUsd}:null}async function b(e,t){let n=await e.json().catch(()=>null);if("object"==typeof n&&null!==n){if("string"==typeof n.error&&n.error)return n.error;if("string"==typeof n.message&&n.message)return n.message}return t}async function g(e){let t=await c(e)("".concat(a,"/supported-assets"),{headers:d(e)});if(!t.ok)throw Error(await b(t,"Failed to fetch supported assets: ".concat(t.status)));return(await t.json()).supportedAssets}async function w(e,t){let n=await c(t)("".concat(a,"/deposit"),{method:"POST",headers:d(t,{"Content-Type":"application/json"}),body:JSON.stringify({address:e})});if(!n.ok)throw Error(await b(n,"Failed to create deposit addresses: ".concat(n.status)));return function(e){var t,n;let r=[],a=new Set(null!=(n=null!=(t=e.supportedChains)?t:e.supported_chain_ids)?n:i);if(e.address.evm)for(let[t,n]of Object.entries(l))t!==o&&a.has(t)&&r.push({chainId:t,chainName:n.name,tokenAddress:"",tokenSymbol:"USDC",depositAddress:e.address.evm});if(e.address.svm){let t=l[o];r.push({chainId:o,chainName:(null==t?void 0:t.name)||"Solana",tokenAddress:"",tokenSymbol:(null==t?void 0:t.tokenSymbol)||"USDC",depositAddress:e.address.svm})}return r}(await n.json())}async function y(e,t){let n=await c(t)("".concat(a,"/quote"),{method:"POST",headers:d(t,{"Content-Type":"application/json"}),body:JSON.stringify(e)});if(!n.ok)throw Error(await b(n,"Failed to fetch quote: ".concat(n.status)));return await n.json()}async function k(e,t){let n=await c(t)("".concat(a,"/status/").concat(encodeURIComponent(e)),{headers:d(t)});if(!n.ok)throw Error(await b(n,"Failed to fetch deposit status: ".concat(n.status)));return(await n.json()).transactions}async function v(e,t){let n=await c(t)("".concat(a,"/withdraw"),{method:"POST",headers:d(t,{"Content-Type":"application/json"}),body:JSON.stringify(e)});if(!n.ok)throw Error(await b(n,"Failed to create withdrawal addresses: ".concat(n.status)));return await n.json()}function j(e,t){let n=t.toUpperCase();if("PUSD"===n)return 0;let r=e.filter(e=>{let t=e.token.symbol.toUpperCase();return t===n||"USDC.E"===n&&"USDC"===t||"USDC"===n&&"USDC"===t});return 0===r.length?45:Math.min(...r.map(e=>e.minCheckoutUsd))}function N(e){return 0===e.length?45:Math.min(...e.map(e=>e.minCheckoutUsd))}function C(e){return e<6e4?"~".concat(Math.ceil(e/1e3),"s"):"~".concat(Math.ceil(e/6e4)," min")}function S(e){switch(e){case"DEPOSIT_DETECTED":return{text:"Deposit detected",color:"#3b82f6",tone:"info"};case"PROCESSING":return{text:"Processing",color:"#f59e0b",tone:"warn"};case"ORIGIN_TX_CONFIRMED":return{text:"Origin confirmed",color:"#f59e0b",tone:"warn"};case"SUBMITTED":return{text:"Submitted",color:"#3b82f6",tone:"info"};case"COMPLETED":return{text:"Completed",color:"#22c55e",tone:"success"};case"FAILED":return{text:"Failed",color:"#ef4444",tone:"error"};default:return{text:e,color:"#888888",tone:"info"}}}let E={pusd:{id:"pusd",symbol:"pUSD",name:"Polymarket USD",address:r.QU,decimals:r.uj}
1,"usdc-e":{id:"usdc-e",symbol:"USDC.e",name:"Bridged USDC",address:r.nO,decimals:r.$X},usdc:{id:"usdc",symbol:"USDC",name:"USD Coin",address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",decimals:6},usdt:{id:"usdt",symbol:"USDT",name:"Tether USD",address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",decimals:6},dai:{id:"dai",symbol:"DAI",name:"Dai Stablecoin",address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",decimals:18},eth:{id:"eth",symbol:"ETH",name:"Ether",address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",decimals:18},pol:{id:"pol",symbol:"POL",name:"Polygon",address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",decimals:18},sol:{id:"sol",symbol:"SOL",name:"Solana",address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",decimals:9}},A={polygon:"137",ethereum:"1",base:"8453",arbitrum:"42161",optimism:"10",bsc:"56",solana:"1151111081099710"},D={pUSD:"pusd",PUSD:"pusd",USDC:"usdc","USDC.e":"usdc-e",USDT:"usdt",DAI:"dai",ETH:"eth",POL:"pol",SOL:"sol"};function _(e,t,n){let r=e.find(e=>e.chainId===t&&D[e.token.symbol]===n);return null==r?void 0:r.minCheckoutUsd}function F(e){let t={};for(let n of e){let e=D[n.token.symbol];e&&(t[n.chainId]||(t[n.chainId]={}),t[n.chainId][e]||(t[n.chainId][e]=n.token.address))}return t}function U(e,t,n){let r=e[t];return(null==r?void 0:r[n])?r[n]:(null==r?void 0:r.usdc)?r.usdc:""}function T(e){let t=e.chainKey||"polygon",n=e.tokenId||"usdc-e",a=E[n];if(!a)throw Error("Unsupported token: ".concat(n));let o=A[t]||s,i=U(e.bridgeTokenIndex,o,n)||(o===s?a.address:"");if(!i)throw Error("Token ".concat(n," is not supported on this chain. Please try a different token."));if(P(i,r.QU)&&"pusd"!==n)throw Error("Resolved withdrawal destination is pUSD for a non-pUSD token.");return{kind:o===s&&"usdc-e"===n?"direct":"bridge",chainKey:t,tokenId:n,toChainId:o,tokenAddress:i,tokenSymbol:a.symbol,tokenDecimals:a.decimals}}function P(e,t){return!!(e&&t&&e.trim().toLowerCase()===t.trim().toLowerCase())}function O(e){if(P(e.toTokenAddress,r.QU)&&"bridge"!==e.routeKind)throw Error("Resolved withdrawal destination is pUSD without an explicit bridge route.");if(P(e.bridgeAddress,e.recipientAddress))throw Error("Bridge returned the recipient address as the pUSD transfer target. Refusing to send direct pUSD.");if(P(e.bridgeAddress,e.sourceAddress))throw Error("Bridge returned the source wallet as the pUSD transfer target. Refusing to submit withdrawal.")}function I(e,t){let n=e[A[t]||"1"];return"polygon"===t?[...new Set(["usdc","usdc-e",...n?Object.keys(n):[]])]:n&&0!==Object.keys(n).length?Object.keys(n):["usdc"]}},81159:(e,t,n)=>{n.d(t,{U:()=>l});var r=n(9775),a=n(52521),s=n(89091),o=n(99085);let i={sm:20,md:24,lg:40};function l(e){let t,n,l=(0,a.c)(5),{size:c,className:d}=e,u=i[void 0===c?"md":c];return l[0]!==d?(t=(0,o.cn)("inline-block shrink-0 select-none",d),l[0]=d,l[1]=t):t=l[1],l[2]!==u||l[3]!==t?(n=(0,r.jsx)(s.default,{src:"/logo-256x256.png",alt:"Knoww",width:u,height:u,className:t,priority:!0,unoptimized:!0}),l[2]=u,l[3]=t,l[4]=n):n=l[4],n}},84638:(e,t,n)=>{n.d(t,{$:()=>c,r:()=>l});var r=n(9775),a=n(52521),s=n(63467),o=n(54268),i=n(99085);let l=(0,o.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-muted/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let t,n,o,c,d,u,m,f=(0,a.c)(16);f[0]!==e?({className:t,variant:o,size:c,asChild:d,...n}=e,f[0]=e,f[1]=t,f[2]=n,f[3]=o,f[4]=c,f[5]=d):(t=f[1],n=f[2],o=f[3],c=f[4],d=f[5]);let p=void 0===o?"default":o,h=void 0===c?"default":c,x=void 0!==d&&d?s.DX:"button";return f[6]!==t||f[7]!==h||f[8]!==p?(u=(0,i.cn)(l({variant:p,size:h,className:t})),f[6]=t,f[7]=h,f[8]=p,f[9]=u):u=f[9],f[10]!==x||f[11]!==n||f[12]!==h||f[13]!==u||f[14]!==p?(m=(0,r.jsx)(x,{"data-slot":"button","data-variant":p,"data-size":h,className:u,...n}),f[10]=x,f[11]=n,f[12]=h,f[13]=u,f[14]=p,f[15]=m):m=f[15],m}}
1,88472:(e,t,n)=>{n.d(t,{bM:()=>o,eB:()=>a,gg:()=>s});var r=n(36568);function a(e){let t=[],n=e;for(;null!=n&&t.length<8;)t.push(n),n=n instanceof Error?n.cause:void 0;return t}function s(e){return a(e).some(r.isPolymarketFreshAuthenticationRequiredError)}function o(e){return a(e).some(i)}function i(e){let t=(e instanceof Error?e.message:String(e||"")).toLowerCase();return t.includes("not found")||t.includes("unauthorized")||t.includes("forbidden")||t.includes("401")||t.includes("403")||t.includes("404")}},94203:(e,t,n)=>{n.r(t),n.d(t,{default:()=>a});var r=n(6719);function a(e){let{src:t,width:n,quality:a}=e;return(0,r.i)(t,n,a)}}}]);
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.