@liberfi.io/ui-predict 4.0.44 → 4.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- 'use strict';var react=require('react'),ui$1=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),yo=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var yo__default=/*#__PURE__*/_interopDefault(yo);var Yl={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},vi=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],vo=(()=>{let e=t=>{let r=vi.indexOf(t);return r===-1?vi.length:r};return Object.entries(Yl).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function yi({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:a="Trending",className:l}){let{t:d}=i18n.useTranslation(),u=react.useCallback(()=>{n(null);},[n]),p=d("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui$1.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",l),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(xi,{label:p,isSelected:t===null,onPress:u,showPulse:p===a}),jsxRuntime.jsx(Zl,{}),e.map(m=>jsxRuntime.jsx(xi,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===a},m.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(bi,{label:d("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(bi,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function xi({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function Zl(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function bi({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Kh({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function ec(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function tc(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function wi({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,s]=react.useState(null),a=react.useCallback(m=>{n(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),l=react.useCallback(m=>{s(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),d=ec(vo),u=vo.find(m=>m.slug===o),p=tc(u);return jsxRuntime.jsx(yi,{categories:d,selectedCategory:o,selectedTag:i,activeTags:p,onCategorySelect:a,onTagSelect:l,trailing:t,className:r})}function xn(e){return {title:e.title,imageUrl:e.image_url}}function bn(e,t){let r=e.outcomes[0],o=e.outcomes[1];return {question:e.question,yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??o?.best_ask??o?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??o?.best_bid,yesSubTitle:r?.label??"Yes",noSubTitle:o?.label??"No"}}var Ur=24,xo=4,yn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},ae={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},kn=ae.ALL,Zh={[ae.ONE_DAY]:yn.ONE_MINUTE,[ae.ONE_WEEK]:yn.ONE_HOUR,[ae.ONE_MONTH]:yn.ONE_HOUR,[ae.ALL]:yn.ONE_DAY},ev={[ae.ONE_DAY]:300,[ae.ONE_WEEK]:3600,[ae.ONE_MONTH]:10800,[ae.ALL]:1440*60},tv={[ae.ONE_DAY]:1440*60,[ae.ONE_WEEK]:10080*60,[ae.ONE_MONTH]:720*60*60,[ae.ALL]:null},Sn=1,wn=1,rv=1,nv=1,ov=99,wr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},iv=wr.ONE_WEEK,sv={[wr.ONE_HOUR]:60,[wr.SIX_HOURS]:60,[wr.ONE_DAY]:300,[wr.ONE_WEEK]:1800,[wr.MAX]:1800};var Ci=react.createContext(null);function ar(){let e=react.useContext(Ci);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var lc=1e4;function cc({pollingInterval:e=lc,enabled:t=true,enableKalshi:r=true,children:o}){let n=walletConnector.useWallets(),i=react.useMemo(()=>n.find(D=>D.chainNamespace===types.ChainNamespace.SOLANA&&D.isConnected)?.address,[n]),s=react.useMemo(()=>n.find(D=>D.chainNamespace===types.ChainNamespace.EVM&&D.isConnected)?.address,[n]),{data:a,isLoading:l,isFetching:d,error:u}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:p,isLoading:m}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:c,isLoading:f}=reactPredict.usePolymarketSetup(s,{enabled:t&&!!s,refetchInterval:3e4}),g=c?.safe_address,v=c?.verified??false,x=c?.wallet_kind??"deposit",b=c?.deposit_wallet_address,w=x==="safe"?c?.safe_address:b,P=x==="safe"?c?.safe_deployed??false:c?.deposit_wallet_deployed??false,{data:h,isLoading:y,isFetching:S,error:N}=reactPredict.useBalance({source:"polymarket",user:s??""},{enabled:t&&v&&!!s,refetchInterval:e}),A=react.useMemo(()=>({solanaAddress:i,evmAddress:s,polymarketWalletKind:x,polymarketWalletAddress:w,polymarketDepositWalletAddress:b,polymarketWalletDeployed:P,polymarketSafeAddress:g,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:v&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:m,polymarketSetupVerified:v,polymarketSafeDeployed:c?.safe_deployed??false,polymarketTokenApproved:c?.token_approved??false,polymarketSetupLoading:f,isLoading:l||y,isFetching:d||S,error:u??N??null}),[i,s,x,w,b,P,g,a,h,v,p,m,c,f,l,y,d,S,u,N]);return jsxRuntime.jsx(Ci.Provider,{value:A,children:o})}var uc={minutes:60,hours:3600,days:86400};function Pn(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*uc[r]}}function Nn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function Pe(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function Cn(e,t,r){let o=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(o)return t("predict.trade.polymarket.minOrderSize",{current:o[1],min:o[2]});let n=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(n){let s=parseInt(n[1],10)/1e6,a=parseInt(n[2],10)/1e6,l=Math.max(0,s-a);return t("predict.trade.polymarket.insufficientBalance",{total:Pe(s,2).toFixed(2),active:Pe(a,2).toFixed(2),available:Pe(l,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function $r(e,t=2){return parseFloat(Pe(e,t).toFixed(t)).toString()}function lr(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};yo__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{yo__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{yo__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function Ti({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:o}){let{t:n}=i18n.useTranslation(),{status:i}=walletConnector.useAuth(),s=walletConnector.useWallets(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),d=reactQuery.useQueryClient(),u=e.source,p=u==="polymarket",m=s.find(_=>_.chainNamespace===types.ChainNamespace.SOLANA&&_.isConnected),c=s.find(_=>_.chainNamespace===types.ChainNamespace.EVM&&_.isConnected&&"switchChain"in _),f=i==="authenticated",g=m?.address,v=c?.address,[x,b]=react.useState(t),[w,P]=react.useState("market"),[h,y]=react.useState(NaN),[S,N]=react.useState(NaN),[A,D]=react.useState(false),[z,F]=react.useState(null),[q,$]=react.useState(false),[Q,re]=react.useState(false),[Z,C]=react.useState("1h"),[E,U]=react.useState(30),[G,k]=react.useState("minutes"),ce=react.useMemo(()=>{if(u!=="polymarket")return;let _=e.provider_meta?.["polymarket.clobTokenIds"];return _?(typeof _=="string"?JSON.parse(_):_)[x==="yes"?0:1]:void 0},[u,e.provider_meta,x]),{data:pe,isLoading:ke}=reactPredict.useTickSize(ce),Ke=pe?.minimum_tick_size?String(pe.minimum_tick_size):"0.01",{data:ze,isLoading:We}=reactPredict.useFeeRate(ce),rt=String(ze?.base_fee??0),{data:Ne}=reactPredict.useRebateConfig(),xe=Ne?.builder_enabled&&Ne.builder_code?Ne.builder_code:void 0,nt=null,Ct=false,ot=null,Ge=false,Se,Ie,it;try{let _=ar();nt={kalshiUsdcBalance:_.kalshiUsdcBalance,polymarketUsdcBalance:_.polymarketUsdcBalance,isLoading:_.isLoading},Ct=_.kalshiKycVerified,ot=_.kalshiKycUrl,Ge=_.polymarketSetupVerified,Se=_.polymarketSafeAddress,Ie=_.polymarketWalletKind,it=_.polymarketWalletAddress;}catch{}let Qt=u==="kalshi"&&!Ct,gt=u==="polymarket"&&!Ge,{data:R}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:u,outcome:x},{enabled:e.status==="open"}),X=react.useMemo(()=>{let _=reactPredict.pickBestAsk(R,x);if(_!=null&&_>0)return _;let je=x==="yes"?0:1,Qe=e.outcomes[je];return Qe?.best_ask??Qe?.price??.5},[R,e.outcomes,x]),yt=react.useCallback(_=>{P(_);},[]),ht=react.useCallback(_=>{b(_),N(NaN);},[]);react.useEffect(()=>{ht(t);},[t,ht]),react.useEffect(()=>{w==="limit"&&isNaN(S)&&N(Math.round(X*1e4)/1e4);},[w,S,X]);let vt=react.useMemo(()=>isNaN(h)||h<=0?0:X>0?h/X:0,[h,X]),L=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:R,outcome:x,side:"buy",sharesNeeded:vt,slippageBps:r}),[R,x,vt,r]),ve=react.useMemo(()=>L.status==="ok"&&L.worstPrice!=null&&L.worstPrice>0?L.worstPrice:X,[L,X]),Ve=react.useMemo(()=>isNaN(h)||h<=0?"0":String(Math.round(h*1e6)),[h]),Ir=e.provider_meta?.["dflow.yesMint"]??"",io=e.provider_meta?.["dflow.noMint"]??"",so=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,rr=x==="yes"?Ir:io,nr=so,Ft=rr,br=u==="kalshi"?g??"":v??"",{data:Mt,isLoading:Ye}=reactPredict.usePositions({source:u,user:br},{enabled:!!br}),ao=u==="kalshi"&&!!nr&&!!Ft&&!!g&&Ve!=="0",{refetch:un}=reactPredict.useDFlowQuote({inputMint:nr,outputMint:Ft,amount:Ve,userPublicKey:g??"",slippageBps:100},{enabled:ao}),Bt=react.useMemo(()=>nt?u==="kalshi"?nt.kalshiUsdcBalance:nt.polymarketUsdcBalance:Mt&&Mt.positions.reduce((je,Qe)=>Qe.side==="USDC"||Qe.side==="collateral"?je+(Qe.current_value??0):je,0)||null,[nt,Mt,u]),Xt=nt?nt.isLoading:Ye,Or=react.useMemo(()=>w==="limit"&&p&&!isNaN(S)?S:X,[w,p,S,X]),pn=react.useMemo(()=>isNaN(h)||h<=0?0:h,[h]),lo=react.useMemo(()=>isNaN(h)||h<=0?0:Or>0?h/Or*1:0,[h,Or]),mn=lo-pn,co=react.useCallback(_=>{if(isNaN(_)){y(NaN);return}y(Math.round(Math.max(0,_)*100)/100);},[]),or=react.useCallback(_=>{if(isNaN(_)){N(NaN);return}N(Math.round(_*1e4)/1e4);},[]),Et=react.useCallback(()=>{y(NaN),N(NaN),P("market"),re(false),C("1h"),U(30),k("minutes");},[]),Ht=react.useMemo(()=>{let _=[];return isNaN(h)||h<=0?_.push(n("predict.trade.minAmountUsd",{amount:wn})):h<wn&&_.push(n("predict.trade.minAmountUsd",{amount:wn})),e.status!=="open"&&_.push(n("predict.trade.marketNotActive")),Bt!=null&&!isNaN(h)&&h>0&&h>Pe(Bt,2)&&_.push(n("predict.trade.insufficientBalance")),w==="limit"&&p&&(isNaN(S)||S<.01||S>.99)&&_.push(n("predict.trade.limitPriceRange")),w==="limit"&&p&&Q&&Z==="custom"&&(isNaN(E)||E<=0)&&_.push(n("predict.trade.expiration.invalidDate")),u==="polymarket"&&w==="market"&&!isNaN(h)&&h>0&&vt>0&&(L.status==="insufficient_liquidity"?_.push(n("predict.trade.insufficientLiquidity",{available:Pe(L.totalAvailable,2)})):L.status==="exceeds_slippage"&&_.push(n("predict.trade.priceImpactTooHigh",{impact:(L.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:_.length===0,errors:_}},[h,e.status,Bt,w,p,S,Q,Z,E,u,vt,L,r,n]),yr=react.useMemo(()=>Bt==null||isNaN(h)||h<=0?false:h>Pe(Bt,2),[Bt,h]),uo=react.useCallback(()=>{o?.(u);},[o,u]),{mutateAsync:Dr}=reactPredict.useDFlowSubmit(),{data:ir}=reactPredict.useOrder({id:z??"",source:u},{enabled:!!z});react.useEffect(()=>{if(!ir||!z)return;let{status:_}=ir;_==="closed"?(F(null),D(false),ui$1.toast.success(n("predict.trade.submitSuccess")),lr(),Et(),d.invalidateQueries({queryKey:["predict","positions"]})):(_==="failed"||_==="expired")&&(D(false),F(null),ui$1.toast.error(n("predict.trade.submitError")));},[ir,z,d,Et,n]);let st=react.useCallback(async()=>{if(!g||!m)return;if(!nr||!Ft){ui$1.toast.error("Missing token mint addresses"),D(false);return}if(!Ct){$(true),D(false);return}let zt=(await un()).data?.transaction;if(!zt){ui$1.toast.error(n("predict.trade.submitError")),D(false);return}let Fr=Uint8Array.from(atob(zt),Xe=>Xe.charCodeAt(0)),kt=await m.signTransaction(Fr),St=await Dr({signedTransaction:btoa(String.fromCharCode(...kt)),orderContext:{user_public_key:g,input_mint:nr,output_mint:Ft,amount:Ve,price:String(X),side:"BUY",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});F(St.signature);},[g,m,un,Dr,nr,Ft,Ve,X,x,e.slug,n,Ct]),Ar=react.useCallback(async()=>{if(!c||!l)return;let _=c.chain,je=_!==types.Chain.POLYGON;je&&await c.switchChain(types.Chain.POLYGON);try{let Qe=await c.getEip1193Provider();if(!Qe){ui$1.toast.error(n("predict.trade.submitError")),D(!1);return}let zt=Ie==="deposit"&&!!it,Fr=!zt&&!!Se,kt=zt?it:Se,St={address:c.address,signatureType:zt?3:Fr?2:0,signTypedData:async(we,Je,Ze,Ee)=>{let qe=[];"name"in we&&qe.push({name:"name",type:"string"}),"version"in we&&qe.push({name:"version",type:"string"}),"chainId"in we&&qe.push({name:"chainId",type:"uint256"}),"verifyingContract"in we&&qe.push({name:"verifyingContract",type:"address"}),"salt"in we&&qe.push({name:"salt",type:"bytes32"});let kr={EIP712Domain:qe,...Je};return await Qe.request({method:"eth_signTypedData_v4",params:[c.address,JSON.stringify({domain:we,types:kr,primaryType:Ze,message:Ee})]})}},Xe=l.credentials??await l.authenticate(St),Br=x==="yes"?0:1,Hr="",Tt=e.provider_meta?.["polymarket.clobTokenIds"];Tt&&(Hr=(typeof Tt=="string"?JSON.parse(Tt):Tt)[Br]??"");let zr=e.provider_meta?.["polymarket.negRisk"]??!1,fn=w==="limit"&&!isNaN(S)?S:ve,Wr=Nn(fn,Ke),M=w==="limit"?Q?"GTD":"GTC":"FOK",Oe=w==="market"?h:Wr>0?h/Wr:0,De={tokenId:Hr,price:Wr,size:Oe,side:"BUY",orderType:M,tickSize:Ke,negRisk:zr,...kt&&{funderAddress:kt},...xe&&{builderCode:xe},...w==="limit"&&Q&&{expiration:Pn(Z,E,G)}},Ue;if(zt)Ue=await reactPredict.buildSignedV2OrderPayload({signer:St,depositWalletAddress:kt,input:De,owner:Xe.apiKey});else {let we=reactPredict.buildCtfExchangeDomain(zr),Je=reactPredict.buildOrderMessage({...De,signerAddress:St.address,signatureType:St.signatureType,feeRateBps:rt}),Ze=await St.signTypedData(we,reactPredict.CTF_ORDER_TYPES,"Order",Je),Ee=reactPredict.buildSignedOrder(Je,Ze,De.orderType);Ue=reactPredict.buildClobPayload(Ee,Xe.apiKey);}await a.executePolymarketOrder({payload:Ue,l2_api_key:Xe.apiKey,l2_secret:Xe.secret,l2_passphrase:Xe.passphrase,signer_address:Xe.address,owner:Xe.apiKey}),d.invalidateQueries({queryKey:["predict","orders"]}),d.invalidateQueries({queryKey:["predict","positions"]}),ui$1.toast.success(n("predict.trade.submitSuccess")),lr(),Et(),D(!1);}finally{je&&_&&c.switchChain(_).catch(()=>{});}},[c,l,x,e.provider_meta,w,S,ve,h,a,d,Q,Z,E,G,Et,n,Ke,rt,Se,Ie,it,xe]),po=react.useCallback(async()=>{if(!(!Ht.isValid||!f)){D(true),F(null),$(false);try{u==="kalshi"?await st():await Ar();}catch(_){let je=_ instanceof Error?_.message:"",Qe=u==="polymarket"&&je?Cn(je,n,"buy"):je||void 0;ui$1.toast.error(Qe||n("predict.trade.submitError")),D(false);}}},[Ht.isValid,f,u,st,Ar,n]);return {outcome:x,orderType:w,quantity:h,limitPrice:S,shares:vt,estimatedCost:pn,potentialPayout:lo,potentialProfit:mn,pricePerShare:X,usdcBalance:Bt,isBalanceLoading:Xt,isMarketDataLoading:u==="polymarket"&&(We||ke),isSubmitting:A,authStatus:i,validation:Ht,isInsufficientBalance:yr,source:u,supportsLimitOrder:p,kycRequired:q,needsKyc:Qt,needsSetup:gt,kycUrl:ot,expirationEnabled:Q,expirationPreset:Z,customDuration:E,customDurationUnit:G,setOutcome:ht,setOrderType:yt,setQuantity:co,setLimitPrice:or,setExpirationEnabled:re,setExpirationPreset:C,setCustomDuration:U,setCustomDurationUnit:k,submit:po,notifyInsufficientBalance:uo}}function Mn({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:n=>{n||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(n=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:o(n)})]},n))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[o("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:o("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.ok")})]})]})})})}var Gc=["5m","1h","12h","24h","eod","custom"],Yc={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Qc=["minutes","hours","days"],Xc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Jc={maximumFractionDigits:0};function Bi({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,shares:a,potentialProfit:l,potentialPayout:d,estimatedCost:u,usdcBalance:p,isBalanceLoading:m,isMarketDataLoading:c,isSubmitting:f,authStatus:g,isValid:v,validationErrors:x,isInsufficientBalance:b,onInsufficientBalance:w,supportsLimitOrder:P,kycRequired:h,needsKyc:y,needsSetup:S,kycUrl:N,expirationEnabled:A,expirationPreset:D,customDuration:z,customDurationUnit:F,onOutcomeChange:q,onOrderTypeChange:$,onQuantityChange:Q,onLimitPriceChange:re,onExpirationEnabledChange:Z,onExpirationPresetChange:C,onCustomDurationChange:E,onCustomDurationUnitChange:U,onSubmit:G}){let{t:k}=i18n.useTranslation(),[ce,pe]=react.useState(false),ke=ui$1.useDisclosure(),[Ke,ze]=react.useState(""),We=react.useRef(false);react.useEffect(()=>{We.current||ze(isNaN(i)?"":String(i));},[i]);let[rt,Ne]=react.useState(""),xe=react.useRef(false);react.useEffect(()=>{xe.current||(isNaN(s)?Ne(""):Ne(String(parseFloat((s*100).toFixed(2)))));},[s]);let nt=react.useCallback(L=>{if(L!==""&&!/^\d*\.?\d{0,2}$/.test(L))return;if(Ne(L),L===""||L==="."){re(NaN);return}let Ve=parseFloat(L);isNaN(Ve)||re(Ve/100);},[re]),Ct=react.useCallback(L=>{if(L!==""&&!/^\d*\.?\d{0,2}$/.test(L))return;if(ze(L),ht(false),L===""||L==="."){Q(NaN);return}let Ve=parseFloat(L);isNaN(Ve)||Q(Ve);},[Q]);react.useEffect(()=>{h&&!ke.isOpen&&ke.onOpen();},[h]);let ot=react.useMemo(()=>{let L=o==="yes"?t.yesAsk:t.noAsk;return L!=null?parseFloat((Number(L)*100).toFixed(2)):null},[o,t]),Ge=!isNaN(i)&&i>0,Se=g==="authenticated",Ie=g==="authenticating"||g==="deauthenticating",it=Se&&(y||S),Qt=react.useMemo(()=>{if(Ie)return k("predict.trade.checkingLogin");if(!Se)return k("predict.trade.loginToTrade");if(y)return k("predict.trade.kycRequired");if(S)return k("predict.trade.setupRequired");if(m)return k("predict.trade.loadingBalance");if(c)return k("predict.trade.loadingMarketData");if(f)return k("predict.trade.submitting");if(h)return k("predict.trade.kycRequired");if(!Ge)return k("predict.trade.enterAmount");let L=k(o==="yes"?"predict.trade.yes":"predict.trade.no"),ve=l>0?` \u2192 Win $${l.toFixed(2)}`:"";return `${k("predict.trade.buy")} ${L}${ve}`},[Ie,Se,y,S,m,c,f,h,Ge,o,l,k]),gt="primary",R=()=>{Q(Math.floor((p??0)/2*100)/100);},X=()=>{Q(Pe(p??0,2));},[yt,ht]=react.useState(false),vt=()=>{if(!Se){ht(false),G();return}if(y){ke.onOpen();return}if(S&&w){ht(false),w();return}if(h){ke.onOpen();return}if(b&&w){ht(false),w();return}if(!v){ht(true);return}ht(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:L=>{r==="bordered"&&(L.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:L=>{r==="bordered"&&(L.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bullish",children:[k("predict.trade.buy")," ",k(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[P?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:L=>$(L),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:k("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:k("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:k("predict.trade.market")}),n==="limit"&&P?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:rt,onChange:L=>nt(L.target.value),onFocus:()=>{xe.current=true;},onBlur:()=>{xe.current=false,isNaN(s)?Ne(""):Ne(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ot!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ot," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(L=>{let ve=L==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>q(L),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===L?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:k(L==="yes"?"predict.trade.yes":"predict.trade.no")}),ve!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(ve)*100).toFixed(2)),"\xA2"]})]})},L)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:k("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:R,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:k("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:X,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:k("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Ke,onChange:L=>Ct(L.target.value),onFocus:()=>{We.current=true;},onBlur:()=>{We.current=false,ze(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),yt&&x.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:x.map(L=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:L},L))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:k("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:p!=null?`$${Pe(p,2).toFixed(2)}`:"$0"})]}),n==="limit"&&P&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:k("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:A,onValueChange:Z,"aria-label":k("predict.trade.setExpiration")})]}),A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":k("predict.trade.setExpiration"),selectedKeys:[D],onSelectionChange:L=>{let ve=Array.from(L)[0];ve&&C(ve);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Gc.map(L=>jsxRuntime.jsx(ui$1.SelectItem,{children:k(Yc[L])},L))}),D==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:E,minValue:1,step:1,formatOptions:Jc,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[F],onSelectionChange:L=>{let ve=Array.from(L)[0];ve&&U(ve);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Qc.map(L=>jsxRuntime.jsx(ui$1.SelectItem,{children:k(Xc[L])},L))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>pe(L=>!L),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:k("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",ce&&"rotate-180")})]}),ot!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:k("predict.trade.chance",{percent:ot})})]}),ce&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?$r(a):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${d.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&l>0?`+$${l.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:gt,fullWidth:true,radius:"lg",size:"lg",isDisabled:Ie||Se&&!it&&(m||c||!Ge||f),isLoading:Ie||Se&&!it&&(f||m||c),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:vt,children:Qt})]}),jsxRuntime.jsx(Mn,{isOpen:ke.isOpen,onClose:ke.onClose,kycUrl:N})]})}function Tn({event:e,market:t,variant:r,initialOutcome:o,chain:n,slippageBps:i,onInsufficientBalance:s,onOutcomeChange:a}){let{outcome:l,orderType:d,quantity:u,limitPrice:p,shares:m,estimatedCost:c,potentialPayout:f,potentialProfit:g,pricePerShare:v,usdcBalance:x,isBalanceLoading:b,isMarketDataLoading:w,isSubmitting:P,authStatus:h,validation:y,isInsufficientBalance:S,supportsLimitOrder:N,kycRequired:A,needsKyc:D,needsSetup:z,kycUrl:F,expirationEnabled:q,expirationPreset:$,customDuration:Q,customDurationUnit:re,setOutcome:Z,setOrderType:C,setQuantity:E,setLimitPrice:U,setExpirationEnabled:G,setExpirationPreset:k,setCustomDuration:ce,setCustomDurationUnit:pe,submit:ke,notifyInsufficientBalance:Ke}=Ti({market:t,initialOutcome:o,slippageBps:i,onInsufficientBalance:s}),ze=walletConnector.useAuthCallback(ke),We=react.useCallback(xe=>{Z(xe),a?.(xe);},[Z,a]),rt=react.useMemo(()=>e?xn(e):void 0,[e]),Ne=react.useMemo(()=>bn(t,{yesAsk:l==="yes"?v:void 0,noAsk:l==="no"?v:void 0}),[t,l,v]);return jsxRuntime.jsx(Bi,{event:rt,market:Ne,variant:r,outcome:l,orderType:d,quantity:u,limitPrice:p,shares:m,estimatedCost:c,potentialPayout:f,potentialProfit:g,usdcBalance:x,isBalanceLoading:b,isMarketDataLoading:w,isSubmitting:P,authStatus:h,isValid:y.isValid,validationErrors:y.errors,isInsufficientBalance:S,onInsufficientBalance:s?Ke:void 0,supportsLimitOrder:N,kycRequired:A,needsKyc:D,needsSetup:z,kycUrl:F,expirationEnabled:q,expirationPreset:$,customDuration:Q,customDurationUnit:re,onOutcomeChange:We,onOrderTypeChange:C,onQuantityChange:E,onLimitPriceChange:U,onExpirationEnabledChange:G,onExpirationPresetChange:k,onCustomDurationChange:ce,onCustomDurationUnitChange:pe,onSubmit:ze})}var Kr="predict-trade";function Ln({id:e=Kr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(ad,{...t})})}function ad({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(Tn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var Vr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function wo(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function zi({isOpen:e,onClose:t,value:r,onChange:o,enableKalshi:n=true}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(r),l=react.useMemo(()=>n?Vr:{...Vr,source:"polymarket"},[n]),d=react.useCallback(b=>{b?a(r):t();},[r,t]),u=react.useCallback(()=>{a(l);},[l]),p=react.useCallback(()=>{o(s),t();},[s,o,t]),m=react.useCallback((b,w)=>{a(P=>({...P,[b]:w}));},[]),c=react.useMemo(()=>wo(s,n),[s,n]),f=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),g=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),x=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:d,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(md,{onClick:()=>d(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[n&&jsxRuntime.jsx(_n,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(In,{options:f,selected:s.source,onSelect:b=>m("source",b)})}),jsxRuntime.jsx(_n,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(In,{options:g,selected:s.timeRemaining,onSelect:b=>m("timeRemaining",b)})}),jsxRuntime.jsx(_n,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(In,{options:v,selected:s.minVolume,onSelect:b=>m("minVolume",b)})}),jsxRuntime.jsx(_n,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(In,{options:x,selected:s.minLiquidity,onSelect:b=>m("minLiquidity",b)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:u,children:i("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:p,children:[i("predict.filter.showResults"),c>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",c,")"]})]})]})]})})})}function _n({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function md({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function In({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.8)",s.currentTarget.style.color="#fff");},onMouseLeave:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.4)",s.currentTarget.style.color="#a1a1aa");},children:n.label},n.value??"__all")})})}var Vi={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Ui={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},Sd=["start_time","volume","liquidity","ending_soon"],$i={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},wd={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function ji({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:i=0,className:s}){let{t:a}=i18n.useTranslation(),[l,d]=react.useState(false),u=react.useRef(null),p=react.useCallback(c=>{u.current&&!u.current.contains(c.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)),[p]),react.useEffect(()=>{if(!l)return;let c=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[l]);let m=Ki[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:u,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:$i,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>d(c=>!c),children:[jsxRuntime.jsx(Pd,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(Ui[e])}),jsxRuntime.jsx(Cd,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...wd,width:224,padding:4},children:Sd.map(c=>{let f=Ki[c],g=e===c;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:v=>{g||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{g||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===c?o(!r):t(c),d(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:a(Ui[c])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},c)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)",c.currentTarget.style.color="#fff";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)",c.currentTarget.style.color="#a1a1aa";},onClick:()=>o(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:$i,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:n,children:[jsxRuntime.jsx(Nd,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var Ki={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function Pd(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Nd(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function Cd({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Yi(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:s,error:a,hasNextPage:l,fetchNextPage:d,refetch:u}=reactPredict.useInfiniteEvents(t),p=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{d();},[d]),c=react.useCallback(()=>{u();},[u]);return {data:p,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:s,error:a??null,hasMore:l??false,fetchMore:m,refetch:c}}var Qi=`
1
+ 'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),yo=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var yo__default=/*#__PURE__*/_interopDefault(yo);var Yl={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},hi=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],vo=(()=>{let e=t=>{let r=hi.indexOf(t);return r===-1?hi.length:r};return Object.entries(Yl).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function bi({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:a="Trending",className:l}){let{t:d}=i18n.useTranslation(),u=react.useCallback(()=>{n(null);},[n]),p=d("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",l),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(vi,{label:p,isSelected:t===null,onPress:u,showPulse:p===a}),jsxRuntime.jsx(Zl,{}),e.map(m=>jsxRuntime.jsx(vi,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===a},m.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(xi,{label:d("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(xi,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function vi({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function Zl(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function xi({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function Kh({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function ec(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function tc(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function Si({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,s]=react.useState(null),a=react.useCallback(m=>{n(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),l=react.useCallback(m=>{s(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),d=ec(vo),u=vo.find(m=>m.slug===o),p=tc(u);return jsxRuntime.jsx(bi,{categories:d,selectedCategory:o,selectedTag:i,activeTags:p,onCategorySelect:a,onTagSelect:l,trailing:t,className:r})}function yn(e){return {title:e.title,imageUrl:e.image_url}}function kn(e,t){let r=e.outcomes[0],o=e.outcomes[1];return {question:e.question,yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??o?.best_ask??o?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??o?.best_bid,yesSubTitle:r?.label??"Yes",noSubTitle:o?.label??"No"}}var Kr=24,xo=4,Sn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},ae={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},wn=ae.ALL,Zh={[ae.ONE_DAY]:Sn.ONE_MINUTE,[ae.ONE_WEEK]:Sn.ONE_HOUR,[ae.ONE_MONTH]:Sn.ONE_HOUR,[ae.ALL]:Sn.ONE_DAY},ev={[ae.ONE_DAY]:300,[ae.ONE_WEEK]:3600,[ae.ONE_MONTH]:10800,[ae.ALL]:1440*60},tv={[ae.ONE_DAY]:1440*60,[ae.ONE_WEEK]:10080*60,[ae.ONE_MONTH]:720*60*60,[ae.ALL]:null},Pn=1,Nn=1,rv=1,nv=1,ov=99,Cr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},iv=Cr.ONE_WEEK,sv={[Cr.ONE_HOUR]:60,[Cr.SIX_HOURS]:60,[Cr.ONE_DAY]:300,[Cr.ONE_WEEK]:1800,[Cr.MAX]:1800};var Ni=react.createContext(null);function dr(){let e=react.useContext(Ni);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var lc=1e4;function cc({pollingInterval:e=lc,enabled:t=true,enableKalshi:r=true,children:o}){let n=walletConnector.useWallets(),i=react.useMemo(()=>n.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected)?.address,[n]),s=react.useMemo(()=>n.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected)?.address,[n]),{data:a,isLoading:l,isFetching:d,error:u}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:p,isLoading:m}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:c,isLoading:f}=reactPredict.usePolymarketSetup(s,{enabled:t&&!!s,refetchInterval:3e4}),g=c?.safe_address,v=c?.verified??false,x=c?.wallet_kind??"deposit",b=c?.deposit_wallet_address,P=x==="safe"?c?.safe_address:b,w=x==="safe"?c?.safe_deployed??false:c?.deposit_wallet_deployed??false,{data:h,isLoading:y,isFetching:k,error:N}=reactPredict.useBalance({source:"polymarket",user:s??""},{enabled:t&&v&&!!s,refetchInterval:e}),F=react.useMemo(()=>({solanaAddress:i,evmAddress:s,polymarketWalletKind:x,polymarketWalletAddress:P,polymarketDepositWalletAddress:b,polymarketWalletDeployed:w,polymarketSafeAddress:g,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:v&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:m,polymarketSetupVerified:v,polymarketSafeDeployed:c?.safe_deployed??false,polymarketTokenApproved:c?.token_approved??false,polymarketSetupLoading:f,isLoading:l||y,isFetching:d||k,error:u??N??null}),[i,s,x,P,b,w,g,a,h,v,p,m,c,f,l,y,d,k,u,N]);return jsxRuntime.jsx(Ni.Provider,{value:F,children:o})}var uc={minutes:60,hours:3600,days:86400};function Cn(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*uc[r]}}function Mn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function Ne(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function En(e,t,r){let o=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(o)return t("predict.trade.polymarket.minOrderSize",{current:o[1],min:o[2]});let n=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(n){let s=parseInt(n[1],10)/1e6,a=parseInt(n[2],10)/1e6,l=Math.max(0,s-a);return t("predict.trade.polymarket.insufficientBalance",{total:Ne(s,2).toFixed(2),active:Ne(a,2).toFixed(2),available:Ne(l,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function Vr(e,t=2){return parseFloat(Ne(e,t).toFixed(t)).toString()}function ur(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};yo__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{yo__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{yo__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function Ei({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:o}){let{t:n}=i18n.useTranslation(),{status:i}=walletConnector.useAuth(),s=walletConnector.useWallets(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),d=reactQuery.useQueryClient(),u=e.source,p=u==="polymarket",m=s.find(L=>L.chainNamespace===types.ChainNamespace.SOLANA&&L.isConnected),c=s.find(L=>L.chainNamespace===types.ChainNamespace.EVM&&L.isConnected&&"switchChain"in L),f=i==="authenticated",g=m?.address,v=c?.address,[x,b]=react.useState(t),[P,w]=react.useState("market"),[h,y]=react.useState(NaN),[k,N]=react.useState(NaN),[F,O]=react.useState(false),[z,A]=react.useState(null),[j,V]=react.useState(false),[te,Q]=react.useState(false),[J,C]=react.useState("1h"),[E,U]=react.useState(30),[Y,oe]=react.useState("minutes"),S=react.useMemo(()=>{if(u!=="polymarket")return;let L=e.provider_meta?.["polymarket.clobTokenIds"];return L?(typeof L=="string"?JSON.parse(L):L)[x==="yes"?0:1]:void 0},[u,e.provider_meta,x]),{data:we,isLoading:Ke}=reactPredict.useTickSize(S),pe=we?.minimum_tick_size?String(we.minimum_tick_size):"0.01",{data:xt,isLoading:Ve}=reactPredict.useFeeRate(S),ze=String(xt?.base_fee??0),{data:at}=reactPredict.useRebateConfig(),me=at?.builder_enabled&&at.builder_code?at.builder_code:void 0,ve=null,Mt=false,Bt=null,lt=false,Qe,je,Xe;try{let L=dr();ve={kalshiUsdcBalance:L.kalshiUsdcBalance,polymarketUsdcBalance:L.polymarketUsdcBalance,isLoading:L.isLoading},Mt=L.kalshiKycVerified,Bt=L.kalshiKycUrl,lt=L.polymarketSetupVerified,Qe=L.polymarketSafeAddress,je=L.polymarketWalletKind,Xe=L.polymarketWalletAddress;}catch{}let Ie=u==="kalshi"&&!Mt,Oe=u==="polymarket"&&!lt,{data:qe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:u,outcome:x},{enabled:e.status==="open"}),xe=react.useMemo(()=>{let L=reactPredict.pickBestAsk(qe,x);if(L!=null&&L>0)return L;let Je=x==="yes"?0:1,tt=e.outcomes[Je];return tt?.best_ask??tt?.price??.5},[qe,e.outcomes,x]),or=react.useCallback(L=>{w(L);},[]),_=react.useCallback(L=>{b(L),N(NaN);},[]);react.useEffect(()=>{_(t);},[t,_]),react.useEffect(()=>{P==="limit"&&isNaN(k)&&N(Math.round(xe*1e4)/1e4);},[P,k,xe]);let le=react.useMemo(()=>isNaN(h)||h<=0?0:xe>0?h/xe:0,[h,xe]),be=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:qe,outcome:x,side:"buy",sharesNeeded:le,slippageBps:r}),[qe,x,le,r]),Ae=react.useMemo(()=>be.status==="ok"&&be.worstPrice!=null&&be.worstPrice>0?be.worstPrice:xe,[be,xe]),kt=react.useMemo(()=>isNaN(h)||h<=0?"0":String(Math.round(h*1e6)),[h]),D=e.provider_meta?.["dflow.yesMint"]??"",We=e.provider_meta?.["dflow.noMint"]??"",Ht=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,ir=x==="yes"?D:We,sr=Ht,zt=ir,Sr=u==="kalshi"?g??"":v??"",{data:Et,isLoading:et}=reactPredict.usePositions({source:u,user:Sr},{enabled:!!Sr}),ao=u==="kalshi"&&!!sr&&!!zt&&!!g&&kt!=="0",{refetch:mn}=reactPredict.useDFlowQuote({inputMint:sr,outputMint:zt,amount:kt,userPublicKey:g??"",slippageBps:100},{enabled:ao}),Wt=react.useMemo(()=>ve?u==="kalshi"?ve.kalshiUsdcBalance:ve.polymarketUsdcBalance:Et&&Et.positions.reduce((Je,tt)=>tt.side==="USDC"||tt.side==="collateral"?Je+(tt.current_value??0):Je,0)||null,[ve,Et,u]),Zt=ve?ve.isLoading:et,Dr=react.useMemo(()=>P==="limit"&&p&&!isNaN(k)?k:xe,[P,p,k,xe]),fn=react.useMemo(()=>isNaN(h)||h<=0?0:h,[h]),lo=react.useMemo(()=>isNaN(h)||h<=0?0:Dr>0?h/Dr*1:0,[h,Dr]),gn=lo-fn,co=react.useCallback(L=>{if(isNaN(L)){y(NaN);return}y(Math.round(Math.max(0,L)*100)/100);},[]),ar=react.useCallback(L=>{if(isNaN(L)){N(NaN);return}N(Math.round(L*1e4)/1e4);},[]),Tt=react.useCallback(()=>{y(NaN),N(NaN),w("market"),Q(false),C("1h"),U(30),oe("minutes");},[]),Ut=react.useMemo(()=>{let L=[];return isNaN(h)||h<=0?L.push(n("predict.trade.minAmountUsd",{amount:Nn})):h<Nn&&L.push(n("predict.trade.minAmountUsd",{amount:Nn})),e.status!=="open"&&L.push(n("predict.trade.marketNotActive")),Wt!=null&&!isNaN(h)&&h>0&&h>Ne(Wt,2)&&L.push(n("predict.trade.insufficientBalance")),P==="limit"&&p&&(isNaN(k)||k<.01||k>.99)&&L.push(n("predict.trade.limitPriceRange")),P==="limit"&&p&&te&&J==="custom"&&(isNaN(E)||E<=0)&&L.push(n("predict.trade.expiration.invalidDate")),u==="polymarket"&&P==="market"&&!isNaN(h)&&h>0&&le>0&&(be.status==="insufficient_liquidity"?L.push(n("predict.trade.insufficientLiquidity",{available:Ne(be.totalAvailable,2)})):be.status==="exceeds_slippage"&&L.push(n("predict.trade.priceImpactTooHigh",{impact:(be.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:L.length===0,errors:L}},[h,e.status,Wt,P,p,k,te,J,E,u,le,be,r,n]),wr=react.useMemo(()=>Wt==null||isNaN(h)||h<=0?false:h>Ne(Wt,2),[Wt,h]),uo=react.useCallback(()=>{o?.(u);},[o,u]),{mutateAsync:Fr}=reactPredict.useDFlowSubmit(),{data:lr}=reactPredict.useOrder({id:z??"",source:u},{enabled:!!z});react.useEffect(()=>{if(!lr||!z)return;let{status:L}=lr;L==="closed"?(A(null),O(false),ui.toast.success(n("predict.trade.submitSuccess")),ur(),Tt(),d.invalidateQueries({queryKey:["predict","positions"]})):(L==="failed"||L==="expired")&&(O(false),A(null),ui.toast.error(n("predict.trade.submitError")));},[lr,z,d,Tt,n]);let ct=react.useCallback(async()=>{if(!g||!m)return;if(!sr||!zt){ui.toast.error("Missing token mint addresses"),O(false);return}if(!Mt){V(true),O(false);return}let $t=(await mn()).data?.transaction;if(!$t){ui.toast.error(n("predict.trade.submitError")),O(false);return}let Hr=Uint8Array.from(atob($t),rt=>rt.charCodeAt(0)),St=await m.signTransaction(Hr),wt=await Fr({signedTransaction:btoa(String.fromCharCode(...St)),orderContext:{user_public_key:g,input_mint:sr,output_mint:zt,amount:kt,price:String(xe),side:"BUY",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});A(wt.signature);},[g,m,mn,Fr,sr,zt,kt,xe,x,e.slug,n,Mt]),Br=react.useCallback(async()=>{if(!c||!l)return;let L=c.chain,Je=L!==types.Chain.POLYGON;Je&&await c.switchChain(types.Chain.POLYGON);try{let tt=await c.getEip1193Provider();if(!tt){ui.toast.error(n("predict.trade.submitError")),O(!1);return}let $t=je==="deposit"&&!!Xe,Hr=!$t&&!!Qe,St=$t?Xe:Qe,wt={address:c.address,signatureType:$t?3:Hr?2:0,signTypedData:async(Pe,nt,ot,Ee)=>{let Ze=[];"name"in Pe&&Ze.push({name:"name",type:"string"}),"version"in Pe&&Ze.push({name:"version",type:"string"}),"chainId"in Pe&&Ze.push({name:"chainId",type:"uint256"}),"verifyingContract"in Pe&&Ze.push({name:"verifyingContract",type:"address"}),"salt"in Pe&&Ze.push({name:"salt",type:"bytes32"});let Pr={EIP712Domain:Ze,...nt};return await tt.request({method:"eth_signTypedData_v4",params:[c.address,JSON.stringify({domain:Pe,types:Pr,primaryType:ot,message:Ee})]})}},rt=l.credentials??await l.authenticate(wt),zr=x==="yes"?0:1,Wr="",Lt=e.provider_meta?.["polymarket.clobTokenIds"];Lt&&(Wr=(typeof Lt=="string"?JSON.parse(Lt):Lt)[zr]??"");let Ur=e.provider_meta?.["polymarket.negRisk"]??!1,hn=P==="limit"&&!isNaN(k)?k:Ae,$r=Mn(hn,pe),M=P==="limit"?te?"GTD":"GTC":"FOK",De=P==="market"?h:$r>0?h/$r:0,Fe={tokenId:Wr,price:$r,size:De,side:"BUY",orderType:M,tickSize:pe,negRisk:Ur,...St&&{funderAddress:St},...me&&{builderCode:me},...P==="limit"&&te&&{expiration:Cn(J,E,Y)}},Ge;if($t)Ge=await reactPredict.buildSignedV2OrderPayload({signer:wt,depositWalletAddress:St,input:Fe,owner:rt.apiKey});else {let Pe=reactPredict.buildCtfExchangeDomain(Ur),nt=reactPredict.buildOrderMessage({...Fe,signerAddress:wt.address,signatureType:wt.signatureType,feeRateBps:ze}),ot=await wt.signTypedData(Pe,reactPredict.CTF_ORDER_TYPES,"Order",nt),Ee=reactPredict.buildSignedOrder(nt,ot,Fe.orderType);Ge=reactPredict.buildClobPayload(Ee,rt.apiKey);}await a.executePolymarketOrder({payload:Ge,l2_api_key:rt.apiKey,l2_secret:rt.secret,l2_passphrase:rt.passphrase,signer_address:rt.address,owner:rt.apiKey}),d.invalidateQueries({queryKey:["predict","orders"]}),d.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(n("predict.trade.submitSuccess")),ur(),Tt(),O(!1);}finally{Je&&L&&c.switchChain(L).catch(()=>{});}},[c,l,x,e.provider_meta,P,k,Ae,h,a,d,te,J,E,Y,Tt,n,pe,ze,Qe,je,Xe,me]),po=react.useCallback(async()=>{if(!(!Ut.isValid||!f)){O(true),A(null),V(false);try{u==="kalshi"?await ct():await Br();}catch(L){let Je=L instanceof Error?L.message:"",tt=u==="polymarket"&&Je?En(Je,n,"buy"):Je||void 0;ui.toast.error(tt||n("predict.trade.submitError")),O(false);}}},[Ut.isValid,f,u,ct,Br,n]);return {outcome:x,orderType:P,quantity:h,limitPrice:k,shares:le,estimatedCost:fn,potentialPayout:lo,potentialProfit:gn,pricePerShare:xe,usdcBalance:Wt,isBalanceLoading:Zt,isMarketDataLoading:u==="polymarket"&&(Ve||Ke),isSubmitting:F,authStatus:i,validation:Ut,isInsufficientBalance:wr,source:u,supportsLimitOrder:p,kycRequired:j,needsKyc:Ie,needsSetup:Oe,kycUrl:Bt,expirationEnabled:te,expirationPreset:J,customDuration:E,customDurationUnit:Y,setOutcome:_,setOrderType:or,setQuantity:co,setLimitPrice:ar,setExpirationEnabled:Q,setExpirationPreset:C,setCustomDuration:U,setCustomDurationUnit:oe,submit:po,notifyInsufficientBalance:uo}}function Tn({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:n=>{n||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(n=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:o(n)})]},n))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[o("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:o("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.ok")})]})]})})})}var Gc=["5m","1h","12h","24h","eod","custom"],Yc={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Qc=["minutes","hours","days"],Xc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Jc={maximumFractionDigits:0};function Fi({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,shares:a,potentialProfit:l,potentialPayout:d,estimatedCost:u,usdcBalance:p,isBalanceLoading:m,isMarketDataLoading:c,isSubmitting:f,authStatus:g,isValid:v,validationErrors:x,isInsufficientBalance:b,onInsufficientBalance:P,supportsLimitOrder:w,kycRequired:h,needsKyc:y,needsSetup:k,kycUrl:N,expirationEnabled:F,expirationPreset:O,customDuration:z,customDurationUnit:A,oddsFormatter:j,onOutcomeChange:V,onOrderTypeChange:te,onQuantityChange:Q,onLimitPriceChange:J,onExpirationEnabledChange:C,onExpirationPresetChange:E,onCustomDurationChange:U,onCustomDurationUnitChange:Y,onSubmit:oe}){let{t:S}=i18n.useTranslation(),[we,Ke]=react.useState(false),pe=ui.useDisclosure(),[xt,Ve]=react.useState(""),ze=react.useRef(false);react.useEffect(()=>{ze.current||Ve(isNaN(i)?"":String(i));},[i]);let[at,me]=react.useState(""),ve=react.useRef(false);react.useEffect(()=>{ve.current||(isNaN(s)?me(""):me(String(parseFloat((s*100).toFixed(2)))));},[s]);let Mt=react.useCallback(D=>{if(D!==""&&!/^\d*\.?\d{0,2}$/.test(D))return;if(me(D),D===""||D==="."){J(NaN);return}let Ht=parseFloat(D);isNaN(Ht)||J(Ht/100);},[J]),Bt=react.useCallback(D=>{if(D!==""&&!/^\d*\.?\d{0,2}$/.test(D))return;if(Ve(D),Ae(false),D===""||D==="."){Q(NaN);return}let Ht=parseFloat(D);isNaN(Ht)||Q(Ht);},[Q]);react.useEffect(()=>{h&&!pe.isOpen&&pe.onOpen();},[h]);let lt=react.useMemo(()=>{let D=o==="yes"?t.yesAsk:t.noAsk;return D!=null?parseFloat((Number(D)*100).toFixed(2)):null},[o,t]),Qe=o==="yes"?t.yesAsk:t.noAsk,je=Qe!=null&&j?j(Number(Qe)):lt!=null?`${lt} \xA2`:null,Xe=!isNaN(i)&&i>0,Ie=g==="authenticated",Oe=g==="authenticating"||g==="deauthenticating",qe=Ie&&(y||k),xe=react.useMemo(()=>{if(Oe)return S("predict.trade.checkingLogin");if(!Ie)return S("predict.trade.loginToTrade");if(y)return S("predict.trade.kycRequired");if(k)return S("predict.trade.setupRequired");if(m)return S("predict.trade.loadingBalance");if(c)return S("predict.trade.loadingMarketData");if(f)return S("predict.trade.submitting");if(h)return S("predict.trade.kycRequired");if(!Xe)return S("predict.trade.enterAmount");let D=S(o==="yes"?"predict.trade.yes":"predict.trade.no"),We=l>0?` \u2192 Win $${l.toFixed(2)}`:"";return `${S("predict.trade.buy")} ${D}${We}`},[Oe,Ie,y,k,m,c,f,h,Xe,o,l,S]),or="primary",_=()=>{Q(Math.floor((p??0)/2*100)/100);},le=()=>{Q(Ne(p??0,2));},[be,Ae]=react.useState(false),kt=()=>{if(!Ie){Ae(false),oe();return}if(y){pe.onOpen();return}if(k&&P){Ae(false),P();return}if(h){pe.onOpen();return}if(b&&P){Ae(false),P();return}if(!v){Ae(true);return}Ae(false),oe();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:D=>{r==="bordered"&&(D.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:D=>{r==="bordered"&&(D.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bullish",children:[S("predict.trade.buy")," ",S(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[w?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:D=>te(D),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:S("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:S("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:S("predict.trade.market")}),n==="limit"&&w?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:at,onChange:D=>Mt(D.target.value),onFocus:()=>{ve.current=true;},onBlur:()=>{ve.current=false,isNaN(s)?me(""):me(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):je!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:je})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(D=>{let We=D==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>V(D),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===D?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:S(D==="yes"?"predict.trade.yes":"predict.trade.no")}),We!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:j?j(Number(We)):`${parseFloat((Number(We)*100).toFixed(2))}\xA2`})]})},D)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:S("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:_,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:S("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:le,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:S("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:xt,onChange:D=>Bt(D.target.value),onFocus:()=>{ze.current=true;},onBlur:()=>{ze.current=false,Ve(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),be&&x.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:x.map(D=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:D},D))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:S("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:p!=null?`$${Ne(p,2).toFixed(2)}`:"$0"})]}),n==="limit"&&w&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:S("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:F,onValueChange:C,"aria-label":S("predict.trade.setExpiration")})]}),F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":S("predict.trade.setExpiration"),selectedKeys:[O],onSelectionChange:D=>{let We=Array.from(D)[0];We&&E(We);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Gc.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:S(Yc[D])},D))}),O==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:U,minValue:1,step:1,formatOptions:Jc,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[A],onSelectionChange:D=>{let We=Array.from(D)[0];We&&Y(We);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Qc.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:S(Xc[D])},D))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ke(D=>!D),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:S("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",we&&"rotate-180")})]}),je!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:j&&Qe!=null?je:S("predict.trade.chance",{percent:lt})})]}),we&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?Vr(a):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${d.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&l>0?`+$${l.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:or,fullWidth:true,radius:"lg",size:"lg",isDisabled:Oe||Ie&&!qe&&(m||c||!Xe||f),isLoading:Oe||Ie&&!qe&&(f||m||c),spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:kt,children:xe})]}),jsxRuntime.jsx(Tn,{isOpen:pe.isOpen,onClose:pe.onClose,kycUrl:N})]})}function Rn({event:e,market:t,variant:r,initialOutcome:o,chain:n,slippageBps:i,onInsufficientBalance:s,onOutcomeChange:a,oddsFormatter:l}){let{outcome:d,orderType:u,quantity:p,limitPrice:m,shares:c,estimatedCost:f,potentialPayout:g,potentialProfit:v,pricePerShare:x,usdcBalance:b,isBalanceLoading:P,isMarketDataLoading:w,isSubmitting:h,authStatus:y,validation:k,isInsufficientBalance:N,supportsLimitOrder:F,kycRequired:O,needsKyc:z,needsSetup:A,kycUrl:j,expirationEnabled:V,expirationPreset:te,customDuration:Q,customDurationUnit:J,setOutcome:C,setOrderType:E,setQuantity:U,setLimitPrice:Y,setExpirationEnabled:oe,setExpirationPreset:S,setCustomDuration:we,setCustomDurationUnit:Ke,submit:pe,notifyInsufficientBalance:xt}=Ei({market:t,initialOutcome:o,slippageBps:i,onInsufficientBalance:s}),Ve=walletConnector.useAuthCallback(pe),ze=react.useCallback(ve=>{C(ve),a?.(ve);},[C,a]),at=react.useMemo(()=>e?yn(e):void 0,[e]),me=react.useMemo(()=>kn(t,{yesAsk:d==="yes"?x:void 0,noAsk:d==="no"?x:void 0}),[t,d,x]);return jsxRuntime.jsx(Fi,{event:at,market:me,variant:r,outcome:d,orderType:u,quantity:p,limitPrice:m,shares:c,estimatedCost:f,potentialPayout:g,potentialProfit:v,usdcBalance:b,isBalanceLoading:P,isMarketDataLoading:w,isSubmitting:h,authStatus:y,isValid:k.isValid,validationErrors:k.errors,isInsufficientBalance:N,onInsufficientBalance:s?xt:void 0,supportsLimitOrder:F,kycRequired:O,needsKyc:z,needsSetup:A,kycUrl:j,expirationEnabled:V,expirationPreset:te,customDuration:Q,customDurationUnit:J,oddsFormatter:l,onOutcomeChange:ze,onOrderTypeChange:E,onQuantityChange:U,onLimitPriceChange:Y,onExpirationEnabledChange:oe,onExpirationPresetChange:S,onCustomDurationChange:we,onCustomDurationUnitChange:Ke,onSubmit:Ve})}var jr="predict-trade";function _n({id:e=jr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(ad,{...t})})}function ad({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(Rn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var qr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function wo(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function Hi({isOpen:e,onClose:t,value:r,onChange:o,enableKalshi:n=true}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(r),l=react.useMemo(()=>n?qr:{...qr,source:"polymarket"},[n]),d=react.useCallback(b=>{b?a(r):t();},[r,t]),u=react.useCallback(()=>{a(l);},[l]),p=react.useCallback(()=>{o(s),t();},[s,o,t]),m=react.useCallback((b,P)=>{a(w=>({...w,[b]:P}));},[]),c=react.useMemo(()=>wo(s,n),[s,n]),f=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),g=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),x=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:d,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(md,{onClick:()=>d(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[n&&jsxRuntime.jsx(On,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(An,{options:f,selected:s.source,onSelect:b=>m("source",b)})}),jsxRuntime.jsx(On,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(An,{options:g,selected:s.timeRemaining,onSelect:b=>m("timeRemaining",b)})}),jsxRuntime.jsx(On,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(An,{options:v,selected:s.minVolume,onSelect:b=>m("minVolume",b)})}),jsxRuntime.jsx(On,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(An,{options:x,selected:s.minLiquidity,onSelect:b=>m("minLiquidity",b)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:u,children:i("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:p,children:[i("predict.filter.showResults"),c>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",c,")"]})]})]})]})})})}function On({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function md({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function An({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.8)",s.currentTarget.style.color="#fff");},onMouseLeave:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.4)",s.currentTarget.style.color="#a1a1aa");},children:n.label},n.value??"__all")})})}var Ki={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Wi={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},Sd=["start_time","volume","liquidity","ending_soon"],Ui={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},wd={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Vi({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:i=0,className:s}){let{t:a}=i18n.useTranslation(),[l,d]=react.useState(false),u=react.useRef(null),p=react.useCallback(c=>{u.current&&!u.current.contains(c.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)),[p]),react.useEffect(()=>{if(!l)return;let c=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[l]);let m=$i[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:u,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ui,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>d(c=>!c),children:[jsxRuntime.jsx(Pd,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(Wi[e])}),jsxRuntime.jsx(Cd,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...wd,width:224,padding:4},children:Sd.map(c=>{let f=$i[c],g=e===c;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:v=>{g||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{g||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===c?o(!r):t(c),d(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:a(Wi[c])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},c)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)",c.currentTarget.style.color="#fff";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)",c.currentTarget.style.color="#a1a1aa";},onClick:()=>o(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ui,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:n,children:[jsxRuntime.jsx(Nd,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var $i={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Pd(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Nd(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function Cd({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Gi(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:s,error:a,hasNextPage:l,fetchNextPage:d,refetch:u}=reactPredict.useInfiniteEvents(t),p=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{d();},[d]),c=react.useCallback(()=>{u();},[u]);return {data:p,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:s,error:a??null,hasMore:l??false,fetchMore:m,refetch:c}}var Yi=`
2
2
  @keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
3
3
  @media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
4
4
  @media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
5
5
  @media(max-width:767px){.evt-skel-grid{grid-template-columns:1fr!important}}
6
- `,Xi={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function On(e){return {...Xi,animationDelay:`${e}ms`}}function Po({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Qi}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(Td,{index:r},r))})]})}function Td({index:e}){let t=e*120,r={...Xi,animationDelay:`${t}ms`},o=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:o}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(n=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:n===0?"55%":n===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},n))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function Ld(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...On(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...On(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...On(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...On(100),height:36,width:80,borderRadius:10}})]})]})}function fx({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Qi}),jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(Ld,{})}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(Po,{count:e})})]})}var Ji=3,zd={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},Wd={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},Co={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},ns={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Ud={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},jr=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function Zi(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function $d(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [Co,Ud];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [Co,ns];let r=t[0]??"",o=t[1]??"",n=Zi(r)%jr.length,i=Zi(o)%jr.length;return i===n&&(i=(i+1)%jr.length),[jr[n],jr[i]]}function Kd(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function os(e){let t=Kd(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function is(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function es(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function ts(e){let t=e.outcomes?.[1];if(t){let n=t.best_ask??t.price??0;return parseFloat((n*100).toFixed(2)).toString()}let r=e.outcomes?.[0],o=r?.best_ask??r?.price??0;return parseFloat(((1-o)*100).toFixed(2)).toString()}function Vd(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),n=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),o>0&&i.push(`${o}h`),i.push(`${n}m`),i.join(" ")}var jd=`
6
+ `,Qi={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function Dn(e){return {...Qi,animationDelay:`${e}ms`}}function Po({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Yi}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(Td,{index:r},r))})]})}function Td({index:e}){let t=e*120,r={...Qi,animationDelay:`${t}ms`},o=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:o}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(n=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:n===0?"55%":n===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},n))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function Ld(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...Dn(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...Dn(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Dn(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Dn(100),height:36,width:80,borderRadius:10}})]})]})}function fx({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Yi}),jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(Ld,{})}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(Po,{count:e})})]})}var Xi=3,zd={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},Wd={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},Co={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},rs={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Ud={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Gr=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function Ji(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function $d(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [Co,Ud];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [Co,rs];let r=t[0]??"",o=t[1]??"",n=Ji(r)%Gr.length,i=Ji(o)%Gr.length;return i===n&&(i=(i+1)%Gr.length),[Gr[n],Gr[i]]}function Kd(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function ns(e){let t=Kd(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function os(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Zi(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function es(e){let t=e.outcomes?.[1];if(t){let n=t.best_ask??t.price??0;return parseFloat((n*100).toFixed(2)).toString()}let r=e.outcomes?.[0],o=r?.best_ask??r?.price??0;return parseFloat(((1-o)*100).toFixed(2)).toString()}function Vd(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),n=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),o>0&&i.push(`${o}h`),i.push(`${n}m`),i.join(" ")}var jd=`
7
7
  .badge-shine { position: relative; overflow: hidden; }
8
8
  .badge-shine::after {
9
9
  content: "";
@@ -27,13 +27,13 @@
27
27
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
28
28
  outline-offset: 2px;
29
29
  }
30
- `;function ss({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[s,a]=react.useState(null),l=e.markets??[],u=react.useMemo(()=>l.length>2?[...l].sort((h,y)=>(y.outcomes?.[0]?.price??0)-(h.outcomes?.[0]?.price??0)):l,[l]).filter(h=>h.status==="open"),p=u.length===1,m=u.slice(0,Ji),c=u.length-Ji,f=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),g=s?u.find(h=>h.slug===s)??null:null,v=!!g||p,x=()=>{v||o?.(e);},b=h=>{h.stopPropagation(),g&&(h.preventDefault(),a(null));},w=h=>{h.stopPropagation(),t||(h.preventDefault(),o?.(e));},P=p?jsxRuntime.jsx(ou,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o}):g?jsxRuntime.jsx(su,{onCollapse:()=>a(null)}):jsxRuntime.jsx(eu,{moreCount:c,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:w});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:h=>{let y=h.currentTarget,S=zd[e.source]??Wd;y.style.borderColor=S.border,y.style.boxShadow=S.shadow,i?.(e);},onMouseLeave:h=>{let y=h.currentTarget;y.style.borderColor="rgba(39,39,42,0.6)",y.style.boxShadow="none";},onClick:x,children:[jsxRuntime.jsx("style",{children:jd}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(qd,{event:e,href:t,LinkComponent:r,onClick:b,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:p?jsxRuntime.jsx(nu,{market:u[0],event:e,onSelectOutcome:n}):g?jsxRuntime.jsx(iu,{market:g,event:e,onCollapse:()=>a(null),onSelectOutcome:n}):jsxRuntime.jsx(Zd,{displayedMarkets:m,onMarketClick:h=>a(h.slug)})})]}),jsxRuntime.jsx(tu,{children:P})]})}function qd({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?Vd(e.start_at):null;return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:o,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",n&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(Yd,{event:e})]})}function Gd(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(n=>n.label?.toLowerCase()==="crypto"),o=e.tags?.some(n=>n.label?.toLowerCase()==="live");if(r&&e.end_at){let n=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,s=900*1e3;if(n>0&&n<=s){let a=n<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=i?"5m":"15m",color:a});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function Yd({event:e}){let t=react.useMemo(()=>Gd(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,o)=>{switch(r.kind){case "live":return jsxRuntime.jsx(Qd,{},o);case "crypto-short":return jsxRuntime.jsx(Xd,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(Jd,{},o)}})})}function Qd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function Xd({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui$1.TimerIcon,{className:"size-3 shrink-0"}),e]})}function Jd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function Zd({displayedMarkets:e,onMarketClick:t}){return e.length>0?jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(r=>{let o=os(r);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:n=>{n.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:r.outcomes?.[0]?.label??r.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:is(o)}),jsxRuntime.jsx(ru,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function eu({moreCount:e,formattedVolume:t,source:r,href:o,LinkComponent:n,onShowMore:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui$1.Linkable,{href:o,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[s("predict.event.showMore"),jsxRuntime.jsx(ls,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",s("predict.event.volume"),jsxRuntime.jsx(cs,{source:r})]})]})}function tu({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function rs({bgColor:e,textColor:t,shadowColor:r,onClick:o,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:o,children:n})}function as({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[s,a]=o?$d(e):[Co,ns],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",d=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&l===d?"action":n,p=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${es(e)}\xA2`:i("predict.market.action.yes",{price:es(e)}),m=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${ts(e)}\xA2`:i("predict.market.action.no",{price:ts(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(rs,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"yes");},children:p}),jsxRuntime.jsx(rs,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"no");},children:m})]})}function ru(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function nu({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(as,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function ou({event:e,formattedVolume:t,href:r,LinkComponent:o,onSelect:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.Linkable,{href:r,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:a=>{a.stopPropagation(),r||(a.preventDefault(),n?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(ls,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx(cs,{source:e.source})]})]})}function iu({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let n=os(e);return jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:i=>{i.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:is(n)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(as,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]})}function su({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(au,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function ls({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function au({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function cs({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var uu=8;function us({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:o,onSelect:n,onSelectOutcome:i,getEventHref:s,LinkComponent:a,onHover:l}){let{t:d}=i18n.useTranslation(),u=react.useRef(null);react.useEffect(()=>{let c=u.current;if(!c)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&o?.();},{rootMargin:"300px"});return f.observe(c),()=>f.disconnect()},[t,r,o]);let p=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),m=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
30
+ `;function is({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[s,a]=react.useState(null),l=e.markets??[],u=react.useMemo(()=>l.length>2?[...l].sort((h,y)=>(y.outcomes?.[0]?.price??0)-(h.outcomes?.[0]?.price??0)):l,[l]).filter(h=>h.status==="open"),p=u.length===1,m=u.slice(0,Xi),c=u.length-Xi,f=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),g=s?u.find(h=>h.slug===s)??null:null,v=!!g||p,x=()=>{v||o?.(e);},b=h=>{h.stopPropagation(),g&&(h.preventDefault(),a(null));},P=h=>{h.stopPropagation(),t||(h.preventDefault(),o?.(e));},w=p?jsxRuntime.jsx(ou,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o}):g?jsxRuntime.jsx(su,{onCollapse:()=>a(null)}):jsxRuntime.jsx(eu,{moreCount:c,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:P});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:h=>{let y=h.currentTarget,k=zd[e.source]??Wd;y.style.borderColor=k.border,y.style.boxShadow=k.shadow,i?.(e);},onMouseLeave:h=>{let y=h.currentTarget;y.style.borderColor="rgba(39,39,42,0.6)",y.style.boxShadow="none";},onClick:x,children:[jsxRuntime.jsx("style",{children:jd}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(qd,{event:e,href:t,LinkComponent:r,onClick:b,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:p?jsxRuntime.jsx(nu,{market:u[0],event:e,onSelectOutcome:n}):g?jsxRuntime.jsx(iu,{market:g,event:e,onCollapse:()=>a(null),onSelectOutcome:n}):jsxRuntime.jsx(Zd,{displayedMarkets:m,onMarketClick:h=>a(h.slug)})})]}),jsxRuntime.jsx(tu,{children:w})]})}function qd({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?Vd(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:o,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",n&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(Yd,{event:e})]})}function Gd(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(n=>n.label?.toLowerCase()==="crypto"),o=e.tags?.some(n=>n.label?.toLowerCase()==="live");if(r&&e.end_at){let n=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,s=900*1e3;if(n>0&&n<=s){let a=n<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=i?"5m":"15m",color:a});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function Yd({event:e}){let t=react.useMemo(()=>Gd(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,o)=>{switch(r.kind){case "live":return jsxRuntime.jsx(Qd,{},o);case "crypto-short":return jsxRuntime.jsx(Xd,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(Jd,{},o)}})})}function Qd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function Xd({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui.TimerIcon,{className:"size-3 shrink-0"}),e]})}function Jd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function Zd({displayedMarkets:e,onMarketClick:t}){return e.length>0?jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(r=>{let o=ns(r);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:n=>{n.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:r.outcomes?.[0]?.label??r.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:os(o)}),jsxRuntime.jsx(ru,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function eu({moreCount:e,formattedVolume:t,source:r,href:o,LinkComponent:n,onShowMore:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui.Linkable,{href:o,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[s("predict.event.showMore"),jsxRuntime.jsx(as,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",s("predict.event.volume"),jsxRuntime.jsx(ls,{source:r})]})]})}function tu({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function ts({bgColor:e,textColor:t,shadowColor:r,onClick:o,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:o,children:n})}function ss({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[s,a]=o?$d(e):[Co,rs],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",d=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&l===d?"action":n,p=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Zi(e)}\xA2`:i("predict.market.action.yes",{price:Zi(e)}),m=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${es(e)}\xA2`:i("predict.market.action.no",{price:es(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(ts,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"yes");},children:p}),jsxRuntime.jsx(ts,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"no");},children:m})]})}function ru(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function nu({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(ss,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function ou({event:e,formattedVolume:t,href:r,LinkComponent:o,onSelect:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui.Linkable,{href:r,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:a=>{a.stopPropagation(),r||(a.preventDefault(),n?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(as,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx(ls,{source:e.source})]})]})}function iu({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let n=ns(e);return jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:i=>{i.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:os(n)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(ss,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]})}function su({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(au,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function as({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function au({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ls({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var uu=8;function ds({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:o,onSelect:n,onSelectOutcome:i,getEventHref:s,LinkComponent:a,onHover:l}){let{t:d}=i18n.useTranslation(),u=react.useRef(null);react.useEffect(()=>{let c=u.current;if(!c)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&o?.();},{rootMargin:"300px"});return f.observe(c),()=>f.disconnect()},[t,r,o]);let p=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),m=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
31
31
  @keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
32
32
  @keyframes evt-load-spin{to{transform:rotate(360deg)}}
33
33
  @media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
34
34
  @media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
35
35
  @media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
36
- `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((c,f)=>c==null?null:jsxRuntime.jsx("div",{style:{padding:uu,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(ss,{event:c,href:s?.(c),LinkComponent:a,onSelect:n,onSelectOutcome:i,onHover:l})},`${c.source}-${c.slug}`))}),jsxRuntime.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),d("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(pu,{onScrollToTop:p})]})}function pu({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function ms({tagSlugSelection:e,limit:t=24,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:d,markets_limit:u,onSelect:p,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g}){let{data:v,hasMore:x,fetchMore:b,isFetching:w,isFetchingMore:P}=Yi({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:d,markets_limit:u});return w?jsxRuntime.jsx(Po,{count:24}):jsxRuntime.jsx(us,{events:v,hasMore:x,isFetchingMore:P,onFetchMore:b,onSelect:p,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g})}function Ux({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n,bgImageSrc:i,onInsufficientBalance:s,enableKalshi:a=true}){let[l,d]=react.useState({categorySlug:null,tagSlug:null}),[u,p]=react.useState(()=>a?Vr:{...Vr,source:"polymarket"}),{isOpen:m,onOpen:c,onClose:f}=ui$1.useDisclosure(),{onOpen:g}=uiScaffold.useAsyncModal(Kr),v=react.useCallback((N,A,D)=>{t?.(N,A,D),g({params:{event:N,market:A,initialOutcome:D,onInsufficientBalance:s}});},[t,g,s]),x=react.useCallback(N=>{d(N);},[]),b=react.useCallback(N=>{p(A=>({...A,sortPreset:N}));},[]),w=react.useCallback(N=>{p(A=>({...A,sortAsc:N}));},[]),P=react.useCallback(N=>{p(N);},[]),h=react.useMemo(()=>Vi[u.sortPreset].sort_by,[u.sortPreset]),y=react.useMemo(()=>wo(u,a),[u,a]),S=react.useMemo(()=>jsxRuntime.jsx(ji,{sortPreset:u.sortPreset,onSortChange:b,sortAsc:u.sortAsc,onSortAscChange:w,onFilterPress:c,filterCount:y}),[u.sortPreset,u.sortAsc,y,b,w,c]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(wi,{onSelect:x,trailing:S})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(zi,{isOpen:m,onClose:f,value:u,onChange:P,enableKalshi:a}),jsxRuntime.jsx(ms,{tagSlugSelection:l,sort_by:h,sort_asc:u.sortAsc,source:u.source,timeRemaining:u.timeRemaining,minVolume:u.minVolume,minLiquidity:u.minLiquidity,onSelect:e,onSelectOutcome:v,getEventHref:r,LinkComponent:o,onHover:n})]}),jsxRuntime.jsx(Ln,{})]})}function vs(e){return utils$1.formatAmountInUsd(e)}var vu=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:vs,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:vs,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>utils$1.formatAmount(e),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function qx({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
36
+ `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((c,f)=>c==null?null:jsxRuntime.jsx("div",{style:{padding:uu,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(is,{event:c,href:s?.(c),LinkComponent:a,onSelect:n,onSelectOutcome:i,onHover:l})},`${c.source}-${c.slug}`))}),jsxRuntime.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),d("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(pu,{onScrollToTop:p})]})}function pu({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function ps({tagSlugSelection:e,limit:t=24,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:d,markets_limit:u,onSelect:p,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g}){let{data:v,hasMore:x,fetchMore:b,isFetching:P,isFetchingMore:w}=Gi({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:d,markets_limit:u});return P?jsxRuntime.jsx(Po,{count:24}):jsxRuntime.jsx(ds,{events:v,hasMore:x,isFetchingMore:w,onFetchMore:b,onSelect:p,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g})}function Ux({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n,bgImageSrc:i,onInsufficientBalance:s,enableKalshi:a=true}){let[l,d]=react.useState({categorySlug:null,tagSlug:null}),[u,p]=react.useState(()=>a?qr:{...qr,source:"polymarket"}),{isOpen:m,onOpen:c,onClose:f}=ui.useDisclosure(),{onOpen:g}=uiScaffold.useAsyncModal(jr),v=react.useCallback((N,F,O)=>{t?.(N,F,O),g({params:{event:N,market:F,initialOutcome:O,onInsufficientBalance:s}});},[t,g,s]),x=react.useCallback(N=>{d(N);},[]),b=react.useCallback(N=>{p(F=>({...F,sortPreset:N}));},[]),P=react.useCallback(N=>{p(F=>({...F,sortAsc:N}));},[]),w=react.useCallback(N=>{p(N);},[]),h=react.useMemo(()=>Ki[u.sortPreset].sort_by,[u.sortPreset]),y=react.useMemo(()=>wo(u,a),[u,a]),k=react.useMemo(()=>jsxRuntime.jsx(Vi,{sortPreset:u.sortPreset,onSortChange:b,sortAsc:u.sortAsc,onSortAscChange:P,onFilterPress:c,filterCount:y}),[u.sortPreset,u.sortAsc,y,b,P,c]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(Si,{onSelect:x,trailing:k})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(Hi,{isOpen:m,onClose:f,value:u,onChange:w,enableKalshi:a}),jsxRuntime.jsx(ps,{tagSlugSelection:l,sort_by:h,sort_asc:u.sortAsc,source:u.source,timeRemaining:u.timeRemaining,minVolume:u.minVolume,minLiquidity:u.minLiquidity,onSelect:e,onSelectOutcome:v,getEventHref:r,LinkComponent:o,onHover:n})]}),jsxRuntime.jsx(_n,{})]})}function hs(e){return utils$1.formatAmountInUsd(e)}var vu=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:hs,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:hs,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>utils$1.formatAmount(e),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function qx({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
37
37
  @keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
38
38
  @keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
39
39
  @keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@@ -71,15 +71,15 @@
71
71
  .evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
72
72
  @media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
73
73
  `}),jsxRuntime.jsxs("div",{className:"evt-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-hero-left",style:{minWidth:0,flex:1,animation:"evtHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"evt-hero-live",style:{marginBottom:16},children:jsxRuntime.jsxs("div",{className:"inline-flex items-center",style:{gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",width:8,height:8},children:[jsxRuntime.jsx("span",{style:{position:"absolute",display:"inline-flex",width:"100%",height:"100%",borderRadius:9999,background:"#00d492",opacity:.75,animation:"evt-live-ping 1.2s cubic-bezier(0,0,0.2,1) infinite"}}),jsxRuntime.jsx("span",{style:{position:"relative",display:"inline-flex",width:8,height:8,borderRadius:9999,background:"#00bc7d",animation:"evt-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.events.liveBadge")})]})}),jsxRuntime.jsxs("h1",{className:"evt-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.events.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.events.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"evt-hero-subtitle evt-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.events.heroSubtitle")).split(`
74
- `).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:vu.map((r,o)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:o%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:o<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${o*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+o*80}ms`}})})]},r.key))})]})]})}function Ss({event:e,market:t,position:r,onSuccess:o,onCancel:n}){let{t:i}=i18n.useTranslation(),{mutateAsync:s}=reactPredict.useRedeemPosition(),{evmAddress:a}=ar(),l=walletConnector.useWallets(),[d,u]=react.useState("idle"),[p,m]=react.useState(null),c=t.provider_meta?.["polymarket.conditionId"],f=t.provider_meta?.["polymarket.negRisk"]??false,g=a??"",v=react.useMemo(()=>l.find(F=>F.chainNamespace===types.ChainNamespace.EVM&&F.isConnected),[l]),x=ks(r.side,t.outcomes),w=t.outcomes?.[x]?.label??r.side,P=t.result!=null?ks(t.result,t.outcomes):-1,y=(P>=0?t.outcomes?.[P]:void 0)?.label??t.result??"",S=t.result!=null?x===P:true,N=react.useMemo(()=>S?r.size:0,[S,r.size]),A=react.useCallback(async()=>{if(!(!c||!g||!v)){u("pending"),m(null);try{let F=await v.getEip1193Provider();if(!F)throw new Error("EIP-1193 provider unavailable");await s({wallet_address:g,condition_id:c,neg_risk:f,signMessage:async q=>await F.request({method:"personal_sign",params:[q,g]})}),u("success"),o?.();}catch(F){u("error"),m(F instanceof Error?F.message:i("predict.redeem.error"));}}},[c,g,f,v,s,o,i]),D=walletConnector.useAuthCallback(A),z=d==="idle"&&!!c&&!!g&&!!v&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(Dn,{label:i("predict.positions.side"),value:w,valueClassName:S?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(Dn,{label:i("predict.redeem.result"),value:y,valueClassName:"text-green-400"}),jsxRuntime.jsx(Dn,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(Dn,{label:i("predict.redeem.expectedPayout"),value:`$${N.toFixed(2)}`,valueClassName:N>0?"text-green-400":"text-zinc-400"})]}),!S&&N===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),d==="error"&&p&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:p}),d==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[d!=="success"&&jsxRuntime.jsx(ui$1.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!z,isLoading:d==="pending",onPress:D,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),n&&d!=="success"&&jsxRuntime.jsx("button",{type:"button",onClick:n,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),d==="success"&&n&&jsxRuntime.jsx(ui$1.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:n,children:i("common.ok")})]})]})}function Dn({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function ks(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let o=t.findIndex(n=>n.label.toLowerCase()===r);return o>=0?o:1}var Ru="predict-redeem";function Ps({id:e=Ru}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_u,{...t})})}function _u({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:o("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:o("predict.redeem.description")})]}),jsxRuntime.jsx(Ss,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function Ms({market:e,initialOutcome:t="yes",slippageBps:r=100,onSuccess:o}){let{t:n}=i18n.useTranslation(),i=react.useRef(o);i.current=o;let{status:s}=walletConnector.useAuth(),a=walletConnector.useWallets(),l=reactPredict.usePredictClient(),d=react.useContext(reactPredict.PolymarketContext),u=reactQuery.useQueryClient(),p=e.source,m=p==="polymarket",c=a.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),f=a.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),g=s==="authenticated",v=c?.address,x=f?.address,[b,w]=react.useState(t),[P,h]=react.useState("market"),[y,S]=react.useState(NaN),[N,A]=react.useState(NaN),[D,z]=react.useState(false),[F,q]=react.useState(false),[$,Q]=react.useState(null),[re,Z]=react.useState(null),[C,E]=react.useState(false),[U,G]=react.useState(false),[k,ce]=react.useState("1h"),[pe,ke]=react.useState(30),[Ke,ze]=react.useState("minutes"),We=react.useMemo(()=>{if(p!=="polymarket")return;let M=e.provider_meta?.["polymarket.clobTokenIds"];return M?(typeof M=="string"?JSON.parse(M):M)[b==="yes"?0:1]:void 0},[p,e.provider_meta,b]),{data:rt,isLoading:Ne}=reactPredict.useTickSize(We),xe=rt?.minimum_tick_size?String(rt.minimum_tick_size):"0.01",{data:nt,isLoading:Ct}=reactPredict.useFeeRate(We),ot=String(nt?.base_fee??0),{data:Ge}=reactPredict.useRebateConfig(),Se=Ge?.builder_enabled&&Ge.builder_code?Ge.builder_code:void 0,Ie=false,it=null,Qt=false,gt,R,X;try{let M=ar();Ie=M.kalshiKycVerified,it=M.kalshiKycUrl,Qt=M.polymarketSetupVerified,gt=M.polymarketSafeAddress,R=M.polymarketWalletKind,X=M.polymarketWalletAddress;}catch{}let yt=p==="kalshi"&&!Ie,ht=p==="polymarket"&&!Qt,vt=react.useCallback(async()=>{if(!f||!d)return null;let M=await f.getEip1193Provider();if(!M)return null;let Oe=R==="deposit"&&!!X,De=!Oe&&!!gt,Ue={address:f.address,signatureType:Oe?3:De?2:0,signTypedData:async(we,Je,Ze,Ee)=>{let qe=[];"name"in we&&qe.push({name:"name",type:"string"}),"version"in we&&qe.push({name:"version",type:"string"}),"chainId"in we&&qe.push({name:"chainId",type:"uint256"}),"verifyingContract"in we&&qe.push({name:"verifyingContract",type:"address"}),"salt"in we&&qe.push({name:"salt",type:"bytes32"});let kr={EIP712Domain:qe,...Je};return await M.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:we,types:kr,primaryType:Ze,message:Ee})]})}};return d.credentials??await d.authenticate(Ue)},[gt,R,X,f,d]),{data:L}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:b},{enabled:e.status==="open"}),ve=react.useMemo(()=>{let M=reactPredict.pickBestBid(L,b);if(M!=null&&M>0)return M;let Oe=b==="yes"?0:1,De=e.outcomes[Oe];return De?.best_bid??De?.price??.5},[L,e.outcomes,b]),Ve=p==="kalshi"?v??"":x??"",{data:Ir,isLoading:io}=reactPredict.usePositions({source:p,user:Ve},{enabled:!!Ve,refetchInterval:3e4}),so=react.useCallback(async()=>{let M=await vt();return M?await reactPredict.buildPolymarketL2Headers(M.address,{apiKey:M.apiKey,secret:M.secret,passphrase:M.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[vt]),{data:rr,isLoading:nr}=reactPredict.useAvailableShares({source:p,user:Ve,market:e.slug,side:b},p==="polymarket"?{getHeaders:so}:void 0,{enabled:!!Ve&&!!e.slug,refetchOnMount:"always"}),Ft=rr?.total_shares??0,br=rr?.active_order_shares??0,Mt=rr?.available_shares??0,Ye=react.useMemo(()=>p==="polymarket"?reactPredict.getPolymarketSharesPrecision(xe):rr?.precision??0,[p,xe,rr?.precision]),ao=nr||io,un=e.provider_meta?.["dflow.yesMint"]??"",Bt=e.provider_meta?.["dflow.noMint"]??"",Xt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Or=e.provider_meta?.["dflow.collateralMint"]||"",pn=b==="yes"?un:Bt,mn=react.useMemo(()=>Ir?Ir.positions.find(M=>M.side?.toLowerCase()===b&&M.market?.slug===e.slug)??null:null,[Ir,e.slug,b])?.market?.provider_meta,co=mn?.["dflow.outcomeMint"]||pn,or=mn?.["dflow.collateralMint"]||Or,Et=co,Ht=or||Xt,yr=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),uo=p==="kalshi"&&!!Et&&!!Ht&&!!v&&yr!=="0",{refetch:Dr}=reactPredict.useDFlowQuote({inputMint:Et,outputMint:Ht,amount:yr,userPublicKey:v??"",slippageBps:100},{enabled:uo}),ir=react.useMemo(()=>isNaN(y)||y<=0?0:y,[y]),st=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:L,outcome:b,side:"sell",sharesNeeded:ir,slippageBps:r}),[L,b,ir,r]),Ar=react.useMemo(()=>st.status==="ok"&&st.worstPrice!=null&&st.worstPrice>0?st.worstPrice:ve,[st,ve]),po=react.useMemo(()=>{if(isNaN(y)||y<=0)return 0;let M=P==="limit"&&m&&!isNaN(N)?N:ve;return y*M},[y,P,m,N,ve]),_=react.useCallback(M=>{w(M),A(NaN),S(NaN),q(false);},[]);react.useEffect(()=>{_(t);},[t,_]);let je=react.useCallback(M=>{h(M);},[]);react.useEffect(()=>{P==="limit"&&A(Math.round(ve*1e4)/1e4);},[P,b]);let Qe=react.useCallback(M=>{if(q(false),isNaN(M)){S(NaN);return}S(Pe(Math.max(0,M),Ye));},[Ye]),zt=react.useCallback(()=>{q(true),S(Pe(Mt,Ye));},[Mt,Ye]),Fr=react.useCallback(M=>{if(isNaN(M)){A(NaN);return}A(Math.round(M*1e4)/1e4);},[]),kt=react.useCallback(()=>{S(NaN),A(NaN),h("market"),q(false),G(false),ce("1h"),ke(30),ze("minutes");},[]),St=react.useMemo(()=>{let M=[];return isNaN(y)||y<=0?M.push(n("predict.trade.minQuantity",{amount:Sn})):y<Sn&&M.push(n("predict.trade.minQuantity",{amount:Sn})),e.status!=="open"&&M.push(n("predict.trade.marketNotActive")),!isNaN(y)&&y>0&&!F&&y>Mt&&M.push(n("predict.trade.insufficientSharesDetail",{total:Pe(Ft,Ye).toFixed(Ye),active:Pe(br,Ye).toFixed(Ye),available:Pe(Mt,Ye).toFixed(Ye)})),P==="limit"&&m&&(isNaN(N)||N<.01||N>.99)&&M.push(n("predict.trade.limitPriceRange")),P==="limit"&&m&&U&&k==="custom"&&(isNaN(pe)||pe<=0)&&M.push(n("predict.trade.expiration.invalidDate")),p==="polymarket"&&P==="market"&&!isNaN(y)&&y>0&&(st.status==="insufficient_liquidity"?M.push(n("predict.trade.insufficientLiquidity",{available:Pe(st.totalAvailable,2)})):st.status==="exceeds_slippage"&&M.push(n("predict.trade.priceImpactTooHigh",{impact:(st.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:M.length===0,errors:M}},[y,e.status,Mt,Ft,br,F,P,m,N,U,k,pe,Ye,p,st,r,n]),{mutateAsync:Xe}=reactPredict.useDFlowSubmit(),{data:Br}=reactPredict.useOrder({id:$??"",source:p},{enabled:!!$}),Hr=react.useCallback(async()=>{if(!re||!v||!c)return;let{cashAmount:M,collateral:Oe}=re;Z(null);try{let Ue=(await l.createDFlowQuote({inputMint:Oe,outputMint:Xt,amount:M,userPublicKey:v,slippageBps:100}))?.transaction;if(!Ue)return;let we=Uint8Array.from(atob(Ue),Ze=>Ze.charCodeAt(0)),Je=await c.signTransaction(we);await Xe({signedTransaction:btoa(String.fromCharCode(...Je)),orderContext:{user_public_key:v,input_mint:Oe,output_mint:Xt,amount:M,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[re,v,c,l,Xe,Xt]),Tt=react.useCallback(()=>{u.invalidateQueries({queryKey:["predict","positions"]}),u.invalidateQueries({queryKey:["predict","orders"]}),u.invalidateQueries({queryKey:["predict","available-shares"]});},[u]);react.useEffect(()=>{if(!Br||!$)return;let{status:M}=Br;M==="closed"?(Q(null),re?Hr().finally(()=>{z(false),ui$1.toast.success(n("predict.trade.submitSuccess")),lr(),Tt(),kt(),i.current?.();}):(z(false),ui$1.toast.success(n("predict.trade.submitSuccess")),lr(),Tt(),kt(),i.current?.())):(M==="failed"||M==="expired")&&(z(false),Q(null),Z(null),ui$1.toast.error(n("predict.trade.submitError")));},[Br,$,re,Hr,Tt,kt,n]);let zr=react.useCallback(async()=>{if(!v||!c)return;if(!Et||!Ht){ui$1.toast.error("Missing token mint addresses"),z(false);return}if(!Ie){E(true),z(false);return}let De=(await Dr()).data,Ue=De?.transaction;if(!Ue){ui$1.toast.error(n("predict.trade.submitError")),z(false);return}if(or&&or!==Xt){let Ee=String(De?.outAmount??"");Ee&&Ee!=="0"&&Z({cashAmount:Ee,collateral:or});}let we=Uint8Array.from(atob(Ue),Ee=>Ee.charCodeAt(0)),Je=await c.signTransaction(we),Ze=await Xe({signedTransaction:btoa(String.fromCharCode(...Je)),orderContext:{user_public_key:v,input_mint:Et,output_mint:Ht,amount:yr,price:String(ve),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});Q(Ze.signature);},[v,c,Dr,Xe,Et,Ht,yr,ve,b,e.slug,or,Xt,n,Ie]),fn=react.useCallback(async()=>{if(!f||!d)return;let M=f.chain,Oe=M!==types.Chain.POLYGON;Oe&&await f.switchChain(types.Chain.POLYGON);try{let De=await f.getEip1193Provider();if(!De){ui$1.toast.error(n("predict.trade.submitError")),z(!1);return}let Ue=R==="deposit"&&!!X,we=!Ue&&!!gt,Je=Ue?X:gt,Ze={address:f.address,signatureType:Ue?3:we?2:0,signTypedData:async(Wt,hn,go,ho)=>{let Sr=[];"name"in Wt&&Sr.push({name:"name",type:"string"}),"version"in Wt&&Sr.push({name:"version",type:"string"}),"chainId"in Wt&&Sr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Wt&&Sr.push({name:"verifyingContract",type:"address"}),"salt"in Wt&&Sr.push({name:"salt",type:"bytes32"});let Gl={EIP712Domain:Sr,...hn};return await De.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:Wt,types:Gl,primaryType:go,message:ho})]})}},Ee=await vt();if(!Ee){ui$1.toast.error(n("predict.trade.submitError")),z(!1);return}let qe=b==="yes"?0:1,kr="",gn=e.provider_meta?.["polymarket.clobTokenIds"];gn&&(kr=(typeof gn=="string"?JSON.parse(gn):gn)[qe]??"");let hi=e.provider_meta?.["polymarket.negRisk"]??!1,jl=P==="limit"&&!isNaN(N)?N:Ar,ql=Nn(jl,xe),mo={tokenId:kr,price:ql,size:y,side:"SELL",orderType:P==="limit"?U?"GTD":"GTC":"FOK",tickSize:xe,negRisk:hi,...Je&&{funderAddress:Je},...Se&&{builderCode:Se},...P==="limit"&&U&&{expiration:Pn(k,pe,Ke)}},fo;if(Ue)fo=await reactPredict.buildSignedV2OrderPayload({signer:Ze,depositWalletAddress:Je,input:mo,owner:Ee.apiKey});else {let Wt=reactPredict.buildCtfExchangeDomain(hi),hn=reactPredict.buildOrderMessage({...mo,signerAddress:Ze.address,signatureType:Ze.signatureType,feeRateBps:ot}),go=await Ze.signTypedData(Wt,reactPredict.CTF_ORDER_TYPES,"Order",hn),ho=reactPredict.buildSignedOrder(hn,go,mo.orderType);fo=reactPredict.buildClobPayload(ho,Ee.apiKey);}await l.executePolymarketOrder({payload:fo,l2_api_key:Ee.apiKey,l2_secret:Ee.secret,l2_passphrase:Ee.passphrase,signer_address:Ee.address,owner:Ee.apiKey}),Tt(),ui$1.toast.success(n("predict.trade.submitSuccess")),lr(),kt(),z(!1),i.current?.();}finally{Oe&&M&&f.switchChain(M).catch(()=>{});}},[f,d,vt,b,e.provider_meta,P,N,Ar,y,l,Tt,U,k,pe,Ke,kt,n,xe,ot,e.slug,gt,R,X,Se]),Wr=react.useCallback(async()=>{if(!(!St.isValid||!g)){z(true),Q(null),E(false);try{p==="kalshi"?await zr():await fn();}catch(M){let Oe=M instanceof Error?M.message:"",De=p==="polymarket"&&Oe?Cn(Oe,n,"sell"):Oe||void 0;ui$1.toast.error(De||n("predict.trade.submitError")),z(false);}}},[St.isValid,g,p,zr,fn,n]);return {outcome:b,orderType:P,quantity:y,limitPrice:N,shares:ir,estimatedReturn:po,pricePerShare:ve,isMarketDataLoading:p==="polymarket"&&(Ct||Ne),isSubmitting:D,authStatus:s,validation:St,supportsLimitOrder:m,kycRequired:C,needsKyc:yt,needsSetup:ht,kycUrl:it,totalShares:Ft,activeOrderShares:br,availableShares:Mt,isAvailableLoading:ao,isSellAll:F,precision:Ye,expirationEnabled:U,expirationPreset:k,customDuration:pe,customDurationUnit:Ke,setOutcome:_,setOrderType:je,setQuantity:Qe,setLimitPrice:Fr,setSellAll:zt,setExpirationEnabled:G,setExpirationPreset:ce,setCustomDuration:ke,setCustomDurationUnit:ze,submit:Wr}}var fp=["5m","1h","12h","24h","eod","custom"],gp={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},hp=["minutes","hours","days"],vp={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},xp={maximumFractionDigits:0};function As({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,estimatedReturn:a,isMarketDataLoading:l,isSubmitting:d,authStatus:u,isValid:p,validationErrors:m,supportsLimitOrder:c,kycRequired:f,needsKyc:g,needsSetup:v,onSetupRequired:x,kycUrl:b,totalShares:w,activeOrderShares:P,availableShares:h,isAvailableLoading:y,precision:S,expirationEnabled:N,expirationPreset:A,customDuration:D,customDurationUnit:z,onOutcomeChange:F,onOrderTypeChange:q,onQuantityChange:$,onLimitPriceChange:Q,onSellAll:re,onExpirationEnabledChange:Z,onExpirationPresetChange:C,onCustomDurationChange:E,onCustomDurationUnitChange:U,onSubmit:G}){let{t:k}=i18n.useTranslation(),[ce,pe]=react.useState(false),ke=ui$1.useDisclosure(),[Ke,ze]=react.useState(""),We=react.useRef(false);react.useEffect(()=>{We.current||ze(isNaN(i)?"":String(i));},[i]);let[rt,Ne]=react.useState(""),xe=react.useRef(false);react.useEffect(()=>{xe.current||(isNaN(s)?Ne(""):Ne(String(parseFloat((s*100).toFixed(2)))));},[s]);let nt=react.useCallback(R=>{if(R!==""&&!/^\d*\.?\d{0,2}$/.test(R))return;if(Ne(R),R===""||R==="."){Q(NaN);return}let yt=parseFloat(R);isNaN(yt)||Q(yt/100);},[Q]),Ct=react.useCallback(R=>{let X=new RegExp(`^\\d*\\.?\\d{0,${S}}$`);if(R!==""&&!X.test(R))return;if(ze(R),pe(false),R===""||R==="."){$(NaN);return}let yt=parseFloat(R);isNaN(yt)||$(yt);},[$,S]);react.useEffect(()=>{f&&!ke.isOpen&&ke.onOpen();},[f]);let ot=react.useMemo(()=>{let R=o==="yes"?t.yesBid:t.noBid;return R!=null?parseFloat((Number(R)*100).toFixed(2)):null},[o,t]),Ge=!isNaN(i)&&i>0,Se=u==="authenticated",Ie=u==="authenticating"||u==="deauthenticating",it=Se&&(g||v),Qt=react.useMemo(()=>{if(Ie)return k("predict.trade.checkingLogin");if(!Se)return k("predict.trade.loginToTrade");if(g)return k("predict.trade.kycRequired");if(v)return k("predict.trade.setupRequired");if(y)return k("predict.trade.loadingBalance");if(l)return k("predict.trade.loadingMarketData");if(d)return k("predict.trade.submitting");if(f)return k("predict.trade.kycRequired");if(!Ge)return k("predict.trade.enterAmount");let R=k(o==="yes"?"predict.trade.yes":"predict.trade.no");return `${k("predict.trade.sell")} ${R}`},[Ie,Se,g,v,y,l,d,f,Ge,o,k]),gt=()=>{if(!Se){pe(false),G();return}if(g){ke.onOpen();return}if(v&&x){pe(false),x();return}if(f){ke.onOpen();return}if(!p){pe(true);return}pe(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:R=>{r==="bordered"&&(R.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:R=>{r==="bordered"&&(R.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[k("predict.trade.sell")," ",k(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[c?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:R=>q(R),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:k("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:k("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:k("predict.trade.market")}),n==="limit"&&c?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:rt,onChange:R=>nt(R.target.value),onFocus:()=>{xe.current=true;},onBlur:()=>{xe.current=false,isNaN(s)?Ne(""):Ne(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ot!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ot," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(R=>{let X=R==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>F(R),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===R?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:k(R==="yes"?"predict.trade.yes":"predict.trade.no")}),X!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(X)*100).toFixed(2)),"\xA2"]})]})},R)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:k("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(R=>{let X=Math.pow(10,S);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{$(Math.floor(h*R/100*X)/X);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[R,"%"]},R)}),jsxRuntime.jsx("button",{type:"button",onClick:re,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:k("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Ke,onChange:R=>Ct(R.target.value),onFocus:()=>{We.current=true;},onBlur:()=>{We.current=false,ze(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ce&&m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:m.map(R=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:R},R))})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:y?"\u2013":`${Pe(w,S).toFixed(S)}${k("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:y?"\u2013":P>0?`-${Pe(P,S).toFixed(S)}${k("predict.trade.sharesUnit")}`:`0${k("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:y?"\u2013":`${Pe(h,S).toFixed(S)}${k("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:k("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${a.toFixed(2)}`:"\u2013"})]})]}),n==="limit"&&c&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:k("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:N,onValueChange:Z,"aria-label":k("predict.trade.setExpiration")})]}),N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":k("predict.trade.setExpiration"),selectedKeys:[A],onSelectionChange:R=>{let X=Array.from(R)[0];X&&C(X);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:fp.map(R=>jsxRuntime.jsx(ui$1.SelectItem,{children:k(gp[R])},R))}),A==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(D)?void 0:D,onValueChange:E,minValue:1,step:1,formatOptions:xp,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[z],onSelectionChange:R=>{let X=Array.from(R)[0];X&&U(X);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:hp.map(R=>jsxRuntime.jsx(ui$1.SelectItem,{children:k(vp[R])},R))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:Ie||Se&&!it&&(y||l||!Ge||d),isLoading:Ie||Se&&!it&&(d||y||l),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:gt,children:Qt})]}),jsxRuntime.jsx(Mn,{isOpen:ke.isOpen,onClose:ke.onClose,kycUrl:b})]})}function Fn({event:e,market:t,variant:r,initialOutcome:o,chain:n,slippageBps:i,onOutcomeChange:s,onSetupRequired:a,onSuccess:l}){let{outcome:d,orderType:u,quantity:p,limitPrice:m,estimatedReturn:c,pricePerShare:f,isMarketDataLoading:g,isSubmitting:v,authStatus:x,validation:b,supportsLimitOrder:w,kycRequired:P,needsKyc:h,needsSetup:y,kycUrl:S,totalShares:N,activeOrderShares:A,availableShares:D,isAvailableLoading:z,precision:F,expirationEnabled:q,expirationPreset:$,customDuration:Q,customDurationUnit:re,setOutcome:Z,setOrderType:C,setQuantity:E,setLimitPrice:U,setSellAll:G,setExpirationEnabled:k,setExpirationPreset:ce,setCustomDuration:pe,setCustomDurationUnit:ke,submit:Ke}=Ms({market:t,initialOutcome:o,slippageBps:i,onSuccess:l}),ze=walletConnector.useAuthCallback(Ke),We=react.useCallback(xe=>{Z(xe),s?.(xe);},[Z,s]),rt=react.useMemo(()=>e?xn(e):void 0,[e]),Ne=react.useMemo(()=>bn(t,{yesBid:d==="yes"?f:void 0,noBid:d==="no"?f:void 0}),[t,d,f]);return jsxRuntime.jsx(As,{event:rt,market:Ne,variant:r,outcome:d,orderType:u,quantity:p,limitPrice:m,estimatedReturn:c,isMarketDataLoading:g,isSubmitting:v,authStatus:x,isValid:b.isValid,validationErrors:b.errors,supportsLimitOrder:w,kycRequired:P,needsKyc:h,needsSetup:y,onSetupRequired:a,kycUrl:S,totalShares:N,activeOrderShares:A,availableShares:D,isAvailableLoading:z,precision:F,expirationEnabled:q,expirationPreset:$,customDuration:Q,customDurationUnit:re,onOutcomeChange:We,onOrderTypeChange:C,onQuantityChange:E,onLimitPriceChange:U,onSellAll:G,onExpirationEnabledChange:k,onExpirationPresetChange:ce,onCustomDurationChange:pe,onCustomDurationUnitChange:ke,onSubmit:ze})}var Io="predict-sell";function Bs({id:e=Io}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Mp,{...t})})}function Mp({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(Fn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var Ao=40,zn=36,Xr=480,Fo=Xr-zn;function Ws({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(p=>p.slug)??[],[e.markets]),{data:a}=reactPredict.usePositions({source:e.source,user:t??""}),l=react.useMemo(()=>!a?.positions||!t?0:s.length===0?a.positions.length:a.positions.filter(p=>p.market&&s.includes(p.market.slug)).length,[a?.positions,s,t]),u=[{key:"positions",label:l>0?`${o("predict.positions.title")} (${l})`:o("predict.positions.title")},{key:"orders",label:o("predict.openOrders.title")},{key:"trades",label:o("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:u.map(p=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(p.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===p.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:p.label},p.key))}),t?jsxRuntime.jsxs("div",{style:{height:Xr},children:[n==="positions"&&jsxRuntime.jsx(Op,{source:e.source,walletAddress:t,marketSlugs:s}),n==="orders"&&jsxRuntime.jsx(Ap,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Hp,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xr},children:o("predict.trade.connectWallet")})]})}function Op({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:i}=reactPredict.usePositions({source:e,user:t}),s=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(a=>a.market&&r.includes(a.market.slug)):[],[n?.positions,r]);return i?jsxRuntime.jsx(Ho,{}):s.length===0?jsxRuntime.jsx(Bo,{message:o("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:zn},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:o("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},rowComponent:Dp,rowCount:s.length,rowHeight:Ao,rowProps:{positions:s,closeLabel:o("predict.positions.close")}})]})}function Dp({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let i=n.pnl??0,s=n.pnl_percent??0,a=n.avg_price??0,l=n.current_price??0,d=i>0?"text-success":i<0?"text-danger":"text-foreground",u=i>0?"+":"",p=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",m=n.side,c=n.size,f=n.size*l,g=n.market?.end_at?Up(n.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:p}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",m.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:m})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Bn(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Bn(l)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",d),children:[u,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:o})})]})}function Ap({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:a,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),d=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let x=i?.pages?.flatMap(P=>P.items)??[],b=new Set(["live","open","submitted","pending"]),w=x.filter(P=>b.has(P.status));return r.length>0&&(w=w.filter(P=>P.market_id&&r.includes(P.market_id))),w},[i?.pages,r]),p=react.useCallback(x=>{o?o(x.id):d.mutate({source:x.source,id:x.id});},[o,d]),m=u.length,c=m+(l?1:0),f=react.useCallback(x=>x<m,[m]),g=react.useCallback(async()=>{await a();},[a]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:c,threshold:5});return s?jsxRuntime.jsx(Ho,{}):u.length===0&&!l?jsxRuntime.jsx(Bo,{message:n("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:zn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:n("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:n("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},onRowsRendered:v,rowComponent:Fp,rowCount:c,rowHeight:Ao,rowProps:{orders:u,itemCount:m,onCancel:p,isCancelling:d.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Fp({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:i,cancelLabel:s}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let a=r[e];if(!a)return null;let l=a.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",l?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:a.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:a.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:a.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:a.price?Bn(parseFloat(a.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[a.size_matched??"0","/",a.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Bp,{status:a.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(a),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):s})})]})}function Bp({status:e}){return jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Hp({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:i,hasNextPage:s}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),a=react.useMemo(()=>o?.pages?.flatMap(c=>c.items)??[],[o?.pages]),l=a.length,d=l+(s?1:0),u=react.useCallback(c=>c<l,[l]),p=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:p,rowCount:d,threshold:5});return n?jsxRuntime.jsx(Ho,{}):a.length===0&&!s?jsxRuntime.jsx(Bo,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:zn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},onRowsRendered:m,rowComponent:zp,rowCount:d,rowHeight:Ao,rowProps:{trades:a,itemCount:l}})]})}function zp({index:e,style:t,trades:r,itemCount:o}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let n=r[e];if(!n)return null;let i=n.side?.toUpperCase()==="BUY",s=Wp(n.timestamp),a=n.price??0,l=n.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:n.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:n.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Bn(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",l.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:s})]})}function Bo({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xr},children:e})}function Ho(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Xr},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Bn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Wp(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${i}`}function Up(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Us=`
74
+ `).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:vu.map((r,o)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:o%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:o<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${o*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+o*80}ms`}})})]},r.key))})]})]})}function ks({event:e,market:t,position:r,onSuccess:o,onCancel:n}){let{t:i}=i18n.useTranslation(),{mutateAsync:s}=reactPredict.useRedeemPosition(),{evmAddress:a}=dr(),l=walletConnector.useWallets(),[d,u]=react.useState("idle"),[p,m]=react.useState(null),c=t.provider_meta?.["polymarket.conditionId"],f=t.provider_meta?.["polymarket.negRisk"]??false,g=a??"",v=react.useMemo(()=>l.find(A=>A.chainNamespace===types.ChainNamespace.EVM&&A.isConnected),[l]),x=ys(r.side,t.outcomes),P=t.outcomes?.[x]?.label??r.side,w=t.result!=null?ys(t.result,t.outcomes):-1,y=(w>=0?t.outcomes?.[w]:void 0)?.label??t.result??"",k=t.result!=null?x===w:true,N=react.useMemo(()=>k?r.size:0,[k,r.size]),F=react.useCallback(async()=>{if(!(!c||!g||!v)){u("pending"),m(null);try{let A=await v.getEip1193Provider();if(!A)throw new Error("EIP-1193 provider unavailable");await s({wallet_address:g,condition_id:c,neg_risk:f,signMessage:async j=>await A.request({method:"personal_sign",params:[j,g]})}),u("success"),o?.();}catch(A){u("error"),m(A instanceof Error?A.message:i("predict.redeem.error"));}}},[c,g,f,v,s,o,i]),O=walletConnector.useAuthCallback(F),z=d==="idle"&&!!c&&!!g&&!!v&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(Fn,{label:i("predict.positions.side"),value:P,valueClassName:k?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(Fn,{label:i("predict.redeem.result"),value:y,valueClassName:"text-green-400"}),jsxRuntime.jsx(Fn,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(Fn,{label:i("predict.redeem.expectedPayout"),value:`$${N.toFixed(2)}`,valueClassName:N>0?"text-green-400":"text-zinc-400"})]}),!k&&N===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),d==="error"&&p&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:p}),d==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[d!=="success"&&jsxRuntime.jsx(ui.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!z,isLoading:d==="pending",onPress:O,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),n&&d!=="success"&&jsxRuntime.jsx("button",{type:"button",onClick:n,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),d==="success"&&n&&jsxRuntime.jsx(ui.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:n,children:i("common.ok")})]})]})}function Fn({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function ys(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let o=t.findIndex(n=>n.label.toLowerCase()===r);return o>=0?o:1}var Ru="predict-redeem";function ws({id:e=Ru}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_u,{...t})})}function _u({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:o("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:o("predict.redeem.description")})]}),jsxRuntime.jsx(ks,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function Cs({market:e,initialOutcome:t="yes",slippageBps:r=100,onSuccess:o}){let{t:n}=i18n.useTranslation(),i=react.useRef(o);i.current=o;let{status:s}=walletConnector.useAuth(),a=walletConnector.useWallets(),l=reactPredict.usePredictClient(),d=react.useContext(reactPredict.PolymarketContext),u=reactQuery.useQueryClient(),p=e.source,m=p==="polymarket",c=a.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),f=a.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),g=s==="authenticated",v=c?.address,x=f?.address,[b,P]=react.useState(t),[w,h]=react.useState("market"),[y,k]=react.useState(NaN),[N,F]=react.useState(NaN),[O,z]=react.useState(false),[A,j]=react.useState(false),[V,te]=react.useState(null),[Q,J]=react.useState(null),[C,E]=react.useState(false),[U,Y]=react.useState(false),[oe,S]=react.useState("1h"),[we,Ke]=react.useState(30),[pe,xt]=react.useState("minutes"),Ve=react.useMemo(()=>{if(p!=="polymarket")return;let M=e.provider_meta?.["polymarket.clobTokenIds"];return M?(typeof M=="string"?JSON.parse(M):M)[b==="yes"?0:1]:void 0},[p,e.provider_meta,b]),{data:ze,isLoading:at}=reactPredict.useTickSize(Ve),me=ze?.minimum_tick_size?String(ze.minimum_tick_size):"0.01",{data:ve,isLoading:Mt}=reactPredict.useFeeRate(Ve),Bt=String(ve?.base_fee??0),{data:lt}=reactPredict.useRebateConfig(),Qe=lt?.builder_enabled&&lt.builder_code?lt.builder_code:void 0,je=false,Xe=null,Ie=false,Oe,qe,xe;try{let M=dr();je=M.kalshiKycVerified,Xe=M.kalshiKycUrl,Ie=M.polymarketSetupVerified,Oe=M.polymarketSafeAddress,qe=M.polymarketWalletKind,xe=M.polymarketWalletAddress;}catch{}let or=p==="kalshi"&&!je,_=p==="polymarket"&&!Ie,le=react.useCallback(async()=>{if(!f||!d)return null;let M=await f.getEip1193Provider();if(!M)return null;let De=qe==="deposit"&&!!xe,Fe=!De&&!!Oe,Ge={address:f.address,signatureType:De?3:Fe?2:0,signTypedData:async(Pe,nt,ot,Ee)=>{let Ze=[];"name"in Pe&&Ze.push({name:"name",type:"string"}),"version"in Pe&&Ze.push({name:"version",type:"string"}),"chainId"in Pe&&Ze.push({name:"chainId",type:"uint256"}),"verifyingContract"in Pe&&Ze.push({name:"verifyingContract",type:"address"}),"salt"in Pe&&Ze.push({name:"salt",type:"bytes32"});let Pr={EIP712Domain:Ze,...nt};return await M.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:Pe,types:Pr,primaryType:ot,message:Ee})]})}};return d.credentials??await d.authenticate(Ge)},[Oe,qe,xe,f,d]),{data:be}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:b},{enabled:e.status==="open"}),Ae=react.useMemo(()=>{let M=reactPredict.pickBestBid(be,b);if(M!=null&&M>0)return M;let De=b==="yes"?0:1,Fe=e.outcomes[De];return Fe?.best_bid??Fe?.price??.5},[be,e.outcomes,b]),kt=p==="kalshi"?v??"":x??"",{data:D,isLoading:We}=reactPredict.usePositions({source:p,user:kt},{enabled:!!kt,refetchInterval:3e4}),Ht=react.useCallback(async()=>{let M=await le();return M?await reactPredict.buildPolymarketL2Headers(M.address,{apiKey:M.apiKey,secret:M.secret,passphrase:M.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[le]),{data:ir,isLoading:sr}=reactPredict.useAvailableShares({source:p,user:kt,market:e.slug,side:b},p==="polymarket"?{getHeaders:Ht}:void 0,{enabled:!!kt&&!!e.slug,refetchOnMount:"always"}),zt=ir?.total_shares??0,Sr=ir?.active_order_shares??0,Et=ir?.available_shares??0,et=react.useMemo(()=>p==="polymarket"?reactPredict.getPolymarketSharesPrecision(me):ir?.precision??0,[p,me,ir?.precision]),ao=sr||We,mn=e.provider_meta?.["dflow.yesMint"]??"",Wt=e.provider_meta?.["dflow.noMint"]??"",Zt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Dr=e.provider_meta?.["dflow.collateralMint"]||"",fn=b==="yes"?mn:Wt,gn=react.useMemo(()=>D?D.positions.find(M=>M.side?.toLowerCase()===b&&M.market?.slug===e.slug)??null:null,[D,e.slug,b])?.market?.provider_meta,co=gn?.["dflow.outcomeMint"]||fn,ar=gn?.["dflow.collateralMint"]||Dr,Tt=co,Ut=ar||Zt,wr=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),uo=p==="kalshi"&&!!Tt&&!!Ut&&!!v&&wr!=="0",{refetch:Fr}=reactPredict.useDFlowQuote({inputMint:Tt,outputMint:Ut,amount:wr,userPublicKey:v??"",slippageBps:100},{enabled:uo}),lr=react.useMemo(()=>isNaN(y)||y<=0?0:y,[y]),ct=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:be,outcome:b,side:"sell",sharesNeeded:lr,slippageBps:r}),[be,b,lr,r]),Br=react.useMemo(()=>ct.status==="ok"&&ct.worstPrice!=null&&ct.worstPrice>0?ct.worstPrice:Ae,[ct,Ae]),po=react.useMemo(()=>{if(isNaN(y)||y<=0)return 0;let M=w==="limit"&&m&&!isNaN(N)?N:Ae;return y*M},[y,w,m,N,Ae]),L=react.useCallback(M=>{P(M),F(NaN),k(NaN),j(false);},[]);react.useEffect(()=>{L(t);},[t,L]);let Je=react.useCallback(M=>{h(M);},[]);react.useEffect(()=>{w==="limit"&&F(Math.round(Ae*1e4)/1e4);},[w,b]);let tt=react.useCallback(M=>{if(j(false),isNaN(M)){k(NaN);return}k(Ne(Math.max(0,M),et));},[et]),$t=react.useCallback(()=>{j(true),k(Ne(Et,et));},[Et,et]),Hr=react.useCallback(M=>{if(isNaN(M)){F(NaN);return}F(Math.round(M*1e4)/1e4);},[]),St=react.useCallback(()=>{k(NaN),F(NaN),h("market"),j(false),Y(false),S("1h"),Ke(30),xt("minutes");},[]),wt=react.useMemo(()=>{let M=[];return isNaN(y)||y<=0?M.push(n("predict.trade.minQuantity",{amount:Pn})):y<Pn&&M.push(n("predict.trade.minQuantity",{amount:Pn})),e.status!=="open"&&M.push(n("predict.trade.marketNotActive")),!isNaN(y)&&y>0&&!A&&y>Et&&M.push(n("predict.trade.insufficientSharesDetail",{total:Ne(zt,et).toFixed(et),active:Ne(Sr,et).toFixed(et),available:Ne(Et,et).toFixed(et)})),w==="limit"&&m&&(isNaN(N)||N<.01||N>.99)&&M.push(n("predict.trade.limitPriceRange")),w==="limit"&&m&&U&&oe==="custom"&&(isNaN(we)||we<=0)&&M.push(n("predict.trade.expiration.invalidDate")),p==="polymarket"&&w==="market"&&!isNaN(y)&&y>0&&(ct.status==="insufficient_liquidity"?M.push(n("predict.trade.insufficientLiquidity",{available:Ne(ct.totalAvailable,2)})):ct.status==="exceeds_slippage"&&M.push(n("predict.trade.priceImpactTooHigh",{impact:(ct.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:M.length===0,errors:M}},[y,e.status,Et,zt,Sr,A,w,m,N,U,oe,we,et,p,ct,r,n]),{mutateAsync:rt}=reactPredict.useDFlowSubmit(),{data:zr}=reactPredict.useOrder({id:V??"",source:p},{enabled:!!V}),Wr=react.useCallback(async()=>{if(!Q||!v||!c)return;let{cashAmount:M,collateral:De}=Q;J(null);try{let Ge=(await l.createDFlowQuote({inputMint:De,outputMint:Zt,amount:M,userPublicKey:v,slippageBps:100}))?.transaction;if(!Ge)return;let Pe=Uint8Array.from(atob(Ge),ot=>ot.charCodeAt(0)),nt=await c.signTransaction(Pe);await rt({signedTransaction:btoa(String.fromCharCode(...nt)),orderContext:{user_public_key:v,input_mint:De,output_mint:Zt,amount:M,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[Q,v,c,l,rt,Zt]),Lt=react.useCallback(()=>{u.invalidateQueries({queryKey:["predict","positions"]}),u.invalidateQueries({queryKey:["predict","orders"]}),u.invalidateQueries({queryKey:["predict","available-shares"]});},[u]);react.useEffect(()=>{if(!zr||!V)return;let{status:M}=zr;M==="closed"?(te(null),Q?Wr().finally(()=>{z(false),ui.toast.success(n("predict.trade.submitSuccess")),ur(),Lt(),St(),i.current?.();}):(z(false),ui.toast.success(n("predict.trade.submitSuccess")),ur(),Lt(),St(),i.current?.())):(M==="failed"||M==="expired")&&(z(false),te(null),J(null),ui.toast.error(n("predict.trade.submitError")));},[zr,V,Q,Wr,Lt,St,n]);let Ur=react.useCallback(async()=>{if(!v||!c)return;if(!Tt||!Ut){ui.toast.error("Missing token mint addresses"),z(false);return}if(!je){E(true),z(false);return}let Fe=(await Fr()).data,Ge=Fe?.transaction;if(!Ge){ui.toast.error(n("predict.trade.submitError")),z(false);return}if(ar&&ar!==Zt){let Ee=String(Fe?.outAmount??"");Ee&&Ee!=="0"&&J({cashAmount:Ee,collateral:ar});}let Pe=Uint8Array.from(atob(Ge),Ee=>Ee.charCodeAt(0)),nt=await c.signTransaction(Pe),ot=await rt({signedTransaction:btoa(String.fromCharCode(...nt)),orderContext:{user_public_key:v,input_mint:Tt,output_mint:Ut,amount:wr,price:String(Ae),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});te(ot.signature);},[v,c,Fr,rt,Tt,Ut,wr,Ae,b,e.slug,ar,Zt,n,je]),hn=react.useCallback(async()=>{if(!f||!d)return;let M=f.chain,De=M!==types.Chain.POLYGON;De&&await f.switchChain(types.Chain.POLYGON);try{let Fe=await f.getEip1193Provider();if(!Fe){ui.toast.error(n("predict.trade.submitError")),z(!1);return}let Ge=qe==="deposit"&&!!xe,Pe=!Ge&&!!Oe,nt=Ge?xe:Oe,ot={address:f.address,signatureType:Ge?3:Pe?2:0,signTypedData:async(Kt,xn,go,ho)=>{let Nr=[];"name"in Kt&&Nr.push({name:"name",type:"string"}),"version"in Kt&&Nr.push({name:"version",type:"string"}),"chainId"in Kt&&Nr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Kt&&Nr.push({name:"verifyingContract",type:"address"}),"salt"in Kt&&Nr.push({name:"salt",type:"bytes32"});let Gl={EIP712Domain:Nr,...xn};return await Fe.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:Kt,types:Gl,primaryType:go,message:ho})]})}},Ee=await le();if(!Ee){ui.toast.error(n("predict.trade.submitError")),z(!1);return}let Ze=b==="yes"?0:1,Pr="",vn=e.provider_meta?.["polymarket.clobTokenIds"];vn&&(Pr=(typeof vn=="string"?JSON.parse(vn):vn)[Ze]??"");let gi=e.provider_meta?.["polymarket.negRisk"]??!1,jl=w==="limit"&&!isNaN(N)?N:Br,ql=Mn(jl,me),mo={tokenId:Pr,price:ql,size:y,side:"SELL",orderType:w==="limit"?U?"GTD":"GTC":"FOK",tickSize:me,negRisk:gi,...nt&&{funderAddress:nt},...Qe&&{builderCode:Qe},...w==="limit"&&U&&{expiration:Cn(oe,we,pe)}},fo;if(Ge)fo=await reactPredict.buildSignedV2OrderPayload({signer:ot,depositWalletAddress:nt,input:mo,owner:Ee.apiKey});else {let Kt=reactPredict.buildCtfExchangeDomain(gi),xn=reactPredict.buildOrderMessage({...mo,signerAddress:ot.address,signatureType:ot.signatureType,feeRateBps:Bt}),go=await ot.signTypedData(Kt,reactPredict.CTF_ORDER_TYPES,"Order",xn),ho=reactPredict.buildSignedOrder(xn,go,mo.orderType);fo=reactPredict.buildClobPayload(ho,Ee.apiKey);}await l.executePolymarketOrder({payload:fo,l2_api_key:Ee.apiKey,l2_secret:Ee.secret,l2_passphrase:Ee.passphrase,signer_address:Ee.address,owner:Ee.apiKey}),Lt(),ui.toast.success(n("predict.trade.submitSuccess")),ur(),St(),z(!1),i.current?.();}finally{De&&M&&f.switchChain(M).catch(()=>{});}},[f,d,le,b,e.provider_meta,w,N,Br,y,l,Lt,U,oe,we,pe,St,n,me,Bt,e.slug,Oe,qe,xe,Qe]),$r=react.useCallback(async()=>{if(!(!wt.isValid||!g)){z(true),te(null),E(false);try{p==="kalshi"?await Ur():await hn();}catch(M){let De=M instanceof Error?M.message:"",Fe=p==="polymarket"&&De?En(De,n,"sell"):De||void 0;ui.toast.error(Fe||n("predict.trade.submitError")),z(false);}}},[wt.isValid,g,p,Ur,hn,n]);return {outcome:b,orderType:w,quantity:y,limitPrice:N,shares:lr,estimatedReturn:po,pricePerShare:Ae,isMarketDataLoading:p==="polymarket"&&(Mt||at),isSubmitting:O,authStatus:s,validation:wt,supportsLimitOrder:m,kycRequired:C,needsKyc:or,needsSetup:_,kycUrl:Xe,totalShares:zt,activeOrderShares:Sr,availableShares:Et,isAvailableLoading:ao,isSellAll:A,precision:et,expirationEnabled:U,expirationPreset:oe,customDuration:we,customDurationUnit:pe,setOutcome:L,setOrderType:Je,setQuantity:tt,setLimitPrice:Hr,setSellAll:$t,setExpirationEnabled:Y,setExpirationPreset:S,setCustomDuration:Ke,setCustomDurationUnit:xt,submit:$r}}var fp=["5m","1h","12h","24h","eod","custom"],gp={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},hp=["minutes","hours","days"],vp={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},xp={maximumFractionDigits:0};function As({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,estimatedReturn:a,isMarketDataLoading:l,isSubmitting:d,authStatus:u,isValid:p,validationErrors:m,supportsLimitOrder:c,kycRequired:f,needsKyc:g,needsSetup:v,onSetupRequired:x,kycUrl:b,totalShares:P,activeOrderShares:w,availableShares:h,isAvailableLoading:y,precision:k,expirationEnabled:N,expirationPreset:F,customDuration:O,customDurationUnit:z,oddsFormatter:A,onOutcomeChange:j,onOrderTypeChange:V,onQuantityChange:te,onLimitPriceChange:Q,onSellAll:J,onExpirationEnabledChange:C,onExpirationPresetChange:E,onCustomDurationChange:U,onCustomDurationUnitChange:Y,onSubmit:oe}){let{t:S}=i18n.useTranslation(),[we,Ke]=react.useState(false),pe=ui.useDisclosure(),[xt,Ve]=react.useState(""),ze=react.useRef(false);react.useEffect(()=>{ze.current||Ve(isNaN(i)?"":String(i));},[i]);let[at,me]=react.useState(""),ve=react.useRef(false);react.useEffect(()=>{ve.current||(isNaN(s)?me(""):me(String(parseFloat((s*100).toFixed(2)))));},[s]);let Mt=react.useCallback(_=>{if(_!==""&&!/^\d*\.?\d{0,2}$/.test(_))return;if(me(_),_===""||_==="."){Q(NaN);return}let be=parseFloat(_);isNaN(be)||Q(be/100);},[Q]),Bt=react.useCallback(_=>{let le=new RegExp(`^\\d*\\.?\\d{0,${k}}$`);if(_!==""&&!le.test(_))return;if(Ve(_),Ke(false),_===""||_==="."){te(NaN);return}let be=parseFloat(_);isNaN(be)||te(be);},[te,k]);react.useEffect(()=>{f&&!pe.isOpen&&pe.onOpen();},[f]);let lt=react.useMemo(()=>{let _=o==="yes"?t.yesBid:t.noBid;return _!=null?parseFloat((Number(_)*100).toFixed(2)):null},[o,t]),Qe=o==="yes"?t.yesBid:t.noBid,je=Qe!=null&&A?A(Number(Qe)):lt!=null?`${lt} \xA2`:null,Xe=!isNaN(i)&&i>0,Ie=u==="authenticated",Oe=u==="authenticating"||u==="deauthenticating",qe=Ie&&(g||v),xe=react.useMemo(()=>{if(Oe)return S("predict.trade.checkingLogin");if(!Ie)return S("predict.trade.loginToTrade");if(g)return S("predict.trade.kycRequired");if(v)return S("predict.trade.setupRequired");if(y)return S("predict.trade.loadingBalance");if(l)return S("predict.trade.loadingMarketData");if(d)return S("predict.trade.submitting");if(f)return S("predict.trade.kycRequired");if(!Xe)return S("predict.trade.enterAmount");let _=S(o==="yes"?"predict.trade.yes":"predict.trade.no");return `${S("predict.trade.sell")} ${_}`},[Oe,Ie,g,v,y,l,d,f,Xe,o,S]),or=()=>{if(!Ie){Ke(false),oe();return}if(g){pe.onOpen();return}if(v&&x){Ke(false),x();return}if(f){pe.onOpen();return}if(!p){Ke(true);return}Ke(false),oe();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[S("predict.trade.sell")," ",S(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[c?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:_=>V(_),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:S("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:S("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:S("predict.trade.market")}),n==="limit"&&c?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:at,onChange:_=>Mt(_.target.value),onFocus:()=>{ve.current=true;},onBlur:()=>{ve.current=false,isNaN(s)?me(""):me(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):je!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:je})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(_=>{let le=_==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>j(_),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===_?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:S(_==="yes"?"predict.trade.yes":"predict.trade.no")}),le!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:A?A(Number(le)):`${parseFloat((Number(le)*100).toFixed(2))}\xA2`})]})},_)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:S("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(_=>{let le=Math.pow(10,k);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{te(Math.floor(h*_/100*le)/le);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[_,"%"]},_)}),jsxRuntime.jsx("button",{type:"button",onClick:J,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:S("common.all")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:xt,onChange:_=>Bt(_.target.value),onFocus:()=>{ze.current=true;},onBlur:()=>{ze.current=false,Ve(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),we&&m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:m.map(_=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:_},_))})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:y?"\u2013":`${Ne(P,k).toFixed(k)}${S("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:y?"\u2013":w>0?`-${Ne(w,k).toFixed(k)}${S("predict.trade.sharesUnit")}`:`0${S("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:y?"\u2013":`${Ne(h,k).toFixed(k)}${S("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:S("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${a.toFixed(2)}`:"\u2013"})]})]}),n==="limit"&&c&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:S("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:N,onValueChange:C,"aria-label":S("predict.trade.setExpiration")})]}),N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":S("predict.trade.setExpiration"),selectedKeys:[F],onSelectionChange:_=>{let le=Array.from(_)[0];le&&E(le);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:fp.map(_=>jsxRuntime.jsx(ui.SelectItem,{children:S(gp[_])},_))}),F==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(O)?void 0:O,onValueChange:U,minValue:1,step:1,formatOptions:xp,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[z],onSelectionChange:_=>{let le=Array.from(_)[0];le&&Y(le);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:hp.map(_=>jsxRuntime.jsx(ui.SelectItem,{children:S(vp[_])},_))})]})]})]}),jsxRuntime.jsx(ui.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:Oe||Ie&&!qe&&(y||l||!Xe||d),isLoading:Oe||Ie&&!qe&&(d||y||l),spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:or,children:xe})]}),jsxRuntime.jsx(Tn,{isOpen:pe.isOpen,onClose:pe.onClose,kycUrl:b})]})}function Hn({event:e,market:t,variant:r,initialOutcome:o,chain:n,slippageBps:i,onOutcomeChange:s,onSetupRequired:a,onSuccess:l,oddsFormatter:d}){let{outcome:u,orderType:p,quantity:m,limitPrice:c,estimatedReturn:f,pricePerShare:g,isMarketDataLoading:v,isSubmitting:x,authStatus:b,validation:P,supportsLimitOrder:w,kycRequired:h,needsKyc:y,needsSetup:k,kycUrl:N,totalShares:F,activeOrderShares:O,availableShares:z,isAvailableLoading:A,precision:j,expirationEnabled:V,expirationPreset:te,customDuration:Q,customDurationUnit:J,setOutcome:C,setOrderType:E,setQuantity:U,setLimitPrice:Y,setSellAll:oe,setExpirationEnabled:S,setExpirationPreset:we,setCustomDuration:Ke,setCustomDurationUnit:pe,submit:xt}=Cs({market:t,initialOutcome:o,slippageBps:i,onSuccess:l}),Ve=walletConnector.useAuthCallback(xt),ze=react.useCallback(ve=>{C(ve),s?.(ve);},[C,s]),at=react.useMemo(()=>e?yn(e):void 0,[e]),me=react.useMemo(()=>kn(t,{yesBid:u==="yes"?g:void 0,noBid:u==="no"?g:void 0}),[t,u,g]);return jsxRuntime.jsx(As,{event:at,market:me,variant:r,outcome:u,orderType:p,quantity:m,limitPrice:c,estimatedReturn:f,isMarketDataLoading:v,isSubmitting:x,authStatus:b,isValid:P.isValid,validationErrors:P.errors,supportsLimitOrder:w,kycRequired:h,needsKyc:y,needsSetup:k,onSetupRequired:a,kycUrl:N,totalShares:F,activeOrderShares:O,availableShares:z,isAvailableLoading:A,precision:j,expirationEnabled:V,expirationPreset:te,customDuration:Q,customDurationUnit:J,oddsFormatter:d,onOutcomeChange:ze,onOrderTypeChange:E,onQuantityChange:U,onLimitPriceChange:Y,onSellAll:oe,onExpirationEnabledChange:S,onExpirationPresetChange:we,onCustomDurationChange:Ke,onCustomDurationUnitChange:pe,onSubmit:Ve})}var Io="predict-sell";function Fs({id:e=Io}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Mp,{...t})})}function Mp({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(Hn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var Do=40,Un=36,Zr=480,Fo=Zr-Un;function zs({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(p=>p.slug)??[],[e.markets]),{data:a}=reactPredict.usePositions({source:e.source,user:t??""}),l=react.useMemo(()=>!a?.positions||!t?0:s.length===0?a.positions.length:a.positions.filter(p=>p.market&&s.includes(p.market.slug)).length,[a?.positions,s,t]),u=[{key:"positions",label:l>0?`${o("predict.positions.title")} (${l})`:o("predict.positions.title")},{key:"orders",label:o("predict.openOrders.title")},{key:"trades",label:o("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:u.map(p=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(p.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===p.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:p.label},p.key))}),t?jsxRuntime.jsxs("div",{style:{height:Zr},children:[n==="positions"&&jsxRuntime.jsx(Op,{source:e.source,walletAddress:t,marketSlugs:s}),n==="orders"&&jsxRuntime.jsx(Dp,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Hp,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Zr},children:o("predict.trade.connectWallet")})]})}function Op({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:i}=reactPredict.usePositions({source:e,user:t}),s=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(a=>a.market&&r.includes(a.market.slug)):[],[n?.positions,r]);return i?jsxRuntime.jsx(Ho,{}):s.length===0?jsxRuntime.jsx(Bo,{message:o("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Un},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:o("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},rowComponent:Ap,rowCount:s.length,rowHeight:Do,rowProps:{positions:s,closeLabel:o("predict.positions.close")}})]})}function Ap({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let i=n.pnl??0,s=n.pnl_percent??0,a=n.avg_price??0,l=n.current_price??0,d=i>0?"text-success":i<0?"text-danger":"text-foreground",u=i>0?"+":"",p=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",m=n.side,c=n.size,f=n.size*l,g=n.market?.end_at?Up(n.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:p}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",m.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:m})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:zn(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:zn(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",d),children:[u,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:o})})]})}function Dp({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:a,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),d=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let x=i?.pages?.flatMap(w=>w.items)??[],b=new Set(["live","open","submitted","pending"]),P=x.filter(w=>b.has(w.status));return r.length>0&&(P=P.filter(w=>w.market_id&&r.includes(w.market_id))),P},[i?.pages,r]),p=react.useCallback(x=>{o?o(x.id):d.mutate({source:x.source,id:x.id});},[o,d]),m=u.length,c=m+(l?1:0),f=react.useCallback(x=>x<m,[m]),g=react.useCallback(async()=>{await a();},[a]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:c,threshold:5});return s?jsxRuntime.jsx(Ho,{}):u.length===0&&!l?jsxRuntime.jsx(Bo,{message:n("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Un},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:n("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:n("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},onRowsRendered:v,rowComponent:Fp,rowCount:c,rowHeight:Do,rowProps:{orders:u,itemCount:m,onCancel:p,isCancelling:d.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Fp({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:i,cancelLabel:s}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let a=r[e];if(!a)return null;let l=a.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",l?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:a.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:a.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:a.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:a.price?zn(parseFloat(a.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[a.size_matched??"0","/",a.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Bp,{status:a.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(a),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):s})})]})}function Bp({status:e}){return jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Hp({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:i,hasNextPage:s}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),a=react.useMemo(()=>o?.pages?.flatMap(c=>c.items)??[],[o?.pages]),l=a.length,d=l+(s?1:0),u=react.useCallback(c=>c<l,[l]),p=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:p,rowCount:d,threshold:5});return n?jsxRuntime.jsx(Ho,{}):a.length===0&&!s?jsxRuntime.jsx(Bo,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Un},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Fo},onRowsRendered:m,rowComponent:zp,rowCount:d,rowHeight:Do,rowProps:{trades:a,itemCount:l}})]})}function zp({index:e,style:t,trades:r,itemCount:o}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let n=r[e];if(!n)return null;let i=n.side?.toUpperCase()==="BUY",s=Wp(n.timestamp),a=n.price??0,l=n.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:n.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:n.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:zn(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",l.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:s})]})}function Bo({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Zr},children:e})}function Ho(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Zr},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function zn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Wp(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${i}`}function Up(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Ws=`
75
75
  @keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
76
- `,$s={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function fe(e){return {...$s,animationDelay:`${e}ms`}}function Jr({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Us}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...$s,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...fe(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...fe(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...fe(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...fe(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...fe(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...fe(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...fe(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...fe(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...fe(240),height:14,width:56}})}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...fe(260+o*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...fe(280+o*40),height:14,width:o%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...fe(300+o*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...fe(320+o*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(340+o*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(360+o*40),height:32,width:80,borderRadius:8}})]})]},o))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...fe(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...fe(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...fe(460),height:14,width:"60%"}})]})]})]})}function Ks(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Us}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(120),height:40,width:"100%",borderRadius:8}})]})]})}var Ys="var(--color-bullish)",Qs="var(--color-bearish)";function Zr(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function Vp(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function jp(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let c of e){let f=Math.round(c.price*100);f>=0&&f<=100&&(r[f]+=c.quantity);}for(let c of t){let f=Math.round(c.price*100);f>=0&&f<=100&&(o[f]+=c.quantity);}let n=0,i=0,s=new Float64Array(101),a=new Float64Array(101);for(let c=100;c>=0;c--)n+=r[c],i+=r[c]*c/100,s[c]=n,a[c]=i;let l=0,d=0,u=new Float64Array(101),p=new Float64Array(101);for(let c=0;c<=100;c++)l+=o[c],d+=o[c]*c/100,u[c]=l,p[c]=d;let m=Math.max(s[0]??0,u[100]??0);return Array.from({length:101},(c,f)=>{let g=s[f]>0,v=u[f]>0,x=s[f]||u[f],b=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:Vp(x,m),opacity:x>0?b?1:.5:0,isBid:g,isAsk:v,bidCumTotal:s[f],askCumTotal:u[f],bidCumCost:a[f],askCumCost:p[f]}})}function qp({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Ys:Qs,o=e.leftPct>65?void 0:`${e.leftPct}%`,n=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:o,right:n,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:Zr(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Zr(Math.round(e.cumCost))]})]})}var Gp=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?Ys:t.isAsk?Qs:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:i&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:s,opacity:t.opacity}})})}),Yp=[0,10,20,30,40,50,60,70,80,90,100];function Qp(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:Yp.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function Xs({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>jp(e,t),[e,t]),n=react.useMemo(()=>{let p=e.length>0?Math.max(...e.map(c=>c.price)):0,m=t.length>0?Math.min(...t.map(c=>c.price)):1;return Math.round((p+m)/2*100)},[e,t]),i=react.useMemo(()=>o.some(p=>p.isBid||p.isAsk),[o]),[s,a]=react.useState(null),l=react.useRef(null),d=react.useCallback((p,m)=>{l.current&&(l.current.style.filter=""),m?(m.style.filter="brightness(1.5)",l.current=m):l.current=null,p.isBid||p.isAsk?a({priceCents:p.priceCents,isBid:p.isBid,cumTotal:p.isBid?p.bidCumTotal:p.askCumTotal,cumCost:p.isBid?p.bidCumCost:p.askCumCost,leftPct:p.priceCents}):a(null);},[]),u=react.useCallback(()=>{l.current&&(l.current.style.filter="",l.current=null),a(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[n>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),s&&jsxRuntime.jsx(qp,{info:s}),o.map(p=>jsxRuntime.jsx(Gp,{slot:p,onEnter:d,onLeave:u},p.priceCents))]}),jsxRuntime.jsx(Qp,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function Uo(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Zs(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function na({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:o="depth",className:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(o),l=e.source,{data:d,isLoading:u,isFetching:p,refetch:m}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:l,outcome:t}),c=react.useMemo(()=>(d?.bids??[]).map(b=>({price:b.price,quantity:b.size})),[d?.bids]),f=react.useMemo(()=>(d?.asks??[]).map(b=>({price:b.price,quantity:b.size})),[d?.asks]),g=react.useMemo(()=>c.length>0?Math.max(...c.map(b=>b.price)):null,[c]),v=react.useMemo(()=>f.length>0?Math.min(...f.map(b=>b.price)):null,[f]),x=react.useMemo(()=>{if(g==null||v==null)return null;let b=(v-g)*100;return Math.round(b*10)/10},[g,v]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col",n??"h-[262px]"),children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:x!=null?`${i("predict.orderBook.spread")}: ${Number.isInteger(x)?`${x}\xA2`:`${x.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[g!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[i("predict.trade.bestBid"),": ",Uo(g)]}),g!=null&&v!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),v!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[i("predict.trade.bestAsk"),": ",Uo(v)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:s==="depth"?"Orderbook":"Depth chart",onClick:()=>a(b=>b==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:s==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>m(),disabled:p,className:ui$1.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",p&&"animate-spin"),children:jsxRuntime.jsx(ui$1.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:u?jsxRuntime.jsx(Zs,{}):jsxRuntime.jsx(Xs,{bids:c,asks:f})}),s==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:u?jsxRuntime.jsx(Zs,{}):jsxRuntime.jsx(rm,{bids:c,asks:f,bestBid:g??void 0,bestAsk:v??void 0,spread:x??void 0})})]})]})}var Wo=4,tm=8;function rm({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(false),s=n?tm:Wo,a=t.length>Wo||e.length>Wo,l=react.useMemo(()=>[...t].sort((m,c)=>m.price-c.price).slice(0,s).reverse(),[t,s]),d=react.useMemo(()=>[...e].sort((m,c)=>c.price-m.price).slice(0,s),[e,s]),u=react.useMemo(()=>{let m=[...l,...d].map(c=>c.quantity);return Math.max(...m,1)},[l,d]);return l.length===0&&d.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:o("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[l.map(m=>jsxRuntime.jsx(ea,{price:m.price,quantity:m.quantity,side:"ask",maxQty:u},`ask-${m.price}`)),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:[r!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]}),a&&jsxRuntime.jsx("button",{type:"button",onClick:()=>i(m=>!m),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:o(n?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),d.map(m=>jsxRuntime.jsx(ea,{price:m.price,quantity:m.quantity,side:"bid",maxQty:u},`bid-${m.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:o("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:o("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:o("predict.orderBook.total")})]})]})}function ea({price:e,quantity:t,side:r,maxQty:o}){let n=r==="ask",i=Math.min(t/o*100,100),s=n?"bg-bearish/10":"bg-bullish/10",a=n?"text-bearish":"text-bullish",l=Zr(Math.round(t)),d=Math.round(t*e),u=`$${Zr(d)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${s} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${a}`,children:Uo(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:l}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:u})]})}var Vo=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},en=4,oa=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function fm(e,t){let r=new Date(e);return t===ae.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function gm(e,t){let r=new Date(e);return t===ae.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===ae.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function sa(e){return `${(e*100).toFixed(2)}%`}var hm=[{range:ae.ONE_DAY,label:"1D"},{range:ae.ONE_WEEK,label:"1W"},{range:ae.ONE_MONTH,label:"1M"},{range:ae.ALL,label:"ALL"}];function vm({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:hm.map(({range:r,label:o})=>{let n=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:n?"#f9fafb":"#6b7280",fontWeight:n?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:o},r)})})}function xm(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let i=e.current,s=t.current;if(!i||!s)return;let a=i.getBoundingClientRect(),l=(n.clientX-a.left)/a.width*100;s.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,s.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function bm({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:i}){if(!e||!n?.length)return null;let s=new Map;t?.forEach(l=>s.set(l.dataKey,l));let a=n.map(l=>s.get(l.slug)??{dataKey:l.slug,value:void 0,stroke:l.color,color:l.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?gm(r,i):r}),a.map(l=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:l.stroke??l.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(l.dataKey)??l.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:l.value!=null?sa(l.value):"--"})]},l.dataKey))]})}function ym({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!n)return;function d(u){s.current&&!s.current.contains(u.target)&&i(false);}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let a=t.length>=en,l=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(d=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(d)??"#6b7280",display:"inline-block"}},d))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let d=e.find(u=>u.slug===t[0]);return d?.outcomes?.[0]?.label??d?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[l,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",en," markets"]}),e.map((d,u)=>{let p=t.includes(d.slug),m=!p&&a,c=p&&t.length===1,f=r.get(d.slug)??"#6b7280",g=d.outcomes.find(x=>x.label.toLowerCase()==="yes")??d.outcomes[0],v=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{c||m||o(d.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:p?"rgba(255,255,255,0.05)":"transparent",cursor:m||c?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!m&&!c&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=p?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:p?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:p?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:p&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:p?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.outcomes?.[0]?.label??d.question}),v&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},d.id??`${u}-${d.slug}`)})]})]})}function km({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(o=>{let n=t.get(o.marketSlug)??"#6b7280",i=r.get(o.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:o.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?sa(i):"--"})]})]},o.marketSlug)})})}function Sm(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function wm(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let i=Math.floor(n*o),s=Math.min(Math.floor((n+1)*o),e.length),a=e.slice(i,s),l=a.map(d=>d.price).sort((d,u)=>d-u);r.push({timestamp:a[a.length-1].timestamp,price:Sm(l)});}return r}function Pm(e,t=200){if(e.length===0)return [];let r=e.map(a=>({...a,data:wm(a.data,t)})),o=new Set;r.forEach(a=>a.data.forEach(l=>o.add(l.timestamp)));let n=Array.from(o).sort((a,l)=>a-l),i=r.map(a=>{let l=new Map;return a.data.forEach(d=>l.set(d.timestamp,d.price)),{slug:a.marketSlug,map:l}}),s=new Map;return n.map(a=>{let l={timestamp:a};return i.forEach(({slug:d,map:u})=>{let p=u.get(a);if(p!==void 0)s.set(d,p),l[d]=p;else {let m=s.get(d);m!==void 0&&(l[d]=m);}}),l})}function aa(e){return jsxRuntime.jsx(Vo,{children:jsxRuntime.jsx(Nm,{...e})})}function Nm({event:e,isLoading:t,className:r,volume:o,fillHeight:n=false}){let i=react.useMemo(()=>{let C=new Set;return (e.markets??[]).filter(E=>C.has(E.slug)?false:(C.add(E.slug),true))},[e.markets]),s=react.useMemo(()=>[...i].sort((C,E)=>{let U=G=>(G.outcomes.find(k=>k.label.toLowerCase()==="yes")??G.outcomes[0])?.price??0;return U(E)-U(C)}),[i]),[a,l]=react.useState(()=>s.slice(0,en).map(C=>C.slug));react.useEffect(()=>{let C=new Set(i.map(E=>E.slug));l(E=>{let U=E.filter(G=>C.has(G));return U.length===E.length?E:U.length>0?U:s.slice(0,en).map(G=>G.slug)});},[i,s]);let[d,u]=react.useState(kn),p=react.useMemo(()=>{let C=new Map;return a.forEach((E,U)=>{C.set(E,oa[U%oa.length]);}),C},[a]),m=react.useMemo(()=>i.filter(C=>a.includes(C.slug)),[i,a]),{series:c,isLoading:f}=reactPredict.useMarketHistory(m,d),g=t||f,v=react.useMemo(()=>{if(c.length>0&&c.some(U=>U.data.length>0))return c;let C=Date.now(),E=864e5;return m.map(U=>{let k=(U.outcomes?.find(ce=>ce.label.toLowerCase()==="yes")??U.outcomes?.[0])?.price??.5;return {marketSlug:U.slug,label:U.outcomes?.[0]?.label??U.question,data:[{timestamp:C-7*E,price:k},{timestamp:C,price:k}]}})},[c,m]),x=react.useMemo(()=>d===ae.ONE_DAY?96:d===ae.ONE_WEEK?168:d===ae.ONE_MONTH?180:300,[d]),b=react.useMemo(()=>Pm(v,x),[v,x]),w=react.useMemo(()=>{if(b.length===0)return [0,1];let C=1/0,E=-1/0;if(a.forEach(G=>{b.forEach(k=>{let ce=k[G];ce!=null&&(ce<C&&(C=ce),ce>E&&(E=ce));});}),!isFinite(C))return [0,1];let U=Math.max((E-C)*.15,.05);return [Math.max(0,C-U),Math.min(1,E+U)]},[b,a]),P=react.useMemo(()=>{let C=new Map;return v.forEach(E=>{E.data.length>0&&C.set(E.marketSlug,E.data[E.data.length-1].price);}),C},[v]),h=react.useMemo(()=>{let C=new Map;return v.forEach(E=>C.set(E.marketSlug,E.label)),C},[v]),y=react.useMemo(()=>v.map(C=>({slug:C.marketSlug,color:p.get(C.marketSlug)??"#6b7280"})),[v,p]),{wrapperRef:S,overlayRef:N,onMouseMove:A,onMouseLeave:D}=xm(),z=react.useCallback(C=>{l(E=>E.includes(C)?E.length<=1?E:E.filter(U=>U!==C):E.length>=en?E:[...E,C]);},[]),[F,q]=react.useState(null),$=react.useRef(null),Q=react.useRef(""),re=react.useRef(0),Z=!g&&b.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...n?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(km,{series:v,colorMap:p,displayValues:F??P}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...n?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:S,style:{width:"100%",userSelect:"none",position:"relative",...n?{flex:1,minHeight:240}:{height:300}},onMouseMove:Z?C=>{A(C),cancelAnimationFrame(re.current),re.current=requestAnimationFrame(()=>{q($.current);});}:void 0,onMouseLeave:Z?()=>{D(),cancelAnimationFrame(re.current),Q.current="",$.current=null,q(null);}:void 0,children:g?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):b.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:N,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:b,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:C=>fm(C,d),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:w,tickFormatter:C=>`${Math.round(C*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:C=>{let E=C;if(E.active&&E.payload?.length){let U=E.payload.map(G=>`${G.dataKey}:${G.value}`).join(",");if(U!==Q.current){Q.current=U;let G=new Map;E.payload.forEach(k=>{k.value!=null&&G.set(k.dataKey,k.value);}),$.current=G;}}return jsxRuntime.jsx(bm,{...E,labelMap:h,allSeries:y,range:d})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),v.map(C=>{let E=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:C.marketSlug,stroke:E,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:E},connectNulls:true,isAnimationActive:false},C.marketSlug)}),F==null&&b.length>0&&v.map(C=>{let E=b[b.length-1],U=E[C.marketSlug];if(U==null)return null;let G=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:U,ifOverflow:"extendDomain",shape:k=>{let{cx:ce,cy:pe}=k;return ce==null||pe==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:ce,cy:pe,r:6,fill:G,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:ce,cy:pe,r:3.5,fill:G})]})}},`pulse-${C.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[o!=null&&o>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:[utils$1.formatAmountInUsd(o)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(vm,{value:d,onChange:u}),s.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(ym,{markets:s,selectedSlugs:a,colorMap:p,onToggle:z})})]})]})]})}function $n(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function ca(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function Wm(e){return `${parseFloat((e*100).toFixed(2))}%`}function da(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function Kn(e){return e.outcomes?.[0]?.label??e.question}function Um(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function tn(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),o=t.getDate(),n=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${i}:${s}`}function ua(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let u=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(u)},[e]),!e||t===0)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let i=Math.floor(n/864e5),s=Math.floor(n%864e5/36e5),a=Math.floor(n%36e5/6e4),l=Math.floor(n%6e4/1e3),d=[];return i>0&&d.push(`${i}d`),d.push(`${String(s).padStart(2,"0")}h`),d.push(`${String(a).padStart(2,"0")}m`),d.push(`${String(l).padStart(2,"0")}s`),d.join(" ")}function pa(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),s=t.getFullYear(),a=-t.getTimezoneOffset(),l=a>=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}function ha({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let p=[...e.markets||[]],m=p.filter(f=>f.status==="open").sort((f,g)=>$n(g)-$n(f)),c=p.filter(f=>f.status!=="open").sort((f,g)=>$n(g)-$n(f));return [...m,...c]},[e.markets]),s=e.status==="closed"||e.status==="voided",a=ua(s?void 0:e.start_at),l=ua(s?void 0:e.end_at),d=pa(e.start_at),u=pa(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:o,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${n?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${n?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!n&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((p,m)=>jsxRuntime.jsxs(react.Fragment,{children:[m>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:p.label})]},p.slug)),jsxRuntime.jsx(jm,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${n?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(a||l||s)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:s?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:a})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:d})]})]}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:l})}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:u})]})]}):null}),jsxRuntime.jsx(aa,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx($m,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Vm,{markets:i,event:e})]})}var ma=5;function $m({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),[n,i]=react.useState(false),[s,a]=react.useState(null),l=react.useMemo(()=>{let v=new Set;return e.filter(x=>v.has(x.slug)?false:(v.add(x.slug),true))},[e]),d=l.find(v=>v.status==="open")?.slug,[u,p]=react.useState(d?`${d}:yes`:null);if(l.length===0)return null;let m=l.length>ma,c=n?l:l.slice(0,ma),f=v=>{a(x=>x===v?null:v);},g=(v,x,b)=>{p(`${v.slug}:${x}`),o&&a(v.slug),t?.(v,x,b);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:c.map((v,x)=>{let b=s===v.slug;return jsxRuntime.jsx(Km,{market:v,activeYes:u===`${v.slug}:yes`,activeNo:u===`${v.slug}:no`,isExpanded:b,onToggleExpand:()=>f(v.slug),onTradeAction:g},v.id??`${x}-${v.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(v=>!v),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(n?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",n&&"rotate-180")})]})]})}function Km({market:e,activeYes:t,activeNo:r,isExpanded:o,onToggleExpand:n,onTradeAction:i}){let{t:s}=i18n.useTranslation(),a=e.status==="open",l=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,{data:d}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:e.source,outcome:"yes"},{enabled:a}),{data:u}=reactPredict.useOrderbook({slug:e.slug,source:e.source,outcome:"no"},{enabled:false,refetchInterval:false}),p=reactPredict.pickBestAsk(d,"yes")??ca(e,"yes")??0,m=reactPredict.pickBestAsk(u,"no")??ca(e,"no");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:n,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url,name:Kn(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:Kn(e)}),l&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:l})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Wm(p)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:c=>{c.stopPropagation(),i?.(e,"yes","buy");},children:s("predict.market.action.yes",{price:da(p)})}),jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:c=>{c.stopPropagation(),i?.(e,"no","buy");},children:m!=null?s("predict.market.action.no",{price:da(m)}):s("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?s("predict.event.status.closed"):e.status==="voided"?s("predict.event.status.voided"):s("predict.event.status.pending")})})})]}),o&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(na,{market:e,outcome:r?"no":"yes",onTradeAction:i})})})})]})}function Vm({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[i,s]=react.useState(false),[a,l]=react.useState(0),d=e.filter(c=>c.rules&&c.rules.length>0||c.description);if(d.length===0)return null;let u=d[a]??d[0],p=u.rules&&u.rules.length>0?u.rules.join(`
76
+ `,Us={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function fe(e){return {...Us,animationDelay:`${e}ms`}}function en({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ws}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...Us,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...fe(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...fe(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...fe(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...fe(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...fe(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...fe(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...fe(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...fe(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...fe(240),height:14,width:56}})}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...fe(260+o*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...fe(280+o*40),height:14,width:o%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...fe(300+o*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...fe(320+o*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(340+o*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(360+o*40),height:32,width:80,borderRadius:8}})]})]},o))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...fe(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...fe(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...fe(460),height:14,width:"60%"}})]})]})]})}function $s(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ws}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(120),height:40,width:"100%",borderRadius:8}})]})]})}var Gs="var(--color-bullish)",Ys="var(--color-bearish)";function tn(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function Vp(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function jp(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let c of e){let f=Math.round(c.price*100);f>=0&&f<=100&&(r[f]+=c.quantity);}for(let c of t){let f=Math.round(c.price*100);f>=0&&f<=100&&(o[f]+=c.quantity);}let n=0,i=0,s=new Float64Array(101),a=new Float64Array(101);for(let c=100;c>=0;c--)n+=r[c],i+=r[c]*c/100,s[c]=n,a[c]=i;let l=0,d=0,u=new Float64Array(101),p=new Float64Array(101);for(let c=0;c<=100;c++)l+=o[c],d+=o[c]*c/100,u[c]=l,p[c]=d;let m=Math.max(s[0]??0,u[100]??0);return Array.from({length:101},(c,f)=>{let g=s[f]>0,v=u[f]>0,x=s[f]||u[f],b=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:Vp(x,m),opacity:x>0?b?1:.5:0,isBid:g,isAsk:v,bidCumTotal:s[f],askCumTotal:u[f],bidCumCost:a[f],askCumCost:p[f]}})}function qp({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Gs:Ys,o=e.leftPct>65?void 0:`${e.leftPct}%`,n=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:o,right:n,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:tn(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",tn(Math.round(e.cumCost))]})]})}var Gp=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?Gs:t.isAsk?Ys:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:i&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:s,opacity:t.opacity}})})}),Yp=[0,10,20,30,40,50,60,70,80,90,100];function Qp(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:Yp.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function Qs({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>jp(e,t),[e,t]),n=react.useMemo(()=>{let p=e.length>0?Math.max(...e.map(c=>c.price)):0,m=t.length>0?Math.min(...t.map(c=>c.price)):1;return Math.round((p+m)/2*100)},[e,t]),i=react.useMemo(()=>o.some(p=>p.isBid||p.isAsk),[o]),[s,a]=react.useState(null),l=react.useRef(null),d=react.useCallback((p,m)=>{l.current&&(l.current.style.filter=""),m?(m.style.filter="brightness(1.5)",l.current=m):l.current=null,p.isBid||p.isAsk?a({priceCents:p.priceCents,isBid:p.isBid,cumTotal:p.isBid?p.bidCumTotal:p.askCumTotal,cumCost:p.isBid?p.bidCumCost:p.askCumCost,leftPct:p.priceCents}):a(null);},[]),u=react.useCallback(()=>{l.current&&(l.current.style.filter="",l.current=null),a(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[n>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),s&&jsxRuntime.jsx(qp,{info:s}),o.map(p=>jsxRuntime.jsx(Gp,{slot:p,onEnter:d,onLeave:u},p.priceCents))]}),jsxRuntime.jsx(Qp,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function ra(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Js(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function na({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:o="depth",className:n,oddsFormatter:i}){let{t:s}=i18n.useTranslation(),[a,l]=react.useState(o),d=i??ra,u=e.source,{data:p,isLoading:m,isFetching:c,refetch:f}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:u,outcome:t}),g=react.useMemo(()=>(p?.bids??[]).map(w=>({price:w.price,quantity:w.size})),[p?.bids]),v=react.useMemo(()=>(p?.asks??[]).map(w=>({price:w.price,quantity:w.size})),[p?.asks]),x=react.useMemo(()=>g.length>0?Math.max(...g.map(w=>w.price)):null,[g]),b=react.useMemo(()=>v.length>0?Math.min(...v.map(w=>w.price)):null,[v]),P=react.useMemo(()=>{if(x==null||b==null)return null;let w=(b-x)*100;return Math.round(w*10)/10},[x,b]);return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col",n??"h-[262px]"),children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:P!=null?`${s("predict.orderBook.spread")}: ${Number.isInteger(P)?`${P}\xA2`:`${P.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[x!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[s("predict.trade.bestBid"),": ",d(x)]}),x!=null&&b!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),b!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[s("predict.trade.bestAsk"),": ",d(b)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:a==="depth"?"Orderbook":"Depth chart",onClick:()=>l(w=>w==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:a==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>f(),disabled:c,className:ui.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",c&&"animate-spin"),children:jsxRuntime.jsx(ui.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[a==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:m?jsxRuntime.jsx(Js,{}):jsxRuntime.jsx(Qs,{bids:g,asks:v})}),a==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:m?jsxRuntime.jsx(Js,{}):jsxRuntime.jsx(rm,{bids:g,asks:v,bestBid:x??void 0,bestAsk:b??void 0,spread:P??void 0,oddsFormatter:i})})]})]})}var Wo=4,tm=8;function rm({bids:e,asks:t,spread:r,oddsFormatter:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(false),a=i?tm:Wo,l=t.length>Wo||e.length>Wo,d=react.useMemo(()=>[...t].sort((c,f)=>c.price-f.price).slice(0,a).reverse(),[t,a]),u=react.useMemo(()=>[...e].sort((c,f)=>f.price-c.price).slice(0,a),[e,a]),p=react.useMemo(()=>{let c=[...d,...u].map(f=>f.quantity);return Math.max(...c,1)},[d,u]);return d.length===0&&u.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:n("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[d.map(c=>jsxRuntime.jsx(Zs,{price:c.price,quantity:c.quantity,side:"ask",maxQty:p,oddsFormatter:o},`ask-${c.price}`)),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:[r!=null&&jsxRuntime.jsxs("span",{children:[n("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]}),l&&jsxRuntime.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:n(i?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),u.map(c=>jsxRuntime.jsx(Zs,{price:c.price,quantity:c.quantity,side:"bid",maxQty:p,oddsFormatter:o},`bid-${c.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:n("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:n("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:n("predict.orderBook.total")})]})]})}function Zs({price:e,quantity:t,side:r,maxQty:o,oddsFormatter:n}){let i=r==="ask",s=Math.min(t/o*100,100),a=i?"bg-bearish/10":"bg-bullish/10",l=i?"text-bearish":"text-bullish",d=tn(Math.round(t)),u=Math.round(t*e),p=`$${tn(u)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${a} transition-[width] duration-200`,style:{width:`${s}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:n?n(e):ra(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:d}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:p})]})}var Ko=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},rn=4,oa=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function fm(e,t){let r=new Date(e);return t===ae.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function gm(e,t){let r=new Date(e);return t===ae.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===ae.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function sa(e){return `${(e*100).toFixed(2)}%`}var hm=[{range:ae.ONE_DAY,label:"1D"},{range:ae.ONE_WEEK,label:"1W"},{range:ae.ONE_MONTH,label:"1M"},{range:ae.ALL,label:"ALL"}];function vm({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:hm.map(({range:r,label:o})=>{let n=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:n?"#f9fafb":"#6b7280",fontWeight:n?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:o},r)})})}function xm(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let i=e.current,s=t.current;if(!i||!s)return;let a=i.getBoundingClientRect(),l=(n.clientX-a.left)/a.width*100;s.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,s.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function bm({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:i}){if(!e||!n?.length)return null;let s=new Map;t?.forEach(l=>s.set(l.dataKey,l));let a=n.map(l=>s.get(l.slug)??{dataKey:l.slug,value:void 0,stroke:l.color,color:l.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?gm(r,i):r}),a.map(l=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:l.stroke??l.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(l.dataKey)??l.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:l.value!=null?sa(l.value):"--"})]},l.dataKey))]})}function ym({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!n)return;function d(u){s.current&&!s.current.contains(u.target)&&i(false);}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let a=t.length>=rn,l=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(d=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(d)??"#6b7280",display:"inline-block"}},d))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let d=e.find(u=>u.slug===t[0]);return d?.outcomes?.[0]?.label??d?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[l,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",rn," markets"]}),e.map((d,u)=>{let p=t.includes(d.slug),m=!p&&a,c=p&&t.length===1,f=r.get(d.slug)??"#6b7280",g=d.outcomes.find(x=>x.label.toLowerCase()==="yes")??d.outcomes[0],v=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{c||m||o(d.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:p?"rgba(255,255,255,0.05)":"transparent",cursor:m||c?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!m&&!c&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=p?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:p?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:p?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:p&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:p?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.outcomes?.[0]?.label??d.question}),v&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},d.id??`${u}-${d.slug}`)})]})]})}function km({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(o=>{let n=t.get(o.marketSlug)??"#6b7280",i=r.get(o.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:o.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?sa(i):"--"})]})]},o.marketSlug)})})}function Sm(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function wm(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let i=Math.floor(n*o),s=Math.min(Math.floor((n+1)*o),e.length),a=e.slice(i,s),l=a.map(d=>d.price).sort((d,u)=>d-u);r.push({timestamp:a[a.length-1].timestamp,price:Sm(l)});}return r}function Pm(e,t=200){if(e.length===0)return [];let r=e.map(a=>({...a,data:wm(a.data,t)})),o=new Set;r.forEach(a=>a.data.forEach(l=>o.add(l.timestamp)));let n=Array.from(o).sort((a,l)=>a-l),i=r.map(a=>{let l=new Map;return a.data.forEach(d=>l.set(d.timestamp,d.price)),{slug:a.marketSlug,map:l}}),s=new Map;return n.map(a=>{let l={timestamp:a};return i.forEach(({slug:d,map:u})=>{let p=u.get(a);if(p!==void 0)s.set(d,p),l[d]=p;else {let m=s.get(d);m!==void 0&&(l[d]=m);}}),l})}function aa(e){return jsxRuntime.jsx(Ko,{children:jsxRuntime.jsx(Nm,{...e})})}function Nm({event:e,isLoading:t,className:r,volume:o,fillHeight:n=false}){let i=react.useMemo(()=>{let C=new Set;return (e.markets??[]).filter(E=>C.has(E.slug)?false:(C.add(E.slug),true))},[e.markets]),s=react.useMemo(()=>[...i].sort((C,E)=>{let U=Y=>(Y.outcomes.find(oe=>oe.label.toLowerCase()==="yes")??Y.outcomes[0])?.price??0;return U(E)-U(C)}),[i]),[a,l]=react.useState(()=>s.slice(0,rn).map(C=>C.slug));react.useEffect(()=>{let C=new Set(i.map(E=>E.slug));l(E=>{let U=E.filter(Y=>C.has(Y));return U.length===E.length?E:U.length>0?U:s.slice(0,rn).map(Y=>Y.slug)});},[i,s]);let[d,u]=react.useState(wn),p=react.useMemo(()=>{let C=new Map;return a.forEach((E,U)=>{C.set(E,oa[U%oa.length]);}),C},[a]),m=react.useMemo(()=>i.filter(C=>a.includes(C.slug)),[i,a]),{series:c,isLoading:f}=reactPredict.useMarketHistory(m,d),g=t||f,v=react.useMemo(()=>{if(c.length>0&&c.some(U=>U.data.length>0))return c;let C=Date.now(),E=864e5;return m.map(U=>{let oe=(U.outcomes?.find(S=>S.label.toLowerCase()==="yes")??U.outcomes?.[0])?.price??.5;return {marketSlug:U.slug,label:U.outcomes?.[0]?.label??U.question,data:[{timestamp:C-7*E,price:oe},{timestamp:C,price:oe}]}})},[c,m]),x=react.useMemo(()=>d===ae.ONE_DAY?96:d===ae.ONE_WEEK?168:d===ae.ONE_MONTH?180:300,[d]),b=react.useMemo(()=>Pm(v,x),[v,x]),P=react.useMemo(()=>{if(b.length===0)return [0,1];let C=1/0,E=-1/0;if(a.forEach(Y=>{b.forEach(oe=>{let S=oe[Y];S!=null&&(S<C&&(C=S),S>E&&(E=S));});}),!isFinite(C))return [0,1];let U=Math.max((E-C)*.15,.05);return [Math.max(0,C-U),Math.min(1,E+U)]},[b,a]),w=react.useMemo(()=>{let C=new Map;return v.forEach(E=>{E.data.length>0&&C.set(E.marketSlug,E.data[E.data.length-1].price);}),C},[v]),h=react.useMemo(()=>{let C=new Map;return v.forEach(E=>C.set(E.marketSlug,E.label)),C},[v]),y=react.useMemo(()=>v.map(C=>({slug:C.marketSlug,color:p.get(C.marketSlug)??"#6b7280"})),[v,p]),{wrapperRef:k,overlayRef:N,onMouseMove:F,onMouseLeave:O}=xm(),z=react.useCallback(C=>{l(E=>E.includes(C)?E.length<=1?E:E.filter(U=>U!==C):E.length>=rn?E:[...E,C]);},[]),[A,j]=react.useState(null),V=react.useRef(null),te=react.useRef(""),Q=react.useRef(0),J=!g&&b.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...n?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(km,{series:v,colorMap:p,displayValues:A??w}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...n?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:k,style:{width:"100%",userSelect:"none",position:"relative",...n?{flex:1,minHeight:240}:{height:300}},onMouseMove:J?C=>{F(C),cancelAnimationFrame(Q.current),Q.current=requestAnimationFrame(()=>{j(V.current);});}:void 0,onMouseLeave:J?()=>{O(),cancelAnimationFrame(Q.current),te.current="",V.current=null,j(null);}:void 0,children:g?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):b.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:N,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:b,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:C=>fm(C,d),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:P,tickFormatter:C=>`${Math.round(C*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:C=>{let E=C;if(E.active&&E.payload?.length){let U=E.payload.map(Y=>`${Y.dataKey}:${Y.value}`).join(",");if(U!==te.current){te.current=U;let Y=new Map;E.payload.forEach(oe=>{oe.value!=null&&Y.set(oe.dataKey,oe.value);}),V.current=Y;}}return jsxRuntime.jsx(bm,{...E,labelMap:h,allSeries:y,range:d})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),v.map(C=>{let E=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:C.marketSlug,stroke:E,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:E},connectNulls:true,isAnimationActive:false},C.marketSlug)}),A==null&&b.length>0&&v.map(C=>{let E=b[b.length-1],U=E[C.marketSlug];if(U==null)return null;let Y=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:U,ifOverflow:"extendDomain",shape:oe=>{let{cx:S,cy:we}=oe;return S==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:S,cy:we,r:6,fill:Y,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:S,cy:we,r:3.5,fill:Y})]})}},`pulse-${C.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[o!=null&&o>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:[utils$1.formatAmountInUsd(o)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(vm,{value:d,onChange:u}),s.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(ym,{markets:s,selectedSlugs:a,colorMap:p,onToggle:z})})]})]})]})}function Vn(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function ca(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function Wm(e){return `${parseFloat((e*100).toFixed(2))}%`}function da(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function jn(e){return e.outcomes?.[0]?.label??e.question}function Um(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function nn(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),o=t.getDate(),n=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${i}:${s}`}function ua(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let u=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(u)},[e]),!e||t===0)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let i=Math.floor(n/864e5),s=Math.floor(n%864e5/36e5),a=Math.floor(n%36e5/6e4),l=Math.floor(n%6e4/1e3),d=[];return i>0&&d.push(`${i}d`),d.push(`${String(s).padStart(2,"0")}h`),d.push(`${String(a).padStart(2,"0")}m`),d.push(`${String(l).padStart(2,"0")}s`),d.join(" ")}function pa(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),s=t.getFullYear(),a=-t.getTimezoneOffset(),l=a>=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}function ha({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let p=[...e.markets||[]],m=p.filter(f=>f.status==="open").sort((f,g)=>Vn(g)-Vn(f)),c=p.filter(f=>f.status!=="open").sort((f,g)=>Vn(g)-Vn(f));return [...m,...c]},[e.markets]),s=e.status==="closed"||e.status==="voided",a=ua(s?void 0:e.start_at),l=ua(s?void 0:e.end_at),d=pa(e.start_at),u=pa(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:o,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${n?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${n?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!n&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((p,m)=>jsxRuntime.jsxs(react.Fragment,{children:[m>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:p.label})]},p.slug)),jsxRuntime.jsx(jm,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${n?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(a||l||s)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:s?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:a})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:d})]})]}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:l})}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:u})]})]}):null}),jsxRuntime.jsx(aa,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx($m,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Vm,{markets:i,event:e})]})}var ma=5;function $m({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:o}=ui.useScreen(),[n,i]=react.useState(false),[s,a]=react.useState(null),l=react.useMemo(()=>{let v=new Set;return e.filter(x=>v.has(x.slug)?false:(v.add(x.slug),true))},[e]),d=l.find(v=>v.status==="open")?.slug,[u,p]=react.useState(d?`${d}:yes`:null);if(l.length===0)return null;let m=l.length>ma,c=n?l:l.slice(0,ma),f=v=>{a(x=>x===v?null:v);},g=(v,x,b)=>{p(`${v.slug}:${x}`),o&&a(v.slug),t?.(v,x,b);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:c.map((v,x)=>{let b=s===v.slug;return jsxRuntime.jsx(Km,{market:v,activeYes:u===`${v.slug}:yes`,activeNo:u===`${v.slug}:no`,isExpanded:b,onToggleExpand:()=>f(v.slug),onTradeAction:g},v.id??`${x}-${v.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(v=>!v),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(n?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",n&&"rotate-180")})]})]})}function Km({market:e,activeYes:t,activeNo:r,isExpanded:o,onToggleExpand:n,onTradeAction:i}){let{t:s}=i18n.useTranslation(),a=e.status==="open",l=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,{data:d}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:e.source,outcome:"yes"},{enabled:a}),{data:u}=reactPredict.useOrderbook({slug:e.slug,source:e.source,outcome:"no"},{enabled:false,refetchInterval:false}),p=reactPredict.pickBestAsk(d,"yes")??ca(e,"yes")??0,m=reactPredict.pickBestAsk(u,"no")??ca(e,"no");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:n,role:"button",tabIndex:0,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:jn(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:jn(e)}),l&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:l})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Wm(p)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:c=>{c.stopPropagation(),i?.(e,"yes","buy");},children:s("predict.market.action.yes",{price:da(p)})}),jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:c=>{c.stopPropagation(),i?.(e,"no","buy");},children:m!=null?s("predict.market.action.no",{price:da(m)}):s("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?s("predict.event.status.closed"):e.status==="voided"?s("predict.event.status.voided"):s("predict.event.status.pending")})})})]}),o&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(na,{market:e,outcome:r?"no":"yes",onTradeAction:i})})})})]})}function Vm({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[i,s]=react.useState(false),[a,l]=react.useState(0),d=e.filter(c=>c.rules&&c.rules.length>0||c.description);if(d.length===0)return null;let u=d[a]??d[0],p=u.rules&&u.rules.length>0?u.rules.join(`
77
77
 
78
- `):u.description??"";if(!p)return null;let m=p.length>200&&!o?p.slice(0,200)+"...":p;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),d.length>1&&jsxRuntime.jsxs(ui$1.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui$1.DropdownTrigger,{children:jsxRuntime.jsx(ui$1.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:Kn(u)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(a)],onAction:c=>{l(Number(c)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:d.map((c,f)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(f===a?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:Kn(c)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),p.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(c=>!c),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(o?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(c=>!c),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let c=u.status,f=[];return u.created_at&&f.push({label:r("predict.event.timeline.created"),value:tn(u.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:tn(u.start_at),isActive:c!=="pending"}),c==="voided"?f.push({label:r("predict.event.timeline.voided"),value:tn(u.closed_at??u.end_at),isActive:true}):c==="closed"?f.push({label:r("predict.event.timeline.closed"),value:tn(u.closed_at??u.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:tn(u.end_at),isActive:false}),f})().map((c,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${c.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:c.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:c.value})]})]},c.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:u.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Um(u.source)})]})]})]})]})}function jm({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function va({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Jr,{}):i||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(ha,{event:o,onTradeAction:r})}var Xm={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui$1.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},Jm={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function _t(e){return Xm[e]??Jm}function Vy({source:e,className:t}){let r=_t(e);return jsxRuntime.jsxs("span",{className:ui$1.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var ba="rgba(39,39,42,0.6)",sf="rgba(63,63,70,0.8)";function af(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function ka({eventSlug:e,source:t,limit:r=4,onEventClick:o,onEventHover:n}){let{t:i}=i18n.useTranslation(),{data:s,isLoading:a}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return a||!s||s.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:s.map(l=>jsxRuntime.jsx(lf,{event:l,onClick:o,onHover:n},`${l.source}-${l.slug}`))})]})}function lf({event:e,onClick:t,onHover:r}){let{t:o}=i18n.useTranslation(),n=_t(e.source),i=react.useMemo(()=>af(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:a=>{a.currentTarget.style.borderColor=sf,r?.(e);},onMouseLeave:a=>{a.currentTarget.style.borderColor=ba;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${ba}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:n.color,flexShrink:0},children:[n.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",o("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:s.label})]})]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function jn(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function h1({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onSimilarEventHover:i,onBack:s,renderActivitySection:a,onInsufficientBalance:l,onSetupRequired:d,slippageBps:u}){let{t:p}=i18n.useTranslation(),{isDesktop:m}=ui$1.useScreen(),{onOpen:c}=uiScaffold.useAsyncModal(Kr),{onOpen:f}=uiScaffold.useAsyncModal(Io),{data:g,isLoading:v}=reactPredict.useEvent({slug:e,source:t}),x=react.useMemo(()=>{let N=[...g?.markets||[]],A=N.filter(z=>z.status==="open").sort((z,F)=>jn(F)-jn(z)),D=N.filter(z=>z.status!=="open").sort((z,F)=>jn(F)-jn(z));return [...A,...D]},[g?.markets]),[b,w]=react.useState(null),P=react.useCallback((N,A,D)=>{w(z=>({market:N,outcome:A,side:D,version:(z?.version??0)+1})),!m&&g&&(D==="sell"?f({params:{event:g,market:N,initialOutcome:A,chain:r,slippageBps:u,onSetupRequired:d}}):c({params:{event:g,market:N,initialOutcome:A,chain:r,slippageBps:u,onInsufficientBalance:l}}));},[m,g,r,u,c,f,l,d]),h=b?.market??x[0];if(v){let N=!!s;return m?jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Jr,{showBack:N})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx(Ks,{})})})]}):jsxRuntime.jsx(Jr,{showBack:N})}let y=b?`${b.market.slug}-${b.version}`:h?.slug??"default",S=b?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui$1.Button,{as:"a",onPress:s,startContent:jsxRuntime.jsx(ui$1.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:p("common.back")})}),jsxRuntime.jsx(va,{eventSlug:e,source:t,onTradeAction:P})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[h&&(S?jsxRuntime.jsx(Fn,{event:g,market:h,initialOutcome:b?.outcome,chain:r,slippageBps:u,onSetupRequired:d},y):jsxRuntime.jsx(Tn,{event:g,market:h,initialOutcome:b?.outcome,chain:r,slippageBps:u,onInsufficientBalance:l},y)),g&&jsxRuntime.jsx(ka,{eventSlug:e,source:g.source,onEventClick:n,onEventHover:i})]})]}),g&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:a?a({event:g,walletAddress:o}):jsxRuntime.jsx(Ws,{event:g,walletAddress:o})}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Bs,{}),jsxRuntime.jsx(Ps,{})]})}function wa(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Sf(e){switch(e){case ae.ONE_DAY:return {interval:"15m",limit:96};case ae.ONE_WEEK:return {interval:"1h",limit:168};case ae.ONE_MONTH:return {interval:"4h",limit:180};case ae.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var w1=e=>{let{candlestickMarketSlugs:t,chartRange:r=kn,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>Sf(r),[r]),{data:s,isLoading:a,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:o}),d=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(b=>b.slug===x)).filter(x=>x!==void 0):[...g].sort((x,b)=>wa(b)-wa(x)).slice(0,4)).map(x=>x.slug)},[t,s?.markets]),u=reactQuery.useQueries({queries:d.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:d.length>0}))}),p=u.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return d.forEach((g,v)=>{let x=u[v]?.error;x&&f.set(g,x);}),f},[d,u]),c=react.useMemo(()=>{let f=new Map;return d.forEach((g,v)=>{let x=u[v]?.data;x&&f.set(g,x);}),f},[d,u]);return {event:s,isEventLoading:a,eventError:l,candlestickParams:i,candlesticks:c,isCandlesticksLoading:p,candlestickErrors:m}};function Go({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:o}=e,n=o.name||o.pseudonym||t,i=react.useMemo(()=>Cf(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(wf,{src:o.profile_image,name:n,className:ui$1.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(Pf,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function wf({src:e,name:t,className:r}){let o=t.trim().charAt(0).toUpperCase()||"?",n=react.useMemo(()=>Nf(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui$1.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui$1.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:n},"aria-hidden":true,children:o})}function Pf({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function Nf(e){let t=0;for(let o=0;o<e.length;o++)t=e.charCodeAt(o)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function Cf(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let o=Math.floor(r/60);if(o<60)return `${o}m`;let n=Math.floor(o/60);if(n<24)return `${n}h`;let i=Math.floor(n/24);if(i<7)return `${i}d`;let s=Math.floor(i/7);return s<5?`${s}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Af={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},Ca={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},Ff=["latest","oldest","mostLiked"],Bf=600,Hf=112;function zf({slug:e,source:t,limit:r=20,height:o,className:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState("latest"),[l,d]=react.useState(false),u=Af[s],{data:p,isLoading:m,isFetchingNextPage:c,hasNextPage:f,fetchNextPage:g}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:u.order,ascending:u.ascending,holders_only:l}),v=react.useMemo(()=>p?.pages?.flatMap(D=>D.items)??[],[p?.pages]),x=react.useRef(null),{height:b}=hooks.useResizeObserver({ref:x}),w=o??(b||Bf),P=reactWindow.useDynamicRowHeight({defaultRowHeight:Hf,key:`${e}:${t}:${s}:${l}`}),h=v.length,y=h+(f?1:0),S=react.useCallback(D=>D<h,[h]),N=react.useCallback(async()=>{f&&!c&&await g();},[f,c,g]),A=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:S,loadMoreRows:N,rowCount:y,threshold:5});return jsxRuntime.jsxs("div",{className:ui$1.cn("flex h-full w-full flex-col",n),children:[jsxRuntime.jsx(Uf,{sort:s,onSortChange:a,holdersOnly:l,onHoldersOnlyChange:d}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:x,children:m?jsxRuntime.jsx($f,{}):v.length===0?jsxRuntime.jsx(Kf,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:w},onRowsRendered:A,rowComponent:Wf,rowCount:y,rowHeight:P,rowProps:{comments:v,itemCount:h,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function Wf({index:e,style:t,comments:r,itemCount:o,anonymousLabel:n}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Go,{comment:i,anonymousLabel:n,isReply:!!i.parent_comment_id})}):null}function Uf({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(false),a=react.useRef(null);return react.useEffect(()=>{if(!i)return;let l=u=>{a.current&&!a.current.contains(u.target)&&s(false);},d=u=>{u.key==="Escape"&&s(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:a,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(Vf,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:n(Ca[e])}),jsxRuntime.jsx(jf,{className:ui$1.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:Ff.map(l=>{let d=l===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(l),s(false);},className:ui$1.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",d?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:n(Ca[l])}),d&&jsxRuntime.jsx(Ma,{className:"size-4 text-primary"})]},l)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>o(!r),className:ui$1.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui$1.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(Ma,{className:"size-3 text-background"})}),n("predict.comments.holdersOnly")]})]})}function $f(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function Kf({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function Vf({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function jf({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Ma({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var Yf=10,Qf=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Xn(){let[e,t]=jotai.useAtom(Qf),r=react.useCallback(n=>{let i=n.trim();i&&t(s=>{let a=s.filter(l=>l!==i);return [i,...a].slice(0,Yf)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function Ia({histories:e,onSelect:t,onClear:r,className:o}){let{t:n}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.cn("px-4 pb-4",o),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n("predict.search.history")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Oa({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Xn();return jsxRuntime.jsx(Ia,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:o})}function Da({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:s=>{s.preventDefault(),o?.();},children:"Esc"})})})}function hg(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function Aa({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:s}=i18n.useTranslation(),a=e.tags?.[0],l=_t(e.source),d=react.useMemo(()=>hg(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:u=>{t&&o&&u.preventDefault(),o?.(e);},onMouseEnter:()=>n?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color:l.color},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[d," ",s("predict.event.volume")]}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:a.label})]})]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Fa({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:i,hasNextPage:s,fetchNextPage:a}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>o?.pages.flatMap(d=>d.items).filter(d=>d!=null)??[],[o]),isLoading:n,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:a}}var Cg=64;function Wa({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:s,isLoading:a,isFetchingNextPage:l,hasNextPage:d,fetchNextPage:u}=Fa(i),p=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:p}),c=react.useCallback(x=>x<s.length,[s]),f=react.useCallback(async()=>{d&&!l&&await u();},[d,l,u]),g=react.useMemo(()=>d?s.length+1:s.length,[s,d]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:c,loadMoreRows:f,rowCount:g,threshold:5});return a?jsxRuntime.jsx(Eg,{className:n}):s.length===0?jsxRuntime.jsx(Tg,{className:n}):jsxRuntime.jsx("div",{className:ui$1.cn("w-full h-full flex flex-col",n),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:p,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:v,rowComponent:Mg,rowCount:g,rowHeight:Cg,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function Mg({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:i,onHover:s}){let a=r[e];return a?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Aa,{event:a,href:n?.(a),LinkComponent:i,onSelect:o,onHover:s})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function Eg({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function Tg({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Va({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Xn(),s=hooks.useCallbackRef(e),a=hooks.useCallbackRef(i),l=react.useMemo(()=>utils$1.debounce(m=>{n(m),s(m),m&&a(m);},500),[s,a]),d=react.useCallback(m=>{r(m),l(m);},[l]),u=react.useCallback(m=>{l.cancel(),r(m),n(m),s(m),m&&a(m);},[l,s,a]),p=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:d,setKeyword:u,clearKeyword:p}}function ja({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:s}){let{text:a,keyword:l,setText:d,setKeyword:u,clearKeyword:p}=Va({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Da,{value:a,onValueChange:d,onClear:p,onEscape:i}),!l&&jsxRuntime.jsx(Oa,{onSelect:u}),jsxRuntime.jsx(Wa,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:s})]})}var Zo="predict-search";function gk({id:e=Zo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Ug,{...t})})}function Ug({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),s=react.useCallback(l=>{o(l);},[o]),a=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(ja,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:a})})]})})}function Pk({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n}=ui$1.useScreen(),{onOpen:i,onClose:s}=uiScaffold.useAsyncModal(Zo),a=hooks.useCallbackRef(e),l=hooks.useCallbackRef(async()=>{let u=await i({params:t});u&&a(u);}),d=hooks.useCallbackRef(()=>{s();});return react.useEffect(()=>{let u=p=>{let m=document.activeElement,c=!!m&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.getAttribute("contenteditable")==="true");p.key==="/"&&!c&&(p.preventDefault(),l()),p.key==="Escape"&&(p.preventDefault(),d());};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[l,d]),n?jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui$1.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:o("predict.search.placeholder")}):jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:ui$1.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var ti=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],nl=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],el={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},tl={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Qg(e,t){if(!e)return "$5K+";let r=nl.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function ol({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:s}){let{t:a}=i18n.useTranslation(),[l,d]=react.useState(false),[u,p]=react.useState(false),[m,c]=react.useState(false),[f,g]=react.useState(false),v=react.useRef(null),x=react.useRef(null),b=ti.find(h=>h.value===e)??ti[0],w=react.useCallback(h=>{v.current&&!v.current.contains(h.target)&&d(false),x.current&&!x.current.contains(h.target)&&p(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)),[w]);let P=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
78
+ `):u.description??"";if(!p)return null;let m=p.length>200&&!o?p.slice(0,200)+"...":p;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),d.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:jn(u)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(a)],onAction:c=>{l(Number(c)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:d.map((c,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===a?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:jn(c)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),p.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(c=>!c),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(o?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(c=>!c),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let c=u.status,f=[];return u.created_at&&f.push({label:r("predict.event.timeline.created"),value:nn(u.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:nn(u.start_at),isActive:c!=="pending"}),c==="voided"?f.push({label:r("predict.event.timeline.voided"),value:nn(u.closed_at??u.end_at),isActive:true}):c==="closed"?f.push({label:r("predict.event.timeline.closed"),value:nn(u.closed_at??u.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:nn(u.end_at),isActive:false}),f})().map((c,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${c.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:c.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:c.value})]})]},c.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:u.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Um(u.source)})]})]})]})]})}function jm({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function va({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(en,{}):i||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(ha,{event:o,onTradeAction:r})}var Xm={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},Jm={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function It(e){return Xm[e]??Jm}function Vy({source:e,className:t}){let r=It(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var ba="rgba(39,39,42,0.6)",sf="rgba(63,63,70,0.8)";function af(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function ka({eventSlug:e,source:t,limit:r=4,onEventClick:o,onEventHover:n}){let{t:i}=i18n.useTranslation(),{data:s,isLoading:a}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return a||!s||s.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:s.map(l=>jsxRuntime.jsx(lf,{event:l,onClick:o,onHover:n},`${l.source}-${l.slug}`))})]})}function lf({event:e,onClick:t,onHover:r}){let{t:o}=i18n.useTranslation(),n=It(e.source),i=react.useMemo(()=>af(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:a=>{a.currentTarget.style.borderColor=sf,r?.(e);},onMouseLeave:a=>{a.currentTarget.style.borderColor=ba;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${ba}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:n.color,flexShrink:0},children:[n.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",o("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:s.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function Gn(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function h1({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onSimilarEventHover:i,onBack:s,renderActivitySection:a,onInsufficientBalance:l,onSetupRequired:d,slippageBps:u}){let{t:p}=i18n.useTranslation(),{isDesktop:m}=ui.useScreen(),{onOpen:c}=uiScaffold.useAsyncModal(jr),{onOpen:f}=uiScaffold.useAsyncModal(Io),{data:g,isLoading:v}=reactPredict.useEvent({slug:e,source:t}),x=react.useMemo(()=>{let N=[...g?.markets||[]],F=N.filter(z=>z.status==="open").sort((z,A)=>Gn(A)-Gn(z)),O=N.filter(z=>z.status!=="open").sort((z,A)=>Gn(A)-Gn(z));return [...F,...O]},[g?.markets]),[b,P]=react.useState(null),w=react.useCallback((N,F,O)=>{P(z=>({market:N,outcome:F,side:O,version:(z?.version??0)+1})),!m&&g&&(O==="sell"?f({params:{event:g,market:N,initialOutcome:F,chain:r,slippageBps:u,onSetupRequired:d}}):c({params:{event:g,market:N,initialOutcome:F,chain:r,slippageBps:u,onInsufficientBalance:l}}));},[m,g,r,u,c,f,l,d]),h=b?.market??x[0];if(v){let N=!!s;return m?jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(en,{showBack:N})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx($s,{})})})]}):jsxRuntime.jsx(en,{showBack:N})}let y=b?`${b.market.slug}-${b.version}`:h?.slug??"default",k=b?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:s,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:p("common.back")})}),jsxRuntime.jsx(va,{eventSlug:e,source:t,onTradeAction:w})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[h&&(k?jsxRuntime.jsx(Hn,{event:g,market:h,initialOutcome:b?.outcome,chain:r,slippageBps:u,onSetupRequired:d},y):jsxRuntime.jsx(Rn,{event:g,market:h,initialOutcome:b?.outcome,chain:r,slippageBps:u,onInsufficientBalance:l},y)),g&&jsxRuntime.jsx(ka,{eventSlug:e,source:g.source,onEventClick:n,onEventHover:i})]})]}),g&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:a?a({event:g,walletAddress:o}):jsxRuntime.jsx(zs,{event:g,walletAddress:o})}),jsxRuntime.jsx(_n,{}),jsxRuntime.jsx(Fs,{}),jsxRuntime.jsx(ws,{})]})}function wa(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Sf(e){switch(e){case ae.ONE_DAY:return {interval:"15m",limit:96};case ae.ONE_WEEK:return {interval:"1h",limit:168};case ae.ONE_MONTH:return {interval:"4h",limit:180};case ae.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var w1=e=>{let{candlestickMarketSlugs:t,chartRange:r=wn,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>Sf(r),[r]),{data:s,isLoading:a,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:o}),d=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(b=>b.slug===x)).filter(x=>x!==void 0):[...g].sort((x,b)=>wa(b)-wa(x)).slice(0,4)).map(x=>x.slug)},[t,s?.markets]),u=reactQuery.useQueries({queries:d.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:d.length>0}))}),p=u.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return d.forEach((g,v)=>{let x=u[v]?.error;x&&f.set(g,x);}),f},[d,u]),c=react.useMemo(()=>{let f=new Map;return d.forEach((g,v)=>{let x=u[v]?.data;x&&f.set(g,x);}),f},[d,u]);return {event:s,isEventLoading:a,eventError:l,candlestickParams:i,candlesticks:c,isCandlesticksLoading:p,candlestickErrors:m}};function qo({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:o}=e,n=o.name||o.pseudonym||t,i=react.useMemo(()=>Cf(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(wf,{src:o.profile_image,name:n,className:ui.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(Pf,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function wf({src:e,name:t,className:r}){let o=t.trim().charAt(0).toUpperCase()||"?",n=react.useMemo(()=>Nf(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:n},"aria-hidden":true,children:o})}function Pf({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function Nf(e){let t=0;for(let o=0;o<e.length;o++)t=e.charCodeAt(o)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function Cf(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let o=Math.floor(r/60);if(o<60)return `${o}m`;let n=Math.floor(o/60);if(n<24)return `${n}h`;let i=Math.floor(n/24);if(i<7)return `${i}d`;let s=Math.floor(i/7);return s<5?`${s}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Df={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},Ca={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},Ff=["latest","oldest","mostLiked"],Bf=600,Hf=112;function zf({slug:e,source:t,limit:r=20,height:o,className:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState("latest"),[l,d]=react.useState(false),u=Df[s],{data:p,isLoading:m,isFetchingNextPage:c,hasNextPage:f,fetchNextPage:g}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:u.order,ascending:u.ascending,holders_only:l}),v=react.useMemo(()=>p?.pages?.flatMap(O=>O.items)??[],[p?.pages]),x=react.useRef(null),{height:b}=hooks.useResizeObserver({ref:x}),P=o??(b||Bf),w=reactWindow.useDynamicRowHeight({defaultRowHeight:Hf,key:`${e}:${t}:${s}:${l}`}),h=v.length,y=h+(f?1:0),k=react.useCallback(O=>O<h,[h]),N=react.useCallback(async()=>{f&&!c&&await g();},[f,c,g]),F=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:k,loadMoreRows:N,rowCount:y,threshold:5});return jsxRuntime.jsxs("div",{className:ui.cn("flex h-full w-full flex-col",n),children:[jsxRuntime.jsx(Uf,{sort:s,onSortChange:a,holdersOnly:l,onHoldersOnlyChange:d}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:x,children:m?jsxRuntime.jsx($f,{}):v.length===0?jsxRuntime.jsx(Kf,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:P},onRowsRendered:F,rowComponent:Wf,rowCount:y,rowHeight:w,rowProps:{comments:v,itemCount:h,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function Wf({index:e,style:t,comments:r,itemCount:o,anonymousLabel:n}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(qo,{comment:i,anonymousLabel:n,isReply:!!i.parent_comment_id})}):null}function Uf({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(false),a=react.useRef(null);return react.useEffect(()=>{if(!i)return;let l=u=>{a.current&&!a.current.contains(u.target)&&s(false);},d=u=>{u.key==="Escape"&&s(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",d);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:a,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(Vf,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:n(Ca[e])}),jsxRuntime.jsx(jf,{className:ui.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:Ff.map(l=>{let d=l===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(l),s(false);},className:ui.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",d?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:n(Ca[l])}),d&&jsxRuntime.jsx(Ma,{className:"size-4 text-primary"})]},l)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>o(!r),className:ui.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(Ma,{className:"size-3 text-background"})}),n("predict.comments.holdersOnly")]})]})}function $f(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function Kf({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function Vf({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function jf({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Ma({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var Yf=10,Qf=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Zn(){let[e,t]=jotai.useAtom(Qf),r=react.useCallback(n=>{let i=n.trim();i&&t(s=>{let a=s.filter(l=>l!==i);return [i,...a].slice(0,Yf)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function Ia({histories:e,onSelect:t,onClear:r,className:o}){let{t:n}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",o),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Oa({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Zn();return jsxRuntime.jsx(Ia,{className:ui.cn(t),histories:r,onSelect:e,onClear:o})}function Aa({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:s=>{s.preventDefault(),o?.();},children:"Esc"})})})}function hg(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function Da({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:s}=i18n.useTranslation(),a=e.tags?.[0],l=It(e.source),d=react.useMemo(()=>hg(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:u=>{t&&o&&u.preventDefault(),o?.(e);},onMouseEnter:()=>n?.(e),children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color:l.color},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[d," ",s("predict.event.volume")]}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:a.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Fa({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:i,hasNextPage:s,fetchNextPage:a}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>o?.pages.flatMap(d=>d.items).filter(d=>d!=null)??[],[o]),isLoading:n,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:a}}var Cg=64;function Wa({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:s,isLoading:a,isFetchingNextPage:l,hasNextPage:d,fetchNextPage:u}=Fa(i),p=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:p}),c=react.useCallback(x=>x<s.length,[s]),f=react.useCallback(async()=>{d&&!l&&await u();},[d,l,u]),g=react.useMemo(()=>d?s.length+1:s.length,[s,d]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:c,loadMoreRows:f,rowCount:g,threshold:5});return a?jsxRuntime.jsx(Eg,{className:n}):s.length===0?jsxRuntime.jsx(Tg,{className:n}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",n),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:p,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:v,rowComponent:Mg,rowCount:g,rowHeight:Cg,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function Mg({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:i,onHover:s}){let a=r[e];return a?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Da,{event:a,href:n?.(a),LinkComponent:i,onSelect:o,onHover:s})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function Eg({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function Tg({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Va({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Zn(),s=hooks.useCallbackRef(e),a=hooks.useCallbackRef(i),l=react.useMemo(()=>utils$1.debounce(m=>{n(m),s(m),m&&a(m);},500),[s,a]),d=react.useCallback(m=>{r(m),l(m);},[l]),u=react.useCallback(m=>{l.cancel(),r(m),n(m),s(m),m&&a(m);},[l,s,a]),p=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:d,setKeyword:u,clearKeyword:p}}function ja({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:s}){let{text:a,keyword:l,setText:d,setKeyword:u,clearKeyword:p}=Va({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Aa,{value:a,onValueChange:d,onClear:p,onEscape:i}),!l&&jsxRuntime.jsx(Oa,{onSelect:u}),jsxRuntime.jsx(Wa,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:s})]})}var Jo="predict-search";function gk({id:e=Jo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Ug,{...t})})}function Ug({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),s=react.useCallback(l=>{o(l);},[o]),a=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui.ModalBody,{className:"p-4",children:jsxRuntime.jsx(ja,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:a})})]})})}function Pk({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n}=ui.useScreen(),{onOpen:i,onClose:s}=uiScaffold.useAsyncModal(Jo),a=hooks.useCallbackRef(e),l=hooks.useCallbackRef(async()=>{let u=await i({params:t});u&&a(u);}),d=hooks.useCallbackRef(()=>{s();});return react.useEffect(()=>{let u=p=>{let m=document.activeElement,c=!!m&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.getAttribute("contenteditable")==="true");p.key==="/"&&!c&&(p.preventDefault(),l()),p.key==="Escape"&&(p.preventDefault(),d());};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[l,d]),n?jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsxRuntime.jsx(ui.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:o("predict.search.placeholder")}):jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:ui.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var ei=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],nl=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],el={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},tl={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Qg(e,t){if(!e)return "$5K+";let r=nl.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function ol({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:s}){let{t:a}=i18n.useTranslation(),[l,d]=react.useState(false),[u,p]=react.useState(false),[m,c]=react.useState(false),[f,g]=react.useState(false),v=react.useRef(null),x=react.useRef(null),b=ei.find(h=>h.value===e)??ei[0],P=react.useCallback(h=>{v.current&&!v.current.contains(h.target)&&d(false),x.current&&!x.current.contains(h.target)&&p(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)),[P]);let w=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
79
79
  @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
80
80
  .match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
81
81
  .match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
82
- `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:el,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(h=>!h),p(false);},children:[jsxRuntime.jsx(Xg,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(b.labelKey)}),jsxRuntime.jsx(rl,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...tl,width:224,padding:4},children:ti.map(h=>{let y=e===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:S=>{y||(S.currentTarget.style.background="rgba(39,39,42,0.5)",S.currentTarget.style.color="#fff");},onMouseLeave:S=>{y||(S.currentTarget.style.background="transparent",S.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===h.value?o(!r):t(h.value),d(false);},children:[jsxRuntime.jsx("div",{style:{color:y?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Jg,{type:h.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:a(h.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:a(h.descKey)})]}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:el,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{p(h=>!h),d(false);},children:[jsxRuntime.jsx(Zg,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Qg(n,a)}),jsxRuntime.jsx(e0,{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false)}),jsxRuntime.jsx(rl,{open:u})]}),m&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),a("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:a("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:a("predict.matches.filter.tooltipNote")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{...tl,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:a("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:nl.map(h=>{let y=h.value===0?!n:n===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:S=>{y||(S.currentTarget.style.background="rgba(39,39,42,0.5)",S.currentTarget.style.color="#fff");},onMouseLeave:S=>{y||(S.currentTarget.style.background="transparent",S.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(h.value===0?void 0:h.value),p(false);},children:[jsxRuntime.jsx("span",{children:h.labelKey?a(h.labelKey):h.label}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)",h.currentTarget.style.color="#fff";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)",h.currentTarget.style.color="#a1a1aa";},onClick:P,children:jsxRuntime.jsxs("svg",{className:f?"match-refresh-spin":void 0,viewBox:"0 0 24 24",style:{width:16,height:16},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})})]})]})}function Xg(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Jg({type:e}){let t={width:16,height:16},r={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="trending-up"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M16 7h6v6"}),jsxRuntime.jsx("path",{d:"m22 7-8.5 8.5-5-5L2 17"})]}):e==="chart-column"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}):jsxRuntime.jsx("svg",{...r,style:t,children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})})}function Zg(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function e0({onMouseEnter:e,onMouseLeave:t}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"hidden sm:block",style:{width:12,height:12,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onMouseEnter:e,onMouseLeave:t,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 16v-4"}),jsxRuntime.jsx("path",{d:"M12 8h.01"})]})}function rl({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function o0(e){return utils$1.formatAmountInUsd(e)}var i0=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>utils$1.formatAmount(e),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:o0,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function sl({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
82
+ `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:el,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(h=>!h),p(false);},children:[jsxRuntime.jsx(Xg,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(b.labelKey)}),jsxRuntime.jsx(rl,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...tl,width:224,padding:4},children:ei.map(h=>{let y=e===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:k=>{y||(k.currentTarget.style.background="rgba(39,39,42,0.5)",k.currentTarget.style.color="#fff");},onMouseLeave:k=>{y||(k.currentTarget.style.background="transparent",k.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===h.value?o(!r):t(h.value),d(false);},children:[jsxRuntime.jsx("div",{style:{color:y?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Jg,{type:h.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:a(h.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:a(h.descKey)})]}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:el,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{p(h=>!h),d(false);},children:[jsxRuntime.jsx(Zg,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Qg(n,a)}),jsxRuntime.jsx(e0,{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false)}),jsxRuntime.jsx(rl,{open:u})]}),m&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),a("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:a("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:a("predict.matches.filter.tooltipNote")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{...tl,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:a("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:nl.map(h=>{let y=h.value===0?!n:n===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:k=>{y||(k.currentTarget.style.background="rgba(39,39,42,0.5)",k.currentTarget.style.color="#fff");},onMouseLeave:k=>{y||(k.currentTarget.style.background="transparent",k.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(h.value===0?void 0:h.value),p(false);},children:[jsxRuntime.jsx("span",{children:h.labelKey?a(h.labelKey):h.label}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)",h.currentTarget.style.color="#fff";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)",h.currentTarget.style.color="#a1a1aa";},onClick:w,children:jsxRuntime.jsxs("svg",{className:f?"match-refresh-spin":void 0,viewBox:"0 0 24 24",style:{width:16,height:16},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})})]})]})}function Xg(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Jg({type:e}){let t={width:16,height:16},r={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="trending-up"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M16 7h6v6"}),jsxRuntime.jsx("path",{d:"m22 7-8.5 8.5-5-5L2 17"})]}):e==="chart-column"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}):jsxRuntime.jsx("svg",{...r,style:t,children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})})}function Zg(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function e0({onMouseEnter:e,onMouseLeave:t}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"hidden sm:block",style:{width:12,height:12,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onMouseEnter:e,onMouseLeave:t,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 16v-4"}),jsxRuntime.jsx("path",{d:"M12 8h.01"})]})}function rl({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function o0(e){return utils$1.formatAmountInUsd(e)}var i0=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>utils$1.formatAmount(e),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:o0,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function sl({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
83
83
  @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
84
84
  @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
85
85
  @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@@ -117,21 +117,21 @@
117
117
  .matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
118
118
  @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
119
119
  `}),jsxRuntime.jsxs("div",{className:"matches-hero-outer",style:{display:"flex",marginBottom:0},children:[jsxRuntime.jsxs("div",{className:"matches-hero-left",style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,animation:"matchHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"matches-hero-live",style:{display:"flex",marginBottom:16},children:jsxRuntime.jsxs("div",{className:"inline-flex items-center",style:{gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",width:8,height:8},children:[jsxRuntime.jsx("span",{style:{position:"absolute",display:"inline-flex",width:"100%",height:"100%",borderRadius:9999,background:"#00d492",opacity:.75,animation:"match-live-ping 1.2s cubic-bezier(0,0,0.2,1) infinite"}}),jsxRuntime.jsx("span",{style:{position:"relative",display:"inline-flex",width:8,height:8,borderRadius:9999,background:"#00bc7d",animation:"match-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.matches.liveBadge")}),jsxRuntime.jsx("span",{style:{borderRadius:4,background:"rgba(199,255,46,0.12)",padding:"2px 6px",fontSize:10,fontWeight:600,color:"#c7ff2e",textTransform:"uppercase",border:"1px solid rgba(199,255,46,0.22)"},children:t("predict.matches.betaTag")})]})}),jsxRuntime.jsxs("h1",{className:"matches-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontSize:46,fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.matches.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.matches.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"matches-hero-subtitle matches-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.matches.heroSubtitle")).split(`
120
- `).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:i0.map((r,o)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:o%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:o<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${o*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+o*80}ms`}})})]},r.key))})]})]})}function ri(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function l0(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var dl={wide:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},moderate:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},narrow:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},c0={wide:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},moderate:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},narrow:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},al={liquid_gap:{dot:"#17c964",label:"predict.matches.signalLiquidGap"},active_gap:{dot:"#c7ff2e",label:"predict.matches.signalActiveGap"},stale_gap:{dot:"#f5a524",label:"predict.matches.signalStaleGap"},stale_data:{dot:"#71717a",label:"predict.matches.signalStaleData"}};function d0(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var u0={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},p0={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},m0={text:"#9ca3af",icon:"#9ca3af"};function f0(e){return p0[e]??m0}var g0=`
120
+ `).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:i0.map((r,o)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:o%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:o<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${o*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+o*80}ms`}})})]},r.key))})]})]})}function ti(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function l0(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var dl={wide:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},moderate:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},narrow:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},c0={wide:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},moderate:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},narrow:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},al={liquid_gap:{dot:"#17c964",label:"predict.matches.signalLiquidGap"},active_gap:{dot:"#c7ff2e",label:"predict.matches.signalActiveGap"},stale_gap:{dot:"#f5a524",label:"predict.matches.signalStaleGap"},stale_data:{dot:"#71717a",label:"predict.matches.signalStaleData"}};function d0(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var u0={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},p0={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},m0={text:"#9ca3af",icon:"#9ca3af"};function f0(e){return p0[e]??m0}var g0=`
121
121
  .match-card button:focus-visible,
122
122
  .match-card a:focus-visible,
123
123
  .match-card [role="button"]:focus-visible {
124
124
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
125
125
  outline-offset: 2px;
126
126
  }
127
- `;function h0({tier:e}){let t=dl[e],r=e==="wide"?5:e==="moderate"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(o,n)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:n<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},n))})}function v0(e){if(Array.isArray(e.legs)&&e.legs.length===2)return [e.legs[0],e.legs[1]];let t=(r,o,n)=>({source:r,event_title:o,event_slug:n?.event_slug??"",market_id:n?.id??0,market_slug:n?.slug??"",question:n?.question??"",status:n?.status??"open",outcomes:n?.outcomes,best_price:n?.outcomes?.[0]?.best_ask??n?.outcomes?.[0]?.price??void 0,vol_24h_usd:n?.volume_24h??void 0});return !e.market_a||!e.market_b?null:[t(e.source_a,e.event_a_title??"",e.market_a),t(e.source_b,e.event_b_title??"",e.market_b)]}function ul({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:o,getLegHref:n,onHover:i,getMarketHref:s,LinkComponent:a}){let{t:l}=i18n.useTranslation(),d=v0(e);if(!d)return null;let[u,p]=d,m=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=l0(m),f=dl[c],g=u.best_price!=null&&p.best_price!=null?u.best_price<=p.best_price?u.source:p.source:null,v=u.event_title||p.event_title,x=e.signal_tag??"stale_data",b=al[x]??al.stale_data,w=r?.(e),P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:g0}),m!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${f.bandFrom}, ${f.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:f.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:f.color},children:[m.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:l("predict.matches.gap")})]}),jsxRuntime.jsx(h0,{tier:c})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:v}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(ll,{leg:u,isCheaper:g===u.source,externalUrlFallback:s?.(e,u.source),internalHref:n?.(e,u),onSelect:o?()=>o(e,u):void 0,LinkComponent:a}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(ll,{leg:p,isCheaper:g===p.source,externalUrlFallback:s?.(e,p.source),internalHref:n?.(e,p),onSelect:o?()=>o(e,p):void 0,LinkComponent:a})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),ri(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),ri(e.combined_volume_24h)," ",l("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:l("predict.matches.updatedAgo",{seconds:e.age_seconds}),style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),x0(l,e.age_seconds)]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:b.dot,flexShrink:0}}),l(b.label)]})]})]}),h={display:"block",color:"inherit",textDecoration:"none",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:w||t?"pointer":void 0},y=N=>{let A=N.currentTarget,D=c0[c];A.style.borderColor=D.border,A.style.boxShadow=D.shadow,i?.(e);},S=N=>{let A=N.currentTarget;A.style.borderColor="rgba(39,39,42,0.6)",A.style.boxShadow="none";};return w&&a?jsxRuntime.jsx(a,{href:w,className:"group match-card",children:jsxRuntime.jsx("div",{style:h,onMouseEnter:y,onMouseLeave:S,onClick:()=>t?.(e),children:P})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:h,onMouseEnter:y,onMouseLeave:S,onClick:()=>t?.(e),onKeyDown:N=>{t&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),t(e));},children:P})}function x0(e,t){if(t<60)return e("predict.matches.ageJustNow");if(t<3600){let o=Math.floor(t/60);return e("predict.matches.ageMinutes",{count:o})}let r=Math.floor(t/3600);return e("predict.matches.ageHours",{count:r})}function ll({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:o,onSelect:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),a=_t(e.source),l=f0(e.source),d=e.best_price,u=e.outcomes?.[0]?.label??null,p=e.external_url??r,m=d0(e.age_seconds),c=x=>{x.stopPropagation();},f=!!(o||n),g={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:f?"pointer":void 0,color:"inherit",textDecoration:"none"},v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:100,flexShrink:0},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:l.text,textTransform:"uppercase"},children:a.label}),m&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?s("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:u0[m],flexShrink:0}})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[u&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[ri(e.vol_24h_usd)," ",s("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?"#c7ff2e":"#f4f4f5"},children:d!=null?(d*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),p?jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer","aria-label":s("predict.matches.viewOn",{platform:a.label}),title:s("predict.matches.viewOn",{platform:a.label}),onClick:x=>x.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:x=>{x.currentTarget.style.color="#d4d4d8",x.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:x=>{x.currentTarget.style.color="#71717a",x.currentTarget.style.background="transparent";},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})}):jsxRuntime.jsx("span",{style:{width:18,flexShrink:0}})]});return o&&i?jsxRuntime.jsx(i,{href:o,className:"match-card-leg-link",onClick:x=>{c(x),n?.();},children:jsxRuntime.jsx("div",{style:g,children:v})}):f?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:g,onClick:x=>{c(x),n?.();},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c(x),n?.());},children:v}):jsxRuntime.jsx("div",{style:g,children:v})}var hl=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,signal:n,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onSelect:d,onHover:u,getMarketHref:p,LinkComponent:m,onStatsChange:c},f){let{t:g}=i18n.useTranslation(),{data:v,hasNextPage:x,fetchNextPage:b,isFetchingNextPage:w,isLoading:P,isPlaceholderData:h,refetch:y}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,signal:n,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[S,N]=react.useState(0),[A,D]=react.useState(false);A&&!h?(D(false),N(Z=>Z+1)):h&&!A&&D(true),react.useImperativeHandle(f,()=>({refetch:()=>{y();}}),[y]);let z=react.useMemo(()=>v?.pages.flatMap(Z=>Z.items??[])??[],[v]),F=v?.pages[0]?.total,q=react.useMemo(()=>{let Z=0,C=0,E=0;for(let U of z){let G=U.spread??0;G>Z&&(Z=G),G>=.03&&E++,U.combined_volume!=null&&(C+=U.combined_volume);}return {activePairs:F??z.length,maxSpread:Z,highSpreadCount:E,totalVolume:C}},[z,F]);react.useEffect(()=>{q.activePairs>0&&c?.(q);},[q,c]);let $=react.useRef(null),Q=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let Z=$.current;if(!Z)return;let C=new IntersectionObserver(E=>{E[0]?.isIntersecting&&x&&!w&&b();},{rootMargin:"200px"});return C.observe(Z),()=>C.disconnect()},[x,w,b]),react.useEffect(()=>{if(x)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[x]),P)return jsxRuntime.jsx(C0,{});if(z.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:g("predict.matches.empty")})});let re=!x&&z.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
127
+ `;function h0({tier:e}){let t=dl[e],r=e==="wide"?5:e==="moderate"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(o,n)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:n<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},n))})}function v0(e){if(Array.isArray(e.legs)&&e.legs.length===2)return [e.legs[0],e.legs[1]];let t=(r,o,n)=>({source:r,event_title:o,event_slug:n?.event_slug??"",market_id:n?.id??0,market_slug:n?.slug??"",question:n?.question??"",status:n?.status??"open",outcomes:n?.outcomes,best_price:n?.outcomes?.[0]?.best_ask??n?.outcomes?.[0]?.price??void 0,vol_24h_usd:n?.volume_24h??void 0});return !e.market_a||!e.market_b?null:[t(e.source_a,e.event_a_title??"",e.market_a),t(e.source_b,e.event_b_title??"",e.market_b)]}function ul({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:o,getLegHref:n,onHover:i,getMarketHref:s,LinkComponent:a}){let{t:l}=i18n.useTranslation(),d=v0(e);if(!d)return null;let[u,p]=d,m=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=l0(m),f=dl[c],g=u.best_price!=null&&p.best_price!=null?u.best_price<=p.best_price?u.source:p.source:null,v=u.event_title||p.event_title,x=e.signal_tag??"stale_data",b=al[x]??al.stale_data,P=r?.(e),w=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:g0}),m!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${f.bandFrom}, ${f.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:f.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:f.color},children:[m.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:l("predict.matches.gap")})]}),jsxRuntime.jsx(h0,{tier:c})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:v}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(ll,{leg:u,isCheaper:g===u.source,externalUrlFallback:s?.(e,u.source),internalHref:n?.(e,u),onSelect:o?()=>o(e,u):void 0,LinkComponent:a}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(ll,{leg:p,isCheaper:g===p.source,externalUrlFallback:s?.(e,p.source),internalHref:n?.(e,p),onSelect:o?()=>o(e,p):void 0,LinkComponent:a})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),ti(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),ti(e.combined_volume_24h)," ",l("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:l("predict.matches.updatedAgo",{seconds:e.age_seconds}),style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),x0(l,e.age_seconds)]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:b.dot,flexShrink:0}}),l(b.label)]})]})]}),h={display:"block",color:"inherit",textDecoration:"none",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:P||t?"pointer":void 0},y=N=>{let F=N.currentTarget,O=c0[c];F.style.borderColor=O.border,F.style.boxShadow=O.shadow,i?.(e);},k=N=>{let F=N.currentTarget;F.style.borderColor="rgba(39,39,42,0.6)",F.style.boxShadow="none";};return P&&a?jsxRuntime.jsx(a,{href:P,className:"group match-card",children:jsxRuntime.jsx("div",{style:h,onMouseEnter:y,onMouseLeave:k,onClick:()=>t?.(e),children:w})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:h,onMouseEnter:y,onMouseLeave:k,onClick:()=>t?.(e),onKeyDown:N=>{t&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),t(e));},children:w})}function x0(e,t){if(t<60)return e("predict.matches.ageJustNow");if(t<3600){let o=Math.floor(t/60);return e("predict.matches.ageMinutes",{count:o})}let r=Math.floor(t/3600);return e("predict.matches.ageHours",{count:r})}function ll({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:o,onSelect:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),a=It(e.source),l=f0(e.source),d=e.best_price,u=e.outcomes?.[0]?.label??null,p=e.external_url??r,m=d0(e.age_seconds),c=x=>{x.stopPropagation();},f=!!(o||n),g={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:f?"pointer":void 0,color:"inherit",textDecoration:"none"},v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:100,flexShrink:0},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:l.text,textTransform:"uppercase"},children:a.label}),m&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?s("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:u0[m],flexShrink:0}})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[u&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[ti(e.vol_24h_usd)," ",s("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?"#c7ff2e":"#f4f4f5"},children:d!=null?(d*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),p?jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer","aria-label":s("predict.matches.viewOn",{platform:a.label}),title:s("predict.matches.viewOn",{platform:a.label}),onClick:x=>x.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:x=>{x.currentTarget.style.color="#d4d4d8",x.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:x=>{x.currentTarget.style.color="#71717a",x.currentTarget.style.background="transparent";},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})}):jsxRuntime.jsx("span",{style:{width:18,flexShrink:0}})]});return o&&i?jsxRuntime.jsx(i,{href:o,className:"match-card-leg-link",onClick:x=>{c(x),n?.();},children:jsxRuntime.jsx("div",{style:g,children:v})}):f?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:g,onClick:x=>{c(x),n?.();},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c(x),n?.());},children:v}):jsxRuntime.jsx("div",{style:g,children:v})}var hl=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,signal:n,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onSelect:d,onHover:u,getMarketHref:p,LinkComponent:m,onStatsChange:c},f){let{t:g}=i18n.useTranslation(),{data:v,hasNextPage:x,fetchNextPage:b,isFetchingNextPage:P,isLoading:w,isPlaceholderData:h,refetch:y}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,signal:n,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[k,N]=react.useState(0),[F,O]=react.useState(false);F&&!h?(O(false),N(J=>J+1)):h&&!F&&O(true),react.useImperativeHandle(f,()=>({refetch:()=>{y();}}),[y]);let z=react.useMemo(()=>v?.pages.flatMap(J=>J.items??[])??[],[v]),A=v?.pages[0]?.total,j=react.useMemo(()=>{let J=0,C=0,E=0;for(let U of z){let Y=U.spread??0;Y>J&&(J=Y),Y>=.03&&E++,U.combined_volume!=null&&(C+=U.combined_volume);}return {activePairs:A??z.length,maxSpread:J,highSpreadCount:E,totalVolume:C}},[z,A]);react.useEffect(()=>{j.activePairs>0&&c?.(j);},[j,c]);let V=react.useRef(null),te=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let J=V.current;if(!J)return;let C=new IntersectionObserver(E=>{E[0]?.isIntersecting&&x&&!P&&b();},{rootMargin:"200px"});return C.observe(J),()=>C.disconnect()},[x,P,b]),react.useEffect(()=>{if(x)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[x]),w)return jsxRuntime.jsx(C0,{});if(z.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:g("predict.matches.empty")})});let Q=!x&&z.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
128
128
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
129
129
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
130
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:v?.pages.map(Z=>Z.items?.map((C,E)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${E*35}ms both`},children:jsxRuntime.jsx(ul,{match:C,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onHover:u,onSelect:d,getMarketHref:p,LinkComponent:m})},`${S}-${C.match_id}-${C.source_a}-${C.market_a?.slug??E}`)))}),jsxRuntime.jsxs("div",{ref:$,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),w&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),g("predict.matches.loadMore")]})]}),re&&jsxRuntime.jsx(N0,{onScrollToTop:Q})]})});function N0({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function C0(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(M0,{index:t},t))})]})}function M0({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var I0={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function O0(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function D0({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:utils$1.formatAmount(e.activePairs)})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(O0,{})]})]})]})]})}function uS({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:o,onHover:n,onSelect:i,getMarketHref:s,LinkComponent:a,bgImageSrc:l}){let{t:d}=i18n.useTranslation(),[u,p]=react.useState("spread"),[m,c]=react.useState(false),[f,g]=react.useState(void 0),[v,x]=react.useState(),b=react.useRef(null),w=react.useCallback(S=>{p(S);},[]),P=react.useCallback(S=>{c(S);},[]),h=react.useCallback(S=>{react.startTransition(()=>{x(S);});},[]),y=react.useCallback(()=>{b.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
130
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:v?.pages.map(J=>J.items?.map((C,E)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${E*35}ms both`},children:jsxRuntime.jsx(ul,{match:C,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onHover:u,onSelect:d,getMarketHref:p,LinkComponent:m})},`${k}-${C.match_id}-${C.source_a}-${C.market_a?.slug??E}`)))}),jsxRuntime.jsxs("div",{ref:V,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),P&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),g("predict.matches.loadMore")]})]}),Q&&jsxRuntime.jsx(N0,{onScrollToTop:te})]})});function N0({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function C0(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(M0,{index:t},t))})]})}function M0({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var I0={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function O0(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function A0({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:utils$1.formatAmount(e.activePairs)})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(O0,{})]})]})]})]})}function uS({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:o,onHover:n,onSelect:i,getMarketHref:s,LinkComponent:a,bgImageSrc:l}){let{t:d}=i18n.useTranslation(),[u,p]=react.useState("spread"),[m,c]=react.useState(false),[f,g]=react.useState(void 0),[v,x]=react.useState(),b=react.useRef(null),P=react.useCallback(k=>{p(k);},[]),w=react.useCallback(k=>{c(k);},[]),h=react.useCallback(k=>{react.startTransition(()=>{x(k);});},[]),y=react.useCallback(()=>{b.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
131
131
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
132
132
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
133
133
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
134
134
  .match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
135
- `}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:0,overflow:"hidden"},children:[l&&jsxRuntime.jsx("img",{src:l,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(sl,{stats:v})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d(I0[u])}),v&&v.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:d("predict.matches.pairsFound",{count:v.activePairs})})]})]}),jsxRuntime.jsx(ol,{sortBy:u,onSortChange:w,sortAsc:m,onSortAscChange:P,minVolume:f,onMinVolumeChange:g,onRefresh:y})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:d("predict.matches.experimentalFeature")})," \u2014 ",d("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(hl,{ref:b,sortBy:u,sortAsc:m,minVolume:f,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:o,onHover:n,onSelect:i,getMarketHref:s,LinkComponent:a,onStatsChange:h})]}),jsxRuntime.jsx(D0,{stats:v})]})}function oi(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var B0={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},H0={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function z0(e){return B0[e]??H0}function W0(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let o of e.matched_markets){let n=o.spread??0;n>r&&(r=n,t=o);}return t}function U0(e,t){let r=e.entries.find(a=>a.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(a=>a.source===(t?.source_b??e.entries[1]?.source)),n=a=>{if(!a?.outcomes?.[0])return {name:null,price:null};let l=a.outcomes[0];return {name:l.label||null,price:l.best_ask??l.price??null}},i=n(t?.market_a),s=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:s.name,yesPrice:s.price,volume:o?.event?.volume??null,event:o?.event}]}function xS({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>W0(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[a,l]=react.useMemo(()=>U0(e,i),[e,i]),d=s!=null&&s>=3;a.yesPrice!=null&&l.yesPrice!=null?a.source==="kalshi"?a.yesPrice>l.yesPrice:l.yesPrice>a.yesPrice:false;let p=a.yesPrice!=null&&l.yesPrice!=null?a.yesPrice<=l.yesPrice?a:l:null,m=p?_t(p.source):null,c=d?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${d?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:d?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:d?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(bl,{data:a,isCheaper:p===a,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(bl,{data:l,isCheaper:p===l,onSelect:t,getEventHref:r,LinkComponent:o})]}),p&&m&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${c==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:c==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>p.event&&t?.(p.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:c==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:c==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:p.source.charAt(0).toUpperCase()+p.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:c==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),oi(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),oi(e.combined_volume_24h)," ",n("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",n("predict.matches.match")]})]})]})}function bl({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=_t(e.source),a=z0(e.source),l=e.event?o?.(e.event):void 0,d=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${a.border}`,background:a.bg,padding:12,cursor:l||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:u=>{u.currentTarget.style.borderColor=a.hoverBorder;},onMouseLeave:u=>{u.currentTarget.style.borderColor=a.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:a.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?a.priceActiveColor:a.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[oi(e.volume)," ",i("predict.matches.volume")]})]});return l&&n?jsxRuntime.jsx(n,{href:l,className:"block",children:d}):d}function j0(e){return utils$1.formatAmountInUsd(e)}function PS({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,i=0,s=new Set;for(let a of e){a.max_spread!=null&&a.max_spread>n&&(n=a.max_spread),a.combined_volume!=null&&(i+=a.combined_volume);for(let l of a.entries)s.add(typeof l.source=="string"?l.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:i,platformCount:s.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(eo,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(ii,{}),jsxRuntime.jsx(eo,{label:r("predict.matches.stats.totalVolume"),value:j0(o.totalVolume)}),jsxRuntime.jsx(ii,{}),jsxRuntime.jsx(eo,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(ii,{}),jsxRuntime.jsx(eo,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function eo({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function ii(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Sl(e){return `${(e*100).toFixed(1)}\xA2`}function q0(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function ES({spread:e,arbProfit:t,className:r}){if(e==null)return null;let o=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-semibold",q0(e)),children:Sl(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Sl(t)]})]})}var ln=10,Z0=64,Cl=40,to=48;function Ml({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(1),{data:s,isLoading:a,fetchNextPage:l,hasNextPage:d,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:p,isLoading:m,fetchNextPage:c,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=a||m,x=u||g,b=d||f,w=react.useMemo(()=>{let F=[];return s?.pages&&F.push(...s.pages.flatMap(q=>q.items)),p?.pages&&F.push(...p.pages.flatMap(q=>q.items)),F.sort((q,$)=>($.timestamp??0)-(q.timestamp??0)),F},[s,p]),P=Math.max(1,Math.ceil(w.length/ln)+(b?1:0)),h=(n-1)*ln,y=w.slice(h,h+ln),S=react.useCallback(()=>{i(F=>Math.max(1,F-1));},[]),N=react.useCallback(async()=>{n*ln>=w.length&&b&&(d&&await l(),f&&await c()),i(q=>q+1);},[n,w.length,b,d,f,l,c]),A=n>1,D=n*ln<w.length||b;if(v)return jsxRuntime.jsx(ih,{height:r});if(w.length===0&&!b)return jsxRuntime.jsx(oh,{message:o("predict.profile.noHistory"),height:r});let z=r-Cl-to;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Cl},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:o("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:z},children:[y.map((F,q)=>jsxRuntime.jsx(eh,{trade:F},F.id??`${h+q}`)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:to},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!A,onClick:S,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",A?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(P,5)},(F,q)=>{let $=q+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i($),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",$===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:$},$)}),jsxRuntime.jsxs("button",{type:"button",disabled:!D,onClick:N,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",D?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[o("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-to},children:y.map((F,q)=>jsxRuntime.jsx(th,{trade:F},F.id??`m-${h+q}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:to},children:[jsxRuntime.jsx("button",{type:"button",disabled:!A,onClick:S,className:ui$1.cn("text-sm cursor-pointer",A?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:n}),jsxRuntime.jsx("button",{type:"button",disabled:!D,onClick:N,className:ui$1.cn("text-sm cursor-pointer",D?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function eh({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",o=e.side?.toUpperCase()==="BUY",n=e.price??0,i=e.usd_size??0,s=El(e.type,t),a=r||o,l=a?"+":"-",d=a?"text-success":"text-foreground",u=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,m=e.outcome??"",c=_l(e.timestamp),f=Tl(e),g=rh(e),v=nh(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Z0},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p&&jsxRuntime.jsx("img",{src:p,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:u}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[m&&jsxRuntime.jsx("span",{className:"mr-1",children:m}),jsxRuntime.jsx("span",{children:c})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",r?"text-primary":o?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:s}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Rl(n)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",d),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:v!==null?`$${v.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:f&&jsxRuntime.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ll,{})})})]})}function th({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",o=e.side?.toUpperCase()==="BUY",n=e.price??0,i=e.usd_size??0,s=El(e.type,t),a=e.event?.title??e.market?.question??"\u2014",l=_l(e.timestamp),d=Tl(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:a})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:l})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",r?"text-primary":o?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":o?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:s})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Rl(n)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),d&&jsxRuntime.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ll,{})})]})]})}function El(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function Tl(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function rh(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function nh(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return null}function Ll(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function oh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function ih({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Rl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function _l(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}var cn=10,ph=64,Ol=40,ro=48;function Al({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:a,isLoading:l,fetchNextPage:d,hasNextPage:u,isFetchingNextPage:p}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:c,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=l||c,b=p||v,w=u||g,P=react.useMemo(()=>{let $=[],Q=new Set(["live","open","submitted","pending"]);return a?.pages&&$.push(...a.pages.flatMap(re=>re.items).filter(re=>Q.has(re.status))),m?.pages&&$.push(...m.pages.flatMap(re=>re.items).filter(re=>Q.has(re.status))),$},[a,m]),h=react.useCallback($=>{n.mutate({source:$.source,id:$.id});},[n]),y=Math.max(1,Math.ceil(P.length/cn)+(w?1:0)),S=(i-1)*cn,N=P.slice(S,S+cn),A=react.useCallback(()=>{s($=>Math.max(1,$-1));},[]),D=react.useCallback(async()=>{i*cn>=P.length&&w&&(u&&await d(),g&&await f()),s(Q=>Q+1);},[i,P.length,w,u,g,d,f]),z=i>1,F=i*cn<P.length||w;if(x)return jsxRuntime.jsx(hh,{height:r});if(P.length===0&&!w)return jsxRuntime.jsx(gh,{message:o("predict.profile.noOrders"),height:r});let q=r-Ol-ro;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Ol},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:q},children:[N.map($=>jsxRuntime.jsx(mh,{order:$,onCancel:h},$.id)),b&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Dl,{className:"hidden lg:flex",currentPage:i,totalPages:y,canGoPrev:z,canGoNext:F,onPrev:A,onNext:D,onPage:s,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-ro},children:N.map($=>jsxRuntime.jsx(fh,{order:$,onCancel:h},$.id))}),jsxRuntime.jsx(Dl,{className:"lg:hidden",currentPage:i,totalPages:y,canGoPrev:z,canGoNext:F,onPrev:A,onNext:D,onPage:s,t:o,compact:true})]})}function mh({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):n*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:ph},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",o?"text-success":"text-danger"),children:r(o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n>0?Fl(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function fh({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-xs font-medium px-1.5 py-0.5 rounded",o?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?Fl(n):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function Dl({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:i,onNext:s,onPage:a,t:l,compact:d}){return d?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:ro},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:i,className:ui$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:s,className:ui$1.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:ro},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:i,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",l("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(u,p)=>{let m=p+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(m),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",m===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:m},m)}),jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:s,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[l("predict.profile.next")," \u2192"]})]})}function gh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function hh({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Fl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var di=10,yh=64,Bl=40,no=48;function Hl({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(1),l=react.useCallback(()=>{for(let g of e)o?.(g);},[e,o]);if(t)return jsxRuntime.jsx(Ph,{height:r});if(e.length===0)return jsxRuntime.jsx(wh,{message:i("predict.profile.noPositions"),height:r});let d=Math.max(1,Math.ceil(e.length/di)),u=(s-1)*di,p=e.slice(u,u+di),m=s>1,c=s<d,f=r-Bl-no;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Bl},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:o&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:l,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:p.map((g,v)=>jsxRuntime.jsx(kh,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??u+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:no},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>a(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(d,5)},(g,v)=>{let x=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(x),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!c,onClick:()=>a(g=>g+1),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-no},children:p.map((g,v)=>jsxRuntime.jsx(Sh,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${u+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:no},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>a(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!c,onClick:()=>a(g=>g+1),className:ui$1.cn("text-sm cursor-pointer",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function kh({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,s=e.avg_price??0,a=e.current_price??0,l=e.current_value??e.size*a,d=e.size,u=n>0?"text-success":n<0?"text-danger":"text-foreground",p=n>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?Nh(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:yh},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[c&&jsxRuntime.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",l.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count:$r(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*s).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:ui(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:ui(a)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:[jsxRuntime.jsxs("span",{children:[p,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:v}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),o("predict.profile.close")]})})]})}function Sh({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,s=e.current_price??0,a=n>0?"text-success":n<0?"text-danger":"text-foreground",l=n>0?"+":"",d=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:d})]}),jsxRuntime.jsx("span",{className:ui$1.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(oo,{label:o("predict.profile.totalSize"),value:$r(e.size)}),jsxRuntime.jsx(oo,{label:o("predict.profile.markPrice"),value:ui(s)}),jsxRuntime.jsx(oo,{label:o("predict.profile.pnl"),value:`${l}$${Math.abs(n).toFixed(2)} (${l}${i.toFixed(1)}%)`,className:a}),jsxRuntime.jsx(oo,{label:o("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:o("predict.profile.close")})})]})}function oo({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui$1.cn("font-mono text-foreground",r),children:t})]})}function wh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Ph({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function ui(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Nh(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}catch{return "\u2014"}}function Wl({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let a=0,l=0;for(let c of e)a+=c.realized_pnl??0,l+=c.current_value??c.size*(c.current_price??0);let d=0,u=0,p=0;for(let c of t)d+=c.usd_size??0,c.type==="REDEEM"&&(p++,(c.usd_size??0)>0&&u++);let m=p>0?`${u} / ${p}`:"0 / 0";return {realizedPnl:a,positionsValue:l,volume:d,winRateStr:m}},[e,t]),i=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",s=n.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:o("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",i),children:[s,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(mi,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(mi,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(mi,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function mi({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var fi=600;function Ih({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState("positions"),a=!!(e||t),{data:l,isLoading:d}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:p}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let S=[];return l?.positions&&S.push(...l.positions),u?.positions&&S.push(...u.positions),S},[l,u]),c=d||p,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:v,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...f?.pages?.flatMap(N=>N.items)??[],...v?.pages?.flatMap(N=>N.items)??[]],[f,v]),w=c||g||x,P=m.length,y=[{key:"positions",label:P>0?`${n("predict.profile.positionsTab")} (${P})`:n("predict.profile.positionsTab")},{key:"orders",label:n("predict.profile.openOrdersTab")},{key:"history",label:n("predict.profile.historyTab")}];return a?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Wl,{positions:m,trades:b,isLoading:w}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:y.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(S.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===S.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:S.label},S.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Hl,{positions:m,isLoading:c,listHeight:fi,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Al,{solanaAddress:e,evmAddress:t,listHeight:fi}),i==="history"&&jsxRuntime.jsx(Ml,{solanaAddress:e,evmAddress:t,listHeight:fi})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function Nw({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:o,onDeployAndApprove:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(false),[l,d]=react.useState(null),[u,p]=react.useState(false),m=r||u,c=o||u,f=m?"done":s?"running":"pending",g=c?"done":m&&s?"running":"pending",v=m&&c,x=react.useCallback(async()=>{d(null),p(false),a(true);try{await n(),p(!0);}catch(h){d(h instanceof Error?h.message:String(h));}finally{a(false);}},[n]),b=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:f},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],w=()=>{v?t():x();},P=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:h=>{h||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:b.map((h,y)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Bh,{index:y+1,status:h.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:h.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${h.status==="done"?"text-[#c7ff2e]":h.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:h.status==="done"?i("predict.setup.stepComplete"):h.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:h.desc})]})]},h.key))}),l&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:l})}),jsxRuntime.jsx("button",{type:"button",onClick:w,disabled:s,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):P}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Bh({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
136
- Object.defineProperty(exports,"PredictClient",{enumerable:true,get:function(){return reactPredict.PredictClient}});Object.defineProperty(exports,"PredictContext",{enumerable:true,get:function(){return reactPredict.PredictContext}});Object.defineProperty(exports,"PredictProvider",{enumerable:true,get:function(){return reactPredict.PredictProvider}});Object.defineProperty(exports,"PredictWsClient",{enumerable:true,get:function(){return reactPredict.PredictWsClient}});Object.defineProperty(exports,"createPredictClient",{enumerable:true,get:function(){return reactPredict.createPredictClient}});Object.defineProperty(exports,"createPredictWsClient",{enumerable:true,get:function(){return reactPredict.createPredictWsClient}});Object.defineProperty(exports,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositions",{enumerable:true,get:function(){return reactPredict.usePositions}});Object.defineProperty(exports,"usePredictClient",{enumerable:true,get:function(){return reactPredict.usePredictClient}});Object.defineProperty(exports,"usePriceHistory",{enumerable:true,get:function(){return reactPredict.usePriceHistory}});Object.defineProperty(exports,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});Object.defineProperty(exports,"useSearchEvents",{enumerable:true,get:function(){return reactPredict.useSearchEvents}});Object.defineProperty(exports,"useSimilarEvents",{enumerable:true,get:function(){return reactPredict.useSimilarEvents}});Object.defineProperty(exports,"useTrades",{enumerable:true,get:function(){return reactPredict.useTrades}});exports.CHART_RANGE_DURATION=tv;exports.CHART_RANGE_PERIOD=Zh;exports.CHART_RANGE_SAMPLE_INTERVAL=ev;exports.CandlestickPeriod=yn;exports.CategoriesSkeleton=Kh;exports.CategoriesUI=yi;exports.CategoriesWidget=wi;exports.ChartRange=ae;exports.CommentItemUI=Go;exports.DEFAULT_CHART_RANGE=kn;exports.DEFAULT_FILTER_STATE=Vr;exports.DEFAULT_PAGE_SIZE=Ur;exports.DEFAULT_PRICE_HISTORY_INTERVAL=iv;exports.EventCommentsWidget=zf;exports.EventDetailPage=h1;exports.EventDetailSkeleton=Jr;exports.EventDetailUI=ha;exports.EventDetailWidget=va;exports.EventItem=ss;exports.EventMarketDepthChartUI=Xs;exports.EventMarketDetailWidget=na;exports.EventPriceChart=aa;exports.EventsFilterUI=zi;exports.EventsHero=qx;exports.EventsPage=Ux;exports.EventsPageSkeleton=fx;exports.EventsSkeleton=Po;exports.EventsToolbarUI=ji;exports.EventsUI=us;exports.EventsWidget=ms;exports.KycModal=Mn;exports.MAX_PRICE_HISTORY_MARKETS=xo;exports.MatchGroupCard=xS;exports.MatchMarketCard=ul;exports.MatchesFilterBar=ol;exports.MatchesHero=sl;exports.MatchesPage=uS;exports.MatchesStatsBar=PS;exports.MatchesWidget=hl;exports.ORDER_MAX_PRICE=ov;exports.ORDER_MIN_PRICE=nv;exports.ORDER_MIN_QUANTITY=Sn;exports.ORDER_MIN_USDC=wn;exports.ORDER_PRICE_STEP=rv;exports.PREDICT_REDEEM_MODAL_ID=Ru;exports.PREDICT_SEARCH_MODAL_ID=Zo;exports.PREDICT_SELL_MODAL_ID=Io;exports.PREDICT_TRADE_MODAL_ID=Kr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=sv;exports.PredictRedeemModal=Ps;exports.PredictSearchModal=gk;exports.PredictSellModal=Bs;exports.PredictTradeModal=Ln;exports.PredictWalletProvider=cc;exports.PriceHistoryInterval=wr;exports.ProfilePage=Ih;exports.RedeemFormWidget=Ss;exports.SORT_PRESETS=Vi;exports.STATIC_CATEGORIES=vo;exports.SearchEventsButton=Pk;exports.SearchHistoryUI=Ia;exports.SearchHistoryWidget=Oa;exports.SearchInputUI=Da;exports.SearchResultItemUI=Aa;exports.SearchResultListWidget=Wa;exports.SearchWidget=ja;exports.SellFormUI=As;exports.SellFormWidget=Fn;exports.SetupModal=Nw;exports.SimilarEventCard=lf;exports.SimilarEventsSection=ka;exports.SourceBadge=Vy;exports.SpreadIndicator=ES;exports.TradeFormSkeleton=Ks;exports.TradeFormUI=Bi;exports.TradeFormWidget=Tn;exports.UserActivitySection=Ws;exports.countActiveFilters=wo;exports.fireCelebration=lr;exports.floorToDecimals=Pe;exports.formatKMB=Zr;exports.formatShares=$r;exports.getSourceMeta=_t;exports.parsePolymarketError=Cn;exports.resolveExpiration=Pn;exports.roundToTickSize=Nn;exports.useEventDetail=w1;exports.useEventsInfinite=Yi;exports.usePredictSearchHistory=Xn;exports.usePredictWallet=ar;exports.useSearchResultListScript=Fa;exports.useSearchScript=Va;exports.useSellForm=Ms;exports.useTradeForm=Ti;//# sourceMappingURL=index.js.map
135
+ `}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:0,overflow:"hidden"},children:[l&&jsxRuntime.jsx("img",{src:l,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(sl,{stats:v})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d(I0[u])}),v&&v.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:d("predict.matches.pairsFound",{count:v.activePairs})})]})]}),jsxRuntime.jsx(ol,{sortBy:u,onSortChange:P,sortAsc:m,onSortAscChange:w,minVolume:f,onMinVolumeChange:g,onRefresh:y})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:d("predict.matches.experimentalFeature")})," \u2014 ",d("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(hl,{ref:b,sortBy:u,sortAsc:m,minVolume:f,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:o,onHover:n,onSelect:i,getMarketHref:s,LinkComponent:a,onStatsChange:h})]}),jsxRuntime.jsx(A0,{stats:v})]})}function ni(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var B0={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},H0={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function z0(e){return B0[e]??H0}function W0(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let o of e.matched_markets){let n=o.spread??0;n>r&&(r=n,t=o);}return t}function U0(e,t){let r=e.entries.find(a=>a.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(a=>a.source===(t?.source_b??e.entries[1]?.source)),n=a=>{if(!a?.outcomes?.[0])return {name:null,price:null};let l=a.outcomes[0];return {name:l.label||null,price:l.best_ask??l.price??null}},i=n(t?.market_a),s=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:s.name,yesPrice:s.price,volume:o?.event?.volume??null,event:o?.event}]}function xS({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>W0(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[a,l]=react.useMemo(()=>U0(e,i),[e,i]),d=s!=null&&s>=3;a.yesPrice!=null&&l.yesPrice!=null?a.source==="kalshi"?a.yesPrice>l.yesPrice:l.yesPrice>a.yesPrice:false;let p=a.yesPrice!=null&&l.yesPrice!=null?a.yesPrice<=l.yesPrice?a:l:null,m=p?It(p.source):null,c=d?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${d?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:d?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:d?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(bl,{data:a,isCheaper:p===a,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(bl,{data:l,isCheaper:p===l,onSelect:t,getEventHref:r,LinkComponent:o})]}),p&&m&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${c==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:c==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>p.event&&t?.(p.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:c==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:c==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:p.source.charAt(0).toUpperCase()+p.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:c==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),ni(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),ni(e.combined_volume_24h)," ",n("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",n("predict.matches.match")]})]})]})}function bl({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=It(e.source),a=z0(e.source),l=e.event?o?.(e.event):void 0,d=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${a.border}`,background:a.bg,padding:12,cursor:l||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:u=>{u.currentTarget.style.borderColor=a.hoverBorder;},onMouseLeave:u=>{u.currentTarget.style.borderColor=a.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:a.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?a.priceActiveColor:a.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[ni(e.volume)," ",i("predict.matches.volume")]})]});return l&&n?jsxRuntime.jsx(n,{href:l,className:"block",children:d}):d}function j0(e){return utils$1.formatAmountInUsd(e)}function PS({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,i=0,s=new Set;for(let a of e){a.max_spread!=null&&a.max_spread>n&&(n=a.max_spread),a.combined_volume!=null&&(i+=a.combined_volume);for(let l of a.entries)s.add(typeof l.source=="string"?l.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:i,platformCount:s.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(ro,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(oi,{}),jsxRuntime.jsx(ro,{label:r("predict.matches.stats.totalVolume"),value:j0(o.totalVolume)}),jsxRuntime.jsx(oi,{}),jsxRuntime.jsx(ro,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(oi,{}),jsxRuntime.jsx(ro,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function ro({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function oi(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Sl(e){return `${(e*100).toFixed(1)}\xA2`}function q0(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function ES({spread:e,arbProfit:t,className:r}){if(e==null)return null;let o=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui.cn("text-sm font-semibold",q0(e)),children:Sl(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Sl(t)]})]})}var dn=10,Z0=64,Cl=40,no=48;function Ml({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(1),{data:s,isLoading:a,fetchNextPage:l,hasNextPage:d,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:p,isLoading:m,fetchNextPage:c,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=a||m,x=u||g,b=d||f,P=react.useMemo(()=>{let A=[];return s?.pages&&A.push(...s.pages.flatMap(j=>j.items)),p?.pages&&A.push(...p.pages.flatMap(j=>j.items)),A.sort((j,V)=>(V.timestamp??0)-(j.timestamp??0)),A},[s,p]),w=Math.max(1,Math.ceil(P.length/dn)+(b?1:0)),h=(n-1)*dn,y=P.slice(h,h+dn),k=react.useCallback(()=>{i(A=>Math.max(1,A-1));},[]),N=react.useCallback(async()=>{n*dn>=P.length&&b&&(d&&await l(),f&&await c()),i(j=>j+1);},[n,P.length,b,d,f,l,c]),F=n>1,O=n*dn<P.length||b;if(v)return jsxRuntime.jsx(ih,{height:r});if(P.length===0&&!b)return jsxRuntime.jsx(oh,{message:o("predict.profile.noHistory"),height:r});let z=r-Cl-no;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Cl},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:o("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:z},children:[y.map((A,j)=>jsxRuntime.jsx(eh,{trade:A},A.id??`${h+j}`)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:no},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!F,onClick:k,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",F?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(w,5)},(A,j)=>{let V=j+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(V),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",V===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:V},V)}),jsxRuntime.jsxs("button",{type:"button",disabled:!O,onClick:N,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",O?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[o("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-no},children:y.map((A,j)=>jsxRuntime.jsx(th,{trade:A},A.id??`m-${h+j}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:no},children:[jsxRuntime.jsx("button",{type:"button",disabled:!F,onClick:k,className:ui.cn("text-sm cursor-pointer",F?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:n}),jsxRuntime.jsx("button",{type:"button",disabled:!O,onClick:N,className:ui.cn("text-sm cursor-pointer",O?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function eh({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",o=e.side?.toUpperCase()==="BUY",n=e.price??0,i=e.usd_size??0,s=El(e.type,t),a=r||o,l=a?"+":"-",d=a?"text-success":"text-foreground",u=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,m=e.outcome??"",c=_l(e.timestamp),f=Tl(e),g=rh(e),v=nh(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Z0},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p&&jsxRuntime.jsx("img",{src:p,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:u}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[m&&jsxRuntime.jsx("span",{className:"mr-1",children:m}),jsxRuntime.jsx("span",{children:c})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-primary":o?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:s}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Rl(n)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",d),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:v!==null?`$${v.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:f&&jsxRuntime.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ll,{})})})]})}function th({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",o=e.side?.toUpperCase()==="BUY",n=e.price??0,i=e.usd_size??0,s=El(e.type,t),a=e.event?.title??e.market?.question??"\u2014",l=_l(e.timestamp),d=Tl(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:a})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:l})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui.cn("font-medium",r?"text-primary":o?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":o?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:s})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Rl(n)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),d&&jsxRuntime.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ll,{})})]})]})}function El(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function Tl(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function rh(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function nh(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return null}function Ll(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function oh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function ih({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Rl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function _l(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}var un=10,ph=64,Ol=40,oo=48;function Dl({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:a,isLoading:l,fetchNextPage:d,hasNextPage:u,isFetchingNextPage:p}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:c,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=l||c,b=p||v,P=u||g,w=react.useMemo(()=>{let V=[],te=new Set(["live","open","submitted","pending"]);return a?.pages&&V.push(...a.pages.flatMap(Q=>Q.items).filter(Q=>te.has(Q.status))),m?.pages&&V.push(...m.pages.flatMap(Q=>Q.items).filter(Q=>te.has(Q.status))),V},[a,m]),h=react.useCallback(V=>{n.mutate({source:V.source,id:V.id});},[n]),y=Math.max(1,Math.ceil(w.length/un)+(P?1:0)),k=(i-1)*un,N=w.slice(k,k+un),F=react.useCallback(()=>{s(V=>Math.max(1,V-1));},[]),O=react.useCallback(async()=>{i*un>=w.length&&P&&(u&&await d(),g&&await f()),s(te=>te+1);},[i,w.length,P,u,g,d,f]),z=i>1,A=i*un<w.length||P;if(x)return jsxRuntime.jsx(hh,{height:r});if(w.length===0&&!P)return jsxRuntime.jsx(gh,{message:o("predict.profile.noOrders"),height:r});let j=r-Ol-oo;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Ol},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:j},children:[N.map(V=>jsxRuntime.jsx(mh,{order:V,onCancel:h},V.id)),b&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Al,{className:"hidden lg:flex",currentPage:i,totalPages:y,canGoPrev:z,canGoNext:A,onPrev:F,onNext:O,onPage:s,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-oo},children:N.map(V=>jsxRuntime.jsx(fh,{order:V,onCancel:h},V.id))}),jsxRuntime.jsx(Al,{className:"lg:hidden",currentPage:i,totalPages:y,canGoPrev:z,canGoNext:A,onPrev:F,onNext:O,onPage:s,t:o,compact:true})]})}function mh({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):n*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:ph},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",o?"text-success":"text-danger"),children:r(o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n>0?Fl(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function fh({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui.cn("text-xs font-medium px-1.5 py-0.5 rounded",o?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?Fl(n):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function Al({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:i,onNext:s,onPage:a,t:l,compact:d}){return d?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:oo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:s,className:ui.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:oo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",l("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(u,p)=>{let m=p+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(m),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",m===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:m},m)}),jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:s,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[l("predict.profile.next")," \u2192"]})]})}function gh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function hh({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Fl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var ci=10,yh=64,Bl=40,io=48;function Hl({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(1),l=react.useCallback(()=>{for(let g of e)o?.(g);},[e,o]);if(t)return jsxRuntime.jsx(Ph,{height:r});if(e.length===0)return jsxRuntime.jsx(wh,{message:i("predict.profile.noPositions"),height:r});let d=Math.max(1,Math.ceil(e.length/ci)),u=(s-1)*ci,p=e.slice(u,u+ci),m=s>1,c=s<d,f=r-Bl-io;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Bl},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:o&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:l,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:p.map((g,v)=>jsxRuntime.jsx(kh,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??u+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:io},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>a(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(d,5)},(g,v)=>{let x=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(x),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!c,onClick:()=>a(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-io},children:p.map((g,v)=>jsxRuntime.jsx(Sh,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${u+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:io},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>a(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!c,onClick:()=>a(g=>g+1),className:ui.cn("text-sm cursor-pointer",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function kh({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,s=e.avg_price??0,a=e.current_price??0,l=e.current_value??e.size*a,d=e.size,u=n>0?"text-success":n<0?"text-danger":"text-foreground",p=n>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?Nh(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:yh},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[c&&jsxRuntime.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",l.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count:Vr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*s).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:di(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:di(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",u),children:[jsxRuntime.jsxs("span",{children:[p,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:v}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),o("predict.profile.close")]})})]})}function Sh({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,s=e.current_price??0,a=n>0?"text-success":n<0?"text-danger":"text-foreground",l=n>0?"+":"",d=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:d})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(so,{label:o("predict.profile.totalSize"),value:Vr(e.size)}),jsxRuntime.jsx(so,{label:o("predict.profile.markPrice"),value:di(s)}),jsxRuntime.jsx(so,{label:o("predict.profile.pnl"),value:`${l}$${Math.abs(n).toFixed(2)} (${l}${i.toFixed(1)}%)`,className:a}),jsxRuntime.jsx(so,{label:o("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:o("predict.profile.close")})})]})}function so({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function wh({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Ph({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function di(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Nh(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",d=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${l}${d})`}catch{return "\u2014"}}function Wl({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let a=0,l=0;for(let c of e)a+=c.realized_pnl??0,l+=c.current_value??c.size*(c.current_price??0);let d=0,u=0,p=0;for(let c of t)d+=c.usd_size??0,c.type==="REDEEM"&&(p++,(c.usd_size??0)>0&&u++);let m=p>0?`${u} / ${p}`:"0 / 0";return {realizedPnl:a,positionsValue:l,volume:d,winRateStr:m}},[e,t]),i=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",s=n.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:o("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui.cn("text-5xl font-bold tabular-nums",i),children:[s,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(pi,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(pi,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(pi,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function pi({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var mi=600;function Ih({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState("positions"),a=!!(e||t),{data:l,isLoading:d}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:p}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let k=[];return l?.positions&&k.push(...l.positions),u?.positions&&k.push(...u.positions),k},[l,u]),c=d||p,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:v,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...f?.pages?.flatMap(N=>N.items)??[],...v?.pages?.flatMap(N=>N.items)??[]],[f,v]),P=c||g||x,w=m.length,y=[{key:"positions",label:w>0?`${n("predict.profile.positionsTab")} (${w})`:n("predict.profile.positionsTab")},{key:"orders",label:n("predict.profile.openOrdersTab")},{key:"history",label:n("predict.profile.historyTab")}];return a?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Wl,{positions:m,trades:b,isLoading:P}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:y.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(k.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===k.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:k.label},k.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Hl,{positions:m,isLoading:c,listHeight:mi,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Dl,{solanaAddress:e,evmAddress:t,listHeight:mi}),i==="history"&&jsxRuntime.jsx(Ml,{solanaAddress:e,evmAddress:t,listHeight:mi})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function Nw({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:o,onDeployAndApprove:n}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(false),[l,d]=react.useState(null),[u,p]=react.useState(false),m=r||u,c=o||u,f=m?"done":s?"running":"pending",g=c?"done":m&&s?"running":"pending",v=m&&c,x=react.useCallback(async()=>{d(null),p(false),a(true);try{await n(),p(!0);}catch(h){d(h instanceof Error?h.message:String(h));}finally{a(false);}},[n]),b=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:f},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],P=()=>{v?t():x();},w=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:h=>{h||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:b.map((h,y)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Bh,{index:y+1,status:h.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:h.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${h.status==="done"?"text-[#c7ff2e]":h.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:h.status==="done"?i("predict.setup.stepComplete"):h.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:h.desc})]})]},h.key))}),l&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:l})}),jsxRuntime.jsx("button",{type:"button",onClick:P,disabled:s,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):w}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Bh({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
136
+ Object.defineProperty(exports,"PredictClient",{enumerable:true,get:function(){return reactPredict.PredictClient}});Object.defineProperty(exports,"PredictContext",{enumerable:true,get:function(){return reactPredict.PredictContext}});Object.defineProperty(exports,"PredictProvider",{enumerable:true,get:function(){return reactPredict.PredictProvider}});Object.defineProperty(exports,"PredictWsClient",{enumerable:true,get:function(){return reactPredict.PredictWsClient}});Object.defineProperty(exports,"createPredictClient",{enumerable:true,get:function(){return reactPredict.createPredictClient}});Object.defineProperty(exports,"createPredictWsClient",{enumerable:true,get:function(){return reactPredict.createPredictWsClient}});Object.defineProperty(exports,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositions",{enumerable:true,get:function(){return reactPredict.usePositions}});Object.defineProperty(exports,"usePredictClient",{enumerable:true,get:function(){return reactPredict.usePredictClient}});Object.defineProperty(exports,"usePriceHistory",{enumerable:true,get:function(){return reactPredict.usePriceHistory}});Object.defineProperty(exports,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});Object.defineProperty(exports,"useSearchEvents",{enumerable:true,get:function(){return reactPredict.useSearchEvents}});Object.defineProperty(exports,"useSimilarEvents",{enumerable:true,get:function(){return reactPredict.useSimilarEvents}});Object.defineProperty(exports,"useTrades",{enumerable:true,get:function(){return reactPredict.useTrades}});exports.CHART_RANGE_DURATION=tv;exports.CHART_RANGE_PERIOD=Zh;exports.CHART_RANGE_SAMPLE_INTERVAL=ev;exports.CandlestickPeriod=Sn;exports.CategoriesSkeleton=Kh;exports.CategoriesUI=bi;exports.CategoriesWidget=Si;exports.ChartRange=ae;exports.CommentItemUI=qo;exports.DEFAULT_CHART_RANGE=wn;exports.DEFAULT_FILTER_STATE=qr;exports.DEFAULT_PAGE_SIZE=Kr;exports.DEFAULT_PRICE_HISTORY_INTERVAL=iv;exports.EventCommentsWidget=zf;exports.EventDetailPage=h1;exports.EventDetailSkeleton=en;exports.EventDetailUI=ha;exports.EventDetailWidget=va;exports.EventItem=is;exports.EventMarketDepthChartUI=Qs;exports.EventMarketDetailWidget=na;exports.EventPriceChart=aa;exports.EventsFilterUI=Hi;exports.EventsHero=qx;exports.EventsPage=Ux;exports.EventsPageSkeleton=fx;exports.EventsSkeleton=Po;exports.EventsToolbarUI=Vi;exports.EventsUI=ds;exports.EventsWidget=ps;exports.KycModal=Tn;exports.MAX_PRICE_HISTORY_MARKETS=xo;exports.MatchGroupCard=xS;exports.MatchMarketCard=ul;exports.MatchesFilterBar=ol;exports.MatchesHero=sl;exports.MatchesPage=uS;exports.MatchesStatsBar=PS;exports.MatchesWidget=hl;exports.ORDER_MAX_PRICE=ov;exports.ORDER_MIN_PRICE=nv;exports.ORDER_MIN_QUANTITY=Pn;exports.ORDER_MIN_USDC=Nn;exports.ORDER_PRICE_STEP=rv;exports.PREDICT_REDEEM_MODAL_ID=Ru;exports.PREDICT_SEARCH_MODAL_ID=Jo;exports.PREDICT_SELL_MODAL_ID=Io;exports.PREDICT_TRADE_MODAL_ID=jr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=sv;exports.PredictRedeemModal=ws;exports.PredictSearchModal=gk;exports.PredictSellModal=Fs;exports.PredictTradeModal=_n;exports.PredictWalletProvider=cc;exports.PriceHistoryInterval=Cr;exports.ProfilePage=Ih;exports.RedeemFormWidget=ks;exports.SORT_PRESETS=Ki;exports.STATIC_CATEGORIES=vo;exports.SearchEventsButton=Pk;exports.SearchHistoryUI=Ia;exports.SearchHistoryWidget=Oa;exports.SearchInputUI=Aa;exports.SearchResultItemUI=Da;exports.SearchResultListWidget=Wa;exports.SearchWidget=ja;exports.SellFormUI=As;exports.SellFormWidget=Hn;exports.SetupModal=Nw;exports.SimilarEventCard=lf;exports.SimilarEventsSection=ka;exports.SourceBadge=Vy;exports.SpreadIndicator=ES;exports.TradeFormSkeleton=$s;exports.TradeFormUI=Fi;exports.TradeFormWidget=Rn;exports.UserActivitySection=zs;exports.countActiveFilters=wo;exports.fireCelebration=ur;exports.floorToDecimals=Ne;exports.formatKMB=tn;exports.formatShares=Vr;exports.getSourceMeta=It;exports.parsePolymarketError=En;exports.resolveExpiration=Cn;exports.roundToTickSize=Mn;exports.useEventDetail=w1;exports.useEventsInfinite=Gi;exports.usePredictSearchHistory=Zn;exports.usePredictWallet=dr;exports.useSearchResultListScript=Fa;exports.useSearchScript=Va;exports.useSellForm=Cs;exports.useTradeForm=Ei;//# sourceMappingURL=index.js.map
137
137
  //# sourceMappingURL=index.js.map