@liberfi.io/ui-predict 0.1.123 → 0.1.124
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.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactPredict=require('@liberfi.io/react-predict'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),rn=require('canvas-confetti'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rn__default=/*#__PURE__*/_interopDefault(rn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.123");var Na="0.1.123";var Ca={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},lo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zr=(()=>{let e=t=>{let r=lo.indexOf(t);return r===-1?lo.length:r};return Object.entries(Ca).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 uo({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:d}=i18n.useTranslation(),p=react.useCallback(()=>{o(null);},[o]),u=d("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(co,{label:u,isSelected:t===null,onPress:p,showPulse:u===l}),jsxRuntime.jsx(La,{}),e.map(m=>jsxRuntime.jsx(co,{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(po,{label:d("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(m=>jsxRuntime.jsx(po,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function co({label:e,isSelected:t,onPress:r,badge: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 La(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function po({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 _f({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 _a(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Ra(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]),d=_a(Zr),p=Zr.find(m=>m.slug===n),u=Ra(p);return jsxRuntime.jsx(uo,{categories:d,selectedCategory:n,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function ho(e){return {title:e.title,imageUrl:e.image_url}}function vo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Ut=24,Jr=4,gr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},hr=Ee.ALL,zf={[Ee.ONE_DAY]:gr.ONE_MINUTE,[Ee.ONE_WEEK]:gr.ONE_HOUR,[Ee.ONE_MONTH]:gr.ONE_HOUR,[Ee.ALL]:gr.ONE_DAY},$f={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},Wf={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},vr=1,xr=1,Uf=1,Kf=1,Vf=99,Mt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},jf=Mt.ONE_WEEK,Yf={[Mt.ONE_HOUR]:60,[Mt.SIX_HOURS]:60,[Mt.ONE_DAY]:300,[Mt.ONE_WEEK]:1800,[Mt.MAX]:1800};var yo=react.createContext(null);function tn(){let e=react.useContext(yo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ha=1e4;function za({pollingInterval:e=Ha,enabled:t=true,children:r}){let n=walletConnector.useWallets(),o=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[n]),i=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[n]),{data:s,isLoading:l,isFetching:a,error:d}=reactPredict.useBalance({source:"kalshi",user:o??""},{enabled:t&&!!o,refetchInterval:e}),{data:p,isLoading:u}=reactPredict.useDFlowKYC(o,{enabled:t&&!!o,refetchInterval:3e4}),{data:m,isLoading:c}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:h,isLoading:v,isFetching:S,error:C}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),P=react.useMemo(()=>({solanaAddress:o,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:c,isLoading:l||v,isFetching:a||S,error:d??C??null}),[o,i,f,s,h,g,p,u,m,c,l,v,a,S,d,C]);return jsxRuntime.jsx(yo.Provider,{value:P,children:r})}var ll={minutes:60,hours:3600,days:86400};function cl(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*ll[r]}}function nn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};rn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function Po({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:n}=i18n.useTranslation(),{status:o}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),d=reactQuery.useQueryClient(),p=e.source,u=p==="polymarket",m=i.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),c=i.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),f=o==="authenticated",g=m?.address,h=c?.address,v=react.useMemo(()=>{if(p!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[p,e.provider_meta]),{data:S}=reactPredict.useTickSize(v),C=S?.minimum_tick_size?String(S.minimum_tick_size):"0.01",[P,x]=react.useState(t),[b,T]=react.useState(r),[z,ae]=react.useState("market"),[D,ve]=react.useState(NaN),[I,H]=react.useState(NaN),[$,J]=react.useState(false),[ie,M]=react.useState(null),[_,G]=react.useState(null),[A,pe]=react.useState(false),[le,we]=react.useState(false),[Qe,ut]=react.useState("1h"),[Ke,Dt]=react.useState(30),[At,mt]=react.useState("minutes"),Be=null,lr=false,cr=null,Nt;try{let k=tn();Be={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},lr=k.kalshiKycVerified,cr=k.kalshiKycUrl,Nt=k.polymarketSafeAddress;}catch{}let Ne=react.useMemo(()=>{let k=P==="yes"?0:1,q=e.outcomes[k];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,P,b]),Kr=react.useCallback(k=>{ae(k);},[]),Ft=react.useCallback(k=>{x(k),H(NaN);},[]);react.useEffect(()=>{z==="limit"&&isNaN(I)&&H(Math.round(Ne*100)/100);},[z,I,Ne]);let Vr=react.useMemo(()=>isNaN(D)||D<=0?0:b==="buy"?Ne>0?D/Ne:0:D,[b,D,Ne]),E=react.useMemo(()=>isNaN(D)||D<=0?"0":String(Math.round(D*1e6)),[D]),Ce=e.provider_meta?.["dflow.yesMint"]??"",Xe=e.provider_meta?.["dflow.noMint"]??"",ft=utils.SOLANA_TOKENS.stablecoins.USDC.address,oa=e.provider_meta?.["dflow.collateralMint"]||"",Qn=P==="yes"?Ce:Xe,Xn=p==="kalshi"?g??"":h??"",{data:Ae,isLoading:ia}=reactPredict.usePositions({source:p,user:Xn},{enabled:!!Xn}),Zn=react.useMemo(()=>!Ae||b!=="sell"?null:Ae.positions.find(k=>k.side?.toLowerCase()===P&&k.market?.slug===e.slug)??null,[Ae,e.slug,P,b])?.market?.provider_meta,sa=b==="sell"&&Zn?.["dflow.outcomeMint"]||Qn,Bt=b==="sell"&&Zn?.["dflow.collateralMint"]||oa,Ht=b==="buy"?ft:sa,zt=b==="buy"?Qn:Bt||ft,aa=p==="kalshi"&&!!Ht&&!!zt&&!!g&&E!=="0",{refetch:Jn}=reactPredict.useDFlowQuote({inputMint:Ht,outputMint:zt,amount:E,userPublicKey:g??"",slippageBps:100},{enabled:aa}),dr=react.useMemo(()=>Be?p==="kalshi"?Be.kalshiUsdcBalance:Be.polymarketUsdcBalance:Ae&&Ae.positions.reduce((q,Me)=>Me.side==="USDC"||Me.side==="collateral"?q+(Me.current_value??0):q,0)||null,[Be,Ae,p]),la=Be?Be.isLoading:ia,jr=react.useMemo(()=>Ae?Ae.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[Ae,e.slug]),Yr=react.useMemo(()=>Ae?Ae.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[Ae,e.slug]),Gr=react.useMemo(()=>z==="limit"&&u&&!isNaN(I)?I:Ne,[z,u,I,Ne]),pr=react.useMemo(()=>{if(isNaN(D)||D<=0)return 0;if(b==="buy")return D;let k=P==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return D*k},[b,P,D,e.outcomes]),eo=react.useMemo(()=>isNaN(D)||D<=0?0:b==="buy"?Gr>0?D/Gr*1:0:pr,[b,D,Gr,pr]),ca=eo-pr,da=react.useCallback(k=>{T(k),ve(NaN);},[]),pa=react.useCallback(k=>{if(isNaN(k)){ve(NaN);return}let q=Math.max(0,k),Me=b==="buy"?Math.round(q*100)/100:Math.round(q);ve(Me);},[b]),ua=react.useCallback(k=>{if(isNaN(k)){H(NaN);return}let q=Math.max(.01,Math.min(.99,k));H(Math.round(q*100)/100);},[]),$t=react.useCallback(()=>{ve(NaN),H(NaN),ae("market"),we(false),ut("1h"),Dt(30),mt("minutes");},[]),qr=react.useMemo(()=>{let k=[];isNaN(D)||D<=0?b==="buy"?k.push(n("predict.trade.minAmountUsd",{amount:xr})):k.push(n("predict.trade.minQuantity",{amount:vr})):b==="buy"&&D<xr?k.push(n("predict.trade.minAmountUsd",{amount:xr})):b==="sell"&&D<vr&&k.push(n("predict.trade.minQuantity",{amount:vr})),e.status!=="open"&&k.push(n("predict.trade.marketNotActive")),b==="buy"&&dr!=null&&!isNaN(D)&&D>0&&D>dr&&k.push(n("predict.trade.insufficientBalance"));let q=P==="yes"?jr:Yr;return b==="sell"&&q!=null&&!isNaN(D)&&D>0&&D>q&&k.push(n("predict.trade.insufficientShares")),z==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&k.push(n("predict.trade.limitPriceRange")),z==="limit"&&u&&le&&Qe==="custom"&&(isNaN(Ke)||Ke<=0)&&k.push(n("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[D,e.status,b,p,dr,jr,Yr,P,z,u,I,le,Qe,Ke,n]),{mutateAsync:ur}=reactPredict.useDFlowSubmit(),{data:Qr}=reactPredict.useOrder({id:ie??"",source:p},{enabled:!!ie}),to=react.useCallback(async()=>{if(!_||!g||!m)return;let{cashAmount:k,collateral:q}=_;G(null);try{let gt=(await l.createDFlowQuote({inputMint:q,outputMint:ft,amount:k,userPublicKey:g,slippageBps:100}))?.transaction;if(!gt)return;let it=Uint8Array.from(atob(gt),Wt=>Wt.charCodeAt(0)),Ze=await m.signTransaction(it);await ur({signedTransaction:btoa(String.fromCharCode(...Ze)),orderContext:{user_public_key:g,input_mint:q,output_mint:ft,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,g,m,l,ur,ft]);react.useEffect(()=>{if(!Qr||!ie)return;let{status:k}=Qr;k==="closed"?(M(null),_?to().finally(()=>{J(false),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t();}):(J(false),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t())):(k==="failed"||k==="expired")&&(J(false),M(null),G(null),ui.toast.error(n("predict.trade.submitError")));},[Qr,ie,_,to,$t,n]);let ro=react.useCallback(async()=>{if(!g||!m)return;if(!Ht||!zt){ui.toast.error("Missing token mint addresses"),J(false);return}if(!lr){pe(true),J(false);return}let Me=(await Jn()).data,gt=Me?.transaction;if(!gt){ui.toast.error(n("predict.trade.submitError")),J(false);return}if(b==="sell"&&Bt&&Bt!==ft){let st=String(Me?.outAmount??"");st&&st!=="0"&&G({cashAmount:st,collateral:Bt});}let it=Uint8Array.from(atob(gt),st=>st.charCodeAt(0)),Ze=await m.signTransaction(it),Wt=await ur({signedTransaction:btoa(String.fromCharCode(...Ze)),orderContext:{user_public_key:g,input_mint:Ht,output_mint:zt,amount:E,price:String(Ne),side:b==="buy"?"BUY":"SELL",outcome:P==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});M(Wt.signature);},[g,m,l,Jn,ur,Ht,zt,E,Ne,b,P,e.slug,Bt,ft,n]),no=react.useCallback(async()=>{if(!c||!a)return;let k=c.chain,q=k!==types.Chain.POLYGON;q&&await s(types.Chain.POLYGON);try{let Me=await c.getEip1193Provider();if(!Me){ui.toast.error(n("predict.trade.submitError")),J(!1);return}let gt=!!Nt,it={address:c.address,signatureType:gt?2:0,signTypedData:async(ht,ka,Sa,wa)=>{let Ct=[];"name"in ht&&Ct.push({name:"name",type:"string"}),"version"in ht&&Ct.push({name:"version",type:"string"}),"chainId"in ht&&Ct.push({name:"chainId",type:"uint256"}),"verifyingContract"in ht&&Ct.push({name:"verifyingContract",type:"address"}),"salt"in ht&&Ct.push({name:"salt",type:"bytes32"});let Pa={EIP712Domain:Ct,...ka};return await Me.request({method:"eth_signTypedData_v4",params:[c.address,JSON.stringify({domain:ht,types:Pa,primaryType:Sa,message:wa})]})}},Ze=a.credentials??await a.authenticate(it),Wt=P==="yes"?0:1,st="",mr=e.provider_meta?.["polymarket.clobTokenIds"];mr&&(st=(typeof mr=="string"?JSON.parse(mr):mr)[Wt]??"");let oo=e.provider_meta?.["polymarket.negRisk"]??!1,Xr=z==="limit"&&!isNaN(I)?I:Ne,fa=z==="limit"?le?"GTD":"GTC":"FOK",ga=b==="buy"&&Xr>0?D/Xr:D,io={tokenId:st,price:Xr,size:ga,side:b==="buy"?"BUY":"SELL",orderType:fa,tickSize:C,negRisk:oo,...Nt&&{funderAddress:Nt},...z==="limit"&&le&&{expiration:cl(Qe,Ke,At)}},ha=reactPredict.buildCtfExchangeDomain(oo),so=reactPredict.buildOrderMessage({...io,signerAddress:it.address,signatureType:it.signatureType}),va=await it.signTypedData(ha,reactPredict.CTF_ORDER_TYPES,"Order",so),xa=reactPredict.buildSignedOrder(so,va,io.orderType),ao=reactPredict.buildClobPayload(xa,Ze.apiKey),ba=JSON.stringify(ao),ya=await reactPredict.buildPolymarketL2Headers(Ze.address,{apiKey:Ze.apiKey,secret:Ze.secret,passphrase:Ze.passphrase,method:"POST",requestPath:"/order",body:ba});await l.createPolymarketOrder(ao,ya),d.invalidateQueries({queryKey:["predict","orders"]}),d.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t(),J(!1);}finally{q&&k&&s(k).catch(()=>{});}},[c,a,s,P,e.provider_meta,z,I,Ne,D,b,l,d,le,Qe,Ke,At,$t,n]),ma=react.useCallback(async()=>{if(!(!qr.isValid||!f)){J(true),M(null),pe(false);try{p==="kalshi"?await ro():await no();}catch(k){let q=k instanceof Error?k.message:void 0;ui.toast.error(q||n("predict.trade.submitError")),J(false);}}},[qr.isValid,f,p,ro,no,n]);return {outcome:P,side:b,orderType:z,quantity:D,limitPrice:I,shares:Vr,estimatedCost:pr,potentialPayout:eo,potentialProfit:ca,usdcBalance:dr,yesTokenBalance:jr,noTokenBalance:Yr,isBalanceLoading:la,isSubmitting:$,validation:qr,supportsLimitOrder:u,kycRequired:A,kycUrl:cr,expirationEnabled:le,expirationPreset:Qe,customDuration:Ke,customDurationUnit:At,setOutcome:Ft,setSide:da,setOrderType:Kr,setQuantity:pa,setLimitPrice:ua,setExpirationEnabled:we,setExpirationPreset:ut,setCustomDuration:Dt,setCustomDurationUnit:mt,submit:ma}}function No({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 Pl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,Nl=["5m","1h","12h","24h","eod","custom"],Cl={"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"},Ml=["minutes","hours","days"],El={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Ro({event:e,market:t,variant:r="bordered",outcome:n,side:o,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:d,potentialPayout:p,estimatedCost:u,usdcBalance:m,yesTokenBalance:c,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:v,validationErrors:S,supportsLimitOrder:C,kycRequired:P,kycUrl:x,expirationEnabled:b,expirationPreset:T,customDuration:z,customDurationUnit:ae,onOutcomeChange:D,onSideChange:ve,onOrderTypeChange:I,onQuantityChange:H,onLimitPriceChange:$,onExpirationEnabledChange:J,onExpirationPresetChange:ie,onCustomDurationChange:M,onCustomDurationUnitChange:_,onSubmit:G}){let{t:A}=i18n.useTranslation(),[pe,le]=react.useState(false),we=ui.useDisclosure(),[Qe,ut]=react.useState(""),Ke=react.useRef(false),Dt=react.useRef(o);react.useEffect(()=>{Ke.current||ut(isNaN(s)?"":String(s));},[s]),react.useEffect(()=>{o!==Dt.current&&(Dt.current=o,ut(""));},[o]);let At=react.useCallback(E=>{if(E!==""&&!(o==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(E))return;if(ut(E),Ft(false),E===""||E==="."){H(NaN);return}let Xe=parseFloat(E);isNaN(Xe)||H(Xe);},[o,H]);react.useEffect(()=>{P&&!we.isOpen&&we.onOpen();},[P]);let mt=react.useMemo(()=>{let E=o==="buy"?n==="yes"?t.yesAsk:t.noAsk:n==="yes"?t.yesBid:t.noBid;return E!=null?parseFloat((Number(E)*100).toFixed(2)):null},[o,n,t]),Be=!isNaN(s)&&s>0,lr=react.useMemo(()=>{if(g)return A("predict.trade.loadingBalance");if(h)return A("predict.trade.submitting");if(P)return A("predict.trade.kycRequired");if(!Be)return A("predict.trade.enterAmount");let E=A(o==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=A(n==="yes"?"predict.trade.yes":"predict.trade.no"),Xe=o==="buy"&&d>0?` \u2192 Win $${d.toFixed(2)}`:"";return `${E} ${Ce}${Xe}`},[g,h,P,Be,o,n,d,A]),cr=react.useMemo(()=>n==="yes"?"primary":"secondary",[n]),Nt=()=>{H(Math.floor((m??0)/2*100)/100);},Ne=()=>{H(m??0);},[Kr,Ft]=react.useState(false),Vr=()=>{if(P){we.onOpen();return}if(!v){Ft(true);return}Ft(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter: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:n==="yes"?"text-bullish":"text-bearish",children:[A(o==="buy"?"predict.trade.buy":"predict.trade.sell")," ",A(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:[C?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:E=>I(E),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:A("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:A("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:A("predict.trade.market")}),i==="limit"&&C?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:E=>$(E/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):mt!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[mt," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(E=>{let Ce=E==="yes"?c:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(E),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===E?E==="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:A(E==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Xe=o==="buy"?E==="yes"?t.yesAsk:t.noAsk:E==="yes"?t.yesBid:t.noBid;return Xe!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Xe)*100).toFixed(2)),"\xA2"]}):null})()]}),o==="sell"&&n===E&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${Ce??0} shares`})]},E)})}),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:A(o==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),o==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:Pl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:Nt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:A("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Ne,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:A("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:o==="buy"?"decimal":"numeric",value:Qe,onChange:E=>At(E.target.value),onFocus:()=>{Ke.current=true;},onBlur:()=>{Ke.current=false,ut(isNaN(s)?"":String(s));},startContent:o==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),o==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(E=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(Math.floor((n==="yes"?c??0:f??0)*E/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[E,"%"]},E)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{H(n==="yes"?c??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:A("common.all")})]}),Kr&&S.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:S.map(E=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:E},E))})]}),i==="limit"&&C&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:A("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:J,"aria-label":A("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":A("predict.trade.setExpiration"),selectedKeys:[T],onSelectionChange:E=>{let Ce=Array.from(E)[0];Ce&&ie(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Nl.map(E=>jsxRuntime.jsx(ui.SelectItem,{children:A(Cl[E])},E))}),T==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:M,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[ae],onSelectionChange:E=>{let Ce=Array.from(E)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ml.map(E=>jsxRuntime.jsx(ui.SelectItem,{children:A(El[E])},E))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>le(E=>!E),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:A("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",pe&&"rotate-180")})]}),mt!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[mt,"% chance"]})]}),pe&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(s)&&s>0&&d>0?`+$${d.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:cr,fullWidth:true,radius:"lg",size:"lg",isDisabled:g||!Be||h,isLoading:h||g,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:Vr,children:lr})]}),jsxRuntime.jsx(No,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:x})]})}function br({event:e,market:t,variant:r,initialSide:n,initialOutcome:o,chain:i}){let{outcome:s,side:l,orderType:a,quantity:d,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:c,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:S,isSubmitting:C,validation:P,supportsLimitOrder:x,kycRequired:b,kycUrl:T,expirationEnabled:z,expirationPreset:ae,customDuration:D,customDurationUnit:ve,setOutcome:I,setSide:H,setOrderType:$,setQuantity:J,setLimitPrice:ie,setExpirationEnabled:M,setExpirationPreset:_,setCustomDuration:G,setCustomDurationUnit:A,submit:pe}=Po({market:t,initialSide:n,initialOutcome:o}),le=walletConnector.useAuthCallback(pe),we=react.useMemo(()=>e?ho(e):void 0,[e]),Qe=react.useMemo(()=>vo(t),[t]);return jsxRuntime.jsx(Ro,{event:we,market:Qe,variant:r,outcome:s,side:l,orderType:a,quantity:d,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:c,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:S,isSubmitting:C,isValid:P.isValid,validationErrors:P.errors,supportsLimitOrder:x,kycRequired:b,kycUrl:T,expirationEnabled:z,expirationPreset:ae,customDuration:D,customDurationUnit:ve,onOutcomeChange:I,onSideChange:H,onOrderTypeChange:$,onQuantityChange:J,onLimitPriceChange:ie,onExpirationEnabledChange:M,onExpirationPresetChange:_,onCustomDurationChange:G,onCustomDurationUnitChange:A,onSubmit:le})}var Kt="predict-trade";function yr({id:e=Kt}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Al,{...t})})}function Al({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(br,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function cn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Oo({isOpen:e,onClose:t,value:r,onChange:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(h=>{h?s(r):t();},[r,t]),a=react.useCallback(()=>{s(ln);},[]),d=react.useCallback(()=>{n(i),t();},[i,n,t]),p=react.useCallback((h,v)=>{s(S=>({...S,[h]:v}));},[]),u=react.useMemo(()=>cn(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]),c=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(Wl,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(Sr,{label:o("predict.filter.platform"),children:jsxRuntime.jsx(wr,{options:m,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.timeRemaining"),children:jsxRuntime.jsx(wr,{options:c,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.minVolume"),children:jsxRuntime.jsx(wr,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.minLiquidity"),children:jsxRuntime.jsx(wr,{options:g,selected:i.minLiquidity,onSelect:h=>p("minLiquidity",h)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:a,children: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:d,children:[o("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function Sr({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 Wl({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 wr({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")})})}function Do(e){return e>=1e9?`$${(e/1e9).toFixed(1)}B`:e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}var Kl=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:Do,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:Do,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>e.toLocaleString(),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function Ao({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var react=require('react'),reactPredict=require('@liberfi.io/react-predict'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),rn=require('canvas-confetti'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rn__default=/*#__PURE__*/_interopDefault(rn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.124");var Na="0.1.124";var Ca={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},lo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zr=(()=>{let e=t=>{let r=lo.indexOf(t);return r===-1?lo.length:r};return Object.entries(Ca).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 uo({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:d}=i18n.useTranslation(),p=react.useCallback(()=>{o(null);},[o]),u=d("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(co,{label:u,isSelected:t===null,onPress:p,showPulse:u===l}),jsxRuntime.jsx(La,{}),e.map(m=>jsxRuntime.jsx(co,{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(po,{label:d("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(m=>jsxRuntime.jsx(po,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function co({label:e,isSelected:t,onPress:r,badge: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 La(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function po({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 _f({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 _a(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Ra(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]),d=_a(Zr),p=Zr.find(m=>m.slug===n),u=Ra(p);return jsxRuntime.jsx(uo,{categories:d,selectedCategory:n,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function ho(e){return {title:e.title,imageUrl:e.image_url}}function vo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Ut=24,Jr=4,gr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},hr=Ee.ALL,zf={[Ee.ONE_DAY]:gr.ONE_MINUTE,[Ee.ONE_WEEK]:gr.ONE_HOUR,[Ee.ONE_MONTH]:gr.ONE_HOUR,[Ee.ALL]:gr.ONE_DAY},$f={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},Wf={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},vr=1,xr=1,Uf=1,Kf=1,Vf=99,Mt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},jf=Mt.ONE_WEEK,Yf={[Mt.ONE_HOUR]:60,[Mt.SIX_HOURS]:60,[Mt.ONE_DAY]:300,[Mt.ONE_WEEK]:1800,[Mt.MAX]:1800};var yo=react.createContext(null);function tn(){let e=react.useContext(yo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ha=1e4;function za({pollingInterval:e=Ha,enabled:t=true,children:r}){let n=walletConnector.useWallets(),o=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[n]),i=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[n]),{data:s,isLoading:l,isFetching:a,error:d}=reactPredict.useBalance({source:"kalshi",user:o??""},{enabled:t&&!!o,refetchInterval:e}),{data:p,isLoading:u}=reactPredict.useDFlowKYC(o,{enabled:t&&!!o,refetchInterval:3e4}),{data:m,isLoading:c}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:h,isLoading:v,isFetching:w,error:C}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),S=react.useMemo(()=>({solanaAddress:o,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:c,isLoading:l||v,isFetching:a||w,error:d??C??null}),[o,i,f,s,h,g,p,u,m,c,l,v,a,w,d,C]);return jsxRuntime.jsx(yo.Provider,{value:S,children:r})}var ll={minutes:60,hours:3600,days:86400};function cl(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*ll[r]}}function nn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};rn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function Po({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:n}=i18n.useTranslation(),{status:o}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),d=reactQuery.useQueryClient(),p=e.source,u=p==="polymarket",m=i.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),c=i.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),f=o==="authenticated",g=m?.address,h=c?.address,v=react.useMemo(()=>{if(p!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[p,e.provider_meta]),{data:w}=reactPredict.useTickSize(v),C=w?.minimum_tick_size?String(w.minimum_tick_size):"0.01",[S,x]=react.useState(t),[b,T]=react.useState(r),[z,ae]=react.useState("market"),[D,ve]=react.useState(NaN),[I,H]=react.useState(NaN),[$,J]=react.useState(false),[ie,M]=react.useState(null),[_,G]=react.useState(null),[A,pe]=react.useState(false),[le,we]=react.useState(false),[Qe,ut]=react.useState("1h"),[Ke,Dt]=react.useState(30),[At,mt]=react.useState("minutes"),Be=null,lr=false,cr=null,Nt;try{let k=tn();Be={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},lr=k.kalshiKycVerified,cr=k.kalshiKycUrl,Nt=k.polymarketSafeAddress;}catch{}let Ne=react.useMemo(()=>{let k=S==="yes"?0:1,q=e.outcomes[k];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,S,b]),Kr=react.useCallback(k=>{ae(k);},[]),Ft=react.useCallback(k=>{x(k),H(NaN);},[]);react.useEffect(()=>{z==="limit"&&isNaN(I)&&H(Math.round(Ne*100)/100);},[z,I,Ne]);let Vr=react.useMemo(()=>isNaN(D)||D<=0?0:b==="buy"?Ne>0?D/Ne:0:D,[b,D,Ne]),E=react.useMemo(()=>isNaN(D)||D<=0?"0":String(Math.round(D*1e6)),[D]),Ce=e.provider_meta?.["dflow.yesMint"]??"",Xe=e.provider_meta?.["dflow.noMint"]??"",ft=utils.SOLANA_TOKENS.stablecoins.USDC.address,oa=e.provider_meta?.["dflow.collateralMint"]||"",Qn=S==="yes"?Ce:Xe,Xn=p==="kalshi"?g??"":h??"",{data:Ae,isLoading:ia}=reactPredict.usePositions({source:p,user:Xn},{enabled:!!Xn}),Zn=react.useMemo(()=>!Ae||b!=="sell"?null:Ae.positions.find(k=>k.side?.toLowerCase()===S&&k.market?.slug===e.slug)??null,[Ae,e.slug,S,b])?.market?.provider_meta,sa=b==="sell"&&Zn?.["dflow.outcomeMint"]||Qn,Bt=b==="sell"&&Zn?.["dflow.collateralMint"]||oa,Ht=b==="buy"?ft:sa,zt=b==="buy"?Qn:Bt||ft,aa=p==="kalshi"&&!!Ht&&!!zt&&!!g&&E!=="0",{refetch:Jn}=reactPredict.useDFlowQuote({inputMint:Ht,outputMint:zt,amount:E,userPublicKey:g??"",slippageBps:100},{enabled:aa}),dr=react.useMemo(()=>Be?p==="kalshi"?Be.kalshiUsdcBalance:Be.polymarketUsdcBalance:Ae&&Ae.positions.reduce((q,Me)=>Me.side==="USDC"||Me.side==="collateral"?q+(Me.current_value??0):q,0)||null,[Be,Ae,p]),la=Be?Be.isLoading:ia,jr=react.useMemo(()=>Ae?Ae.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[Ae,e.slug]),Yr=react.useMemo(()=>Ae?Ae.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[Ae,e.slug]),Gr=react.useMemo(()=>z==="limit"&&u&&!isNaN(I)?I:Ne,[z,u,I,Ne]),pr=react.useMemo(()=>{if(isNaN(D)||D<=0)return 0;if(b==="buy")return D;let k=S==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return D*k},[b,S,D,e.outcomes]),eo=react.useMemo(()=>isNaN(D)||D<=0?0:b==="buy"?Gr>0?D/Gr*1:0:pr,[b,D,Gr,pr]),ca=eo-pr,da=react.useCallback(k=>{T(k),ve(NaN);},[]),pa=react.useCallback(k=>{if(isNaN(k)){ve(NaN);return}let q=Math.max(0,k),Me=b==="buy"?Math.round(q*100)/100:Math.round(q);ve(Me);},[b]),ua=react.useCallback(k=>{if(isNaN(k)){H(NaN);return}let q=Math.max(.01,Math.min(.99,k));H(Math.round(q*100)/100);},[]),$t=react.useCallback(()=>{ve(NaN),H(NaN),ae("market"),we(false),ut("1h"),Dt(30),mt("minutes");},[]),qr=react.useMemo(()=>{let k=[];isNaN(D)||D<=0?b==="buy"?k.push(n("predict.trade.minAmountUsd",{amount:xr})):k.push(n("predict.trade.minQuantity",{amount:vr})):b==="buy"&&D<xr?k.push(n("predict.trade.minAmountUsd",{amount:xr})):b==="sell"&&D<vr&&k.push(n("predict.trade.minQuantity",{amount:vr})),e.status!=="open"&&k.push(n("predict.trade.marketNotActive")),b==="buy"&&dr!=null&&!isNaN(D)&&D>0&&D>dr&&k.push(n("predict.trade.insufficientBalance"));let q=S==="yes"?jr:Yr;return b==="sell"&&q!=null&&!isNaN(D)&&D>0&&D>q&&k.push(n("predict.trade.insufficientShares")),z==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&k.push(n("predict.trade.limitPriceRange")),z==="limit"&&u&&le&&Qe==="custom"&&(isNaN(Ke)||Ke<=0)&&k.push(n("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[D,e.status,b,p,dr,jr,Yr,S,z,u,I,le,Qe,Ke,n]),{mutateAsync:ur}=reactPredict.useDFlowSubmit(),{data:Qr}=reactPredict.useOrder({id:ie??"",source:p},{enabled:!!ie}),to=react.useCallback(async()=>{if(!_||!g||!m)return;let{cashAmount:k,collateral:q}=_;G(null);try{let gt=(await l.createDFlowQuote({inputMint:q,outputMint:ft,amount:k,userPublicKey:g,slippageBps:100}))?.transaction;if(!gt)return;let it=Uint8Array.from(atob(gt),Wt=>Wt.charCodeAt(0)),Ze=await m.signTransaction(it);await ur({signedTransaction:btoa(String.fromCharCode(...Ze)),orderContext:{user_public_key:g,input_mint:q,output_mint:ft,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,g,m,l,ur,ft]);react.useEffect(()=>{if(!Qr||!ie)return;let{status:k}=Qr;k==="closed"?(M(null),_?to().finally(()=>{J(false),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t();}):(J(false),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t())):(k==="failed"||k==="expired")&&(J(false),M(null),G(null),ui.toast.error(n("predict.trade.submitError")));},[Qr,ie,_,to,$t,n]);let ro=react.useCallback(async()=>{if(!g||!m)return;if(!Ht||!zt){ui.toast.error("Missing token mint addresses"),J(false);return}if(!lr){pe(true),J(false);return}let Me=(await Jn()).data,gt=Me?.transaction;if(!gt){ui.toast.error(n("predict.trade.submitError")),J(false);return}if(b==="sell"&&Bt&&Bt!==ft){let st=String(Me?.outAmount??"");st&&st!=="0"&&G({cashAmount:st,collateral:Bt});}let it=Uint8Array.from(atob(gt),st=>st.charCodeAt(0)),Ze=await m.signTransaction(it),Wt=await ur({signedTransaction:btoa(String.fromCharCode(...Ze)),orderContext:{user_public_key:g,input_mint:Ht,output_mint:zt,amount:E,price:String(Ne),side:b==="buy"?"BUY":"SELL",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});M(Wt.signature);},[g,m,l,Jn,ur,Ht,zt,E,Ne,b,S,e.slug,Bt,ft,n]),no=react.useCallback(async()=>{if(!c||!a)return;let k=c.chain,q=k!==types.Chain.POLYGON;q&&await s(types.Chain.POLYGON);try{let Me=await c.getEip1193Provider();if(!Me){ui.toast.error(n("predict.trade.submitError")),J(!1);return}let gt=!!Nt,it={address:c.address,signatureType:gt?2:0,signTypedData:async(ht,ka,Sa,wa)=>{let Ct=[];"name"in ht&&Ct.push({name:"name",type:"string"}),"version"in ht&&Ct.push({name:"version",type:"string"}),"chainId"in ht&&Ct.push({name:"chainId",type:"uint256"}),"verifyingContract"in ht&&Ct.push({name:"verifyingContract",type:"address"}),"salt"in ht&&Ct.push({name:"salt",type:"bytes32"});let Pa={EIP712Domain:Ct,...ka};return await Me.request({method:"eth_signTypedData_v4",params:[c.address,JSON.stringify({domain:ht,types:Pa,primaryType:Sa,message:wa})]})}},Ze=a.credentials??await a.authenticate(it),Wt=S==="yes"?0:1,st="",mr=e.provider_meta?.["polymarket.clobTokenIds"];mr&&(st=(typeof mr=="string"?JSON.parse(mr):mr)[Wt]??"");let oo=e.provider_meta?.["polymarket.negRisk"]??!1,Xr=z==="limit"&&!isNaN(I)?I:Ne,fa=z==="limit"?le?"GTD":"GTC":"FOK",ga=b==="buy"&&Xr>0?D/Xr:D,io={tokenId:st,price:Xr,size:ga,side:b==="buy"?"BUY":"SELL",orderType:fa,tickSize:C,negRisk:oo,...Nt&&{funderAddress:Nt},...z==="limit"&&le&&{expiration:cl(Qe,Ke,At)}},ha=reactPredict.buildCtfExchangeDomain(oo),so=reactPredict.buildOrderMessage({...io,signerAddress:it.address,signatureType:it.signatureType}),va=await it.signTypedData(ha,reactPredict.CTF_ORDER_TYPES,"Order",so),xa=reactPredict.buildSignedOrder(so,va,io.orderType),ao=reactPredict.buildClobPayload(xa,Ze.apiKey),ba=JSON.stringify(ao),ya=await reactPredict.buildPolymarketL2Headers(Ze.address,{apiKey:Ze.apiKey,secret:Ze.secret,passphrase:Ze.passphrase,method:"POST",requestPath:"/order",body:ba});await l.createPolymarketOrder(ao,ya),d.invalidateQueries({queryKey:["predict","orders"]}),d.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(n("predict.trade.submitSuccess")),nn(),$t(),J(!1);}finally{q&&k&&s(k).catch(()=>{});}},[c,a,s,S,e.provider_meta,z,I,Ne,D,b,l,d,le,Qe,Ke,At,$t,n]),ma=react.useCallback(async()=>{if(!(!qr.isValid||!f)){J(true),M(null),pe(false);try{p==="kalshi"?await ro():await no();}catch(k){let q=k instanceof Error?k.message:void 0;ui.toast.error(q||n("predict.trade.submitError")),J(false);}}},[qr.isValid,f,p,ro,no,n]);return {outcome:S,side:b,orderType:z,quantity:D,limitPrice:I,shares:Vr,estimatedCost:pr,potentialPayout:eo,potentialProfit:ca,usdcBalance:dr,yesTokenBalance:jr,noTokenBalance:Yr,isBalanceLoading:la,isSubmitting:$,validation:qr,supportsLimitOrder:u,kycRequired:A,kycUrl:cr,expirationEnabled:le,expirationPreset:Qe,customDuration:Ke,customDurationUnit:At,setOutcome:Ft,setSide:da,setOrderType:Kr,setQuantity:pa,setLimitPrice:ua,setExpirationEnabled:we,setExpirationPreset:ut,setCustomDuration:Dt,setCustomDurationUnit:mt,submit:ma}}function No({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 Pl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,Nl=["5m","1h","12h","24h","eod","custom"],Cl={"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"},Ml=["minutes","hours","days"],El={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Ro({event:e,market:t,variant:r="bordered",outcome:n,side:o,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:d,potentialPayout:p,estimatedCost:u,usdcBalance:m,yesTokenBalance:c,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:v,validationErrors:w,supportsLimitOrder:C,kycRequired:S,kycUrl:x,expirationEnabled:b,expirationPreset:T,customDuration:z,customDurationUnit:ae,onOutcomeChange:D,onSideChange:ve,onOrderTypeChange:I,onQuantityChange:H,onLimitPriceChange:$,onExpirationEnabledChange:J,onExpirationPresetChange:ie,onCustomDurationChange:M,onCustomDurationUnitChange:_,onSubmit:G}){let{t:A}=i18n.useTranslation(),[pe,le]=react.useState(false),we=ui.useDisclosure(),[Qe,ut]=react.useState(""),Ke=react.useRef(false),Dt=react.useRef(o);react.useEffect(()=>{Ke.current||ut(isNaN(s)?"":String(s));},[s]),react.useEffect(()=>{o!==Dt.current&&(Dt.current=o,ut(""));},[o]);let At=react.useCallback(E=>{if(E!==""&&!(o==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(E))return;if(ut(E),Ft(false),E===""||E==="."){H(NaN);return}let Xe=parseFloat(E);isNaN(Xe)||H(Xe);},[o,H]);react.useEffect(()=>{S&&!we.isOpen&&we.onOpen();},[S]);let mt=react.useMemo(()=>{let E=o==="buy"?n==="yes"?t.yesAsk:t.noAsk:n==="yes"?t.yesBid:t.noBid;return E!=null?parseFloat((Number(E)*100).toFixed(2)):null},[o,n,t]),Be=!isNaN(s)&&s>0,lr=react.useMemo(()=>{if(g)return A("predict.trade.loadingBalance");if(h)return A("predict.trade.submitting");if(S)return A("predict.trade.kycRequired");if(!Be)return A("predict.trade.enterAmount");let E=A(o==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=A(n==="yes"?"predict.trade.yes":"predict.trade.no"),Xe=o==="buy"&&d>0?` \u2192 Win $${d.toFixed(2)}`:"";return `${E} ${Ce}${Xe}`},[g,h,S,Be,o,n,d,A]),cr=react.useMemo(()=>n==="yes"?"primary":"secondary",[n]),Nt=()=>{H(Math.floor((m??0)/2*100)/100);},Ne=()=>{H(m??0);},[Kr,Ft]=react.useState(false),Vr=()=>{if(S){we.onOpen();return}if(!v){Ft(true);return}Ft(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter: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:n==="yes"?"text-bullish":"text-bearish",children:[A(o==="buy"?"predict.trade.buy":"predict.trade.sell")," ",A(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:[C?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:E=>I(E),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:A("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:A("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:A("predict.trade.market")}),i==="limit"&&C?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:E=>$(E/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):mt!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[mt," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(E=>{let Ce=E==="yes"?c:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(E),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===E?E==="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:A(E==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Xe=o==="buy"?E==="yes"?t.yesAsk:t.noAsk:E==="yes"?t.yesBid:t.noBid;return Xe!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Xe)*100).toFixed(2)),"\xA2"]}):null})()]}),o==="sell"&&n===E&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${Ce??0} shares`})]},E)})}),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:A(o==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),o==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:Pl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:Nt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:A("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Ne,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:A("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:o==="buy"?"decimal":"numeric",value:Qe,onChange:E=>At(E.target.value),onFocus:()=>{Ke.current=true;},onBlur:()=>{Ke.current=false,ut(isNaN(s)?"":String(s));},startContent:o==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),o==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(E=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(Math.floor((n==="yes"?c??0:f??0)*E/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[E,"%"]},E)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{H(n==="yes"?c??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:A("common.all")})]}),Kr&&w.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:w.map(E=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:E},E))})]}),i==="limit"&&C&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:A("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:J,"aria-label":A("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":A("predict.trade.setExpiration"),selectedKeys:[T],onSelectionChange:E=>{let Ce=Array.from(E)[0];Ce&&ie(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Nl.map(E=>jsxRuntime.jsx(ui.SelectItem,{children:A(Cl[E])},E))}),T==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:M,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[ae],onSelectionChange:E=>{let Ce=Array.from(E)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ml.map(E=>jsxRuntime.jsx(ui.SelectItem,{children:A(El[E])},E))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>le(E=>!E),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:A("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",pe&&"rotate-180")})]}),mt!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[mt,"% chance"]})]}),pe&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(s)&&s>0&&d>0?`+$${d.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:cr,fullWidth:true,radius:"lg",size:"lg",isDisabled:g||!Be||h,isLoading:h||g,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:Vr,children:lr})]}),jsxRuntime.jsx(No,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:x})]})}function br({event:e,market:t,variant:r,initialSide:n,initialOutcome:o,chain:i}){let{outcome:s,side:l,orderType:a,quantity:d,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:c,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:w,isSubmitting:C,validation:S,supportsLimitOrder:x,kycRequired:b,kycUrl:T,expirationEnabled:z,expirationPreset:ae,customDuration:D,customDurationUnit:ve,setOutcome:I,setSide:H,setOrderType:$,setQuantity:J,setLimitPrice:ie,setExpirationEnabled:M,setExpirationPreset:_,setCustomDuration:G,setCustomDurationUnit:A,submit:pe}=Po({market:t,initialSide:n,initialOutcome:o}),le=walletConnector.useAuthCallback(pe),we=react.useMemo(()=>e?ho(e):void 0,[e]),Qe=react.useMemo(()=>vo(t),[t]);return jsxRuntime.jsx(Ro,{event:we,market:Qe,variant:r,outcome:s,side:l,orderType:a,quantity:d,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:c,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:w,isSubmitting:C,isValid:S.isValid,validationErrors:S.errors,supportsLimitOrder:x,kycRequired:b,kycUrl:T,expirationEnabled:z,expirationPreset:ae,customDuration:D,customDurationUnit:ve,onOutcomeChange:I,onSideChange:H,onOrderTypeChange:$,onQuantityChange:J,onLimitPriceChange:ie,onExpirationEnabledChange:M,onExpirationPresetChange:_,onCustomDurationChange:G,onCustomDurationUnitChange:A,onSubmit:le})}var Kt="predict-trade";function yr({id:e=Kt}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Al,{...t})})}function Al({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(br,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function cn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Oo({isOpen:e,onClose:t,value:r,onChange:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(h=>{h?s(r):t();},[r,t]),a=react.useCallback(()=>{s(ln);},[]),d=react.useCallback(()=>{n(i),t();},[i,n,t]),p=react.useCallback((h,v)=>{s(w=>({...w,[h]:v}));},[]),u=react.useMemo(()=>cn(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]),c=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(Wl,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(Sr,{label:o("predict.filter.platform"),children:jsxRuntime.jsx(wr,{options:m,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.timeRemaining"),children:jsxRuntime.jsx(wr,{options:c,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.minVolume"),children:jsxRuntime.jsx(wr,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(Sr,{label:o("predict.filter.minLiquidity"),children:jsxRuntime.jsx(wr,{options:g,selected:i.minLiquidity,onSelect:h=>p("minLiquidity",h)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:a,children: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:d,children:[o("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function Sr({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 Wl({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 wr({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")})})}function Do(e){return e>=1e9?`$${(e/1e9).toFixed(1)}B`:e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}var Kl=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:Do,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:Do,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>e.toLocaleString(),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function Ao({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
2
2
|
@keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
|
|
3
3
|
@keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
|
|
4
4
|
@keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
.evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
|
|
37
37
|
@media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
|
|
38
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,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:Kl.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))})]})]})}var $o={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Bo={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ec=["start_time","volume","liquidity","ending_soon"],Ho={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"},tc={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 Wo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:s}){let{t:l}=i18n.useTranslation(),[a,d]=react.useState(false),p=react.useRef(null),u=react.useCallback(c=>{p.current&&!p.current.contains(c.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)),[u]),react.useEffect(()=>{if(!a)return;let c=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[a]);let m=zo[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:p,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ho,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>d(c=>!c),children:[jsxRuntime.jsx(rc,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(Bo[e])}),jsxRuntime.jsx(oc,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...tc,width:224,padding:4},children:ec.map(c=>{let f=zo[c],g=e===c;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:h=>{g||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{g||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===c?n(!r):t(c),d(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:l(Bo[c])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},c)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)",c.currentTarget.style.color="#fff";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)",c.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ho,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(nc,{}),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 zo={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function rc(){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 nc(){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 oc({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 Vo(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining]),{data:r,isLoading:n,isFetching:o,isFetchingNextPage:i,isError:s,error:l,hasNextPage:a,fetchNextPage:d,refetch:p}=reactPredict.useInfiniteEvents(t),u=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{d();},[d]),c=react.useCallback(()=>{p();},[p]);return {data:u,isLoading:n,isFetching:o&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:m,refetch:c}}var jo=`
|
|
39
|
+
`).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:Kl.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))})]})]})}var $o={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Bo={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ec=["start_time","volume","liquidity","ending_soon"],Ho={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"},tc={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 Wo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:s}){let{t:l}=i18n.useTranslation(),[a,d]=react.useState(false),p=react.useRef(null),u=react.useCallback(c=>{p.current&&!p.current.contains(c.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)),[u]),react.useEffect(()=>{if(!a)return;let c=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[a]);let m=zo[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:p,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ho,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>d(c=>!c),children:[jsxRuntime.jsx(rc,{}),jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(Bo[e])}),jsxRuntime.jsx(oc,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...tc,width:224,padding:4},children:ec.map(c=>{let f=zo[c],g=e===c;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:h=>{g||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{g||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===c?n(!r):t(c),d(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:l(Bo[c])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},c)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)",c.currentTarget.style.color="#fff";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)",c.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:Ho,onMouseEnter:c=>{c.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:c=>{c.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(nc,{}),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 zo={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function rc(){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 nc(){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 oc({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 Vo(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:d,refetch:p}=reactPredict.useInfiniteEvents(t),u=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),m=react.useCallback(()=>{d();},[d]),c=react.useCallback(()=>{p();},[p]);return {data:u,isLoading:n,isFetching:o&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:m,refetch:c}}var jo=`
|
|
40
40
|
@keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
|
41
41
|
@media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
|
|
42
42
|
@media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
|
|
@@ -76,21 +76,21 @@
|
|
|
76
76
|
outline: 2px solid hsl(var(--heroui-primary) / 0.4);
|
|
77
77
|
outline-offset: 2px;
|
|
78
78
|
}
|
|
79
|
-
`;function ri({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],p=react.useMemo(()=>a.length>2?[...a].sort((x,b)=>(b.outcomes?.[0]?.price??0)-(x.outcomes?.[0]?.price??0)):a,[a]).filter(x=>x.status==="open"),u=p.length===1,m=p.slice(0,Go),c=p.length-Go,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?p.find(x=>x.slug===s)??null:null,h=!!g||u,v=()=>{h||n?.(e);},S=x=>{x.stopPropagation(),g&&(x.preventDefault(),l(null));},C=x=>{x.stopPropagation(),t||(x.preventDefault(),n?.(e));},P=u?jsxRuntime.jsx(Ac,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(Bc,{onCollapse:()=>l(null)}):jsxRuntime.jsx(Rc,{moreCount:c,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:C});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:h?void 0:"pointer"},onMouseEnter:x=>{let b=x.currentTarget,T=xc[e.source]??bc;b.style.borderColor=T.border,b.style.boxShadow=T.shadow,i?.(e);},onMouseLeave:x=>{let b=x.currentTarget;b.style.borderColor="rgba(39,39,42,0.6)",b.style.boxShadow="none";},onClick:v,children:[jsxRuntime.jsx("style",{children:Pc}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(Nc,{event:e,href:t,LinkComponent:r,onClick:S,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:u?jsxRuntime.jsx(Dc,{market:p[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(Fc,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:o}):jsxRuntime.jsx(_c,{displayedMarkets:m,onMarketClick:x=>l(x.slug)})})]}),jsxRuntime.jsx(Ic,{children:P})]})}function Nc({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?wc(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(Mc,{event:e})]})}function Cc(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 Mc({event:e}){let t=react.useMemo(()=>Cc(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(Ec,{},n);case "crypto-short":return jsxRuntime.jsx(Tc,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(Lc,{},n)}})})}function Ec(){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 Tc({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 Lc(){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 _c({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=ei(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:ti(n)}),jsxRuntime.jsx(Oc,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Rc({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(oi,{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(ii,{source:r})]})]})}function Ic({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 Zo({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 ni({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[s,l]=n?kc(e):[un,Jo],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",d=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",p=o==="label"&&a===d?"action":o,u=p==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Qo(e)}\xA2`:i("predict.market.action.yes",{price:Qo(e)}),m=p==="label"?`${e.outcomes?.[1]?.label??"No"} ${Xo(e)}\xA2`:i("predict.market.action.no",{price:Xo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Zo,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"yes");},children:u}),jsxRuntime.jsx(Zo,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"no");},children:m})]})}function Oc(){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 Dc({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(ni,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function Ac({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(oi,{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(ii,{source:e.source})]})]})}function Fc({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=ei(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:ti(o)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(ni,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function Bc({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(Hc,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function oi({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 Hc({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 ii({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 Uc=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:d}=i18n.useTranslation(),p=react.useRef(null);react.useEffect(()=>{let c=p.current;if(!c)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return f.observe(c),()=>f.disconnect()},[t,r,n]);let u=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),m=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
|
|
79
|
+
`;function ri({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],p=react.useMemo(()=>a.length>2?[...a].sort((x,b)=>(b.outcomes?.[0]?.price??0)-(x.outcomes?.[0]?.price??0)):a,[a]).filter(x=>x.status==="open"),u=p.length===1,m=p.slice(0,Go),c=p.length-Go,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?p.find(x=>x.slug===s)??null:null,h=!!g||u,v=()=>{h||n?.(e);},w=x=>{x.stopPropagation(),g&&(x.preventDefault(),l(null));},C=x=>{x.stopPropagation(),t||(x.preventDefault(),n?.(e));},S=u?jsxRuntime.jsx(Ac,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(Bc,{onCollapse:()=>l(null)}):jsxRuntime.jsx(Rc,{moreCount:c,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:C});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:h?void 0:"pointer"},onMouseEnter:x=>{let b=x.currentTarget,T=xc[e.source]??bc;b.style.borderColor=T.border,b.style.boxShadow=T.shadow,i?.(e);},onMouseLeave:x=>{let b=x.currentTarget;b.style.borderColor="rgba(39,39,42,0.6)",b.style.boxShadow="none";},onClick:v,children:[jsxRuntime.jsx("style",{children:Pc}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(Nc,{event:e,href:t,LinkComponent:r,onClick:w,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:u?jsxRuntime.jsx(Dc,{market:p[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(Fc,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:o}):jsxRuntime.jsx(_c,{displayedMarkets:m,onMarketClick:x=>l(x.slug)})})]}),jsxRuntime.jsx(Ic,{children:S})]})}function Nc({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?wc(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(Mc,{event:e})]})}function Cc(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 Mc({event:e}){let t=react.useMemo(()=>Cc(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(Ec,{},n);case "crypto-short":return jsxRuntime.jsx(Tc,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(Lc,{},n)}})})}function Ec(){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 Tc({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 Lc(){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 _c({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=ei(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:ti(n)}),jsxRuntime.jsx(Oc,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Rc({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(oi,{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(ii,{source:r})]})]})}function Ic({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 Zo({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 ni({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[s,l]=n?kc(e):[un,Jo],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",d=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",p=o==="label"&&a===d?"action":o,u=p==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Qo(e)}\xA2`:i("predict.market.action.yes",{price:Qo(e)}),m=p==="label"?`${e.outcomes?.[1]?.label??"No"} ${Xo(e)}\xA2`:i("predict.market.action.no",{price:Xo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Zo,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"yes");},children:u}),jsxRuntime.jsx(Zo,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:c=>{c.stopPropagation(),r?.(t,e,"no");},children:m})]})}function Oc(){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 Dc({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(ni,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function Ac({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(oi,{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(ii,{source:e.source})]})]})}function Fc({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=ei(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:ti(o)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(ni,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function Bc({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(Hc,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function oi({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 Hc({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 ii({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 Uc=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:d}=i18n.useTranslation(),p=react.useRef(null);react.useEffect(()=>{let c=p.current;if(!c)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return f.observe(c),()=>f.disconnect()},[t,r,n]);let u=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),m=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
|
|
80
80
|
@keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
|
|
81
81
|
@keyframes evt-load-spin{to{transform:rotate(360deg)}}
|
|
82
82
|
@media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
|
|
83
83
|
@media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
|
|
84
84
|
@media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
|
|
85
|
-
`}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((c,f)=>c==null?null:jsxRuntime.jsx("div",{style:{padding:Uc,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(ri,{event:c,href:s?.(c),LinkComponent:l,onSelect:o,onSelectOutcome:i,onHover:a})},`${c.source}-${c.slug}`))}),jsxRuntime.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),d("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(Kc,{onScrollToTop:u})]})}function Kc({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 ci({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:d,onSelect:p,onSelectOutcome:u,getEventHref:m,LinkComponent:c,onHover:f}){let{data:g,hasMore:h,fetchMore:v,isFetching:S,isFetchingMore:C}=Vo({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:d});return S?jsxRuntime.jsx(dn,{count:24}):jsxRuntime.jsx(ai,{events:g,hasMore:h,isFetchingMore:C,onFetchMore:v,onSelect:p,onSelectOutcome:u,getEventHref:m,LinkComponent:c,onHover:f})}function _0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i}){let[s,l]=react.useState({categorySlug:null,tagSlug:null}),[a,d]=react.useState(ln),{data:p}=reactPredict.useEventStats(),{isOpen:u,onOpen:m,onClose:c}=ui.useDisclosure(),{onOpen:f}=uiScaffold.useAsyncModal(Kt),g=react.useCallback((T,z,ae)=>{t?.(T,z,ae),f({params:{event:T,market:z,initialOutcome:ae}});},[t,f]),h=react.useCallback(T=>{l(T);},[]),v=react.useCallback(T=>{d(z=>({...z,sortPreset:T}));},[]),S=react.useCallback(T=>{d(z=>({...z,sortAsc:T}));},[]),C=react.useCallback(T=>{d(T);},[]),P=react.useMemo(()=>$o[a.sortPreset].sort_by,[a.sortPreset]),x=react.useMemo(()=>cn(a),[a]),b=react.useMemo(()=>jsxRuntime.jsx(Wo,{sortPreset:a.sortPreset,onSortChange:v,sortAsc:a.sortAsc,onSortAscChange:S,onFilterPress:m,filterCount:x}),[a.sortPreset,a.sortAsc,x,v,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(Ao,{stats:p})})]}),jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(go,{onSelect:h,trailing:b})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(Oo,{isOpen:u,onClose:c,value:a,onChange:C}),jsxRuntime.jsx(ci,{tagSlugSelection:s,sort_by:P,sort_asc:a.sortAsc,source:a.source,timeRemaining:a.timeRemaining,minVolume:a.minVolume,minLiquidity:a.minLiquidity,onSelect:e,onSelectOutcome:g,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(yr,{})]})}var xn=40,Mr=36,Xt=480,bn=Xt-Mr;function mi({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(u=>u.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),a=react.useMemo(()=>!l?.positions||!t?0:s.length===0?l.positions.length:l.positions.filter(u=>u.market&&s.includes(u.market.slug)).length,[l?.positions,s,t]),p=[{key:"positions",label:a>0?`${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:p.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(u.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===u.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:u.label},u.key))}),t?jsxRuntime.jsxs("div",{style:{height:Xt},children:[o==="positions"&&jsxRuntime.jsx(Jc,{source:e.source,walletAddress:t,marketSlugs:s}),o==="orders"&&jsxRuntime.jsx(td,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(od,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xt},children:n("predict.trade.connectWallet")})]})}function Jc({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(kn,{}):s.length===0?jsxRuntime.jsx(yn,{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:Mr},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:bn},rowComponent:ed,rowCount:s.length,rowHeight:xn,rowProps:{positions:s,closeLabel:n("predict.positions.close")}})]})}function ed({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,d=i>0?"text-success":i<0?"text-danger":"text-foreground",p=i>0?"+":"",u=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",m=o.side,c=o.size,f=o.size*a,g=o.market?.end_at?ad(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:u}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",m.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:m})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children: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:Nr(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Nr(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",d),children:[p,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:n})})]})}function td({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}),d=reactPredict.useCancelOrder(),p=react.useMemo(()=>{let v=i?.pages?.flatMap(P=>P.items)??[],S=new Set(["live","open","submitted","pending"]),C=v.filter(P=>S.has(P.status));return r.length>0&&(C=C.filter(P=>P.market_id&&r.includes(P.market_id))),C},[i?.pages,r]),u=react.useCallback(v=>{n?n(v.id):d.mutate({source:v.source,id:v.id});},[n,d]),m=p.length,c=m+(a?1:0),f=react.useCallback(v=>v<m,[m]),g=react.useCallback(async()=>{await l();},[l]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:c,threshold:5});return s?jsxRuntime.jsx(kn,{}):p.length===0&&!a?jsxRuntime.jsx(yn,{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:Mr},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:bn},onRowsRendered:h,rowComponent:rd,rowCount:c,rowHeight:xn,rowProps:{orders:p,itemCount:m,onCancel:u,isCancelling:d.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function rd({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?Nr(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(nd,{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 nd({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 od({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(c=>c.items)??[],[n?.pages]),a=l.length,d=a+(s?1:0),p=react.useCallback(c=>c<a,[a]),u=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:u,rowCount:d,threshold:5});return o?jsxRuntime.jsx(kn,{}):l.length===0&&!s?jsxRuntime.jsx(yn,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Mr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:bn},onRowsRendered:m,rowComponent:id,rowCount:d,rowHeight:xn,rowProps:{trades:l,itemCount:a}})]})}function id({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=sd(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:Nr(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 yn({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xt},children:e})}function kn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Xt},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Nr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function sd(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 ad(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var fi=`
|
|
85
|
+
`}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((c,f)=>c==null?null:jsxRuntime.jsx("div",{style:{padding:Uc,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(ri,{event:c,href:s?.(c),LinkComponent:l,onSelect:o,onSelectOutcome:i,onHover:a})},`${c.source}-${c.slug}`))}),jsxRuntime.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),d("predict.events.loadMore")]})}),m&&jsxRuntime.jsx(Kc,{onScrollToTop:u})]})}function Kc({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 ci({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:d,markets_limit:p,onSelect:u,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g}){let{data:h,hasMore:v,fetchMore:w,isFetching:C,isFetchingMore:S}=Vo({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:d,markets_limit:p});return C?jsxRuntime.jsx(dn,{count:24}):jsxRuntime.jsx(ai,{events:h,hasMore:v,isFetchingMore:S,onFetchMore:w,onSelect:u,onSelectOutcome:m,getEventHref:c,LinkComponent:f,onHover:g})}function _0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i}){let[s,l]=react.useState({categorySlug:null,tagSlug:null}),[a,d]=react.useState(ln),{data:p}=reactPredict.useEventStats(),{isOpen:u,onOpen:m,onClose:c}=ui.useDisclosure(),{onOpen:f}=uiScaffold.useAsyncModal(Kt),g=react.useCallback((T,z,ae)=>{t?.(T,z,ae),f({params:{event:T,market:z,initialOutcome:ae}});},[t,f]),h=react.useCallback(T=>{l(T);},[]),v=react.useCallback(T=>{d(z=>({...z,sortPreset:T}));},[]),w=react.useCallback(T=>{d(z=>({...z,sortAsc:T}));},[]),C=react.useCallback(T=>{d(T);},[]),S=react.useMemo(()=>$o[a.sortPreset].sort_by,[a.sortPreset]),x=react.useMemo(()=>cn(a),[a]),b=react.useMemo(()=>jsxRuntime.jsx(Wo,{sortPreset:a.sortPreset,onSortChange:v,sortAsc:a.sortAsc,onSortAscChange:w,onFilterPress:m,filterCount:x}),[a.sortPreset,a.sortAsc,x,v,w,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(Ao,{stats:p})})]}),jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(go,{onSelect:h,trailing:b})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(Oo,{isOpen:u,onClose:c,value:a,onChange:C}),jsxRuntime.jsx(ci,{tagSlugSelection:s,sort_by:S,sort_asc:a.sortAsc,source:a.source,timeRemaining:a.timeRemaining,minVolume:a.minVolume,minLiquidity:a.minLiquidity,onSelect:e,onSelectOutcome:g,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(yr,{})]})}var xn=40,Mr=36,Xt=480,bn=Xt-Mr;function mi({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(u=>u.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),a=react.useMemo(()=>!l?.positions||!t?0:s.length===0?l.positions.length:l.positions.filter(u=>u.market&&s.includes(u.market.slug)).length,[l?.positions,s,t]),p=[{key:"positions",label:a>0?`${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:p.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(u.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===u.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:u.label},u.key))}),t?jsxRuntime.jsxs("div",{style:{height:Xt},children:[o==="positions"&&jsxRuntime.jsx(Jc,{source:e.source,walletAddress:t,marketSlugs:s}),o==="orders"&&jsxRuntime.jsx(td,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(od,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xt},children:n("predict.trade.connectWallet")})]})}function Jc({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(kn,{}):s.length===0?jsxRuntime.jsx(yn,{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:Mr},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:bn},rowComponent:ed,rowCount:s.length,rowHeight:xn,rowProps:{positions:s,closeLabel:n("predict.positions.close")}})]})}function ed({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,d=i>0?"text-success":i<0?"text-danger":"text-foreground",p=i>0?"+":"",u=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",m=o.side,c=o.size,f=o.size*a,g=o.market?.end_at?ad(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:u}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",m.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:m})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children: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:Nr(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Nr(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",d),children:[p,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:n})})]})}function td({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}),d=reactPredict.useCancelOrder(),p=react.useMemo(()=>{let v=i?.pages?.flatMap(S=>S.items)??[],w=new Set(["live","open","submitted","pending"]),C=v.filter(S=>w.has(S.status));return r.length>0&&(C=C.filter(S=>S.market_id&&r.includes(S.market_id))),C},[i?.pages,r]),u=react.useCallback(v=>{n?n(v.id):d.mutate({source:v.source,id:v.id});},[n,d]),m=p.length,c=m+(a?1:0),f=react.useCallback(v=>v<m,[m]),g=react.useCallback(async()=>{await l();},[l]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:c,threshold:5});return s?jsxRuntime.jsx(kn,{}):p.length===0&&!a?jsxRuntime.jsx(yn,{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:Mr},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:bn},onRowsRendered:h,rowComponent:rd,rowCount:c,rowHeight:xn,rowProps:{orders:p,itemCount:m,onCancel:u,isCancelling:d.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function rd({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?Nr(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(nd,{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 nd({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 od({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(c=>c.items)??[],[n?.pages]),a=l.length,d=a+(s?1:0),p=react.useCallback(c=>c<a,[a]),u=react.useCallback(async()=>{await i();},[i]),m=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:u,rowCount:d,threshold:5});return o?jsxRuntime.jsx(kn,{}):l.length===0&&!s?jsxRuntime.jsx(yn,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Mr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:bn},onRowsRendered:m,rowComponent:id,rowCount:d,rowHeight:xn,rowProps:{trades:l,itemCount:a}})]})}function id({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=sd(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:Nr(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 yn({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Xt},children:e})}function kn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Xt},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Nr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function sd(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 ad(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var fi=`
|
|
86
86
|
@keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
|
87
|
-
`,gi={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 te(e){return {...gi,animationDelay:`${e}ms`}}function Zt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:fi}),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:{...gi,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:{...te(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...te(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...te(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...te(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...te(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:{...te(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...te(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...te(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...te(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...te(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(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:{...te(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:{...te(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:{...te(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...te(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...te(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...te(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(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:{...te(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...te(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...te(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...te(460),height:14,width:"60%"}})]})]})]})}function hi(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:fi}),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:{...te(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(120),height:40,width:"100%",borderRadius:8}})]})]})}var ki="var(--color-bullish)",Si="var(--color-bearish)";function Jt(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 dd(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function pd(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let c of e){let f=Math.round(c.price*100);f>=0&&f<=100&&(r[f]+=c.quantity);}for(let c of t){let f=Math.round(c.price*100);f>=0&&f<=100&&(n[f]+=c.quantity);}let o=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let c=100;c>=0;c--)o+=r[c],i+=r[c]*c/100,s[c]=o,l[c]=i;let a=0,d=0,p=new Float64Array(101),u=new Float64Array(101);for(let c=0;c<=100;c++)a+=n[c],d+=n[c]*c/100,p[c]=a,u[c]=d;let m=Math.max(s[0]??0,p[100]??0);return Array.from({length:101},(c,f)=>{let g=s[f]>0,h=p[f]>0,v=s[f]||p[f],S=r[f]>0||n[f]>0;return {priceCents:f,displayHeight:dd(v,m),opacity:v>0?S?1:.5:0,isBid:g,isAsk:h,bidCumTotal:s[f],askCumTotal:p[f],bidCumCost:l[f],askCumCost:u[f]}})}function ud({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?ki:Si,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:Jt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Jt(Math.round(e.cumCost))]})]})}var md=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?ki:t.isAsk?Si: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}})})}),fd=[0,10,20,30,40,50,60,70,80,90,100];function gd(){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:fd.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 wi({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>pd(e,t),[e,t]),o=react.useMemo(()=>{let u=e.length>0?Math.max(...e.map(c=>c.price)):0,m=t.length>0?Math.min(...t.map(c=>c.price)):1;return Math.round((u+m)/2*100)},[e,t]),i=react.useMemo(()=>n.some(u=>u.isBid||u.isAsk),[n]),[s,l]=react.useState(null),a=react.useRef(null),d=react.useCallback((u,m)=>{a.current&&(a.current.style.filter=""),m?(m.style.filter="brightness(1.5)",a.current=m):a.current=null,u.isBid||u.isAsk?l({priceCents:u.priceCents,isBid:u.isBid,cumTotal:u.isBid?u.bidCumTotal:u.askCumTotal,cumCost:u.isBid?u.bidCumCost:u.askCumCost,leftPct:u.priceCents}):l(null);},[]),p=react.useCallback(()=>{a.current&&(a.current.style.filter="",a.current=null),l(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[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(ud,{info:s}),n.map(u=>jsxRuntime.jsx(md,{slot:u,onEnter:d,onLeave:p},u.priceCents))]}),jsxRuntime.jsx(gd,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function wn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Pi(){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 Ei({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:d}=reactPredict.useOrderbook({slug:e.slug,source:l}),p=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),u=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),m=react.useMemo(()=>p.length>0?Math.max(...p.map(g=>g.price)):null,[p]),c=react.useMemo(()=>u.length>0?Math.min(...u.map(g=>g.price)):null,[u]),f=react.useMemo(()=>{if(m==null||c==null)return null;let g=(c-m)*100;return Math.round(g*10)/10},[m,c]);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?`${n("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:[n("predict.trade.bestBid"),": ",wn(m)]}),m!=null&&c!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),c!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[n("predict.trade.bestAsk"),": ",wn(c)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:o==="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:o==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[o==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:d?jsxRuntime.jsx(Pi,{}):jsxRuntime.jsx(wi,{bids:p,asks:u})}),o==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:d?jsxRuntime.jsx(Pi,{}):jsxRuntime.jsx(kd,{bids:p,asks:u,bestBid:m??void 0,bestAsk:c??void 0,spread:f??void 0})})]})]})}var Ni=8;function kd({bids:e,asks:t,spread:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>[...t].sort((a,d)=>a.price-d.price).slice(0,Ni).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,d)=>d.price-a.price).slice(0,Ni),[e]),s=react.useMemo(()=>{let a=[...o,...i].map(d=>d.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(Ci,{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(Ci,{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 Ci({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=Jt(Math.round(t)),d=Math.round(t*e),p=`$${Jt(d)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${s} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:wn(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:a}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:p})]})}var Cn=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},Lr=4,Ti=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Id(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 Od(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 Li(e){return `${(e*100).toFixed(2)}%`}var Dd=[{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 Ad({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Dd.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 Fd(){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 Bd({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"?Od(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?Li(a.value):"--"})]},a.dataKey))]})}function Hd({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!o)return;function d(p){s.current&&!s.current.contains(p.target)&&i(false);}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]);let l=t.length>=Lr,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(d=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(d)??"#6b7280",display:"inline-block"}},d))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let d=e.find(p=>p.slug===t[0]);return d?.outcomes?.[0]?.label??d?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[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 ",Lr," markets"]}),e.map((d,p)=>{let u=t.includes(d.slug),m=!u&&l,c=u&&t.length===1,f=r.get(d.slug)??"#6b7280",g=d.outcomes.find(v=>v.label.toLowerCase()==="yes")??d.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{c||m||n(d.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:u?"rgba(255,255,255,0.05)":"transparent",cursor:m||c?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!m&&!c&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.currentTarget.style.background=u?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:u?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:u?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:u&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:u?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.outcomes?.[0]?.label??d.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},d.id??`${p}-${d.slug}`)})]})]})}function zd({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?Li(i):"--"})]})]},n.marketSlug)})})}function $d(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Wd(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(d=>d.price).sort((d,p)=>d-p);r.push({timestamp:l[l.length-1].timestamp,price:$d(a)});}return r}function Ud(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:Wd(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(d=>a.set(d.timestamp,d.price)),{slug:l.marketSlug,map:a}}),s=new Map;return o.map(l=>{let a={timestamp:l};return i.forEach(({slug:d,map:p})=>{let u=p.get(l);if(u!==void 0)s.set(d,u),a[d]=u;else {let m=s.get(d);m!==void 0&&(a[d]=m);}}),a})}function _i(e){return jsxRuntime.jsx(Cn,{children:jsxRuntime.jsx(Kd,{...e})})}function Kd({event:e,isLoading:t,className:r,volume:n}){let o=react.useMemo(()=>{let M=new Set;return (e.markets??[]).filter(_=>_.status!=="open"||M.has(_.slug)?false:(M.add(_.slug),true))},[e.markets]),i=react.useMemo(()=>[...o].sort((M,_)=>{let G=A=>(A.outcomes.find(pe=>pe.label.toLowerCase()==="yes")??A.outcomes[0])?.price??0;return G(_)-G(M)}),[o]),[s,l]=react.useState(()=>i.slice(0,Lr).map(M=>M.slug)),[a,d]=react.useState(hr),p=react.useMemo(()=>{let M=new Map;return s.forEach((_,G)=>{M.set(_,Ti[G%Ti.length]);}),M},[s]),u=react.useMemo(()=>o.filter(M=>s.includes(M.slug)),[o,s]),{series:m,isLoading:c}=reactPredict.useMarketHistory(u,a),f=t||c,g=react.useMemo(()=>{if(m.length>0&&m.some(G=>G.data.length>0))return m;let M=Date.now(),_=864e5;return u.map(G=>{let pe=(G.outcomes?.find(le=>le.label.toLowerCase()==="yes")??G.outcomes?.[0])?.price??.5;return {marketSlug:G.slug,label:G.outcomes?.[0]?.label??G.question,data:[{timestamp:M-7*_,price:pe},{timestamp:M,price:pe}]}})},[m,u]),h=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),v=react.useMemo(()=>Ud(g,h),[g,h]),S=react.useMemo(()=>{if(v.length===0)return [0,1];let M=1/0,_=-1/0;if(s.forEach(A=>{v.forEach(pe=>{let le=pe[A];le!=null&&(le<M&&(M=le),le>_&&(_=le));});}),!isFinite(M))return [0,1];let G=Math.max((_-M)*.15,.05);return [Math.max(0,M-G),Math.min(1,_+G)]},[v,s]),C=react.useMemo(()=>{let M=new Map;return g.forEach(_=>{_.data.length>0&&M.set(_.marketSlug,_.data[_.data.length-1].price);}),M},[g]),P=react.useMemo(()=>{let M=new Map;return g.forEach(_=>M.set(_.marketSlug,_.label)),M},[g]),x=react.useMemo(()=>g.map(M=>({slug:M.marketSlug,color:p.get(M.marketSlug)??"#6b7280"})),[g,p]),{wrapperRef:b,overlayRef:T,onMouseMove:z,onMouseLeave:ae}=Fd(),D=react.useCallback(M=>{l(_=>_.includes(M)?_.length<=1?_:_.filter(G=>G!==M):_.length>=Lr?_:[..._,M]);},[]),[ve,I]=react.useState(null),H=react.useRef(null),$=react.useRef(""),J=react.useRef(0),ie=!f&&v.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(zd,{series:g,colorMap:p,displayValues:ve??C}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:b,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:ie?M=>{z(M),cancelAnimationFrame(J.current),J.current=requestAnimationFrame(()=>{I(H.current);});}:void 0,onMouseLeave:ie?()=>{ae(),cancelAnimationFrame(J.current),$.current="",H.current=null,I(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):v.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:T,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:v,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:M=>Id(M,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:S,tickFormatter:M=>`${Math.round(M*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:M=>{let _=M;if(_.active&&_.payload?.length){let G=_.payload.map(A=>`${A.dataKey}:${A.value}`).join(",");if(G!==$.current){$.current=G;let A=new Map;_.payload.forEach(pe=>{pe.value!=null&&A.set(pe.dataKey,pe.value);}),H.current=A;}}return jsxRuntime.jsx(Bd,{..._,labelMap:P,allSeries:x,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(M=>{let _=p.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:M.marketSlug,stroke:_,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:_},connectNulls:true,isAnimationActive:false},M.marketSlug)}),ve==null&&v.length>0&&g.map(M=>{let _=v[v.length-1],G=_[M.marketSlug];if(G==null)return null;let A=p.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:_.timestamp,y:G,ifOverflow:"extendDomain",shape:pe=>{let{cx:le,cy:we}=pe;return le==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:le,cy:we,r:6,fill:A,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:le,cy:we,r:3.5,fill:A})]})}},`pulse-${M.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(Ad,{value:a,onChange:d}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Hd,{markets:i,selectedSlugs:s,colorMap:p,onToggle:D})})]})]})]})}function tr(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function np(e){return `${parseFloat((e*100).toFixed(2))}%`}function Ri(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function _r(e){return e.outcomes?.[0]?.label??e.question}function op(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function er(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 Ii(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let p=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(p)},[e]),!e||t===0)return null;let 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),d=[];return i>0&&d.push(`${i}d`),d.push(`${String(s).padStart(2,"0")}h`),d.push(`${String(l).padStart(2,"0")}m`),d.push(`${String(a).padStart(2,"0")}s`),d.join(" ")}function Oi(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}function Bi({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let u=[...e.markets||[]],m=u.filter(f=>f.status==="open").sort((f,g)=>tr(g)-tr(f)),c=u.filter(f=>f.status!=="open").sort((f,g)=>tr(g)-tr(f));return [...m,...c]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=Ii(s?void 0:e.start_at),a=Ii(s?void 0:e.end_at),d=Oi(e.start_at),p=Oi(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((u,m)=>jsxRuntime.jsxs(react.Fragment,{children:[m>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:u.label})]},u.slug)),jsxRuntime.jsx(lp,{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?p&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:p})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:l})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:d})]})]}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:a})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:p})]})]}):null}),jsxRuntime.jsx(_i,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(ip,{markets:i,onTradeAction:t}),jsxRuntime.jsx(ap,{markets:i,event:e})]})}var Di=5;function ip({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:n}=ui.useScreen(),[o,i]=react.useState(false),[s,l]=react.useState(null),a=react.useMemo(()=>{let h=new Set;return e.filter(v=>h.has(v.slug)?false:(h.add(v.slug),true))},[e]),d=a.find(h=>h.status==="open")?.slug,[p,u]=react.useState(d?`${d}:yes`:null);if(a.length===0)return null;let m=a.length>Di,c=o?a:a.slice(0,Di),f=h=>{l(v=>v===h?null:h);},g=(h,v,S)=>{u(`${h.slug}:${v}`),n||l(h.slug),t?.(h,v,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:c.map((h,v)=>{let S=tr(h),C=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,P=s===h.slug;return jsxRuntime.jsx(sp,{market:h,yesPrice:S,noPrice:C??void 0,activeYes:p===`${h.slug}:yes`,activeNo:p===`${h.slug}:no`,isExpanded:P,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${v}-${h.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(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 sp({market:e,yesPrice:t,noPrice:r,activeYes:n,activeNo:o,isExpanded:i,onToggleExpand:s,onTradeAction:l}){let{t:a}=i18n.useTranslation(),d=e.status==="open",p=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:s,role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:_r(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:_r(e)}),p&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:p})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:np(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:d?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:u=>{u.stopPropagation(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Ri(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:u=>{u.stopPropagation(),l?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:Ri(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(Ei,{market:e,outcome:o?"no":"yes",onTradeAction:l})})})})]})}function ap({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,s]=react.useState(false),[l,a]=react.useState(0),d=e.filter(c=>c.rules&&c.rules.length>0||c.description);if(d.length===0)return null;let p=d[l]??d[0],u=p.rules&&p.rules.length>0?p.rules.join(`
|
|
87
|
+
`,gi={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 te(e){return {...gi,animationDelay:`${e}ms`}}function Zt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:fi}),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:{...gi,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:{...te(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...te(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...te(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...te(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...te(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:{...te(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...te(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...te(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...te(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...te(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(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:{...te(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:{...te(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:{...te(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...te(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...te(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...te(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(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:{...te(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...te(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...te(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...te(460),height:14,width:"60%"}})]})]})]})}function hi(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:fi}),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:{...te(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...te(120),height:40,width:"100%",borderRadius:8}})]})]})}var ki="var(--color-bullish)",Si="var(--color-bearish)";function Jt(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 dd(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function pd(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let c of e){let f=Math.round(c.price*100);f>=0&&f<=100&&(r[f]+=c.quantity);}for(let c of t){let f=Math.round(c.price*100);f>=0&&f<=100&&(n[f]+=c.quantity);}let o=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let c=100;c>=0;c--)o+=r[c],i+=r[c]*c/100,s[c]=o,l[c]=i;let a=0,d=0,p=new Float64Array(101),u=new Float64Array(101);for(let c=0;c<=100;c++)a+=n[c],d+=n[c]*c/100,p[c]=a,u[c]=d;let m=Math.max(s[0]??0,p[100]??0);return Array.from({length:101},(c,f)=>{let g=s[f]>0,h=p[f]>0,v=s[f]||p[f],w=r[f]>0||n[f]>0;return {priceCents:f,displayHeight:dd(v,m),opacity:v>0?w?1:.5:0,isBid:g,isAsk:h,bidCumTotal:s[f],askCumTotal:p[f],bidCumCost:l[f],askCumCost:u[f]}})}function ud({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?ki:Si,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:Jt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Jt(Math.round(e.cumCost))]})]})}var md=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?ki:t.isAsk?Si: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}})})}),fd=[0,10,20,30,40,50,60,70,80,90,100];function gd(){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:fd.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 wi({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>pd(e,t),[e,t]),o=react.useMemo(()=>{let u=e.length>0?Math.max(...e.map(c=>c.price)):0,m=t.length>0?Math.min(...t.map(c=>c.price)):1;return Math.round((u+m)/2*100)},[e,t]),i=react.useMemo(()=>n.some(u=>u.isBid||u.isAsk),[n]),[s,l]=react.useState(null),a=react.useRef(null),d=react.useCallback((u,m)=>{a.current&&(a.current.style.filter=""),m?(m.style.filter="brightness(1.5)",a.current=m):a.current=null,u.isBid||u.isAsk?l({priceCents:u.priceCents,isBid:u.isBid,cumTotal:u.isBid?u.bidCumTotal:u.askCumTotal,cumCost:u.isBid?u.bidCumCost:u.askCumCost,leftPct:u.priceCents}):l(null);},[]),p=react.useCallback(()=>{a.current&&(a.current.style.filter="",a.current=null),l(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[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(ud,{info:s}),n.map(u=>jsxRuntime.jsx(md,{slot:u,onEnter:d,onLeave:p},u.priceCents))]}),jsxRuntime.jsx(gd,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function wn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Pi(){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 Ei({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:d}=reactPredict.useOrderbook({slug:e.slug,source:l}),p=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),u=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(h=>({price:s?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,s]),m=react.useMemo(()=>p.length>0?Math.max(...p.map(g=>g.price)):null,[p]),c=react.useMemo(()=>u.length>0?Math.min(...u.map(g=>g.price)):null,[u]),f=react.useMemo(()=>{if(m==null||c==null)return null;let g=(c-m)*100;return Math.round(g*10)/10},[m,c]);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?`${n("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:[n("predict.trade.bestBid"),": ",wn(m)]}),m!=null&&c!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),c!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[n("predict.trade.bestAsk"),": ",wn(c)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:o==="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:o==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[o==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:d?jsxRuntime.jsx(Pi,{}):jsxRuntime.jsx(wi,{bids:p,asks:u})}),o==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:d?jsxRuntime.jsx(Pi,{}):jsxRuntime.jsx(kd,{bids:p,asks:u,bestBid:m??void 0,bestAsk:c??void 0,spread:f??void 0})})]})]})}var Ni=8;function kd({bids:e,asks:t,spread:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>[...t].sort((a,d)=>a.price-d.price).slice(0,Ni).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,d)=>d.price-a.price).slice(0,Ni),[e]),s=react.useMemo(()=>{let a=[...o,...i].map(d=>d.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(Ci,{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(Ci,{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 Ci({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=Jt(Math.round(t)),d=Math.round(t*e),p=`$${Jt(d)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${s} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:wn(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:a}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:p})]})}var Cn=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},Lr=4,Ti=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Id(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 Od(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 Li(e){return `${(e*100).toFixed(2)}%`}var Dd=[{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 Ad({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Dd.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 Fd(){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 Bd({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"?Od(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?Li(a.value):"--"})]},a.dataKey))]})}function Hd({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!o)return;function d(p){s.current&&!s.current.contains(p.target)&&i(false);}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]);let l=t.length>=Lr,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(d=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(d)??"#6b7280",display:"inline-block"}},d))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let d=e.find(p=>p.slug===t[0]);return d?.outcomes?.[0]?.label??d?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[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 ",Lr," markets"]}),e.map((d,p)=>{let u=t.includes(d.slug),m=!u&&l,c=u&&t.length===1,f=r.get(d.slug)??"#6b7280",g=d.outcomes.find(v=>v.label.toLowerCase()==="yes")??d.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{c||m||n(d.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:u?"rgba(255,255,255,0.05)":"transparent",cursor:m||c?"not-allowed":"pointer",opacity:m?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!m&&!c&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.currentTarget.style.background=u?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:u?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:u?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:u&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:u?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.outcomes?.[0]?.label??d.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},d.id??`${p}-${d.slug}`)})]})]})}function zd({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?Li(i):"--"})]})]},n.marketSlug)})})}function $d(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Wd(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(d=>d.price).sort((d,p)=>d-p);r.push({timestamp:l[l.length-1].timestamp,price:$d(a)});}return r}function Ud(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:Wd(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(d=>a.set(d.timestamp,d.price)),{slug:l.marketSlug,map:a}}),s=new Map;return o.map(l=>{let a={timestamp:l};return i.forEach(({slug:d,map:p})=>{let u=p.get(l);if(u!==void 0)s.set(d,u),a[d]=u;else {let m=s.get(d);m!==void 0&&(a[d]=m);}}),a})}function _i(e){return jsxRuntime.jsx(Cn,{children:jsxRuntime.jsx(Kd,{...e})})}function Kd({event:e,isLoading:t,className:r,volume:n}){let o=react.useMemo(()=>{let M=new Set;return (e.markets??[]).filter(_=>_.status!=="open"||M.has(_.slug)?false:(M.add(_.slug),true))},[e.markets]),i=react.useMemo(()=>[...o].sort((M,_)=>{let G=A=>(A.outcomes.find(pe=>pe.label.toLowerCase()==="yes")??A.outcomes[0])?.price??0;return G(_)-G(M)}),[o]),[s,l]=react.useState(()=>i.slice(0,Lr).map(M=>M.slug)),[a,d]=react.useState(hr),p=react.useMemo(()=>{let M=new Map;return s.forEach((_,G)=>{M.set(_,Ti[G%Ti.length]);}),M},[s]),u=react.useMemo(()=>o.filter(M=>s.includes(M.slug)),[o,s]),{series:m,isLoading:c}=reactPredict.useMarketHistory(u,a),f=t||c,g=react.useMemo(()=>{if(m.length>0&&m.some(G=>G.data.length>0))return m;let M=Date.now(),_=864e5;return u.map(G=>{let pe=(G.outcomes?.find(le=>le.label.toLowerCase()==="yes")??G.outcomes?.[0])?.price??.5;return {marketSlug:G.slug,label:G.outcomes?.[0]?.label??G.question,data:[{timestamp:M-7*_,price:pe},{timestamp:M,price:pe}]}})},[m,u]),h=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),v=react.useMemo(()=>Ud(g,h),[g,h]),w=react.useMemo(()=>{if(v.length===0)return [0,1];let M=1/0,_=-1/0;if(s.forEach(A=>{v.forEach(pe=>{let le=pe[A];le!=null&&(le<M&&(M=le),le>_&&(_=le));});}),!isFinite(M))return [0,1];let G=Math.max((_-M)*.15,.05);return [Math.max(0,M-G),Math.min(1,_+G)]},[v,s]),C=react.useMemo(()=>{let M=new Map;return g.forEach(_=>{_.data.length>0&&M.set(_.marketSlug,_.data[_.data.length-1].price);}),M},[g]),S=react.useMemo(()=>{let M=new Map;return g.forEach(_=>M.set(_.marketSlug,_.label)),M},[g]),x=react.useMemo(()=>g.map(M=>({slug:M.marketSlug,color:p.get(M.marketSlug)??"#6b7280"})),[g,p]),{wrapperRef:b,overlayRef:T,onMouseMove:z,onMouseLeave:ae}=Fd(),D=react.useCallback(M=>{l(_=>_.includes(M)?_.length<=1?_:_.filter(G=>G!==M):_.length>=Lr?_:[..._,M]);},[]),[ve,I]=react.useState(null),H=react.useRef(null),$=react.useRef(""),J=react.useRef(0),ie=!f&&v.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(zd,{series:g,colorMap:p,displayValues:ve??C}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:b,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:ie?M=>{z(M),cancelAnimationFrame(J.current),J.current=requestAnimationFrame(()=>{I(H.current);});}:void 0,onMouseLeave:ie?()=>{ae(),cancelAnimationFrame(J.current),$.current="",H.current=null,I(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):v.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:T,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:v,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:M=>Id(M,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:w,tickFormatter:M=>`${Math.round(M*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:M=>{let _=M;if(_.active&&_.payload?.length){let G=_.payload.map(A=>`${A.dataKey}:${A.value}`).join(",");if(G!==$.current){$.current=G;let A=new Map;_.payload.forEach(pe=>{pe.value!=null&&A.set(pe.dataKey,pe.value);}),H.current=A;}}return jsxRuntime.jsx(Bd,{..._,labelMap:S,allSeries:x,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(M=>{let _=p.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:M.marketSlug,stroke:_,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:_},connectNulls:true,isAnimationActive:false},M.marketSlug)}),ve==null&&v.length>0&&g.map(M=>{let _=v[v.length-1],G=_[M.marketSlug];if(G==null)return null;let A=p.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:_.timestamp,y:G,ifOverflow:"extendDomain",shape:pe=>{let{cx:le,cy:we}=pe;return le==null||we==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:le,cy:we,r:6,fill:A,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:le,cy:we,r:3.5,fill:A})]})}},`pulse-${M.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(Ad,{value:a,onChange:d}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Hd,{markets:i,selectedSlugs:s,colorMap:p,onToggle:D})})]})]})]})}function tr(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function np(e){return `${parseFloat((e*100).toFixed(2))}%`}function Ri(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function _r(e){return e.outcomes?.[0]?.label??e.question}function op(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function er(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 Ii(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let p=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(p)},[e]),!e||t===0)return null;let 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),d=[];return i>0&&d.push(`${i}d`),d.push(`${String(s).padStart(2,"0")}h`),d.push(`${String(l).padStart(2,"0")}m`),d.push(`${String(a).padStart(2,"0")}s`),d.join(" ")}function Oi(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}function Bi({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let u=[...e.markets||[]],m=u.filter(f=>f.status==="open").sort((f,g)=>tr(g)-tr(f)),c=u.filter(f=>f.status!=="open").sort((f,g)=>tr(g)-tr(f));return [...m,...c]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=Ii(s?void 0:e.start_at),a=Ii(s?void 0:e.end_at),d=Oi(e.start_at),p=Oi(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((u,m)=>jsxRuntime.jsxs(react.Fragment,{children:[m>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:u.label})]},u.slug)),jsxRuntime.jsx(lp,{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?p&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:p})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:l})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:d})]})]}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:a})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:p})]})]}):null}),jsxRuntime.jsx(_i,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(ip,{markets:i,onTradeAction:t}),jsxRuntime.jsx(ap,{markets:i,event:e})]})}var Di=5;function ip({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:n}=ui.useScreen(),[o,i]=react.useState(false),[s,l]=react.useState(null),a=react.useMemo(()=>{let h=new Set;return e.filter(v=>h.has(v.slug)?false:(h.add(v.slug),true))},[e]),d=a.find(h=>h.status==="open")?.slug,[p,u]=react.useState(d?`${d}:yes`:null);if(a.length===0)return null;let m=a.length>Di,c=o?a:a.slice(0,Di),f=h=>{l(v=>v===h?null:h);},g=(h,v,w)=>{u(`${h.slug}:${v}`),n||l(h.slug),t?.(h,v,w);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:c.map((h,v)=>{let w=tr(h),C=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,S=s===h.slug;return jsxRuntime.jsx(sp,{market:h,yesPrice:w,noPrice:C??void 0,activeYes:p===`${h.slug}:yes`,activeNo:p===`${h.slug}:no`,isExpanded:S,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${v}-${h.slug}`)})})]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(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 sp({market:e,yesPrice:t,noPrice:r,activeYes:n,activeNo:o,isExpanded:i,onToggleExpand:s,onTradeAction:l}){let{t:a}=i18n.useTranslation(),d=e.status==="open",p=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:s,role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:_r(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:_r(e)}),p&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:p})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:np(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:d?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:u=>{u.stopPropagation(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Ri(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:u=>{u.stopPropagation(),l?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:Ri(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(Ei,{market:e,outcome:o?"no":"yes",onTradeAction:l})})})})]})}function ap({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,s]=react.useState(false),[l,a]=react.useState(0),d=e.filter(c=>c.rules&&c.rules.length>0||c.description);if(d.length===0)return null;let p=d[l]??d[0],u=p.rules&&p.rules.length>0?p.rules.join(`
|
|
88
88
|
|
|
89
|
-
`):p.description??"";if(!u)return null;let m=u.length>200&&!n?u.slice(0,200)+"...":u;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),d.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:_r(p)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:c=>{a(Number(c)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:d.map((c,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:_r(c)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),u.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(c=>!c),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(c=>!c),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let c=p.status,f=[];return p.created_at&&f.push({label:r("predict.event.timeline.created"),value:er(p.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:er(p.start_at),isActive:c!=="pending"}),c==="voided"?f.push({label:r("predict.event.timeline.voided"),value:er(p.closed_at??p.end_at),isActive:true}):c==="closed"?f.push({label:r("predict.event.timeline.closed"),value:er(p.closed_at??p.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:er(p.end_at),isActive:false}),f})().map((c,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${c.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:c.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:c.value})]})]},c.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:p.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:op(p.source)})]})]})]})]})}function lp({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 Hi({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(Zt,{}):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(Bi,{event:n,onTradeAction:r})}var mp={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}},fp={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function Ye(e){return mp[e]??fp}function Rh({source:e,className:t}){let r=Ye(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 $i="rgba(39,39,42,0.6)",yp="rgba(63,63,70,0.8)";function kp(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Ui({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(Sp,{event:a,onClick:n,onHover:o},`${a.source}-${a.slug}`))})]})}function Sp({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=Ye(e.source),i=react.useMemo(()=>kp(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=yp,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=$i;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${$i}`,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 Ki(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Jh({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:s}){let{t:l}=i18n.useTranslation(),{isMobile:a}=ui.useScreen(),{onOpen:d}=uiScaffold.useAsyncModal(Kt),{data:p,isLoading:u}=reactPredict.useEvent({slug:e,source:t}),m=react.useMemo(()=>[...p?.markets||[]].sort((S,C)=>Ki(C)-Ki(S)),[p?.markets]),[c,f]=react.useState(null),g=react.useCallback((S,C,P)=>{f(x=>({market:S,outcome:C,side:P,version:(x?.version??0)+1})),a&&p&&d({params:{event:p,market:S,initialOutcome:C,chain:r}});},[a,p,r,d]),h=c?.market??m[0];if(u){let S=!!s;return a?jsxRuntime.jsx(Zt,{showBack:S}):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(Zt,{showBack:S})}),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(hi,{})})})]})}let v=c?`${c.market.slug}-${c.version}`:h?.slug??"default";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.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(Hi,{eventSlug:e,source:t,onTradeAction:g})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[h&&jsxRuntime.jsx(br,{event:p,market:h,initialSide:c?.side,initialOutcome:c?.outcome,chain:r},v),p&&jsxRuntime.jsx(Ui,{eventSlug:e,source:p.source,onEventClick:o,onEventHover:i})]})]}),p&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(mi,{event:p,walletAddress:n})}),jsxRuntime.jsx(yr,{})]})}function Vi(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Fp(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 sv=e=>{let{candlestickMarketSlugs:t,chartRange:r=hr,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Fp(r),[r]),{data:s,isLoading:l,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:n}),d=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(v=>f.has(v.slug)?false:(f.add(v.slug),true));return (t&&t.length>0?t.slice(0,4).map(v=>g.find(S=>S.slug===v)).filter(v=>v!==void 0):[...g].sort((v,S)=>Vi(S)-Vi(v)).slice(0,4)).map(v=>v.slug)},[t,s?.markets]),p=reactQuery.useQueries({queries:d.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>o.listCandlesticks(f,i),enabled:d.length>0}))}),u=p.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return d.forEach((g,h)=>{let v=p[h]?.error;v&&f.set(g,v);}),f},[d,p]),c=react.useMemo(()=>{let f=new Map;return d.forEach((g,h)=>{let v=p[h]?.data;v&&f.set(g,v);}),f},[d,p]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:c,isCandlesticksLoading:u,candlestickErrors:m}};var zp=10,$p=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Dr(){let[e,t]=jotai.useAtom($p),r=react.useCallback(o=>{let i=o.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,zp)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function qi({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 Qi({onSelect:e,className:t}){let{histories:r,clearHistories:n}=Dr();return jsxRuntime.jsx(qi,{className:ui.cn(t),histories:r,onSelect:e,onClear:n})}function Xi({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 su(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Zi({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=Ye(e.source),d=react.useMemo(()=>su(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:p=>{t&&n&&p.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:[d," ",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 Ji({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(d=>d.items).filter(d=>d!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:l}}var hu=64;function ns({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:d,fetchNextPage:p}=Ji(i),u=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:u}),c=react.useCallback(v=>v<s.length,[s]),f=react.useCallback(async()=>{d&&!a&&await p();},[d,a,p]),g=react.useMemo(()=>d?s.length+1:s.length,[s,d]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:c,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(xu,{className:o}):s.length===0?jsxRuntime.jsx(bu,{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:u,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:h,rowComponent:vu,rowCount:g,rowHeight:hu,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function vu({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(Zi,{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 xu({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 bu({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 as({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=Dr(),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(m=>{o(m),s(m),m&&l(m);},500),[s,l]),d=react.useCallback(m=>{r(m),a(m);},[a]),p=react.useCallback(m=>{a.cancel(),r(m),o(m),s(m),m&&l(m);},[a,s,l]),u=react.useCallback(()=>p(""),[p]);return {text:t,keyword:n,setText:d,setKeyword:p,clearKeyword:u}}function ls({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:s}){let{text:l,keyword:a,setText:d,setKeyword:p,clearKeyword:u}=as({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Xi,{value:l,onValueChange:d,onClear:u,onEscape:i}),!a&&jsxRuntime.jsx(Qi,{onSelect:p}),jsxRuntime.jsx(ns,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:s})]})}var Rn="predict-search";function Mx({id:e=Rn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Ru,{...t})})}function Ru({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(ls,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function Ax({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o,isMobile:i}=ui.useScreen(),{onOpen:s,onClose:l}=uiScaffold.useAsyncModal(Rn),a=hooks.useCallbackRef(e),d=hooks.useCallbackRef(async()=>{let u=await s({params:t});u&&a(u);}),p=hooks.useCallbackRef(()=>{l();});return react.useEffect(()=>{let u=m=>{let c=document.activeElement,f=!!c&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.getAttribute("contenteditable")==="true");m.key==="/"&&!f&&(m.preventDefault(),d()),m.key==="Escape"&&(m.preventDefault(),p());};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[d,p]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!o,onPress:d,variant:i?"flat":"bordered",startContent:o?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:o?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(o&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:o?n("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var On=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],vs=[{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}],fs={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"},gs={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 Wu(e,t){if(!e)return "$5K+";let r=vs.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function xs({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:s}){let{t:l}=i18n.useTranslation(),[a,d]=react.useState(false),[p,u]=react.useState(false),[m,c]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),v=react.useRef(null),S=On.find(x=>x.value===e)??On[0],C=react.useCallback(x=>{h.current&&!h.current.contains(x.target)&&d(false),v.current&&!v.current.contains(x.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)),[C]);let P=react.useCallback(()=>{s?.(),g(true),setTimeout(()=>g(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
89
|
+
`):p.description??"";if(!u)return null;let m=u.length>200&&!n?u.slice(0,200)+"...":u;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),d.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:_r(p)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:c=>{a(Number(c)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:d.map((c,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:_r(c)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:m}),u.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(c=>!c),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(c=>!c),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let c=p.status,f=[];return p.created_at&&f.push({label:r("predict.event.timeline.created"),value:er(p.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:er(p.start_at),isActive:c!=="pending"}),c==="voided"?f.push({label:r("predict.event.timeline.voided"),value:er(p.closed_at??p.end_at),isActive:true}):c==="closed"?f.push({label:r("predict.event.timeline.closed"),value:er(p.closed_at??p.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:er(p.end_at),isActive:false}),f})().map((c,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${c.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:c.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:c.value})]})]},c.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:p.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:op(p.source)})]})]})]})]})}function lp({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 Hi({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(Zt,{}):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(Bi,{event:n,onTradeAction:r})}var mp={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}},fp={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function Ye(e){return mp[e]??fp}function Rh({source:e,className:t}){let r=Ye(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 $i="rgba(39,39,42,0.6)",yp="rgba(63,63,70,0.8)";function kp(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Ui({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(Sp,{event:a,onClick:n,onHover:o},`${a.source}-${a.slug}`))})]})}function Sp({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=Ye(e.source),i=react.useMemo(()=>kp(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=yp,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=$i;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${$i}`,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 Ki(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Jh({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:s}){let{t:l}=i18n.useTranslation(),{isMobile:a}=ui.useScreen(),{onOpen:d}=uiScaffold.useAsyncModal(Kt),{data:p,isLoading:u}=reactPredict.useEvent({slug:e,source:t}),m=react.useMemo(()=>[...p?.markets||[]].sort((w,C)=>Ki(C)-Ki(w)),[p?.markets]),[c,f]=react.useState(null),g=react.useCallback((w,C,S)=>{f(x=>({market:w,outcome:C,side:S,version:(x?.version??0)+1})),a&&p&&d({params:{event:p,market:w,initialOutcome:C,chain:r}});},[a,p,r,d]),h=c?.market??m[0];if(u){let w=!!s;return a?jsxRuntime.jsx(Zt,{showBack:w}):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(Zt,{showBack:w})}),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(hi,{})})})]})}let v=c?`${c.market.slug}-${c.version}`:h?.slug??"default";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.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(Hi,{eventSlug:e,source:t,onTradeAction:g})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[h&&jsxRuntime.jsx(br,{event:p,market:h,initialSide:c?.side,initialOutcome:c?.outcome,chain:r},v),p&&jsxRuntime.jsx(Ui,{eventSlug:e,source:p.source,onEventClick:o,onEventHover:i})]})]}),p&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(mi,{event:p,walletAddress:n})}),jsxRuntime.jsx(yr,{})]})}function Vi(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Fp(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 sv=e=>{let{candlestickMarketSlugs:t,chartRange:r=hr,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Fp(r),[r]),{data:s,isLoading:l,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:n}),d=react.useMemo(()=>{if(!s?.markets)return [];let f=new Set,g=s.markets.filter(v=>f.has(v.slug)?false:(f.add(v.slug),true));return (t&&t.length>0?t.slice(0,4).map(v=>g.find(w=>w.slug===v)).filter(v=>v!==void 0):[...g].sort((v,w)=>Vi(w)-Vi(v)).slice(0,4)).map(v=>v.slug)},[t,s?.markets]),p=reactQuery.useQueries({queries:d.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>o.listCandlesticks(f,i),enabled:d.length>0}))}),u=p.some(f=>f.isLoading),m=react.useMemo(()=>{let f=new Map;return d.forEach((g,h)=>{let v=p[h]?.error;v&&f.set(g,v);}),f},[d,p]),c=react.useMemo(()=>{let f=new Map;return d.forEach((g,h)=>{let v=p[h]?.data;v&&f.set(g,v);}),f},[d,p]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:c,isCandlesticksLoading:u,candlestickErrors:m}};var zp=10,$p=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Dr(){let[e,t]=jotai.useAtom($p),r=react.useCallback(o=>{let i=o.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,zp)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function qi({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 Qi({onSelect:e,className:t}){let{histories:r,clearHistories:n}=Dr();return jsxRuntime.jsx(qi,{className:ui.cn(t),histories:r,onSelect:e,onClear:n})}function Xi({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 su(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Zi({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=Ye(e.source),d=react.useMemo(()=>su(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:p=>{t&&n&&p.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:[d," ",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 Ji({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(d=>d.items).filter(d=>d!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:l}}var hu=64;function ns({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:d,fetchNextPage:p}=Ji(i),u=react.useRef(null),{height:m}=hooks.useResizeObserver({ref:u}),c=react.useCallback(v=>v<s.length,[s]),f=react.useCallback(async()=>{d&&!a&&await p();},[d,a,p]),g=react.useMemo(()=>d?s.length+1:s.length,[s,d]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:c,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(xu,{className:o}):s.length===0?jsxRuntime.jsx(bu,{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:u,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:m},onRowsRendered:h,rowComponent:vu,rowCount:g,rowHeight:hu,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function vu({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(Zi,{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 xu({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 bu({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 as({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=Dr(),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(m=>{o(m),s(m),m&&l(m);},500),[s,l]),d=react.useCallback(m=>{r(m),a(m);},[a]),p=react.useCallback(m=>{a.cancel(),r(m),o(m),s(m),m&&l(m);},[a,s,l]),u=react.useCallback(()=>p(""),[p]);return {text:t,keyword:n,setText:d,setKeyword:p,clearKeyword:u}}function ls({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:s}){let{text:l,keyword:a,setText:d,setKeyword:p,clearKeyword:u}=as({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Xi,{value:l,onValueChange:d,onClear:u,onEscape:i}),!a&&jsxRuntime.jsx(Qi,{onSelect:p}),jsxRuntime.jsx(ns,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:s})]})}var Rn="predict-search";function Mx({id:e=Rn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Ru,{...t})})}function Ru({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(ls,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function Ax({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o,isMobile:i}=ui.useScreen(),{onOpen:s,onClose:l}=uiScaffold.useAsyncModal(Rn),a=hooks.useCallbackRef(e),d=hooks.useCallbackRef(async()=>{let u=await s({params:t});u&&a(u);}),p=hooks.useCallbackRef(()=>{l();});return react.useEffect(()=>{let u=m=>{let c=document.activeElement,f=!!c&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.getAttribute("contenteditable")==="true");m.key==="/"&&!f&&(m.preventDefault(),d()),m.key==="Escape"&&(m.preventDefault(),p());};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[d,p]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!o,onPress:d,variant:i?"flat":"bordered",startContent:o?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:o?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(o&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:o?n("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var On=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],vs=[{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}],fs={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"},gs={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 Wu(e,t){if(!e)return "$5K+";let r=vs.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function xs({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:s}){let{t:l}=i18n.useTranslation(),[a,d]=react.useState(false),[p,u]=react.useState(false),[m,c]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),v=react.useRef(null),w=On.find(x=>x.value===e)??On[0],C=react.useCallback(x=>{h.current&&!h.current.contains(x.target)&&d(false),v.current&&!v.current.contains(x.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)),[C]);let S=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:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:fs,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(x=>!x),u(false);},children:[jsxRuntime.jsx(Uu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(
|
|
93
|
+
`}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:fs,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(x=>!x),u(false);},children:[jsxRuntime.jsx(Uu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(w.labelKey)}),jsxRuntime.jsx(hs,{open:a})]}),a&&jsxRuntime.jsx("div",{style:{...gs,width:224,padding:4},children:On.map(x=>{let b=e===x.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:T=>{b||(T.currentTarget.style.background="rgba(39,39,42,0.5)",T.currentTarget.style.color="#fff");},onMouseLeave:T=>{b||(T.currentTarget.style.background="transparent",T.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===x.value?n(!r):t(x.value),d(false);},children:[jsxRuntime.jsx("div",{style:{color:b?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Ku,{type:x.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(x.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(x.descKey)})]}),b&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:fs,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(x=>!x),d(false);},children:[jsxRuntime.jsx(Vu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Wu(o,l)}),jsxRuntime.jsx(ju,{onMouseEnter:()=>c(true),onMouseLeave:()=>c(false)}),jsxRuntime.jsx(hs,{open:p})]}),m&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),l("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:l("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:l("predict.matches.filter.tooltipNote")})]})]})]}),p&&jsxRuntime.jsxs("div",{style:{...gs,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:vs.map(x=>{let b=x.value===0?!o:o===x.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:b?"rgba(199,255,46,0.08)":"transparent",color:b?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:T=>{b||(T.currentTarget.style.background="rgba(39,39,42,0.5)",T.currentTarget.style.color="#fff");},onMouseLeave:T=>{b||(T.currentTarget.style.background="transparent",T.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(x.value===0?void 0:x.value),u(false);},children:[jsxRuntime.jsx("span",{children:x.labelKey?l(x.labelKey):x.label}),b&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)",x.currentTarget.style.color="#fff";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)",x.currentTarget.style.color="#a1a1aa";},onClick:S,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 Uu(){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 Ku({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 Vu(){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 ju({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 hs({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 qu(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var Qu=[{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:qu,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function bs({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)}}
|
|
@@ -135,14 +135,14 @@
|
|
|
135
135
|
outline: 2px solid hsl(var(--heroui-primary) / 0.4);
|
|
136
136
|
outline-offset: 2px;
|
|
137
137
|
}
|
|
138
|
-
`;function Ps({match:e,onSelect:t,onHover:r,getMarketHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=An(e.market_a),l=An(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=Ju(a),p=ws[d],u=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,c=tm(e.confidence_tier,e.similarity_score),f=ys[c]??ys.low,g=d==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group match-card",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let v=h.currentTarget,
|
|
138
|
+
`;function Ps({match:e,onSelect:t,onHover:r,getMarketHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=An(e.market_a),l=An(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=Ju(a),p=ws[d],u=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,c=tm(e.confidence_tier,e.similarity_score),f=ys[c]??ys.low,g=d==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group match-card",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let v=h.currentTarget,w=em[d];v.style.borderColor=w.border,v.style.boxShadow=w.shadow,r?.(e);},onMouseLeave:h=>{let v=h.currentTarget;v.style.borderColor="rgba(39,39,42,0.6)",v.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:sm}),a!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[a.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"SPREAD"})]}),jsxRuntime.jsx(rm,{tier:d})]}),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(ks,{source:e.source_a,market:e.market_a,isCheaper:u===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(ks,{source:e.source_b,market:e.market_b,isCheaper:u===e.source_b,onClick:()=>t?.(e,e.source_b),href:n?.(e,e.source_b),LinkComponent:o})]}),u&&a!=null&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10},children:jsxRuntime.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",borderRadius:8,border:`1px solid ${g==="orange"?"rgba(247,104,22,0.2)":"rgba(199,255,46,0.15)"}`,background:g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)",cursor:"pointer",transition:"all 0.15s",fontSize:11,fontWeight:500,color:g==="orange"?"rgba(247,104,22,0.9)":"rgba(199,255,46,0.85)"},onMouseEnter:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,u),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,flexShrink:0,color:g==="orange"?"#f76816":"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),i("predict.matches.buyEdge",{platform:u.charAt(0).toUpperCase()+u.slice(1),spread:a.toFixed(1)}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:10,height:10,color:g==="orange"?"rgba(247,104,22,0.5)":"rgba(199,255,46,0.4)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Dn(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"})}),Dn(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 ks({source:e,market:t,isCheaper:r,onClick:n,href:o,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=Ye(e),a=im(e),d=An(t),p=Zu(t),u=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:c=>{c.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:c=>{c.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:[p&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[Dn(u)," ",s("predict.matches.volume")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:r?"#c7ff2e":"#f4f4f5"},children:d!=null?(d*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 Es=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,onSelect:o,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},d){let{t:p}=i18n.useTranslation(),{data:u,hasNextPage:m,fetchNextPage:c,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:v}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[w,C]=react.useState(0),[S,x]=react.useState(false);S&&!h?(x(false),C(I=>I+1)):h&&!S&&x(true),react.useImperativeHandle(d,()=>({refetch:()=>{v();}}),[v]);let b=react.useMemo(()=>u?.pages.flatMap(I=>I.items??[])??[],[u]),T=u?.pages[0]?.total,z=react.useMemo(()=>{let I=0,H=0,$=0;for(let J of b){let ie=J.spread??0;ie>I&&(I=ie),ie>=.03&&$++,J.combined_volume!=null&&(H+=J.combined_volume);}return {activePairs:T??b.length,maxSpread:I,highSpreadCount:$,totalVolume:H}},[b,T]);react.useEffect(()=>{z.activePairs>0&&a?.(z);},[z,a]);let ae=react.useRef(null),D=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let I=ae.current;if(!I)return;let H=new IntersectionObserver($=>{$[0]?.isIntersecting&&m&&!f&&c();},{rootMargin:"200px"});return H.observe(I),()=>H.disconnect()},[m,f,c]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(fm,{});if(b.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:p("predict.matches.empty")})});let ve=!m&&b.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
|
|
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:u?.pages.map(I=>I.items?.map((H,$)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${$*35}ms both`},children:jsxRuntime.jsx(Ps,{match:H,onSelect:o,onHover:i,getMarketHref:s,LinkComponent:l})},`${S}-${H.match_id}-${H.source_a}-${H.market_a?.slug??$}`)))}),jsxRuntime.jsxs("div",{ref:ae,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),f&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(mm,{onScrollToTop:D})]})});function mm({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 fm(){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(gm,{index:t},t))})]})}function gm({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 ym={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function km(){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 Sm({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(km,{})]})]})]})]})}function yb({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,bgImageSrc:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,d]=react.useState(false),[p,u]=react.useState(5e3),[m,c]=react.useState(),f=react.useRef(null),g=react.useCallback(C=>{l(C);},[]),h=react.useCallback(C=>{d(C);},[]),v=react.useCallback(C=>{react.startTransition(()=>{c(C);});},[]),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:u?.pages.map(I=>I.items?.map((H,$)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${$*35}ms both`},children:jsxRuntime.jsx(Ps,{match:H,onSelect:o,onHover:i,getMarketHref:s,LinkComponent:l})},`${w}-${H.match_id}-${H.source_a}-${H.market_a?.slug??$}`)))}),jsxRuntime.jsxs("div",{ref:ae,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),f&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(mm,{onScrollToTop:D})]})});function mm({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 fm(){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(gm,{index:t},t))})]})}function gm({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 ym={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function km(){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 Sm({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(km,{})]})]})]})]})}function yb({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,bgImageSrc:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,d]=react.useState(false),[p,u]=react.useState(5e3),[m,c]=react.useState(),f=react.useRef(null),g=react.useCallback(C=>{l(C);},[]),h=react.useCallback(C=>{d(C);},[]),v=react.useCallback(C=>{react.startTransition(()=>{c(C);});},[]),w=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:[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(bs,{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(ym[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(xs,{sortBy:s,onSortChange:g,sortAsc:a,onSortAscChange:h,minVolume:p,onMinVolumeChange:u,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(Es,{ref:f,sortBy:s,sortAsc:a,minVolume:p,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,onStatsChange:v})]}),jsxRuntime.jsx(Sm,{stats:m})]})}function Bn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Pm={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"}},Nm={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 Cm(e){return Pm[e]??Nm}function Mm(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 Em(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 Cb({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Mm(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[l,a]=react.useMemo(()=>Em(e,i),[e,i]),d=s!=null&&s>=3;l.yesPrice!=null&&a.yesPrice!=null?l.source==="kalshi"?l.yesPrice>a.yesPrice:a.yesPrice>l.yesPrice:false;let u=l.yesPrice!=null&&a.yesPrice!=null?l.yesPrice<=a.yesPrice?l:a:null,m=u?Ye(u.source):null,c=d?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${d?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:d?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:d?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(_s,{data:l,isCheaper:u===l,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(_s,{data:a,isCheaper:u===a,onSelect:t,getEventHref:r,LinkComponent:n})]}),u&&m&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${c==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:c==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>u.event&&t?.(u.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:c==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:c==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:u.source.charAt(0).toUpperCase()+u.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:c==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Bn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Bn(e.combined_volume_24h)," ",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 _s({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=Ye(e.source),l=Cm(e.source),a=e.event?n?.(e.event):void 0,d=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${l.border}`,background:l.bg,padding:12,cursor:a||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:p=>{p.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:p=>{p.currentTarget.style.borderColor=l.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:l.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?l.priceActiveColor:l.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Bn(e.volume)," ",i("predict.matches.volume")]})]});return a&&o?jsxRuntime.jsx(o,{href:a,className:"block",children:d}):d}function _m(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function _b({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(Hr,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.totalVolume"),value:_m(n.totalVolume)}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Hr({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Hn(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Os(e){return `${(e*100).toFixed(1)}\xA2`}function Rm(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function Db({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",Rm(e)),children:Os(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Os(t)]})]})}var ir=10,Bm=64,Bs=40,zr=48;function Hs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:s,isLoading:l,fetchNextPage:a,hasNextPage:d,isFetchingNextPage:p}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:u,isLoading:m,fetchNextPage:c,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=l||m,v=p||g,S=d||f,C=react.useMemo(()=>{let I=[];return s?.pages&&I.push(...s.pages.flatMap(H=>H.items)),u?.pages&&I.push(...u.pages.flatMap(H=>H.items)),I.sort((H,$)=>($.timestamp??0)-(H.timestamp??0)),I},[s,u]),P=Math.max(1,Math.ceil(C.length/ir)+(S?1:0)),x=(o-1)*ir,b=C.slice(x,x+ir),T=react.useCallback(()=>{i(I=>Math.max(1,I-1));},[]),z=react.useCallback(async()=>{o*ir>=C.length&&S&&(d&&await a(),f&&await c()),i(H=>H+1);},[o,C.length,S,d,f,a,c]),ae=o>1,D=o*ir<C.length||S;if(h)return jsxRuntime.jsx(Km,{height:r});if(C.length===0&&!S)return jsxRuntime.jsx(Um,{message:n("predict.profile.noHistory"),height:r});let ve=r-Bs-zr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Bs},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:[b.map((I,H)=>jsxRuntime.jsx(Hm,{trade:I},I.id??`${x+H}`)),v&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:zr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!ae,onClick:T,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",ae?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(P,5)},(I,H)=>{let $=H+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i($),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",$===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:$},$)}),jsxRuntime.jsxs("button",{type:"button",disabled:!D,onClick:z,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:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zr},children:b.map((I,H)=>jsxRuntime.jsx(zm,{trade:I},I.id??`m-${x+H}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:zr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!ae,onClick:T,className:ui.cn("text-sm cursor-pointer",ae?"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:!D,onClick:z,className:ui.cn("text-sm cursor-pointer",D?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Hm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=zs(e.type,t),s=r,l=s?"+":"-",a=s?"text-success":"text-foreground",d=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,u=e.outcome??"",m=Ks(e.timestamp),c=$s(e),f=$m(e),g=Wm(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Bm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p&&jsxRuntime.jsx("img",{src:p,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:d}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[u&&jsxRuntime.jsx("span",{className:"mr-1",children:u}),jsxRuntime.jsx("span",{children:m})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Us(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:c&&jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ws,{})})})]})}function zm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=zs(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=Ks(e.timestamp),a=$s(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:Us(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(Ws,{})})]})]})}function zs(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 $s(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function $m(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 Wm(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 Ws(){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 Um({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Km({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.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`}function Ks(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}var sr=10,Xm=64,js=40,$r=48;function Gs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:l,isLoading:a,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:u}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:c,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),v=a||c,S=u||h,C=p||g,P=react.useMemo(()=>{let $=[],J=new Set(["live","open","submitted","pending"]);return l?.pages&&$.push(...l.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),m?.pages&&$.push(...m.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),$},[l,m]),x=react.useCallback($=>{o.mutate({source:$.source,id:$.id});},[o]),b=Math.max(1,Math.ceil(P.length/sr)+(C?1:0)),T=(i-1)*sr,z=P.slice(T,T+sr),ae=react.useCallback(()=>{s($=>Math.max(1,$-1));},[]),D=react.useCallback(async()=>{i*sr>=P.length&&C&&(p&&await d(),g&&await f()),s(J=>J+1);},[i,P.length,C,p,g,d,f]),ve=i>1,I=i*sr<P.length||C;if(v)return jsxRuntime.jsx(tf,{height:r});if(P.length===0&&!C)return jsxRuntime.jsx(ef,{message:n("predict.profile.noOrders"),height:r});let H=r-js-$r;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:js},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:H},children:[z.map($=>jsxRuntime.jsx(Zm,{order:$,onCancel:x},$.id)),S&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Ys,{className:"hidden lg:flex",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:ae,onNext:D,onPage:s,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-$r},children:z.map($=>jsxRuntime.jsx(Jm,{order:$,onCancel:x},$.id))}),jsxRuntime.jsx(Ys,{className:"lg:hidden",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:ae,onNext:D,onPage:s,t:n,compact:true})]})}function Zm({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:Xm},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?qs(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Jm({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?qs(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 Ys({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:s,onPage:l,t:a,compact:d}){return d?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:$r},children:[jsxRuntime.jsx("button",{type:"button",disabled:!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:$r},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)},(p,u)=>{let m=u+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(m),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",m===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:m},m)}),jsxRuntime.jsxs("button",{type:"button",disabled:!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 ef({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function tf({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function qs(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Kn=10,sf=64,Qs=40,Wr=48;function Xs({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(df,{height:r});if(e.length===0)return jsxRuntime.jsx(cf,{message:i("predict.profile.noPositions"),height:r});let d=Math.max(1,Math.ceil(e.length/Kn)),p=(s-1)*Kn,u=e.slice(p,p+Kn),m=s>1,c=s<d,f=r-Qs-Wr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Qs},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:u.map((g,h)=>jsxRuntime.jsx(af,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??p+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Wr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(d,5)},(g,h)=>{let v=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(v),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",v===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:v},v)}),jsxRuntime.jsxs("button",{type:"button",disabled:!c,onClick:()=>l(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Wr},children:u.map((g,h)=>jsxRuntime.jsx(lf,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${p+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Wr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!c,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function af({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,d=e.size,p=o>0?"text-success":o<0?"text-danger":"text-foreground",u=o>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?pf(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:sf},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[c&&jsxRuntime.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",a.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:e.size})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*s).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Vn(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Vn(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",p),children:[jsxRuntime.jsxs("span",{children:[u,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function lf({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?"+":"",d=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:d})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(Ur,{label:n("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Ur,{label:n("predict.profile.markPrice"),value:Vn(s)}),jsxRuntime.jsx(Ur,{label:n("predict.profile.pnl"),value:`${a}$${Math.abs(o).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx(Ur,{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 Ur({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function cf({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function df({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Vn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function pf(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}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 c of e)l+=c.realized_pnl??0,a+=c.current_value??c.size*(c.current_price??0);let d=0,p=0,u=0;for(let c of t)d+=c.usd_size??0,c.type==="REDEEM"&&(u++,(c.usd_size??0)>0&&p++);let m=u>0?`${p} / ${u}`:"0 / 0";return {realizedPnl:l,positionsValue:a,volume:d,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(Yn,{label:n("predict.profile.winRate"),value:o.winRateStr,isLoading:r}),jsxRuntime.jsx(Yn,{label:n("predict.profile.positions"),value:`$${o.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Yn,{label:n("predict.profile.volume"),value:`$${o.volume.toFixed(2)}`,isLoading:r})]})]})}function Yn({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Gn=600;function bf({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState("positions"),l=!!(e||t),{data:a,isLoading:d}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:p,isLoading:u}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let T=[];return a?.positions&&T.push(...a.positions),p?.positions&&T.push(...p.positions),T},[a,p]),c=d||u,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:v}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),S=react.useMemo(()=>[...f?.pages?.flatMap(z=>z.items)??[],...h?.pages?.flatMap(z=>z.items)??[]],[f,h]),C=c||g||v,P=m.length,b=[{key:"positions",label:P>0?`${o("predict.profile.positionsTab")} (${P})`: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:S,isLoading:C}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:b.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(T.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===T.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:T.label},T.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Xs,{positions:m,isLoading:c,listHeight:Gn,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(Gs,{solanaAddress:e,evmAddress:t,listHeight:Gn}),i==="history"&&jsxRuntime.jsx(Hs,{solanaAddress:e,evmAddress:t,listHeight:Gn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function _1({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(false),[a,d]=react.useState(null),[p,u]=react.useState(false),m=r||p,c=n||p,f=m?"done":s?"running":"pending",g=c?"done":m&&s?"running":"pending",h=m&&c,v=react.useCallback(async()=>{d(null),u(false),l(true);try{await o(),u(!0);}catch(x){d(x instanceof Error?x.message:String(x));}finally{l(false);}},[o]),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}],C=()=>{h?t():v();},P=i(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:x=>{x||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:S.map((x,b)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Pf,{index:b+1,status:x.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:x.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${x.status==="done"?"text-[#c7ff2e]":x.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:x.status==="done"?i("predict.setup.stepComplete"):x.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:x.desc})]})]},x.key))}),a&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:a})}),jsxRuntime.jsx("button",{type:"button",onClick:C,disabled:s,className:h?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):P}),!h&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Pf({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})}
|
|
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(bs,{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(ym[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(xs,{sortBy:s,onSortChange:g,sortAsc:a,onSortAscChange:h,minVolume:p,onMinVolumeChange:u,onRefresh:w})]})]}),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(Es,{ref:f,sortBy:s,sortAsc:a,minVolume:p,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,onStatsChange:v})]}),jsxRuntime.jsx(Sm,{stats:m})]})}function Bn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Pm={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"}},Nm={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 Cm(e){return Pm[e]??Nm}function Mm(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 Em(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 Cb({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Mm(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[l,a]=react.useMemo(()=>Em(e,i),[e,i]),d=s!=null&&s>=3;l.yesPrice!=null&&a.yesPrice!=null?l.source==="kalshi"?l.yesPrice>a.yesPrice:a.yesPrice>l.yesPrice:false;let u=l.yesPrice!=null&&a.yesPrice!=null?l.yesPrice<=a.yesPrice?l:a:null,m=u?Ye(u.source):null,c=d?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${d?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:d?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:d?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(_s,{data:l,isCheaper:u===l,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(_s,{data:a,isCheaper:u===a,onSelect:t,getEventHref:r,LinkComponent:n})]}),u&&m&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${c==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:c==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>u.event&&t?.(u.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:c==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:c==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:u.source.charAt(0).toUpperCase()+u.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:c==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Bn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Bn(e.combined_volume_24h)," ",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 _s({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=Ye(e.source),l=Cm(e.source),a=e.event?n?.(e.event):void 0,d=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${l.border}`,background:l.bg,padding:12,cursor:a||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:p=>{p.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:p=>{p.currentTarget.style.borderColor=l.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:l.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?l.priceActiveColor:l.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Bn(e.volume)," ",i("predict.matches.volume")]})]});return a&&o?jsxRuntime.jsx(o,{href:a,className:"block",children:d}):d}function _m(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function _b({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(Hr,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.totalVolume"),value:_m(n.totalVolume)}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Hn,{}),jsxRuntime.jsx(Hr,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Hr({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Hn(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Os(e){return `${(e*100).toFixed(1)}\xA2`}function Rm(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function Db({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",Rm(e)),children:Os(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Os(t)]})]})}var ir=10,Bm=64,Bs=40,zr=48;function Hs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:s,isLoading:l,fetchNextPage:a,hasNextPage:d,isFetchingNextPage:p}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:u,isLoading:m,fetchNextPage:c,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=l||m,v=p||g,w=d||f,C=react.useMemo(()=>{let I=[];return s?.pages&&I.push(...s.pages.flatMap(H=>H.items)),u?.pages&&I.push(...u.pages.flatMap(H=>H.items)),I.sort((H,$)=>($.timestamp??0)-(H.timestamp??0)),I},[s,u]),S=Math.max(1,Math.ceil(C.length/ir)+(w?1:0)),x=(o-1)*ir,b=C.slice(x,x+ir),T=react.useCallback(()=>{i(I=>Math.max(1,I-1));},[]),z=react.useCallback(async()=>{o*ir>=C.length&&w&&(d&&await a(),f&&await c()),i(H=>H+1);},[o,C.length,w,d,f,a,c]),ae=o>1,D=o*ir<C.length||w;if(h)return jsxRuntime.jsx(Km,{height:r});if(C.length===0&&!w)return jsxRuntime.jsx(Um,{message:n("predict.profile.noHistory"),height:r});let ve=r-Bs-zr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Bs},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:[b.map((I,H)=>jsxRuntime.jsx(Hm,{trade:I},I.id??`${x+H}`)),v&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:zr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!ae,onClick:T,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",ae?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(S,5)},(I,H)=>{let $=H+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i($),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",$===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:$},$)}),jsxRuntime.jsxs("button",{type:"button",disabled:!D,onClick:z,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:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zr},children:b.map((I,H)=>jsxRuntime.jsx(zm,{trade:I},I.id??`m-${x+H}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:zr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!ae,onClick:T,className:ui.cn("text-sm cursor-pointer",ae?"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:!D,onClick:z,className:ui.cn("text-sm cursor-pointer",D?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Hm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=zs(e.type,t),s=r,l=s?"+":"-",a=s?"text-success":"text-foreground",d=e.event?.title??e.market?.question??"\u2014",p=e.event?.image_url,u=e.outcome??"",m=Ks(e.timestamp),c=$s(e),f=$m(e),g=Wm(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Bm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[p&&jsxRuntime.jsx("img",{src:p,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:d}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[u&&jsxRuntime.jsx("span",{className:"mr-1",children:u}),jsxRuntime.jsx("span",{children:m})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Us(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:c&&jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ws,{})})})]})}function zm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",n=e.price??0,o=e.usd_size??0,i=zs(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=Ks(e.timestamp),a=$s(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:Us(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(Ws,{})})]})]})}function zs(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 $s(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function $m(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 Wm(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 Ws(){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 Um({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Km({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.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`}function Ks(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}var sr=10,Xm=64,js=40,$r=48;function Gs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:l,isLoading:a,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:u}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:m,isLoading:c,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),v=a||c,w=u||h,C=p||g,S=react.useMemo(()=>{let $=[],J=new Set(["live","open","submitted","pending"]);return l?.pages&&$.push(...l.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),m?.pages&&$.push(...m.pages.flatMap(ie=>ie.items).filter(ie=>J.has(ie.status))),$},[l,m]),x=react.useCallback($=>{o.mutate({source:$.source,id:$.id});},[o]),b=Math.max(1,Math.ceil(S.length/sr)+(C?1:0)),T=(i-1)*sr,z=S.slice(T,T+sr),ae=react.useCallback(()=>{s($=>Math.max(1,$-1));},[]),D=react.useCallback(async()=>{i*sr>=S.length&&C&&(p&&await d(),g&&await f()),s(J=>J+1);},[i,S.length,C,p,g,d,f]),ve=i>1,I=i*sr<S.length||C;if(v)return jsxRuntime.jsx(tf,{height:r});if(S.length===0&&!C)return jsxRuntime.jsx(ef,{message:n("predict.profile.noOrders"),height:r});let H=r-js-$r;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:js},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:H},children:[z.map($=>jsxRuntime.jsx(Zm,{order:$,onCancel:x},$.id)),w&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Ys,{className:"hidden lg:flex",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:ae,onNext:D,onPage:s,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-$r},children:z.map($=>jsxRuntime.jsx(Jm,{order:$,onCancel:x},$.id))}),jsxRuntime.jsx(Ys,{className:"lg:hidden",currentPage:i,totalPages:b,canGoPrev:ve,canGoNext:I,onPrev:ae,onNext:D,onPage:s,t:n,compact:true})]})}function Zm({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:Xm},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?qs(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Jm({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?qs(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 Ys({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:s,onPage:l,t:a,compact:d}){return d?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:$r},children:[jsxRuntime.jsx("button",{type:"button",disabled:!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:$r},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)},(p,u)=>{let m=u+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(m),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",m===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:m},m)}),jsxRuntime.jsxs("button",{type:"button",disabled:!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 ef({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function tf({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function qs(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Kn=10,sf=64,Qs=40,Wr=48;function Xs({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(df,{height:r});if(e.length===0)return jsxRuntime.jsx(cf,{message:i("predict.profile.noPositions"),height:r});let d=Math.max(1,Math.ceil(e.length/Kn)),p=(s-1)*Kn,u=e.slice(p,p+Kn),m=s>1,c=s<d,f=r-Qs-Wr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Qs},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:u.map((g,h)=>jsxRuntime.jsx(af,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??p+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Wr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(d,5)},(g,h)=>{let v=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(v),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",v===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:v},v)}),jsxRuntime.jsxs("button",{type:"button",disabled:!c,onClick:()=>l(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Wr},children:u.map((g,h)=>jsxRuntime.jsx(lf,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${p+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Wr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!c,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",c?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function af({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,d=e.size,p=o>0?"text-success":o<0?"text-danger":"text-foreground",u=o>0?"+":"",m=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?pf(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:sf},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[c&&jsxRuntime.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",a.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:e.size})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*s).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Vn(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Vn(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",p),children:[jsxRuntime.jsxs("span",{children:[u,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function lf({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?"+":"",d=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:d})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(Ur,{label:n("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Ur,{label:n("predict.profile.markPrice"),value:Vn(s)}),jsxRuntime.jsx(Ur,{label:n("predict.profile.pnl"),value:`${a}$${Math.abs(o).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx(Ur,{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 Ur({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function cf({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function df({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Vn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function pf(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?"+":"-",d=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${a}${d})`}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 c of e)l+=c.realized_pnl??0,a+=c.current_value??c.size*(c.current_price??0);let d=0,p=0,u=0;for(let c of t)d+=c.usd_size??0,c.type==="REDEEM"&&(u++,(c.usd_size??0)>0&&p++);let m=u>0?`${p} / ${u}`:"0 / 0";return {realizedPnl:l,positionsValue:a,volume:d,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(Yn,{label:n("predict.profile.winRate"),value:o.winRateStr,isLoading:r}),jsxRuntime.jsx(Yn,{label:n("predict.profile.positions"),value:`$${o.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Yn,{label:n("predict.profile.volume"),value:`$${o.volume.toFixed(2)}`,isLoading:r})]})]})}function Yn({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Gn=600;function bf({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState("positions"),l=!!(e||t),{data:a,isLoading:d}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:p,isLoading:u}=reactPredict.usePositions({source:"polymarket",user:t??""}),m=react.useMemo(()=>{let T=[];return a?.positions&&T.push(...a.positions),p?.positions&&T.push(...p.positions),T},[a,p]),c=d||u,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:v}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),w=react.useMemo(()=>[...f?.pages?.flatMap(z=>z.items)??[],...h?.pages?.flatMap(z=>z.items)??[]],[f,h]),C=c||g||v,S=m.length,b=[{key:"positions",label:S>0?`${o("predict.profile.positionsTab")} (${S})`: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:w,isLoading:C}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:b.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(T.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===T.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:T.label},T.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Xs,{positions:m,isLoading:c,listHeight:Gn,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(Gs,{solanaAddress:e,evmAddress:t,listHeight:Gn}),i==="history"&&jsxRuntime.jsx(Hs,{solanaAddress:e,evmAddress:t,listHeight:Gn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function _1({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState(false),[a,d]=react.useState(null),[p,u]=react.useState(false),m=r||p,c=n||p,f=m?"done":s?"running":"pending",g=c?"done":m&&s?"running":"pending",h=m&&c,v=react.useCallback(async()=>{d(null),u(false),l(true);try{await o(),u(!0);}catch(x){d(x instanceof Error?x.message:String(x));}finally{l(false);}},[o]),w=[{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}],C=()=>{h?t():v();},S=i(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:x=>{x||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:w.map((x,b)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Pf,{index:b+1,status:x.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:x.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${x.status==="done"?"text-[#c7ff2e]":x.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:x.status==="done"?i("predict.setup.stepComplete"):x.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:x.desc})]})]},x.key))}),a&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:a})}),jsxRuntime.jsx("button",{type:"button",onClick:C,disabled:s,className:h?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):S}),!h&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Pf({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
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=Wf;exports.CHART_RANGE_PERIOD=zf;exports.CHART_RANGE_SAMPLE_INTERVAL=$f;exports.CandlestickPeriod=gr;exports.CategoriesSkeleton=_f;exports.CategoriesUI=uo;exports.CategoriesWidget=go;exports.ChartRange=Ee;exports.DEFAULT_CHART_RANGE=hr;exports.DEFAULT_FILTER_STATE=ln;exports.DEFAULT_PAGE_SIZE=Ut;exports.DEFAULT_PRICE_HISTORY_INTERVAL=jf;exports.EventDetailPage=Jh;exports.EventDetailSkeleton=Zt;exports.EventDetailUI=Bi;exports.EventDetailWidget=Hi;exports.EventItem=ri;exports.EventMarketDepthChartUI=wi;exports.EventMarketDetailWidget=Ei;exports.EventPriceChart=_i;exports.EventsFilterUI=Oo;exports.EventsHero=Ao;exports.EventsPage=_0;exports.EventsPageSkeleton=r0;exports.EventsSkeleton=dn;exports.EventsToolbarUI=Wo;exports.EventsUI=ai;exports.EventsWidget=ci;exports.KycModal=No;exports.MAX_PRICE_HISTORY_MARKETS=Jr;exports.MatchGroupCard=Cb;exports.MatchMarketCard=Ps;exports.MatchesFilterBar=xs;exports.MatchesHero=bs;exports.MatchesPage=yb;exports.MatchesStatsBar=_b;exports.MatchesWidget=Es;exports.ORDER_MAX_PRICE=Vf;exports.ORDER_MIN_PRICE=Kf;exports.ORDER_MIN_QUANTITY=vr;exports.ORDER_MIN_USDC=xr;exports.ORDER_PRICE_STEP=Uf;exports.PREDICT_SEARCH_MODAL_ID=Rn;exports.PREDICT_TRADE_MODAL_ID=Kt;exports.PRICE_HISTORY_SAMPLE_INTERVAL=Yf;exports.PredictSearchModal=Mx;exports.PredictTradeModal=yr;exports.PredictWalletProvider=za;exports.PriceHistoryInterval=Mt;exports.ProfilePage=bf;exports.SORT_PRESETS=$o;exports.STATIC_CATEGORIES=Zr;exports.SearchEventsButton=Ax;exports.SearchHistoryUI=qi;exports.SearchHistoryWidget=Qi;exports.SearchInputUI=Xi;exports.SearchResultItemUI=Zi;exports.SearchResultListWidget=ns;exports.SearchWidget=ls;exports.SetupModal=_1;exports.SimilarEventCard=Sp;exports.SimilarEventsSection=Ui;exports.SourceBadge=Rh;exports.SpreadIndicator=Db;exports.TradeFormSkeleton=hi;exports.TradeFormUI=Ro;exports.TradeFormWidget=br;exports.UserActivitySection=mi;exports.countActiveFilters=cn;exports.formatKMB=Jt;exports.getSourceMeta=Ye;exports.useEventDetail=sv;exports.useEventsInfinite=Vo;exports.usePredictSearchHistory=Dr;exports.usePredictWallet=tn;exports.useSearchResultListScript=Ji;exports.useSearchScript=as;exports.useTradeForm=Po;exports.version=Na;//# sourceMappingURL=index.js.map
|
|
148
148
|
//# sourceMappingURL=index.js.map
|