@liberfi.io/ui-predict 0.1.118 → 0.1.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -13,7 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  }
16
- declare const _default: "0.1.118";
16
+ declare const _default: "0.1.119";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare global {
13
13
  };
14
14
  }
15
15
  }
16
- declare const _default: "0.1.118";
16
+ declare const _default: "0.1.119";
17
17
 
18
18
  /**
19
19
  * A single category entry in the static navigation model.
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.118");var ks="0.1.118";var Ss={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},lo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zr=(()=>{let e=t=>{let r=lo.indexOf(t);return r===-1?lo.length:r};return Object.entries(Ss).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function uo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),p=react.useCallback(()=>{n(null);},[n]),u=c("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(co,{label:u,isSelected:t===null,onPress:p,showPulse:u===l}),jsxRuntime.jsx(Cs,{}),e.map(m=>jsxRuntime.jsx(co,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===l},m.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(po,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(po,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function co({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function Cs(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function po({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function wf({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function Ms(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Es(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function go({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,s]=react.useState(null),l=react.useCallback(m=>{n(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),a=react.useCallback(m=>{s(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),c=Ms(Zr),p=Zr.find(m=>m.slug===o),u=Es(p);return jsxRuntime.jsx(uo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function ho(e){return {title:e.title,imageUrl:e.image_url}}function vo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Wt=48,Jr=4,fr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},gr=Ee.ALL,Rf={[Ee.ONE_DAY]:fr.ONE_MINUTE,[Ee.ONE_WEEK]:fr.ONE_HOUR,[Ee.ONE_MONTH]:fr.ONE_HOUR,[Ee.ALL]:fr.ONE_DAY},If={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},Of={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},hr=1,vr=1,Af=1,Df=1,Ff=99,Pt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Bf=Pt.ONE_WEEK,Hf={[Pt.ONE_HOUR]:60,[Pt.SIX_HOURS]:60,[Pt.ONE_DAY]:300,[Pt.ONE_WEEK]:1800,[Pt.MAX]:1800};var yo=react.createContext(null);function tn(){let e=react.useContext(yo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var As=1e4;function Ds({pollingInterval:e=As,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[o]),{data:s,isLoading:l,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:p,isLoading:u}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:m,isLoading:d}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:h,isLoading:v,isFetching:N,error:M}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),w=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:d,isLoading:l||v,isFetching:a||N,error:c??M??null}),[n,i,f,s,h,g,p,u,m,d,l,v,a,N,c,M]);return jsxRuntime.jsx(yo.Provider,{value:w,children:r})}var ol={minutes:60,hours:3600,days:86400};function il(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*ol[r]}}function nn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};rn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function No({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),p=e.source,u=p==="polymarket",m=i.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),d=i.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),f=n==="authenticated",g=m?.address,h=d?.address,v=react.useMemo(()=>{if(p!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[p,e.provider_meta]),{data:N}=reactPredict.useTickSize(v),M=N?.minimum_tick_size?String(N.minimum_tick_size):"0.01",[w,x]=react.useState(t),[b,E]=react.useState(r),[z,se]=react.useState("market"),[A,ve]=react.useState(NaN),[I,H]=react.useState(NaN),[$,J]=react.useState(false),[ie,C]=react.useState(null),[_,G]=react.useState(null),[D,pe]=react.useState(false),[le,we]=react.useState(false),[Ge,pt]=react.useState("1h"),[Ke,Ot]=react.useState(30),[At,ut]=react.useState("minutes"),Be=null,sr=false,lr=null,wt;try{let k=tn();Be={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},sr=k.kalshiKycVerified,lr=k.kalshiKycUrl,wt=k.polymarketSafeAddress;}catch{}let Pe=react.useMemo(()=>{let k=w==="yes"?0:1,q=e.outcomes[k];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,w,b]),Kr=react.useCallback(k=>{se(k);},[]),Dt=react.useCallback(k=>{x(k),H(NaN);},[]);react.useEffect(()=>{z==="limit"&&isNaN(I)&&H(Math.round(Pe*100)/100);},[z,I,Pe]);let Vr=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Pe>0?A/Pe:0:A,[b,A,Pe]),T=react.useMemo(()=>isNaN(A)||A<=0?"0":String(Math.round(A*1e6)),[A]),Ce=e.provider_meta?.["dflow.yesMint"]??"",qe=e.provider_meta?.["dflow.noMint"]??"",mt=utils.SOLANA_TOKENS.stablecoins.USDC.address,es=e.provider_meta?.["dflow.collateralMint"]||"",Qn=w==="yes"?Ce:qe,Xn=p==="kalshi"?g??"":h??"",{data:De,isLoading:ts}=reactPredict.usePositions({source:p,user:Xn},{enabled:!!Xn}),Zn=react.useMemo(()=>!De||b!=="sell"?null:De.positions.find(k=>k.side?.toLowerCase()===w&&k.market?.slug===e.slug)??null,[De,e.slug,w,b])?.market?.provider_meta,rs=b==="sell"&&Zn?.["dflow.outcomeMint"]||Qn,Ft=b==="sell"&&Zn?.["dflow.collateralMint"]||es,Bt=b==="buy"?mt:rs,Ht=b==="buy"?Qn:Ft||mt,ns=p==="kalshi"&&!!Bt&&!!Ht&&!!g&&T!=="0",{refetch:Jn}=reactPredict.useDFlowQuote({inputMint:Bt,outputMint:Ht,amount:T,userPublicKey:g??"",slippageBps:100},{enabled:ns}),cr=react.useMemo(()=>Be?p==="kalshi"?Be.kalshiUsdcBalance:Be.polymarketUsdcBalance:De&&De.positions.reduce((q,Me)=>Me.side==="USDC"||Me.side==="collateral"?q+(Me.current_value??0):q,0)||null,[Be,De,p]),os=Be?Be.isLoading:ts,jr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Yr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Gr=react.useMemo(()=>z==="limit"&&u&&!isNaN(I)?I:Pe,[z,u,I,Pe]),dr=react.useMemo(()=>{if(isNaN(A)||A<=0)return 0;if(b==="buy")return A;let k=w==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return A*k},[b,w,A,e.outcomes]),eo=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Gr>0?A/Gr*1:0:dr,[b,A,Gr,dr]),is=eo-dr,as=react.useCallback(k=>{E(k),ve(NaN);},[]),ss=react.useCallback(k=>{if(isNaN(k)){ve(NaN);return}let q=Math.max(0,k),Me=b==="buy"?Math.round(q*100)/100:Math.round(q);ve(Me);},[b]),ls=react.useCallback(k=>{if(isNaN(k)){H(NaN);return}let q=Math.max(.01,Math.min(.99,k));H(Math.round(q*100)/100);},[]),zt=react.useCallback(()=>{ve(NaN),H(NaN),se("market"),we(false),pt("1h"),Ot(30),ut("minutes");},[]),qr=react.useMemo(()=>{let k=[];isNaN(A)||A<=0?b==="buy"?k.push(o("predict.trade.minAmountUsd",{amount:vr})):k.push(o("predict.trade.minQuantity",{amount:hr})):b==="buy"&&A<vr?k.push(o("predict.trade.minAmountUsd",{amount:vr})):b==="sell"&&A<hr&&k.push(o("predict.trade.minQuantity",{amount:hr})),e.status!=="open"&&k.push(o("predict.trade.marketNotActive")),b==="buy"&&cr!=null&&!isNaN(A)&&A>0&&A>cr&&k.push(o("predict.trade.insufficientBalance"));let q=w==="yes"?jr:Yr;return b==="sell"&&q!=null&&!isNaN(A)&&A>0&&A>q&&k.push(o("predict.trade.insufficientShares")),z==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&k.push(o("predict.trade.limitPriceRange")),z==="limit"&&u&&le&&Ge==="custom"&&(isNaN(Ke)||Ke<=0)&&k.push(o("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[A,e.status,b,p,cr,jr,Yr,w,z,u,I,le,Ge,Ke,o]),{mutateAsync:pr}=reactPredict.useDFlowSubmit(),{data:Qr}=reactPredict.useOrder({id:ie??"",source:p},{enabled:!!ie}),to=react.useCallback(async()=>{if(!_||!g||!m)return;let{cashAmount:k,collateral:q}=_;G(null);try{let ft=(await l.createDFlowQuote({inputMint:q,outputMint:mt,amount:k,userPublicKey:g,slippageBps:100}))?.transaction;if(!ft)return;let nt=Uint8Array.from(atob(ft),$t=>$t.charCodeAt(0)),Qe=await m.signTransaction(nt);await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:q,output_mint:mt,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,g,m,l,pr,mt]);react.useEffect(()=>{if(!Qr||!ie)return;let{status:k}=Qr;k==="closed"?(C(null),_?to().finally(()=>{J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt();}):(J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt())):(k==="failed"||k==="expired")&&(J(false),C(null),G(null),ui.toast.error(o("predict.trade.submitError")));},[Qr,ie,_,to,zt,o]);let ro=react.useCallback(async()=>{if(!g||!m)return;if(!Bt||!Ht){ui.toast.error("Missing token mint addresses"),J(false);return}if(!sr){pe(true),J(false);return}let Me=(await Jn()).data,ft=Me?.transaction;if(!ft){ui.toast.error(o("predict.trade.submitError")),J(false);return}if(b==="sell"&&Ft&&Ft!==mt){let ot=String(Me?.outAmount??"");ot&&ot!=="0"&&G({cashAmount:ot,collateral:Ft});}let nt=Uint8Array.from(atob(ft),ot=>ot.charCodeAt(0)),Qe=await m.signTransaction(nt),$t=await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:Bt,output_mint:Ht,amount:T,price:String(Pe),side:b==="buy"?"BUY":"SELL",outcome:w==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});C($t.signature);},[g,m,l,Jn,pr,Bt,Ht,T,Pe,b,w,e.slug,Ft,mt,o]),no=react.useCallback(async()=>{if(!d||!a)return;let k=d.chain,q=k!==types.Chain.POLYGON;q&&await s(types.Chain.POLYGON);try{let Me=await d.getEip1193Provider();if(!Me){ui.toast.error(o("predict.trade.submitError")),J(!1);return}let ft=!!wt,nt={address:d.address,signatureType:ft?2:0,signTypedData:async(gt,vs,xs,bs)=>{let Nt=[];"name"in gt&&Nt.push({name:"name",type:"string"}),"version"in gt&&Nt.push({name:"version",type:"string"}),"chainId"in gt&&Nt.push({name:"chainId",type:"uint256"}),"verifyingContract"in gt&&Nt.push({name:"verifyingContract",type:"address"}),"salt"in gt&&Nt.push({name:"salt",type:"bytes32"});let ys={EIP712Domain:Nt,...vs};return await Me.request({method:"eth_signTypedData_v4",params:[d.address,JSON.stringify({domain:gt,types:ys,primaryType:xs,message:bs})]})}},Qe=a.credentials??await a.authenticate(nt),$t=w==="yes"?0:1,ot="",ur=e.provider_meta?.["polymarket.clobTokenIds"];ur&&(ot=(typeof ur=="string"?JSON.parse(ur):ur)[$t]??"");let oo=e.provider_meta?.["polymarket.negRisk"]??!1,Xr=z==="limit"&&!isNaN(I)?I:Pe,ds=z==="limit"?le?"GTD":"GTC":"FOK",ps=b==="buy"&&Xr>0?A/Xr:A,io={tokenId:ot,price:Xr,size:ps,side:b==="buy"?"BUY":"SELL",orderType:ds,tickSize:M,negRisk:oo,...wt&&{funderAddress:wt},...z==="limit"&&le&&{expiration:il(Ge,Ke,At)}},us=reactPredict.buildCtfExchangeDomain(oo),ao=reactPredict.buildOrderMessage({...io,signerAddress:nt.address,signatureType:nt.signatureType}),ms=await nt.signTypedData(us,reactPredict.CTF_ORDER_TYPES,"Order",ao),fs=reactPredict.buildSignedOrder(ao,ms,io.orderType),so=reactPredict.buildClobPayload(fs,Qe.apiKey),gs=JSON.stringify(so),hs=await reactPredict.buildPolymarketL2Headers(Qe.address,{apiKey:Qe.apiKey,secret:Qe.secret,passphrase:Qe.passphrase,method:"POST",requestPath:"/order",body:gs});await l.createPolymarketOrder(so,hs),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt(),J(!1);}finally{q&&k&&s(k).catch(()=>{});}},[d,a,s,w,e.provider_meta,z,I,Pe,A,b,l,c,le,Ge,Ke,At,zt,o]),cs=react.useCallback(async()=>{if(!(!qr.isValid||!f)){J(true),C(null),pe(false);try{p==="kalshi"?await ro():await no();}catch(k){let q=k instanceof Error?k.message:void 0;ui.toast.error(q||o("predict.trade.submitError")),J(false);}}},[qr.isValid,f,p,ro,no,o]);return {outcome:w,side:b,orderType:z,quantity:A,limitPrice:I,shares:Vr,estimatedCost:dr,potentialPayout:eo,potentialProfit:is,usdcBalance:cr,yesTokenBalance:jr,noTokenBalance:Yr,isBalanceLoading:os,isSubmitting:$,validation:qr,supportsLimitOrder:u,kycRequired:D,kycUrl:lr,expirationEnabled:le,expirationPreset:Ge,customDuration:Ke,customDurationUnit:At,setOutcome:Dt,setSide:as,setOrderType:Kr,setQuantity:ss,setLimitPrice:ls,setExpirationEnabled:we,setExpirationPreset:pt,setCustomDuration:Ot,setCustomDurationUnit:ut,submit:cs}}function Po({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:n=>{n||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(n=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:o(n)})]},n))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[o("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:o("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.ok")})]})]})})})}var bl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,yl=["5m","1h","12h","24h","eod","custom"],kl={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Sl=["minutes","hours","days"],wl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Io({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:c,potentialPayout:p,estimatedCost:u,usdcBalance:m,yesTokenBalance:d,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:v,validationErrors:N,supportsLimitOrder:M,kycRequired:w,kycUrl:x,expirationEnabled:b,expirationPreset:E,customDuration:z,customDurationUnit:se,onOutcomeChange:A,onSideChange:ve,onOrderTypeChange:I,onQuantityChange:H,onLimitPriceChange:$,onExpirationEnabledChange:J,onExpirationPresetChange:ie,onCustomDurationChange:C,onCustomDurationUnitChange:_,onSubmit:G}){let{t:D}=i18n.useTranslation(),[pe,le]=react.useState(false),we=ui.useDisclosure(),[Ge,pt]=react.useState(""),Ke=react.useRef(false),Ot=react.useRef(n);react.useEffect(()=>{Ke.current||pt(isNaN(s)?"":String(s));},[s]),react.useEffect(()=>{n!==Ot.current&&(Ot.current=n,pt(""));},[n]);let At=react.useCallback(T=>{if(T!==""&&!(n==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(T))return;if(pt(T),Dt(false),T===""||T==="."){H(NaN);return}let qe=parseFloat(T);isNaN(qe)||H(qe);},[n,H]);react.useEffect(()=>{w&&!we.isOpen&&we.onOpen();},[w]);let ut=react.useMemo(()=>{let T=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return T!=null?parseFloat((Number(T)*100).toFixed(2)):null},[n,o,t]),Be=!isNaN(s)&&s>0,sr=react.useMemo(()=>{if(g)return D("predict.trade.loadingBalance");if(h)return D("predict.trade.submitting");if(w)return D("predict.trade.kycRequired");if(!Be)return D("predict.trade.enterAmount");let T=D(n==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=D(o==="yes"?"predict.trade.yes":"predict.trade.no"),qe=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${T} ${Ce}${qe}`},[g,h,w,Be,n,o,c,D]),lr=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),wt=()=>{H(Math.floor((m??0)/2*100)/100);},Pe=()=>{H(m??0);},[Kr,Dt]=react.useState(false),Vr=()=>{if(w){we.onOpen();return}if(!v){Dt(true);return}Dt(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:o==="yes"?"text-bullish":"text-bearish",children:[D(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",D(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[M?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:T=>I(T),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:D("predict.trade.market")}),i==="limit"&&M?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:T=>$(T/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ut!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ut," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(T=>{let Ce=T==="yes"?d:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(T),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===T?T==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:D(T==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let qe=n==="buy"?T==="yes"?t.yesAsk:t.noAsk:T==="yes"?t.yesBid:t.noBid;return qe!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(qe)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===T&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${Ce??0} shares`})]},T)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:D(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:bl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:wt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Pe,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:n==="buy"?"decimal":"numeric",value:Ge,onChange:T=>At(T.target.value),onFocus:()=>{Ke.current=true;},onBlur:()=>{Ke.current=false,pt(isNaN(s)?"":String(s));},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(T=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(Math.floor((o==="yes"?d??0:f??0)*T/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[T,"%"]},T)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{H(o==="yes"?d??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:D("common.all")})]}),Kr&&N.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:N.map(T=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:T},T))})]}),i==="limit"&&M&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:D("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:J,"aria-label":D("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":D("predict.trade.setExpiration"),selectedKeys:[E],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&ie(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:yl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(kl[T])},T))}),E==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:C,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[se],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Sl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(wl[T])},T))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>le(T=>!T),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:D("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",pe&&"rotate-180")})]}),ut!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[ut,"% chance"]})]}),pe&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(s)&&s>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:lr,fullWidth:true,radius:"lg",size:"lg",isDisabled:g||!Be||h,isLoading:h||g,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:Vr,children:sr})]}),jsxRuntime.jsx(Po,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:x})]})}function xr({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:i}){let{outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,validation:w,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,setOutcome:I,setSide:H,setOrderType:$,setQuantity:J,setLimitPrice:ie,setExpirationEnabled:C,setExpirationPreset:_,setCustomDuration:G,setCustomDurationUnit:D,submit:pe}=No({market:t,initialSide:o,initialOutcome:n}),le=walletConnector.useAuthCallback(pe),we=react.useMemo(()=>e?ho(e):void 0,[e]),Ge=react.useMemo(()=>vo(t),[t]);return jsxRuntime.jsx(Io,{event:we,market:Ge,variant:r,outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,isValid:w.isValid,validationErrors:w.errors,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,onOutcomeChange:I,onSideChange:H,onOrderTypeChange:$,onQuantityChange:J,onLimitPriceChange:ie,onExpirationEnabledChange:C,onExpirationPresetChange:_,onCustomDurationChange:G,onCustomDurationUnitChange:D,onSubmit:le})}var Ut="predict-trade";function br({id:e=Ut}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_l,{...t})})}function _l({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(xr,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function cn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Ao({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(h=>{h?s(r):t();},[r,t]),a=react.useCallback(()=>{s(ln);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),p=react.useCallback((h,v)=>{s(N=>({...N,[h]:v}));},[]),u=react.useMemo(()=>cn(i),[i]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),d=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,size:"md",backdrop:"blur",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.filter.title")}),jsxRuntime.jsx(Fl,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(kr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(Sr,{options:m,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Sr,{options:d,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(Sr,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Sr,{options:g,selected:i.minLiquidity,onSelect:h=>p("minLiquidity",h)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:a,children:n("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:c,children:[n("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function kr({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function Fl({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function Sr({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.8)",s.currentTarget.style.color="#fff");},onMouseLeave:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.4)",s.currentTarget.style.color="#a1a1aa");},children:n.label},n.value??"__all")})})}function Do(e){return e>=1e9?`$${(e/1e9).toFixed(1)}B`:e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}var Hl=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:Do,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:Do,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>e.toLocaleString(),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function Fo({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var react=require('react'),reactPredict=require('@liberfi.io/react-predict'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),rn=require('canvas-confetti'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var rn__default=/*#__PURE__*/_interopDefault(rn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.119");var ks="0.1.119";var Ss={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},lo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zr=(()=>{let e=t=>{let r=lo.indexOf(t);return r===-1?lo.length:r};return Object.entries(Ss).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function uo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),p=react.useCallback(()=>{n(null);},[n]),u=c("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(co,{label:u,isSelected:t===null,onPress:p,showPulse:u===l}),jsxRuntime.jsx(Cs,{}),e.map(m=>jsxRuntime.jsx(co,{label:m.category,isSelected:t===m.category,onPress:()=>n(m.category),badge:m.badge,showPulse:m.category===l},m.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(po,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(m=>jsxRuntime.jsx(po,{label:m.label,icon:m.icon,isSelected:r===m.label,onPress:()=>i(m.label)},m.label))]})})]})}function co({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function Cs(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function po({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function wf({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function Ms(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Es(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function go({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,s]=react.useState(null),l=react.useCallback(m=>{n(m),s(null),e?.({categorySlug:m,tagSlug:null});},[e]),a=react.useCallback(m=>{s(m),e?.({categorySlug:o,tagSlug:m});},[o,e]),c=Ms(Zr),p=Zr.find(m=>m.slug===o),u=Es(p);return jsxRuntime.jsx(uo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:a,trailing:t,className:r})}function ho(e){return {title:e.title,imageUrl:e.image_url}}function vo(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Wt=48,Jr=4,fr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ee={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},gr=Ee.ALL,Rf={[Ee.ONE_DAY]:fr.ONE_MINUTE,[Ee.ONE_WEEK]:fr.ONE_HOUR,[Ee.ONE_MONTH]:fr.ONE_HOUR,[Ee.ALL]:fr.ONE_DAY},If={[Ee.ONE_DAY]:300,[Ee.ONE_WEEK]:3600,[Ee.ONE_MONTH]:10800,[Ee.ALL]:1440*60},Of={[Ee.ONE_DAY]:1440*60,[Ee.ONE_WEEK]:10080*60,[Ee.ONE_MONTH]:720*60*60,[Ee.ALL]:null},hr=1,vr=1,Af=1,Df=1,Ff=99,Pt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Bf=Pt.ONE_WEEK,Hf={[Pt.ONE_HOUR]:60,[Pt.SIX_HOURS]:60,[Pt.ONE_DAY]:300,[Pt.ONE_WEEK]:1800,[Pt.MAX]:1800};var yo=react.createContext(null);function tn(){let e=react.useContext(yo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var As=1e4;function Ds({pollingInterval:e=As,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[o]),{data:s,isLoading:l,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:p,isLoading:u}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:m,isLoading:d}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=m?.safe_address,g=m?.verified??false,{data:h,isLoading:v,isFetching:N,error:M}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),w=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:m?.safe_deployed??false,polymarketTokenApproved:m?.token_approved??false,polymarketSetupLoading:d,isLoading:l||v,isFetching:a||N,error:c??M??null}),[n,i,f,s,h,g,p,u,m,d,l,v,a,N,c,M]);return jsxRuntime.jsx(yo.Provider,{value:w,children:r})}var ol={minutes:60,hours:3600,days:86400};function il(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*ol[r]}}function nn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};rn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{rn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function No({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),p=e.source,u=p==="polymarket",m=i.find(k=>k.chainNamespace===types.ChainNamespace.SOLANA&&k.isConnected),d=i.find(k=>k.chainNamespace===types.ChainNamespace.EVM&&k.isConnected&&"switchChain"in k),f=n==="authenticated",g=m?.address,h=d?.address,v=react.useMemo(()=>{if(p!=="polymarket")return;let k=e.provider_meta?.["polymarket.clobTokenIds"];return k?(typeof k=="string"?JSON.parse(k):k)[0]:void 0},[p,e.provider_meta]),{data:N}=reactPredict.useTickSize(v),M=N?.minimum_tick_size?String(N.minimum_tick_size):"0.01",[w,x]=react.useState(t),[b,E]=react.useState(r),[z,se]=react.useState("market"),[A,ve]=react.useState(NaN),[I,H]=react.useState(NaN),[$,J]=react.useState(false),[ie,C]=react.useState(null),[_,G]=react.useState(null),[D,pe]=react.useState(false),[le,we]=react.useState(false),[Ge,pt]=react.useState("1h"),[Ke,Ot]=react.useState(30),[At,ut]=react.useState("minutes"),Be=null,sr=false,lr=null,wt;try{let k=tn();Be={kalshiUsdcBalance:k.kalshiUsdcBalance,polymarketUsdcBalance:k.polymarketUsdcBalance,isLoading:k.isLoading},sr=k.kalshiKycVerified,lr=k.kalshiKycUrl,wt=k.polymarketSafeAddress;}catch{}let Pe=react.useMemo(()=>{let k=w==="yes"?0:1,q=e.outcomes[k];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,w,b]),Kr=react.useCallback(k=>{se(k);},[]),Dt=react.useCallback(k=>{x(k),H(NaN);},[]);react.useEffect(()=>{z==="limit"&&isNaN(I)&&H(Math.round(Pe*100)/100);},[z,I,Pe]);let Vr=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Pe>0?A/Pe:0:A,[b,A,Pe]),T=react.useMemo(()=>isNaN(A)||A<=0?"0":String(Math.round(A*1e6)),[A]),Ce=e.provider_meta?.["dflow.yesMint"]??"",qe=e.provider_meta?.["dflow.noMint"]??"",mt=utils.SOLANA_TOKENS.stablecoins.USDC.address,es=e.provider_meta?.["dflow.collateralMint"]||"",Qn=w==="yes"?Ce:qe,Xn=p==="kalshi"?g??"":h??"",{data:De,isLoading:ts}=reactPredict.usePositions({source:p,user:Xn},{enabled:!!Xn}),Zn=react.useMemo(()=>!De||b!=="sell"?null:De.positions.find(k=>k.side?.toLowerCase()===w&&k.market?.slug===e.slug)??null,[De,e.slug,w,b])?.market?.provider_meta,rs=b==="sell"&&Zn?.["dflow.outcomeMint"]||Qn,Ft=b==="sell"&&Zn?.["dflow.collateralMint"]||es,Bt=b==="buy"?mt:rs,Ht=b==="buy"?Qn:Ft||mt,ns=p==="kalshi"&&!!Bt&&!!Ht&&!!g&&T!=="0",{refetch:Jn}=reactPredict.useDFlowQuote({inputMint:Bt,outputMint:Ht,amount:T,userPublicKey:g??"",slippageBps:100},{enabled:ns}),cr=react.useMemo(()=>Be?p==="kalshi"?Be.kalshiUsdcBalance:Be.polymarketUsdcBalance:De&&De.positions.reduce((q,Me)=>Me.side==="USDC"||Me.side==="collateral"?q+(Me.current_value??0):q,0)||null,[Be,De,p]),os=Be?Be.isLoading:ts,jr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Yr=react.useMemo(()=>De?De.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Gr=react.useMemo(()=>z==="limit"&&u&&!isNaN(I)?I:Pe,[z,u,I,Pe]),dr=react.useMemo(()=>{if(isNaN(A)||A<=0)return 0;if(b==="buy")return A;let k=w==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return A*k},[b,w,A,e.outcomes]),eo=react.useMemo(()=>isNaN(A)||A<=0?0:b==="buy"?Gr>0?A/Gr*1:0:dr,[b,A,Gr,dr]),is=eo-dr,as=react.useCallback(k=>{E(k),ve(NaN);},[]),ss=react.useCallback(k=>{if(isNaN(k)){ve(NaN);return}let q=Math.max(0,k),Me=b==="buy"?Math.round(q*100)/100:Math.round(q);ve(Me);},[b]),ls=react.useCallback(k=>{if(isNaN(k)){H(NaN);return}let q=Math.max(.01,Math.min(.99,k));H(Math.round(q*100)/100);},[]),zt=react.useCallback(()=>{ve(NaN),H(NaN),se("market"),we(false),pt("1h"),Ot(30),ut("minutes");},[]),qr=react.useMemo(()=>{let k=[];isNaN(A)||A<=0?b==="buy"?k.push(o("predict.trade.minAmountUsd",{amount:vr})):k.push(o("predict.trade.minQuantity",{amount:hr})):b==="buy"&&A<vr?k.push(o("predict.trade.minAmountUsd",{amount:vr})):b==="sell"&&A<hr&&k.push(o("predict.trade.minQuantity",{amount:hr})),e.status!=="open"&&k.push(o("predict.trade.marketNotActive")),b==="buy"&&cr!=null&&!isNaN(A)&&A>0&&A>cr&&k.push(o("predict.trade.insufficientBalance"));let q=w==="yes"?jr:Yr;return b==="sell"&&q!=null&&!isNaN(A)&&A>0&&A>q&&k.push(o("predict.trade.insufficientShares")),z==="limit"&&u&&(isNaN(I)||I<.01||I>.99)&&k.push(o("predict.trade.limitPriceRange")),z==="limit"&&u&&le&&Ge==="custom"&&(isNaN(Ke)||Ke<=0)&&k.push(o("predict.trade.expiration.invalidDate")),{isValid:k.length===0,errors:k}},[A,e.status,b,p,cr,jr,Yr,w,z,u,I,le,Ge,Ke,o]),{mutateAsync:pr}=reactPredict.useDFlowSubmit(),{data:Qr}=reactPredict.useOrder({id:ie??"",source:p},{enabled:!!ie}),to=react.useCallback(async()=>{if(!_||!g||!m)return;let{cashAmount:k,collateral:q}=_;G(null);try{let ft=(await l.createDFlowQuote({inputMint:q,outputMint:mt,amount:k,userPublicKey:g,slippageBps:100}))?.transaction;if(!ft)return;let nt=Uint8Array.from(atob(ft),$t=>$t.charCodeAt(0)),Qe=await m.signTransaction(nt);await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:q,output_mint:mt,amount:k,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[_,g,m,l,pr,mt]);react.useEffect(()=>{if(!Qr||!ie)return;let{status:k}=Qr;k==="closed"?(C(null),_?to().finally(()=>{J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt();}):(J(false),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt())):(k==="failed"||k==="expired")&&(J(false),C(null),G(null),ui.toast.error(o("predict.trade.submitError")));},[Qr,ie,_,to,zt,o]);let ro=react.useCallback(async()=>{if(!g||!m)return;if(!Bt||!Ht){ui.toast.error("Missing token mint addresses"),J(false);return}if(!sr){pe(true),J(false);return}let Me=(await Jn()).data,ft=Me?.transaction;if(!ft){ui.toast.error(o("predict.trade.submitError")),J(false);return}if(b==="sell"&&Ft&&Ft!==mt){let ot=String(Me?.outAmount??"");ot&&ot!=="0"&&G({cashAmount:ot,collateral:Ft});}let nt=Uint8Array.from(atob(ft),ot=>ot.charCodeAt(0)),Qe=await m.signTransaction(nt),$t=await pr({signedTransaction:btoa(String.fromCharCode(...Qe)),orderContext:{user_public_key:g,input_mint:Bt,output_mint:Ht,amount:T,price:String(Pe),side:b==="buy"?"BUY":"SELL",outcome:w==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});C($t.signature);},[g,m,l,Jn,pr,Bt,Ht,T,Pe,b,w,e.slug,Ft,mt,o]),no=react.useCallback(async()=>{if(!d||!a)return;let k=d.chain,q=k!==types.Chain.POLYGON;q&&await s(types.Chain.POLYGON);try{let Me=await d.getEip1193Provider();if(!Me){ui.toast.error(o("predict.trade.submitError")),J(!1);return}let ft=!!wt,nt={address:d.address,signatureType:ft?2:0,signTypedData:async(gt,vs,xs,bs)=>{let Nt=[];"name"in gt&&Nt.push({name:"name",type:"string"}),"version"in gt&&Nt.push({name:"version",type:"string"}),"chainId"in gt&&Nt.push({name:"chainId",type:"uint256"}),"verifyingContract"in gt&&Nt.push({name:"verifyingContract",type:"address"}),"salt"in gt&&Nt.push({name:"salt",type:"bytes32"});let ys={EIP712Domain:Nt,...vs};return await Me.request({method:"eth_signTypedData_v4",params:[d.address,JSON.stringify({domain:gt,types:ys,primaryType:xs,message:bs})]})}},Qe=a.credentials??await a.authenticate(nt),$t=w==="yes"?0:1,ot="",ur=e.provider_meta?.["polymarket.clobTokenIds"];ur&&(ot=(typeof ur=="string"?JSON.parse(ur):ur)[$t]??"");let oo=e.provider_meta?.["polymarket.negRisk"]??!1,Xr=z==="limit"&&!isNaN(I)?I:Pe,ds=z==="limit"?le?"GTD":"GTC":"FOK",ps=b==="buy"&&Xr>0?A/Xr:A,io={tokenId:ot,price:Xr,size:ps,side:b==="buy"?"BUY":"SELL",orderType:ds,tickSize:M,negRisk:oo,...wt&&{funderAddress:wt},...z==="limit"&&le&&{expiration:il(Ge,Ke,At)}},us=reactPredict.buildCtfExchangeDomain(oo),ao=reactPredict.buildOrderMessage({...io,signerAddress:nt.address,signatureType:nt.signatureType}),ms=await nt.signTypedData(us,reactPredict.CTF_ORDER_TYPES,"Order",ao),fs=reactPredict.buildSignedOrder(ao,ms,io.orderType),so=reactPredict.buildClobPayload(fs,Qe.apiKey),gs=JSON.stringify(so),hs=await reactPredict.buildPolymarketL2Headers(Qe.address,{apiKey:Qe.apiKey,secret:Qe.secret,passphrase:Qe.passphrase,method:"POST",requestPath:"/order",body:gs});await l.createPolymarketOrder(so,hs),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),nn(),zt(),J(!1);}finally{q&&k&&s(k).catch(()=>{});}},[d,a,s,w,e.provider_meta,z,I,Pe,A,b,l,c,le,Ge,Ke,At,zt,o]),cs=react.useCallback(async()=>{if(!(!qr.isValid||!f)){J(true),C(null),pe(false);try{p==="kalshi"?await ro():await no();}catch(k){let q=k instanceof Error?k.message:void 0;ui.toast.error(q||o("predict.trade.submitError")),J(false);}}},[qr.isValid,f,p,ro,no,o]);return {outcome:w,side:b,orderType:z,quantity:A,limitPrice:I,shares:Vr,estimatedCost:dr,potentialPayout:eo,potentialProfit:is,usdcBalance:cr,yesTokenBalance:jr,noTokenBalance:Yr,isBalanceLoading:os,isSubmitting:$,validation:qr,supportsLimitOrder:u,kycRequired:D,kycUrl:lr,expirationEnabled:le,expirationPreset:Ge,customDuration:Ke,customDurationUnit:At,setOutcome:Dt,setSide:as,setOrderType:Kr,setQuantity:ss,setLimitPrice:ls,setExpirationEnabled:we,setExpirationPreset:pt,setCustomDuration:Ot,setCustomDurationUnit:ut,submit:cs}}function Po({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:n=>{n||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(n=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:o(n)})]},n))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[o("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:o("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.ok")})]})]})})})}var bl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,yl=["5m","1h","12h","24h","eod","custom"],kl={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Sl=["minutes","hours","days"],wl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Io({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:c,potentialPayout:p,estimatedCost:u,usdcBalance:m,yesTokenBalance:d,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:v,validationErrors:N,supportsLimitOrder:M,kycRequired:w,kycUrl:x,expirationEnabled:b,expirationPreset:E,customDuration:z,customDurationUnit:se,onOutcomeChange:A,onSideChange:ve,onOrderTypeChange:I,onQuantityChange:H,onLimitPriceChange:$,onExpirationEnabledChange:J,onExpirationPresetChange:ie,onCustomDurationChange:C,onCustomDurationUnitChange:_,onSubmit:G}){let{t:D}=i18n.useTranslation(),[pe,le]=react.useState(false),we=ui.useDisclosure(),[Ge,pt]=react.useState(""),Ke=react.useRef(false),Ot=react.useRef(n);react.useEffect(()=>{Ke.current||pt(isNaN(s)?"":String(s));},[s]),react.useEffect(()=>{n!==Ot.current&&(Ot.current=n,pt(""));},[n]);let At=react.useCallback(T=>{if(T!==""&&!(n==="buy"?/^\d*\.?\d{0,2}$/:/^\d*$/).test(T))return;if(pt(T),Dt(false),T===""||T==="."){H(NaN);return}let qe=parseFloat(T);isNaN(qe)||H(qe);},[n,H]);react.useEffect(()=>{w&&!we.isOpen&&we.onOpen();},[w]);let ut=react.useMemo(()=>{let T=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return T!=null?parseFloat((Number(T)*100).toFixed(2)):null},[n,o,t]),Be=!isNaN(s)&&s>0,sr=react.useMemo(()=>{if(g)return D("predict.trade.loadingBalance");if(h)return D("predict.trade.submitting");if(w)return D("predict.trade.kycRequired");if(!Be)return D("predict.trade.enterAmount");let T=D(n==="buy"?"predict.trade.buy":"predict.trade.sell"),Ce=D(o==="yes"?"predict.trade.yes":"predict.trade.no"),qe=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${T} ${Ce}${qe}`},[g,h,w,Be,n,o,c,D]),lr=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),wt=()=>{H(Math.floor((m??0)/2*100)/100);},Pe=()=>{H(m??0);},[Kr,Dt]=react.useState(false),Vr=()=>{if(w){we.onOpen();return}if(!v){Dt(true);return}Dt(false),G();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:o==="yes"?"text-bullish":"text-bearish",children:[D(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",D(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[M?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:T=>I(T),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:D("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:D("predict.trade.market")}),i==="limit"&&M?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:T=>$(T/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ut!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ut," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(T=>{let Ce=T==="yes"?d:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(T),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===T?T==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:D(T==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let qe=n==="buy"?T==="yes"?t.yesAsk:t.noAsk:T==="yes"?t.yesBid:t.noBid;return qe!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(qe)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===T&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${Ce??0} shares`})]},T)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:D(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:bl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:m!=null?`${m.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:wt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Pe,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:D("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:n==="buy"?"decimal":"numeric",value:Ge,onChange:T=>At(T.target.value),onFocus:()=>{Ke.current=true;},onBlur:()=>{Ke.current=false,pt(isNaN(s)?"":String(s));},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(T=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{H(Math.floor((o==="yes"?d??0:f??0)*T/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[T,"%"]},T)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{H(o==="yes"?d??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:D("common.all")})]}),Kr&&N.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:N.map(T=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:T},T))})]}),i==="limit"&&M&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:D("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:b,onValueChange:J,"aria-label":D("predict.trade.setExpiration")})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":D("predict.trade.setExpiration"),selectedKeys:[E],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&ie(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:yl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(kl[T])},T))}),E==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:C,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[se],onSelectionChange:T=>{let Ce=Array.from(T)[0];Ce&&_(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Sl.map(T=>jsxRuntime.jsx(ui.SelectItem,{children:D(wl[T])},T))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>le(T=>!T),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:D("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",pe&&"rotate-180")})]}),ut!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[ut,"% chance"]})]}),pe&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(s)&&s>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:lr,fullWidth:true,radius:"lg",size:"lg",isDisabled:g||!Be||h,isLoading:h||g,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:Vr,children:sr})]}),jsxRuntime.jsx(Po,{isOpen:we.isOpen,onClose:we.onClose,kycUrl:x})]})}function xr({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:i}){let{outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,validation:w,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,setOutcome:I,setSide:H,setOrderType:$,setQuantity:J,setLimitPrice:ie,setExpirationEnabled:C,setExpirationPreset:_,setCustomDuration:G,setCustomDurationUnit:D,submit:pe}=No({market:t,initialSide:o,initialOutcome:n}),le=walletConnector.useAuthCallback(pe),we=react.useMemo(()=>e?ho(e):void 0,[e]),Ge=react.useMemo(()=>vo(t),[t]);return jsxRuntime.jsx(Io,{event:we,market:Ge,variant:r,outcome:s,side:l,orderType:a,quantity:c,limitPrice:p,shares:u,estimatedCost:m,potentialPayout:d,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:v,isBalanceLoading:N,isSubmitting:M,isValid:w.isValid,validationErrors:w.errors,supportsLimitOrder:x,kycRequired:b,kycUrl:E,expirationEnabled:z,expirationPreset:se,customDuration:A,customDurationUnit:ve,onOutcomeChange:I,onSideChange:H,onOrderTypeChange:$,onQuantityChange:J,onLimitPriceChange:ie,onExpirationEnabledChange:C,onExpirationPresetChange:_,onCustomDurationChange:G,onCustomDurationUnitChange:D,onSubmit:le})}var Ut="predict-trade";function br({id:e=Ut}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_l,{...t})})}function _l({params:e,isOpen:t,onOpenChange:r}){let{t:o}=i18n.useTranslation(),{isMobile:n}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:n?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:n?"":"p-2",children:[jsxRuntime.jsx(xr,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:o("common.cancel")})})]})})}):null}var ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function cn(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function Ao({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,s]=react.useState(r),l=react.useCallback(h=>{h?s(r):t();},[r,t]),a=react.useCallback(()=>{s(ln);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),p=react.useCallback((h,v)=>{s(N=>({...N,[h]:v}));},[]),u=react.useMemo(()=>cn(i),[i]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),d=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,size:"md",backdrop:"blur",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.filter.title")}),jsxRuntime.jsx(Fl,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(kr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(Sr,{options:m,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Sr,{options:d,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(Sr,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(kr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Sr,{options:g,selected:i.minLiquidity,onSelect:h=>p("minLiquidity",h)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:a,children:n("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:c,children:[n("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function kr({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function Fl({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function Sr({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.8)",s.currentTarget.style.color="#fff");},onMouseLeave:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.4)",s.currentTarget.style.color="#a1a1aa");},children:n.label},n.value??"__all")})})}function Do(e){return e>=1e9?`$${(e/1e9).toFixed(1)}B`:e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}var Hl=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:Do,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:Do,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>e.toLocaleString(),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function Fo({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
2
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)}}
@@ -133,10 +133,10 @@
133
133
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
134
134
  outline-offset: 2px;
135
135
  }
136
- `;function ya({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=Dn(e.market_a),l=Dn(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=Vu(a),p=ba[c],u=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,d=Yu(e.confidence_tier,e.similarity_score),f=ha[d]??ha.low,g=c==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group match-card",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let v=h.currentTarget,N=ju[c];v.style.borderColor=N.border,v.style.boxShadow=N.shadow,r?.(e);},onMouseLeave:h=>{let v=h.currentTarget;v.style.borderColor="rgba(39,39,42,0.6)",v.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:Zu}),a!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[a.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"SPREAD"})]}),jsxRuntime.jsx(Gu,{tier:c})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",margin:"0 0 12px"},children:m}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(va,{source:e.source_a,market:e.market_a,isCheaper:u===e.source_a,onClick:()=>t?.(e,e.source_a),href:o?.(e,e.source_a),LinkComponent:n}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(va,{source:e.source_b,market:e.market_b,isCheaper:u===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),u&&a!=null&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10},children:jsxRuntime.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",borderRadius:8,border:`1px solid ${g==="orange"?"rgba(247,104,22,0.2)":"rgba(199,255,46,0.15)"}`,background:g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)",cursor:"pointer",transition:"all 0.15s",fontSize:11,fontWeight:500,color:g==="orange"?"rgba(247,104,22,0.9)":"rgba(199,255,46,0.85)"},onMouseEnter:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,u),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,flexShrink:0,color:g==="orange"?"#f76816":"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),i("predict.matches.buyEdge",{platform:u.charAt(0).toUpperCase()+u.slice(1),spread:a.toFixed(1)}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:10,height:10,color:g==="orange"?"rgba(247,104,22,0.5)":"rgba(199,255,46,0.4)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),An(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),An(e.combined_volume_24h)," ",i("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:f.dot,flexShrink:0}}),i(f.label)]})]})]})}function va({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=lt(e),a=Xu(e),c=Dn(t),p=Ku(t),u=t.volume,m=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:n||o?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.03)":"transparent";},onClick:o,children:[r?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:90,flexShrink:0},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:a.text,textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[p&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[An(u)," ",s("predict.matches.volume")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:r?"#c7ff2e":"#f4f4f5"},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"block",children:m}):m}var Na=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},c){let{t:p}=i18n.useTranslation(),{data:u,hasNextPage:m,fetchNextPage:d,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:v}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[N,M]=react.useState(0),[w,x]=react.useState(false);w&&!h?(x(false),M(I=>I+1)):h&&!w&&x(true),react.useImperativeHandle(c,()=>({refetch:()=>{v();}}),[v]);let b=react.useMemo(()=>u?.pages.flatMap(I=>I.items??[])??[],[u]),E=u?.pages[0]?.total,z=react.useMemo(()=>{let I=0,H=0,$=0;for(let J of b){let ie=J.spread??0;ie>I&&(I=ie),ie>=.03&&$++,J.combined_volume!=null&&(H+=J.combined_volume);}return {activePairs:E??b.length,maxSpread:I,highSpreadCount:$,totalVolume:H}},[b,E]);react.useEffect(()=>{z.activePairs>0&&a?.(z);},[z,a]);let se=react.useRef(null);if(react.useEffect(()=>{let I=se.current;if(!I)return;let H=new IntersectionObserver($=>{$[0]?.isIntersecting&&m&&!f&&d();},{rootMargin:"200px"});return H.observe(I),()=>H.disconnect()},[m,f,d]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(am,{});if(b.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:p("predict.matches.empty")})});let A=!m&&b.length>0,ve=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
136
+ `;function ya({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),s=Dn(e.market_a),l=Dn(e.market_b),a=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=Vu(a),p=ba[c],u=s!=null&&l!=null?s<=l?e.source_a:e.source_b:null,m=e.event_a_title||e.event_b_title,d=Yu(e.confidence_tier,e.similarity_score),f=ha[d]??ha.low,g=c==="high"?"orange":"lime";return jsxRuntime.jsxs("div",{className:"group match-card",style:{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s"},onMouseEnter:h=>{let v=h.currentTarget,N=ju[c];v.style.borderColor=N.border,v.style.boxShadow=N.shadow,r?.(e);},onMouseLeave:h=>{let v=h.currentTarget;v.style.borderColor="rgba(39,39,42,0.6)",v.style.boxShadow="none";},children:[jsxRuntime.jsx("style",{children:Zu}),a!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[a.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"SPREAD"})]}),jsxRuntime.jsx(Gu,{tier:c})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",margin:"0 0 12px"},children:m}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(va,{source:e.source_a,market:e.market_a,isCheaper:u===e.source_a,onClick:()=>t?.(e,e.source_a),href:o?.(e,e.source_a),LinkComponent:n}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(va,{source:e.source_b,market:e.market_b,isCheaper:u===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),u&&a!=null&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:10},children:jsxRuntime.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",borderRadius:8,border:`1px solid ${g==="orange"?"rgba(247,104,22,0.2)":"rgba(199,255,46,0.15)"}`,background:g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)",cursor:"pointer",transition:"all 0.15s",fontSize:11,fontWeight:500,color:g==="orange"?"rgba(247,104,22,0.9)":"rgba(199,255,46,0.85)"},onMouseEnter:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.14)":"rgba(199,255,46,0.10)";},onMouseLeave:h=>{let v=h.currentTarget;v.style.background=g==="orange"?"rgba(247,104,22,0.08)":"rgba(199,255,46,0.06)";},onClick:()=>t?.(e,u),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,flexShrink:0,color:g==="orange"?"#f76816":"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),i("predict.matches.buyEdge",{platform:u.charAt(0).toUpperCase()+u.slice(1),spread:a.toFixed(1)}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:10,height:10,color:g==="orange"?"rgba(247,104,22,0.5)":"rgba(199,255,46,0.4)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),An(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),An(e.combined_volume_24h)," ",i("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:f.dot,flexShrink:0}}),i(f.label)]})]})]})}function va({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:s}=i18n.useTranslation(),l=lt(e),a=Xu(e),c=Dn(t),p=Ku(t),u=t.volume,m=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:n||o?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.06)":"rgba(255,255,255,0.02)";},onMouseLeave:d=>{d.currentTarget.style.background=r?"rgba(199,255,46,0.03)":"transparent";},onClick:o,children:[r?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:90,flexShrink:0},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:a.text,textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[p&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[An(u)," ",s("predict.matches.volume")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:r?"#c7ff2e":"#f4f4f5"},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"block",children:m}):m}var Na=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l,onStatsChange:a},c){let{t:p}=i18n.useTranslation(),{data:u,hasNextPage:m,fetchNextPage:d,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:v}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[N,M]=react.useState(0),[w,x]=react.useState(false);w&&!h?(x(false),M(I=>I+1)):h&&!w&&x(true),react.useImperativeHandle(c,()=>({refetch:()=>{v();}}),[v]);let b=react.useMemo(()=>u?.pages.flatMap(I=>I.items??[])??[],[u]),E=u?.pages[0]?.total,z=react.useMemo(()=>{let I=0,H=0,$=0;for(let J of b){let ie=J.spread??0;ie>I&&(I=ie),ie>=.03&&$++,J.combined_volume!=null&&(H+=J.combined_volume);}return {activePairs:E??b.length,maxSpread:I,highSpreadCount:$,totalVolume:H}},[b,E]);react.useEffect(()=>{z.activePairs>0&&a?.(z);},[z,a]);let se=react.useRef(null),A=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let I=se.current;if(!I)return;let H=new IntersectionObserver($=>{$[0]?.isIntersecting&&m&&!f&&d();},{rootMargin:"200px"});return H.observe(I),()=>H.disconnect()},[m,f,d]),react.useEffect(()=>{if(m)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[m]),g)return jsxRuntime.jsx(am,{});if(b.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:p("predict.matches.empty")})});let ve=!m&&b.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
137
137
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
138
138
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
139
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:u?.pages.map(I=>I.items?.map((H,$)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${$*35}ms both`},children:jsxRuntime.jsx(ya,{match:H,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l})},`${N}-${H.match_id}-${H.source_a}-${H.market_a?.slug??$}`)))}),jsxRuntime.jsxs("div",{ref:se,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),f&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p("predict.matches.loadMore")]})]}),A&&jsxRuntime.jsx(im,{onScrollToTop:ve})]})});function im({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function am(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(sm,{index:t},t))})]})}function sm({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var um={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function mm(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function fm({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.activePairs.toLocaleString()})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(mm,{})]})]})]})]})}function pb({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,bgImageSrc:n}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,c]=react.useState(false),[p,u]=react.useState(5e3),[m,d]=react.useState(),f=react.useRef(null),g=react.useCallback(M=>{l(M);},[]),h=react.useCallback(M=>{c(M);},[]),v=react.useCallback(M=>{react.startTransition(()=>{d(M);});},[]),N=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
139
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:u?.pages.map(I=>I.items?.map((H,$)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${$*35}ms both`},children:jsxRuntime.jsx(ya,{match:H,onSelect:n,onHover:i,getMarketHref:s,LinkComponent:l})},`${N}-${H.match_id}-${H.source_a}-${H.market_a?.slug??$}`)))}),jsxRuntime.jsxs("div",{ref:se,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),f&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),p("predict.matches.loadMore")]})]}),ve&&jsxRuntime.jsx(im,{onScrollToTop:A})]})});function im({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function am(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(sm,{index:t},t))})]})}function sm({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var um={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function mm(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function fm({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.activePairs.toLocaleString()})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(mm,{})]})]})]})]})}function pb({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,bgImageSrc:n}){let{t:i}=i18n.useTranslation(),[s,l]=react.useState("spread"),[a,c]=react.useState(false),[p,u]=react.useState(5e3),[m,d]=react.useState(),f=react.useRef(null),g=react.useCallback(M=>{l(M);},[]),h=react.useCallback(M=>{c(M);},[]),v=react.useCallback(M=>{react.startTransition(()=>{d(M);});},[]),N=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
140
140
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
141
141
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
142
142
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}