@liberfi.io/ui-predict 0.1.117 → 0.1.119

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,4 +1,58 @@
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'),Zr=require('canvas-confetti'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Zr__default=/*#__PURE__*/_interopDefault(Zr);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.117");var ga="0.1.117";var ha={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},so=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Yr=(()=>{let e=t=>{let r=so.indexOf(t);return r===-1?so.length:r};return Object.entries(ha).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 lo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:s,trailing:a,pulsingTab:i="Trending",className:l}){let{t:c}=i18n.useTranslation(),u=react.useCallback(()=>{n(null);},[n]),p=c("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-1 lg:px-2 lg:py-1",l),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-8 items-stretch gap-x-2 lg:min-h-9",children:[jsxRuntime.jsx(io,{label:p,isSelected:t===null,onPress:u,showPulse:p===i}),jsxRuntime.jsx(ya,{}),e.map(m=>jsxRuntime.jsx(io,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===i},m.category))]})}),a&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a})]}),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 pl-2 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(ao,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>s(null)}),o.map(m=>jsxRuntime.jsx(ao,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>s(m.label)},m.label))]})})]})}function io({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 p-1 text-base font-normal 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 ya(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function ao({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-2 py-1 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-transparent bg-primary text-black":"border-border/80 text-neutral-200 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function yf({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-1 lg:px-2 lg:py-1",children:jsxRuntime.jsx("div",{className:"flex min-h-8 items-center gap-x-2 lg:min-h-9",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function ka(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Sa(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function po({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[s,a]=react.useState(null),i=react.useCallback(m=>{n(m),a(null),e?.({categorySlug:m,tagSlug:null});},[e]),l=react.useCallback(m=>{a(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),c=ka(Yr),u=Yr.find(m=>m.slug===o),p=Sa(u);return jsxRuntime.jsx(lo,{categories:c,selectedCategory:o,selectedTag:s,activeTags:p,onCategorySelect:i,onTagSelect:l,trailing:t,className:r})}function mo(e){return {title:e.title,imageUrl:e.image_url}}function fo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Bt=48,qr=4,ur={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},pr=Ee.ALL,Tf={[Ee.ONE_DAY]:ur.ONE_MINUTE,[Ee.ONE_WEEK]:ur.ONE_HOUR,[Ee.ONE_MONTH]:ur.ONE_HOUR,[Ee.ALL]:ur.ONE_DAY},Lf={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},_f={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},mr=1,fr=1,Rf=1,If=1,Of=99,kt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Af=kt.ONE_WEEK,Df={[kt.ONE_HOUR]:60,[kt.SIX_HOURS]:60,[kt.ONE_DAY]:300,[kt.ONE_WEEK]:1800,[kt.MAX]:1800};var xo=react.createContext(null);function Xr(){let e=react.useContext(xo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ta=1e4;function La({pollingInterval:e=Ta,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.SOLANA&&v.isConnected)?.address,[o]),s=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.EVM&&v.isConnected)?.address,[o]),{data:a,isLoading:i,isFetching:l,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:u,isLoading:p}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:m,isLoading:d}=reactPredict.usePolymarketSetup(s,{enabled:t&&!!s,refetchInterval:3e4}),g=m?.safe_address,f=m?.verified??false,{data:h,isLoading:x,isFetching:N,error:E}=reactPredict.useBalance({source:"polymarket",user:s??""},{enabled:t&&f&&!!s,refetchInterval:e}),S=react.useMemo(()=>({solanaAddress:n,evmAddress:s,polymarketSafeAddress:g,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:f&&h?Number(h.balance):null,kalshiKycVerified:u?.verified??false,kalshiKycUrl:u?.kyc_url??null,kalshiKycLoading:p,polymarketSetupVerified:f,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:d,isLoading:i||x,isFetching:l||N,error:c??E??null}),[n,s,g,a,h,f,u,p,m,d,i,x,l,N,c,E]);return jsxRuntime.jsx(xo.Provider,{value:S,children:r})}var Za={minutes:60,hours:3600,days:86400};function Ja(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*Za[r]}}function Jr(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Zr__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Zr__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Zr__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function ko({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),s=walletConnector.useWallets(),a=walletConnector.useSwitchChain(),i=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),u=e.source,p=u==="polymarket",m=s.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),d=s.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),g=n==="authenticated",f=m?.address,h=d?.address,x=react.useMemo(()=>{if(u!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[u,e.provider_meta]),{data:N}=reactPredict.useTickSize(x),E=N?.minimum_tick_size?String(N.minimum_tick_size):"0.01",[S,v]=react.useState(t),[b,H]=react.useState(r),[K,pe]=react.useState("market"),[P,X]=react.useState(NaN),[F,z]=react.useState(NaN),[$,oe]=react.useState(false),[me,M]=react.useState(null),[_,V]=react.useState(null),[O,de]=react.useState(false),[ie,we]=react.useState(false),[Ue,at]=react.useState("1h"),[Be,_t]=react.useState(30),[Rt,lt]=react.useState("minutes"),Ae=null,or=false,sr=null,bt;try{let k=Xr();Ae={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},or=k.kalshiKycVerified,sr=k.kalshiKycUrl,bt=k.polymarketSafeAddress;}catch{}let Pe=react.useMemo(()=>{let k=S==="yes"?0:1,j=e.outcomes[k];return b==="buy"?j?.best_ask??j?.price??.5:j?.best_bid??j?.price??.5},[e.outcomes,S,b]),zr=react.useCallback(k=>{pe(k);},[]),It=react.useCallback(k=>{v(k),z(NaN);},[]);react.useEffect(()=>{K==="limit"&&isNaN(F)&&z(Math.round(Pe*100)/100);},[K,F,Pe]);let $r=react.useMemo(()=>isNaN(P)||P<=0?0:b==="buy"?Pe>0?P/Pe:0:P,[b,P,Pe]),T=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),Ce=e.provider_meta?.["dflow.yesMint"]??"",Ke=e.provider_meta?.["dflow.noMint"]??"",ct=utils.SOLANA_TOKENS.stablecoins.USDC.address,Yi=e.provider_meta?.["dflow.collateralMint"]||"",Gn=S==="yes"?Ce:Ke,Yn=u==="kalshi"?f??"":h??"",{data:Ie,isLoading:qi}=reactPredict.usePositions({source:u,user:Yn},{enabled:!!Yn}),qn=react.useMemo(()=>!Ie||b!=="sell"?null:Ie.positions.find(k=>k.side?.toLowerCase()===S&&k.market?.slug===e.slug)??null,[Ie,e.slug,S,b])?.market?.provider_meta,Qi=b==="sell"&&qn?.["dflow.outcomeMint"]||Gn,Ot=b==="sell"&&qn?.["dflow.collateralMint"]||Yi,At=b==="buy"?ct:Qi,Dt=b==="buy"?Gn:Ot||ct,Xi=u==="kalshi"&&!!At&&!!Dt&&!!f&&T!=="0",{refetch:Qn}=reactPredict.useDFlowQuote({inputMint:At,outputMint:Dt,amount:T,userPublicKey:f??"",slippageBps:100},{enabled:Xi}),ir=react.useMemo(()=>Ae?u==="kalshi"?Ae.kalshiUsdcBalance:Ae.polymarketUsdcBalance:Ie&&Ie.positions.reduce((j,Me)=>Me.side==="USDC"||Me.side==="collateral"?j+(Me.current_value??0):j,0)||null,[Ae,Ie,u]),Zi=Ae?Ae.isLoading:qi,Wr=react.useMemo(()=>Ie?Ie.positions.find(j=>j.side?.toLowerCase()==="yes"&&j.market?.slug===e.slug)?.size??0:null,[Ie,e.slug]),Ur=react.useMemo(()=>Ie?Ie.positions.find(j=>j.side?.toLowerCase()==="no"&&j.market?.slug===e.slug)?.size??0:null,[Ie,e.slug]),Kr=react.useMemo(()=>K==="limit"&&p&&!isNaN(F)?F:Pe,[K,p,F,Pe]),ar=react.useMemo(()=>{if(isNaN(P)||P<=0)return 0;if(b==="buy")return P;let k=S==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return P*k},[b,S,P,e.outcomes]),Xn=react.useMemo(()=>isNaN(P)||P<=0?0:b==="buy"?Kr>0?P/Kr*1:0:ar,[b,P,Kr,ar]),Ji=Xn-ar,ea=react.useCallback(k=>{H(k),X(NaN);},[]),ta=react.useCallback(k=>{if(isNaN(k)){X(NaN);return}let j=Math.max(0,k),Me=b==="buy"?Math.round(j*100)/100:Math.round(j);X(Me);},[b]),ra=react.useCallback(k=>{if(isNaN(k)){z(NaN);return}let j=Math.max(.01,Math.min(.99,k));z(Math.round(j*100)/100);},[]),Ft=react.useCallback(()=>{X(NaN),z(NaN),pe("market"),we(false),at("1h"),_t(30),lt("minutes");},[]),Vr=react.useMemo(()=>{let k=[];isNaN(P)||P<=0?b==="buy"?k.push(o("predict.trade.minAmountUsd",{amount:fr})):k.push(o("predict.trade.minQuantity",{amount:mr})):b==="buy"&&P<fr?k.push(o("predict.trade.minAmountUsd",{amount:fr})):b==="sell"&&P<mr&&k.push(o("predict.trade.minQuantity",{amount:mr})),e.status!=="open"&&k.push(o("predict.trade.marketNotActive")),b==="buy"&&ir!=null&&!isNaN(P)&&P>0&&P>ir&&k.push(o("predict.trade.insufficientBalance"));let j=S==="yes"?Wr:Ur;return b==="sell"&&j!=null&&!isNaN(P)&&P>0&&P>j&&k.push(o("predict.trade.insufficientShares")),K==="limit"&&p&&(isNaN(F)||F<.01||F>.99)&&k.push(o("predict.trade.limitPriceRange")),K==="limit"&&p&&ie&&Ue==="custom"&&(isNaN(Be)||Be<=0)&&k.push(o("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[P,e.status,b,u,ir,Wr,Ur,S,K,p,F,ie,Ue,Be,o]),{mutateAsync:lr}=reactPredict.useDFlowSubmit(),{data:jr}=reactPredict.useOrder({id:me??"",source:u},{enabled:!!me}),Zn=react.useCallback(async()=>{if(!_||!f||!m)return;let{cashAmount:k,collateral:j}=_;V(null);try{let dt=(await i.createDFlowQuote({inputMint:j,outputMint:ct,amount:k,userPublicKey:f,slippageBps:100}))?.transaction;if(!dt)return;let Je=Uint8Array.from(atob(dt),Ht=>Ht.charCodeAt(0)),Ve=await m.signTransaction(Je);await lr({signedTransaction:btoa(String.fromCharCode(...Ve)),orderContext:{user_public_key:f,input_mint:j,output_mint:ct,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,f,m,i,lr,ct]);react.useEffect(()=>{if(!jr||!me)return;let{status:k}=jr;k==="closed"?(M(null),_?Zn().finally(()=>{oe(false),ui$1.toast.success(o("predict.trade.submitSuccess")),Jr(),Ft();}):(oe(false),ui$1.toast.success(o("predict.trade.submitSuccess")),Jr(),Ft())):(k==="failed"||k==="expired")&&(oe(false),M(null),V(null),ui$1.toast.error(o("predict.trade.submitError")));},[jr,me,_,Zn,Ft,o]);let Jn=react.useCallback(async()=>{if(!f||!m)return;if(!At||!Dt){ui$1.toast.error("Missing token mint addresses"),oe(false);return}if(!or){de(true),oe(false);return}let Me=(await Qn()).data,dt=Me?.transaction;if(!dt){ui$1.toast.error(o("predict.trade.submitError")),oe(false);return}if(b==="sell"&&Ot&&Ot!==ct){let et=String(Me?.outAmount??"");et&&et!=="0"&&V({cashAmount:et,collateral:Ot});}let Je=Uint8Array.from(atob(dt),et=>et.charCodeAt(0)),Ve=await m.signTransaction(Je),Ht=await lr({signedTransaction:btoa(String.fromCharCode(...Ve)),orderContext:{user_public_key:f,input_mint:At,output_mint:Dt,amount:T,price:String(Pe),side:b==="buy"?"BUY":"SELL",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});M(Ht.signature);},[f,m,i,Qn,lr,At,Dt,T,Pe,b,S,e.slug,Ot,ct,o]),eo=react.useCallback(async()=>{if(!d||!l)return;let k=d.chain,j=k!==types.Chain.POLYGON;j&&await a(types.Chain.POLYGON);try{let Me=await d.getEip1193Provider();if(!Me){ui$1.toast.error(o("predict.trade.submitError")),oe(!1);return}let dt=!!bt,Je={address:d.address,signatureType:dt?2:0,signTypedData:async(ut,ua,pa,ma)=>{let yt=[];"name"in ut&&yt.push({name:"name",type:"string"}),"version"in ut&&yt.push({name:"version",type:"string"}),"chainId"in ut&&yt.push({name:"chainId",type:"uint256"}),"verifyingContract"in ut&&yt.push({name:"verifyingContract",type:"address"}),"salt"in ut&&yt.push({name:"salt",type:"bytes32"});let fa={EIP712Domain:yt,...ua};return await Me.request({method:"eth_signTypedData_v4",params:[d.address,JSON.stringify({domain:ut,types:fa,primaryType:pa,message:ma})]})}},Ve=l.credentials??await l.authenticate(Je),Ht=S==="yes"?0:1,et="",cr=e.provider_meta?.["polymarket.clobTokenIds"];cr&&(et=(typeof cr=="string"?JSON.parse(cr):cr)[Ht]??"");let to=e.provider_meta?.["polymarket.negRisk"]??!1,Gr=K==="limit"&&!isNaN(F)?F:Pe,oa=K==="limit"?ie?"GTD":"GTC":"FOK",sa=b==="buy"&&Gr>0?P/Gr:P,ro={tokenId:et,price:Gr,size:sa,side:b==="buy"?"BUY":"SELL",orderType:oa,tickSize:E,negRisk:to,...bt&&{funderAddress:bt},...K==="limit"&&ie&&{expiration:Ja(Ue,Be,Rt)}},ia=reactPredict.buildCtfExchangeDomain(to),no=reactPredict.buildOrderMessage({...ro,signerAddress:Je.address,signatureType:Je.signatureType}),aa=await Je.signTypedData(ia,reactPredict.CTF_ORDER_TYPES,"Order",no),la=reactPredict.buildSignedOrder(no,aa,ro.orderType),oo=reactPredict.buildClobPayload(la,Ve.apiKey),ca=JSON.stringify(oo),da=await reactPredict.buildPolymarketL2Headers(Ve.address,{apiKey:Ve.apiKey,secret:Ve.secret,passphrase:Ve.passphrase,method:"POST",requestPath:"/order",body:ca});await i.createPolymarketOrder(oo,da),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui$1.toast.success(o("predict.trade.submitSuccess")),Jr(),Ft(),oe(!1);}finally{j&&k&&a(k).catch(()=>{});}},[d,l,a,S,e.provider_meta,K,F,Pe,P,b,i,c,ie,Ue,Be,Rt,Ft,o]),na=react.useCallback(async()=>{if(!(!Vr.isValid||!g)){oe(true),M(null),de(false);try{u==="kalshi"?await Jn():await eo();}catch(k){let j=k instanceof Error?k.message:void 0;ui$1.toast.error(j||o("predict.trade.submitError")),oe(false);}}},[Vr.isValid,g,u,Jn,eo,o]);return {outcome:S,side:b,orderType:K,quantity:P,limitPrice:F,shares:$r,estimatedCost:ar,potentialPayout:Xn,potentialProfit:Ji,usdcBalance:ir,yesTokenBalance:Wr,noTokenBalance:Ur,isBalanceLoading:Zi,isSubmitting:$,validation:Vr,supportsLimitOrder:p,kycRequired:O,kycUrl:sr,expirationEnabled:ie,expirationPreset:Ue,customDuration:Be,customDurationUnit:Rt,setOutcome:It,setSide:ea,setOrderType:zr,setQuantity:ta,setLimitPrice:ra,setExpirationEnabled:we,setExpirationPreset:at,setCustomDuration:_t,setCustomDurationUnit:lt,submit:na}}function So({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 ml=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,fl=["5m","1h","12h","24h","eod","custom"],gl={"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"},hl=["minutes","hours","days"],xl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Lo({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:s,quantity:a,limitPrice:i,shares:l,potentialProfit:c,potentialPayout:u,estimatedCost:p,usdcBalance:m,yesTokenBalance:d,noTokenBalance:g,isBalanceLoading:f,isSubmitting:h,isValid:x,validationErrors:N,supportsLimitOrder:E,kycRequired:S,kycUrl:v,expirationEnabled:b,expirationPreset:H,customDuration:K,customDurationUnit:pe,onOutcomeChange:P,onSideChange:X,onOrderTypeChange:F,onQuantityChange:z,onLimitPriceChange:$,onExpirationEnabledChange:oe,onExpirationPresetChange:me,onCustomDurationChange:M,onCustomDurationUnitChange:_,onSubmit:V}){let{t:O}=i18n.useTranslation(),[de,ie]=react.useState(false),we=ui$1.useDisclosure(),[Ue,at]=react.useState(""),Be=react.useRef(false),_t=react.useRef(n);react.useEffect(()=>{Be.current||at(isNaN(a)?"":String(a));},[a]),react.useEffect(()=>{n!==_t.current&&(_t.current=n,at(""));},[n]);let Rt=react.useCallback(T=>{if(T!==""&&!(n==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(T))return;if(at(T),It(false),T===""||T==="."){z(NaN);return}let Ke=parseFloat(T);isNaN(Ke)||z(Ke);},[n,z]);react.useEffect(()=>{S&&!we.isOpen&&we.onOpen();},[S]);let lt=react.useMemo(()=>{let T=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return T!=null?parseFloat((Number(T)*100).toFixed(2)):null},[n,o,t]),Ae=!isNaN(a)&&a>0,or=react.useMemo(()=>{if(f)return O("predict.trade.loadingBalance");if(h)return O("predict.trade.submitting");if(S)return O("predict.trade.kycRequired");if(!Ae)return O("predict.trade.enterAmount");let T=O(n==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=O(o==="yes"?"predict.trade.yes":"predict.trade.no"),Ke=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${T} ${Ce}${Ke}`},[f,h,S,Ae,n,o,c,O]),sr=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),bt=()=>{z(Math.floor((m??0)/2*100)/100);},Pe=()=>{z(m??0);},[zr,It]=react.useState(false),$r=()=>{if(S){we.onOpen();return}if(!x){It(true);return}It(false),V();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui$1.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),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:o==="yes"?"text-bullish":"text-bearish",children:[O(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",O(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:[E?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:s,onSelectionChange:T=>F(T),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:O("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:O("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:O("predict.trade.market")}),s==="limit"&&E?jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(i)?void 0:parseFloat((i*100).toFixed(2)),onValueChange:T=>$(T/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits: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"}}):lt!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[lt," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(T=>{let Ce=T==="yes"?d:g;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>P(T),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===T?T==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:O(T==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Ke=n==="buy"?T==="yes"?t.yesAsk:t.noAsk:T==="yes"?t.yesBid:t.noBid;return Ke!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ke)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===T&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:f?"\u2013":`${Ce??0} shares`})]},T)})}),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:O(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:ml,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:bt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:O("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Pe,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:O("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:n==="buy"?"decimal":"numeric",value:Ue,onChange:T=>Rt(T.target.value),onFocus:()=>{Be.current=true;},onBlur:()=>{Be.current=false,at(isNaN(a)?"":String(a));},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(T=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(Math.floor((o==="yes"?d??0:g??0)*T/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[T,"%"]},T)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{z(o==="yes"?d??0:g??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:O("common.all")})]}),zr&&N.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:N.map(T=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:T},T))})]}),s==="limit"&&E&&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:O("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:oe,"aria-label":O("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":O("predict.trade.setExpiration"),selectedKeys:[H],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&me(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:fl.map(T=>jsxRuntime.jsx(ui$1.SelectItem,{children:O(gl[T])},T))}),H==="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(K)?void 0:K,onValueChange:M,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},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:[pe],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:hl.map(T=>jsxRuntime.jsx(ui$1.SelectItem,{children:O(xl[T])},T))})]})]})]}),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:()=>ie(T=>!T),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:O("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",de&&"rotate-180")})]}),lt!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[lt,"% chance"]})]}),de&&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:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?parseFloat(l.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(a)&&a>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:sr,fullWidth:true,radius:"lg",size:"lg",isDisabled:f||!Ae||h,isLoading:h||f,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:$r,children:or})]}),jsxRuntime.jsx(So,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:v})]})}function gr({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:s}){let{outcome:a,side:i,orderType:l,quantity:c,limitPrice:u,shares:p,estimatedCost:m,potentialPayout:d,potentialProfit:g,usdcBalance:f,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:N,isSubmitting:E,validation:S,supportsLimitOrder:v,kycRequired:b,kycUrl:H,expirationEnabled:K,expirationPreset:pe,customDuration:P,customDurationUnit:X,setOutcome:F,setSide:z,setOrderType:$,setQuantity:oe,setLimitPrice:me,setExpirationEnabled:M,setExpirationPreset:_,setCustomDuration:V,setCustomDurationUnit:O,submit:de}=ko({market:t,initialSide:o,initialOutcome:n}),ie=walletConnector.useAuthCallback(de),we=react.useMemo(()=>e?mo(e):void 0,[e]),Ue=react.useMemo(()=>fo(t),[t]);return jsxRuntime.jsx(Lo,{event:we,market:Ue,variant:r,outcome:a,side:i,orderType:l,quantity:c,limitPrice:u,shares:p,estimatedCost:m,potentialPayout:d,potentialProfit:g,usdcBalance:f,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:N,isSubmitting:E,isValid:S.isValid,validationErrors:S.errors,supportsLimitOrder:v,kycRequired:b,kycUrl:H,expirationEnabled:K,expirationPreset:pe,customDuration:P,customDurationUnit:X,onOutcomeChange:F,onSideChange:z,onOrderTypeChange:$,onQuantityChange:oe,onLimitPriceChange:me,onExpirationEnabledChange:M,onExpirationPresetChange:_,onCustomDurationChange:V,onCustomDurationUnitChange:O,onSubmit:ie})}var zt="predict-trade";function hr({id:e=zt}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Pl,{...t})})}function Pl({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:"blur",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(gr,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,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 nn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function on(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Ro({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[s,a]=react.useState(r),i=react.useCallback(h=>{h?a(r):t();},[r,t]),l=react.useCallback(()=>{a(nn);},[]),c=react.useCallback(()=>{o(s),t();},[s,o,t]),u=react.useCallback((h,x)=>{a(N=>({...N,[h]:x}));},[]),p=react.useMemo(()=>on(s),[s]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),d=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:i,size:"md",backdrop:"blur",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:n("predict.filter.title")}),jsxRuntime.jsx(_l,{onClick:()=>i(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(vr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(br,{options:m,selected:s.source,onSelect:h=>u("source",h)})}),jsxRuntime.jsx(vr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(br,{options:d,selected:s.timeRemaining,onSelect:h=>u("timeRemaining",h)})}),jsxRuntime.jsx(vr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(br,{options:g,selected:s.minVolume,onSelect:h=>u("minVolume",h)})}),jsxRuntime.jsx(vr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(br,{options:f,selected:s.minLiquidity,onSelect:h=>u("minLiquidity",h)})})]}),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:l,children:n("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:c,children:[n("predict.filter.showResults"),p>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",p,")"]})]})]})]})})})}function vr({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 _l({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 br({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 s=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(s&&o?void 0:n.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:s?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:s?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:s?"#c7ff2e":"#a1a1aa"},onMouseEnter:a=>{s||(a.currentTarget.style.background="rgba(39,39,42,0.8)",a.currentTarget.style.color="#fff");},onMouseLeave:a=>{s||(a.currentTarget.style.background="rgba(39,39,42,0.4)",a.currentTarget.style.color="#a1a1aa");},children:n.label},n.value??"__all")})})}var Fo={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Oo={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},zl=["start_time","volume","liquidity","ending_soon"],Ao={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"},$l={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 Ho({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:s=0,className:a}){let{t:i}=i18n.useTranslation(),[l,c]=react.useState(false),u=react.useRef(null),p=react.useCallback(d=>{u.current&&!u.current.contains(d.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)),[p]),react.useEffect(()=>{if(!l)return;let d=g=>{g.key==="Escape"&&c(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let m=Do[e];return jsxRuntime.jsxs("div",{className:a,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:u,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ao,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(d=>!d),children:[jsxRuntime.jsx(Wl,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:i(Oo[e])}),jsxRuntime.jsx(Kl,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...$l,width:224,padding:4},children:zl.map(d=>{let g=Do[d],f=e===d;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:f?"rgba(199,255,46,0.08)":"transparent",color:f?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:h=>{f||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{f||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?o(!r):t(d),c(false);},children:[jsxRuntime.jsx(g,{className:"size-4 shrink-0",style:{color:f?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:i(Oo[d])}),f&&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"})})]},d)})})]}),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:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.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:Ao,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:n,children:[jsxRuntime.jsx(Ul,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:i("predict.filter.title")})]}),s>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:s})]})]})}var Do={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function Wl(){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 Ul(){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 Kl({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 $o(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]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:s,isError:a,error:i,hasNextPage:l,fetchNextPage:c,refetch:u}=reactPredict.useInfiniteEvents(t),p=react.useMemo(()=>r?.pages.flatMap(g=>g.items).filter(g=>g!=null)??[],[r]),m=react.useCallback(()=>{c();},[c]),d=react.useCallback(()=>{u();},[u]);return {data:p,isLoading:o,isFetching:n&&!s,isFetchingMore:s,isError:a,error:i??null,hasMore:l??false,fetchMore:m,refetch:d}}var Wo="@keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}@media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}}@media(max-width:767px){.evt-skel-grid{grid-template-columns:1fr!important}}";function sn({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Wo}),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(Gl,{index:r},r))})]})}function Gl({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:`evtShimmer 1.8s ease-in-out infinite ${e*120}ms`,borderRadius:6},o=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",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 Wg({count:e=48}){let t={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};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",maxWidth:1680,margin:"0 auto",gap:12},children:[jsxRuntime.jsx("style",{children:Wo}),jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:[48,64,48,56,72,56].map((r,o)=>jsxRuntime.jsx("div",{style:{...t,height:24,width:r}},o))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,minHeight:36},children:[jsxRuntime.jsx("div",{style:{...t,height:32,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...t,height:32,width:32,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...t,height:32,width:80,borderRadius:10}})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0},children:jsxRuntime.jsx(sn,{count:e})})]})}var Uo=3,rc={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)"}},nc={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},ln={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Yo={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},oc={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Wt=[{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 Ko(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 sc(e){let t=e.outcomes?.map(a=>a.label?.toLowerCase().trim()??"")??[];if(t.some(a=>a==="up")&&t.some(a=>a==="down"))return [ln,oc];if(t.some(a=>a==="yes")&&t.some(a=>a==="no"))return [ln,Yo];let r=t[0]??"",o=t[1]??"",n=Ko(r)%Wt.length,s=Ko(o)%Wt.length;return s===n&&(s=(s+1)%Wt.length),[Wt[n],Wt[s]]}function ic(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function qo(e){let t=ic(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Qo(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Vo(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function jo(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 ac(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),s=[];return r>0&&s.push(`${r}d`),o>0&&s.push(`${o}h`),s.push(`${n}m`),s.join(" ")}var lc=`
1
+ 'use strict';var react=require('react'),reactPredict=require('@liberfi.io/react-predict'),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'),rn=require('canvas-confetti'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rn__default=/*#__PURE__*/_interopDefault(rn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.119");var ks="0.1.119";var Ss={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},lo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zr=(()=>{let e=t=>{let r=lo.indexOf(t);return r===-1?lo.length:r};return Object.entries(Ss).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 uo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),p=react.useCallback(()=>{n(null);},[n]),u=c("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",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(co,{label:u,isSelected:t===null,onPress:p,showPulse:u===l}),jsxRuntime.jsx(Cs,{}),e.map(m=>jsxRuntime.jsx(co,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===l},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(po,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(po,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function co({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 Cs(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function po({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 wf({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 Ms(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Es(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function go({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,s]=react.useState(null),l=react.useCallback(m=>{n(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),a=react.useCallback(m=>{s(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),c=Ms(Zr),p=Zr.find(m=>m.slug===o),u=Es(p);return jsxRuntime.jsx(uo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function ho(e){return {title:e.title,imageUrl:e.image_url}}function vo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Wt=48,Jr=4,fr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},gr=Ee.ALL,Rf={[Ee.ONE_DAY]:fr.ONE_MINUTE,[Ee.ONE_WEEK]:fr.ONE_HOUR,[Ee.ONE_MONTH]:fr.ONE_HOUR,[Ee.ALL]:fr.ONE_DAY},If={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},Of={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},hr=1,vr=1,Af=1,Df=1,Ff=99,Pt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Bf=Pt.ONE_WEEK,Hf={[Pt.ONE_HOUR]:60,[Pt.SIX_HOURS]:60,[Pt.ONE_DAY]:300,[Pt.ONE_WEEK]:1800,[Pt.MAX]:1800};var yo=react.createContext(null);function tn(){let e=react.useContext(yo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var As=1e4;function Ds({pollingInterval:e=As,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[o]),{data:s,isLoading:l,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:p,isLoading:u}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:m,isLoading:d}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:h,isLoading:v,isFetching:N,error:M}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),w=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:d,isLoading:l||v,isFetching:a||N,error:c??M??null}),[n,i,f,s,h,g,p,u,m,d,l,v,a,N,c,M]);return jsxRuntime.jsx(yo.Provider,{value:w,children:r})}var ol={minutes:60,hours:3600,days:86400};function il(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*ol[r]}}function nn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};rn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function No({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),p=e.source,u=p==="polymarket",m=i.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),d=i.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),f=n==="authenticated",g=m?.address,h=d?.address,v=react.useMemo(()=>{if(p!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[p,e.provider_meta]),{data:N}=reactPredict.useTickSize(v),M=N?.minimum_tick_size?String(N.minimum_tick_size):"0.01",[w,x]=react.useState(t),[b,E]=react.useState(r),[z,se]=react.useState("market"),[A,ve]=react.useState(NaN),[I,H]=react.useState(NaN),[$,J]=react.useState(false),[ie,C]=react.useState(null),[_,G]=react.useState(null),[D,pe]=react.useState(false),[le,we]=react.useState(false),[Ge,pt]=react.useState("1h"),[Ke,Ot]=react.useState(30),[At,ut]=react.useState("minutes"),Be=null,sr=false,lr=null,wt;try{let k=tn();Be={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},sr=k.kalshiKycVerified,lr=k.kalshiKycUrl,wt=k.polymarketSafeAddress;}catch{}let Pe=react.useMemo(()=>{let k=w==="yes"?0:1,q=e.outcomes[k];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,w,b]),Kr=react.useCallback(k=>{se(k);},[]),Dt=react.useCallback(k=>{x(k),H(NaN);},[]);react.useEffect(()=>{z==="limit"&&isNaN(I)&&H(Math.round(Pe*100)/100);},[z,I,Pe]);let Vr=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Pe>0?A/Pe:0:A,[b,A,Pe]),T=react.useMemo(()=>isNaN(A)||A<=0?"0":String(Math.round(A*1e6)),[A]),Ce=e.provider_meta?.["dflow.yesMint"]??"",qe=e.provider_meta?.["dflow.noMint"]??"",mt=utils.SOLANA_TOKENS.stablecoins.USDC.address,es=e.provider_meta?.["dflow.collateralMint"]||"",Qn=w==="yes"?Ce:qe,Xn=p==="kalshi"?g??"":h??"",{data:De,isLoading:ts}=reactPredict.usePositions({source:p,user:Xn},{enabled:!!Xn}),Zn=react.useMemo(()=>!De||b!=="sell"?null:De.positions.find(k=>k.side?.toLowerCase()===w&&k.market?.slug===e.slug)??null,[De,e.slug,w,b])?.market?.provider_meta,rs=b==="sell"&&Zn?.["dflow.outcomeMint"]||Qn,Ft=b==="sell"&&Zn?.["dflow.collateralMint"]||es,Bt=b==="buy"?mt:rs,Ht=b==="buy"?Qn:Ft||mt,ns=p==="kalshi"&&!!Bt&&!!Ht&&!!g&&T!=="0",{refetch:Jn}=reactPredict.useDFlowQuote({inputMint:Bt,outputMint:Ht,amount:T,userPublicKey:g??"",slippageBps:100},{enabled:ns}),cr=react.useMemo(()=>Be?p==="kalshi"?Be.kalshiUsdcBalance:Be.polymarketUsdcBalance:De&&De.positions.reduce((q,Me)=>Me.side==="USDC"||Me.side==="collateral"?q+(Me.current_value??0):q,0)||null,[Be,De,p]),os=Be?Be.isLoading:ts,jr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Yr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Gr=react.useMemo(()=>z==="limit"&&u&&!isNaN(I)?I:Pe,[z,u,I,Pe]),dr=react.useMemo(()=>{if(isNaN(A)||A<=0)return 0;if(b==="buy")return A;let k=w==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return A*k},[b,w,A,e.outcomes]),eo=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Gr>0?A/Gr*1:0:dr,[b,A,Gr,dr]),is=eo-dr,as=react.useCallback(k=>{E(k),ve(NaN);},[]),ss=react.useCallback(k=>{if(isNaN(k)){ve(NaN);return}let q=Math.max(0,k),Me=b==="buy"?Math.round(q*100)/100:Math.round(q);ve(Me);},[b]),ls=react.useCallback(k=>{if(isNaN(k)){H(NaN);return}let q=Math.max(.01,Math.min(.99,k));H(Math.round(q*100)/100);},[]),zt=react.useCallback(()=>{ve(NaN),H(NaN),se("market"),we(false),pt("1h"),Ot(30),ut("minutes");},[]),qr=react.useMemo(()=>{let k=[];isNaN(A)||A<=0?b==="buy"?k.push(o("predict.trade.minAmountUsd",{amount:vr})):k.push(o("predict.trade.minQuantity",{amount:hr})):b==="buy"&&A<vr?k.push(o("predict.trade.minAmountUsd",{amount:vr})):b==="sell"&&A<hr&&k.push(o("predict.trade.minQuantity",{amount:hr})),e.status!=="open"&&k.push(o("predict.trade.marketNotActive")),b==="buy"&&cr!=null&&!isNaN(A)&&A>0&&A>cr&&k.push(o("predict.trade.insufficientBalance"));let q=w==="yes"?jr:Yr;return b==="sell"&&q!=null&&!isNaN(A)&&A>0&&A>q&&k.push(o("predict.trade.insufficientShares")),z==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&k.push(o("predict.trade.limitPriceRange")),z==="limit"&&u&&le&&Ge==="custom"&&(isNaN(Ke)||Ke<=0)&&k.push(o("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[A,e.status,b,p,cr,jr,Yr,w,z,u,I,le,Ge,Ke,o]),{mutateAsync:pr}=reactPredict.useDFlowSubmit(),{data:Qr}=reactPredict.useOrder({id:ie??"",source:p},{enabled:!!ie}),to=react.useCallback(async()=>{if(!_||!g||!m)return;let{cashAmount:k,collateral:q}=_;G(null);try{let ft=(await l.createDFlowQuote({inputMint:q,outputMint:mt,amount:k,userPublicKey:g,slippageBps:100}))?.transaction;if(!ft)return;let nt=Uint8Array.from(atob(ft),$t=>$t.charCodeAt(0)),Qe=await m.signTransaction(nt);await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:q,output_mint:mt,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,g,m,l,pr,mt]);react.useEffect(()=>{if(!Qr||!ie)return;let{status:k}=Qr;k==="closed"?(C(null),_?to().finally(()=>{J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt();}):(J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt())):(k==="failed"||k==="expired")&&(J(false),C(null),G(null),ui.toast.error(o("predict.trade.submitError")));},[Qr,ie,_,to,zt,o]);let ro=react.useCallback(async()=>{if(!g||!m)return;if(!Bt||!Ht){ui.toast.error("Missing token mint addresses"),J(false);return}if(!sr){pe(true),J(false);return}let Me=(await Jn()).data,ft=Me?.transaction;if(!ft){ui.toast.error(o("predict.trade.submitError")),J(false);return}if(b==="sell"&&Ft&&Ft!==mt){let ot=String(Me?.outAmount??"");ot&&ot!=="0"&&G({cashAmount:ot,collateral:Ft});}let nt=Uint8Array.from(atob(ft),ot=>ot.charCodeAt(0)),Qe=await m.signTransaction(nt),$t=await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:Bt,output_mint:Ht,amount:T,price:String(Pe),side:b==="buy"?"BUY":"SELL",outcome:w==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});C($t.signature);},[g,m,l,Jn,pr,Bt,Ht,T,Pe,b,w,e.slug,Ft,mt,o]),no=react.useCallback(async()=>{if(!d||!a)return;let k=d.chain,q=k!==types.Chain.POLYGON;q&&await s(types.Chain.POLYGON);try{let Me=await d.getEip1193Provider();if(!Me){ui.toast.error(o("predict.trade.submitError")),J(!1);return}let ft=!!wt,nt={address:d.address,signatureType:ft?2:0,signTypedData:async(gt,vs,xs,bs)=>{let Nt=[];"name"in gt&&Nt.push({name:"name",type:"string"}),"version"in gt&&Nt.push({name:"version",type:"string"}),"chainId"in gt&&Nt.push({name:"chainId",type:"uint256"}),"verifyingContract"in gt&&Nt.push({name:"verifyingContract",type:"address"}),"salt"in gt&&Nt.push({name:"salt",type:"bytes32"});let ys={EIP712Domain:Nt,...vs};return await Me.request({method:"eth_signTypedData_v4",params:[d.address,JSON.stringify({domain:gt,types:ys,primaryType:xs,message:bs})]})}},Qe=a.credentials??await a.authenticate(nt),$t=w==="yes"?0:1,ot="",ur=e.provider_meta?.["polymarket.clobTokenIds"];ur&&(ot=(typeof ur=="string"?JSON.parse(ur):ur)[$t]??"");let oo=e.provider_meta?.["polymarket.negRisk"]??!1,Xr=z==="limit"&&!isNaN(I)?I:Pe,ds=z==="limit"?le?"GTD":"GTC":"FOK",ps=b==="buy"&&Xr>0?A/Xr:A,io={tokenId:ot,price:Xr,size:ps,side:b==="buy"?"BUY":"SELL",orderType:ds,tickSize:M,negRisk:oo,...wt&&{funderAddress:wt},...z==="limit"&&le&&{expiration:il(Ge,Ke,At)}},us=reactPredict.buildCtfExchangeDomain(oo),ao=reactPredict.buildOrderMessage({...io,signerAddress:nt.address,signatureType:nt.signatureType}),ms=await nt.signTypedData(us,reactPredict.CTF_ORDER_TYPES,"Order",ao),fs=reactPredict.buildSignedOrder(ao,ms,io.orderType),so=reactPredict.buildClobPayload(fs,Qe.apiKey),gs=JSON.stringify(so),hs=await reactPredict.buildPolymarketL2Headers(Qe.address,{apiKey:Qe.apiKey,secret:Qe.secret,passphrase:Qe.passphrase,method:"POST",requestPath:"/order",body:gs});await l.createPolymarketOrder(so,hs),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt(),J(!1);}finally{q&&k&&s(k).catch(()=>{});}},[d,a,s,w,e.provider_meta,z,I,Pe,A,b,l,c,le,Ge,Ke,At,zt,o]),cs=react.useCallback(async()=>{if(!(!qr.isValid||!f)){J(true),C(null),pe(false);try{p==="kalshi"?await ro():await no();}catch(k){let q=k instanceof Error?k.message:void 0;ui.toast.error(q||o("predict.trade.submitError")),J(false);}}},[qr.isValid,f,p,ro,no,o]);return {outcome:w,side:b,orderType:z,quantity:A,limitPrice:I,shares:Vr,estimatedCost:dr,potentialPayout:eo,potentialProfit:is,usdcBalance:cr,yesTokenBalance:jr,noTokenBalance:Yr,isBalanceLoading:os,isSubmitting:$,validation:qr,supportsLimitOrder:u,kycRequired:D,kycUrl:lr,expirationEnabled:le,expirationPreset:Ge,customDuration:Ke,customDurationUnit:At,setOutcome:Dt,setSide:as,setOrderType:Kr,setQuantity:ss,setLimitPrice:ls,setExpirationEnabled:we,setExpirationPreset:pt,setCustomDuration:Ot,setCustomDurationUnit:ut,submit:cs}}function Po({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 bl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,yl=["5m","1h","12h","24h","eod","custom"],kl={"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"},Sl=["minutes","hours","days"],wl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Io({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:c,potentialPayout:p,estimatedCost:u,usdcBalance:m,yesTokenBalance:d,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:v,validationErrors:N,supportsLimitOrder:M,kycRequired:w,kycUrl:x,expirationEnabled:b,expirationPreset:E,customDuration:z,customDurationUnit:se,onOutcomeChange:A,onSideChange:ve,onOrderTypeChange:I,onQuantityChange:H,onLimitPriceChange:$,onExpirationEnabledChange:J,onExpirationPresetChange:ie,onCustomDurationChange:C,onCustomDurationUnitChange:_,onSubmit:G}){let{t:D}=i18n.useTranslation(),[pe,le]=react.useState(false),we=ui.useDisclosure(),[Ge,pt]=react.useState(""),Ke=react.useRef(false),Ot=react.useRef(n);react.useEffect(()=>{Ke.current||pt(isNaN(s)?"":String(s));},[s]),react.useEffect(()=>{n!==Ot.current&&(Ot.current=n,pt(""));},[n]);let At=react.useCallback(T=>{if(T!==""&&!(n==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(T))return;if(pt(T),Dt(false),T===""||T==="."){H(NaN);return}let qe=parseFloat(T);isNaN(qe)||H(qe);},[n,H]);react.useEffect(()=>{w&&!we.isOpen&&we.onOpen();},[w]);let ut=react.useMemo(()=>{let T=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return T!=null?parseFloat((Number(T)*100).toFixed(2)):null},[n,o,t]),Be=!isNaN(s)&&s>0,sr=react.useMemo(()=>{if(g)return D("predict.trade.loadingBalance");if(h)return D("predict.trade.submitting");if(w)return D("predict.trade.kycRequired");if(!Be)return D("predict.trade.enterAmount");let T=D(n==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=D(o==="yes"?"predict.trade.yes":"predict.trade.no"),qe=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${T} ${Ce}${qe}`},[g,h,w,Be,n,o,c,D]),lr=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),wt=()=>{H(Math.floor((m??0)/2*100)/100);},Pe=()=>{H(m??0);},[Kr,Dt]=react.useState(false),Vr=()=>{if(w){we.onOpen();return}if(!v){Dt(true);return}Dt(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),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:o==="yes"?"text-bullish":"text-bearish",children:[D(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",D(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:[M?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:T=>I(T),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:D("predict.trade.market")}),i==="limit"&&M?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:T=>$(T/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits: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"}}):ut!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ut," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(T=>{let Ce=T==="yes"?d:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(T),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===T?T==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:D(T==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let qe=n==="buy"?T==="yes"?t.yesAsk:t.noAsk:T==="yes"?t.yesBid:t.noBid;return qe!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(qe)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===T&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${Ce??0} shares`})]},T)})}),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:D(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:bl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:wt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Pe,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:n==="buy"?"decimal":"numeric",value:Ge,onChange:T=>At(T.target.value),onFocus:()=>{Ke.current=true;},onBlur:()=>{Ke.current=false,pt(isNaN(s)?"":String(s));},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(T=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(Math.floor((o==="yes"?d??0:f??0)*T/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[T,"%"]},T)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{H(o==="yes"?d??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:D("common.all")})]}),Kr&&N.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:N.map(T=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:T},T))})]}),i==="limit"&&M&&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:D("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:J,"aria-label":D("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":D("predict.trade.setExpiration"),selectedKeys:[E],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&ie(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:yl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(kl[T])},T))}),E==="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:C,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},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:[se],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Sl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(wl[T])},T))})]})]})]}),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:()=>le(T=>!T),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:D("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",pe&&"rotate-180")})]}),ut!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[ut,"% chance"]})]}),pe&&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:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(s)&&s>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:lr,fullWidth:true,radius:"lg",size:"lg",isDisabled:g||!Be||h,isLoading:h||g,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:Vr,children:sr})]}),jsxRuntime.jsx(Po,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:x})]})}function xr({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:i}){let{outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,validation:w,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,setOutcome:I,setSide:H,setOrderType:$,setQuantity:J,setLimitPrice:ie,setExpirationEnabled:C,setExpirationPreset:_,setCustomDuration:G,setCustomDurationUnit:D,submit:pe}=No({market:t,initialSide:o,initialOutcome:n}),le=walletConnector.useAuthCallback(pe),we=react.useMemo(()=>e?ho(e):void 0,[e]),Ge=react.useMemo(()=>vo(t),[t]);return jsxRuntime.jsx(Io,{event:we,market:Ge,variant:r,outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,isValid:w.isValid,validationErrors:w.errors,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,onOutcomeChange:I,onSideChange:H,onOrderTypeChange:$,onQuantityChange:J,onLimitPriceChange:ie,onExpirationEnabledChange:C,onExpirationPresetChange:_,onCustomDurationChange:G,onCustomDurationUnitChange:D,onSubmit:le})}var Ut="predict-trade";function br({id:e=Ut}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_l,{...t})})}function _l({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:"blur",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(xr,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,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 ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function cn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Ao({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(h=>{h?s(r):t();},[r,t]),a=react.useCallback(()=>{s(ln);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),p=react.useCallback((h,v)=>{s(N=>({...N,[h]:v}));},[]),u=react.useMemo(()=>cn(i),[i]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),d=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,size:"md",backdrop:"blur",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:n("predict.filter.title")}),jsxRuntime.jsx(Fl,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(kr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(Sr,{options:m,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Sr,{options:d,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(Sr,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Sr,{options:g,selected:i.minLiquidity,onSelect:h=>p("minLiquidity",h)})})]}),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:a,children:n("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:c,children:[n("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function kr({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 Fl({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 Sr({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")})})}function Do(e){return e>=1e9?`$${(e/1e9).toFixed(1)}B`:e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}var Hl=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>e.toLocaleString(),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:Do,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:Do,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=>e.toLocaleString(),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function Fo({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
2
+ @keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
3
+ @keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
4
+ @keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
5
+ @keyframes evtStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
6
+ @keyframes evtStatCardEnter{from{opacity:0;transform:translateY(8px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}
7
+
8
+ .evt-hero-outer{display:flex;flex-direction:column;align-items:center;text-align:center;gap:28px}
9
+ @media(min-width:640px){.evt-hero-outer{flex-direction:row;align-items:center;text-align:left;gap:40px}}
10
+ @media(min-width:1024px){.evt-hero-outer{gap:56px}}
11
+
12
+ .evt-hero-left{display:flex;flex-direction:column;align-items:center}
13
+ @media(min-width:640px){.evt-hero-left{align-items:flex-start}}
14
+
15
+ .evt-hero-live{display:flex;justify-content:center}
16
+ @media(min-width:640px){.evt-hero-live{justify-content:flex-start}}
17
+
18
+ .evt-hero-subtitle-text{text-align:center;margin:0 auto}
19
+ @media(min-width:640px){.evt-hero-subtitle-text{text-align:left;margin:0}}
20
+
21
+ .evt-hero-title{font-size:32px!important;line-height:1.2!important}
22
+ @media(min-width:640px){.evt-hero-title{font-size:38px!important}}
23
+ @media(min-width:1024px){.evt-hero-title{font-size:46px!important}}
24
+
25
+ .evt-hero-subtitle{font-size:14px}
26
+ @media(min-width:640px){.evt-hero-subtitle{font-size:15px}}
27
+
28
+ .evt-stat-grid{display:grid;grid-template-columns:repeat(2,1fr);width:100%;max-width:360px;border-radius:16px;border:1px solid rgba(39,39,42,0.5);overflow:hidden;flex-shrink:0;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
29
+ @media(min-width:640px){.evt-stat-grid{width:340px;max-width:none}}
30
+ @media(min-width:1024px){.evt-stat-grid{width:380px}}
31
+
32
+ .evt-stat-val{font-size:18px;line-height:24px;min-height:24px}
33
+ @media(min-width:640px){.evt-stat-val{font-size:20px;line-height:28px;min-height:28px}}
34
+ @media(min-width:1024px){.evt-stat-val{font-size:22px;line-height:30px;min-height:30px}}
35
+
36
+ .evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
37
+ @media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
38
+ `}),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(`
39
+ `).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:Hl.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))})]})]})}var Wo={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Ho={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ql=["start_time","volume","liquidity","ending_soon"],zo={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"},Ql={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 Uo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:i=0,className:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),p=react.useRef(null),u=react.useCallback(d=>{p.current&&!p.current.contains(d.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)),[u]),react.useEffect(()=>{if(!a)return;let d=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a]);let m=$o[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:p,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:zo,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(d=>!d),children:[jsxRuntime.jsx(Xl,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(Ho[e])}),jsxRuntime.jsx(Jl,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...Ql,width:224,padding:4},children:ql.map(d=>{let f=$o[d],g=e===d;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:h=>{g||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{g||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?o(!r):t(d),c(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:l(Ho[d])}),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"})})]},d)})})]}),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:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.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:zo,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:n,children:[jsxRuntime.jsx(Zl,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l("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 $o={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Xl(){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 Zl(){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 Jl({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 jo(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]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:s,error:l,hasNextPage:a,fetchNextPage:c,refetch:p}=reactPredict.useInfiniteEvents(t),u=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{c();},[c]),d=react.useCallback(()=>{p();},[p]);return {data:u,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:m,refetch:d}}var Yo=`
40
+ @keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
41
+ @media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
42
+ @media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
43
+ @media(max-width:767px){.evt-skel-grid{grid-template-columns:1fr!important}}
44
+ .evt-skel-hero-outer{display:flex;flex-direction:column;align-items:center;gap:28px}
45
+ @media(min-width:640px){.evt-skel-hero-outer{flex-direction:row;align-items:center;gap:40px}}
46
+ @media(min-width:1024px){.evt-skel-hero-outer{gap:56px}}
47
+ .evt-skel-hero-left{display:flex;flex-direction:column;align-items:center}
48
+ @media(min-width:640px){.evt-skel-hero-left{align-items:flex-start}}
49
+ .evt-skel-stat-grid{display:grid;grid-template-columns:repeat(2,1fr);width:100%;max-width:360px;border-radius:16px;border:1px solid rgba(39,39,42,0.5);overflow:hidden;flex-shrink:0}
50
+ @media(min-width:640px){.evt-skel-stat-grid{width:340px;max-width:none}}
51
+ @media(min-width:1024px){.evt-skel-stat-grid{width:380px}}
52
+ .evt-skel-hero-wrap{padding:40px 16px 32px}
53
+ @media(min-width:640px){.evt-skel-hero-wrap{padding:48px 24px 40px}}
54
+ @media(min-width:1024px){.evt-skel-hero-wrap{padding:52px 32px 44px}}
55
+ `,Go={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 He(e){return {...Go,animationDelay:`${e}ms`}}function dn({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Yo}),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(rc,{index:r},r))})]})}function rc({index:e}){let t=e*120,r={...Go,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 nc(){return jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)",width:"100vw",marginLeft:"calc(-50vw + 50%)"},children:[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",pointerEvents:"none"}}),jsxRuntime.jsx("div",{className:"evt-skel-hero-wrap",style:{position:"relative",zIndex:1,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsxs("div",{className:"evt-skel-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-skel-hero-left",style:{minWidth:0,flex:1,gap:16},children:[jsxRuntime.jsx("div",{style:{...He(0),width:120,height:28,borderRadius:9999}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...He(50),width:280,height:28,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...He(80),width:200,height:28,borderRadius:8}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...He(120),height:14,width:360,maxWidth:"100%"}}),jsxRuntime.jsx("div",{style:{...He(150),height:14,width:300,maxWidth:"100%"}})]})]}),jsxRuntime.jsx("div",{className:"evt-skel-stat-grid",children:[0,1,2,3].map(e=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:"rgba(255,255,255,0.02)",borderRight:e%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:e<2?"1px solid rgba(39,39,42,0.4)":"none"},children:[jsxRuntime.jsx("div",{style:{...He(200+e*60),height:22,width:56,borderRadius:4}}),jsxRuntime.jsx("div",{style:{...He(230+e*60),height:14,width:64,borderRadius:4,marginTop:4}})]},e))})]})})]})}function oc(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:"1px solid rgba(39,39,42,0.3)",background:"rgba(10,10,11,0.8)"},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:{...He(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:{...He(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...He(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...He(100),height:36,width:80,borderRadius:10}})]})]})}function Gg({count:e=48}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Yo}),jsxRuntime.jsx(nc,{}),jsxRuntime.jsx(oc,{}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(dn,{count:e})})]})}var qo=3,mc={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)"}},fc={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},un={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},ei={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},gc={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Vt=[{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 Qo(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 hc(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [un,gc];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [un,ei];let r=t[0]??"",o=t[1]??"",n=Qo(r)%Vt.length,i=Qo(o)%Vt.length;return i===n&&(i=(i+1)%Vt.length),[Vt[n],Vt[i]]}function vc(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function ti(e){let t=vc(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function ri(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Xo(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Zo(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 xc(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 bc=`
2
56
  .badge-shine { position: relative; overflow: hidden; }
3
57
  .badge-shine::after {
4
58
  content: "";
@@ -16,13 +70,25 @@
16
70
  60% { transform: translate(200%); }
17
71
  100% { transform: translate(200%); }
18
72
  }
19
- `;function Xo({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:s}){let[a,i]=react.useState(null),l=e.markets??[],u=react.useMemo(()=>l.length>2?[...l].sort((v,b)=>(b.outcomes?.[0]?.price??0)-(v.outcomes?.[0]?.price??0)):l,[l]).filter(v=>v.status==="open"),p=u.length===1,m=u.slice(0,Uo),d=u.length-Uo,g=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),f=a?u.find(v=>v.slug===a)??null:null,h=!!f||p,x=()=>{h||o?.(e);},N=v=>{v.stopPropagation(),f&&(v.preventDefault(),i(null));},E=v=>{v.stopPropagation(),t||(v.preventDefault(),o?.(e));},S=p?jsxRuntime.jsx(yc,{event:e,formattedVolume:g,href:t,LinkComponent:r,onSelect:o}):f?jsxRuntime.jsx(Sc,{onCollapse:()=>i(null)}):jsxRuntime.jsx(hc,{moreCount:d,formattedVolume:g,source:e.source,href:t,LinkComponent:r,onShowMore:E});return jsxRuntime.jsxs("div",{className:"group",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:h?void 0:"pointer"},onMouseEnter:v=>{let b=v.currentTarget,H=rc[e.source]??nc;b.style.borderColor=H.border,b.style.boxShadow=H.shadow,s?.(e);},onMouseLeave:v=>{let b=v.currentTarget;b.style.borderColor="rgba(39,39,42,0.6)",b.style.boxShadow="none";},onClick:x,children:[jsxRuntime.jsx("style",{children:lc}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(cc,{event:e,href:t,LinkComponent:r,onClick:N,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:p?jsxRuntime.jsx(bc,{market:u[0],event:e,onSelectOutcome:n}):f?jsxRuntime.jsx(kc,{market:f,event:e,onCollapse:()=>i(null),onSelectOutcome:n}):jsxRuntime.jsx(gc,{displayedMarkets:m,onMarketClick:v=>i(v.slug)})})]}),jsxRuntime.jsx(xc,{children:S})]})}function cc({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let s=e.start_at?ac(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}),s&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",s]})]}),jsxRuntime.jsx(uc,{event:e})]})}function dc(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(),s=300*1e3,a=900*1e3;if(n>0&&n<=a){let i=n<=s?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=s?"5m":"15m",color:i});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function uc({event:e}){let t=react.useMemo(()=>dc(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(pc,{},o);case "crypto-short":return jsxRuntime.jsx(mc,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(fc,{},o)}})})}function pc(){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 mc({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 fc(){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 gc({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=qo(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:Qo(o)}),jsxRuntime.jsx(vc,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function hc({moreCount:e,formattedVolume:t,source:r,href:o,LinkComponent:n,onShowMore:s}){let{t:a}=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:s,children:[a("predict.event.showMore"),jsxRuntime.jsx(Jo,{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," ",a("predict.event.volume"),jsxRuntime.jsx(es,{source:r})]})]})}function xc({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 Go({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:i=>{let l=i.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:i=>{let l=i.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:o,children:n})}function Zo({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:s}=i18n.useTranslation(),[a,i]=o?sc(e):[ln,Yo],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&l===c?"action":n,p=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Vo(e)}\xA2`:s("predict.market.action.yes",{price:Vo(e)}),m=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${jo(e)}\xA2`:s("predict.market.action.no",{price:jo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Go,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:p}),jsxRuntime.jsx(Go,{bgColor:i.bg,textColor:i.text,shadowColor:i.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:m})]})}function vc(){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 bc({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Zo,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function yc({event:e,formattedVolume:t,href:r,LinkComponent:o,onSelect:n}){let{t:s}=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:i=>{i.stopPropagation(),r||(i.preventDefault(),n?.(e));},children:[s("predict.event.viewEvent"),jsxRuntime.jsx(Jo,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",s("predict.event.volume"),jsxRuntime.jsx(es,{source:e.source})]})]})}function kc({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let n=qo(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:s=>{s.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:Qo(n)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Zo,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]})}function Sc({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(wc,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function Jo({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 wc({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 es({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 Tc=768,rs=1024,Lc=1280,_c=8,Rc=224,Ic=304,Oc=114;function Ac(e){return e>=Lc?4:e>=rs?3:e>=Tc?2:1}function Dc(e){return e>=rs?Ic:Rc}function ns({events:e,hasMore:t=false,onFetchMore:r,onSelect:o,onSelectOutcome:n,getEventHref:s,LinkComponent:a,onHover:i}){let l=react.useRef(null),c=react.useRef(null),{width:u=0,height:p=0}=hooks.useResizeObserver({ref:l}),m=Ac(u),d=Dc(u),g=Math.ceil(e.length/m)||0,f=!t&&e.length>0,h=g+(t?1:0)+(f?1:0),x=react.useCallback(v=>v<g,[g]),N=react.useCallback(async()=>{r?.();},[r]),E=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:x,loadMoreRows:N,rowCount:h,threshold:3}),S=react.useCallback(()=>{c.current?.scrollToRow({index:0,behavior:"smooth"});},[]);return jsxRuntime.jsxs("div",{ref:l,className:"@container w-full h-full",children:[jsxRuntime.jsx("style",{children:"@keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}"}),p>0&&jsxRuntime.jsx(reactWindow.List,{listRef:c,className:"no-scrollbar",style:{height:p},onRowsRendered:E,rowComponent:Fc,rowCount:h,rowHeight:v=>f&&v===h-1?Oc:(d),rowProps:{events:e,columnCount:m,dataRowCount:g,showEndOfList:f,totalRowCount:h,onSelect:o,onSelectOutcome:n,getEventHref:s,LinkComponent:a,onHover:i,onScrollToTop:S}})]})}function Fc({index:e,style:t,events:r,columnCount:o,dataRowCount:n,showEndOfList:s,totalRowCount:a,onSelect:i,onSelectOutcome:l,getEventHref:c,LinkComponent:u,onHover:p,onScrollToTop:m}){if(s&&e===a-1)return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Hc,{onScrollToTop:m})});if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-start pt-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let d=e*o,g=r.slice(d,d+o),f=o-g.length;return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsxs("div",{className:"flex w-full h-full",children:[g.map((h,x)=>h==null?null:jsxRuntime.jsx("div",{className:"flex-1 min-w-0 flex",style:{padding:_c,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${x*35}ms both`},children:jsxRuntime.jsx(Xo,{event:h,href:c?.(h),LinkComponent:u,onSelect:i,onSelectOutcome:l,onHover:p})},`${d+x}-${h.source}-${h.slug}`)),f>0&&Array.from({length:f}).map((h,x)=>jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}},`spacer-${x}`))]})})}function Hc({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 ss({tagSlugSelection:e,limit:t=48,status:r,sort_by:o,sort_asc:n,source:s,with_markets:a,timeRemaining:i,minVolume:l,minLiquidity:c,onSelect:u,onSelectOutcome:p,getEventHref:m,LinkComponent:d,onHover:g}){let{data:f,hasMore:h,fetchMore:x,isFetching:N}=$o({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:s,with_markets:a,timeRemaining:i,minVolume:l,minLiquidity:c});return N?jsxRuntime.jsx(sn,{count:48}):jsxRuntime.jsx(ns,{events:f,hasMore:h,onFetchMore:x,onSelect:u,onSelectOutcome:p,getEventHref:m,LinkComponent:d,onHover:g})}function b0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n}){let[s,a]=react.useState({categorySlug:null,tagSlug:null}),[i,l]=react.useState(nn),{isOpen:c,onOpen:u,onClose:p}=ui$1.useDisclosure(),{onOpen:m}=uiScaffold.useAsyncModal(zt),d=react.useCallback((v,b,H)=>{t?.(v,b,H),m({params:{event:v,market:b,initialOutcome:H}});},[t,m]),g=react.useCallback(v=>{a(v);},[]),f=react.useCallback(v=>{l(b=>({...b,sortPreset:v}));},[]),h=react.useCallback(v=>{l(b=>({...b,sortAsc:v}));},[]),x=react.useCallback(v=>{l(v);},[]),N=react.useMemo(()=>Fo[i.sortPreset].sort_by,[i.sortPreset]),E=react.useMemo(()=>on(i),[i]),S=react.useMemo(()=>jsxRuntime.jsx(Ho,{sortPreset:i.sortPreset,onSortChange:f,sortAsc:i.sortAsc,onSortAscChange:h,onFilterPress:u,filterCount:E}),[i.sortPreset,i.sortAsc,E,f,h,u]);return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsx(po,{onSelect:g,trailing:S}),jsxRuntime.jsx(Ro,{isOpen:c,onClose:p,value:i,onChange:x}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(ss,{tagSlugSelection:s,sort_by:N,sort_asc:i.sortAsc,source:i.source,timeRemaining:i.timeRemaining,minVolume:i.minVolume,minLiquidity:i.minLiquidity,onSelect:e,onSelectOutcome:d,getEventHref:r,LinkComponent:o,onHover:n})}),jsxRuntime.jsx(hr,{})]})}var gn=40,Sr=36,Gt=480,hn=Gt-Sr;function cs({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,s]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(p=>p.slug)??[],[e.markets]),{data:i}=reactPredict.usePositions({source:e.source,user:t??""}),l=react.useMemo(()=>!i?.positions||!t?0:a.length===0?i.positions.length:i.positions.filter(p=>p.market&&a.includes(p.market.slug)).length,[i?.positions,a,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:()=>s(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:Gt},children:[n==="positions"&&jsxRuntime.jsx(Gc,{source:e.source,walletAddress:t,marketSlugs:a}),n==="orders"&&jsxRuntime.jsx(qc,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Zc,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Gt},children:o("predict.trade.connectWallet")})]})}function Gc({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:s}=reactPredict.usePositions({source:e,user:t}),a=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(i=>i.market&&r.includes(i.market.slug)):[],[n?.positions,r]);return s?jsxRuntime.jsx(vn,{}):a.length===0?jsxRuntime.jsx(xn,{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:Sr},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:hn},rowComponent:Yc,rowCount:a.length,rowHeight:gn,rowProps:{positions:a,closeLabel:o("predict.positions.close")}})]})}function Yc({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let s=n.pnl??0,a=n.pnl_percent??0,i=n.avg_price??0,l=n.current_price??0,c=s>0?"text-success":s<0?"text-danger":"text-foreground",u=s>0?"+":"",p=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",m=n.side,d=n.size,g=n.size*l,f=n.market?.end_at?td(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:["$",g.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:yr(i)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:yr(l)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[u,"$",Math.abs(s).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,a.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:f}),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 qc({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:s,isLoading:a,fetchNextPage:i,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let x=s?.pages?.flatMap(S=>S.items)??[],N=new Set(["live","open","submitted","pending"]),E=x.filter(S=>N.has(S.status));return r.length>0&&(E=E.filter(S=>S.market_id&&r.includes(S.market_id))),E},[s?.pages,r]),p=react.useCallback(x=>{o?o(x.id):c.mutate({source:x.source,id:x.id});},[o,c]),m=u.length,d=m+(l?1:0),g=react.useCallback(x=>x<m,[m]),f=react.useCallback(async()=>{await i();},[i]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:g,loadMoreRows:f,rowCount:d,threshold:5});return a?jsxRuntime.jsx(vn,{}):u.length===0&&!l?jsxRuntime.jsx(xn,{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:Sr},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:hn},onRowsRendered:h,rowComponent:Qc,rowCount:d,rowHeight:gn,rowProps:{orders:u,itemCount:m,onCancel:p,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Qc({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:s,cancelLabel:a}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];if(!i)return null;let l=i.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:i.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:i.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:i.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i.price?yr(parseFloat(i.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[i.size_matched??"0","/",i.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Xc,{status:i.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(i),disabled:s,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:s?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):a})})]})}function Xc({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 Zc({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:s,hasNextPage:a}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),i=react.useMemo(()=>o?.pages?.flatMap(d=>d.items)??[],[o?.pages]),l=i.length,c=l+(a?1:0),u=react.useCallback(d=>d<l,[l]),p=react.useCallback(async()=>{await s();},[s]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:p,rowCount:c,threshold:5});return n?jsxRuntime.jsx(vn,{}):i.length===0&&!a?jsxRuntime.jsx(xn,{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:Sr},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:hn},onRowsRendered:m,rowComponent:Jc,rowCount:c,rowHeight:gn,rowProps:{trades:i,itemCount:l}})]})}function Jc({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 s=n.side?.toUpperCase()==="BUY",a=ed(n.timestamp),i=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",s?"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:yr(i)}),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:a})]})}function xn({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Gt},children:e})}function vn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Gt},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function yr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function ed(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"),s=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${s}`}function td(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function Yt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-4 animate-pulse lg:gap-6",children:[t&&jsxRuntime.jsx("div",{className:"h-5"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 h-16 lg:h-20 lg:gap-x-4",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-16 shrink-0 rounded-lg lg:size-20"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-12 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-10 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-10 rounded"})]}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-5 w-full max-w-sm rounded lg:h-6"})]})]}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-48 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-20 rounded"})]}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-[300px] w-full rounded-xl"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-20 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-7 w-[200px] rounded-lg"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-7 w-28 rounded-lg"})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-14 rounded"}),jsxRuntime.jsx("div",{className:"flex-1"})]}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border py-2.5 lg:gap-x-3",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-5 shrink-0 rounded-lg lg:size-8"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-32 rounded lg:h-4 lg:w-48"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-2.5 w-16 rounded"})]}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-10 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"})]})]},o))]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-4 w-16 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-4/5 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3.5 w-3/5 rounded"})]})]})}function ds(){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border p-4 animate-pulse",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-10 w-full rounded-lg"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-24 w-full rounded-lg"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-10 w-full rounded-lg"})]})}var fs="var(--color-bullish)",gs="var(--color-bearish)";function qt(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 od(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function sd(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let d of e){let g=Math.round(d.price*100);g>=0&&g<=100&&(r[g]+=d.quantity);}for(let d of t){let g=Math.round(d.price*100);g>=0&&g<=100&&(o[g]+=d.quantity);}let n=0,s=0,a=new Float64Array(101),i=new Float64Array(101);for(let d=100;d>=0;d--)n+=r[d],s+=r[d]*d/100,a[d]=n,i[d]=s;let l=0,c=0,u=new Float64Array(101),p=new Float64Array(101);for(let d=0;d<=100;d++)l+=o[d],c+=o[d]*d/100,u[d]=l,p[d]=c;let m=Math.max(a[0]??0,u[100]??0);return Array.from({length:101},(d,g)=>{let f=a[g]>0,h=u[g]>0,x=a[g]||u[g],N=r[g]>0||o[g]>0;return {priceCents:g,displayHeight:od(x,m),opacity:x>0?N?1:.5:0,isBid:f,isAsk:h,bidCumTotal:a[g],askCumTotal:u[g],bidCumCost:i[g],askCumCost:p[g]}})}function id({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?fs:gs,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:qt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",qt(Math.round(e.cumCost))]})]})}var ad=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),s=t.isBid||t.isAsk,a=t.isBid?fs:t.isAsk?gs: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:s?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:s&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:a,opacity:t.opacity}})})}),ld=[0,10,20,30,40,50,60,70,80,90,100];function cd(){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:ld.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 hs({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>sd(e,t),[e,t]),n=react.useMemo(()=>{let p=e.length>0?Math.max(...e.map(d=>d.price)):0,m=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((p+m)/2*100)},[e,t]),s=react.useMemo(()=>o.some(p=>p.isBid||p.isAsk),[o]),[a,i]=react.useState(null),l=react.useRef(null),c=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?i({priceCents:p.priceCents,isBid:p.isBid,cumTotal:p.isBid?p.bidCumTotal:p.askCumTotal,cumCost:p.isBid?p.bidCumCost:p.askCumCost,leftPct:p.priceCents}):i(null);},[]),u=react.useCallback(()=>{l.current&&(l.current.style.filter="",l.current=null),i(null);},[]);return s?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"}}),a&&jsxRuntime.jsx(id,{info:a}),o.map(p=>jsxRuntime.jsx(ad,{slot:p,onEnter:c,onLeave:u},p.priceCents))]}),jsxRuntime.jsx(cd,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function yn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function xs(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function ks({market:e,outcome:t="yes",onTradeAction:r}){let{t:o}=i18n.useTranslation(),[n,s]=react.useState("depth"),a=t==="no",i=e.source,{data:l,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:i}),u=react.useMemo(()=>((a?l?.asks:l?.bids)??[]).map(h=>({price:a?1-h.price:h.price,quantity:h.size})),[l?.bids,l?.asks,a]),p=react.useMemo(()=>((a?l?.bids:l?.asks)??[]).map(h=>({price:a?1-h.price:h.price,quantity:h.size})),[l?.bids,l?.asks,a]),m=react.useMemo(()=>u.length>0?Math.max(...u.map(f=>f.price)):null,[u]),d=react.useMemo(()=>p.length>0?Math.min(...p.map(f=>f.price)):null,[p]),g=react.useMemo(()=>{if(m==null||d==null)return null;let f=(d-m)*100;return Math.round(f*10)/10},[m,d]);return jsxRuntime.jsxs("div",{className:"flex flex-col 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:g!=null?`${o("predict.orderBook.spread")}: ${Number.isInteger(g)?`${g}\xA2`:`${g.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[m!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[o("predict.trade.bestBid"),": ",yn(m)]}),m!=null&&d!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),d!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[o("predict.trade.bestAsk"),": ",yn(d)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:n==="depth"?"Orderbook":"Depth chart",onClick:()=>s(f=>f==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:n==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[n==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(xs,{}):jsxRuntime.jsx(hs,{bids:u,asks:p})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(xs,{}):jsxRuntime.jsx(gd,{bids:u,asks:p,bestBid:m??void 0,bestAsk:d??void 0,spread:g??void 0})})]})]})}var vs=8;function gd({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((l,c)=>l.price-c.price).slice(0,vs).reverse(),[t]),s=react.useMemo(()=>[...e].sort((l,c)=>c.price-l.price).slice(0,vs),[e]),a=react.useMemo(()=>{let l=[...n,...s].map(c=>c.quantity);return Math.max(...l,1)},[n,s]);return n.length===0&&s.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:[n.map(l=>jsxRuntime.jsx(bs,{price:l.price,quantity:l.quantity,side:"ask",maxQty:a},`ask-${l.price}`)),jsxRuntime.jsx("div",{className:"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`]})}),s.map(l=>jsxRuntime.jsx(bs,{price:l.price,quantity:l.quantity,side:"bid",maxQty:a},`bid-${l.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 bs({price:e,quantity:t,side:r,maxQty:o}){let n=r==="ask",s=Math.min(t/o*100,100),a=n?"bg-bearish/10":"bg-bullish/10",i=n?"text-bearish":"text-bullish",l=qt(Math.round(t)),c=Math.round(t*e),u=`$${qt(c)}`;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 ${i}`,children:yn(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 wn=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}},Pr=4,Ss=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Md(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Ed(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.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 ws(e){return `${(e*100).toFixed(2)}%`}var Td=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function Ld({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Td.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 _d(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let s=e.current,a=t.current;if(!s||!a)return;let i=s.getBoundingClientRect(),l=(n.clientX-i.left)/i.width*100;a.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,a.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function Rd({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:s}){if(!e||!n?.length)return null;let a=new Map;t?.forEach(l=>a.set(l.dataKey,l));let i=n.map(l=>a.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"?Ed(r,s):r}),i.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?ws(l.value):"--"})]},l.dataKey))]})}function Id({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,s]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!n)return;function c(u){a.current&&!a.current.contains(u.target)&&s(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let i=t.length>=Pr,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(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(u=>u.slug===t[0]);return c?.outcomes?.[0]?.label??c?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>s(c=>!c),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 ",Pr," markets"]}),e.map((c,u)=>{let p=t.includes(c.slug),m=!p&&i,d=p&&t.length===1,g=r.get(c.slug)??"#6b7280",f=c.outcomes.find(x=>x.label.toLowerCase()==="yes")??c.outcomes[0],h=f?.price!=null?`${Math.round(f.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||m||o(c.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||d?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!m&&!d&&(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 ${g}`:"2px solid rgba(255,255,255,0.2)",background:p?`${g}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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:g,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:p?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:g,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${u}-${c.slug}`)})]})]})}function Od({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",s=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:s!=null?ws(s):"--"})]})]},o.marketSlug)})})}function Ad(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Dd(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let s=Math.floor(n*o),a=Math.min(Math.floor((n+1)*o),e.length),i=e.slice(s,a),l=i.map(c=>c.price).sort((c,u)=>c-u);r.push({timestamp:i[i.length-1].timestamp,price:Ad(l)});}return r}function Fd(e,t=200){if(e.length===0)return [];let r=e.map(i=>({...i,data:Dd(i.data,t)})),o=new Set;r.forEach(i=>i.data.forEach(l=>o.add(l.timestamp)));let n=Array.from(o).sort((i,l)=>i-l),s=r.map(i=>{let l=new Map;return i.data.forEach(c=>l.set(c.timestamp,c.price)),{slug:i.marketSlug,map:l}}),a=new Map;return n.map(i=>{let l={timestamp:i};return s.forEach(({slug:c,map:u})=>{let p=u.get(i);if(p!==void 0)a.set(c,p),l[c]=p;else {let m=a.get(c);m!==void 0&&(l[c]=m);}}),l})}function Ns(e){return jsxRuntime.jsx(wn,{children:jsxRuntime.jsx(Hd,{...e})})}function Hd({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>{let M=new Set;return (e.markets??[]).filter(_=>_.status!=="open"||M.has(_.slug)?false:(M.add(_.slug),true))},[e.markets]),s=react.useMemo(()=>[...n].sort((M,_)=>{let V=O=>(O.outcomes.find(de=>de.label.toLowerCase()==="yes")??O.outcomes[0])?.price??0;return V(_)-V(M)}),[n]),[a,i]=react.useState(()=>s.slice(0,Pr).map(M=>M.slug)),[l,c]=react.useState(pr),u=react.useMemo(()=>{let M=new Map;return a.forEach((_,V)=>{M.set(_,Ss[V%Ss.length]);}),M},[a]),p=react.useMemo(()=>n.filter(M=>a.includes(M.slug)),[n,a]),{series:m,isLoading:d}=reactPredict.useMarketHistory(p,l),g=t||d,f=react.useMemo(()=>{if(m.length>0&&m.some(V=>V.data.length>0))return m;let M=Date.now(),_=864e5;return p.map(V=>{let de=(V.outcomes?.find(ie=>ie.label.toLowerCase()==="yes")??V.outcomes?.[0])?.price??.5;return {marketSlug:V.slug,label:V.outcomes?.[0]?.label??V.question,data:[{timestamp:M-7*_,price:de},{timestamp:M,price:de}]}})},[m,p]),h=react.useMemo(()=>l===reactPredict.ChartRange.ONE_DAY?96:l===reactPredict.ChartRange.ONE_WEEK?168:l===reactPredict.ChartRange.ONE_MONTH?180:300,[l]),x=react.useMemo(()=>Fd(f,h),[f,h]),N=react.useMemo(()=>{if(x.length===0)return [0,1];let M=1/0,_=-1/0;if(a.forEach(O=>{x.forEach(de=>{let ie=de[O];ie!=null&&(ie<M&&(M=ie),ie>_&&(_=ie));});}),!isFinite(M))return [0,1];let V=Math.max((_-M)*.15,.05);return [Math.max(0,M-V),Math.min(1,_+V)]},[x,a]),E=react.useMemo(()=>{let M=new Map;return f.forEach(_=>{_.data.length>0&&M.set(_.marketSlug,_.data[_.data.length-1].price);}),M},[f]),S=react.useMemo(()=>{let M=new Map;return f.forEach(_=>M.set(_.marketSlug,_.label)),M},[f]),v=react.useMemo(()=>f.map(M=>({slug:M.marketSlug,color:u.get(M.marketSlug)??"#6b7280"})),[f,u]),{wrapperRef:b,overlayRef:H,onMouseMove:K,onMouseLeave:pe}=_d(),P=react.useCallback(M=>{i(_=>_.includes(M)?_.length<=1?_:_.filter(V=>V!==M):_.length>=Pr?_:[..._,M]);},[]),[X,F]=react.useState(null),z=react.useRef(null),$=react.useRef(""),oe=react.useRef(0),me=!g&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Od,{series:f,colorMap:u,displayValues:X??E}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:b,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:me?M=>{K(M),cancelAnimationFrame(oe.current),oe.current=requestAnimationFrame(()=>{F(z.current);});}:void 0,onMouseLeave:me?()=>{pe(),cancelAnimationFrame(oe.current),$.current="",z.current=null,F(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"}})}):x.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:H,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:x,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:M=>Md(M,l),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:N,tickFormatter:M=>`${Math.round(M*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:M=>{let _=M;if(_.active&&_.payload?.length){let V=_.payload.map(O=>`${O.dataKey}:${O.value}`).join(",");if(V!==$.current){$.current=V;let O=new Map;_.payload.forEach(de=>{de.value!=null&&O.set(de.dataKey,de.value);}),z.current=O;}}return jsxRuntime.jsx(Rd,{..._,labelMap:S,allSeries:v,range:l})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),f.map(M=>{let _=u.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:M.marketSlug,stroke:_,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:_},connectNulls:true,isAnimationActive:false},M.marketSlug)}),X==null&&x.length>0&&f.map(M=>{let _=x[x.length-1],V=_[M.marketSlug];if(V==null)return null;let O=u.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:_.timestamp,y:V,ifOverflow:"extendDomain",shape:de=>{let{cx:ie,cy:we}=de;return ie==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:ie,cy:we,r:6,fill:O,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:ie,cy:we,r:3.5,fill:O})]})}},`pulse-${M.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:["$",Math.round(o).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(Ld,{value:l,onChange:c}),s.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Id,{markets:s,selectedSlugs:a,colorMap:u,onToggle:P})})]})]})]})}function Xt(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Xd(e){return `${parseFloat((e*100).toFixed(2))}%`}function Ps(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function Cr(e){return e.outcomes?.[0]?.label??e.question}function Zd(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Qt(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(),s=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${s}:${a}`}function Cs(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 s=Math.floor(n/864e5),a=Math.floor(n%864e5/36e5),i=Math.floor(n%36e5/6e4),l=Math.floor(n%6e4/1e3),c=[];return s>0&&c.push(`${s}d`),c.push(`${String(a).padStart(2,"0")}h`),c.push(`${String(i).padStart(2,"0")}m`),c.push(`${String(l).padStart(2,"0")}s`),c.join(" ")}function Ms(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"),s=t.getDate().toString().padStart(2,"0"),a=t.getFullYear(),i=-t.getTimezoneOffset(),l=i>=0?"+":"-",c=String(Math.abs(Math.floor(i/60))).padStart(2,"0");return `${r}:${o} ${n}/${s}/${a} (${l}${c})`}function _s({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),s=react.useMemo(()=>{let p=[...e.markets||[]],m=p.filter(g=>g.status==="open").sort((g,f)=>Xt(f)-Xt(g)),d=p.filter(g=>g.status!=="open").sort((g,f)=>Xt(f)-Xt(g));return [...m,...d]},[e.markets]),a=e.status==="closed"||e.status==="voided",i=Cs(a?void 0:e.start_at),l=Cs(a?void 0:e.end_at),c=Ms(e.start_at),u=Ms(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(ru,{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})]})]}),(i||l||a)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:a?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:i})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):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(Ns,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Jd,{markets:s,onTradeAction:t}),jsxRuntime.jsx(tu,{markets:s,event:e})]})}var Es=5;function Jd({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen(),[n,s]=react.useState(false),[a,i]=react.useState(null),l=react.useMemo(()=>{let h=new Set;return e.filter(x=>h.has(x.slug)?false:(h.add(x.slug),true))},[e]),c=l.find(h=>h.status==="open")?.slug,[u,p]=react.useState(c?`${c}:yes`:null);if(l.length===0)return null;let m=l.length>Es,d=n?l:l.slice(0,Es),g=h=>{i(x=>x===h?null:h);},f=(h,x,N)=>{p(`${h.slug}:${x}`),o||i(h.slug),t?.(h,x,N);};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:d.map((h,x)=>{let N=Xt(h),E=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,S=a===h.slug;return jsxRuntime.jsx(eu,{market:h,yesPrice:N,noPrice:E??void 0,activeYes:u===`${h.slug}:yes`,activeNo:u===`${h.slug}:no`,isExpanded:S,onToggleExpand:()=>g(h.slug),onTradeAction:f},h.id??`${x}-${h.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(h=>!h),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 eu({market:e,yesPrice:t,noPrice:r,activeYes:o,activeNo:n,isExpanded:s,onToggleExpand:a,onTradeAction:i}){let{t:l}=i18n.useTranslation(),c=e.status==="open",u=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;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:a,role:"button",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a());},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:Cr(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:Cr(e)}),u&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:u})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Xd(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?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",o?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:p=>{p.stopPropagation(),i?.(e,"yes","buy");},children:l("predict.market.action.yes",{price:Ps(t)})}),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",n?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:p=>{p.stopPropagation(),i?.(e,"no","buy");},children:r!=null?l("predict.market.action.no",{price:Ps(r)}):l("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"?l("predict.event.status.closed"):e.status==="voided"?l("predict.event.status.voided"):l("predict.event.status.pending")})})})]}),s&&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(ks,{market:e,outcome:n?"no":"yes",onTradeAction:i})})})})]})}function tu({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[s,a]=react.useState(false),[i,l]=react.useState(0),c=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(c.length===0)return null;let u=c[i]??c[0],p=u.rules&&u.rules.length>0?u.rules.join(`
73
+ .evt-card button:focus-visible,
74
+ .evt-card a:focus-visible,
75
+ .evt-card [role="button"]:focus-visible {
76
+ outline: 2px solid hsl(var(--heroui-primary) / 0.4);
77
+ outline-offset: 2px;
78
+ }
79
+ `;function ni({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],p=react.useMemo(()=>a.length>2?[...a].sort((x,b)=>(b.outcomes?.[0]?.price??0)-(x.outcomes?.[0]?.price??0)):a,[a]).filter(x=>x.status==="open"),u=p.length===1,m=p.slice(0,qo),d=p.length-qo,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?p.find(x=>x.slug===s)??null:null,h=!!g||u,v=()=>{h||o?.(e);},N=x=>{x.stopPropagation(),g&&(x.preventDefault(),l(null));},M=x=>{x.stopPropagation(),t||(x.preventDefault(),o?.(e));},w=u?jsxRuntime.jsx(_c,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o}):g?jsxRuntime.jsx(Ic,{onCollapse:()=>l(null)}):jsxRuntime.jsx(Mc,{moreCount:d,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:M});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:h?void 0:"pointer"},onMouseEnter:x=>{let b=x.currentTarget,E=mc[e.source]??fc;b.style.borderColor=E.border,b.style.boxShadow=E.shadow,i?.(e);},onMouseLeave:x=>{let b=x.currentTarget;b.style.borderColor="rgba(39,39,42,0.6)",b.style.boxShadow="none";},onClick:v,children:[jsxRuntime.jsx("style",{children:bc}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(yc,{event:e,href:t,LinkComponent:r,onClick:N,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:u?jsxRuntime.jsx(Lc,{market:p[0],event:e,onSelectOutcome:n}):g?jsxRuntime.jsx(Rc,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:n}):jsxRuntime.jsx(Cc,{displayedMarkets:m,onMarketClick:x=>l(x.slug)})})]}),jsxRuntime.jsx(Ec,{children:w})]})}function yc({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?xc(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(Sc,{event:e})]})}function kc(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 l=n<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=i?"5m":"15m",color:l});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function Sc({event:e}){let t=react.useMemo(()=>kc(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(wc,{},o);case "crypto-short":return jsxRuntime.jsx(Nc,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(Pc,{},o)}})})}function wc(){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 Nc({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 Pc(){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 Cc({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=ti(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:ri(o)}),jsxRuntime.jsx(Tc,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Mc({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(ii,{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(ai,{source:r})]})]})}function Ec({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 Jo({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:l=>{let a=l.currentTarget;a.style.setProperty("--shadow-offset","2px"),a.style.transform="translateY(2px)";},onMouseLeave:l=>{let a=l.currentTarget;a.style.setProperty("--shadow-offset","4px"),a.style.transform="translateY(0px)";},onClick:o,children:n})}function oi({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[s,l]=o?hc(e):[un,ei],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",p=n==="label"&&a===c?"action":n,u=p==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Xo(e)}\xA2`:i("predict.market.action.yes",{price:Xo(e)}),m=p==="label"?`${e.outcomes?.[1]?.label??"No"} ${Zo(e)}\xA2`:i("predict.market.action.no",{price:Zo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Jo,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:u}),jsxRuntime.jsx(Jo,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:m})]})}function Tc(){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 Lc({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(oi,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function _c({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:l=>{l.stopPropagation(),r||(l.preventDefault(),n?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(ii,{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(ai,{source:e.source})]})]})}function Rc({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let n=ti(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:ri(n)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(oi,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]})}function Ic({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(Oc,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function ii({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 Oc({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 ai({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 Bc=8;function li({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:o,onSelect:n,onSelectOutcome:i,getEventHref:s,LinkComponent:l,onHover:a}){let{t:c}=i18n.useTranslation(),p=react.useRef(null);react.useEffect(()=>{let d=p.current;if(!d)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&o?.();},{rootMargin:"300px"});return f.observe(d),()=>f.disconnect()},[t,r,o]);let u=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:`
80
+ @keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
81
+ @keyframes evt-load-spin{to{transform:rotate(360deg)}}
82
+ @media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
83
+ @media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
84
+ @media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
85
+ `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,f)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:Bc,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(ni,{event:d,href:s?.(d),LinkComponent:l,onSelect:n,onSelectOutcome:i,onHover:a})},`${d.source}-${d.slug}`))}),jsxRuntime.jsx("div",{ref:p,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"})}),c("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(Hc,{onScrollToTop:u})]})}function Hc({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 di({tagSlugSelection:e,limit:t=48,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,onSelect:p,onSelectOutcome:u,getEventHref:m,LinkComponent:d,onHover:f}){let{data:g,hasMore:h,fetchMore:v,isFetching:N,isFetchingMore:M}=jo({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c});return N?jsxRuntime.jsx(dn,{count:48}):jsxRuntime.jsx(li,{events:g,hasMore:h,isFetchingMore:M,onFetchMore:v,onSelect:p,onSelectOutcome:u,getEventHref:m,LinkComponent:d,onHover:f})}function w0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n,bgImageSrc:i}){let[s,l]=react.useState({categorySlug:null,tagSlug:null}),[a,c]=react.useState(ln),{data:p}=reactPredict.useEventStats(),{isOpen:u,onOpen:m,onClose:d}=ui.useDisclosure(),{onOpen:f}=uiScaffold.useAsyncModal(Ut),g=react.useCallback((E,z,se)=>{t?.(E,z,se),f({params:{event:E,market:z,initialOutcome:se}});},[t,f]),h=react.useCallback(E=>{l(E);},[]),v=react.useCallback(E=>{c(z=>({...z,sortPreset:E}));},[]),N=react.useCallback(E=>{c(z=>({...z,sortAsc:E}));},[]),M=react.useCallback(E=>{c(E);},[]),w=react.useMemo(()=>Wo[a.sortPreset].sort_by,[a.sortPreset]),x=react.useMemo(()=>cn(a),[a]),b=react.useMemo(()=>jsxRuntime.jsx(Uo,{sortPreset:a.sortPreset,onSortChange:v,sortAsc:a.sortAsc,onSortAscChange:N,onFilterPress:m,filterCount:x}),[a.sortPreset,a.sortAsc,x,v,N,m]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)",width:"100vw",marginLeft:"calc(-50vw + 50%)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:0,overflow:"hidden"},children:[i&&jsxRuntime.jsx("img",{src:i,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:".evt-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.evt-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.evt-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"evt-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(Fo,{stats:p})})]}),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(go,{onSelect:h,trailing:b})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(Ao,{isOpen:u,onClose:d,value:a,onChange:M}),jsxRuntime.jsx(di,{tagSlugSelection:s,sort_by:w,sort_asc:a.sortAsc,source:a.source,timeRemaining:a.timeRemaining,minVolume:a.minVolume,minLiquidity:a.minLiquidity,onSelect:e,onSelectOutcome:g,getEventHref:r,LinkComponent:o,onHover:n})]}),jsxRuntime.jsx(br,{})]})}var xn=40,Cr=36,Qt=480,bn=Qt-Cr;function fi({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(u=>u.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),a=react.useMemo(()=>!l?.positions||!t?0:s.length===0?l.positions.length:l.positions.filter(u=>u.market&&s.includes(u.market.slug)).length,[l?.positions,s,t]),p=[{key:"positions",label:a>0?`${o("predict.positions.title")} (${a})`: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:p.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(u.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===u.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:u.label},u.key))}),t?jsxRuntime.jsxs("div",{style:{height:Qt},children:[n==="positions"&&jsxRuntime.jsx(Gc,{source:e.source,walletAddress:t,marketSlugs:s}),n==="orders"&&jsxRuntime.jsx(Qc,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Jc,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Qt},children:o("predict.trade.connectWallet")})]})}function Gc({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(l=>l.market&&r.includes(l.market.slug)):[],[n?.positions,r]);return i?jsxRuntime.jsx(kn,{}):s.length===0?jsxRuntime.jsx(yn,{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:Cr},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:bn},rowComponent:qc,rowCount:s.length,rowHeight:xn,rowProps:{positions:s,closeLabel:o("predict.positions.close")}})]})}function qc({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,l=n.avg_price??0,a=n.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",p=i>0?"+":"",u=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",m=n.side,d=n.size,f=n.size*a,g=n.market?.end_at?rd(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:u}),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:Nr(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Nr(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[p,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.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 Qc({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:l,hasNextPage:a}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),p=react.useMemo(()=>{let v=i?.pages?.flatMap(w=>w.items)??[],N=new Set(["live","open","submitted","pending"]),M=v.filter(w=>N.has(w.status));return r.length>0&&(M=M.filter(w=>w.market_id&&r.includes(w.market_id))),M},[i?.pages,r]),u=react.useCallback(v=>{o?o(v.id):c.mutate({source:v.source,id:v.id});},[o,c]),m=p.length,d=m+(a?1:0),f=react.useCallback(v=>v<m,[m]),g=react.useCallback(async()=>{await l();},[l]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:d,threshold:5});return s?jsxRuntime.jsx(kn,{}):p.length===0&&!a?jsxRuntime.jsx(yn,{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:Cr},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:bn},onRowsRendered:h,rowComponent:Xc,rowCount:d,rowHeight:xn,rowProps:{orders:p,itemCount:m,onCancel:u,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Xc({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 l=r[e];if(!l)return null;let a=l.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",a?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:l.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:l.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:l.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:l.price?Nr(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Zc,{status:l.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(l),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 Zc({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 Jc({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}),l=react.useMemo(()=>o?.pages?.flatMap(d=>d.items)??[],[o?.pages]),a=l.length,c=a+(s?1:0),p=react.useCallback(d=>d<a,[a]),u=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:u,rowCount:c,threshold:5});return n?jsxRuntime.jsx(kn,{}):l.length===0&&!s?jsxRuntime.jsx(yn,{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:Cr},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:bn},onRowsRendered:m,rowComponent:ed,rowCount:c,rowHeight:xn,rowProps:{trades:l,itemCount:a}})]})}function ed({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=td(n.timestamp),l=n.price??0,a=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:Nr(l)}),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:["$",a.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:s})]})}function yn({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Qt},children:e})}function kn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Qt},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Nr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function td(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 rd(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function Xt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-4 animate-pulse lg:gap-6",children:[t&&jsxRuntime.jsx("div",{className:"h-5"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 h-16 lg:h-20 lg:gap-x-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-16 shrink-0 rounded-lg lg:size-20"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-12 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-5 w-full max-w-sm rounded lg:h-6"})]})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-48 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-24 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-[300px] w-full rounded-xl"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[200px] rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-28 rounded-lg"})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-14 rounded"}),jsxRuntime.jsx("div",{className:"flex-1"})]}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border py-2.5 lg:gap-x-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-5 shrink-0 rounded-lg lg:size-8"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-32 rounded lg:h-4 lg:w-48"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-2.5 w-16 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-10 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"})]})]},o))]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-full rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-4/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-3/5 rounded"})]})]})}function gi(){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border p-4 animate-pulse",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-24 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"})]})}var bi="var(--color-bullish)",yi="var(--color-bearish)";function Zt(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 id(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function ad(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let d of e){let f=Math.round(d.price*100);f>=0&&f<=100&&(r[f]+=d.quantity);}for(let d of t){let f=Math.round(d.price*100);f>=0&&f<=100&&(o[f]+=d.quantity);}let n=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let d=100;d>=0;d--)n+=r[d],i+=r[d]*d/100,s[d]=n,l[d]=i;let a=0,c=0,p=new Float64Array(101),u=new Float64Array(101);for(let d=0;d<=100;d++)a+=o[d],c+=o[d]*d/100,p[d]=a,u[d]=c;let m=Math.max(s[0]??0,p[100]??0);return Array.from({length:101},(d,f)=>{let g=s[f]>0,h=p[f]>0,v=s[f]||p[f],N=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:id(v,m),opacity:v>0?N?1:.5:0,isBid:g,isAsk:h,bidCumTotal:s[f],askCumTotal:p[f],bidCumCost:l[f],askCumCost:u[f]}})}function sd({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?bi:yi,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:Zt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Zt(Math.round(e.cumCost))]})]})}var ld=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?bi:t.isAsk?yi: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}})})}),cd=[0,10,20,30,40,50,60,70,80,90,100];function dd(){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:cd.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 ki({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>ad(e,t),[e,t]),n=react.useMemo(()=>{let u=e.length>0?Math.max(...e.map(d=>d.price)):0,m=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((u+m)/2*100)},[e,t]),i=react.useMemo(()=>o.some(u=>u.isBid||u.isAsk),[o]),[s,l]=react.useState(null),a=react.useRef(null),c=react.useCallback((u,m)=>{a.current&&(a.current.style.filter=""),m?(m.style.filter="brightness(1.5)",a.current=m):a.current=null,u.isBid||u.isAsk?l({priceCents:u.priceCents,isBid:u.isBid,cumTotal:u.isBid?u.bidCumTotal:u.askCumTotal,cumCost:u.isBid?u.bidCumCost:u.askCumCost,leftPct:u.priceCents}):l(null);},[]),p=react.useCallback(()=>{a.current&&(a.current.style.filter="",a.current=null),l(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(sd,{info:s}),o.map(u=>jsxRuntime.jsx(ld,{slot:u,onEnter:c,onLeave:p},u.priceCents))]}),jsxRuntime.jsx(dd,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function wn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Si(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function Ci({market:e,outcome:t="yes",onTradeAction:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("depth"),s=t==="no",l=e.source,{data:a,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:l}),p=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),u=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),m=react.useMemo(()=>p.length>0?Math.max(...p.map(g=>g.price)):null,[p]),d=react.useMemo(()=>u.length>0?Math.min(...u.map(g=>g.price)):null,[u]),f=react.useMemo(()=>{if(m==null||d==null)return null;let g=(d-m)*100;return Math.round(g*10)/10},[m,d]);return jsxRuntime.jsxs("div",{className:"flex flex-col 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:f!=null?`${o("predict.orderBook.spread")}: ${Number.isInteger(f)?`${f}\xA2`:`${f.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[m!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[o("predict.trade.bestBid"),": ",wn(m)]}),m!=null&&d!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),d!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[o("predict.trade.bestAsk"),": ",wn(d)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:n==="depth"?"Orderbook":"Depth chart",onClick:()=>i(g=>g==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:n==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[n==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Si,{}):jsxRuntime.jsx(ki,{bids:p,asks:u})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Si,{}):jsxRuntime.jsx(hd,{bids:p,asks:u,bestBid:m??void 0,bestAsk:d??void 0,spread:f??void 0})})]})]})}var wi=8;function hd({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((a,c)=>a.price-c.price).slice(0,wi).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,c)=>c.price-a.price).slice(0,wi),[e]),s=react.useMemo(()=>{let a=[...n,...i].map(c=>c.quantity);return Math.max(...a,1)},[n,i]);return n.length===0&&i.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:[n.map(a=>jsxRuntime.jsx(Ni,{price:a.price,quantity:a.quantity,side:"ask",maxQty:s},`ask-${a.price}`)),jsxRuntime.jsx("div",{className:"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`]})}),i.map(a=>jsxRuntime.jsx(Ni,{price:a.price,quantity:a.quantity,side:"bid",maxQty:s},`bid-${a.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 Ni({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",l=n?"text-bearish":"text-bullish",a=Zt(Math.round(t)),c=Math.round(t*e),p=`$${Zt(c)}`;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 ${l}`,children:wn(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:a}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:p})]})}var Cn=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}},Tr=4,Mi=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Ed(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Td(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.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 Ei(e){return `${(e*100).toFixed(2)}%`}var Ld=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function _d({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Ld.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 Rd(){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 l=i.getBoundingClientRect(),a=(n.clientX-l.left)/l.width*100;s.style.background=`linear-gradient(to right, transparent ${a}%, rgba(0,0,0,0.55) ${a}%)`,s.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function Id({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:i}){if(!e||!n?.length)return null;let s=new Map;t?.forEach(a=>s.set(a.dataKey,a));let l=n.map(a=>s.get(a.slug)??{dataKey:a.slug,value:void 0,stroke:a.color,color:a.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"?Td(r,i):r}),l.map(a=>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:a.stroke??a.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(a.dataKey)??a.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:a.value!=null?Ei(a.value):"--"})]},a.dataKey))]})}function Od({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!n)return;function c(p){s.current&&!s.current.contains(p.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let l=t.length>=Tr,a=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(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(p=>p.slug===t[0]);return c?.outcomes?.[0]?.label??c?.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(c=>!c),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:[a,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 ",Tr," markets"]}),e.map((c,p)=>{let u=t.includes(c.slug),m=!u&&l,d=u&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(v=>v.label.toLowerCase()==="yes")??c.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||m||o(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:u?"rgba(255,255,255,0.05)":"transparent",cursor:m||d?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!m&&!d&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.currentTarget.style.background=u?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:u?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:u?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:u&&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:u?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${p}-${c.slug}`)})]})]})}function Ad({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?Ei(i):"--"})]})]},o.marketSlug)})})}function Dd(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Fd(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),l=e.slice(i,s),a=l.map(c=>c.price).sort((c,p)=>c-p);r.push({timestamp:l[l.length-1].timestamp,price:Dd(a)});}return r}function Bd(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:Fd(l.data,t)})),o=new Set;r.forEach(l=>l.data.forEach(a=>o.add(a.timestamp)));let n=Array.from(o).sort((l,a)=>l-a),i=r.map(l=>{let a=new Map;return l.data.forEach(c=>a.set(c.timestamp,c.price)),{slug:l.marketSlug,map:a}}),s=new Map;return n.map(l=>{let a={timestamp:l};return i.forEach(({slug:c,map:p})=>{let u=p.get(l);if(u!==void 0)s.set(c,u),a[c]=u;else {let m=s.get(c);m!==void 0&&(a[c]=m);}}),a})}function Ti(e){return jsxRuntime.jsx(Cn,{children:jsxRuntime.jsx(Hd,{...e})})}function Hd({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>{let C=new Set;return (e.markets??[]).filter(_=>_.status!=="open"||C.has(_.slug)?false:(C.add(_.slug),true))},[e.markets]),i=react.useMemo(()=>[...n].sort((C,_)=>{let G=D=>(D.outcomes.find(pe=>pe.label.toLowerCase()==="yes")??D.outcomes[0])?.price??0;return G(_)-G(C)}),[n]),[s,l]=react.useState(()=>i.slice(0,Tr).map(C=>C.slug)),[a,c]=react.useState(gr),p=react.useMemo(()=>{let C=new Map;return s.forEach((_,G)=>{C.set(_,Mi[G%Mi.length]);}),C},[s]),u=react.useMemo(()=>n.filter(C=>s.includes(C.slug)),[n,s]),{series:m,isLoading:d}=reactPredict.useMarketHistory(u,a),f=t||d,g=react.useMemo(()=>{if(m.length>0&&m.some(G=>G.data.length>0))return m;let C=Date.now(),_=864e5;return u.map(G=>{let pe=(G.outcomes?.find(le=>le.label.toLowerCase()==="yes")??G.outcomes?.[0])?.price??.5;return {marketSlug:G.slug,label:G.outcomes?.[0]?.label??G.question,data:[{timestamp:C-7*_,price:pe},{timestamp:C,price:pe}]}})},[m,u]),h=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),v=react.useMemo(()=>Bd(g,h),[g,h]),N=react.useMemo(()=>{if(v.length===0)return [0,1];let C=1/0,_=-1/0;if(s.forEach(D=>{v.forEach(pe=>{let le=pe[D];le!=null&&(le<C&&(C=le),le>_&&(_=le));});}),!isFinite(C))return [0,1];let G=Math.max((_-C)*.15,.05);return [Math.max(0,C-G),Math.min(1,_+G)]},[v,s]),M=react.useMemo(()=>{let C=new Map;return g.forEach(_=>{_.data.length>0&&C.set(_.marketSlug,_.data[_.data.length-1].price);}),C},[g]),w=react.useMemo(()=>{let C=new Map;return g.forEach(_=>C.set(_.marketSlug,_.label)),C},[g]),x=react.useMemo(()=>g.map(C=>({slug:C.marketSlug,color:p.get(C.marketSlug)??"#6b7280"})),[g,p]),{wrapperRef:b,overlayRef:E,onMouseMove:z,onMouseLeave:se}=Rd(),A=react.useCallback(C=>{l(_=>_.includes(C)?_.length<=1?_:_.filter(G=>G!==C):_.length>=Tr?_:[..._,C]);},[]),[ve,I]=react.useState(null),H=react.useRef(null),$=react.useRef(""),J=react.useRef(0),ie=!f&&v.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Ad,{series:g,colorMap:p,displayValues:ve??M}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:b,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:ie?C=>{z(C),cancelAnimationFrame(J.current),J.current=requestAnimationFrame(()=>{I(H.current);});}:void 0,onMouseLeave:ie?()=>{se(),cancelAnimationFrame(J.current),$.current="",H.current=null,I(null);}:void 0,children:f?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"}})}):v.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:E,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:v,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=>Ed(C,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:N,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 _=C;if(_.active&&_.payload?.length){let G=_.payload.map(D=>`${D.dataKey}:${D.value}`).join(",");if(G!==$.current){$.current=G;let D=new Map;_.payload.forEach(pe=>{pe.value!=null&&D.set(pe.dataKey,pe.value);}),H.current=D;}}return jsxRuntime.jsx(Id,{..._,labelMap:w,allSeries:x,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(C=>{let _=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:C.marketSlug,stroke:_,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:_},connectNulls:true,isAnimationActive:false},C.marketSlug)}),ve==null&&v.length>0&&g.map(C=>{let _=v[v.length-1],G=_[C.marketSlug];if(G==null)return null;let D=p.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:_.timestamp,y:G,ifOverflow:"extendDomain",shape:pe=>{let{cx:le,cy:we}=pe;return le==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:le,cy:we,r:6,fill:D,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:le,cy:we,r:3.5,fill:D})]})}},`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:["$",Math.round(o).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(_d,{value:a,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Od,{markets:i,selectedSlugs:s,colorMap:p,onToggle:A})})]})]})]})}function er(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Zd(e){return `${parseFloat((e*100).toFixed(2))}%`}function Li(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function Lr(e){return e.outcomes?.[0]?.label??e.question}function Jd(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Jt(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 _i(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let p=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(p)},[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),l=Math.floor(n%36e5/6e4),a=Math.floor(n%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(s).padStart(2,"0")}h`),c.push(`${String(l).padStart(2,"0")}m`),c.push(`${String(a).padStart(2,"0")}s`),c.join(" ")}function Ri(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(),l=-t.getTimezoneOffset(),a=l>=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${a}${c})`}function Di({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let u=[...e.markets||[]],m=u.filter(f=>f.status==="open").sort((f,g)=>er(g)-er(f)),d=u.filter(f=>f.status!=="open").sort((f,g)=>er(g)-er(f));return [...m,...d]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=_i(s?void 0:e.start_at),a=_i(s?void 0:e.end_at),c=Ri(e.start_at),p=Ri(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((u,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:u.label})]},u.slug)),jsxRuntime.jsx(np,{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})]})]}),(l||a||s)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:s?p&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:p})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:l})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:a})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:p})]})]}):null}),jsxRuntime.jsx(Ti,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(ep,{markets:i,onTradeAction:t}),jsxRuntime.jsx(rp,{markets:i,event:e})]})}var Ii=5;function ep({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui.useScreen(),[n,i]=react.useState(false),[s,l]=react.useState(null),a=react.useMemo(()=>{let h=new Set;return e.filter(v=>h.has(v.slug)?false:(h.add(v.slug),true))},[e]),c=a.find(h=>h.status==="open")?.slug,[p,u]=react.useState(c?`${c}:yes`:null);if(a.length===0)return null;let m=a.length>Ii,d=n?a:a.slice(0,Ii),f=h=>{l(v=>v===h?null:h);},g=(h,v,N)=>{u(`${h.slug}:${v}`),o||l(h.slug),t?.(h,v,N);};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:d.map((h,v)=>{let N=er(h),M=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,w=s===h.slug;return jsxRuntime.jsx(tp,{market:h,yesPrice:N,noPrice:M??void 0,activeYes:p===`${h.slug}:yes`,activeNo:p===`${h.slug}:no`,isExpanded:w,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${v}-${h.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),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 tp({market:e,yesPrice:t,noPrice:r,activeYes:o,activeNo:n,isExpanded:i,onToggleExpand:s,onTradeAction:l}){let{t:a}=i18n.useTranslation(),c=e.status==="open",p=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;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:s,role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s());},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:Lr(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:Lr(e)}),p&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:p})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Zd(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?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",o?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:u=>{u.stopPropagation(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Li(t)})}),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",n?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:u=>{u.stopPropagation(),l?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:Li(r)}):a("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"?a("predict.event.status.closed"):e.status==="voided"?a("predict.event.status.voided"):a("predict.event.status.pending")})})})]}),i&&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(Ci,{market:e,outcome:n?"no":"yes",onTradeAction:l})})})})]})}function rp({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[i,s]=react.useState(false),[l,a]=react.useState(0),c=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(c.length===0)return null;let p=c[l]??c[0],u=p.rules&&p.rules.length>0?p.rules.join(`
20
86
 
21
- `):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")}),c.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:Cr(u)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(i)],onAction:d=>{l(Number(d)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((d,g)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(g===i?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:Cr(d)},String(g)))})]})]}),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(d=>!d),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:()=>a(d=>!d),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",s&&"rotate-180")})]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let d=u.status,g=[];return u.created_at&&g.push({label:r("predict.event.timeline.created"),value:Qt(u.created_at),isActive:true}),g.push({label:r("predict.event.timeline.open"),value:Qt(u.start_at),isActive:d!=="pending"}),d==="voided"?g.push({label:r("predict.event.timeline.voided"),value:Qt(u.closed_at??u.end_at),isActive:true}):d==="closed"?g.push({label:r("predict.event.timeline.closed"),value:Qt(u.closed_at??u.end_at),isActive:true}):g.push({label:r("predict.event.timeline.close"),value:Qt(u.end_at),isActive:false}),g})().map((d,g,f)=>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 ${d.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),g<f.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${g<f.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.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:Zd(u.source)})]})]})]})]})}function ru({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 Rs({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:s}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Yt,{}):s||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:s?.message||"Event not found"}):jsxRuntime.jsx(_s,{event:o,onTradeAction:r})}function Is({eventSlug:e,source:t,limit:r=4,onEventClick:o}){let{t:n}=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",{className:"text-sm font-semibold text-foreground lg:text-base",children:n("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3",children:s.map(i=>jsxRuntime.jsx(lu,{event:i,onClick:o},`${i.source}-${i.slug}`))})]})}function lu({event:e,onClick:t}){let r=e.volume;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),className:"flex items-center gap-x-3 rounded-xl border border-border p-3 hover:bg-content2 transition-colors cursor-pointer text-left w-full",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"lg",className:"size-8 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title}),r!=null&&r>0&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral",children:["$",Math.round(r).toLocaleString()," vol"]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{className:"h-4 w-4 text-neutral shrink-0"})]})}function Os(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Ah({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onBack:s}){let{t:a}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),{onOpen:l}=uiScaffold.useAsyncModal(zt),{data:c,isLoading:u}=reactPredict.useEvent({slug:e,source:t}),p=react.useMemo(()=>[...c?.markets||[]].sort((x,N)=>Os(N)-Os(x)),[c?.markets]),[m,d]=react.useState(null),g=react.useCallback((x,N,E)=>{d(S=>({market:x,outcome:N,side:E,version:(S?.version??0)+1})),i&&c&&l({params:{event:c,market:x,initialOutcome:N,chain:r}});},[i,c,r,l]),f=m?.market??p[0];if(u){let x=!!s;return i?jsxRuntime.jsx(Yt,{showBack:x}):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(Yt,{showBack:x})}),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(ds,{})})})]})}let h=m?`${m.market.slug}-${m.version}`:f?.slug??"default";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:a("common.back")})}),jsxRuntime.jsx(Rs,{eventSlug:e,source:t,onTradeAction:g})]}),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:[f&&jsxRuntime.jsx(gr,{event:c,market:f,initialSide:m?.side,initialOutcome:m?.outcome,chain:r},h),c&&jsxRuntime.jsx(Is,{eventSlug:e,source:c.source,onEventClick:n})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(cs,{event:c,walletAddress:o})}),jsxRuntime.jsx(hr,{})]})}function As(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Su(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var Wh=e=>{let{candlestickMarketSlugs:t,chartRange:r=pr,source:o}=e,n=reactPredict.usePredictClient(),s=react.useMemo(()=>Su(r),[r]),{data:a,isLoading:i,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>{if(!a?.markets)return [];let g=new Set,f=a.markets.filter(x=>g.has(x.slug)?false:(g.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>f.find(N=>N.slug===x)).filter(x=>x!==void 0):[...f].sort((x,N)=>As(N)-As(x)).slice(0,4)).map(x=>x.slug)},[t,a?.markets]),u=reactQuery.useQueries({queries:c.map(g=>({queryKey:reactPredict.candlesticksQueryKey(g,s),queryFn:()=>n.listCandlesticks(g,s),enabled:c.length>0}))}),p=u.some(g=>g.isLoading),m=react.useMemo(()=>{let g=new Map;return c.forEach((f,h)=>{let x=u[h]?.error;x&&g.set(f,x);}),g},[c,u]),d=react.useMemo(()=>{let g=new Map;return c.forEach((f,h)=>{let x=u[h]?.data;x&&g.set(f,x);}),g},[c,u]);return {event:a,isEventLoading:i,eventError:l,candlestickParams:s,candlesticks:d,isCandlesticksLoading:p,candlestickErrors:m}};var Pu=10,Cu=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function _r(){let[e,t]=jotai.useAtom(Cu),r=react.useCallback(n=>{let s=n.trim();s&&t(a=>{let i=a.filter(l=>l!==s);return [s,...i].slice(0,Pu)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function Bs({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(s=>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?.(s),children:s},s))})]})}function zs({onSelect:e,className:t}){let{histories:r,clearHistories:o}=_r();return jsxRuntime.jsx(Bs,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:o})}function $s({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:s}=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:s("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:a=>{a.preventDefault(),o?.();},children:"Esc"})})})}var Wu={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}},Uu={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ot(e){return Wu[e]??Uu}function Ex({source:e,className:t}){let r=ot(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]})}function Xu(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Us({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:s}){let{t:a}=i18n.useTranslation(),i=e.tags?.[0],l=ot(e.source),c=react.useMemo(()=>Xu(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",s),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:[c," ",a("predict.event.volume")]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:i.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 Ks({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:s,hasNextPage:a,fetchNextPage:i}=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(c=>c.items).filter(c=>c!=null)??[],[o]),isLoading:n,isFetchingNextPage:s,hasNextPage:a??false,fetchNextPage:i}}var ap=64;function Ys({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...s}){let{events:a,isLoading:i,isFetchingNextPage:l,hasNextPage:c,fetchNextPage:u}=Ks(s),p=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:p}),d=react.useCallback(x=>x<a.length,[a]),g=react.useCallback(async()=>{c&&!l&&await u();},[c,l,u]),f=react.useMemo(()=>c?a.length+1:a.length,[a,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:g,rowCount:f,threshold:5});return i?jsxRuntime.jsx(cp,{className:n}):a.length===0?jsxRuntime.jsx(dp,{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:h,rowComponent:lp,rowCount:f,rowHeight:ap,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function lp({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:s,onHover:a}){let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Us,{event:i,href:n?.(i),LinkComponent:s,onSelect:o,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function cp({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 dp({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 Zs({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:s}=_r(),a=hooks.useCallbackRef(e),i=hooks.useCallbackRef(s),l=react.useMemo(()=>utils.debounce(m=>{n(m),a(m),m&&i(m);},500),[a,i]),c=react.useCallback(m=>{r(m),l(m);},[l]),u=react.useCallback(m=>{l.cancel(),r(m),n(m),a(m),m&&i(m);},[l,a,i]),p=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:c,setKeyword:u,clearKeyword:p}}function Js({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:s,source:a}){let{text:i,keyword:l,setText:c,setKeyword:u,clearKeyword:p}=Zs({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx($s,{value:i,onValueChange:c,onClear:p,onEscape:s}),!l&&jsxRuntime.jsx(zs,{onSelect:u}),jsxRuntime.jsx(Ys,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:a})]})}var Tn="predict-search";function mv({id:e=Tn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(wp,{...t})})}function wp({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:s}=ui$1.useScreen(),a=react.useCallback(l=>{o(l);},[o]),i=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:s?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:s?void 0:14,border:s?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:s?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(Js,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:i})})]})})}function Sv({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:s}=ui$1.useScreen(),{onOpen:a,onClose:i}=uiScaffold.useAsyncModal(Tn),l=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let p=await a({params:t});p&&l(p);}),u=hooks.useCallbackRef(()=>{i();});return react.useEffect(()=>{let p=m=>{let d=document.activeElement,g=!!d&&(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.getAttribute("contenteditable")==="true");m.key==="/"&&!g&&(m.preventDefault(),c()),m.key==="Escape"&&(m.preventDefault(),u());};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p);}},[c,u]),jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:!n,onPress:c,variant:s?"flat":"bordered",startContent:n?jsxRuntime.jsx(ui$1.SearchIcon,{className:"text-neutral"}):void 0,endContent:n?jsxRuntime.jsx(ui$1.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui$1.cn(n&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:n?o("predict.search.placeholder"):jsxRuntime.jsx(ui$1.SearchIcon,{className:"text-neutral"})})}var _n=[{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"}],li=[{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}],si={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"},ii={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 Ip(e,t){if(!e)return "$5K+";let r=li.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function ci({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:s,onRefresh:a}){let{t:i}=i18n.useTranslation(),[l,c]=react.useState(false),[u,p]=react.useState(false),[m,d]=react.useState(false),[g,f]=react.useState(false),h=react.useRef(null),x=react.useRef(null),N=_n.find(v=>v.value===e)??_n[0],E=react.useCallback(v=>{h.current&&!h.current.contains(v.target)&&c(false),x.current&&!x.current.contains(v.target)&&p(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)),[E]);let S=react.useCallback(()=>{a?.(),f(true),setTimeout(()=>f(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
87
+ `):p.description??"";if(!u)return null;let m=u.length>200&&!o?u.slice(0,200)+"...":u;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")}),c.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:Lr(p)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:d=>{a(Number(d)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((d,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:Lr(d)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),u.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(d=>!d),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(d=>!d),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 d=p.status,f=[];return p.created_at&&f.push({label:r("predict.event.timeline.created"),value:Jt(p.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Jt(p.start_at),isActive:d!=="pending"}),d==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Jt(p.closed_at??p.end_at),isActive:true}):d==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Jt(p.closed_at??p.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Jt(p.end_at),isActive:false}),f})().map((d,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 ${d.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:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.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:p.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Jd(p.source)})]})]})]})]})}function np({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 Fi({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Xt,{}):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(Di,{event:o,onTradeAction:r})}function Bi({eventSlug:e,source:t,limit:r=4,onEventClick:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:s}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return s||!i||i.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:n("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3",children:i.map(l=>jsxRuntime.jsx(cp,{event:l,onClick:o},`${l.source}-${l.slug}`))})]})}function cp({event:e,onClick:t}){let r=e.volume;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),className:"flex items-center gap-x-3 rounded-xl border border-border p-3 hover:bg-content2 transition-colors cursor-pointer text-left w-full",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"lg",className:"size-8 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title}),r!=null&&r>0&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral",children:["$",Math.round(r).toLocaleString()," vol"]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{className:"h-4 w-4 text-neutral shrink-0"})]})}function Hi(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function zh({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onBack:i}){let{t:s}=i18n.useTranslation(),{isMobile:l}=ui.useScreen(),{onOpen:a}=uiScaffold.useAsyncModal(Ut),{data:c,isLoading:p}=reactPredict.useEvent({slug:e,source:t}),u=react.useMemo(()=>[...c?.markets||[]].sort((v,N)=>Hi(N)-Hi(v)),[c?.markets]),[m,d]=react.useState(null),f=react.useCallback((v,N,M)=>{d(w=>({market:v,outcome:N,side:M,version:(w?.version??0)+1})),l&&c&&a({params:{event:c,market:v,initialOutcome:N,chain:r}});},[l,c,r,a]),g=m?.market??u[0];if(p){let v=!!i;return l?jsxRuntime.jsx(Xt,{showBack:v}):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(Xt,{showBack:v})}),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(gi,{})})})]})}let h=m?`${m.market.slug}-${m.version}`:g?.slug??"default";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:[i&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:i,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:s("common.back")})}),jsxRuntime.jsx(Fi,{eventSlug:e,source:t,onTradeAction:f})]}),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:[g&&jsxRuntime.jsx(xr,{event:c,market:g,initialSide:m?.side,initialOutcome:m?.outcome,chain:r},h),c&&jsxRuntime.jsx(Bi,{eventSlug:e,source:c.source,onEventClick:n})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(fi,{event:c,walletAddress:o})}),jsxRuntime.jsx(br,{})]})}function zi(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function wp(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var Yh=e=>{let{candlestickMarketSlugs:t,chartRange:r=gr,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>wp(r),[r]),{data:s,isLoading:l,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(v=>f.has(v.slug)?false:(f.add(v.slug),true));return (t&&t.length>0?t.slice(0,4).map(v=>g.find(N=>N.slug===v)).filter(v=>v!==void 0):[...g].sort((v,N)=>zi(N)-zi(v)).slice(0,4)).map(v=>v.slug)},[t,s?.markets]),p=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:c.length>0}))}),u=p.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let v=p[h]?.error;v&&f.set(g,v);}),f},[c,p]),d=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let v=p[h]?.data;v&&f.set(g,v);}),f},[c,p]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:d,isCandlesticksLoading:u,candlestickErrors:m}};var Cp=10,Mp=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Ar(){let[e,t]=jotai.useAtom(Mp),r=react.useCallback(n=>{let i=n.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,Cp)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function Ki({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 Vi({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Ar();return jsxRuntime.jsx(Ki,{className:ui.cn(t),histories:r,onSelect:e,onClear:o})}function ji({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"})})})}var Up={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}},Kp={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function lt(e){return Up[e]??Kp}function Iv({source:e,className:t}){let r=lt(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]})}function Zp(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Gi({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=lt(e.source),c=react.useMemo(()=>Zp(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:p=>{t&&o&&p.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:a.color},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:a.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[c," ",s("predict.event.volume")]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:l.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function qi({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:i,hasNextPage:s,fetchNextPage:l}=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(c=>c.items).filter(c=>c!=null)??[],[o]),isLoading:n,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:l}}var lu=64;function Ji({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:c,fetchNextPage:p}=qi(i),u=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:u}),d=react.useCallback(v=>v<s.length,[s]),f=react.useCallback(async()=>{c&&!a&&await p();},[c,a,p]),g=react.useMemo(()=>c?s.length+1:s.length,[s,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(du,{className:n}):s.length===0?jsxRuntime.jsx(pu,{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:u,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:h,rowComponent:cu,rowCount:g,rowHeight:lu,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function cu({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:i,onHover:s}){let l=r[e];return l?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Gi,{event:l,href:n?.(l),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 du({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 pu({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 na({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Ar(),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(m=>{n(m),s(m),m&&l(m);},500),[s,l]),c=react.useCallback(m=>{r(m),a(m);},[a]),p=react.useCallback(m=>{a.cancel(),r(m),n(m),s(m),m&&l(m);},[a,s,l]),u=react.useCallback(()=>p(""),[p]);return {text:t,keyword:o,setText:c,setKeyword:p,clearKeyword:u}}function oa({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:s}){let{text:l,keyword:a,setText:c,setKeyword:p,clearKeyword:u}=na({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(ji,{value:l,onValueChange:c,onClear:u,onEscape:i}),!a&&jsxRuntime.jsx(Vi,{onSelect:p}),jsxRuntime.jsx(Ji,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:s})]})}var Rn="predict-search";function xx({id:e=Rn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Nu,{...t})})}function Nu({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),s=react.useCallback(a=>{o(a);},[o]),l=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",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(oa,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function Mx({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:i}=ui.useScreen(),{onOpen:s,onClose:l}=uiScaffold.useAsyncModal(Rn),a=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let u=await s({params:t});u&&a(u);}),p=hooks.useCallbackRef(()=>{l();});return react.useEffect(()=>{let u=m=>{let d=document.activeElement,f=!!d&&(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.getAttribute("contenteditable")==="true");m.key==="/"&&!f&&(m.preventDefault(),c()),m.key==="Escape"&&(m.preventDefault(),p());};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[c,p]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!n,onPress:c,variant:i?"flat":"bordered",startContent:n?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:n?jsxRuntime.jsx(ui.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui.cn(n&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:n?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var On=[{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"}],ma=[{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}],da={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"},pa={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 Ou(e,t){if(!e)return "$5K+";let r=ma.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function fa({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),[p,u]=react.useState(false),[m,d]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),v=react.useRef(null),N=On.find(x=>x.value===e)??On[0],M=react.useCallback(x=>{h.current&&!h.current.contains(x.target)&&c(false),v.current&&!v.current.contains(x.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)),[M]);let w=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
22
88
  @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
23
89
  .match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
24
90
  .match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
25
- `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:si,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(v=>!v),p(false);},children:[jsxRuntime.jsx(Op,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:i(N.labelKey)}),jsxRuntime.jsx(ai,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...ii,width:224,padding:4},children:_n.map(v=>{let b=e===v.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:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:H=>{b||(H.currentTarget.style.background="rgba(39,39,42,0.5)",H.currentTarget.style.color="#fff");},onMouseLeave:H=>{b||(H.currentTarget.style.background="transparent",H.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===v.value?o(!r):t(v.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:b?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Ap,{type:v.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:i(v.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:i(v.descKey)})]}),b&&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"})})]},v.value)})})]}),s&&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:si,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{p(v=>!v),c(false);},children:[jsxRuntime.jsx(Dp,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Ip(n,i)}),jsxRuntime.jsx(Fp,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(ai,{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"})}),i("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:i("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:i("predict.matches.filter.tooltipNote")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{...ii,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:i("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:li.map(v=>{let b=v.value===0?!n:n===v.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:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:H=>{b||(H.currentTarget.style.background="rgba(39,39,42,0.5)",H.currentTarget.style.color="#fff");},onMouseLeave:H=>{b||(H.currentTarget.style.background="transparent",H.currentTarget.style.color="#a1a1aa");},onClick:()=>{s?.(v.value===0?void 0:v.value),p(false);},children:[jsxRuntime.jsx("span",{children:v.labelKey?i(v.labelKey):v.label}),b&&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"})})]},v.value)})})]})]}),a&&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:v=>{v.currentTarget.style.background="rgba(39,39,42,1)",v.currentTarget.style.color="#fff";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)",v.currentTarget.style.color="#a1a1aa";},onClick:S,children:jsxRuntime.jsxs("svg",{className:g?"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 Op(){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 Ap({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 Dp(){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 Fp({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 ai({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 zp(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var $p=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>e.toLocaleString(),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=>e.toLocaleString(),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:zp,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function di({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
91
+ `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:da,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(x=>!x),u(false);},children:[jsxRuntime.jsx(Au,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(N.labelKey)}),jsxRuntime.jsx(ua,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...pa,width:224,padding:4},children:On.map(x=>{let b=e===x.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:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:E=>{b||(E.currentTarget.style.background="rgba(39,39,42,0.5)",E.currentTarget.style.color="#fff");},onMouseLeave:E=>{b||(E.currentTarget.style.background="transparent",E.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===x.value?o(!r):t(x.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:b?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Du,{type:x.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(x.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(x.descKey)})]}),b&&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"})})]},x.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:da,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(x=>!x),c(false);},children:[jsxRuntime.jsx(Fu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Ou(n,l)}),jsxRuntime.jsx(Bu,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(ua,{open:p})]}),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"})}),l("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:l("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:l("predict.matches.filter.tooltipNote")})]})]})]}),p&&jsxRuntime.jsxs("div",{style:{...pa,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:l("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:ma.map(x=>{let b=x.value===0?!n:n===x.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:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:E=>{b||(E.currentTarget.style.background="rgba(39,39,42,0.5)",E.currentTarget.style.color="#fff");},onMouseLeave:E=>{b||(E.currentTarget.style.background="transparent",E.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(x.value===0?void 0:x.value),u(false);},children:[jsxRuntime.jsx("span",{children:x.labelKey?l(x.labelKey):x.label}),b&&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"})})]},x.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:x=>{x.currentTarget.style.background="rgba(39,39,42,1)",x.currentTarget.style.color="#fff";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)",x.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 Au(){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 Du({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 Fu(){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 Bu({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 ua({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 $u(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var Wu=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>e.toLocaleString(),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=>e.toLocaleString(),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:$u,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function ga({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
26
92
  @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
27
93
  @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
28
94
  @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@@ -60,14 +126,21 @@
60
126
  .matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
61
127
  @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
62
128
  `}),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(`
63
- `).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:$p.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]):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 Rn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function In(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function Up(e){return e.outcomes?.[0]?.label||null}function Kp(e){return e==null?"low":e>=3?"high":e>=2?"medium":"low"}var fi={high:{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)"},medium:{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)"},low:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},Vp={high:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},medium:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},low:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},ui={high:{dot:"#17c964",label:"predict.matches.confidenceHigh"},medium:{dot:"#f5a524",label:"predict.matches.confidenceMed"},low:{dot:"#71717a",label:"predict.matches.confidenceLow"}};function jp(e,t){return e||(t==null?"low":t>=.9?"high":t>=.7?"medium":"low")}function Gp({tier:e}){let t=fi[e],r=e==="high"?5:e==="medium"?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))})}var Yp={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},qp={text:"#9ca3af",icon:"#9ca3af"};function Qp(e){return Yp[e]??qp}function gi({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:s}=i18n.useTranslation(),a=In(e.market_a),i=In(e.market_b),l=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=Kp(l),u=fi[c],p=a!=null&&i!=null?a<=i?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,d=jp(e.confidence_tier,e.similarity_score),g=ui[d]??ui.low,f=c==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let x=h.currentTarget,N=Vp[c];x.style.borderColor=N.border,x.style.boxShadow=N.shadow,r?.(e);},onMouseLeave:h=>{let x=h.currentTarget;x.style.borderColor="rgba(39,39,42,0.6)",x.style.boxShadow="none";},children:[l!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${u.bandFrom}, ${u.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:u.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:u.color},children:[l.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"SPREAD"})]}),jsxRuntime.jsx(Gp,{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",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",margin:"0 0 12px"},children:m}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(pi,{source:e.source_a,market:e.market_a,isCheaper:p===e.source_a,onClick:()=>t?.(e,e.source_a),href:o?.(e,e.source_a),LinkComponent:n}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(pi,{source:e.source_b,market:e.market_b,isCheaper:p===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),p&&l!=null&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10},children:jsxRuntime.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",borderRadius:8,border:`1px solid ${f==="orange"?"rgba(247,104,22,0.2)":"rgba(199,255,46,0.15)"}`,background:f==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)",cursor:"pointer",transition:"all 0.15s",fontSize:11,fontWeight:500,color:f==="orange"?"rgba(247,104,22,0.9)":"rgba(199,255,46,0.85)"},onMouseEnter:h=>{let x=h.currentTarget;x.style.background=f==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:h=>{let x=h.currentTarget;x.style.background=f==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,p),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,flexShrink:0,color:f==="orange"?"#f76816":"#c7ff2e"},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("predict.matches.buyEdge",{platform:p.charAt(0).toUpperCase()+p.slice(1),spread:l.toFixed(1)}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:10,height:10,color:f==="orange"?"rgba(247,104,22,0.5)":"rgba(199,255,46,0.4)"},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.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"})]}),Rn(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"})}),Rn(e.combined_volume_24h)," ",s("predict.matches.vol24h")]})]}),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:g.dot,flexShrink:0}}),s(g.label)]})]})]})}function pi({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:s}){let{t:a}=i18n.useTranslation(),i=ot(e),l=Qp(e),c=In(t),u=Up(t),p=t.volume,m=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:n||o?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.03)":"transparent";},onClick:o,children:[r?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:90,flexShrink:0},children:[i.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:l.text,textTransform:"uppercase"},children:i.label})]}),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:[Rn(p)," ",a("predict.matches.volume")]})]}),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:r?"#c7ff2e":"#f4f4f5"},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:a("predict.matches.centsYes")})]}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",flexShrink:0},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"})]})]});return n&&s?jsxRuntime.jsx(s,{href:n,className:"block",children:m}):m}var vi=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:s,getMarketHref:a,LinkComponent:i,onStatsChange:l},c){let{t:u}=i18n.useTranslation(),{data:p,hasNextPage:m,fetchNextPage:d,isFetchingNextPage:g,isLoading:f,isPlaceholderData:h,refetch:x}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[N,E]=react.useState(0),[S,v]=react.useState(false);S&&!h?(v(false),E(P=>P+1)):h&&!S&&v(true),react.useImperativeHandle(c,()=>({refetch:()=>{x();}}),[x]);let b=react.useMemo(()=>p?.pages.flatMap(P=>P.items??[])??[],[p]),H=p?.pages[0]?.total,K=react.useMemo(()=>{let P=0,X=0,F=0;for(let z of b){let $=z.spread??0;$>P&&(P=$),$>=.03&&F++,z.combined_volume!=null&&(X+=z.combined_volume);}return {activePairs:H??b.length,maxSpread:P,highSpreadCount:F,totalVolume:X}},[b,H]);react.useEffect(()=>{K.activePairs>0&&l?.(K);},[K,l]);let pe=react.useRef(null);return react.useEffect(()=>{let P=pe.current;if(!P)return;let X=new IntersectionObserver(F=>{F[0]?.isIntersecting&&m&&!g&&d();},{rootMargin:"200px"});return X.observe(P),()=>X.disconnect()},[m,g,d]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),f?jsxRuntime.jsx(nm,{}):b.length===0?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:u("predict.matches.empty")})}):jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
129
+ `).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:Wu.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]):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 An(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Dn(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function Ku(e){return e.outcomes?.[0]?.label||null}function Vu(e){return e==null?"low":e>=3?"high":e>=2?"medium":"low"}var ba={high:{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)"},medium:{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)"},low:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},ju={high:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},medium:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},low:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},ha={high:{dot:"#17c964",label:"predict.matches.confidenceHigh"},medium:{dot:"#f5a524",label:"predict.matches.confidenceMed"},low:{dot:"#71717a",label:"predict.matches.confidenceLow"}};function Yu(e,t){return e||(t==null?"low":t>=.9?"high":t>=.7?"medium":"low")}function Gu({tier:e}){let t=ba[e],r=e==="high"?5:e==="medium"?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))})}var qu={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},Qu={text:"#9ca3af",icon:"#9ca3af"};function Xu(e){return qu[e]??Qu}var Zu=`
130
+ .match-card button:focus-visible,
131
+ .match-card a:focus-visible,
132
+ .match-card [role="button"]:focus-visible {
133
+ outline: 2px solid hsl(var(--heroui-primary) / 0.4);
134
+ outline-offset: 2px;
135
+ }
136
+ `;function ya({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=Dn(e.market_a),l=Dn(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=Vu(a),p=ba[c],u=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,d=Yu(e.confidence_tier,e.similarity_score),f=ha[d]??ha.low,g=c==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group match-card",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let v=h.currentTarget,N=ju[c];v.style.borderColor=N.border,v.style.boxShadow=N.shadow,r?.(e);},onMouseLeave:h=>{let v=h.currentTarget;v.style.borderColor="rgba(39,39,42,0.6)",v.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:Zu}),a!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.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:p.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:p.color},children:[a.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"SPREAD"})]}),jsxRuntime.jsx(Gu,{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",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",margin:"0 0 12px"},children:m}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(va,{source:e.source_a,market:e.market_a,isCheaper:u===e.source_a,onClick:()=>t?.(e,e.source_a),href:o?.(e,e.source_a),LinkComponent:n}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(va,{source:e.source_b,market:e.market_b,isCheaper:u===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),u&&a!=null&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10},children:jsxRuntime.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",borderRadius:8,border:`1px solid ${g==="orange"?"rgba(247,104,22,0.2)":"rgba(199,255,46,0.15)"}`,background:g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)",cursor:"pointer",transition:"all 0.15s",fontSize:11,fontWeight:500,color:g==="orange"?"rgba(247,104,22,0.9)":"rgba(199,255,46,0.85)"},onMouseEnter:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,u),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,flexShrink:0,color:g==="orange"?"#f76816":"#c7ff2e"},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"})}),i("predict.matches.buyEdge",{platform:u.charAt(0).toUpperCase()+u.slice(1),spread:a.toFixed(1)}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:10,height:10,color:g==="orange"?"rgba(247,104,22,0.5)":"rgba(199,255,46,0.4)"},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.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"})]}),An(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"})}),An(e.combined_volume_24h)," ",i("predict.matches.vol24h")]})]}),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:f.dot,flexShrink:0}}),i(f.label)]})]})]})}function va({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=lt(e),a=Xu(e),c=Dn(t),p=Ku(t),u=t.volume,m=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:n||o?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.03)":"transparent";},onClick:o,children:[r?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:90,flexShrink:0},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:a.text,textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[p&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[An(u)," ",s("predict.matches.volume")]})]}),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:r?"#c7ff2e":"#f4f4f5"},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",flexShrink:0},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"})]})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"block",children:m}):m}var Na=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},c){let{t:p}=i18n.useTranslation(),{data:u,hasNextPage:m,fetchNextPage:d,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:v}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[N,M]=react.useState(0),[w,x]=react.useState(false);w&&!h?(x(false),M(I=>I+1)):h&&!w&&x(true),react.useImperativeHandle(c,()=>({refetch:()=>{v();}}),[v]);let b=react.useMemo(()=>u?.pages.flatMap(I=>I.items??[])??[],[u]),E=u?.pages[0]?.total,z=react.useMemo(()=>{let I=0,H=0,$=0;for(let J of b){let ie=J.spread??0;ie>I&&(I=ie),ie>=.03&&$++,J.combined_volume!=null&&(H+=J.combined_volume);}return {activePairs:E??b.length,maxSpread:I,highSpreadCount:$,totalVolume:H}},[b,E]);react.useEffect(()=>{z.activePairs>0&&a?.(z);},[z,a]);let se=react.useRef(null),A=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let I=se.current;if(!I)return;let H=new IntersectionObserver($=>{$[0]?.isIntersecting&&m&&!f&&d();},{rootMargin:"200px"});return H.observe(I),()=>H.disconnect()},[m,f,d]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(am,{});if(b.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:p("predict.matches.empty")})});let ve=!m&&b.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
64
137
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
65
138
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
66
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:p?.pages.map(P=>P.items?.map((X,F)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${F*35}ms both`},children:jsxRuntime.jsx(gi,{match:X,onSelect:n,onHover:s,getMarketHref:a,LinkComponent:i})},`${N}-${X.match_id}-${X.source_a}-${X.market_a?.slug??F}`)))}),jsxRuntime.jsxs("div",{ref:pe,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)}}"}),g&&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"})}),u("predict.matches.loadMore")]})]})]})});function nm(){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, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(om,{index:t},t))})]})}function om({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 cm={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function dm(){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 um({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:e.activePairs.toLocaleString()})]}),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(dm,{})]})]})]})]})}function ab({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,bgImageSrc:n}){let{t:s}=i18n.useTranslation(),[a,i]=react.useState("spread"),[l,c]=react.useState(false),[u,p]=react.useState(5e3),[m,d]=react.useState(),g=react.useRef(null),f=react.useCallback(E=>{i(E);},[]),h=react.useCallback(E=>{c(E);},[]),x=react.useCallback(E=>{react.startTransition(()=>{d(E);});},[]),N=react.useCallback(()=>{g.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
139
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:u?.pages.map(I=>I.items?.map((H,$)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${$*35}ms both`},children:jsxRuntime.jsx(ya,{match:H,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l})},`${N}-${H.match_id}-${H.source_a}-${H.market_a?.slug??$}`)))}),jsxRuntime.jsxs("div",{ref:se,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)}}"}),f&&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"})}),p("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(im,{onScrollToTop:A})]})});function im({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 am(){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, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(sm,{index:t},t))})]})}function sm({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 um={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function mm(){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 fm({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:e.activePairs.toLocaleString()})]}),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(mm,{})]})]})]})]})}function pb({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,bgImageSrc:n}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,c]=react.useState(false),[p,u]=react.useState(5e3),[m,d]=react.useState(),f=react.useRef(null),g=react.useCallback(M=>{l(M);},[]),h=react.useCallback(M=>{c(M);},[]),v=react.useCallback(M=>{react.startTransition(()=>{d(M);});},[]),N=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
67
140
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
68
141
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
69
142
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
70
143
  .match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
71
- `}),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:[n&&jsxRuntime.jsx("img",{src:n,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(di,{stats:m})})]}),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:s(cm[a])}),m&&m.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:s("predict.matches.pairsFound",{count:m.activePairs})})]})]}),jsxRuntime.jsx(ci,{sortBy:a,onSortChange:f,sortAsc:l,onSortAscChange:h,minVolume:u,onMinVolumeChange:p,onRefresh:N})]})]}),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:s("predict.matches.experimentalFeature")})," \u2014 ",s("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(vi,{ref:g,sortBy:a,sortAsc:l,minVolume:u,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,onStatsChange:x})]}),jsxRuntime.jsx(um,{stats:m})]})}function An(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var mm={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"}},fm={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 gm(e){return mm[e]??fm}function hm(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 xm(e,t){let r=e.entries.find(i=>i.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(i=>i.source===(t?.source_b??e.entries[1]?.source)),n=i=>{if(!i?.outcomes?.[0])return {name:null,price:null};let l=i.outcomes[0];return {name:l.label||null,price:l.best_ask??l.price??null}},s=n(t?.market_a),a=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:s.name,yesPrice:s.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:a.name,yesPrice:a.price,volume:o?.event?.volume??null,event:o?.event}]}function mb({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),s=react.useMemo(()=>hm(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[i,l]=react.useMemo(()=>xm(e,s),[e,s]),c=a!=null&&a>=3;i.yesPrice!=null&&l.yesPrice!=null?i.source==="kalshi"?i.yesPrice>l.yesPrice:l.yesPrice>i.yesPrice:false;let p=i.yesPrice!=null&&l.yesPrice!=null?i.yesPrice<=l.yesPrice?i:l:null,m=p?ot(p.source):null,d=c?"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:g=>{let f=g.currentTarget;f.style.borderColor="rgba(63,63,70,0.6)",f.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:g=>{let f=g.currentTarget;f.style.borderColor="rgba(39,39,42,0.6)",f.style.boxShadow="none";},children:[a!=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 ${c?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":a>=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"})}),a.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(ki,{data:i,isCheaper:p===i,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(ki,{data:l,isCheaper:p===l,onSelect:t,getEventHref:r,LinkComponent:o})]}),p&&m&&a!=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 ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="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:d==="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:d==="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:a.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="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"})]}),An(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"})}),An(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 ki({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:s}=i18n.useTranslation(),a=ot(e.source),i=gm(e.source),l=e.event?o?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${i.border}`,background:i.bg,padding:12,cursor:l||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:u=>{u.currentTarget.style.borderColor=i.hoverBorder;},onMouseLeave:u=>{u.currentTarget.style.borderColor=i.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:i.text,textTransform:"uppercase"},children:a.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?i.priceActiveColor:i.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:s("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[An(e.volume)," ",s("predict.matches.volume")]})]});return l&&n?jsxRuntime.jsx(n,{href:l,className:"block",children:c}):c}function ym(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function vb({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,s=0,a=new Set;for(let i of e){i.max_spread!=null&&i.max_spread>n&&(n=i.max_spread),i.combined_volume!=null&&(s+=i.combined_volume);for(let l of i.entries)a.add(typeof l.source=="string"?l.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:s,platformCount:a.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(Ar,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(Dn,{}),jsxRuntime.jsx(Ar,{label:r("predict.matches.stats.totalVolume"),value:ym(o.totalVolume)}),jsxRuntime.jsx(Dn,{}),jsxRuntime.jsx(Ar,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Dn,{}),jsxRuntime.jsx(Ar,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function Ar({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 Dn(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Ni(e){return `${(e*100).toFixed(1)}\xA2`}function km(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function Sb({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",km(e)),children:Ni(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Ni(t)]})]})}var tr=10,Mm=64,Ei=40,Dr=48;function Ti({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,s]=react.useState(1),{data:a,isLoading:i,fetchNextPage:l,hasNextPage:c,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:p,isLoading:m,fetchNextPage:d,hasNextPage:g,isFetchingNextPage:f}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=i||m,x=u||f,N=c||g,E=react.useMemo(()=>{let F=[];return a?.pages&&F.push(...a.pages.flatMap(z=>z.items)),p?.pages&&F.push(...p.pages.flatMap(z=>z.items)),F.sort((z,$)=>($.timestamp??0)-(z.timestamp??0)),F},[a,p]),S=Math.max(1,Math.ceil(E.length/tr)+(N?1:0)),v=(n-1)*tr,b=E.slice(v,v+tr),H=react.useCallback(()=>{s(F=>Math.max(1,F-1));},[]),K=react.useCallback(async()=>{n*tr>=E.length&&N&&(c&&await l(),g&&await d()),s(z=>z+1);},[n,E.length,N,c,g,l,d]),pe=n>1,P=n*tr<E.length||N;if(h)return jsxRuntime.jsx(Im,{height:r});if(E.length===0&&!N)return jsxRuntime.jsx(Rm,{message:o("predict.profile.noHistory"),height:r});let X=r-Ei-Dr;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:Ei},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:X},children:[b.map((F,z)=>jsxRuntime.jsx(Em,{trade:F},F.id??`${v+z}`)),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:Dr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!pe,onClick:H,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",pe?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(S,5)},(F,z)=>{let $=z+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s($),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:!P,onClick:K,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",P?"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-Dr},children:b.map((F,z)=>jsxRuntime.jsx(Tm,{trade:F},F.id??`m-${v+z}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Dr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!pe,onClick:H,className:ui$1.cn("text-sm cursor-pointer",pe?"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:!P,onClick:K,className:ui$1.cn("text-sm cursor-pointer",P?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Em({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,s=Li(e.type,t),a=r,i=a?"+":"-",l=a?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,p=e.outcome??"",m=Oi(e.timestamp),d=_i(e),g=Lm(e),f=_m(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Mm},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:[u&&jsxRuntime.jsx("img",{src:u,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:c}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[p&&jsxRuntime.jsx("span",{className:"mr-1",children:p}),jsxRuntime.jsx("span",{children:m})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"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:Ii(o)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",l),children:n>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i,"$",n.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:f!==null?`$${f.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:d&&jsxRuntime.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ri,{})})})]})}function Tm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,s=Li(e.type,t),a=e.event?.title??e.market?.question??"\u2014",i=Oi(e.timestamp),l=_i(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:i})]}),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-success":"text-danger"),children:t(r?"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:Ii(o)})]}),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:n>0?`$${n.toFixed(2)}`:"\u2014"})]}),l&&jsxRuntime.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ri,{})})]})]})}function Li(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 _i(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function Lm(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 _m(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 Ri(){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 Rm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Im({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 Ii(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Oi(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"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),i=t.getTimezoneOffset(),l=i<=0?"+":"-",c=String(Math.abs(Math.floor(i/60))).padStart(2,"0");return `${r}:${o} ${n}/${s}/${a} (${l}${c})`}var rr=10,zm=64,Di=40,Fr=48;function Hi({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[s,a]=react.useState(1),{data:i,isLoading:l,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:p}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:d,fetchNextPage:g,hasNextPage:f,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=l||d,N=p||h,E=u||f,S=react.useMemo(()=>{let $=[],oe=new Set(["live","open","submitted","pending"]);return i?.pages&&$.push(...i.pages.flatMap(me=>me.items).filter(me=>oe.has(me.status))),m?.pages&&$.push(...m.pages.flatMap(me=>me.items).filter(me=>oe.has(me.status))),$},[i,m]),v=react.useCallback($=>{n.mutate({source:$.source,id:$.id});},[n]),b=Math.max(1,Math.ceil(S.length/rr)+(E?1:0)),H=(s-1)*rr,K=S.slice(H,H+rr),pe=react.useCallback(()=>{a($=>Math.max(1,$-1));},[]),P=react.useCallback(async()=>{s*rr>=S.length&&E&&(u&&await c(),f&&await g()),a(oe=>oe+1);},[s,S.length,E,u,f,c,g]),X=s>1,F=s*rr<S.length||E;if(x)return jsxRuntime.jsx(Km,{height:r});if(S.length===0&&!E)return jsxRuntime.jsx(Um,{message:o("predict.profile.noOrders"),height:r});let z=r-Di-Fr;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:Di},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:z},children:[K.map($=>jsxRuntime.jsx($m,{order:$,onCancel:v},$.id)),N&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Fi,{className:"hidden lg:flex",currentPage:s,totalPages:b,canGoPrev:X,canGoNext:F,onPrev:pe,onNext:P,onPage:a,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Fr},children:K.map($=>jsxRuntime.jsx(Wm,{order:$,onCancel:v},$.id))}),jsxRuntime.jsx(Fi,{className:"lg:hidden",currentPage:s,totalPages:b,canGoPrev:X,canGoNext:F,onPrev:pe,onNext:P,onPage:a,t:o,compact:true})]})}function $m({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,s=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:zm},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?Bi(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:s>0?`$${s.toFixed(2)}`:"\u2014"})]})}function Wm({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?Bi(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 Fi({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:s,onNext:a,onPage:i,t:l,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Fr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:s,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:a,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:Fr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:s,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:()=>i(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:a,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 Um({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Km({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 Bi(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var $n=10,Ym=64,zi=40,Hr=48;function $i({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:s}=i18n.useTranslation(),[a,i]=react.useState(1),l=react.useCallback(()=>{for(let f of e)o?.(f);},[e,o]);if(t)return jsxRuntime.jsx(Zm,{height:r});if(e.length===0)return jsxRuntime.jsx(Xm,{message:s("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/$n)),u=(a-1)*$n,p=e.slice(u,u+$n),m=a>1,d=a<c,g=r-zi-Hr;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:zi},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:s("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:s("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:s("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:s("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:s("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:s("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",s("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:s("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:s("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:s("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:g},children:p.map((f,h)=>jsxRuntime.jsx(qm,{position:f,onClosePosition:o,onEventClick:n},`${f.source}-${f.market?.slug??u+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Hr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>i(f=>Math.max(1,f-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 ",s("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(f,h)=>{let x=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(x),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>i(f=>f+1),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:[s("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Hr},children:p.map((f,h)=>jsxRuntime.jsx(Qm,{position:f,onClose:o,onEventClick:n},`${f.source}-${f.market?.slug??`m-${u+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Hr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>i(f=>Math.max(1,f-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:a}),jsxRuntime.jsx("button",{type:"button",disabled:!d,onClick:()=>i(f=>f+1),className:ui$1.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function qm({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,s=e.pnl_percent??0,a=e.avg_price??0,i=e.current_price??0,l=e.current_value??e.size*i,c=e.size,u=n>0?"text-success":n<0?"text-danger":"text-foreground",p=n>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,g=e.side,f=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?Jm(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:Ym},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:[d&&jsxRuntime.jsx("img",{src:d,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",g.toLowerCase()==="yes"?"text-success":"text-danger"),children:g}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:f})]})]})]})]})}),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:e.size})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Wn(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Wn(i)}),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,s.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),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 Qm({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,s=e.pnl_percent??0,a=e.current_price??0,i=n>0?"text-success":n<0?"text-danger":"text-foreground",l=n>0?"+":"",c=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:c})]}),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(Br,{label:o("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Br,{label:o("predict.profile.markPrice"),value:Wn(a)}),jsxRuntime.jsx(Br,{label:o("predict.profile.pnl"),value:`${l}$${Math.abs(n).toFixed(2)} (${l}${s.toFixed(1)}%)`,className:i}),jsxRuntime.jsx(Br,{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 Br({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 Xm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Zm({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 Wn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Jm(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"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),i=t.getTimezoneOffset(),l=i<=0?"+":"-",c=String(Math.abs(Math.floor(i/60))).padStart(2,"0");return `${r}:${o} ${n}/${s}/${a} (${l}${c})`}catch{return "\u2014"}}function Ui({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let i=0,l=0;for(let d of e)i+=d.realized_pnl??0,l+=d.current_value??d.size*(d.current_price??0);let c=0,u=0,p=0;for(let d of t)c+=d.usd_size??0,d.type==="REDEEM"&&(p++,(d.usd_size??0)>0&&u++);let m=p>0?`${u} / ${p}`:"0 / 0";return {realizedPnl:i,positionsValue:l,volume:c,winRateStr:m}},[e,t]),s=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",a=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",s),children:[a,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Kn,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Kn,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Kn,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Kn({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 Vn=600;function lf({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[s,a]=react.useState("positions"),i=!!(e||t),{data:l,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:p}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let H=[];return l?.positions&&H.push(...l.positions),u?.positions&&H.push(...u.positions),H},[l,u]),d=c||p,{data:g,isLoading:f}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),N=react.useMemo(()=>[...g?.pages?.flatMap(K=>K.items)??[],...h?.pages?.flatMap(K=>K.items)??[]],[g,h]),E=d||f||x,S=m.length,b=[{key:"positions",label:S>0?`${n("predict.profile.positionsTab")} (${S})`:n("predict.profile.positionsTab")},{key:"orders",label:n("predict.profile.openOrdersTab")},{key:"history",label:n("predict.profile.historyTab")}];return i?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Ui,{positions:m,trades:N,isLoading:E}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:b.map(H=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(H.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",s===H.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:H.label},H.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[s==="positions"&&jsxRuntime.jsx($i,{positions:m,isLoading:d,listHeight:Vn,onClosePosition:r,onEventClick:o}),s==="orders"&&jsxRuntime.jsx(Hi,{solanaAddress:e,evmAddress:t,listHeight:Vn}),s==="history"&&jsxRuntime.jsx(Ti,{solanaAddress:e,evmAddress:t,listHeight:Vn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function v1({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:o,onDeployAndApprove:n}){let{t:s}=i18n.useTranslation(),[a,i]=react.useState(false),[l,c]=react.useState(null),[u,p]=react.useState(false),m=r||u,d=o||u,g=m?"done":a?"running":"pending",f=d?"done":m&&a?"running":"pending",h=m&&d,x=react.useCallback(async()=>{c(null),p(false),i(true);try{await n(),p(!0);}catch(v){c(v instanceof Error?v.message:String(v));}finally{i(false);}},[n]),N=[{key:"step1",label:s("predict.setup.step1"),desc:s("predict.setup.step1Desc"),status:g},{key:"step2",label:s("predict.setup.step2"),desc:s("predict.setup.step2Desc"),status:f}],E=()=>{h?t():x();},S=s(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:v=>{v||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:s("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:s("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:N.map((v,b)=>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(mf,{index:b+1,status:v.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:v.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${v.status==="done"?"text-[#c7ff2e]":v.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:v.status==="done"?s("predict.setup.stepComplete"):v.status==="running"?s("predict.setup.stepRunning"):s("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:v.desc})]})]},v.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:E,disabled:a,className:h?"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:a?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"})]}),s("predict.setup.stepRunning")]}):S}),!h&&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:s("common.cancel")})]})]})})})}function mf({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})}
72
- 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,"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,"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,"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=_f;exports.CHART_RANGE_PERIOD=Tf;exports.CHART_RANGE_SAMPLE_INTERVAL=Lf;exports.CandlestickPeriod=ur;exports.CategoriesSkeleton=yf;exports.CategoriesUI=lo;exports.CategoriesWidget=po;exports.ChartRange=Ee;exports.DEFAULT_CHART_RANGE=pr;exports.DEFAULT_FILTER_STATE=nn;exports.DEFAULT_PAGE_SIZE=Bt;exports.DEFAULT_PRICE_HISTORY_INTERVAL=Af;exports.EventDetailPage=Ah;exports.EventDetailSkeleton=Yt;exports.EventDetailUI=_s;exports.EventDetailWidget=Rs;exports.EventItem=Xo;exports.EventMarketDepthChartUI=hs;exports.EventMarketDetailWidget=ks;exports.EventPriceChart=Ns;exports.EventsFilterUI=Ro;exports.EventsPage=b0;exports.EventsPageSkeleton=Wg;exports.EventsSkeleton=sn;exports.EventsToolbarUI=Ho;exports.EventsUI=ns;exports.EventsWidget=ss;exports.KycModal=So;exports.MAX_PRICE_HISTORY_MARKETS=qr;exports.MatchGroupCard=mb;exports.MatchMarketCard=gi;exports.MatchesFilterBar=ci;exports.MatchesHero=di;exports.MatchesPage=ab;exports.MatchesStatsBar=vb;exports.MatchesWidget=vi;exports.ORDER_MAX_PRICE=Of;exports.ORDER_MIN_PRICE=If;exports.ORDER_MIN_QUANTITY=mr;exports.ORDER_MIN_USDC=fr;exports.ORDER_PRICE_STEP=Rf;exports.PREDICT_SEARCH_MODAL_ID=Tn;exports.PREDICT_TRADE_MODAL_ID=zt;exports.PRICE_HISTORY_SAMPLE_INTERVAL=Df;exports.PredictSearchModal=mv;exports.PredictTradeModal=hr;exports.PredictWalletProvider=La;exports.PriceHistoryInterval=kt;exports.ProfilePage=lf;exports.SORT_PRESETS=Fo;exports.STATIC_CATEGORIES=Yr;exports.SearchEventsButton=Sv;exports.SearchHistoryUI=Bs;exports.SearchHistoryWidget=zs;exports.SearchInputUI=$s;exports.SearchResultItemUI=Us;exports.SearchResultListWidget=Ys;exports.SearchWidget=Js;exports.SetupModal=v1;exports.SimilarEventCard=lu;exports.SimilarEventsSection=Is;exports.SourceBadge=Ex;exports.SpreadIndicator=Sb;exports.TradeFormSkeleton=ds;exports.TradeFormUI=Lo;exports.TradeFormWidget=gr;exports.UserActivitySection=cs;exports.countActiveFilters=on;exports.formatKMB=qt;exports.getSourceMeta=ot;exports.useEventDetail=Wh;exports.useEventsInfinite=$o;exports.usePredictSearchHistory=_r;exports.usePredictWallet=Xr;exports.useSearchResultListScript=Ks;exports.useSearchScript=Zs;exports.useTradeForm=ko;exports.version=ga;//# sourceMappingURL=index.js.map
144
+ `}),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:[n&&jsxRuntime.jsx("img",{src:n,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(ga,{stats:m})})]}),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:i(um[s])}),m&&m.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:i("predict.matches.pairsFound",{count:m.activePairs})})]})]}),jsxRuntime.jsx(fa,{sortBy:s,onSortChange:g,sortAsc:a,onSortAscChange:h,minVolume:p,onMinVolumeChange:u,onRefresh:N})]})]}),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:i("predict.matches.experimentalFeature")})," \u2014 ",i("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Na,{ref:f,sortBy:s,sortAsc:a,minVolume:p,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,onStatsChange:v})]}),jsxRuntime.jsx(fm,{stats:m})]})}function Bn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var hm={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"}},vm={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 xm(e){return hm[e]??vm}function bm(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 ym(e,t){let r=e.entries.find(l=>l.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(l=>l.source===(t?.source_b??e.entries[1]?.source)),n=l=>{if(!l?.outcomes?.[0])return {name:null,price:null};let a=l.outcomes[0];return {name:a.label||null,price:a.best_ask??a.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 vb({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>bm(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[l,a]=react.useMemo(()=>ym(e,i),[e,i]),c=s!=null&&s>=3;l.yesPrice!=null&&a.yesPrice!=null?l.source==="kalshi"?l.yesPrice>a.yesPrice:a.yesPrice>l.yesPrice:false;let u=l.yesPrice!=null&&a.yesPrice!=null?l.yesPrice<=a.yesPrice?l:a:null,m=u?lt(u.source):null,d=c?"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 ${c?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#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(Ma,{data:l,isCheaper:u===l,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(Ma,{data:a,isCheaper:u===a,onSelect:t,getEventHref:r,LinkComponent:o})]}),u&&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 ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>u.event&&t?.(u.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="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:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:u.source.charAt(0).toUpperCase()+u.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="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"})]}),Bn(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"})}),Bn(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 Ma({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=lt(e.source),l=xm(e.source),a=e.event?o?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${l.border}`,background:l.bg,padding:12,cursor:a||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:p=>{p.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:p=>{p.currentTarget.style.borderColor=l.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:l.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?l.priceActiveColor:l.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:[Bn(e.volume)," ",i("predict.matches.volume")]})]});return a&&n?jsxRuntime.jsx(n,{href:a,className:"block",children:c}):c}function wm(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function Sb({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,i=0,s=new Set;for(let l of e){l.max_spread!=null&&l.max_spread>n&&(n=l.max_spread),l.combined_volume!=null&&(i+=l.combined_volume);for(let a of l.entries)s.add(typeof a.source=="string"?a.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(Hr,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.totalVolume"),value:wm(o.totalVolume)}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function Hr({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 Hn(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function La(e){return `${(e*100).toFixed(1)}\xA2`}function Nm(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function Cb({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",Nm(e)),children:La(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",La(t)]})]})}var or=10,Lm=64,Oa=40,zr=48;function Aa({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(1),{data:s,isLoading:l,fetchNextPage:a,hasNextPage:c,isFetchingNextPage:p}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:u,isLoading:m,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=l||m,v=p||g,N=c||f,M=react.useMemo(()=>{let I=[];return s?.pages&&I.push(...s.pages.flatMap(H=>H.items)),u?.pages&&I.push(...u.pages.flatMap(H=>H.items)),I.sort((H,$)=>($.timestamp??0)-(H.timestamp??0)),I},[s,u]),w=Math.max(1,Math.ceil(M.length/or)+(N?1:0)),x=(n-1)*or,b=M.slice(x,x+or),E=react.useCallback(()=>{i(I=>Math.max(1,I-1));},[]),z=react.useCallback(async()=>{n*or>=M.length&&N&&(c&&await a(),f&&await d()),i(H=>H+1);},[n,M.length,N,c,f,a,d]),se=n>1,A=n*or<M.length||N;if(h)return jsxRuntime.jsx(Dm,{height:r});if(M.length===0&&!N)return jsxRuntime.jsx(Am,{message:o("predict.profile.noHistory"),height:r});let ve=r-Oa-zr;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:Oa},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:ve},children:[b.map((I,H)=>jsxRuntime.jsx(_m,{trade:I},I.id??`${x+H}`)),v&&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:zr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!se,onClick:E,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",se?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(w,5)},(I,H)=>{let $=H+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i($),className:ui.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:!A,onClick:z,className:ui.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:[o("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zr},children:b.map((I,H)=>jsxRuntime.jsx(Rm,{trade:I},I.id??`m-${x+H}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:zr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!se,onClick:E,className:ui.cn("text-sm cursor-pointer",se?"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:!A,onClick:z,className:ui.cn("text-sm cursor-pointer",A?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function _m({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Da(e.type,t),s=r,l=s?"+":"-",a=s?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,u=e.outcome??"",m=za(e.timestamp),d=Fa(e),f=Im(e),g=Om(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Lm},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:c}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[u&&jsxRuntime.jsx("span",{className:"mr-1",children:u}),jsxRuntime.jsx("span",{children:m})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ha(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",a),children:n>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",n.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",f!==null?f>=0?"text-success":"text-danger":"text-neutral"),children:f!==null?`${f>=0?"+":"-"}$${Math.abs(f).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:g!==null?`$${g.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:d&&jsxRuntime.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ba,{})})})]})}function Rm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Da(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=za(e.timestamp),a=Fa(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:s})]}),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-success":"text-danger"),children:t(r?"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:i})]}),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:Ha(o)})]}),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:n>0?`$${n.toFixed(2)}`:"\u2014"})]}),a&&jsxRuntime.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ba,{})})]})]})}function Da(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 Fa(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function Im(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 Om(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 Ba(){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 Am({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Dm({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 Ha(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function za(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(),l=t.getTimezoneOffset(),a=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${a}${c})`}var ir=10,Um=64,Wa=40,$r=48;function Ka({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:l,isLoading:a,fetchNextPage:c,hasNextPage:p,isFetchingNextPage:u}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:d,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),v=a||d,N=u||h,M=p||g,w=react.useMemo(()=>{let $=[],J=new Set(["live","open","submitted","pending"]);return l?.pages&&$.push(...l.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),m?.pages&&$.push(...m.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),$},[l,m]),x=react.useCallback($=>{n.mutate({source:$.source,id:$.id});},[n]),b=Math.max(1,Math.ceil(w.length/ir)+(M?1:0)),E=(i-1)*ir,z=w.slice(E,E+ir),se=react.useCallback(()=>{s($=>Math.max(1,$-1));},[]),A=react.useCallback(async()=>{i*ir>=w.length&&M&&(p&&await c(),g&&await f()),s(J=>J+1);},[i,w.length,M,p,g,c,f]),ve=i>1,I=i*ir<w.length||M;if(v)return jsxRuntime.jsx(Ym,{height:r});if(w.length===0&&!M)return jsxRuntime.jsx(jm,{message:o("predict.profile.noOrders"),height:r});let H=r-Wa-$r;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:Wa},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:H},children:[z.map($=>jsxRuntime.jsx(Km,{order:$,onCancel:x},$.id)),N&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Ua,{className:"hidden lg:flex",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:se,onNext:A,onPage:s,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-$r},children:z.map($=>jsxRuntime.jsx(Vm,{order:$,onCancel:x},$.id))}),jsxRuntime.jsx(Ua,{className:"lg:hidden",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:se,onNext:A,onPage:s,t:o,compact:true})]})}function Km({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:Um},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?Va(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Vm({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?Va(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 Ua({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:i,onNext:s,onPage:l,t:a,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:$r},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:$r},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 ",a("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(p,u)=>{let m=u+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(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:[a("predict.profile.next")," \u2192"]})]})}function jm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Ym({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 Va(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Kn=10,Xm=64,ja=40,Wr=48;function Ya({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(1),a=react.useCallback(()=>{for(let g of e)o?.(g);},[e,o]);if(t)return jsxRuntime.jsx(tf,{height:r});if(e.length===0)return jsxRuntime.jsx(ef,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/Kn)),p=(s-1)*Kn,u=e.slice(p,p+Kn),m=s>1,d=s<c,f=r-ja-Wr;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:ja},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:a,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:u.map((g,h)=>jsxRuntime.jsx(Zm,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??p+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Wr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>l(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(c,5)},(g,h)=>{let v=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(v),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",v===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:v},v)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>l(g=>g+1),className:ui.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:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Wr},children:u.map((g,h)=>jsxRuntime.jsx(Jm,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${p+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Wr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>l(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:!d,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Zm({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,l=e.current_price??0,a=e.current_value??e.size*l,c=e.size,p=n>0?"text-success":n<0?"text-danger":"text-foreground",u=n>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?rf(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:Xm},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:[d&&jsxRuntime.jsx("img",{src:d,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:["$",a.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count: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:Vn(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Vn(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",p),children:[jsxRuntime.jsxs("span",{children:[u,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),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 Jm({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,l=n>0?"text-success":n<0?"text-danger":"text-foreground",a=n>0?"+":"",c=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:c})]}),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(Ur,{label:o("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Ur,{label:o("predict.profile.markPrice"),value:Vn(s)}),jsxRuntime.jsx(Ur,{label:o("predict.profile.pnl"),value:`${a}$${Math.abs(n).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx(Ur,{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 Ur({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 ef({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function tf({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 Vn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function rf(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(),l=t.getTimezoneOffset(),a=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${s} (${a}${c})`}catch{return "\u2014"}}function qa({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let l=0,a=0;for(let d of e)l+=d.realized_pnl??0,a+=d.current_value??d.size*(d.current_price??0);let c=0,p=0,u=0;for(let d of t)c+=d.usd_size??0,d.type==="REDEEM"&&(u++,(d.usd_size??0)>0&&p++);let m=u>0?`${p} / ${u}`:"0 / 0";return {realizedPnl:l,positionsValue:a,volume:c,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(Yn,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Yn,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Yn,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Yn({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 Gn=600;function pf({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState("positions"),l=!!(e||t),{data:a,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:p,isLoading:u}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let E=[];return a?.positions&&E.push(...a.positions),p?.positions&&E.push(...p.positions),E},[a,p]),d=c||u,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:v}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),N=react.useMemo(()=>[...f?.pages?.flatMap(z=>z.items)??[],...h?.pages?.flatMap(z=>z.items)??[]],[f,h]),M=d||g||v,w=m.length,b=[{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 l?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(qa,{positions:m,trades:N,isLoading:M}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:b.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(E.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===E.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:E.label},E.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Ya,{positions:m,isLoading:d,listHeight:Gn,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Ka,{solanaAddress:e,evmAddress:t,listHeight:Gn}),i==="history"&&jsxRuntime.jsx(Aa,{solanaAddress:e,evmAddress:t,listHeight:Gn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function S1({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:o,onDeployAndApprove:n}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(false),[a,c]=react.useState(null),[p,u]=react.useState(false),m=r||p,d=o||p,f=m?"done":s?"running":"pending",g=d?"done":m&&s?"running":"pending",h=m&&d,v=react.useCallback(async()=>{c(null),u(false),l(true);try{await n(),u(!0);}catch(x){c(x instanceof Error?x.message:String(x));}finally{l(false);}},[n]),N=[{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}],M=()=>{h?t():v();},w=i(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:x=>{x||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:N.map((x,b)=>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(hf,{index:b+1,status:x.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:x.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${x.status==="done"?"text-[#c7ff2e]":x.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:x.status==="done"?i("predict.setup.stepComplete"):x.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:x.desc})]})]},x.key))}),a&&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:a})}),jsxRuntime.jsx("button",{type:"button",onClick:M,disabled:s,className:h?"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}),!h&&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 hf({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})}
145
+ 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,"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=Of;exports.CHART_RANGE_PERIOD=Rf;exports.CHART_RANGE_SAMPLE_INTERVAL=If;exports.CandlestickPeriod=fr;exports.CategoriesSkeleton=wf;exports.CategoriesUI=uo;exports.CategoriesWidget=go;exports.ChartRange=Ee;exports.DEFAULT_CHART_RANGE=gr;exports.DEFAULT_FILTER_STATE=ln;exports.DEFAULT_PAGE_SIZE=Wt;exports.DEFAULT_PRICE_HISTORY_INTERVAL=Bf;exports.EventDetailPage=zh;exports.EventDetailSkeleton=Xt;exports.EventDetailUI=Di;exports.EventDetailWidget=Fi;exports.EventItem=ni;exports.EventMarketDepthChartUI=ki;exports.EventMarketDetailWidget=Ci;exports.EventPriceChart=Ti;exports.EventsFilterUI=Ao;exports.EventsHero=Fo;exports.EventsPage=w0;exports.EventsPageSkeleton=Gg;exports.EventsSkeleton=dn;exports.EventsToolbarUI=Uo;exports.EventsUI=li;exports.EventsWidget=di;exports.KycModal=Po;exports.MAX_PRICE_HISTORY_MARKETS=Jr;exports.MatchGroupCard=vb;exports.MatchMarketCard=ya;exports.MatchesFilterBar=fa;exports.MatchesHero=ga;exports.MatchesPage=pb;exports.MatchesStatsBar=Sb;exports.MatchesWidget=Na;exports.ORDER_MAX_PRICE=Ff;exports.ORDER_MIN_PRICE=Df;exports.ORDER_MIN_QUANTITY=hr;exports.ORDER_MIN_USDC=vr;exports.ORDER_PRICE_STEP=Af;exports.PREDICT_SEARCH_MODAL_ID=Rn;exports.PREDICT_TRADE_MODAL_ID=Ut;exports.PRICE_HISTORY_SAMPLE_INTERVAL=Hf;exports.PredictSearchModal=xx;exports.PredictTradeModal=br;exports.PredictWalletProvider=Ds;exports.PriceHistoryInterval=Pt;exports.ProfilePage=pf;exports.SORT_PRESETS=Wo;exports.STATIC_CATEGORIES=Zr;exports.SearchEventsButton=Mx;exports.SearchHistoryUI=Ki;exports.SearchHistoryWidget=Vi;exports.SearchInputUI=ji;exports.SearchResultItemUI=Gi;exports.SearchResultListWidget=Ji;exports.SearchWidget=oa;exports.SetupModal=S1;exports.SimilarEventCard=cp;exports.SimilarEventsSection=Bi;exports.SourceBadge=Iv;exports.SpreadIndicator=Cb;exports.TradeFormSkeleton=gi;exports.TradeFormUI=Io;exports.TradeFormWidget=xr;exports.UserActivitySection=fi;exports.countActiveFilters=cn;exports.formatKMB=Zt;exports.getSourceMeta=lt;exports.useEventDetail=Yh;exports.useEventsInfinite=jo;exports.usePredictSearchHistory=Ar;exports.usePredictWallet=tn;exports.useSearchResultListScript=qi;exports.useSearchScript=na;exports.useTradeForm=No;exports.version=ks;//# sourceMappingURL=index.js.map
73
146
  //# sourceMappingURL=index.js.map