@liberfi.io/ui-predict 0.1.136 → 0.1.138

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,42 +1,4 @@
1
- 'use strict';var react=require('react'),reactPredict=require('@liberfi.io/react-predict'),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'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),Un=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Un__default=/*#__PURE__*/_interopDefault(Un);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.136");var sl="0.1.136";var ll={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},Uo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],zn=(()=>{let e=t=>{let r=Uo.indexOf(t);return r===-1?Uo.length:r};return Object.entries(ll).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 jo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),u=react.useCallback(()=>{n(null);},[n]),d=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-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(Ko,{label:d,isSelected:t===null,onPress:u,showPulse:d===l}),jsxRuntime.jsx(ul,{}),e.map(m=>jsxRuntime.jsx(Ko,{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(Vo,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(Vo,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function Ko({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function ul(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function Vo({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Xg({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function ml(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function fl(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function qo({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=ml(zn),u=zn.find(m=>m.slug===o),d=fl(u);return jsxRuntime.jsx(jo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:d,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function Xr(e){return {title:e.title,imageUrl:e.image_url}}function Jr(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 br=24,$n=4,Zr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ue={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},en=Ue.ALL,a0={[Ue.ONE_DAY]:Zr.ONE_MINUTE,[Ue.ONE_WEEK]:Zr.ONE_HOUR,[Ue.ONE_MONTH]:Zr.ONE_HOUR,[Ue.ALL]:Zr.ONE_DAY},s0={[Ue.ONE_DAY]:300,[Ue.ONE_WEEK]:3600,[Ue.ONE_MONTH]:10800,[Ue.ALL]:1440*60},l0={[Ue.ONE_DAY]:1440*60,[Ue.ONE_WEEK]:10080*60,[Ue.ONE_MONTH]:720*60*60,[Ue.ALL]:null},tn=1,rn=1,c0=1,d0=1,p0=99,cr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},u0=cr.ONE_WEEK,m0={[cr.ONE_HOUR]:60,[cr.SIX_HOURS]:60,[cr.ONE_DAY]:300,[cr.ONE_WEEK]:1800,[cr.MAX]:1800};var Jo=react.createContext(null);function yr(){let e=react.useContext(Jo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var kl=1e4;function Sl({pollingInterval:e=kl,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(h=>h.chainNamespace===types.ChainNamespace.SOLANA&&h.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(h=>h.chainNamespace===types.ChainNamespace.EVM&&h.isConnected)?.address,[o]),{data:s,isLoading:l,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:u,isLoading:d}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:m,isLoading:p}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:v,isLoading:x,isFetching:S,error:k}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),M=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&v?Number(v.balance):null,kalshiKycVerified:u?.verified??false,kalshiKycUrl:u?.kyc_url??null,kalshiKycLoading:d,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:p,isLoading:l||x,isFetching:a||S,error:c??k??null}),[n,i,f,s,v,g,u,d,m,p,l,x,a,S,c,k]);return jsxRuntime.jsx(Jo.Provider,{value:M,children:r})}var Nl={minutes:60,hours:3600,days:86400};function nn(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*Nl[r]}}function on(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function rt(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function an(e,t,r){let o=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(o)return t("predict.trade.polymarket.minOrderSize",{current:o[1],min:o[2]});let n=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(n){let s=parseInt(n[1],10)/1e6,l=parseInt(n[2],10)/1e6,a=Math.max(0,s-l);return t("predict.trade.polymarket.insufficientBalance",{total:s.toFixed(2),active:l.toFixed(2),available:a.toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=4){return parseFloat(rt(e,t).toFixed(t)).toString()}function Yt(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Un__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Un__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Un__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function ri({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:o}=walletConnector.useAuth(),n=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),a=reactQuery.useQueryClient(),c=e.source,u=c==="polymarket",d=n.find(D=>D.chainNamespace===types.ChainNamespace.SOLANA&&D.isConnected),m=n.find(D=>D.chainNamespace===types.ChainNamespace.EVM&&D.isConnected&&"switchChain"in D),p=o==="authenticated",f=d?.address,g=m?.address,v=react.useMemo(()=>{if(c!=="polymarket")return;let D=e.provider_meta?.["polymarket.clobTokenIds"];return D?(typeof D=="string"?JSON.parse(D):D)[0]:void 0},[c,e.provider_meta]),{data:x}=reactPredict.useTickSize(v),S=x?.minimum_tick_size?String(x.minimum_tick_size):"0.01",[k,M]=react.useState(t),[h,T]=react.useState("market"),[b,K]=react.useState(NaN),[I,Y]=react.useState(NaN),[ve,P]=react.useState(false),[z,F]=react.useState(null),[ne,L]=react.useState(false),[y,R]=react.useState(false),[U,ee]=react.useState("1h"),[Q,ae]=react.useState(30),[we,ze]=react.useState("minutes"),pe=null,Je=false,ct=null,De;try{let D=yr();pe={kalshiUsdcBalance:D.kalshiUsdcBalance,polymarketUsdcBalance:D.polymarketUsdcBalance,isLoading:D.isLoading},Je=D.kalshiKycVerified,ct=D.kalshiKycUrl,De=D.polymarketSafeAddress;}catch{}let he=react.useMemo(()=>{let D=k==="yes"?0:1,Me=e.outcomes[D];return Me?.best_ask??Me?.price??.5},[e.outcomes,k]),dt=react.useCallback(D=>{T(D);},[]),Ze=react.useCallback(D=>{M(D),Y(NaN);},[]);react.useEffect(()=>{h==="limit"&&isNaN(I)&&Y(Math.round(he*100)/100);},[h,I,he]);let pt=react.useMemo(()=>isNaN(b)||b<=0?0:he>0?b/he:0,[b,he]),E=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),ke=e.provider_meta?.["dflow.yesMint"]??"",Ae=e.provider_meta?.["dflow.noMint"]??"",vr=utils.SOLANA_TOKENS.stablecoins.USDC.address,O=k==="yes"?ke:Ae,ue=vr,$e=O,or=c==="kalshi"?f??"":g??"",{data:Kt,isLoading:Rt}=reactPredict.usePositions({source:c,user:or},{enabled:!!or}),Fe=c==="kalshi"&&!!ue&&!!$e&&!!f&&E!=="0",{refetch:zr}=reactPredict.useDFlowQuote({inputMint:ue,outputMint:$e,amount:E,userPublicKey:f??"",slippageBps:100},{enabled:Fe}),ir=react.useMemo(()=>pe?c==="kalshi"?pe.kalshiUsdcBalance:pe.polymarketUsdcBalance:Kt&&Kt.positions.reduce((Me,tt)=>tt.side==="USDC"||tt.side==="collateral"?Me+(tt.current_value??0):Me,0)||null,[pe,Kt,c]),An=pe?pe.isLoading:Rt,ut=react.useMemo(()=>h==="limit"&&u&&!isNaN(I)?I:he,[h,u,I,he]),$r=react.useMemo(()=>isNaN(b)||b<=0?0:b,[b]),Wr=react.useMemo(()=>isNaN(b)||b<=0?0:ut>0?b/ut*1:0,[b,ut]),Bo=Wr-$r,Ur=react.useCallback(D=>{if(isNaN(D)){K(NaN);return}K(Math.round(Math.max(0,D)*100)/100);},[]),Fn=react.useCallback(D=>{if(isNaN(D)){Y(NaN);return}let Me=Math.max(.01,Math.min(.99,D));Y(Math.round(Me*100)/100);},[]),mt=react.useCallback(()=>{K(NaN),Y(NaN),T("market"),R(false),ee("1h"),ae(30),ze("minutes");},[]),xt=react.useMemo(()=>{let D=[];return isNaN(b)||b<=0?D.push(r("predict.trade.minAmountUsd",{amount:rn})):b<rn&&D.push(r("predict.trade.minAmountUsd",{amount:rn})),e.status!=="open"&&D.push(r("predict.trade.marketNotActive")),ir!=null&&!isNaN(b)&&b>0&&b>ir&&D.push(r("predict.trade.insufficientBalance")),h==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&D.push(r("predict.trade.limitPriceRange")),h==="limit"&&u&&y&&U==="custom"&&(isNaN(Q)||Q<=0)&&D.push(r("predict.trade.expiration.invalidDate")),{isValid:D.length===0,errors:D}},[b,e.status,ir,h,u,I,y,U,Q,r]),{mutateAsync:It}=reactPredict.useDFlowSubmit(),{data:Ot}=reactPredict.useOrder({id:z??"",source:c},{enabled:!!z});react.useEffect(()=>{if(!Ot||!z)return;let{status:D}=Ot;D==="closed"?(F(null),P(false),ui$1.toast.success(r("predict.trade.submitSuccess")),Yt(),mt(),a.invalidateQueries({queryKey:["predict","positions"]})):(D==="failed"||D==="expired")&&(P(false),F(null),ui$1.toast.error(r("predict.trade.submitError")));},[Ot,z,a,mt,r]);let Kr=react.useCallback(async()=>{if(!f||!d)return;if(!ue||!$e){ui$1.toast.error("Missing token mint addresses"),P(false);return}if(!Je){L(true),P(false);return}let ar=(await zr()).data?.transaction;if(!ar){ui$1.toast.error(r("predict.trade.submitError")),P(false);return}let Dt=Uint8Array.from(atob(ar),At=>At.charCodeAt(0)),bt=await d.signTransaction(Dt),yt=await It({signedTransaction:btoa(String.fromCharCode(...bt)),orderContext:{user_public_key:f,input_mint:ue,output_mint:$e,amount:E,price:String(he),side:"BUY",outcome:k==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});F(yt.signature);},[f,d,zr,It,ue,$e,E,he,k,e.slug,r,Je]),xr=react.useCallback(async()=>{if(!m||!l)return;let D=m.chain,Me=D!==types.Chain.POLYGON;Me&&await i(types.Chain.POLYGON);try{let tt=await m.getEip1193Provider();if(!tt){ui$1.toast.error(r("predict.trade.submitError")),P(!1);return}let ar=!!De,Dt={address:m.address,signatureType:ar?2:0,signTypedData:async(me,Ft,qr,Hn)=>{let Bt=[];"name"in me&&Bt.push({name:"name",type:"string"}),"version"in me&&Bt.push({name:"version",type:"string"}),"chainId"in me&&Bt.push({name:"chainId",type:"uint256"}),"verifyingContract"in me&&Bt.push({name:"verifyingContract",type:"address"}),"salt"in me&&Bt.push({name:"salt",type:"bytes32"});let Ho={EIP712Domain:Bt,...Ft};return await tt.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:me,types:Ho,primaryType:qr,message:Hn})]})}},bt=l.credentials??await l.authenticate(Dt),yt=k==="yes"?0:1,At="",kt=e.provider_meta?.["polymarket.clobTokenIds"];kt&&(At=(typeof kt=="string"?JSON.parse(kt):kt)[yt]??"");let sr=e.provider_meta?.["polymarket.negRisk"]??!1,Vr=h==="limit"&&!isNaN(I)?I:he,St=on(Vr,S),jr=h==="limit"?y?"GTD":"GTC":"FOK",Yr=h==="market"?b:St>0?b/St:0,Gr={tokenId:At,price:St,size:Yr,side:"BUY",orderType:jr,tickSize:S,negRisk:sr,...De&&{funderAddress:De},...h==="limit"&&y&&{expiration:nn(U,Q,we)}},N=reactPredict.buildCtfExchangeDomain(sr),xe=reactPredict.buildOrderMessage({...Gr,signerAddress:Dt.address,signatureType:Dt.signatureType}),We=await Dt.signTypedData(N,reactPredict.CTF_ORDER_TYPES,"Order",xe),_e=reactPredict.buildSignedOrder(xe,We,Gr.orderType),et=reactPredict.buildClobPayload(_e,bt.apiKey),Be=JSON.stringify(et),wt=await reactPredict.buildPolymarketL2Headers(bt.address,{apiKey:bt.apiKey,secret:bt.secret,passphrase:bt.passphrase,method:"POST",requestPath:"/order",body:Be});await s.createPolymarketOrder(et,wt),a.invalidateQueries({queryKey:["predict","orders"]}),a.invalidateQueries({queryKey:["predict","positions"]}),ui$1.toast.success(r("predict.trade.submitSuccess")),Yt(),mt(),P(!1);}finally{Me&&D&&i(D).catch(()=>{});}},[m,l,i,k,e.provider_meta,h,I,he,b,s,a,y,U,Q,we,mt,r,S,De]),Bn=react.useCallback(async()=>{if(!(!xt.isValid||!p)){P(true),F(null),L(false);try{c==="kalshi"?await Kr():await xr();}catch(D){let Me=D instanceof Error?D.message:"",tt=c==="polymarket"&&Me?an(Me,r,"buy"):Me||void 0;ui$1.toast.error(tt||r("predict.trade.submitError")),P(false);}}},[xt.isValid,p,c,Kr,xr,r]);return {outcome:k,orderType:h,quantity:b,limitPrice:I,shares:pt,estimatedCost:$r,potentialPayout:Wr,potentialProfit:Bo,usdcBalance:ir,isBalanceLoading:An,isSubmitting:ve,validation:xt,supportsLimitOrder:u,kycRequired:ne,kycUrl:ct,expirationEnabled:y,expirationPreset:U,customDuration:Q,customDurationUnit:we,setOutcome:Ze,setOrderType:dt,setQuantity:Ur,setLimitPrice:Fn,setExpirationEnabled:R,setExpirationPreset:ee,setCustomDuration:ae,setCustomDurationUnit:ze,submit:Bn}}function sn({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 oc=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,ic=["5m","1h","12h","24h","eod","custom"],ac={"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"},sc=["minutes","hours","days"],lc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},cc={maximumFractionDigits:0};function di({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,shares:l,potentialProfit:a,potentialPayout:c,estimatedCost:u,usdcBalance:d,isBalanceLoading:m,isSubmitting:p,isValid:f,validationErrors:g,supportsLimitOrder:v,kycRequired:x,kycUrl:S,expirationEnabled:k,expirationPreset:M,customDuration:h,customDurationUnit:T,onOutcomeChange:b,onOrderTypeChange:K,onQuantityChange:I,onLimitPriceChange:Y,onExpirationEnabledChange:ve,onExpirationPresetChange:P,onCustomDurationChange:z,onCustomDurationUnitChange:F,onSubmit:ne}){let{t:L}=i18n.useTranslation(),[y,R]=react.useState(false),U=ui$1.useDisclosure(),[ee,Q]=react.useState(""),ae=react.useRef(false);react.useEffect(()=>{ae.current||Q(isNaN(i)?"":String(i));},[i]);let[we,ze]=react.useState(""),pe=react.useRef(false);react.useEffect(()=>{pe.current||(isNaN(s)?ze(""):ze(String(parseFloat((s*100).toFixed(2)))));},[s]);let Je=react.useCallback(O=>{if(O!==""&&!/^\d*\.?\d{0,2}$/.test(O))return;if(ze(O),O===""||O==="."){Y(NaN);return}let $e=parseFloat(O);isNaN($e)||Y($e/100);},[Y]),ct=react.useCallback(O=>{if(O!==""&&!/^\d*\.?\d{0,2}$/.test(O))return;if(Q(O),Ae(false),O===""||O==="."){I(NaN);return}let $e=parseFloat(O);isNaN($e)||I($e);},[I]);react.useEffect(()=>{x&&!U.isOpen&&U.onOpen();},[x]);let De=react.useMemo(()=>{let O=o==="yes"?t.yesAsk:t.noAsk;return O!=null?parseFloat((Number(O)*100).toFixed(2)):null},[o,t]),he=!isNaN(i)&&i>0,dt=react.useMemo(()=>{if(m)return L("predict.trade.loadingBalance");if(p)return L("predict.trade.submitting");if(x)return L("predict.trade.kycRequired");if(!he)return L("predict.trade.enterAmount");let O=L(o==="yes"?"predict.trade.yes":"predict.trade.no"),ue=a>0?` \u2192 Win $${a.toFixed(2)}`:"";return `${L("predict.trade.buy")} ${O}${ue}`},[m,p,x,he,o,a,L]),Ze=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),pt=()=>{I(Math.floor((d??0)/2*100)/100);},E=()=>{I(d??0);},[ke,Ae]=react.useState(false),vr=()=>{if(x){U.onOpen();return}if(!f){Ae(true);return}Ae(false),ne();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:O=>{r==="bordered"&&(O.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:O=>{r==="bordered"&&(O.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:o==="yes"?"text-bullish":"text-bearish",children:[L("predict.trade.buy")," ",L(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:[v?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:O=>K(O),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:L("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:L("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:L("predict.trade.market")}),n==="limit"&&v?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:we,onChange:O=>Je(O.target.value),onFocus:()=>{pe.current=true;},onBlur:()=>{pe.current=false,isNaN(s)?ze(""):ze(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):De!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[De," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(O=>{let ue=O==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(O),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===O?O==="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:L(O==="yes"?"predict.trade.yes":"predict.trade.no")}),ue!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(ue)*100).toFixed(2)),"\xA2"]})]})},O)})}),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:L("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:oc,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`${d.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:pt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:L("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:E,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:L("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:ee,onChange:O=>ct(O.target.value),onFocus:()=>{ae.current=true;},onBlur:()=>{ae.current=false,Q(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ke&&g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:g.map(O=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:O},O))})]}),n==="limit"&&v&&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:L("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:k,onValueChange:ve,"aria-label":L("predict.trade.setExpiration")})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":L("predict.trade.setExpiration"),selectedKeys:[M],onSelectionChange:O=>{let ue=Array.from(O)[0];ue&&P(ue);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ic.map(O=>jsxRuntime.jsx(ui$1.SelectItem,{children:L(ac[O])},O))}),M==="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(h)?void 0:h,onValueChange:z,minValue:1,step:1,formatOptions:cc,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:[T],onSelectionChange:O=>{let ue=Array.from(O)[0];ue&&F(ue);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:sc.map(O=>jsxRuntime.jsx(ui$1.SelectItem,{children:L(lc[O])},O))})]})]})]}),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:()=>R(O=>!O),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:L("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",y&&"rotate-180")})]}),De!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:L("predict.trade.chance",{percent:De})})]}),y&&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:L("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?kr(l):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&a>0?`+$${a.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:Ze,fullWidth:true,radius:"lg",size:"lg",isDisabled:m||!he||p,isLoading:p||m,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:vr,children:dt})]}),jsxRuntime.jsx(sn,{isOpen:U.isOpen,onClose:U.onClose,kycUrl:S})]})}function cn({event:e,market:t,variant:r,initialOutcome:o,chain:n}){let{outcome:i,orderType:s,quantity:l,limitPrice:a,shares:c,estimatedCost:u,potentialPayout:d,potentialProfit:m,usdcBalance:p,isBalanceLoading:f,isSubmitting:g,validation:v,supportsLimitOrder:x,kycRequired:S,kycUrl:k,expirationEnabled:M,expirationPreset:h,customDuration:T,customDurationUnit:b,setOutcome:K,setOrderType:I,setQuantity:Y,setLimitPrice:ve,setExpirationEnabled:P,setExpirationPreset:z,setCustomDuration:F,setCustomDurationUnit:ne,submit:L}=ri({market:t,initialOutcome:o}),y=walletConnector.useAuthCallback(L),R=react.useMemo(()=>e?Xr(e):void 0,[e]),U=react.useMemo(()=>Jr(t),[t]);return jsxRuntime.jsx(di,{event:R,market:U,variant:r,outcome:i,orderType:s,quantity:l,limitPrice:a,shares:c,estimatedCost:u,potentialPayout:d,potentialProfit:m,usdcBalance:p,isBalanceLoading:f,isSubmitting:g,isValid:v.isValid,validationErrors:v.errors,supportsLimitOrder:x,kycRequired:S,kycUrl:k,expirationEnabled:M,expirationPreset:h,customDuration:T,customDurationUnit:b,onOutcomeChange:K,onOrderTypeChange:I,onQuantityChange:Y,onLimitPriceChange:ve,onExpirationEnabledChange:P,onExpirationPresetChange:z,onCustomDurationChange:F,onCustomDurationUnitChange:ne,onSubmit:y})}var Sr="predict-trade";function dn({id:e=Sr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(vc,{...t})})}function vc({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(cn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,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 jn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function Yn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function ui({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(v=>{v?s(r):t();},[r,t]),a=react.useCallback(()=>{s(jn);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),u=react.useCallback((v,x)=>{s(S=>({...S,[v]:x}));},[]),d=react.useMemo(()=>Yn(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]),p=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$1.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$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(wc,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(un,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(mn,{options:m,selected:i.source,onSelect:v=>u("source",v)})}),jsxRuntime.jsx(un,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(mn,{options:p,selected:i.timeRemaining,onSelect:v=>u("timeRemaining",v)})}),jsxRuntime.jsx(un,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(mn,{options:f,selected:i.minVolume,onSelect:v=>u("minVolume",v)})}),jsxRuntime.jsx(un,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(mn,{options:g,selected:i.minLiquidity,onSelect:v=>u("minLiquidity",v)})})]}),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"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function un({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 wc({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 mn({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 mi(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 Pc=[{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:mi,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:mi,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 fi({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:Pc.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 bi={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},hi={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},Dc=["start_time","volume","liquidity","ending_soon"],vi={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"},Ac={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 yi({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),u=react.useRef(null),d=react.useCallback(p=>{u.current&&!u.current.contains(p.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)),[d]),react.useEffect(()=>{if(!a)return;let p=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let m=xi[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:u,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:vi,onMouseEnter:p=>{p.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(p=>!p),children:[jsxRuntime.jsx(Fc,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(hi[e])}),jsxRuntime.jsx(Hc,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...Ac,width:224,padding:4},children:Dc.map(p=>{let f=xi[p],g=e===p;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:v=>{g||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{g||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===p?o(!r):t(p),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(hi[p])}),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"})})]},p)})})]}),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:p=>{p.currentTarget.style.background="rgba(39,39,42,1)",p.currentTarget.style.color="#fff";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)",p.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:vi,onMouseEnter:p=>{p.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:n,children:[jsxRuntime.jsx(Bc,{}),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 xi={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function Fc(){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 Bc(){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 Hc({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 wi(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:s,error:l,hasNextPage:a,fetchNextPage:c,refetch:u}=reactPredict.useInfiniteEvents(t),d=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{c();},[c]),p=react.useCallback(()=>{u();},[u]);return {data:d,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:m,refetch:p}}var Ni=`
1
+ 'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),Wn=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Wn__default=/*#__PURE__*/_interopDefault(Wn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.138");var al="0.1.138";var sl={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},Wo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Hn=(()=>{let e=t=>{let r=Wo.indexOf(t);return r===-1?Wo.length:r};return Object.entries(sl).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(n=>({slug:n,label:n}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function Vo({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),u=react.useCallback(()=>{o(null);},[o]),d=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.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(Uo,{label:d,isSelected:t===null,onPress:u,showPulse:d===l}),jsxRuntime.jsx(pl,{}),e.map(m=>jsxRuntime.jsx(Uo,{label:m.category,isSelected:t===m.category,onPress:()=>o(m.category),badge:m.badge,showPulse:m.category===l},m.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&n.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(Ko,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(m=>jsxRuntime.jsx(Ko,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function Uo({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){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:[o?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,n&&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:n})]})}function pl(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function Ko({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,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 Xg({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 ul(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function ml(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function Go({onSelect:e,trailing:t,className:r}){let[n,o]=react.useState(null),[i,s]=react.useState(null),l=react.useCallback(m=>{o(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),a=react.useCallback(m=>{s(m),e?.({categorySlug:n,tagSlug:m});},[n,e]),c=ul(Hn),u=Hn.find(m=>m.slug===n),d=ml(u);return jsxRuntime.jsx(Vo,{categories:c,selectedCategory:n,selectedTag:i,activeTags:d,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function Xr(e){return {title:e.title,imageUrl:e.image_url}}function Jr(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 br=24,zn=4,Zr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ke={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},en=Ke.ALL,a0={[Ke.ONE_DAY]:Zr.ONE_MINUTE,[Ke.ONE_WEEK]:Zr.ONE_HOUR,[Ke.ONE_MONTH]:Zr.ONE_HOUR,[Ke.ALL]:Zr.ONE_DAY},s0={[Ke.ONE_DAY]:300,[Ke.ONE_WEEK]:3600,[Ke.ONE_MONTH]:10800,[Ke.ALL]:1440*60},l0={[Ke.ONE_DAY]:1440*60,[Ke.ONE_WEEK]:10080*60,[Ke.ONE_MONTH]:720*60*60,[Ke.ALL]:null},tn=1,rn=1,c0=1,d0=1,p0=99,lr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},u0=lr.ONE_WEEK,m0={[lr.ONE_HOUR]:60,[lr.SIX_HOURS]:60,[lr.ONE_DAY]:300,[lr.ONE_WEEK]:1800,[lr.MAX]:1800};var Xo=react.createContext(null);function yr(){let e=react.useContext(Xo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var yl=1e4;function kl({pollingInterval:e=yl,enabled:t=true,children:r}){let n=walletConnector.useWallets(),o=react.useMemo(()=>n.find(v=>v.chainNamespace===types.ChainNamespace.SOLANA&&v.isConnected)?.address,[n]),i=react.useMemo(()=>n.find(v=>v.chainNamespace===types.ChainNamespace.EVM&&v.isConnected)?.address,[n]),{data:s,isLoading:l,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:o??""},{enabled:t&&!!o,refetchInterval:e}),{data:u,isLoading:d}=reactPredict.useDFlowKYC(o,{enabled:t&&!!o,refetchInterval:3e4}),{data:m,isLoading:p}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:x,isLoading:h,isFetching:k,error:S}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),M=react.useMemo(()=>({solanaAddress:o,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&x?Number(x.balance):null,kalshiKycVerified:u?.verified??false,kalshiKycUrl:u?.kyc_url??null,kalshiKycLoading:d,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:p,isLoading:l||h,isFetching:a||k,error:c??S??null}),[o,i,f,s,x,g,u,d,m,p,l,h,a,k,c,S]);return jsxRuntime.jsx(Xo.Provider,{value:M,children:r})}var wl={minutes:60,hours:3600,days:86400};function nn(e,t,r){let n=Math.floor(Date.now()/1e3);switch(e){case "5m":return n+300;case "1h":return n+3600;case "12h":return n+720*60;case "24h":return n+1440*60;case "eod":{let o=new Date;return o.setUTCHours(23,59,59,0),Math.floor(o.getTime()/1e3)}case "custom":return n+t*wl[r]}}function on(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function Ne(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function an(e,t,r){let n=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(n)return t("predict.trade.polymarket.minOrderSize",{current:n[1],min:n[2]});let o=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(o){let s=parseInt(o[1],10)/1e6,l=parseInt(o[2],10)/1e6,a=Math.max(0,s-l);return t("predict.trade.polymarket.insufficientBalance",{total:Ne(s,2).toFixed(2),active:Ne(l,2).toFixed(2),available:Ne(a,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=4){return parseFloat(Ne(e,t).toFixed(t)).toString()}function jt(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Wn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Wn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Wn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function ti({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),a=reactQuery.useQueryClient(),c=e.source,u=c==="polymarket",d=o.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected),m=o.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected&&"switchChain"in O),p=n==="authenticated",f=d?.address,g=m?.address,x=react.useMemo(()=>{if(c!=="polymarket")return;let O=e.provider_meta?.["polymarket.clobTokenIds"];return O?(typeof O=="string"?JSON.parse(O):O)[0]:void 0},[c,e.provider_meta]),{data:h}=reactPredict.useTickSize(x),k=h?.minimum_tick_size?String(h.minimum_tick_size):"0.01",[S,M]=react.useState(t),[v,N]=react.useState("market"),[b,K]=react.useState(NaN),[D,Y]=react.useState(NaN),[ve,C]=react.useState(false),[z,F]=react.useState(null),[ne,L]=react.useState(false),[y,R]=react.useState(false),[U,ee]=react.useState("1h"),[Q,se]=react.useState(30),[we,$e]=react.useState("minutes"),pe=null,Ze=false,lt=null,Ae;try{let O=yr();pe={kalshiUsdcBalance:O.kalshiUsdcBalance,polymarketUsdcBalance:O.polymarketUsdcBalance,isLoading:O.isLoading},Ze=O.kalshiKycVerified,lt=O.kalshiKycUrl,Ae=O.polymarketSafeAddress;}catch{}let he=react.useMemo(()=>{let O=S==="yes"?0:1,Ee=e.outcomes[O];return Ee?.best_ask??Ee?.price??.5},[e.outcomes,S]),ct=react.useCallback(O=>{N(O);},[]),et=react.useCallback(O=>{M(O),Y(NaN);},[]);react.useEffect(()=>{v==="limit"&&isNaN(D)&&Y(Math.round(he*100)/100);},[v,D,he]);let dt=react.useMemo(()=>isNaN(b)||b<=0?0:he>0?b/he:0,[b,he]),T=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),ke=e.provider_meta?.["dflow.yesMint"]??"",Fe=e.provider_meta?.["dflow.noMint"]??"",vr=utils.SOLANA_TOKENS.stablecoins.USDC.address,I=S==="yes"?ke:Fe,ue=vr,We=I,nr=c==="kalshi"?f??"":g??"",{data:Ut,isLoading:_t}=reactPredict.usePositions({source:c,user:nr},{enabled:!!nr}),Be=c==="kalshi"&&!!ue&&!!We&&!!f&&T!=="0",{refetch:zr}=reactPredict.useDFlowQuote({inputMint:ue,outputMint:We,amount:T,userPublicKey:f??"",slippageBps:100},{enabled:Be}),or=react.useMemo(()=>pe?c==="kalshi"?pe.kalshiUsdcBalance:pe.polymarketUsdcBalance:Ut&&Ut.positions.reduce((Ee,nt)=>nt.side==="USDC"||nt.side==="collateral"?Ee+(nt.current_value??0):Ee,0)||null,[pe,Ut,c]),Dn=pe?pe.isLoading:_t,pt=react.useMemo(()=>v==="limit"&&u&&!isNaN(D)?D:he,[v,u,D,he]),$r=react.useMemo(()=>isNaN(b)||b<=0?0:b,[b]),Wr=react.useMemo(()=>isNaN(b)||b<=0?0:pt>0?b/pt*1:0,[b,pt]),Fo=Wr-$r,Ur=react.useCallback(O=>{if(isNaN(O)){K(NaN);return}K(Math.round(Math.max(0,O)*100)/100);},[]),An=react.useCallback(O=>{if(isNaN(O)){Y(NaN);return}let Ee=Math.max(.01,Math.min(.99,O));Y(Math.round(Ee*100)/100);},[]),ut=react.useCallback(()=>{K(NaN),Y(NaN),N("market"),R(false),ee("1h"),se(30),$e("minutes");},[]),vt=react.useMemo(()=>{let O=[];return isNaN(b)||b<=0?O.push(r("predict.trade.minAmountUsd",{amount:rn})):b<rn&&O.push(r("predict.trade.minAmountUsd",{amount:rn})),e.status!=="open"&&O.push(r("predict.trade.marketNotActive")),or!=null&&!isNaN(b)&&b>0&&b>Ne(or,2)&&O.push(r("predict.trade.insufficientBalance")),v==="limit"&&u&&(isNaN(D)||D<.01||D>.99)&&O.push(r("predict.trade.limitPriceRange")),v==="limit"&&u&&y&&U==="custom"&&(isNaN(Q)||Q<=0)&&O.push(r("predict.trade.expiration.invalidDate")),{isValid:O.length===0,errors:O}},[b,e.status,or,v,u,D,y,U,Q,r]),{mutateAsync:Rt}=reactPredict.useDFlowSubmit(),{data:It}=reactPredict.useOrder({id:z??"",source:c},{enabled:!!z});react.useEffect(()=>{if(!It||!z)return;let{status:O}=It;O==="closed"?(F(null),C(false),ui.toast.success(r("predict.trade.submitSuccess")),jt(),ut(),a.invalidateQueries({queryKey:["predict","positions"]})):(O==="failed"||O==="expired")&&(C(false),F(null),ui.toast.error(r("predict.trade.submitError")));},[It,z,a,ut,r]);let Kr=react.useCallback(async()=>{if(!f||!d)return;if(!ue||!We){ui.toast.error("Missing token mint addresses"),C(false);return}if(!Ze){L(true),C(false);return}let ir=(await zr()).data?.transaction;if(!ir){ui.toast.error(r("predict.trade.submitError")),C(false);return}let Ot=Uint8Array.from(atob(ir),Dt=>Dt.charCodeAt(0)),xt=await d.signTransaction(Ot),bt=await Rt({signedTransaction:btoa(String.fromCharCode(...xt)),orderContext:{user_public_key:f,input_mint:ue,output_mint:We,amount:T,price:String(he),side:"BUY",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});F(bt.signature);},[f,d,zr,Rt,ue,We,T,he,S,e.slug,r,Ze]),xr=react.useCallback(async()=>{if(!m||!l)return;let O=m.chain,Ee=O!==types.Chain.POLYGON;Ee&&await i(types.Chain.POLYGON);try{let nt=await m.getEip1193Provider();if(!nt){ui.toast.error(r("predict.trade.submitError")),C(!1);return}let ir=!!Ae,Ot={address:m.address,signatureType:ir?2:0,signTypedData:async(me,At,qr,Bn)=>{let Ft=[];"name"in me&&Ft.push({name:"name",type:"string"}),"version"in me&&Ft.push({name:"version",type:"string"}),"chainId"in me&&Ft.push({name:"chainId",type:"uint256"}),"verifyingContract"in me&&Ft.push({name:"verifyingContract",type:"address"}),"salt"in me&&Ft.push({name:"salt",type:"bytes32"});let Bo={EIP712Domain:Ft,...At};return await nt.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:me,types:Bo,primaryType:qr,message:Bn})]})}},xt=l.credentials??await l.authenticate(Ot),bt=S==="yes"?0:1,Dt="",yt=e.provider_meta?.["polymarket.clobTokenIds"];yt&&(Dt=(typeof yt=="string"?JSON.parse(yt):yt)[bt]??"");let ar=e.provider_meta?.["polymarket.negRisk"]??!1,Vr=v==="limit"&&!isNaN(D)?D:he,kt=on(Vr,k),jr=v==="limit"?y?"GTD":"GTC":"FOK",Yr=v==="market"?b:kt>0?b/kt:0,Gr={tokenId:Dt,price:kt,size:Yr,side:"BUY",orderType:jr,tickSize:k,negRisk:ar,...Ae&&{funderAddress:Ae},...v==="limit"&&y&&{expiration:nn(U,Q,we)}},P=reactPredict.buildCtfExchangeDomain(ar),xe=reactPredict.buildOrderMessage({...Gr,signerAddress:Ot.address,signatureType:Ot.signatureType}),Ue=await Ot.signTypedData(P,reactPredict.CTF_ORDER_TYPES,"Order",xe),Ie=reactPredict.buildSignedOrder(xe,Ue,Gr.orderType),tt=reactPredict.buildClobPayload(Ie,xt.apiKey),He=JSON.stringify(tt),St=await reactPredict.buildPolymarketL2Headers(xt.address,{apiKey:xt.apiKey,secret:xt.secret,passphrase:xt.passphrase,method:"POST",requestPath:"/order",body:He});await s.createPolymarketOrder(tt,St),a.invalidateQueries({queryKey:["predict","orders"]}),a.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(r("predict.trade.submitSuccess")),jt(),ut(),C(!1);}finally{Ee&&O&&i(O).catch(()=>{});}},[m,l,i,S,e.provider_meta,v,D,he,b,s,a,y,U,Q,we,ut,r,k,Ae]),Fn=react.useCallback(async()=>{if(!(!vt.isValid||!p)){C(true),F(null),L(false);try{c==="kalshi"?await Kr():await xr();}catch(O){let Ee=O instanceof Error?O.message:"",nt=c==="polymarket"&&Ee?an(Ee,r,"buy"):Ee||void 0;ui.toast.error(nt||r("predict.trade.submitError")),C(false);}}},[vt.isValid,p,c,Kr,xr,r]);return {outcome:S,orderType:v,quantity:b,limitPrice:D,shares:dt,estimatedCost:$r,potentialPayout:Wr,potentialProfit:Fo,usdcBalance:or,isBalanceLoading:Dn,isSubmitting:ve,validation:vt,supportsLimitOrder:u,kycRequired:ne,kycUrl:lt,expirationEnabled:y,expirationPreset:U,customDuration:Q,customDurationUnit:we,setOutcome:et,setOrderType:ct,setQuantity:Ur,setLimitPrice:An,setExpirationEnabled:R,setExpirationPreset:ee,setCustomDuration:se,setCustomDurationUnit:$e,submit:Fn}}function sn({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:o=>{o||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:n("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:n("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(o=>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:n(o)})]},o))}),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:[n("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:n("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:n("common.ok")})]})]})})})}var nc=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,oc=["5m","1h","12h","24h","eod","custom"],ic={"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"},ac=["minutes","hours","days"],sc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},lc={maximumFractionDigits:0};function ci({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:s,shares:l,potentialProfit:a,potentialPayout:c,estimatedCost:u,usdcBalance:d,isBalanceLoading:m,isSubmitting:p,isValid:f,validationErrors:g,supportsLimitOrder:x,kycRequired:h,kycUrl:k,expirationEnabled:S,expirationPreset:M,customDuration:v,customDurationUnit:N,onOutcomeChange:b,onOrderTypeChange:K,onQuantityChange:D,onLimitPriceChange:Y,onExpirationEnabledChange:ve,onExpirationPresetChange:C,onCustomDurationChange:z,onCustomDurationUnitChange:F,onSubmit:ne}){let{t:L}=i18n.useTranslation(),[y,R]=react.useState(false),U=ui.useDisclosure(),[ee,Q]=react.useState(""),se=react.useRef(false);react.useEffect(()=>{se.current||Q(isNaN(i)?"":String(i));},[i]);let[we,$e]=react.useState(""),pe=react.useRef(false);react.useEffect(()=>{pe.current||(isNaN(s)?$e(""):$e(String(parseFloat((s*100).toFixed(2)))));},[s]);let Ze=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if($e(I),I===""||I==="."){Y(NaN);return}let We=parseFloat(I);isNaN(We)||Y(We/100);},[Y]),lt=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if(Q(I),Fe(false),I===""||I==="."){D(NaN);return}let We=parseFloat(I);isNaN(We)||D(We);},[D]);react.useEffect(()=>{h&&!U.isOpen&&U.onOpen();},[h]);let Ae=react.useMemo(()=>{let I=n==="yes"?t.yesAsk:t.noAsk;return I!=null?parseFloat((Number(I)*100).toFixed(2)):null},[n,t]),he=!isNaN(i)&&i>0,ct=react.useMemo(()=>{if(m)return L("predict.trade.loadingBalance");if(p)return L("predict.trade.submitting");if(h)return L("predict.trade.kycRequired");if(!he)return L("predict.trade.enterAmount");let I=L(n==="yes"?"predict.trade.yes":"predict.trade.no"),ue=a>0?` \u2192 Win $${a.toFixed(2)}`:"";return `${L("predict.trade.buy")} ${I}${ue}`},[m,p,h,he,n,a,L]),et=react.useMemo(()=>n==="yes"?"primary":"secondary",[n]),dt=()=>{D(Math.floor((d??0)/2*100)/100);},T=()=>{D(Ne(d??0,2));},[ke,Fe]=react.useState(false),vr=()=>{if(h){U.onOpen();return}if(!f){Fe(true);return}Fe(false),ne();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:I=>{r==="bordered"&&(I.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:I=>{r==="bordered"&&(I.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:n==="yes"?"text-bullish":"text-bearish",children:[L("predict.trade.buy")," ",L(n==="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:[x?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:I=>K(I),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:L("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:L("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:L("predict.trade.market")}),o==="limit"&&x?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:we,onChange:I=>Ze(I.target.value),onFocus:()=>{pe.current=true;},onBlur:()=>{pe.current=false,isNaN(s)?$e(""):$e(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):Ae!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Ae," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(I=>{let ue=I==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>b(I),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===I?I==="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:L(I==="yes"?"predict.trade.yes":"predict.trade.no")}),ue!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(ue)*100).toFixed(2)),"\xA2"]})]})},I)})}),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:L("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:nc,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`${Ne(d,2).toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:dt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:L("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:T,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:L("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:ee,onChange:I=>lt(I.target.value),onFocus:()=>{se.current=true;},onBlur:()=>{se.current=false,Q(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ke&&g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:g.map(I=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:I},I))})]}),o==="limit"&&x&&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:L("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:S,onValueChange:ve,"aria-label":L("predict.trade.setExpiration")})]}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":L("predict.trade.setExpiration"),selectedKeys:[M],onSelectionChange:I=>{let ue=Array.from(I)[0];ue&&C(ue);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:oc.map(I=>jsxRuntime.jsx(ui.SelectItem,{children:L(ic[I])},I))}),M==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(v)?void 0:v,onValueChange:z,minValue:1,step:1,formatOptions:lc,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:[N],onSelectionChange:I=>{let ue=Array.from(I)[0];ue&&F(ue);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ac.map(I=>jsxRuntime.jsx(ui.SelectItem,{children:L(sc[I])},I))})]})]})]}),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:()=>R(I=>!I),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:L("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",y&&"rotate-180")})]}),Ae!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:L("predict.trade.chance",{percent:Ae})})]}),y&&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:L("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?kr(l):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:L("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&a>0?`+$${a.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:et,fullWidth:true,radius:"lg",size:"lg",isDisabled:m||!he||p,isLoading:p||m,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:vr,children:ct})]}),jsxRuntime.jsx(sn,{isOpen:U.isOpen,onClose:U.onClose,kycUrl:k})]})}function cn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:s,quantity:l,limitPrice:a,shares:c,estimatedCost:u,potentialPayout:d,potentialProfit:m,usdcBalance:p,isBalanceLoading:f,isSubmitting:g,validation:x,supportsLimitOrder:h,kycRequired:k,kycUrl:S,expirationEnabled:M,expirationPreset:v,customDuration:N,customDurationUnit:b,setOutcome:K,setOrderType:D,setQuantity:Y,setLimitPrice:ve,setExpirationEnabled:C,setExpirationPreset:z,setCustomDuration:F,setCustomDurationUnit:ne,submit:L}=ti({market:t,initialOutcome:n}),y=walletConnector.useAuthCallback(L),R=react.useMemo(()=>e?Xr(e):void 0,[e]),U=react.useMemo(()=>Jr(t),[t]);return jsxRuntime.jsx(ci,{event:R,market:U,variant:r,outcome:i,orderType:s,quantity:l,limitPrice:a,shares:c,estimatedCost:u,potentialPayout:d,potentialProfit:m,usdcBalance:p,isBalanceLoading:f,isSubmitting:g,isValid:x.isValid,validationErrors:x.errors,supportsLimitOrder:h,kycRequired:k,kycUrl:S,expirationEnabled:M,expirationPreset:v,customDuration:N,customDurationUnit:b,onOutcomeChange:K,onOrderTypeChange:D,onQuantityChange:Y,onLimitPriceChange:ve,onExpirationEnabledChange:C,onExpirationPresetChange:z,onCustomDurationChange:F,onCustomDurationUnitChange:ne,onSubmit:y})}var Sr="predict-trade";function dn({id:e=Sr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(hc,{...t})})}function hc({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"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:o?"":"p-2",children:[jsxRuntime.jsx(cn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,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:n("common.cancel")})})]})})}):null}var Vn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function jn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function pi({isOpen:e,onClose:t,value:r,onChange:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(x=>{x?s(r):t();},[r,t]),a=react.useCallback(()=>{s(Vn);},[]),c=react.useCallback(()=>{n(i),t();},[i,n,t]),u=react.useCallback((x,h)=>{s(k=>({...k,[x]:h}));},[]),d=react.useMemo(()=>jn(i),[i]),m=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"polymarket",label:o("predict.platform.polymarket")},{value:"kalshi",label:o("predict.platform.kalshi")}],[o]),p=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1d",label:o("predict.filter.lessThanDay")},{value:"7d",label:o("predict.filter.lessThanWeek")},{value:"30d",label:o("predict.filter.lessThanMonth")}],[o]),f=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]),g=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]);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:o("predict.filter.title")}),jsxRuntime.jsx(Sc,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(un,{label:o("predict.filter.platform"),children:jsxRuntime.jsx(mn,{options:m,selected:i.source,onSelect:x=>u("source",x)})}),jsxRuntime.jsx(un,{label:o("predict.filter.timeRemaining"),children:jsxRuntime.jsx(mn,{options:p,selected:i.timeRemaining,onSelect:x=>u("timeRemaining",x)})}),jsxRuntime.jsx(un,{label:o("predict.filter.minVolume"),children:jsxRuntime.jsx(mn,{options:f,selected:i.minVolume,onSelect:x=>u("minVolume",x)})}),jsxRuntime.jsx(un,{label:o("predict.filter.minLiquidity"),children:jsxRuntime.jsx(mn,{options:g,selected:i.minLiquidity,onSelect:x=>u("minLiquidity",x)})})]}),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:o("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:[o("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function un({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 Sc({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 mn({options:e,selected:t,onSelect:r,allowDeselect:n=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(o=>{let i=t===o.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&n?void 0:o.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:o.label},o.value??"__all")})})}var hi={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},mi={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},_c=["start_time","volume","liquidity","ending_soon"],fi={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"},Rc={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function vi({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),u=react.useRef(null),d=react.useCallback(p=>{u.current&&!u.current.contains(p.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)),[d]),react.useEffect(()=>{if(!a)return;let p=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let m=gi[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:u,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:fi,onMouseEnter:p=>{p.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(p=>!p),children:[jsxRuntime.jsx(Ic,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(mi[e])}),jsxRuntime.jsx(Dc,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...Rc,width:224,padding:4},children:_c.map(p=>{let f=gi[p],g=e===p;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:x=>{g||(x.currentTarget.style.background="rgba(39,39,42,0.5)",x.currentTarget.style.color="#fff");},onMouseLeave:x=>{g||(x.currentTarget.style.background="transparent",x.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===p?n(!r):t(p),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(mi[p])}),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"})})]},p)})})]}),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:p=>{p.currentTarget.style.background="rgba(39,39,42,1)",p.currentTarget.style.color="#fff";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)",p.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:fi,onMouseEnter:p=>{p.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(Oc,{}),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 gi={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Ic(){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 Oc(){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 Dc({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function yi(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:n,isFetching:o,isFetchingNextPage:i,isError:s,error:l,hasNextPage:a,fetchNextPage:c,refetch:u}=reactPredict.useInfiniteEvents(t),d=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{c();},[c]),p=react.useCallback(()=>{u();},[u]);return {data:d,isLoading:n,isFetching:o&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:m,refetch:p}}var ki=`
40
2
  @keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
41
3
  @media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
42
4
  @media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
@@ -52,7 +14,7 @@
52
14
  .evt-skel-hero-wrap{padding:40px 16px 32px}
53
15
  @media(min-width:640px){.evt-skel-hero-wrap{padding:48px 24px 40px}}
54
16
  @media(min-width:1024px){.evt-skel-hero-wrap{padding:52px 32px 44px}}
55
- `,Pi={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 ot(e){return {...Pi,animationDelay:`${e}ms`}}function Gn({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ni}),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(Wc,{index:r},r))})]})}function Wc({index:e}){let t=e*120,r={...Pi,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 Uc(){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:{...ot(0),width:120,height:28,borderRadius:9999}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...ot(50),width:280,height:28,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ot(80),width:200,height:28,borderRadius:8}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...ot(120),height:14,width:360,maxWidth:"100%"}}),jsxRuntime.jsx("div",{style:{...ot(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:{...ot(200+e*60),height:22,width:56,borderRadius:4}}),jsxRuntime.jsx("div",{style:{...ot(230+e*60),height:14,width:64,borderRadius:4,marginTop:4}})]},e))})]})})]})}function Kc(){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:{...ot(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:{...ot(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...ot(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...ot(100),height:36,width:80,borderRadius:10}})]})]})}function Ph({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Ni}),jsxRuntime.jsx(Uc,{}),jsxRuntime.jsx(Kc,{}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(Gn,{count:e})})]})}var Ci=3,Zc={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)"}},ed={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},Qn={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},_i={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},td={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Nr=[{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 Mi(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 rd(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [Qn,td];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [Qn,_i];let r=t[0]??"",o=t[1]??"",n=Mi(r)%Nr.length,i=Mi(o)%Nr.length;return i===n&&(i=(i+1)%Nr.length),[Nr[n],Nr[i]]}function nd(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Ri(e){let t=nd(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Ii(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Ei(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Ti(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 od(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 id=`
17
+ `,Si={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 it(e){return {...Si,animationDelay:`${e}ms`}}function Yn({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:ki}),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(Bc,{index:r},r))})]})}function Bc({index:e}){let t=e*120,r={...Si,animationDelay:`${t}ms`},n=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:n}}),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(o=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:o===0?"55%":o===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}})]})]},o))}),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 Hc(){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:{...it(0),width:120,height:28,borderRadius:9999}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...it(50),width:280,height:28,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...it(80),width:200,height:28,borderRadius:8}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...it(120),height:14,width:360,maxWidth:"100%"}}),jsxRuntime.jsx("div",{style:{...it(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:{...it(200+e*60),height:22,width:56,borderRadius:4}}),jsxRuntime.jsx("div",{style:{...it(230+e*60),height:14,width:64,borderRadius:4,marginTop:4}})]},e))})]})})]})}function zc(){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:{...it(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:{...it(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...it(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...it(100),height:36,width:80,borderRadius:10}})]})]})}function Sh({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:ki}),jsxRuntime.jsx(Hc,{}),jsxRuntime.jsx(zc,{}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(Yn,{count:e})})]})}var wi=3,qc={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)"}},Qc={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},qn={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)"},Xc={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Nr=[{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 Ni(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 Jc(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [qn,Xc];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [qn,Ei];let r=t[0]??"",n=t[1]??"",o=Ni(r)%Nr.length,i=Ni(n)%Nr.length;return i===o&&(i=(i+1)%Nr.length),[Nr[o],Nr[i]]}function Zc(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Ti(e){let t=Zc(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Li(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Pi(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Ci(e){let t=e.outcomes?.[1];if(t){let o=t.best_ask??t.price??0;return parseFloat((o*100).toFixed(2)).toString()}let r=e.outcomes?.[0],n=r?.best_ask??r?.price??0;return parseFloat(((1-n)*100).toFixed(2)).toString()}function ed(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),o=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),n>0&&i.push(`${n}h`),i.push(`${o}m`),i.join(" ")}var td=`
56
18
  .badge-shine { position: relative; overflow: hidden; }
57
19
  .badge-shine::after {
58
20
  content: "";
@@ -76,21 +38,59 @@
76
38
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
77
39
  outline-offset: 2px;
78
40
  }
79
- `;function Oi({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],u=react.useMemo(()=>a.length>2?[...a].sort((h,T)=>(T.outcomes?.[0]?.price??0)-(h.outcomes?.[0]?.price??0)):a,[a]).filter(h=>h.status==="open"),d=u.length===1,m=u.slice(0,Ci),p=u.length-Ci,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?u.find(h=>h.slug===s)??null:null,v=!!g||d,x=()=>{v||o?.(e);},S=h=>{h.stopPropagation(),g&&(h.preventDefault(),l(null));},k=h=>{h.stopPropagation(),t||(h.preventDefault(),o?.(e));},M=d?jsxRuntime.jsx(vd,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o}):g?jsxRuntime.jsx(bd,{onCollapse:()=>l(null)}):jsxRuntime.jsx(md,{moreCount:p,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:k});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:h=>{let T=h.currentTarget,b=Zc[e.source]??ed;T.style.borderColor=b.border,T.style.boxShadow=b.shadow,i?.(e);},onMouseLeave:h=>{let T=h.currentTarget;T.style.borderColor="rgba(39,39,42,0.6)",T.style.boxShadow="none";},onClick:x,children:[jsxRuntime.jsx("style",{children:id}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(ad,{event:e,href:t,LinkComponent:r,onClick:S,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:d?jsxRuntime.jsx(hd,{market:u[0],event:e,onSelectOutcome:n}):g?jsxRuntime.jsx(xd,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:n}):jsxRuntime.jsx(ud,{displayedMarkets:m,onMarketClick:h=>l(h.slug)})})]}),jsxRuntime.jsx(fd,{children:M})]})}function ad({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?od(e.start_at):null;return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:o,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",n&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(ld,{event:e})]})}function sd(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 ld({event:e}){let t=react.useMemo(()=>sd(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(cd,{},o);case "crypto-short":return jsxRuntime.jsx(dd,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(pd,{},o)}})})}function cd(){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 dd({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 pd(){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 ud({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=Ri(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:Ii(o)}),jsxRuntime.jsx(gd,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function md({moreCount:e,formattedVolume:t,source:r,href:o,LinkComponent:n,onShowMore:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui$1.Linkable,{href:o,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[s("predict.event.showMore"),jsxRuntime.jsx(Ai,{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(Fi,{source:r})]})]})}function fd({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 Li({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 Di({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[s,l]=o?rd(e):[Qn,_i],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&a===c?"action":n,d=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Ei(e)}\xA2`:i("predict.market.action.yes",{price:Ei(e)}),m=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${Ti(e)}\xA2`:i("predict.market.action.no",{price:Ti(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Li,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:p=>{p.stopPropagation(),r?.(t,e,"yes");},children:d}),jsxRuntime.jsx(Li,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:p=>{p.stopPropagation(),r?.(t,e,"no");},children:m})]})}function gd(){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 hd({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Di,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function vd({event:e,formattedVolume:t,href:r,LinkComponent:o,onSelect:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.Linkable,{href:r,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:l=>{l.stopPropagation(),r||(l.preventDefault(),n?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(Ai,{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(Fi,{source:e.source})]})]})}function xd({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let n=Ri(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:Ii(n)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Di,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]})}function bd({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(yd,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function Ai({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 yd({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 Fi({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 Nd=8;function Hi({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(),u=react.useRef(null);react.useEffect(()=>{let p=u.current;if(!p)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&o?.();},{rootMargin:"300px"});return f.observe(p),()=>f.disconnect()},[t,r,o]);let d=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:`
41
+ `;function _i({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],u=react.useMemo(()=>a.length>2?[...a].sort((v,N)=>(N.outcomes?.[0]?.price??0)-(v.outcomes?.[0]?.price??0)):a,[a]).filter(v=>v.status==="open"),d=u.length===1,m=u.slice(0,wi),p=u.length-wi,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?u.find(v=>v.slug===s)??null:null,x=!!g||d,h=()=>{x||n?.(e);},k=v=>{v.stopPropagation(),g&&(v.preventDefault(),l(null));},S=v=>{v.stopPropagation(),t||(v.preventDefault(),n?.(e));},M=d?jsxRuntime.jsx(md,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(gd,{onCollapse:()=>l(null)}):jsxRuntime.jsx(cd,{moreCount:p,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:S});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:x?void 0:"pointer"},onMouseEnter:v=>{let N=v.currentTarget,b=qc[e.source]??Qc;N.style.borderColor=b.border,N.style.boxShadow=b.shadow,i?.(e);},onMouseLeave:v=>{let N=v.currentTarget;N.style.borderColor="rgba(39,39,42,0.6)",N.style.boxShadow="none";},onClick:h,children:[jsxRuntime.jsx("style",{children:td}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(rd,{event:e,href:t,LinkComponent:r,onClick:k,isExpanded:x}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:d?jsxRuntime.jsx(ud,{market:u[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(fd,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:o}):jsxRuntime.jsx(ld,{displayedMarkets:m,onMarketClick:v=>l(v.slug)})})]}),jsxRuntime.jsx(dd,{children:M})]})}function rd({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?ed(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:n,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",o&&"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(od,{event:e})]})}function nd(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(o=>o.label?.toLowerCase()==="crypto"),n=e.tags?.some(o=>o.label?.toLowerCase()==="live");if(r&&e.end_at){let o=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,s=900*1e3;if(o>0&&o<=s){let l=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:l});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function od({event:e}){let t=react.useMemo(()=>nd(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,n)=>{switch(r.kind){case "live":return jsxRuntime.jsx(id,{},n);case "crypto-short":return jsxRuntime.jsx(ad,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(sd,{},n)}})})}function id(){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 ad({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 sd(){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 ld({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 n=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:o=>{o.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:Li(n)}),jsxRuntime.jsx(pd,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function cd({moreCount:e,formattedVolume:t,source:r,href:n,LinkComponent:o,onShowMore:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui.Linkable,{href:n,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,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(Oi,{source:r})]})]})}function dd({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 Mi({bgColor:e,textColor:t,shadowColor:r,onClick:n,children:o}){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:n,children:o})}function Ri({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[s,l]=n?Jc(e):[qn,Ei],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=o==="label"&&a===c?"action":o,d=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Pi(e)}\xA2`:i("predict.market.action.yes",{price:Pi(e)}),m=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${Ci(e)}\xA2`:i("predict.market.action.no",{price:Ci(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Mi,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:p=>{p.stopPropagation(),r?.(t,e,"yes");},children:d}),jsxRuntime.jsx(Mi,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:p=>{p.stopPropagation(),r?.(t,e,"no");},children:m})]})}function pd(){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 ud({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Ri,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function md({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui.Linkable,{href:r,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:l=>{l.stopPropagation(),r||(l.preventDefault(),o?.(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(Oi,{source:e.source})]})]})}function fd({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=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:Li(o)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Ri,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function gd({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(hd,{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 hd({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 Oi({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 yd=8;function Ai({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:s,LinkComponent:l,onHover:a}){let{t:c}=i18n.useTranslation(),u=react.useRef(null);react.useEffect(()=>{let p=u.current;if(!p)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return f.observe(p),()=>f.disconnect()},[t,r,n]);let d=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
42
  @keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
81
43
  @keyframes evt-load-spin{to{transform:rotate(360deg)}}
82
44
  @media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
83
45
  @media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
84
46
  @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((p,f)=>p==null?null:jsxRuntime.jsx("div",{style:{padding:Nd,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(Oi,{event:p,href:s?.(p),LinkComponent:l,onSelect:n,onSelectOutcome:i,onHover:a})},`${p.source}-${p.slug}`))}),jsxRuntime.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),c("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(Pd,{onScrollToTop:d})]})}function Pd({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 $i({tagSlugSelection:e,limit:t=24,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,markets_limit:u,onSelect:d,onSelectOutcome:m,getEventHref:p,LinkComponent:f,onHover:g}){let{data:v,hasMore:x,fetchMore:S,isFetching:k,isFetchingMore:M}=wi({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,markets_limit:u});return k?jsxRuntime.jsx(Gn,{count:24}):jsxRuntime.jsx(Hi,{events:v,hasMore:x,isFetchingMore:M,onFetchMore:S,onSelect:d,onSelectOutcome:m,getEventHref:p,LinkComponent:f,onHover:g})}function ev({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(jn),{data:u}=reactPredict.useEventStats(),{isOpen:d,onOpen:m,onClose:p}=ui$1.useDisclosure(),{onOpen:f}=uiScaffold.useAsyncModal(Sr),g=react.useCallback((b,K,I)=>{t?.(b,K,I),f({params:{event:b,market:K,initialOutcome:I}});},[t,f]),v=react.useCallback(b=>{l(b);},[]),x=react.useCallback(b=>{c(K=>({...K,sortPreset:b}));},[]),S=react.useCallback(b=>{c(K=>({...K,sortAsc:b}));},[]),k=react.useCallback(b=>{c(b);},[]),M=react.useMemo(()=>bi[a.sortPreset].sort_by,[a.sortPreset]),h=react.useMemo(()=>Yn(a),[a]),T=react.useMemo(()=>jsxRuntime.jsx(yi,{sortPreset:a.sortPreset,onSortChange:x,sortAsc:a.sortAsc,onSortAscChange:S,onFilterPress:m,filterCount:h}),[a.sortPreset,a.sortAsc,h,x,S,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(fi,{stats:u})})]}),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(qo,{onSelect:v,trailing:T})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(ui,{isOpen:d,onClose:p,value:a,onChange:k}),jsxRuntime.jsx($i,{tagSlugSelection:s,sort_by:M,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(dn,{})]})}function Yi({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:o}=walletConnector.useAuth(),n=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),a=reactQuery.useQueryClient(),c=e.source,u=c==="polymarket",d=n.find(N=>N.chainNamespace===types.ChainNamespace.SOLANA&&N.isConnected),m=n.find(N=>N.chainNamespace===types.ChainNamespace.EVM&&N.isConnected&&"switchChain"in N),p=o==="authenticated",f=d?.address,g=m?.address,v=react.useMemo(()=>{if(c!=="polymarket")return;let N=e.provider_meta?.["polymarket.clobTokenIds"];return N?(typeof N=="string"?JSON.parse(N):N)[0]:void 0},[c,e.provider_meta]),{data:x}=reactPredict.useTickSize(v),S=x?.minimum_tick_size?String(x.minimum_tick_size):"0.01",[k,M]=react.useState(t),[h,T]=react.useState("market"),[b,K]=react.useState(NaN),[I,Y]=react.useState(NaN),[ve,P]=react.useState(false),[z,F]=react.useState(false),[ne,L]=react.useState(null),[y,R]=react.useState(null),[U,ee]=react.useState(false),[Q,ae]=react.useState(false),[we,ze]=react.useState("1h"),[pe,Je]=react.useState(30),[ct,De]=react.useState("minutes"),he=false,dt=null,Ze;try{let N=yr();he=N.kalshiKycVerified,dt=N.kalshiKycUrl,Ze=N.polymarketSafeAddress;}catch{}let pt=react.useCallback(async()=>{if(!m||!l)return null;let N=await m.getEip1193Provider();if(!N)return null;let xe=!!Ze,We={address:m.address,signatureType:xe?2:0,signTypedData:async(_e,et,Be,wt)=>{let me=[];"name"in _e&&me.push({name:"name",type:"string"}),"version"in _e&&me.push({name:"version",type:"string"}),"chainId"in _e&&me.push({name:"chainId",type:"uint256"}),"verifyingContract"in _e&&me.push({name:"verifyingContract",type:"address"}),"salt"in _e&&me.push({name:"salt",type:"bytes32"});let Ft={EIP712Domain:me,...et};return await N.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:_e,types:Ft,primaryType:Be,message:wt})]})}};return l.credentials??await l.authenticate(We)},[Ze,m,l]),E=react.useMemo(()=>{let N=k==="yes"?0:1,xe=e.outcomes[N];return xe?.best_bid??xe?.price??.5},[e.outcomes,k]),ke=c==="kalshi"?f??"":g??"",{data:Ae,isLoading:vr}=reactPredict.usePositions({source:c,user:ke},{enabled:!!ke,refetchInterval:3e4}),O=react.useCallback(async()=>{let N=await pt();return N?await reactPredict.buildPolymarketL2Headers(N.address,{apiKey:N.apiKey,secret:N.secret,passphrase:N.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[pt]),{data:ue,isLoading:$e}=reactPredict.useAvailableShares({source:c,user:ke,market:e.slug,side:k},c==="polymarket"?{getHeaders:O}:void 0,{enabled:!!ke&&!!e.slug,refetchOnMount:"always"}),or=ue?.total_shares??0,Kt=ue?.active_order_shares??0,Rt=ue?.available_shares??0,Fe=ue?.precision??(c==="polymarket"?4:0),zr=$e||vr,ir=e.provider_meta?.["dflow.yesMint"]??"",An=e.provider_meta?.["dflow.noMint"]??"",ut=utils.SOLANA_TOKENS.stablecoins.USDC.address,$r=e.provider_meta?.["dflow.collateralMint"]||"",Wr=k==="yes"?ir:An,Ur=react.useMemo(()=>Ae?Ae.positions.find(N=>N.side?.toLowerCase()===k&&N.market?.slug===e.slug)??null:null,[Ae,e.slug,k])?.market?.provider_meta,Fn=Ur?.["dflow.outcomeMint"]||Wr,mt=Ur?.["dflow.collateralMint"]||$r,xt=Fn,It=mt||ut,Ot=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),Kr=c==="kalshi"&&!!xt&&!!It&&!!f&&Ot!=="0",{refetch:xr}=reactPredict.useDFlowQuote({inputMint:xt,outputMint:It,amount:Ot,userPublicKey:f??"",slippageBps:100},{enabled:Kr}),Bn=react.useMemo(()=>isNaN(b)||b<=0?0:b,[b]),D=react.useMemo(()=>{if(isNaN(b)||b<=0)return 0;let N=h==="limit"&&u&&!isNaN(I)?I:E;return b*N},[b,h,u,I,E]),Me=react.useCallback(N=>{M(N),Y(NaN),K(NaN),F(false);},[]),tt=react.useCallback(N=>{T(N);},[]);react.useEffect(()=>{h==="limit"&&Y(Math.round(E*100)/100);},[h,k]);let ar=react.useCallback(N=>{if(F(false),isNaN(N)){K(NaN);return}K(rt(Math.max(0,N),Fe));},[Fe]),Dt=react.useCallback(()=>{F(true),K(rt(Rt,Fe));},[Rt,Fe]),bt=react.useCallback(N=>{if(isNaN(N)){Y(NaN);return}let xe=Math.max(.01,Math.min(.99,N));Y(Math.round(xe*100)/100);},[]),yt=react.useCallback(()=>{K(NaN),Y(NaN),T("market"),F(false),ae(false),ze("1h"),Je(30),De("minutes");},[]),At=react.useMemo(()=>{let N=[];return isNaN(b)||b<=0?N.push(r("predict.trade.minQuantity",{amount:tn})):b<tn&&N.push(r("predict.trade.minQuantity",{amount:tn})),e.status!=="open"&&N.push(r("predict.trade.marketNotActive")),!isNaN(b)&&b>0&&!z&&b>Rt&&N.push(r("predict.trade.insufficientSharesDetail",{total:rt(or,Fe).toFixed(Fe),active:rt(Kt,Fe).toFixed(Fe),available:rt(Rt,Fe).toFixed(Fe)})),h==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&N.push(r("predict.trade.limitPriceRange")),h==="limit"&&u&&Q&&we==="custom"&&(isNaN(pe)||pe<=0)&&N.push(r("predict.trade.expiration.invalidDate")),{isValid:N.length===0,errors:N}},[b,e.status,Rt,or,Kt,z,h,u,I,Q,we,pe,Fe,r]),{mutateAsync:kt}=reactPredict.useDFlowSubmit(),{data:sr}=reactPredict.useOrder({id:ne??"",source:c},{enabled:!!ne}),Vr=react.useCallback(async()=>{if(!y||!f||!d)return;let{cashAmount:N,collateral:xe}=y;R(null);try{let _e=(await s.createDFlowQuote({inputMint:xe,outputMint:ut,amount:N,userPublicKey:f,slippageBps:100}))?.transaction;if(!_e)return;let et=Uint8Array.from(atob(_e),wt=>wt.charCodeAt(0)),Be=await d.signTransaction(et);await kt({signedTransaction:btoa(String.fromCharCode(...Be)),orderContext:{user_public_key:f,input_mint:xe,output_mint:ut,amount:N,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[y,f,d,s,kt,ut]),St=react.useCallback(()=>{a.invalidateQueries({queryKey:["predict","positions"]}),a.invalidateQueries({queryKey:["predict","orders"]}),a.invalidateQueries({queryKey:["predict","available-shares"]});},[a]);react.useEffect(()=>{if(!sr||!ne)return;let{status:N}=sr;N==="closed"?(L(null),y?Vr().finally(()=>{P(false),ui$1.toast.success(r("predict.trade.submitSuccess")),Yt(),St(),yt();}):(P(false),ui$1.toast.success(r("predict.trade.submitSuccess")),Yt(),St(),yt())):(N==="failed"||N==="expired")&&(P(false),L(null),R(null),ui$1.toast.error(r("predict.trade.submitError")));},[sr,ne,y,Vr,St,yt,r]);let jr=react.useCallback(async()=>{if(!f||!d)return;if(!xt||!It){ui$1.toast.error("Missing token mint addresses"),P(false);return}if(!he){ee(true),P(false);return}let We=(await xr()).data,_e=We?.transaction;if(!_e){ui$1.toast.error(r("predict.trade.submitError")),P(false);return}if(mt&&mt!==ut){let me=String(We?.outAmount??"");me&&me!=="0"&&R({cashAmount:me,collateral:mt});}let et=Uint8Array.from(atob(_e),me=>me.charCodeAt(0)),Be=await d.signTransaction(et),wt=await kt({signedTransaction:btoa(String.fromCharCode(...Be)),orderContext:{user_public_key:f,input_mint:xt,output_mint:It,amount:Ot,price:String(E),side:"SELL",outcome:k==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});L(wt.signature);},[f,d,xr,kt,xt,It,Ot,E,k,e.slug,mt,ut,r,he]),Yr=react.useCallback(async()=>{if(!m||!l)return;let N=m.chain,xe=N!==types.Chain.POLYGON;xe&&await i(types.Chain.POLYGON);try{let We=await m.getEip1193Provider();if(!We){ui$1.toast.error(r("predict.trade.submitError")),P(!1);return}let _e=!!Ze,et={address:m.address,signatureType:_e?2:0,signTypedData:async(Vt,nl,ol,il)=>{let lr=[];"name"in Vt&&lr.push({name:"name",type:"string"}),"version"in Vt&&lr.push({name:"version",type:"string"}),"chainId"in Vt&&lr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Vt&&lr.push({name:"verifyingContract",type:"address"}),"salt"in Vt&&lr.push({name:"salt",type:"bytes32"});let al={EIP712Domain:lr,...nl};return await We.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:Vt,types:al,primaryType:ol,message:il})]})}},Be=await pt();if(!Be){ui$1.toast.error(r("predict.trade.submitError")),P(!1);return}let wt=k==="yes"?0:1,me="",Ft=e.provider_meta?.["polymarket.clobTokenIds"];Ft&&(me=(typeof Ft=="string"?JSON.parse(Ft):Ft)[wt]??"");let qr=e.provider_meta?.["polymarket.negRisk"]??!1,Hn=h==="limit"&&!isNaN(I)?I:E,Bt=on(Hn,S),zo={tokenId:me,price:Bt,size:b,side:"SELL",orderType:h==="limit"?Q?"GTD":"GTC":"FOK",tickSize:S,negRisk:qr,...Ze&&{funderAddress:Ze},...h==="limit"&&Q&&{expiration:nn(we,pe,ct)}},Js=reactPredict.buildCtfExchangeDomain(qr),$o=reactPredict.buildOrderMessage({...zo,signerAddress:et.address,signatureType:et.signatureType}),Zs=await et.signTypedData(Js,reactPredict.CTF_ORDER_TYPES,"Order",$o),el=reactPredict.buildSignedOrder($o,Zs,zo.orderType),Wo=reactPredict.buildClobPayload(el,Be.apiKey),tl=JSON.stringify(Wo),rl=await reactPredict.buildPolymarketL2Headers(Be.address,{apiKey:Be.apiKey,secret:Be.secret,passphrase:Be.passphrase,method:"POST",requestPath:"/order",body:tl});await s.createPolymarketOrder(Wo,rl),St(),ui$1.toast.success(r("predict.trade.submitSuccess")),Yt(),yt(),P(!1);}finally{xe&&N&&i(N).catch(()=>{});}},[m,l,pt,i,k,e.provider_meta,h,I,E,b,s,St,Q,we,pe,ct,yt,r,S,e.slug]),Gr=react.useCallback(async()=>{if(!(!At.isValid||!p)){P(true),L(null),ee(false);try{c==="kalshi"?await jr():await Yr();}catch(N){let xe=N instanceof Error?N.message:"",We=c==="polymarket"&&xe?an(xe,r,"sell"):xe||void 0;ui$1.toast.error(We||r("predict.trade.submitError")),P(false);}}},[At.isValid,p,c,jr,Yr,r]);return {outcome:k,orderType:h,quantity:b,limitPrice:I,shares:Bn,estimatedReturn:D,isSubmitting:ve,validation:At,supportsLimitOrder:u,kycRequired:U,kycUrl:dt,totalShares:or,activeOrderShares:Kt,availableShares:Rt,isAvailableLoading:zr,isSellAll:z,precision:Fe,expirationEnabled:Q,expirationPreset:we,customDuration:pe,customDurationUnit:ct,setOutcome:Me,setOrderType:tt,setQuantity:ar,setLimitPrice:bt,setSellAll:Dt,setExpirationEnabled:ae,setExpirationPreset:ze,setCustomDuration:Je,setCustomDurationUnit:De,submit:Gr}}var rp=["5m","1h","12h","24h","eod","custom"],np={"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"},op=["minutes","hours","days"],ip={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},ap={maximumFractionDigits:0};function ra({event:e,market:t,variant:r="bordered",outcome:o,orderType:n,quantity:i,limitPrice:s,estimatedReturn:l,isSubmitting:a,isValid:c,validationErrors:u,supportsLimitOrder:d,kycRequired:m,kycUrl:p,totalShares:f,activeOrderShares:g,availableShares:v,isAvailableLoading:x,precision:S,expirationEnabled:k,expirationPreset:M,customDuration:h,customDurationUnit:T,onOutcomeChange:b,onOrderTypeChange:K,onQuantityChange:I,onLimitPriceChange:Y,onSellAll:ve,onExpirationEnabledChange:P,onExpirationPresetChange:z,onCustomDurationChange:F,onCustomDurationUnitChange:ne,onSubmit:L}){let{t:y}=i18n.useTranslation(),[R,U]=react.useState(false),ee=ui$1.useDisclosure(),[Q,ae]=react.useState(""),we=react.useRef(false);react.useEffect(()=>{we.current||ae(isNaN(i)?"":String(i));},[i]);let[ze,pe]=react.useState(""),Je=react.useRef(false);react.useEffect(()=>{Je.current||(isNaN(s)?pe(""):pe(String(parseFloat((s*100).toFixed(2)))));},[s]);let ct=react.useCallback(E=>{if(E!==""&&!/^\d*\.?\d{0,2}$/.test(E))return;if(pe(E),E===""||E==="."){Y(NaN);return}let Ae=parseFloat(E);isNaN(Ae)||Y(Ae/100);},[Y]),De=react.useCallback(E=>{let ke=new RegExp(`^\\d*\\.?\\d{0,${S}}$`);if(E!==""&&!ke.test(E))return;if(ae(E),U(false),E===""||E==="."){I(NaN);return}let Ae=parseFloat(E);isNaN(Ae)||I(Ae);},[I,S]);react.useEffect(()=>{m&&!ee.isOpen&&ee.onOpen();},[m]);let he=react.useMemo(()=>{let E=o==="yes"?t.yesBid:t.noBid;return E!=null?parseFloat((Number(E)*100).toFixed(2)):null},[o,t]),dt=!isNaN(i)&&i>0,Ze=react.useMemo(()=>{if(x)return y("predict.trade.loadingBalance");if(a)return y("predict.trade.submitting");if(m)return y("predict.trade.kycRequired");if(!dt)return y("predict.trade.enterAmount");let E=y(o==="yes"?"predict.trade.yes":"predict.trade.no");return `${y("predict.trade.sell")} ${E}`},[x,a,m,dt,o,y]),pt=()=>{if(m){ee.onOpen();return}if(!c){U(true);return}U(false),L();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:E=>{r==="bordered"&&(E.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:E=>{r==="bordered"&&(E.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[y("predict.trade.sell")," ",y(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:[d?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:n,onSelectionChange:E=>K(E),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:y("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:y("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.market")}),n==="limit"&&d?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:ze,onChange:E=>ct(E.target.value),onFocus:()=>{Je.current=true;},onBlur:()=>{Je.current=false,isNaN(s)?pe(""):pe(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):he!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[he," \xA2"]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(E=>{let ke=Math.pow(10,S);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{I(Math.floor(v*E/100*ke)/ke);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:[E,"%"]},E)}),jsxRuntime.jsx("button",{type:"button",onClick:ve,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Q,onChange:E=>De(E.target.value),onFocus:()=>{we.current=true;},onBlur:()=>{we.current=false,ae(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),R&&u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:u.map(E=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:E},E))})]}),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:y("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:x?"\u2013":`${rt(f,S).toFixed(S)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:x?"\u2013":g>0?`-${rt(g,S).toFixed(S)}${y("predict.trade.sharesUnit")}`:`0${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:x?"\u2013":`${rt(v,S).toFixed(S)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:"\u2013"})]})]}),n==="limit"&&d&&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:y("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:k,onValueChange:P,"aria-label":y("predict.trade.setExpiration")})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":y("predict.trade.setExpiration"),selectedKeys:[M],onSelectionChange:E=>{let ke=Array.from(E)[0];ke&&z(ke);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:rp.map(E=>jsxRuntime.jsx(ui$1.SelectItem,{children:y(np[E])},E))}),M==="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(h)?void 0:h,onValueChange:F,minValue:1,step:1,formatOptions:ap,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:[T],onSelectionChange:E=>{let ke=Array.from(E)[0];ke&&ne(ke);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:op.map(E=>jsxRuntime.jsx(ui$1.SelectItem,{children:y(ip[E])},E))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:x||!dt||a,isLoading:a||x,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:pt,children:Ze})]}),jsxRuntime.jsx(sn,{isOpen:ee.isOpen,onClose:ee.onClose,kycUrl:p})]})}function gn({event:e,market:t,variant:r,initialOutcome:o,chain:n}){let{outcome:i,orderType:s,quantity:l,limitPrice:a,estimatedReturn:c,isSubmitting:u,validation:d,supportsLimitOrder:m,kycRequired:p,kycUrl:f,totalShares:g,activeOrderShares:v,availableShares:x,isAvailableLoading:S,precision:k,expirationEnabled:M,expirationPreset:h,customDuration:T,customDurationUnit:b,setOutcome:K,setOrderType:I,setQuantity:Y,setLimitPrice:ve,setSellAll:P,setExpirationEnabled:z,setExpirationPreset:F,setCustomDuration:ne,setCustomDurationUnit:L,submit:y}=Yi({market:t,initialOutcome:o}),R=walletConnector.useAuthCallback(y),U=react.useMemo(()=>e?Xr(e):void 0,[e]),ee=react.useMemo(()=>Jr(t),[t]);return jsxRuntime.jsx(ra,{event:U,market:ee,variant:r,outcome:i,orderType:s,quantity:l,limitPrice:a,estimatedReturn:c,isSubmitting:u,isValid:d.isValid,validationErrors:d.errors,supportsLimitOrder:m,kycRequired:p,kycUrl:f,totalShares:g,activeOrderShares:v,availableShares:x,isAvailableLoading:S,precision:k,expirationEnabled:M,expirationPreset:h,customDuration:T,customDurationUnit:b,onOutcomeChange:K,onOrderTypeChange:I,onQuantityChange:Y,onLimitPriceChange:ve,onSellAll:P,onExpirationEnabledChange:z,onExpirationPresetChange:F,onCustomDurationChange:ne,onCustomDurationUnitChange:L,onSubmit:R})}var ro="predict-sell";function oa({id:e=ro}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(fp,{...t})})}function fp({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(gn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,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 io=40,xn=36,Tr=480,ao=Tr-xn;function sa({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(d=>d.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(d=>d.market&&s.includes(d.market.slug)).length,[l?.positions,s,t]),u=[{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:u.map(d=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(d.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===d.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:d.label},d.key))}),t?jsxRuntime.jsxs("div",{style:{height:Tr},children:[n==="positions"&&jsxRuntime.jsx(kp,{source:e.source,walletAddress:t,marketSlugs:s}),n==="orders"&&jsxRuntime.jsx(wp,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Cp,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Tr},children:o("predict.trade.connectWallet")})]})}function kp({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(lo,{}):s.length===0?jsxRuntime.jsx(so,{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:xn},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:ao},rowComponent:Sp,rowCount:s.length,rowHeight:io,rowProps:{positions:s,closeLabel:o("predict.positions.close")}})]})}function Sp({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",u=i>0?"+":"",d=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",m=n.side,p=n.size,f=n.size*a,g=n.market?.end_at?Tp(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:d}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",m.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:m})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:hn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:hn(a)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[u,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",p.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 wp({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(),u=react.useMemo(()=>{let x=i?.pages?.flatMap(M=>M.items)??[],S=new Set(["live","open","submitted","pending"]),k=x.filter(M=>S.has(M.status));return r.length>0&&(k=k.filter(M=>M.market_id&&r.includes(M.market_id))),k},[i?.pages,r]),d=react.useCallback(x=>{o?o(x.id):c.mutate({source:x.source,id:x.id});},[o,c]),m=u.length,p=m+(a?1:0),f=react.useCallback(x=>x<m,[m]),g=react.useCallback(async()=>{await l();},[l]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:p,threshold:5});return s?jsxRuntime.jsx(lo,{}):u.length===0&&!a?jsxRuntime.jsx(so,{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:xn},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:ao},onRowsRendered:v,rowComponent:Np,rowCount:p,rowHeight:io,rowProps:{orders:u,itemCount:m,onCancel:d,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Np({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:i,cancelLabel:s}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let 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$1.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?hn(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(Pp,{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$1.Spinner,{size:"sm"}):s})})]})}function Pp({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 Cp({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(p=>p.items)??[],[o?.pages]),a=l.length,c=a+(s?1:0),u=react.useCallback(p=>p<a,[a]),d=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:d,rowCount:c,threshold:5});return n?jsxRuntime.jsx(lo,{}):l.length===0&&!s?jsxRuntime.jsx(so,{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:xn},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:ao},onRowsRendered:m,rowComponent:Mp,rowCount:c,rowHeight:io,rowProps:{trades:l,itemCount:a}})]})}function Mp({index:e,style:t,trades:r,itemCount:o}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let n=r[e];if(!n)return null;let i=n.side?.toUpperCase()==="BUY",s=Ep(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$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:n.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:n.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:hn(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 so({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Tr},children:e})}function lo(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Tr},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function hn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Ep(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 Tp(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var la=`
47
+ `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((p,f)=>p==null?null:jsxRuntime.jsx("div",{style:{padding:yd,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(_i,{event:p,href:s?.(p),LinkComponent:l,onSelect:o,onSelectOutcome:i,onHover:a})},`${p.source}-${p.slug}`))}),jsxRuntime.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),c("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(kd,{onScrollToTop:d})]})}function kd({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 Bi({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,markets_limit:u,onSelect:d,onSelectOutcome:m,getEventHref:p,LinkComponent:f,onHover:g}){let{data:x,hasMore:h,fetchMore:k,isFetching:S,isFetchingMore:M}=yi({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,markets_limit:u});return S?jsxRuntime.jsx(Yn,{count:24}):jsxRuntime.jsx(Ai,{events:x,hasMore:h,isFetchingMore:M,onFetchMore:k,onSelect:d,onSelectOutcome:m,getEventHref:p,LinkComponent:f,onHover:g})}function qh({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i}){let[s,l]=react.useState({categorySlug:null,tagSlug:null}),[a,c]=react.useState(Vn),{isOpen:u,onOpen:d,onClose:m}=ui.useDisclosure(),{onOpen:p}=uiScaffold.useAsyncModal(Sr),f=react.useCallback((N,b,K)=>{t?.(N,b,K),p({params:{event:N,market:b,initialOutcome:K}});},[t,p]),g=react.useCallback(N=>{l(N);},[]),x=react.useCallback(N=>{c(b=>({...b,sortPreset:N}));},[]),h=react.useCallback(N=>{c(b=>({...b,sortAsc:N}));},[]),k=react.useCallback(N=>{c(N);},[]),S=react.useMemo(()=>hi[a.sortPreset].sort_by,[a.sortPreset]),M=react.useMemo(()=>jn(a),[a]),v=react.useMemo(()=>jsxRuntime.jsx(vi,{sortPreset:a.sortPreset,onSortChange:x,sortAsc:a.sortAsc,onSortAscChange:h,onFilterPress:d,filterCount:M}),[a.sortPreset,a.sortAsc,M,x,h,d]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(Go,{onSelect:g,trailing:v})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(pi,{isOpen:u,onClose:m,value:a,onChange:k}),jsxRuntime.jsx(Bi,{tagSlugSelection:s,sort_by:S,sort_asc:a.sortAsc,source:a.source,timeRemaining:a.timeRemaining,minVolume:a.minVolume,minLiquidity:a.minLiquidity,onSelect:e,onSelectOutcome:f,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(dn,{})]})}function $i(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 Pd=[{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:$i,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:$i,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 Zh({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
48
+ @keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
49
+ @keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
50
+ @keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
51
+ @keyframes evtStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
52
+ @keyframes evtStatCardEnter{from{opacity:0;transform:translateY(8px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}
53
+
54
+ .evt-hero-outer{display:flex;flex-direction:column;align-items:center;text-align:center;gap:28px}
55
+ @media(min-width:640px){.evt-hero-outer{flex-direction:row;align-items:center;text-align:left;gap:40px}}
56
+ @media(min-width:1024px){.evt-hero-outer{gap:56px}}
57
+
58
+ .evt-hero-left{display:flex;flex-direction:column;align-items:center}
59
+ @media(min-width:640px){.evt-hero-left{align-items:flex-start}}
60
+
61
+ .evt-hero-live{display:flex;justify-content:center}
62
+ @media(min-width:640px){.evt-hero-live{justify-content:flex-start}}
63
+
64
+ .evt-hero-subtitle-text{text-align:center;margin:0 auto}
65
+ @media(min-width:640px){.evt-hero-subtitle-text{text-align:left;margin:0}}
66
+
67
+ .evt-hero-title{font-size:32px!important;line-height:1.2!important}
68
+ @media(min-width:640px){.evt-hero-title{font-size:38px!important}}
69
+ @media(min-width:1024px){.evt-hero-title{font-size:46px!important}}
70
+
71
+ .evt-hero-subtitle{font-size:14px}
72
+ @media(min-width:640px){.evt-hero-subtitle{font-size:15px}}
73
+
74
+ .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)}
75
+ @media(min-width:640px){.evt-stat-grid{width:340px;max-width:none}}
76
+ @media(min-width:1024px){.evt-stat-grid{width:380px}}
77
+
78
+ .evt-stat-val{font-size:18px;line-height:24px;min-height:24px}
79
+ @media(min-width:640px){.evt-stat-val{font-size:20px;line-height:28px;min-height:28px}}
80
+ @media(min-width:1024px){.evt-stat-val{font-size:22px;line-height:30px;min-height:30px}}
81
+
82
+ .evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
83
+ @media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
84
+ `}),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(`
85
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),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:Pd.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<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+n*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:`${n*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+n*80}ms`}})})]},r.key))})]})]})}function ji({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),a=reactQuery.useQueryClient(),c=e.source,u=c==="polymarket",d=o.find(P=>P.chainNamespace===types.ChainNamespace.SOLANA&&P.isConnected),m=o.find(P=>P.chainNamespace===types.ChainNamespace.EVM&&P.isConnected&&"switchChain"in P),p=n==="authenticated",f=d?.address,g=m?.address,x=react.useMemo(()=>{if(c!=="polymarket")return;let P=e.provider_meta?.["polymarket.clobTokenIds"];return P?(typeof P=="string"?JSON.parse(P):P)[0]:void 0},[c,e.provider_meta]),{data:h}=reactPredict.useTickSize(x),k=h?.minimum_tick_size?String(h.minimum_tick_size):"0.01",[S,M]=react.useState(t),[v,N]=react.useState("market"),[b,K]=react.useState(NaN),[D,Y]=react.useState(NaN),[ve,C]=react.useState(false),[z,F]=react.useState(false),[ne,L]=react.useState(null),[y,R]=react.useState(null),[U,ee]=react.useState(false),[Q,se]=react.useState(false),[we,$e]=react.useState("1h"),[pe,Ze]=react.useState(30),[lt,Ae]=react.useState("minutes"),he=false,ct=null,et;try{let P=yr();he=P.kalshiKycVerified,ct=P.kalshiKycUrl,et=P.polymarketSafeAddress;}catch{}let dt=react.useCallback(async()=>{if(!m||!l)return null;let P=await m.getEip1193Provider();if(!P)return null;let xe=!!et,Ue={address:m.address,signatureType:xe?2:0,signTypedData:async(Ie,tt,He,St)=>{let me=[];"name"in Ie&&me.push({name:"name",type:"string"}),"version"in Ie&&me.push({name:"version",type:"string"}),"chainId"in Ie&&me.push({name:"chainId",type:"uint256"}),"verifyingContract"in Ie&&me.push({name:"verifyingContract",type:"address"}),"salt"in Ie&&me.push({name:"salt",type:"bytes32"});let At={EIP712Domain:me,...tt};return await P.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:Ie,types:At,primaryType:He,message:St})]})}};return l.credentials??await l.authenticate(Ue)},[et,m,l]),T=react.useMemo(()=>{let P=S==="yes"?0:1,xe=e.outcomes[P];return xe?.best_bid??xe?.price??.5},[e.outcomes,S]),ke=c==="kalshi"?f??"":g??"",{data:Fe,isLoading:vr}=reactPredict.usePositions({source:c,user:ke},{enabled:!!ke,refetchInterval:3e4}),I=react.useCallback(async()=>{let P=await dt();return P?await reactPredict.buildPolymarketL2Headers(P.address,{apiKey:P.apiKey,secret:P.secret,passphrase:P.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[dt]),{data:ue,isLoading:We}=reactPredict.useAvailableShares({source:c,user:ke,market:e.slug,side:S},c==="polymarket"?{getHeaders:I}:void 0,{enabled:!!ke&&!!e.slug,refetchOnMount:"always"}),nr=ue?.total_shares??0,Ut=ue?.active_order_shares??0,_t=ue?.available_shares??0,Be=ue?.precision??(c==="polymarket"?4:0),zr=We||vr,or=e.provider_meta?.["dflow.yesMint"]??"",Dn=e.provider_meta?.["dflow.noMint"]??"",pt=utils.SOLANA_TOKENS.stablecoins.USDC.address,$r=e.provider_meta?.["dflow.collateralMint"]||"",Wr=S==="yes"?or:Dn,Ur=react.useMemo(()=>Fe?Fe.positions.find(P=>P.side?.toLowerCase()===S&&P.market?.slug===e.slug)??null:null,[Fe,e.slug,S])?.market?.provider_meta,An=Ur?.["dflow.outcomeMint"]||Wr,ut=Ur?.["dflow.collateralMint"]||$r,vt=An,Rt=ut||pt,It=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),Kr=c==="kalshi"&&!!vt&&!!Rt&&!!f&&It!=="0",{refetch:xr}=reactPredict.useDFlowQuote({inputMint:vt,outputMint:Rt,amount:It,userPublicKey:f??"",slippageBps:100},{enabled:Kr}),Fn=react.useMemo(()=>isNaN(b)||b<=0?0:b,[b]),O=react.useMemo(()=>{if(isNaN(b)||b<=0)return 0;let P=v==="limit"&&u&&!isNaN(D)?D:T;return b*P},[b,v,u,D,T]),Ee=react.useCallback(P=>{M(P),Y(NaN),K(NaN),F(false);},[]),nt=react.useCallback(P=>{N(P);},[]);react.useEffect(()=>{v==="limit"&&Y(Math.round(T*100)/100);},[v,S]);let ir=react.useCallback(P=>{if(F(false),isNaN(P)){K(NaN);return}K(Ne(Math.max(0,P),Be));},[Be]),Ot=react.useCallback(()=>{F(true),K(Ne(_t,Be));},[_t,Be]),xt=react.useCallback(P=>{if(isNaN(P)){Y(NaN);return}let xe=Math.max(.01,Math.min(.99,P));Y(Math.round(xe*100)/100);},[]),bt=react.useCallback(()=>{K(NaN),Y(NaN),N("market"),F(false),se(false),$e("1h"),Ze(30),Ae("minutes");},[]),Dt=react.useMemo(()=>{let P=[];return isNaN(b)||b<=0?P.push(r("predict.trade.minQuantity",{amount:tn})):b<tn&&P.push(r("predict.trade.minQuantity",{amount:tn})),e.status!=="open"&&P.push(r("predict.trade.marketNotActive")),!isNaN(b)&&b>0&&!z&&b>_t&&P.push(r("predict.trade.insufficientSharesDetail",{total:Ne(nr,Be).toFixed(Be),active:Ne(Ut,Be).toFixed(Be),available:Ne(_t,Be).toFixed(Be)})),v==="limit"&&u&&(isNaN(D)||D<.01||D>.99)&&P.push(r("predict.trade.limitPriceRange")),v==="limit"&&u&&Q&&we==="custom"&&(isNaN(pe)||pe<=0)&&P.push(r("predict.trade.expiration.invalidDate")),{isValid:P.length===0,errors:P}},[b,e.status,_t,nr,Ut,z,v,u,D,Q,we,pe,Be,r]),{mutateAsync:yt}=reactPredict.useDFlowSubmit(),{data:ar}=reactPredict.useOrder({id:ne??"",source:c},{enabled:!!ne}),Vr=react.useCallback(async()=>{if(!y||!f||!d)return;let{cashAmount:P,collateral:xe}=y;R(null);try{let Ie=(await s.createDFlowQuote({inputMint:xe,outputMint:pt,amount:P,userPublicKey:f,slippageBps:100}))?.transaction;if(!Ie)return;let tt=Uint8Array.from(atob(Ie),St=>St.charCodeAt(0)),He=await d.signTransaction(tt);await yt({signedTransaction:btoa(String.fromCharCode(...He)),orderContext:{user_public_key:f,input_mint:xe,output_mint:pt,amount:P,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[y,f,d,s,yt,pt]),kt=react.useCallback(()=>{a.invalidateQueries({queryKey:["predict","positions"]}),a.invalidateQueries({queryKey:["predict","orders"]}),a.invalidateQueries({queryKey:["predict","available-shares"]});},[a]);react.useEffect(()=>{if(!ar||!ne)return;let{status:P}=ar;P==="closed"?(L(null),y?Vr().finally(()=>{C(false),ui.toast.success(r("predict.trade.submitSuccess")),jt(),kt(),bt();}):(C(false),ui.toast.success(r("predict.trade.submitSuccess")),jt(),kt(),bt())):(P==="failed"||P==="expired")&&(C(false),L(null),R(null),ui.toast.error(r("predict.trade.submitError")));},[ar,ne,y,Vr,kt,bt,r]);let jr=react.useCallback(async()=>{if(!f||!d)return;if(!vt||!Rt){ui.toast.error("Missing token mint addresses"),C(false);return}if(!he){ee(true),C(false);return}let Ue=(await xr()).data,Ie=Ue?.transaction;if(!Ie){ui.toast.error(r("predict.trade.submitError")),C(false);return}if(ut&&ut!==pt){let me=String(Ue?.outAmount??"");me&&me!=="0"&&R({cashAmount:me,collateral:ut});}let tt=Uint8Array.from(atob(Ie),me=>me.charCodeAt(0)),He=await d.signTransaction(tt),St=await yt({signedTransaction:btoa(String.fromCharCode(...He)),orderContext:{user_public_key:f,input_mint:vt,output_mint:Rt,amount:It,price:String(T),side:"SELL",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});L(St.signature);},[f,d,xr,yt,vt,Rt,It,T,S,e.slug,ut,pt,r,he]),Yr=react.useCallback(async()=>{if(!m||!l)return;let P=m.chain,xe=P!==types.Chain.POLYGON;xe&&await i(types.Chain.POLYGON);try{let Ue=await m.getEip1193Provider();if(!Ue){ui.toast.error(r("predict.trade.submitError")),C(!1);return}let Ie=!!et,tt={address:m.address,signatureType:Ie?2:0,signTypedData:async(Kt,rl,nl,ol)=>{let sr=[];"name"in Kt&&sr.push({name:"name",type:"string"}),"version"in Kt&&sr.push({name:"version",type:"string"}),"chainId"in Kt&&sr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Kt&&sr.push({name:"verifyingContract",type:"address"}),"salt"in Kt&&sr.push({name:"salt",type:"bytes32"});let il={EIP712Domain:sr,...rl};return await Ue.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:Kt,types:il,primaryType:nl,message:ol})]})}},He=await dt();if(!He){ui.toast.error(r("predict.trade.submitError")),C(!1);return}let St=S==="yes"?0:1,me="",At=e.provider_meta?.["polymarket.clobTokenIds"];At&&(me=(typeof At=="string"?JSON.parse(At):At)[St]??"");let qr=e.provider_meta?.["polymarket.negRisk"]??!1,Bn=v==="limit"&&!isNaN(D)?D:T,Ft=on(Bn,k),Ho={tokenId:me,price:Ft,size:b,side:"SELL",orderType:v==="limit"?Q?"GTD":"GTC":"FOK",tickSize:k,negRisk:qr,...et&&{funderAddress:et},...v==="limit"&&Q&&{expiration:nn(we,pe,lt)}},Xs=reactPredict.buildCtfExchangeDomain(qr),zo=reactPredict.buildOrderMessage({...Ho,signerAddress:tt.address,signatureType:tt.signatureType}),Js=await tt.signTypedData(Xs,reactPredict.CTF_ORDER_TYPES,"Order",zo),Zs=reactPredict.buildSignedOrder(zo,Js,Ho.orderType),$o=reactPredict.buildClobPayload(Zs,He.apiKey),el=JSON.stringify($o),tl=await reactPredict.buildPolymarketL2Headers(He.address,{apiKey:He.apiKey,secret:He.secret,passphrase:He.passphrase,method:"POST",requestPath:"/order",body:el});await s.createPolymarketOrder($o,tl),kt(),ui.toast.success(r("predict.trade.submitSuccess")),jt(),bt(),C(!1);}finally{xe&&P&&i(P).catch(()=>{});}},[m,l,dt,i,S,e.provider_meta,v,D,T,b,s,kt,Q,we,pe,lt,bt,r,k,e.slug]),Gr=react.useCallback(async()=>{if(!(!Dt.isValid||!p)){C(true),L(null),ee(false);try{c==="kalshi"?await jr():await Yr();}catch(P){let xe=P instanceof Error?P.message:"",Ue=c==="polymarket"&&xe?an(xe,r,"sell"):xe||void 0;ui.toast.error(Ue||r("predict.trade.submitError")),C(false);}}},[Dt.isValid,p,c,jr,Yr,r]);return {outcome:S,orderType:v,quantity:b,limitPrice:D,shares:Fn,estimatedReturn:O,isSubmitting:ve,validation:Dt,supportsLimitOrder:u,kycRequired:U,kycUrl:ct,totalShares:nr,activeOrderShares:Ut,availableShares:_t,isAvailableLoading:zr,isSellAll:z,precision:Be,expirationEnabled:Q,expirationPreset:we,customDuration:pe,customDurationUnit:lt,setOutcome:Ee,setOrderType:nt,setQuantity:ir,setLimitPrice:xt,setSellAll:Ot,setExpirationEnabled:se,setExpirationPreset:$e,setCustomDuration:Ze,setCustomDurationUnit:Ae,submit:Gr}}var ep=["5m","1h","12h","24h","eod","custom"],tp={"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"},rp=["minutes","hours","days"],np={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},op={maximumFractionDigits:0};function ta({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:s,estimatedReturn:l,isSubmitting:a,isValid:c,validationErrors:u,supportsLimitOrder:d,kycRequired:m,kycUrl:p,totalShares:f,activeOrderShares:g,availableShares:x,isAvailableLoading:h,precision:k,expirationEnabled:S,expirationPreset:M,customDuration:v,customDurationUnit:N,onOutcomeChange:b,onOrderTypeChange:K,onQuantityChange:D,onLimitPriceChange:Y,onSellAll:ve,onExpirationEnabledChange:C,onExpirationPresetChange:z,onCustomDurationChange:F,onCustomDurationUnitChange:ne,onSubmit:L}){let{t:y}=i18n.useTranslation(),[R,U]=react.useState(false),ee=ui.useDisclosure(),[Q,se]=react.useState(""),we=react.useRef(false);react.useEffect(()=>{we.current||se(isNaN(i)?"":String(i));},[i]);let[$e,pe]=react.useState(""),Ze=react.useRef(false);react.useEffect(()=>{Ze.current||(isNaN(s)?pe(""):pe(String(parseFloat((s*100).toFixed(2)))));},[s]);let lt=react.useCallback(T=>{if(T!==""&&!/^\d*\.?\d{0,2}$/.test(T))return;if(pe(T),T===""||T==="."){Y(NaN);return}let Fe=parseFloat(T);isNaN(Fe)||Y(Fe/100);},[Y]),Ae=react.useCallback(T=>{let ke=new RegExp(`^\\d*\\.?\\d{0,${k}}$`);if(T!==""&&!ke.test(T))return;if(se(T),U(false),T===""||T==="."){D(NaN);return}let Fe=parseFloat(T);isNaN(Fe)||D(Fe);},[D,k]);react.useEffect(()=>{m&&!ee.isOpen&&ee.onOpen();},[m]);let he=react.useMemo(()=>{let T=n==="yes"?t.yesBid:t.noBid;return T!=null?parseFloat((Number(T)*100).toFixed(2)):null},[n,t]),ct=!isNaN(i)&&i>0,et=react.useMemo(()=>{if(h)return y("predict.trade.loadingBalance");if(a)return y("predict.trade.submitting");if(m)return y("predict.trade.kycRequired");if(!ct)return y("predict.trade.enterAmount");let T=y(n==="yes"?"predict.trade.yes":"predict.trade.no");return `${y("predict.trade.sell")} ${T}`},[h,a,m,ct,n,y]),dt=()=>{if(m){ee.onOpen();return}if(!c){U(true);return}U(false),L();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:T=>{r==="bordered"&&(T.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:T=>{r==="bordered"&&(T.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[y("predict.trade.sell")," ",y(n==="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:[d?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:T=>K(T),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.market")}),o==="limit"&&d?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:$e,onChange:T=>lt(T.target.value),onFocus:()=>{Ze.current=true;},onBlur:()=>{Ze.current=false,isNaN(s)?pe(""):pe(String(parseFloat((s*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):he!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[he," \xA2"]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(T=>{let ke=Math.pow(10,k);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{D(Math.floor(x*T/100*ke)/ke);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:[T,"%"]},T)}),jsxRuntime.jsx("button",{type:"button",onClick:ve,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("common.all")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Q,onChange:T=>Ae(T.target.value),onFocus:()=>{we.current=true;},onBlur:()=>{we.current=false,se(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),R&&u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:u.map(T=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:T},T))})]}),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:y("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:h?"\u2013":`${Ne(f,k).toFixed(k)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:h?"\u2013":g>0?`-${Ne(g,k).toFixed(k)}${y("predict.trade.sharesUnit")}`:`0${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:h?"\u2013":`${Ne(x,k).toFixed(k)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:"\u2013"})]})]}),o==="limit"&&d&&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:y("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:S,onValueChange:C,"aria-label":y("predict.trade.setExpiration")})]}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":y("predict.trade.setExpiration"),selectedKeys:[M],onSelectionChange:T=>{let ke=Array.from(T)[0];ke&&z(ke);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ep.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:y(tp[T])},T))}),M==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(v)?void 0:v,onValueChange:F,minValue:1,step:1,formatOptions:op,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:[N],onSelectionChange:T=>{let ke=Array.from(T)[0];ke&&ne(ke);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:rp.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:y(np[T])},T))})]})]})]}),jsxRuntime.jsx(ui.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:h||!ct||a,isLoading:a||h,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:dt,children:et})]}),jsxRuntime.jsx(sn,{isOpen:ee.isOpen,onClose:ee.onClose,kycUrl:p})]})}function fn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:s,quantity:l,limitPrice:a,estimatedReturn:c,isSubmitting:u,validation:d,supportsLimitOrder:m,kycRequired:p,kycUrl:f,totalShares:g,activeOrderShares:x,availableShares:h,isAvailableLoading:k,precision:S,expirationEnabled:M,expirationPreset:v,customDuration:N,customDurationUnit:b,setOutcome:K,setOrderType:D,setQuantity:Y,setLimitPrice:ve,setSellAll:C,setExpirationEnabled:z,setExpirationPreset:F,setCustomDuration:ne,setCustomDurationUnit:L,submit:y}=ji({market:t,initialOutcome:n}),R=walletConnector.useAuthCallback(y),U=react.useMemo(()=>e?Xr(e):void 0,[e]),ee=react.useMemo(()=>Jr(t),[t]);return jsxRuntime.jsx(ta,{event:U,market:ee,variant:r,outcome:i,orderType:s,quantity:l,limitPrice:a,estimatedReturn:c,isSubmitting:u,isValid:d.isValid,validationErrors:d.errors,supportsLimitOrder:m,kycRequired:p,kycUrl:f,totalShares:g,activeOrderShares:x,availableShares:h,isAvailableLoading:k,precision:S,expirationEnabled:M,expirationPreset:v,customDuration:N,customDurationUnit:b,onOutcomeChange:K,onOrderTypeChange:D,onQuantityChange:Y,onLimitPriceChange:ve,onSellAll:C,onExpirationEnabledChange:z,onExpirationPresetChange:F,onCustomDurationChange:ne,onCustomDurationUnitChange:L,onSubmit:R})}var to="predict-sell";function na({id:e=to}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(up,{...t})})}function up({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"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:o?"":"p-2",children:[jsxRuntime.jsx(fn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,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:n("common.cancel")})})]})})}):null}var oo=40,vn=36,Tr=480,io=Tr-vn;function aa({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(d=>d.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(d=>d.market&&s.includes(d.market.slug)).length,[l?.positions,s,t]),u=[{key:"positions",label:a>0?`${n("predict.positions.title")} (${a})`:n("predict.positions.title")},{key:"orders",label:n("predict.openOrders.title")},{key:"trades",label:n("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(d=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(d.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===d.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:d.label},d.key))}),t?jsxRuntime.jsxs("div",{style:{height:Tr},children:[o==="positions"&&jsxRuntime.jsx(bp,{source:e.source,walletAddress:t,marketSlugs:s}),o==="orders"&&jsxRuntime.jsx(kp,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(Np,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Tr},children:n("predict.trade.connectWallet")})]})}function bp({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositions({source:e,user:t}),s=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(l=>l.market&&r.includes(l.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(so,{}):s.length===0?jsxRuntime.jsx(ao,{message:n("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:vn},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:n("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:io},rowComponent:yp,rowCount:s.length,rowHeight:oo,rowProps:{positions:s,closeLabel:n("predict.positions.close")}})]})}function yp({index:e,style:t,positions:r,closeLabel:n}){let o=r[e];if(!o)return null;let i=o.pnl??0,s=o.pnl_percent??0,l=o.avg_price??0,a=o.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",u=i>0?"+":"",d=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",m=o.side,p=o.size,f=o.size*a,g=o.market?.end_at?Mp(o.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:d}),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:o.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:gn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:gn(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[u,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",p.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:n})})]})}function kp({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:l,hasNextPage:a}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let h=i?.pages?.flatMap(M=>M.items)??[],k=new Set(["live","open","submitted","pending"]),S=h.filter(M=>k.has(M.status));return r.length>0&&(S=S.filter(M=>M.market_id&&r.includes(M.market_id))),S},[i?.pages,r]),d=react.useCallback(h=>{n?n(h.id):c.mutate({source:h.source,id:h.id});},[n,c]),m=u.length,p=m+(a?1:0),f=react.useCallback(h=>h<m,[m]),g=react.useCallback(async()=>{await l();},[l]),x=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:p,threshold:5});return s?jsxRuntime.jsx(so,{}):u.length===0&&!a?jsxRuntime.jsx(ao,{message:o("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:vn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:o("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:o("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:io},onRowsRendered:x,rowComponent:Sp,rowCount:p,rowHeight:oo,rowProps:{orders:u,itemCount:m,onCancel:d,isCancelling:c.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function Sp({index:e,style:t,orders:r,itemCount:n,onCancel:o,isCancelling:i,cancelLabel:s}){if(e>=n)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?gn(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(wp,{status:l.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(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 wp({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 Np({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:n,isLoading:o,fetchNextPage:i,hasNextPage:s}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),l=react.useMemo(()=>n?.pages?.flatMap(p=>p.items)??[],[n?.pages]),a=l.length,c=a+(s?1:0),u=react.useCallback(p=>p<a,[a]),d=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:d,rowCount:c,threshold:5});return o?jsxRuntime.jsx(so,{}):l.length===0&&!s?jsxRuntime.jsx(ao,{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:vn},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:io},onRowsRendered:m,rowComponent:Pp,rowCount:c,rowHeight:oo,rowProps:{trades:l,itemCount:a}})]})}function Pp({index:e,style:t,trades:r,itemCount:n}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",s=Cp(o.timestamp),l=o.price??0,a=o.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:o.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:o.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:gn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o.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 ao({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Tr},children:e})}function so(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Tr},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function gn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Cp(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),o=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${n} ${o}:${i}`}function Mp(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var sa=`
86
86
  @keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
87
- `,ca={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function se(e){return {...ca,animationDelay:`${e}ms`}}function Lr({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:la}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...ca,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...se(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...se(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...se(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...se(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...se(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...se(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...se(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...se(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...se(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...se(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...se(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...se(240),height:14,width:56}})}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...se(260+o*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...se(280+o*40),height:14,width:o%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...se(300+o*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...se(320+o*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...se(340+o*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...se(360+o*40),height:32,width:80,borderRadius:8}})]})]},o))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...se(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...se(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...se(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...se(460),height:14,width:"60%"}})]})]})]})}function da(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:la}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...se(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...se(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...se(120),height:40,width:"100%",borderRadius:8}})]})]})}var ga="var(--color-bullish)",ha="var(--color-bearish)";function _r(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 Rp(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function Ip(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let p of e){let f=Math.round(p.price*100);f>=0&&f<=100&&(r[f]+=p.quantity);}for(let p of t){let f=Math.round(p.price*100);f>=0&&f<=100&&(o[f]+=p.quantity);}let n=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let p=100;p>=0;p--)n+=r[p],i+=r[p]*p/100,s[p]=n,l[p]=i;let a=0,c=0,u=new Float64Array(101),d=new Float64Array(101);for(let p=0;p<=100;p++)a+=o[p],c+=o[p]*p/100,u[p]=a,d[p]=c;let m=Math.max(s[0]??0,u[100]??0);return Array.from({length:101},(p,f)=>{let g=s[f]>0,v=u[f]>0,x=s[f]||u[f],S=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:Rp(x,m),opacity:x>0?S?1:.5:0,isBid:g,isAsk:v,bidCumTotal:s[f],askCumTotal:u[f],bidCumCost:l[f],askCumCost:d[f]}})}function Op({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?ga:ha,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:_r(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",_r(Math.round(e.cumCost))]})]})}var Dp=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?ga:t.isAsk?ha: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}})})}),Ap=[0,10,20,30,40,50,60,70,80,90,100];function Fp(){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:Ap.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 va({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>Ip(e,t),[e,t]),n=react.useMemo(()=>{let d=e.length>0?Math.max(...e.map(p=>p.price)):0,m=t.length>0?Math.min(...t.map(p=>p.price)):1;return Math.round((d+m)/2*100)},[e,t]),i=react.useMemo(()=>o.some(d=>d.isBid||d.isAsk),[o]),[s,l]=react.useState(null),a=react.useRef(null),c=react.useCallback((d,m)=>{a.current&&(a.current.style.filter=""),m?(m.style.filter="brightness(1.5)",a.current=m):a.current=null,d.isBid||d.isAsk?l({priceCents:d.priceCents,isBid:d.isBid,cumTotal:d.isBid?d.bidCumTotal:d.askCumTotal,cumCost:d.isBid?d.bidCumCost:d.askCumCost,leftPct:d.priceCents}):l(null);},[]),u=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(Op,{info:s}),o.map(d=>jsxRuntime.jsx(Dp,{slot:d,onEnter:c,onLeave:u},d.priceCents))]}),jsxRuntime.jsx(Fp,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function po(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function xa(){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 Sa({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}),u=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(v=>({price:s?1-v.price:v.price,quantity:v.size})),[a?.bids,a?.asks,s]),d=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(v=>({price:s?1-v.price:v.price,quantity:v.size})),[a?.bids,a?.asks,s]),m=react.useMemo(()=>u.length>0?Math.max(...u.map(g=>g.price)):null,[u]),p=react.useMemo(()=>d.length>0?Math.min(...d.map(g=>g.price)):null,[d]),f=react.useMemo(()=>{if(m==null||p==null)return null;let g=(p-m)*100;return Math.round(g*10)/10},[m,p]);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"),": ",po(m)]}),m!=null&&p!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),p!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[o("predict.trade.bestAsk"),": ",po(p)]})]}),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$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(xa,{}):jsxRuntime.jsx(va,{bids:u,asks:d})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(xa,{}):jsxRuntime.jsx(Up,{bids:u,asks:d,bestBid:m??void 0,bestAsk:p??void 0,spread:f??void 0})})]})]})}var ba=8;function Up({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((a,c)=>a.price-c.price).slice(0,ba).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,c)=>c.price-a.price).slice(0,ba),[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(ya,{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(ya,{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 ya({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=_r(Math.round(t)),c=Math.round(t*e),u=`$${_r(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:po(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:u})]})}var fo=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}},kn=4,wa=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function tu(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 ru(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 Na(e){return `${(e*100).toFixed(2)}%`}var nu=[{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 ou({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:nu.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 iu(){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 au({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"?ru(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?Na(a.value):"--"})]},a.dataKey))]})}function su({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(u){s.current&&!s.current.contains(u.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let l=t.length>=kn,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(u=>u.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 ",kn," markets"]}),e.map((c,u)=>{let d=t.includes(c.slug),m=!d&&l,p=d&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(x=>x.label.toLowerCase()==="yes")??c.outcomes[0],v=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{p||m||o(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:d?"rgba(255,255,255,0.05)":"transparent",cursor:m||p?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!m&&!p&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=d?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:d?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:d?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:d&&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:d?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),v&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},c.id??`${u}-${c.slug}`)})]})]})}function lu({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?Na(i):"--"})]})]},o.marketSlug)})})}function cu(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function du(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,u)=>c-u);r.push({timestamp:l[l.length-1].timestamp,price:cu(a)});}return r}function pu(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:du(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:u})=>{let d=u.get(l);if(d!==void 0)s.set(c,d),a[c]=d;else {let m=s.get(c);m!==void 0&&(a[c]=m);}}),a})}function Pa(e){return jsxRuntime.jsx(fo,{children:jsxRuntime.jsx(uu,{...e})})}function uu({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>{let y=new Set;return (e.markets??[]).filter(R=>R.status!=="open"||y.has(R.slug)?false:(y.add(R.slug),true))},[e.markets]),i=react.useMemo(()=>[...n].sort((y,R)=>{let U=ee=>(ee.outcomes.find(Q=>Q.label.toLowerCase()==="yes")??ee.outcomes[0])?.price??0;return U(R)-U(y)}),[n]),[s,l]=react.useState(()=>i.slice(0,kn).map(y=>y.slug)),[a,c]=react.useState(en),u=react.useMemo(()=>{let y=new Map;return s.forEach((R,U)=>{y.set(R,wa[U%wa.length]);}),y},[s]),d=react.useMemo(()=>n.filter(y=>s.includes(y.slug)),[n,s]),{series:m,isLoading:p}=reactPredict.useMarketHistory(d,a),f=t||p,g=react.useMemo(()=>{if(m.length>0&&m.some(U=>U.data.length>0))return m;let y=Date.now(),R=864e5;return d.map(U=>{let Q=(U.outcomes?.find(ae=>ae.label.toLowerCase()==="yes")??U.outcomes?.[0])?.price??.5;return {marketSlug:U.slug,label:U.outcomes?.[0]?.label??U.question,data:[{timestamp:y-7*R,price:Q},{timestamp:y,price:Q}]}})},[m,d]),v=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),x=react.useMemo(()=>pu(g,v),[g,v]),S=react.useMemo(()=>{if(x.length===0)return [0,1];let y=1/0,R=-1/0;if(s.forEach(ee=>{x.forEach(Q=>{let ae=Q[ee];ae!=null&&(ae<y&&(y=ae),ae>R&&(R=ae));});}),!isFinite(y))return [0,1];let U=Math.max((R-y)*.15,.05);return [Math.max(0,y-U),Math.min(1,R+U)]},[x,s]),k=react.useMemo(()=>{let y=new Map;return g.forEach(R=>{R.data.length>0&&y.set(R.marketSlug,R.data[R.data.length-1].price);}),y},[g]),M=react.useMemo(()=>{let y=new Map;return g.forEach(R=>y.set(R.marketSlug,R.label)),y},[g]),h=react.useMemo(()=>g.map(y=>({slug:y.marketSlug,color:u.get(y.marketSlug)??"#6b7280"})),[g,u]),{wrapperRef:T,overlayRef:b,onMouseMove:K,onMouseLeave:I}=iu(),Y=react.useCallback(y=>{l(R=>R.includes(y)?R.length<=1?R:R.filter(U=>U!==y):R.length>=kn?R:[...R,y]);},[]),[ve,P]=react.useState(null),z=react.useRef(null),F=react.useRef(""),ne=react.useRef(0),L=!f&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(lu,{series:g,colorMap:u,displayValues:ve??k}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:T,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:L?y=>{K(y),cancelAnimationFrame(ne.current),ne.current=requestAnimationFrame(()=>{P(z.current);});}:void 0,onMouseLeave:L?()=>{I(),cancelAnimationFrame(ne.current),F.current="",z.current=null,P(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"}})}):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:b,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:y=>tu(y,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:S,tickFormatter:y=>`${Math.round(y*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:y=>{let R=y;if(R.active&&R.payload?.length){let U=R.payload.map(ee=>`${ee.dataKey}:${ee.value}`).join(",");if(U!==F.current){F.current=U;let ee=new Map;R.payload.forEach(Q=>{Q.value!=null&&ee.set(Q.dataKey,Q.value);}),z.current=ee;}}return jsxRuntime.jsx(au,{...R,labelMap:M,allSeries:h,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(y=>{let R=u.get(y.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:y.marketSlug,stroke:R,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:R},connectNulls:true,isAnimationActive:false},y.marketSlug)}),ve==null&&x.length>0&&g.map(y=>{let R=x[x.length-1],U=R[y.marketSlug];if(U==null)return null;let ee=u.get(y.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:R.timestamp,y:U,ifOverflow:"extendDomain",shape:Q=>{let{cx:ae,cy:we}=Q;return ae==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:ae,cy:we,r:6,fill:ee,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:ae,cy:we,r:3.5,fill:ee})]})}},`pulse-${y.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(ou,{value:a,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(su,{markets:i,selectedSlugs:s,colorMap:u,onToggle:Y})})]})]})]})}function Ir(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Pu(e){return `${parseFloat((e*100).toFixed(2))}%`}function Ca(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function Sn(e){return e.outcomes?.[0]?.label??e.question}function Cu(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Rr(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 Ma(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let u=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(u)},[e]),!e||t===0)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let i=Math.floor(n/864e5),s=Math.floor(n%864e5/36e5),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 Ea(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 Ra({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let d=[...e.markets||[]],m=d.filter(f=>f.status==="open").sort((f,g)=>Ir(g)-Ir(f)),p=d.filter(f=>f.status!=="open").sort((f,g)=>Ir(g)-Ir(f));return [...m,...p]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=Ma(s?void 0:e.start_at),a=Ma(s?void 0:e.end_at),c=Ea(e.start_at),u=Ea(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((d,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:d.label})]},d.slug)),jsxRuntime.jsx(Lu,{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?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):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})}),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(Pa,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Mu,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Tu,{markets:i,event:e})]})}var Ta=5;function Mu({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen(),[n,i]=react.useState(false),[s,l]=react.useState(null),a=react.useMemo(()=>{let v=new Set;return e.filter(x=>v.has(x.slug)?false:(v.add(x.slug),true))},[e]),c=a.find(v=>v.status==="open")?.slug,[u,d]=react.useState(c?`${c}:yes`:null);if(a.length===0)return null;let m=a.length>Ta,p=n?a:a.slice(0,Ta),f=v=>{l(x=>x===v?null:v);},g=(v,x,S)=>{d(`${v.slug}:${x}`),o||l(v.slug),t?.(v,x,S);};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:p.map((v,x)=>{let S=Ir(v),k=v.outcomes[1]?.best_ask??v.outcomes[1]?.price,M=s===v.slug;return jsxRuntime.jsx(Eu,{market:v,yesPrice:S,noPrice:k??void 0,activeYes:u===`${v.slug}:yes`,activeNo:u===`${v.slug}:no`,isExpanded:M,onToggleExpand:()=>f(v.slug),onTradeAction:g},v.id??`${x}-${v.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(v=>!v),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(n?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",n&&"rotate-180")})]})]})}function Eu({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",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:s,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.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$1.Avatar,{src:e.image_url,name:Sn(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:Sn(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:Pu(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 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:d=>{d.stopPropagation(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Ca(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 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:d=>{d.stopPropagation(),l?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:Ca(r)}):a("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"?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(Sa,{market:e,outcome:n?"no":"yes",onTradeAction:l})})})})]})}function Tu({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(p=>p.rules&&p.rules.length>0||p.description);if(c.length===0)return null;let u=c[l]??c[0],d=u.rules&&u.rules.length>0?u.rules.join(`
87
+ `,la={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function le(e){return {...la,animationDelay:`${e}ms`}}function Lr({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:sa}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...la,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...le(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...le(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...le(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...le(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...le(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...le(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...le(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...le(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...le(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...le(240),height:14,width:56}})}),Array.from({length:e}).map((r,n)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...le(260+n*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...le(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...le(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...le(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(360+n*40),height:32,width:80,borderRadius:8}})]})]},n))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...le(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...le(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...le(460),height:14,width:"60%"}})]})]})]})}function ca(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:sa}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...le(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(120),height:40,width:"100%",borderRadius:8}})]})]})}var fa="var(--color-bullish)",ga="var(--color-bearish)";function _r(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 Lp(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function _p(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let p of e){let f=Math.round(p.price*100);f>=0&&f<=100&&(r[f]+=p.quantity);}for(let p of t){let f=Math.round(p.price*100);f>=0&&f<=100&&(n[f]+=p.quantity);}let o=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let p=100;p>=0;p--)o+=r[p],i+=r[p]*p/100,s[p]=o,l[p]=i;let a=0,c=0,u=new Float64Array(101),d=new Float64Array(101);for(let p=0;p<=100;p++)a+=n[p],c+=n[p]*p/100,u[p]=a,d[p]=c;let m=Math.max(s[0]??0,u[100]??0);return Array.from({length:101},(p,f)=>{let g=s[f]>0,x=u[f]>0,h=s[f]||u[f],k=r[f]>0||n[f]>0;return {priceCents:f,displayHeight:Lp(h,m),opacity:h>0?k?1:.5:0,isBid:g,isAsk:x,bidCumTotal:s[f],askCumTotal:u[f],bidCumCost:l[f],askCumCost:d[f]}})}function Rp({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?fa:ga,n=e.leftPct>65?void 0:`${e.leftPct}%`,o=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:n,right:o,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:_r(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",_r(Math.round(e.cumCost))]})]})}var Ip=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?fa:t.isAsk?ga: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,o.current),onMouseLeave:n,children:i&&jsxRuntime.jsx("div",{ref:o,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:s,opacity:t.opacity}})})}),Op=[0,10,20,30,40,50,60,70,80,90,100];function Dp(){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:Op.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 ha({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>_p(e,t),[e,t]),o=react.useMemo(()=>{let d=e.length>0?Math.max(...e.map(p=>p.price)):0,m=t.length>0?Math.min(...t.map(p=>p.price)):1;return Math.round((d+m)/2*100)},[e,t]),i=react.useMemo(()=>n.some(d=>d.isBid||d.isAsk),[n]),[s,l]=react.useState(null),a=react.useRef(null),c=react.useCallback((d,m)=>{a.current&&(a.current.style.filter=""),m?(m.style.filter="brightness(1.5)",a.current=m):a.current=null,d.isBid||d.isAsk?l({priceCents:d.priceCents,isBid:d.isBid,cumTotal:d.isBid?d.bidCumTotal:d.askCumTotal,cumCost:d.isBid?d.bidCumCost:d.askCumCost,leftPct:d.priceCents}):l(null);},[]),u=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:[o>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${o}%`,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(Rp,{info:s}),n.map(d=>jsxRuntime.jsx(Ip,{slot:d,onEnter:c,onLeave:u},d.priceCents))]}),jsxRuntime.jsx(Dp,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function co(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function va(){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 ka({market:e,outcome:t="yes",onTradeAction:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("depth"),s=t==="no",l=e.source,{data:a,isLoading:c,isFetching:u,refetch:d}=reactPredict.useOrderbook({slug:e.slug,source:l}),m=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(k=>({price:s?1-k.price:k.price,quantity:k.size})),[a?.bids,a?.asks,s]),p=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(k=>({price:s?1-k.price:k.price,quantity:k.size})),[a?.bids,a?.asks,s]),f=react.useMemo(()=>m.length>0?Math.max(...m.map(h=>h.price)):null,[m]),g=react.useMemo(()=>p.length>0?Math.min(...p.map(h=>h.price)):null,[p]),x=react.useMemo(()=>{if(f==null||g==null)return null;let h=(g-f)*100;return Math.round(h*10)/10},[f,g]);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:x!=null?`${n("predict.orderBook.spread")}: ${Number.isInteger(x)?`${x}\xA2`:`${x.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[f!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[n("predict.trade.bestBid"),": ",co(f)]}),f!=null&&g!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),g!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[n("predict.trade.bestAsk"),": ",co(g)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:o==="depth"?"Orderbook":"Depth chart",onClick:()=>i(h=>h==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:o==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>d(),disabled:u,className:ui.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",u&&"animate-spin"),children:jsxRuntime.jsx(ui.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[o==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(va,{}):jsxRuntime.jsx(ha,{bids:m,asks:p})}),o==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(va,{}):jsxRuntime.jsx(Up,{bids:m,asks:p,bestBid:f??void 0,bestAsk:g??void 0,spread:x??void 0})})]})]})}var xa=8;function Up({bids:e,asks:t,spread:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>[...t].sort((a,c)=>a.price-c.price).slice(0,xa).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,c)=>c.price-a.price).slice(0,xa),[e]),s=react.useMemo(()=>{let a=[...o,...i].map(c=>c.quantity);return Math.max(...a,1)},[o,i]);return o.length===0&&i.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:n("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[o.map(a=>jsxRuntime.jsx(ba,{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:[n("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]})}),i.map(a=>jsxRuntime.jsx(ba,{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:n("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:n("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:n("predict.orderBook.total")})]})]})}function ba({price:e,quantity:t,side:r,maxQty:n}){let o=r==="ask",i=Math.min(t/n*100,100),s=o?"bg-bearish/10":"bg-bullish/10",l=o?"text-bearish":"text-bullish",a=_r(Math.round(t)),c=Math.round(t*e),u=`$${_r(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:co(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:u})]})}var mo=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}},yn=4,Sa=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function tu(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 ru(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 wa(e){return `${(e*100).toFixed(2)}%`}var nu=[{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 ou({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:nu.map(({range:r,label:n})=>{let o=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:o?"#f9fafb":"#6b7280",fontWeight:o?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:n},r)})})}function iu(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(o=>{let i=e.current,s=t.current;if(!i||!s)return;let l=i.getBoundingClientRect(),a=(o.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";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function au({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let s=new Map;t?.forEach(a=>s.set(a.dataKey,a));let l=o.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"?ru(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:n.get(a.dataKey)??a.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:a.value!=null?wa(a.value):"--"})]},a.dataKey))]})}function su({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!o)return;function c(u){s.current&&!s.current.contains(u.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]);let l=t.length>=yn,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(u=>u.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:o?"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"})})]}),o&&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 ",yn," markets"]}),e.map((c,u)=>{let d=t.includes(c.slug),m=!d&&l,p=d&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(h=>h.label.toLowerCase()==="yes")??c.outcomes[0],x=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{p||m||n(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:d?"rgba(255,255,255,0.05)":"transparent",cursor:m||p?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:h=>{!m&&!p&&(h.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:h=>{h.currentTarget.style.background=d?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:d?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:d?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:d&&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:d?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),x&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:x})]},c.id??`${u}-${c.slug}`)})]})]})}function lu({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(n=>{let o=t.get(n.marketSlug)??"#6b7280",i=r.get(n.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:o,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:n.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?wa(i):"--"})]})]},n.marketSlug)})})}function cu(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function du(e,t){if(e.length<=t)return e;let r=[],n=e.length/t;for(let o=0;o<t;o++){let i=Math.floor(o*n),s=Math.min(Math.floor((o+1)*n),e.length),l=e.slice(i,s),a=l.map(c=>c.price).sort((c,u)=>c-u);r.push({timestamp:l[l.length-1].timestamp,price:cu(a)});}return r}function pu(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:du(l.data,t)})),n=new Set;r.forEach(l=>l.data.forEach(a=>n.add(a.timestamp)));let o=Array.from(n).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 o.map(l=>{let a={timestamp:l};return i.forEach(({slug:c,map:u})=>{let d=u.get(l);if(d!==void 0)s.set(c,d),a[c]=d;else {let m=s.get(c);m!==void 0&&(a[c]=m);}}),a})}function Na(e){return jsxRuntime.jsx(mo,{children:jsxRuntime.jsx(uu,{...e})})}function uu({event:e,isLoading:t,className:r,volume:n}){let o=react.useMemo(()=>{let y=new Set;return (e.markets??[]).filter(R=>R.status!=="open"||y.has(R.slug)?false:(y.add(R.slug),true))},[e.markets]),i=react.useMemo(()=>[...o].sort((y,R)=>{let U=ee=>(ee.outcomes.find(Q=>Q.label.toLowerCase()==="yes")??ee.outcomes[0])?.price??0;return U(R)-U(y)}),[o]),[s,l]=react.useState(()=>i.slice(0,yn).map(y=>y.slug)),[a,c]=react.useState(en),u=react.useMemo(()=>{let y=new Map;return s.forEach((R,U)=>{y.set(R,Sa[U%Sa.length]);}),y},[s]),d=react.useMemo(()=>o.filter(y=>s.includes(y.slug)),[o,s]),{series:m,isLoading:p}=reactPredict.useMarketHistory(d,a),f=t||p,g=react.useMemo(()=>{if(m.length>0&&m.some(U=>U.data.length>0))return m;let y=Date.now(),R=864e5;return d.map(U=>{let Q=(U.outcomes?.find(se=>se.label.toLowerCase()==="yes")??U.outcomes?.[0])?.price??.5;return {marketSlug:U.slug,label:U.outcomes?.[0]?.label??U.question,data:[{timestamp:y-7*R,price:Q},{timestamp:y,price:Q}]}})},[m,d]),x=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),h=react.useMemo(()=>pu(g,x),[g,x]),k=react.useMemo(()=>{if(h.length===0)return [0,1];let y=1/0,R=-1/0;if(s.forEach(ee=>{h.forEach(Q=>{let se=Q[ee];se!=null&&(se<y&&(y=se),se>R&&(R=se));});}),!isFinite(y))return [0,1];let U=Math.max((R-y)*.15,.05);return [Math.max(0,y-U),Math.min(1,R+U)]},[h,s]),S=react.useMemo(()=>{let y=new Map;return g.forEach(R=>{R.data.length>0&&y.set(R.marketSlug,R.data[R.data.length-1].price);}),y},[g]),M=react.useMemo(()=>{let y=new Map;return g.forEach(R=>y.set(R.marketSlug,R.label)),y},[g]),v=react.useMemo(()=>g.map(y=>({slug:y.marketSlug,color:u.get(y.marketSlug)??"#6b7280"})),[g,u]),{wrapperRef:N,overlayRef:b,onMouseMove:K,onMouseLeave:D}=iu(),Y=react.useCallback(y=>{l(R=>R.includes(y)?R.length<=1?R:R.filter(U=>U!==y):R.length>=yn?R:[...R,y]);},[]),[ve,C]=react.useState(null),z=react.useRef(null),F=react.useRef(""),ne=react.useRef(0),L=!f&&h.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(lu,{series:g,colorMap:u,displayValues:ve??S}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:N,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:L?y=>{K(y),cancelAnimationFrame(ne.current),ne.current=requestAnimationFrame(()=>{C(z.current);});}:void 0,onMouseLeave:L?()=>{D(),cancelAnimationFrame(ne.current),F.current="",z.current=null,C(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"}})}):h.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:b,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:h,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:y=>tu(y,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:k,tickFormatter:y=>`${Math.round(y*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:y=>{let R=y;if(R.active&&R.payload?.length){let U=R.payload.map(ee=>`${ee.dataKey}:${ee.value}`).join(",");if(U!==F.current){F.current=U;let ee=new Map;R.payload.forEach(Q=>{Q.value!=null&&ee.set(Q.dataKey,Q.value);}),z.current=ee;}}return jsxRuntime.jsx(au,{...R,labelMap:M,allSeries:v,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(y=>{let R=u.get(y.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:y.marketSlug,stroke:R,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:R},connectNulls:true,isAnimationActive:false},y.marketSlug)}),ve==null&&h.length>0&&g.map(y=>{let R=h[h.length-1],U=R[y.marketSlug];if(U==null)return null;let ee=u.get(y.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:R.timestamp,y:U,ifOverflow:"extendDomain",shape:Q=>{let{cx:se,cy:we}=Q;return se==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:se,cy:we,r:6,fill:ee,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:se,cy:we,r:3.5,fill:ee})]})}},`pulse-${y.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[n!=null&&n>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:["$",Math.round(n).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(ou,{value:a,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(su,{markets:i,selectedSlugs:s,colorMap:u,onToggle:Y})})]})]})]})}function Ir(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Pu(e){return `${parseFloat((e*100).toFixed(2))}%`}function Pa(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function kn(e){return e.outcomes?.[0]?.label??e.question}function Cu(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Rr(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0");return `${r} ${n}, ${o} ${i}:${s}`}function Ca(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 n=new Date(e).getTime();if(isNaN(n))return null;let o=n-t;if(o<=0)return null;let i=Math.floor(o/864e5),s=Math.floor(o%864e5/36e5),l=Math.floor(o%36e5/6e4),a=Math.floor(o%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 Ma(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=(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}:${n} ${o}/${i}/${s} (${a}${c})`}function _a({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let d=[...e.markets||[]],m=d.filter(f=>f.status==="open").sort((f,g)=>Ir(g)-Ir(f)),p=d.filter(f=>f.status!=="open").sort((f,g)=>Ir(g)-Ir(f));return [...m,...p]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=Ca(s?void 0:e.start_at),a=Ca(s?void 0:e.end_at),c=Ma(e.start_at),u=Ma(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:n,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${o?"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 ${o?"!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:[!o&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((d,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:d.label})]},d.slug)),jsxRuntime.jsx(Lu,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${o?"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?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):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})}),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(Na,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Mu,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Tu,{markets:i,event:e})]})}var Ea=5;function Mu({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui.useScreen(),[o,i]=react.useState(false),[s,l]=react.useState(null),a=react.useMemo(()=>{let x=new Set;return e.filter(h=>x.has(h.slug)?false:(x.add(h.slug),true))},[e]),c=a.find(x=>x.status==="open")?.slug,[u,d]=react.useState(c?`${c}:yes`:null);if(a.length===0)return null;let m=a.length>Ea,p=o?a:a.slice(0,Ea),f=x=>{l(h=>h===x?null:x);},g=(x,h,k)=>{d(`${x.slug}:${h}`),n&&l(x.slug),t?.(x,h,k);};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:p.map((x,h)=>{let k=Ir(x),S=x.outcomes[1]?.best_ask??x.outcomes[1]?.price,M=s===x.slug;return jsxRuntime.jsx(Eu,{market:x,yesPrice:k,noPrice:S??void 0,activeYes:u===`${x.slug}:yes`,activeNo:u===`${x.slug}:no`,isExpanded:M,onToggleExpand:()=>f(x.slug),onTradeAction:g},x.id??`${h}-${x.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(x=>!x),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(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function Eu({market:e,yesPrice:t,noPrice:r,activeYes:n,activeNo:o,isExpanded:i,onToggleExpand:s,onTradeAction:l}){let{t:a}=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:s,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.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:kn(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:kn(e)}),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:Pu(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",n?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:d=>{d.stopPropagation(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Pa(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",o?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:d=>{d.stopPropagation(),l?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:Pa(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(ka,{market:e,outcome:o?"no":"yes",onTradeAction:l})})})})]})}function Tu({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,s]=react.useState(false),[l,a]=react.useState(0),c=e.filter(p=>p.rules&&p.rules.length>0||p.description);if(c.length===0)return null;let u=c[l]??c[0],d=u.rules&&u.rules.length>0?u.rules.join(`
88
88
 
89
- `):u.description??"";if(!d)return null;let m=d.length>200&&!o?d.slice(0,200)+"...":d;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:Sn(u)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:p=>{a(Number(p)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((p,f)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:Sn(p)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),d.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(p=>!p),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(p=>!p),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let p=u.status,f=[];return u.created_at&&f.push({label:r("predict.event.timeline.created"),value:Rr(u.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Rr(u.start_at),isActive:p!=="pending"}),p==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Rr(u.closed_at??u.end_at),isActive:true}):p==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Rr(u.closed_at??u.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Rr(u.end_at),isActive:false}),f})().map((p,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 ${p.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:p.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:p.value})]})]},p.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:Cu(u.source)})]})]})]})]})}function Lu({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 Ia({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Lr,{}):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(Ra,{event:o,onTradeAction:r})}var Du={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}},Au={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function gt(e){return Du[e]??Au}function Ox({source:e,className:t}){let r=gt(e);return jsxRuntime.jsxs("span",{className:ui$1.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var Da="rgba(39,39,42,0.6)",Wu="rgba(63,63,70,0.8)";function Uu(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Fa({eventSlug:e,source:t,limit:r=4,onEventClick:o,onEventHover:n}){let{t:i}=i18n.useTranslation(),{data:s,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!s||s.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:s.map(a=>jsxRuntime.jsx(Ku,{event:a,onClick:o,onHover:n},`${a.source}-${a.slug}`))})]})}function Ku({event:e,onClick:t,onHover:r}){let{t:o}=i18n.useTranslation(),n=gt(e.source),i=react.useMemo(()=>Uu(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=Wu,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=Da;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${Da}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:n.color,flexShrink:0},children:[n.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",o("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:s.label})]})]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function Nn(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function nb({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onSimilarEventHover:i,onBack:s}){let{t:l}=i18n.useTranslation(),{isMobile:a}=ui$1.useScreen(),{onOpen:c}=uiScaffold.useAsyncModal(Sr),{onOpen:u}=uiScaffold.useAsyncModal(ro),{data:d,isLoading:m}=reactPredict.useEvent({slug:e,source:t}),p=react.useMemo(()=>{let M=[...d?.markets||[]],h=M.filter(b=>b.status==="open").sort((b,K)=>Nn(K)-Nn(b)),T=M.filter(b=>b.status!=="open").sort((b,K)=>Nn(K)-Nn(b));return [...h,...T]},[d?.markets]),[f,g]=react.useState(null),v=react.useCallback((M,h,T)=>{g(b=>({market:M,outcome:h,side:T,version:(b?.version??0)+1})),a&&d&&(T==="sell"?u({params:{event:d,market:M,initialOutcome:h,chain:r}}):c({params:{event:d,market:M,initialOutcome:h,chain:r}}));},[a,d,r,c,u]),x=f?.market??p[0];if(m){let M=!!s;return a?jsxRuntime.jsx(Lr,{showBack:M}):jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Lr,{showBack:M})}),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(da,{})})})]})}let S=f?`${f.market.slug}-${f.version}`:x?.slug??"default",k=f?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui$1.Button,{as:"a",onPress:s,startContent:jsxRuntime.jsx(ui$1.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:l("common.back")})}),jsxRuntime.jsx(Ia,{eventSlug:e,source:t,onTradeAction:v})]}),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:[x&&(k?jsxRuntime.jsx(gn,{event:d,market:x,initialOutcome:f?.outcome,chain:r},S):jsxRuntime.jsx(cn,{event:d,market:x,initialOutcome:f?.outcome,chain:r},S)),d&&jsxRuntime.jsx(Fa,{eventSlug:e,source:d.source,onEventClick:n,onEventHover:i})]})]}),d&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(sa,{event:d,walletAddress:o})}),jsxRuntime.jsx(dn,{}),jsxRuntime.jsx(oa,{})]})}function Ha(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function om(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 db=e=>{let{candlestickMarketSlugs:t,chartRange:r=en,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>om(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(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(S=>S.slug===x)).filter(x=>x!==void 0):[...g].sort((x,S)=>Ha(S)-Ha(x)).slice(0,4)).map(x=>x.slug)},[t,s?.markets]),u=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:c.length>0}))}),d=u.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,v)=>{let x=u[v]?.error;x&&f.set(g,x);}),f},[c,u]),p=react.useMemo(()=>{let f=new Map;return c.forEach((g,v)=>{let x=u[v]?.data;x&&f.set(g,x);}),f},[c,u]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:p,isCandlesticksLoading:d,candlestickErrors:m}};var sm=10,lm=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Mn(){let[e,t]=jotai.useAtom(lm),r=react.useCallback(n=>{let i=n.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,sm)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function Ua({histories:e,onSelect:t,onClear:r,className:o}){let{t:n}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.cn("px-4 pb-4",o),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n("predict.search.history")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Ka({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Mn();return jsxRuntime.jsx(Ua,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:o})}function Va({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:s=>{s.preventDefault(),o?.();},children:"Esc"})})})}function Mm(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function ja({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=gt(e.source),c=react.useMemo(()=>Mm(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:u=>{t&&o&&u.preventDefault(),o?.(e);},onMouseEnter:()=>n?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color: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$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ya({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 Fm=64;function Xa({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:c,fetchNextPage:u}=Ya(i),d=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:d}),p=react.useCallback(x=>x<s.length,[s]),f=react.useCallback(async()=>{c&&!a&&await u();},[c,a,u]),g=react.useMemo(()=>c?s.length+1:s.length,[s,c]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(Hm,{className:n}):s.length===0?jsxRuntime.jsx(zm,{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:d,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:v,rowComponent:Bm,rowCount:g,rowHeight:Fm,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function Bm({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(ja,{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$1.Spinner,{size:"sm"})})}function Hm({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 zm({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 ts({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Mn(),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]),u=react.useCallback(m=>{a.cancel(),r(m),n(m),s(m),m&&l(m);},[a,s,l]),d=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:c,setKeyword:u,clearKeyword:d}}function rs({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:s}){let{text:l,keyword:a,setText:c,setKeyword:u,clearKeyword:d}=ts({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Va,{value:l,onValueChange:c,onClear:d,onEscape:i}),!a&&jsxRuntime.jsx(Ka,{onSelect:u}),jsxRuntime.jsx(Xa,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:s})]})}var yo="predict-search";function A1({id:e=yo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Zm,{...t})})}function Zm({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),s=react.useCallback(a=>{o(a);},[o]),l=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(rs,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function V1({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:i}=ui$1.useScreen(),{onOpen:s,onClose:l}=uiScaffold.useAsyncModal(yo),a=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let d=await s({params:t});d&&a(d);}),u=hooks.useCallbackRef(()=>{l();});return react.useEffect(()=>{let d=m=>{let p=document.activeElement,f=!!p&&(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.getAttribute("contenteditable")==="true");m.key==="/"&&!f&&(m.preventDefault(),c()),m.key==="Escape"&&(m.preventDefault(),u());};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d);}},[c,u]),jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:!n,onPress:c,variant:i?"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 So=[{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"}],ps=[{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}],ls={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"},cs={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 df(e,t){if(!e)return "$5K+";let r=ps.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function us({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),[u,d]=react.useState(false),[m,p]=react.useState(false),[f,g]=react.useState(false),v=react.useRef(null),x=react.useRef(null),S=So.find(h=>h.value===e)??So[0],k=react.useCallback(h=>{v.current&&!v.current.contains(h.target)&&c(false),x.current&&!x.current.contains(h.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)),[k]);let M=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
89
+ `):u.description??"";if(!d)return null;let m=d.length>200&&!n?d.slice(0,200)+"...":d;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:kn(u)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:p=>{a(Number(p)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((p,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:kn(p)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),d.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(p=>!p),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(n?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(p=>!p),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 p=u.status,f=[];return u.created_at&&f.push({label:r("predict.event.timeline.created"),value:Rr(u.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Rr(u.start_at),isActive:p!=="pending"}),p==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Rr(u.closed_at??u.end_at),isActive:true}):p==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Rr(u.closed_at??u.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Rr(u.end_at),isActive:false}),f})().map((p,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 ${p.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:p.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:p.value})]})]},p.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:Cu(u.source)})]})]})]})]})}function Lu({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 Ra({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(Lr,{}):i||!n?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(_a,{event:n,onTradeAction:r})}var Du={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}},Au={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ft(e){return Du[e]??Au}function Rx({source:e,className:t}){let r=ft(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var Oa="rgba(39,39,42,0.6)",Wu="rgba(63,63,70,0.8)";function Uu(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Aa({eventSlug:e,source:t,limit:r=4,onEventClick:n,onEventHover:o}){let{t:i}=i18n.useTranslation(),{data:s,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!s||s.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:s.map(a=>jsxRuntime.jsx(Ku,{event:a,onClick:n,onHover:o},`${a.source}-${a.slug}`))})]})}function Ku({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=ft(e.source),i=react.useMemo(()=>Uu(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=Wu,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=Oa;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${Oa}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:o.color,flexShrink:0},children:[o.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",n("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:s.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function wn(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function tb({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:s}){let{t:l}=i18n.useTranslation(),{isDesktop:a}=ui.useScreen(),{onOpen:c}=uiScaffold.useAsyncModal(Sr),{onOpen:u}=uiScaffold.useAsyncModal(to),{data:d,isLoading:m}=reactPredict.useEvent({slug:e,source:t}),p=react.useMemo(()=>{let M=[...d?.markets||[]],v=M.filter(b=>b.status==="open").sort((b,K)=>wn(K)-wn(b)),N=M.filter(b=>b.status!=="open").sort((b,K)=>wn(K)-wn(b));return [...v,...N]},[d?.markets]),[f,g]=react.useState(null),x=react.useCallback((M,v,N)=>{g(b=>({market:M,outcome:v,side:N,version:(b?.version??0)+1})),!a&&d&&(N==="sell"?u({params:{event:d,market:M,initialOutcome:v,chain:r}}):c({params:{event:d,market:M,initialOutcome:v,chain:r}}));},[a,d,r,c,u]),h=f?.market??p[0];if(m){let M=!!s;return a?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(Lr,{showBack:M})}),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(ca,{})})})]}):jsxRuntime.jsx(Lr,{showBack:M})}let k=f?`${f.market.slug}-${f.version}`:h?.slug??"default",S=f?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:s,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:l("common.back")})}),jsxRuntime.jsx(Ra,{eventSlug:e,source:t,onTradeAction:x})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[h&&(S?jsxRuntime.jsx(fn,{event:d,market:h,initialOutcome:f?.outcome,chain:r},k):jsxRuntime.jsx(cn,{event:d,market:h,initialOutcome:f?.outcome,chain:r},k)),d&&jsxRuntime.jsx(Aa,{eventSlug:e,source:d.source,onEventClick:o,onEventHover:i})]})]}),d&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(aa,{event:d,walletAddress:n})}),jsxRuntime.jsx(dn,{}),jsxRuntime.jsx(na,{})]})}function Ba(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function om(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 lb=e=>{let{candlestickMarketSlugs:t,chartRange:r=en,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>om(r),[r]),{data:s,isLoading:l,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:n}),c=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(h=>f.has(h.slug)?false:(f.add(h.slug),true));return (t&&t.length>0?t.slice(0,4).map(h=>g.find(k=>k.slug===h)).filter(h=>h!==void 0):[...g].sort((h,k)=>Ba(k)-Ba(h)).slice(0,4)).map(h=>h.slug)},[t,s?.markets]),u=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>o.listCandlesticks(f,i),enabled:c.length>0}))}),d=u.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,x)=>{let h=u[x]?.error;h&&f.set(g,h);}),f},[c,u]),p=react.useMemo(()=>{let f=new Map;return c.forEach((g,x)=>{let h=u[x]?.data;h&&f.set(g,h);}),f},[c,u]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:p,isCandlesticksLoading:d,candlestickErrors:m}};var sm=10,lm=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Cn(){let[e,t]=jotai.useAtom(lm),r=react.useCallback(o=>{let i=o.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,sm)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function Wa({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",n),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:o("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 Ua({onSelect:e,className:t}){let{histories:r,clearHistories:n}=Cn();return jsxRuntime.jsx(Wa,{className:ui.cn(t),histories:r,onSelect:e,onClear:n})}function Ka({value:e,onValueChange:t,onClear:r,onEscape:n,className:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:o,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(),n?.();},children:"Esc"})})})}function Mm(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Va({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=ft(e.source),c=react.useMemo(()=>Mm(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:u=>{t&&n&&u.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(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 ja({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,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(()=>n?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:l}}var Fm=64;function Qa({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:c,fetchNextPage:u}=ja(i),d=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:d}),p=react.useCallback(h=>h<s.length,[s]),f=react.useCallback(async()=>{c&&!a&&await u();},[c,a,u]),g=react.useMemo(()=>c?s.length+1:s.length,[s,c]),x=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(Hm,{className:o}):s.length===0?jsxRuntime.jsx(zm,{className:o}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:d,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:x,rowComponent:Bm,rowCount:g,rowHeight:Fm,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function Bm({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:s}){let l=r[e];return l?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Va,{event:l,href:o?.(l),LinkComponent:i,onSelect:n,onHover:s})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function Hm({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 zm({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 es({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=Cn(),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(m=>{o(m),s(m),m&&l(m);},500),[s,l]),c=react.useCallback(m=>{r(m),a(m);},[a]),u=react.useCallback(m=>{a.cancel(),r(m),o(m),s(m),m&&l(m);},[a,s,l]),d=react.useCallback(()=>u(""),[u]);return {text:t,keyword:n,setText:c,setKeyword:u,clearKeyword:d}}function ts({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:s}){let{text:l,keyword:a,setText:c,setKeyword:u,clearKeyword:d}=es({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Ka,{value:l,onValueChange:c,onClear:d,onEscape:i}),!a&&jsxRuntime.jsx(Ua,{onSelect:u}),jsxRuntime.jsx(Qa,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:s})]})}var bo="predict-search";function Oy({id:e=bo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Zm,{...t})})}function Zm({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),s=react.useCallback(a=>{n(a);},[n]),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:o("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(ts,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function Uy({onSelectEvent:e,modalParams:t,className:r,displayMode:n="auto"}){let{t:o}=i18n.useTranslation(),i=ui.useScreen(),s=n==="auto"?i.isDesktop:n==="desktop",l=n==="auto"?i.isMobile:n==="compact",{onOpen:a,onClose:c}=uiScaffold.useAsyncModal(bo),u=hooks.useCallbackRef(e),d=hooks.useCallbackRef(async()=>{let p=await a({params:t});p&&u(p);}),m=hooks.useCallbackRef(()=>{c();});return react.useEffect(()=>{let p=f=>{let g=document.activeElement,x=!!g&&(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.getAttribute("contenteditable")==="true");f.key==="/"&&!x&&(f.preventDefault(),d()),f.key==="Escape"&&(f.preventDefault(),m());};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p);}},[d,m]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!s,onPress:d,variant:l?"flat":"bordered",startContent:s?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:s?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(s&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:s?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var ko=[{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"}],ds=[{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}],ss={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"},ls={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 df(e,t){if(!e)return "$5K+";let r=ds.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function ps({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),[u,d]=react.useState(false),[m,p]=react.useState(false),[f,g]=react.useState(false),x=react.useRef(null),h=react.useRef(null),k=ko.find(v=>v.value===e)??ko[0],S=react.useCallback(v=>{x.current&&!x.current.contains(v.target)&&c(false),h.current&&!h.current.contains(v.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)),[S]);let M=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
90
90
  @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
91
91
  .match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
92
92
  .match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
93
- `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ls,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(h=>!h),d(false);},children:[jsxRuntime.jsx(pf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(S.labelKey)}),jsxRuntime.jsx(ds,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...cs,width:224,padding:4},children:So.map(h=>{let T=e===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:T?"rgba(199,255,46,0.08)":"transparent",color:T?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:b=>{T||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{T||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===h.value?o(!r):t(h.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:T?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(uf,{type:h.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(h.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(h.descKey)})]}),T&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ls,onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(h=>!h),c(false);},children:[jsxRuntime.jsx(mf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:df(n,l)}),jsxRuntime.jsx(ff,{onMouseEnter:()=>p(true),onMouseLeave:()=>p(false)}),jsxRuntime.jsx(ds,{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"})}),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")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{...cs,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:ps.map(h=>{let T=h.value===0?!n:n===h.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:T?"rgba(199,255,46,0.08)":"transparent",color:T?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:b=>{T||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{T||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(h.value===0?void 0:h.value),d(false);},children:[jsxRuntime.jsx("span",{children:h.labelKey?l(h.labelKey):h.label}),T&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},h.value)})})]})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:h=>{h.currentTarget.style.background="rgba(39,39,42,1)",h.currentTarget.style.color="#fff";},onMouseLeave:h=>{h.currentTarget.style.background="rgba(39,39,42,0.6)",h.currentTarget.style.color="#a1a1aa";},onClick:M,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 pf(){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 uf({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 mf(){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 ff({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 ds({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 vf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var xf=[{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:vf,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function ms({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
93
+ `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ss,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),d(false);},children:[jsxRuntime.jsx(pf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(k.labelKey)}),jsxRuntime.jsx(cs,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...ls,width:224,padding:4},children:ko.map(v=>{let N=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:N?"rgba(199,255,46,0.08)":"transparent",color:N?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:b=>{N||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{N||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===v.value?n(!r):t(v.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:N?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(uf,{type:v.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(v.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(v.descKey)})]}),N&&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)})})]}),i&&jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ss,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(v=>!v),c(false);},children:[jsxRuntime.jsx(mf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:df(o,l)}),jsxRuntime.jsx(ff,{onMouseEnter:()=>p(true),onMouseLeave:()=>p(false)}),jsxRuntime.jsx(cs,{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"})}),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")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{...ls,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:ds.map(v=>{let N=v.value===0?!o:o===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:N?"rgba(199,255,46,0.08)":"transparent",color:N?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:b=>{N||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{N||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(v.value===0?void 0:v.value),d(false);},children:[jsxRuntime.jsx("span",{children:v.labelKey?l(v.labelKey):v.label}),N&&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)})})]})]}),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: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:M,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 pf(){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 uf({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 mf(){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 ff({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 cs({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 vf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var xf=[{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:vf,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function us({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
94
94
  @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
95
95
  @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
96
96
  @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@@ -128,21 +128,21 @@
128
128
  .matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
129
129
  @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
130
130
  `}),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(`
131
- `).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:xf.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 wo(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function No(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function yf(e){return e.outcomes?.[0]?.label||null}function kf(e){return e==null?"low":e>=3?"high":e>=2?"medium":"low"}var vs={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)"}},Sf={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)"}},fs={high:{dot:"#17c964",label:"predict.matches.confidenceHigh"},medium:{dot:"#f5a524",label:"predict.matches.confidenceMed"},low:{dot:"#71717a",label:"predict.matches.confidenceLow"}};function wf(e,t){return e||(t==null?"low":t>=.9?"high":t>=.7?"medium":"low")}function Nf({tier:e}){let t=vs[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 Pf={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},Cf={text:"#9ca3af",icon:"#9ca3af"};function Mf(e){return Pf[e]??Cf}var Ef=`
131
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),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:xf.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<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+n*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:`${n*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+n*80}ms`}})})]},r.key))})]})]})}function So(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function wo(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function yf(e){return e.outcomes?.[0]?.label||null}function kf(e){return e==null?"low":e>=3?"high":e>=2?"medium":"low"}var hs={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)"}},Sf={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)"}},ms={high:{dot:"#17c964",label:"predict.matches.confidenceHigh"},medium:{dot:"#f5a524",label:"predict.matches.confidenceMed"},low:{dot:"#71717a",label:"predict.matches.confidenceLow"}};function wf(e,t){return e||(t==null?"low":t>=.9?"high":t>=.7?"medium":"low")}function Nf({tier:e}){let t=hs[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},(n,o)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:o<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},o))})}var Pf={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},Cf={text:"#9ca3af",icon:"#9ca3af"};function Mf(e){return Pf[e]??Cf}var Ef=`
132
132
  .match-card button:focus-visible,
133
133
  .match-card a:focus-visible,
134
134
  .match-card [role="button"]:focus-visible {
135
135
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
136
136
  outline-offset: 2px;
137
137
  }
138
- `;function xs({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=No(e.market_a),l=No(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=kf(a),u=vs[c],d=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,p=wf(e.confidence_tier,e.similarity_score),f=fs[p]??fs.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:v=>{let x=v.currentTarget,S=Sf[c];x.style.borderColor=S.border,x.style.boxShadow=S.shadow,r?.(e);},onMouseLeave:v=>{let x=v.currentTarget;x.style.borderColor="rgba(39,39,42,0.6)",x.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:Ef}),a!=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:[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(Nf,{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(gs,{source:e.source_a,market:e.market_a,isCheaper:d===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(gs,{source:e.source_b,market:e.market_b,isCheaper:d===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),d&&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:v=>{let x=v.currentTarget;x.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:v=>{let x=v.currentTarget;x.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,d),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:d.charAt(0).toUpperCase()+d.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"})]}),wo(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"})}),wo(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 gs({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=gt(e),a=Mf(e),c=No(t),u=yf(t),d=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:p=>{p.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:p=>{p.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:[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:[wo(d)," ",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 Ss=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},c){let{t:u}=i18n.useTranslation(),{data:d,hasNextPage:m,fetchNextPage:p,isFetchingNextPage:f,isLoading:g,isPlaceholderData:v,refetch:x}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[S,k]=react.useState(0),[M,h]=react.useState(false);M&&!v?(h(false),k(P=>P+1)):v&&!M&&h(true),react.useImperativeHandle(c,()=>({refetch:()=>{x();}}),[x]);let T=react.useMemo(()=>d?.pages.flatMap(P=>P.items??[])??[],[d]),b=d?.pages[0]?.total,K=react.useMemo(()=>{let P=0,z=0,F=0;for(let ne of T){let L=ne.spread??0;L>P&&(P=L),L>=.03&&F++,ne.combined_volume!=null&&(z+=ne.combined_volume);}return {activePairs:b??T.length,maxSpread:P,highSpreadCount:F,totalVolume:z}},[T,b]);react.useEffect(()=>{K.activePairs>0&&a?.(K);},[K,a]);let I=react.useRef(null),Y=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let P=I.current;if(!P)return;let z=new IntersectionObserver(F=>{F[0]?.isIntersecting&&m&&!f&&p();},{rootMargin:"200px"});return z.observe(P),()=>z.disconnect()},[m,f,p]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(Af,{});if(T.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:u("predict.matches.empty")})});let ve=!m&&T.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
138
+ `;function vs({match:e,onSelect:t,onHover:r,getMarketHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=wo(e.market_a),l=wo(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=kf(a),u=hs[c],d=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,p=wf(e.confidence_tier,e.similarity_score),f=ms[p]??ms.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:x=>{let h=x.currentTarget,k=Sf[c];h.style.borderColor=k.border,h.style.boxShadow=k.shadow,r?.(e);},onMouseLeave:x=>{let h=x.currentTarget;h.style.borderColor="rgba(39,39,42,0.6)",h.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:Ef}),a!=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:[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(Nf,{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(fs,{source:e.source_a,market:e.market_a,isCheaper:d===e.source_a,onClick:()=>t?.(e,e.source_a),href:n?.(e,e.source_a),LinkComponent:o}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(fs,{source:e.source_b,market:e.market_b,isCheaper:d===e.source_b,onClick:()=>t?.(e,e.source_b),href:n?.(e,e.source_b),LinkComponent:o})]}),d&&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:x=>{let h=x.currentTarget;h.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:x=>{let h=x.currentTarget;h.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,d),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:d.charAt(0).toUpperCase()+d.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"})]}),So(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"})}),So(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 fs({source:e,market:t,isCheaper:r,onClick:n,href:o,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=ft(e),a=Mf(e),c=wo(t),u=yf(t),d=t.volume,m=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:o||n?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter:p=>{p.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:p=>{p.currentTarget.style.background=r?"rgba(199,255,46,0.03)":"transparent";},onClick:n,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:[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:[So(d)," ",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 o&&i?jsxRuntime.jsx(i,{href:o,className:"block",children:m}):m}var ks=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,onSelect:o,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},c){let{t:u}=i18n.useTranslation(),{data:d,hasNextPage:m,fetchNextPage:p,isFetchingNextPage:f,isLoading:g,isPlaceholderData:x,refetch:h}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[k,S]=react.useState(0),[M,v]=react.useState(false);M&&!x?(v(false),S(C=>C+1)):x&&!M&&v(true),react.useImperativeHandle(c,()=>({refetch:()=>{h();}}),[h]);let N=react.useMemo(()=>d?.pages.flatMap(C=>C.items??[])??[],[d]),b=d?.pages[0]?.total,K=react.useMemo(()=>{let C=0,z=0,F=0;for(let ne of N){let L=ne.spread??0;L>C&&(C=L),L>=.03&&F++,ne.combined_volume!=null&&(z+=ne.combined_volume);}return {activePairs:b??N.length,maxSpread:C,highSpreadCount:F,totalVolume:z}},[N,b]);react.useEffect(()=>{K.activePairs>0&&a?.(K);},[K,a]);let D=react.useRef(null),Y=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let C=D.current;if(!C)return;let z=new IntersectionObserver(F=>{F[0]?.isIntersecting&&m&&!f&&p();},{rootMargin:"200px"});return z.observe(C),()=>z.disconnect()},[m,f,p]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(Af,{});if(N.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:u("predict.matches.empty")})});let ve=!m&&N.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
139
139
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
140
140
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
141
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:d?.pages.map(P=>P.items?.map((z,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(xs,{match:z,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l})},`${S}-${z.match_id}-${z.source_a}-${z.market_a?.slug??F}`)))}),jsxRuntime.jsxs("div",{ref:I,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"})}),u("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(Df,{onScrollToTop:Y})]})});function Df({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 Af(){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(Ff,{index:t},t))})]})}function Ff({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 Wf={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Uf(){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 Kf({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(Uf,{})]})]})]})]})}function Ty({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),[u,d]=react.useState(5e3),[m,p]=react.useState(),f=react.useRef(null),g=react.useCallback(k=>{l(k);},[]),v=react.useCallback(k=>{c(k);},[]),x=react.useCallback(k=>{react.startTransition(()=>{p(k);});},[]),S=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
141
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:d?.pages.map(C=>C.items?.map((z,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(vs,{match:z,onSelect:o,onHover:i,getMarketHref:s,LinkComponent:l})},`${k}-${z.match_id}-${z.source_a}-${z.market_a?.slug??F}`)))}),jsxRuntime.jsxs("div",{ref:D,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"})}),u("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(Df,{onScrollToTop:Y})]})});function Df({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 Af(){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(Ff,{index:t},t))})]})}function Ff({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(n=>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}})]},n))}),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 Wf={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Uf(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let o=new Date;return `${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`};t(r());let n=setInterval(()=>t(r()),1e4);return ()=>clearInterval(n)},[]),jsxRuntime.jsx("span",{children:e})}function Kf({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(Uf,{})]})]})]})]})}function M1({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,bgImageSrc:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,c]=react.useState(false),[u,d]=react.useState(5e3),[m,p]=react.useState(),f=react.useRef(null),g=react.useCallback(S=>{l(S);},[]),x=react.useCallback(S=>{c(S);},[]),h=react.useCallback(S=>{react.startTransition(()=>{p(S);});},[]),k=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
142
142
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
143
143
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
144
144
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
145
145
  .match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
146
- `}),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(ms,{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(Wf[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(us,{sortBy:s,onSortChange:g,sortAsc:a,onSortAscChange:v,minVolume:u,onMinVolumeChange:d,onRefresh:S})]})]}),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(Ss,{ref:f,sortBy:s,sortAsc:a,minVolume:u,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,onStatsChange:x})]}),jsxRuntime.jsx(Kf,{stats:m})]})}function Co(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var jf={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"}},Yf={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 Gf(e){return jf[e]??Yf}function qf(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 Qf(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 Dy({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>qf(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[l,a]=react.useMemo(()=>Qf(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 d=l.yesPrice!=null&&a.yesPrice!=null?l.yesPrice<=a.yesPrice?l:a:null,m=d?gt(d.source):null,p=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(Ps,{data:l,isCheaper:d===l,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(Ps,{data:a,isCheaper:d===a,onSelect:t,getEventHref:r,LinkComponent:o})]}),d&&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 ${p==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:p==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>d.event&&t?.(d.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p==="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:p==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:d.source.charAt(0).toUpperCase()+d.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:p==="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"})]}),Co(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"})}),Co(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 Ps({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=gt(e.source),l=Gf(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:u=>{u.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:u=>{u.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:[Co(e.volume)," ",i("predict.matches.volume")]})]});return a&&n?jsxRuntime.jsx(n,{href:a,className:"block",children:c}):c}function Zf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function zy({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(_n,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(Mo,{}),jsxRuntime.jsx(_n,{label:r("predict.matches.stats.totalVolume"),value:Zf(o.totalVolume)}),jsxRuntime.jsx(Mo,{}),jsxRuntime.jsx(_n,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Mo,{}),jsxRuntime.jsx(_n,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function _n({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 Mo(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Es(e){return `${(e*100).toFixed(1)}\xA2`}function eg(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function Ky({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",eg(e)),children:Es(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Es(t)]})]})}var Fr=10,ag=64,Rs=40,Rn=48;function Is({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:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:d,isLoading:m,fetchNextPage:p,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=l||m,x=u||g,S=c||f,k=react.useMemo(()=>{let P=[];return s?.pages&&P.push(...s.pages.flatMap(z=>z.items)),d?.pages&&P.push(...d.pages.flatMap(z=>z.items)),P.sort((z,F)=>(F.timestamp??0)-(z.timestamp??0)),P},[s,d]),M=Math.max(1,Math.ceil(k.length/Fr)+(S?1:0)),h=(n-1)*Fr,T=k.slice(h,h+Fr),b=react.useCallback(()=>{i(P=>Math.max(1,P-1));},[]),K=react.useCallback(async()=>{n*Fr>=k.length&&S&&(c&&await a(),f&&await p()),i(z=>z+1);},[n,k.length,S,c,f,a,p]),I=n>1,Y=n*Fr<k.length||S;if(v)return jsxRuntime.jsx(ug,{height:r});if(k.length===0&&!S)return jsxRuntime.jsx(pg,{message:o("predict.profile.noHistory"),height:r});let ve=r-Rs-Rn;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:Rs},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:[T.map((P,z)=>jsxRuntime.jsx(sg,{trade:P},P.id??`${h+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:Rn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!I,onClick:b,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",I?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(M,5)},(P,z)=>{let F=z+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(F),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",F===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:F},F)}),jsxRuntime.jsxs("button",{type:"button",disabled:!Y,onClick:K,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",Y?"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-Rn},children:T.map((P,z)=>jsxRuntime.jsx(lg,{trade:P},P.id??`m-${h+z}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Rn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!I,onClick:b,className:ui$1.cn("text-sm cursor-pointer",I?"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:!Y,onClick:K,className:ui$1.cn("text-sm cursor-pointer",Y?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function sg({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Os(e.type,t),s=r,l=s?"+":"-",a=s?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,d=e.outcome??"",m=Bs(e.timestamp),p=Ds(e),f=cg(e),g=dg(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:ag},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:[d&&jsxRuntime.jsx("span",{className:"mr-1",children:d}),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:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fs(o)}),jsxRuntime.jsx("div",{className:ui$1.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$1.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:p&&jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(As,{})})})]})}function lg({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Os(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=Bs(e.timestamp),a=Ds(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$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: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:Fs(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(As,{})})]})]})}function Os(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 Ds(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function cg(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 dg(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 As(){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 pg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function ug({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 Fs(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Bs(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 Br=10,bg=64,zs=40,In=48;function Ws({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:u,isFetchingNextPage:d}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:p,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=a||p,S=d||v,k=u||g,M=react.useMemo(()=>{let F=[],ne=new Set(["live","open","submitted","pending"]);return l?.pages&&F.push(...l.pages.flatMap(L=>L.items).filter(L=>ne.has(L.status))),m?.pages&&F.push(...m.pages.flatMap(L=>L.items).filter(L=>ne.has(L.status))),F},[l,m]),h=react.useCallback(F=>{n.mutate({source:F.source,id:F.id});},[n]),T=Math.max(1,Math.ceil(M.length/Br)+(k?1:0)),b=(i-1)*Br,K=M.slice(b,b+Br),I=react.useCallback(()=>{s(F=>Math.max(1,F-1));},[]),Y=react.useCallback(async()=>{i*Br>=M.length&&k&&(u&&await c(),g&&await f()),s(ne=>ne+1);},[i,M.length,k,u,g,c,f]),ve=i>1,P=i*Br<M.length||k;if(x)return jsxRuntime.jsx(wg,{height:r});if(M.length===0&&!k)return jsxRuntime.jsx(Sg,{message:o("predict.profile.noOrders"),height:r});let z=r-zs-In;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:zs},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(F=>jsxRuntime.jsx(yg,{order:F,onCancel:h},F.id)),S&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx($s,{className:"hidden lg:flex",currentPage:i,totalPages:T,canGoPrev:ve,canGoNext:P,onPrev:I,onNext:Y,onPage:s,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-In},children:K.map(F=>jsxRuntime.jsx(kg,{order:F,onCancel:h},F.id))}),jsxRuntime.jsx($s,{className:"lg:hidden",currentPage:i,totalPages:T,canGoPrev:ve,canGoNext:P,onPrev:I,onNext:Y,onPage:s,t:o,compact:true})]})}function yg({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:bg},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?Us(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function kg({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?Us(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 $s({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$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:In},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:i,className:ui$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:s,className:ui$1.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:In},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:i,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",a("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(u,d)=>{let m=d+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(m),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",m===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:m},m)}),jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:s,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[a("predict.profile.next")," \u2192"]})]})}function Sg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function wg({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 Us(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Ro=10,Mg=64,Ks=40,On=48;function Vs({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(_g,{height:r});if(e.length===0)return jsxRuntime.jsx(Lg,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/Ro)),u=(s-1)*Ro,d=e.slice(u,u+Ro),m=s>1,p=s<c,f=r-Ks-On;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:Ks},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:d.map((g,v)=>jsxRuntime.jsx(Eg,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??u+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:On},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(g,v)=>{let x=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(x),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!p,onClick:()=>l(g=>g+1),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:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-On},children:d.map((g,v)=>jsxRuntime.jsx(Tg,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${u+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:On},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!p,onClick:()=>l(g=>g+1),className:ui$1.cn("text-sm cursor-pointer",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Eg({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,u=n>0?"text-success":n<0?"text-danger":"text-foreground",d=n>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?Rg(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:Mg},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:[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:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",a.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count:kr(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:Io(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Io(l)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:[jsxRuntime.jsxs("span",{children:[d,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",d,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:v}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),o("predict.profile.close")]})})]})}function Tg({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$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(Dn,{label:o("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx(Dn,{label:o("predict.profile.markPrice"),value:Io(s)}),jsxRuntime.jsx(Dn,{label:o("predict.profile.pnl"),value:`${a}$${Math.abs(n).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx(Dn,{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 Dn({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 Lg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function _g({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 Io(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Rg(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 Ys({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let l=0,a=0;for(let p of e)l+=p.realized_pnl??0,a+=p.current_value??p.size*(p.current_price??0);let c=0,u=0,d=0;for(let p of t)c+=p.usd_size??0,p.type==="REDEEM"&&(d++,(p.usd_size??0)>0&&u++);let m=d>0?`${u} / ${d}`:"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$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",i),children:[s,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Do,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Do,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Do,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Do({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 Ao=600;function zg({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:u,isLoading:d}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let b=[];return a?.positions&&b.push(...a.positions),u?.positions&&b.push(...u.positions),b},[a,u]),p=c||d,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:v,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),S=react.useMemo(()=>[...f?.pages?.flatMap(K=>K.items)??[],...v?.pages?.flatMap(K=>K.items)??[]],[f,v]),k=p||g||x,M=m.length,T=[{key:"positions",label:M>0?`${n("predict.profile.positionsTab")} (${M})`: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(Ys,{positions:m,trades:S,isLoading:k}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:T.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(b.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===b.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:b.label},b.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Vs,{positions:m,isLoading:p,listHeight:Ao,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Ws,{solanaAddress:e,evmAddress:t,listHeight:Ao}),i==="history"&&jsxRuntime.jsx(Is,{solanaAddress:e,evmAddress:t,listHeight:Ao})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function $2({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),[u,d]=react.useState(false),m=r||u,p=o||u,f=m?"done":s?"running":"pending",g=p?"done":m&&s?"running":"pending",v=m&&p,x=react.useCallback(async()=>{c(null),d(false),l(true);try{await n(),d(!0);}catch(h){c(h instanceof Error?h.message:String(h));}finally{l(false);}},[n]),S=[{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}],k=()=>{v?t():x();},M=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:h=>{h||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:S.map((h,T)=>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(Vg,{index:T+1,status:h.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:h.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${h.status==="done"?"text-[#c7ff2e]":h.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:h.status==="done"?i("predict.setup.stepComplete"):h.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:h.desc})]})]},h.key))}),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:k,disabled:s,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):M}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Vg({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})}
147
- 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=l0;exports.CHART_RANGE_PERIOD=a0;exports.CHART_RANGE_SAMPLE_INTERVAL=s0;exports.CandlestickPeriod=Zr;exports.CategoriesSkeleton=Xg;exports.CategoriesUI=jo;exports.CategoriesWidget=qo;exports.ChartRange=Ue;exports.DEFAULT_CHART_RANGE=en;exports.DEFAULT_FILTER_STATE=jn;exports.DEFAULT_PAGE_SIZE=br;exports.DEFAULT_PRICE_HISTORY_INTERVAL=u0;exports.EventDetailPage=nb;exports.EventDetailSkeleton=Lr;exports.EventDetailUI=Ra;exports.EventDetailWidget=Ia;exports.EventItem=Oi;exports.EventMarketDepthChartUI=va;exports.EventMarketDetailWidget=Sa;exports.EventPriceChart=Pa;exports.EventsFilterUI=ui;exports.EventsHero=fi;exports.EventsPage=ev;exports.EventsPageSkeleton=Ph;exports.EventsSkeleton=Gn;exports.EventsToolbarUI=yi;exports.EventsUI=Hi;exports.EventsWidget=$i;exports.KycModal=sn;exports.MAX_PRICE_HISTORY_MARKETS=$n;exports.MatchGroupCard=Dy;exports.MatchMarketCard=xs;exports.MatchesFilterBar=us;exports.MatchesHero=ms;exports.MatchesPage=Ty;exports.MatchesStatsBar=zy;exports.MatchesWidget=Ss;exports.ORDER_MAX_PRICE=p0;exports.ORDER_MIN_PRICE=d0;exports.ORDER_MIN_QUANTITY=tn;exports.ORDER_MIN_USDC=rn;exports.ORDER_PRICE_STEP=c0;exports.PREDICT_SEARCH_MODAL_ID=yo;exports.PREDICT_SELL_MODAL_ID=ro;exports.PREDICT_TRADE_MODAL_ID=Sr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=m0;exports.PredictSearchModal=A1;exports.PredictSellModal=oa;exports.PredictTradeModal=dn;exports.PredictWalletProvider=Sl;exports.PriceHistoryInterval=cr;exports.ProfilePage=zg;exports.SORT_PRESETS=bi;exports.STATIC_CATEGORIES=zn;exports.SearchEventsButton=V1;exports.SearchHistoryUI=Ua;exports.SearchHistoryWidget=Ka;exports.SearchInputUI=Va;exports.SearchResultItemUI=ja;exports.SearchResultListWidget=Xa;exports.SearchWidget=rs;exports.SellFormUI=ra;exports.SellFormWidget=gn;exports.SetupModal=$2;exports.SimilarEventCard=Ku;exports.SimilarEventsSection=Fa;exports.SourceBadge=Ox;exports.SpreadIndicator=Ky;exports.TradeFormSkeleton=da;exports.TradeFormUI=di;exports.TradeFormWidget=cn;exports.UserActivitySection=sa;exports.countActiveFilters=Yn;exports.fireCelebration=Yt;exports.floorToDecimals=rt;exports.formatKMB=_r;exports.formatShares=kr;exports.getSourceMeta=gt;exports.parsePolymarketError=an;exports.resolveExpiration=nn;exports.roundToTickSize=on;exports.useEventDetail=db;exports.useEventsInfinite=wi;exports.usePredictSearchHistory=Mn;exports.usePredictWallet=yr;exports.useSearchResultListScript=Ya;exports.useSearchScript=ts;exports.useSellForm=Yi;exports.useTradeForm=ri;exports.version=sl;//# sourceMappingURL=index.js.map
146
+ `}),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:[o&&jsxRuntime.jsx("img",{src:o,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(us,{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(Wf[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(ps,{sortBy:s,onSortChange:g,sortAsc:a,onSortAscChange:x,minVolume:u,onMinVolumeChange:d,onRefresh:k})]})]}),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(ks,{ref:f,sortBy:s,sortAsc:a,minVolume:u,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,onStatsChange:h})]}),jsxRuntime.jsx(Kf,{stats:m})]})}function Po(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var jf={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"}},Yf={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 Gf(e){return jf[e]??Yf}function qf(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let n of e.matched_markets){let o=n.spread??0;o>r&&(r=o,t=n);}return t}function Qf(e,t){let r=e.entries.find(l=>l.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(l=>l.source===(t?.source_b??e.entries[1]?.source)),o=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=o(t?.market_a),s=o(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??n?.source??"unknown",outcomeName:s.name,yesPrice:s.price,volume:n?.event?.volume??null,event:n?.event}]}function I1({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>qf(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[l,a]=react.useMemo(()=>Qf(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 d=l.yesPrice!=null&&a.yesPrice!=null?l.yesPrice<=a.yesPrice?l:a:null,m=d?ft(d.source):null,p=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(Ns,{data:l,isCheaper:d===l,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(Ns,{data:a,isCheaper:d===a,onSelect:t,getEventHref:r,LinkComponent:n})]}),d&&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 ${p==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:p==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>d.event&&t?.(d.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p==="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:p==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:d.source.charAt(0).toUpperCase()+d.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:p==="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"})]}),Po(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"})}),Po(e.combined_volume_24h)," ",o("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),"%"," ",o("predict.matches.match")]})]})]})}function Ns({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=ft(e.source),l=Gf(e.source),a=e.event?n?.(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:u=>{u.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:u=>{u.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:[Po(e.volume)," ",i("predict.matches.volume")]})]});return a&&o?jsxRuntime.jsx(o,{href:a,className:"block",children:c}):c}function Zf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function B1({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,s=new Set;for(let l of e){l.max_spread!=null&&l.max_spread>o&&(o=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:o,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(Ln,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Co,{}),jsxRuntime.jsx(Ln,{label:r("predict.matches.stats.totalVolume"),value:Zf(n.totalVolume)}),jsxRuntime.jsx(Co,{}),jsxRuntime.jsx(Ln,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Co,{}),jsxRuntime.jsx(Ln,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Ln({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 Co(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Ms(e){return `${(e*100).toFixed(1)}\xA2`}function eg(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function W1({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=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",eg(e)),children:Ms(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Ms(t)]})]})}var Fr=10,ag=64,_s=40,_n=48;function Rs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:s,isLoading:l,fetchNextPage:a,hasNextPage:c,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:d,isLoading:m,fetchNextPage:p,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),x=l||m,h=u||g,k=c||f,S=react.useMemo(()=>{let C=[];return s?.pages&&C.push(...s.pages.flatMap(z=>z.items)),d?.pages&&C.push(...d.pages.flatMap(z=>z.items)),C.sort((z,F)=>(F.timestamp??0)-(z.timestamp??0)),C},[s,d]),M=Math.max(1,Math.ceil(S.length/Fr)+(k?1:0)),v=(o-1)*Fr,N=S.slice(v,v+Fr),b=react.useCallback(()=>{i(C=>Math.max(1,C-1));},[]),K=react.useCallback(async()=>{o*Fr>=S.length&&k&&(c&&await a(),f&&await p()),i(z=>z+1);},[o,S.length,k,c,f,a,p]),D=o>1,Y=o*Fr<S.length||k;if(x)return jsxRuntime.jsx(ug,{height:r});if(S.length===0&&!k)return jsxRuntime.jsx(pg,{message:n("predict.profile.noHistory"),height:r});let ve=r-_s-_n;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:_s},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("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:[N.map((C,z)=>jsxRuntime.jsx(sg,{trade:C},C.id??`${v+z}`)),h&&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:_n},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!D,onClick:b,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:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(M,5)},(C,z)=>{let F=z+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(F),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",F===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:F},F)}),jsxRuntime.jsxs("button",{type:"button",disabled:!Y,onClick:K,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",Y?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-_n},children:N.map((C,z)=>jsxRuntime.jsx(lg,{trade:C},C.id??`m-${v+z}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:_n},children:[jsxRuntime.jsx("button",{type:"button",disabled:!D,onClick:b,className:ui.cn("text-sm cursor-pointer",D?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:o}),jsxRuntime.jsx("button",{type:"button",disabled:!Y,onClick:K,className:ui.cn("text-sm cursor-pointer",Y?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function sg({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=Is(e.type,t),s=r,l=s?"+":"-",a=s?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,d=e.outcome??"",m=Fs(e.timestamp),p=Os(e),f=cg(e),g=dg(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:ag},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:[d&&jsxRuntime.jsx("span",{className:"mr-1",children:d}),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:As(n)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",a),children:o>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",o.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:p&&jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ds,{})})})]})}function lg({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=Is(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=Fs(e.timestamp),a=Os(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:As(n)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:o>0?`$${o.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(Ds,{})})]})]})}function Is(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 Os(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function cg(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function dg(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return null}function Ds(){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 pg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function ug({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 As(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Fs(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=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}:${n} ${o}/${i}/${s} (${a}${c})`}var Br=10,bg=64,Hs=40,Rn=48;function $s({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:l,isLoading:a,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:d}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:p,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:x}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),h=a||p,k=d||x,S=u||g,M=react.useMemo(()=>{let F=[],ne=new Set(["live","open","submitted","pending"]);return l?.pages&&F.push(...l.pages.flatMap(L=>L.items).filter(L=>ne.has(L.status))),m?.pages&&F.push(...m.pages.flatMap(L=>L.items).filter(L=>ne.has(L.status))),F},[l,m]),v=react.useCallback(F=>{o.mutate({source:F.source,id:F.id});},[o]),N=Math.max(1,Math.ceil(M.length/Br)+(S?1:0)),b=(i-1)*Br,K=M.slice(b,b+Br),D=react.useCallback(()=>{s(F=>Math.max(1,F-1));},[]),Y=react.useCallback(async()=>{i*Br>=M.length&&S&&(u&&await c(),g&&await f()),s(ne=>ne+1);},[i,M.length,S,u,g,c,f]),ve=i>1,C=i*Br<M.length||S;if(h)return jsxRuntime.jsx(wg,{height:r});if(M.length===0&&!S)return jsxRuntime.jsx(Sg,{message:n("predict.profile.noOrders"),height:r});let z=r-Hs-Rn;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:Hs},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:z},children:[K.map(F=>jsxRuntime.jsx(yg,{order:F,onCancel:v},F.id)),k&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(zs,{className:"hidden lg:flex",currentPage:i,totalPages:N,canGoPrev:ve,canGoNext:C,onPrev:D,onNext:Y,onPage:s,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Rn},children:K.map(F=>jsxRuntime.jsx(kg,{order:F,onCancel:v},F.id))}),jsxRuntime.jsx(zs,{className:"lg:hidden",currentPage:i,totalPages:N,canGoPrev:ve,canGoNext:C,onPrev:D,onNext:Y,onPage:s,t:n,compact:true})]})}function yg({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):o*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:bg},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",n?"text-success":"text-danger"),children:r(n?"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:o>0?Ws(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function kg({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=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",n?"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:o>0?Ws(o):"\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 zs({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,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:Rn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui.cn("text-sm cursor-pointer",n?"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:!o,onClick:s,className:ui.cn("text-sm cursor-pointer",o?"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:Rn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,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:["\u2190 ",a("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(u,d)=>{let m=d+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:!o,onClick:s,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:[a("predict.profile.next")," \u2192"]})]})}function Sg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function wg({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 Ws(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var _o=10,Mg=64,Us=40,In=48;function Ks({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(1),a=react.useCallback(()=>{for(let g of e)n?.(g);},[e,n]);if(t)return jsxRuntime.jsx(_g,{height:r});if(e.length===0)return jsxRuntime.jsx(Lg,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/_o)),u=(s-1)*_o,d=e.slice(u,u+_o),m=s>1,p=s<c,f=r-Us-In;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:Us},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:n&&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:d.map((g,x)=>jsxRuntime.jsx(Eg,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??u+x}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:In},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,x)=>{let h=x+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(h),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",h===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:h},h)}),jsxRuntime.jsxs("button",{type:"button",disabled:!p,onClick:()=>l(g=>g+1),className:ui.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:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-In},children:d.map((g,x)=>jsxRuntime.jsx(Tg,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${u+x}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:In},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:!p,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Eg({position:e,onClosePosition:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=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,u=o>0?"text-success":o<0?"text-danger":"text-foreground",d=o>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",x=e.market?.end_at?Rg(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:Mg},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:[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: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:n("predict.profile.contracts",{count:kr(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:Ro(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ro(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",u),children:[jsxRuntime.jsxs("span",{children:[d,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",d,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:x}),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"}),n("predict.profile.close")]})})]})}function Tg({position:e,onClose:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,s=e.current_price??0,l=o>0?"text-success":o<0?"text-danger":"text-foreground",a=o>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(On,{label:n("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx(On,{label:n("predict.profile.markPrice"),value:Ro(s)}),jsxRuntime.jsx(On,{label:n("predict.profile.pnl"),value:`${a}$${Math.abs(o).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx(On,{label:n("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:n("predict.profile.close")})})]})}function On({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 Lg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function _g({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 Ro(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Rg(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=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}:${n} ${o}/${i}/${s} (${a}${c})`}catch{return "\u2014"}}function js({positions:e,trades:t,isLoading:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>{let l=0,a=0;for(let p of e)l+=p.realized_pnl??0,a+=p.current_value??p.size*(p.current_price??0);let c=0,u=0,d=0;for(let p of t)c+=p.usd_size??0,p.type==="REDEEM"&&(d++,(p.usd_size??0)>0&&u++);let m=d>0?`${u} / ${d}`:"0 / 0";return {realizedPnl:l,positionsValue:a,volume:c,winRateStr:m}},[e,t]),i=o.realizedPnl>0?"text-success":o.realizedPnl<0?"text-danger":"text-foreground",s=o.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:n("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(o.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Oo,{label:n("predict.profile.winRate"),value:o.winRateStr,isLoading:r}),jsxRuntime.jsx(Oo,{label:n("predict.profile.positions"),value:`$${o.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Oo,{label:n("predict.profile.volume"),value:`$${o.volume.toFixed(2)}`,isLoading:r})]})]})}function Oo({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 Do=600;function zg({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState("positions"),l=!!(e||t),{data:a,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:d}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let b=[];return a?.positions&&b.push(...a.positions),u?.positions&&b.push(...u.positions),b},[a,u]),p=c||d,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:x,isLoading:h}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),k=react.useMemo(()=>[...f?.pages?.flatMap(K=>K.items)??[],...x?.pages?.flatMap(K=>K.items)??[]],[f,x]),S=p||g||h,M=m.length,N=[{key:"positions",label:M>0?`${o("predict.profile.positionsTab")} (${M})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("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(js,{positions:m,trades:k,isLoading:S}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:N.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(b.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===b.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:b.label},b.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Ks,{positions:m,isLoading:p,listHeight:Do,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx($s,{solanaAddress:e,evmAddress:t,listHeight:Do}),i==="history"&&jsxRuntime.jsx(Rs,{solanaAddress:e,evmAddress:t,listHeight:Do})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function H2({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(false),[a,c]=react.useState(null),[u,d]=react.useState(false),m=r||u,p=n||u,f=m?"done":s?"running":"pending",g=p?"done":m&&s?"running":"pending",x=m&&p,h=react.useCallback(async()=>{c(null),d(false),l(true);try{await o(),d(!0);}catch(v){c(v instanceof Error?v.message:String(v));}finally{l(false);}},[o]),k=[{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}],S=()=>{x?t():h();},M=i(x?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.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.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:k.map((v,N)=>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(Vg,{index:N+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"?i("predict.setup.stepComplete"):v.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:v.desc})]})]},v.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:S,disabled:s,className:x?"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")]}):M}),!x&&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 Vg({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})}
147
+ 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=l0;exports.CHART_RANGE_PERIOD=a0;exports.CHART_RANGE_SAMPLE_INTERVAL=s0;exports.CandlestickPeriod=Zr;exports.CategoriesSkeleton=Xg;exports.CategoriesUI=Vo;exports.CategoriesWidget=Go;exports.ChartRange=Ke;exports.DEFAULT_CHART_RANGE=en;exports.DEFAULT_FILTER_STATE=Vn;exports.DEFAULT_PAGE_SIZE=br;exports.DEFAULT_PRICE_HISTORY_INTERVAL=u0;exports.EventDetailPage=tb;exports.EventDetailSkeleton=Lr;exports.EventDetailUI=_a;exports.EventDetailWidget=Ra;exports.EventItem=_i;exports.EventMarketDepthChartUI=ha;exports.EventMarketDetailWidget=ka;exports.EventPriceChart=Na;exports.EventsFilterUI=pi;exports.EventsHero=Zh;exports.EventsPage=qh;exports.EventsPageSkeleton=Sh;exports.EventsSkeleton=Yn;exports.EventsToolbarUI=vi;exports.EventsUI=Ai;exports.EventsWidget=Bi;exports.KycModal=sn;exports.MAX_PRICE_HISTORY_MARKETS=zn;exports.MatchGroupCard=I1;exports.MatchMarketCard=vs;exports.MatchesFilterBar=ps;exports.MatchesHero=us;exports.MatchesPage=M1;exports.MatchesStatsBar=B1;exports.MatchesWidget=ks;exports.ORDER_MAX_PRICE=p0;exports.ORDER_MIN_PRICE=d0;exports.ORDER_MIN_QUANTITY=tn;exports.ORDER_MIN_USDC=rn;exports.ORDER_PRICE_STEP=c0;exports.PREDICT_SEARCH_MODAL_ID=bo;exports.PREDICT_SELL_MODAL_ID=to;exports.PREDICT_TRADE_MODAL_ID=Sr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=m0;exports.PredictSearchModal=Oy;exports.PredictSellModal=na;exports.PredictTradeModal=dn;exports.PredictWalletProvider=kl;exports.PriceHistoryInterval=lr;exports.ProfilePage=zg;exports.SORT_PRESETS=hi;exports.STATIC_CATEGORIES=Hn;exports.SearchEventsButton=Uy;exports.SearchHistoryUI=Wa;exports.SearchHistoryWidget=Ua;exports.SearchInputUI=Ka;exports.SearchResultItemUI=Va;exports.SearchResultListWidget=Qa;exports.SearchWidget=ts;exports.SellFormUI=ta;exports.SellFormWidget=fn;exports.SetupModal=H2;exports.SimilarEventCard=Ku;exports.SimilarEventsSection=Aa;exports.SourceBadge=Rx;exports.SpreadIndicator=W1;exports.TradeFormSkeleton=ca;exports.TradeFormUI=ci;exports.TradeFormWidget=cn;exports.UserActivitySection=aa;exports.countActiveFilters=jn;exports.fireCelebration=jt;exports.floorToDecimals=Ne;exports.formatKMB=_r;exports.formatShares=kr;exports.getSourceMeta=ft;exports.parsePolymarketError=an;exports.resolveExpiration=nn;exports.roundToTickSize=on;exports.useEventDetail=lb;exports.useEventsInfinite=yi;exports.usePredictSearchHistory=Cn;exports.usePredictWallet=yr;exports.useSearchResultListScript=ja;exports.useSearchScript=es;exports.useSellForm=ji;exports.useTradeForm=ti;exports.version=al;//# sourceMappingURL=index.js.map
148
148
  //# sourceMappingURL=index.js.map