@liberfi.io/ui-predict 0.1.145 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),Qn=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qn__default=/*#__PURE__*/_interopDefault(Qn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.145");var kl="0.1.145";var Sl={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},Qo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Yn=(()=>{let e=t=>{let r=Qo.indexOf(t);return r===-1?Qo.length:r};return Object.entries(Sl).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(n=>({slug:n,label:n}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function Zo({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:a,pulsingTab:l="Trending",className:s}){let{t:c}=i18n.useTranslation(),m=react.useCallback(()=>{o(null);},[o]),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",s),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(Xo,{label:u,isSelected:t===null,onPress:m,showPulse:u===l}),jsxRuntime.jsx(Cl,{}),e.map(p=>jsxRuntime.jsx(Xo,{label:p.category,isSelected:t===p.category,onPress:()=>o(p.category),badge:p.badge,showPulse:p.category===l},p.category))]})}),a&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a})]}),t&&n.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(Jo,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(p=>jsxRuntime.jsx(Jo,{label:p.label,icon:p.icon,isSelected:r===p.label,onPress:()=>i(p.label)},p.label))]})})]})}function Xo({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[o?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,n&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:n})]})}function Cl(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function Jo({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function T0({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 Ml(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function El(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function ri({onSelect:e,trailing:t,className:r}){let[n,o]=react.useState(null),[i,a]=react.useState(null),l=react.useCallback(p=>{o(p),a(null),e?.({categorySlug:p,tagSlug:null});},[e]),s=react.useCallback(p=>{a(p),e?.({categorySlug:n,tagSlug:p});},[n,e]),c=Ml(Yn),m=Yn.find(p=>p.slug===n),u=El(m);return jsxRuntime.jsx(Zo,{categories:c,selectedCategory:n,selectedTag:i,activeTags:u,onCategorySelect:l,onTagSelect:s,trailing:t,className:r})}function rn(e){return {title:e.title,imageUrl:e.image_url}}function nn(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 Nr=24,Gn=4,on={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ye={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},sn=Ye.ALL,B0={[Ye.ONE_DAY]:on.ONE_MINUTE,[Ye.ONE_WEEK]:on.ONE_HOUR,[Ye.ONE_MONTH]:on.ONE_HOUR,[Ye.ALL]:on.ONE_DAY},z0={[Ye.ONE_DAY]:300,[Ye.ONE_WEEK]:3600,[Ye.ONE_MONTH]:10800,[Ye.ALL]:1440*60},H0={[Ye.ONE_DAY]:1440*60,[Ye.ONE_WEEK]:10080*60,[Ye.ONE_MONTH]:720*60*60,[Ye.ALL]:null},an=1,ln=1,$0=1,W0=1,U0=99,gr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},K0=gr.ONE_WEEK,V0={[gr.ONE_HOUR]:60,[gr.SIX_HOURS]:60,[gr.ONE_DAY]:300,[gr.ONE_WEEK]:1800,[gr.MAX]:1800};var ii=react.createContext(null);function Jt(){let e=react.useContext(ii);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Dl=1e4;function Al({pollingInterval:e=Dl,enabled:t=true,children:r}){let n=walletConnector.useWallets(),o=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.SOLANA&&x.isConnected)?.address,[n]),i=react.useMemo(()=>n.find(x=>x.chainNamespace===types.ChainNamespace.EVM&&x.isConnected)?.address,[n]),{data:a,isLoading:l,isFetching:s,error:c}=reactPredict.useBalance({source:"kalshi",user:o??""},{enabled:t&&!!o,refetchInterval:e}),{data:m,isLoading:u}=reactPredict.useDFlowKYC(o,{enabled:t&&!!o,refetchInterval:3e4}),{data:p,isLoading:d}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=p?.safe_address,g=p?.verified??false,{data:h,isLoading:v,isFetching:k,error:w}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),R=react.useMemo(()=>({solanaAddress:o,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:m?.verified??false,kalshiKycUrl:m?.kyc_url??null,kalshiKycLoading:u,polymarketSetupVerified:g,polymarketSafeDeployed:p?.safe_deployed??false,polymarketTokenApproved:p?.token_approved??false,polymarketSetupLoading:d,isLoading:l||v,isFetching:s||k,error:c??w??null}),[o,i,f,a,h,g,m,u,p,d,l,v,s,k,c,w]);return jsxRuntime.jsx(ii.Provider,{value:R,children:r})}var Bl={minutes:60,hours:3600,days:86400};function cn(e,t,r){let n=Math.floor(Date.now()/1e3);switch(e){case "5m":return n+300;case "1h":return n+3600;case "12h":return n+720*60;case "24h":return n+1440*60;case "eod":{let o=new Date;return o.setUTCHours(23,59,59,0),Math.floor(o.getTime()/1e3)}case "custom":return n+t*Bl[r]}}function dn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function Pe(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function pn(e,t,r){let n=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(n)return t("predict.trade.polymarket.minOrderSize",{current:n[1],min:n[2]});let o=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(o){let a=parseInt(o[1],10)/1e6,l=parseInt(o[2],10)/1e6,s=Math.max(0,a-l);return t("predict.trade.polymarket.insufficientBalance",{total:Pe(a,2).toFixed(2),active:Pe(l,2).toFixed(2),available:Pe(s,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function Cr(e,t=2){return parseFloat(Pe(e,t).toFixed(t)).toString()}function Zt(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Qn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Qn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Qn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function ci({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),s=reactQuery.useQueryClient(),c=e.source,m=c==="polymarket",u=o.find(D=>D.chainNamespace===types.ChainNamespace.SOLANA&&D.isConnected),p=o.find(D=>D.chainNamespace===types.ChainNamespace.EVM&&D.isConnected&&"switchChain"in D),d=n==="authenticated",f=u?.address,g=p?.address,h=react.useMemo(()=>{if(c!=="polymarket")return;let D=e.provider_meta?.["polymarket.clobTokenIds"];return D?(typeof D=="string"?JSON.parse(D):D)[0]:void 0},[c,e.provider_meta]),{data:v,isLoading:k}=reactPredict.useTickSize(h),w=v?.minimum_tick_size?String(v.minimum_tick_size):"0.01",{data:R,isLoading:x}=reactPredict.useFeeRate(h),N=String(R?.base_fee??0),[S,K]=react.useState(t),[A,Q]=react.useState("market"),[P,L]=react.useState(NaN),[E,O]=react.useState(NaN),[de,U]=react.useState(false),[b,y]=react.useState(null),[j,Y]=react.useState(false),[q,pe]=react.useState(false),[Se,st]=react.useState("1h"),[he,Be]=react.useState(30),[ze,bt]=react.useState("minutes"),ve=null,Ve=false,rt=null,nt;try{let D=Jt();ve={kalshiUsdcBalance:D.kalshiUsdcBalance,polymarketUsdcBalance:D.polymarketUsdcBalance,isLoading:D.isLoading},Ve=D.kalshiKycVerified,rt=D.kalshiKycUrl,nt=D.polymarketSafeAddress;}catch{}let we=react.useMemo(()=>{let D=S==="yes"?0:1,Te=e.outcomes[D];return Te?.best_ask??Te?.price??.5},[e.outcomes,S]),B=react.useCallback(D=>{Q(D);},[]),ge=react.useCallback(D=>{K(D),O(NaN);},[]);react.useEffect(()=>{A==="limit"&&isNaN(E)&&O(Math.round(we*100)/100);},[A,E,we]);let Oe=react.useMemo(()=>isNaN(P)||P<=0?0:we>0?P/we:0,[P,we]),He=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),I=e.provider_meta?.["dflow.yesMint"]??"",Ee=e.provider_meta?.["dflow.noMint"]??"",yt=utils.SOLANA_TOKENS.stablecoins.USDC.address,Wn=S==="yes"?I:Ee,at=yt,Gt=Wn,dr=c==="kalshi"?f??"":g??"",{data:qt,isLoading:Dt}=reactPredict.usePositions({source:c,user:dr},{enabled:!!dr}),$e=c==="kalshi"&&!!at&&!!Gt&&!!f&&He!=="0",{refetch:Vr}=reactPredict.useDFlowQuote({inputMint:at,outputMint:Gt,amount:He,userPublicKey:f??"",slippageBps:100},{enabled:$e}),pr=react.useMemo(()=>ve?c==="kalshi"?ve.kalshiUsdcBalance:ve.polymarketUsdcBalance:qt&&qt.positions.reduce((Te,lt)=>lt.side==="USDC"||lt.side==="collateral"?Te+(lt.current_value??0):Te,0)||null,[ve,qt,c]),Un=ve?ve.isLoading:Dt,mt=react.useMemo(()=>A==="limit"&&m&&!isNaN(E)?E:we,[A,m,E,we]),jr=react.useMemo(()=>isNaN(P)||P<=0?0:P,[P]),Yr=react.useMemo(()=>isNaN(P)||P<=0?0:mt>0?P/mt*1:0,[P,mt]),Vo=Yr-jr,Gr=react.useCallback(D=>{if(isNaN(D)){L(NaN);return}L(Math.round(Math.max(0,D)*100)/100);},[]),Kn=react.useCallback(D=>{if(isNaN(D)){O(NaN);return}let Te=Math.max(.01,Math.min(.99,D));O(Math.round(Te*100)/100);},[]),ft=react.useCallback(()=>{L(NaN),O(NaN),Q("market"),pe(false),st("1h"),Be(30),bt("minutes");},[]),kt=react.useMemo(()=>{let D=[];return isNaN(P)||P<=0?D.push(r("predict.trade.minAmountUsd",{amount:ln})):P<ln&&D.push(r("predict.trade.minAmountUsd",{amount:ln})),e.status!=="open"&&D.push(r("predict.trade.marketNotActive")),pr!=null&&!isNaN(P)&&P>0&&P>Pe(pr,2)&&D.push(r("predict.trade.insufficientBalance")),A==="limit"&&m&&(isNaN(E)||E<.01||E>.99)&&D.push(r("predict.trade.limitPriceRange")),A==="limit"&&m&&q&&Se==="custom"&&(isNaN(he)||he<=0)&&D.push(r("predict.trade.expiration.invalidDate")),{isValid:D.length===0,errors:D}},[P,e.status,pr,A,m,E,q,Se,he,r]),{mutateAsync:At}=reactPredict.useDFlowSubmit(),{data:Ft}=reactPredict.useOrder({id:b??"",source:c},{enabled:!!b});react.useEffect(()=>{if(!Ft||!b)return;let{status:D}=Ft;D==="closed"?(y(null),U(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),ft(),s.invalidateQueries({queryKey:["predict","positions"]})):(D==="failed"||D==="expired")&&(U(false),y(null),ui.toast.error(r("predict.trade.submitError")));},[Ft,b,s,ft,r]);let qr=react.useCallback(async()=>{if(!f||!u)return;if(!at||!Gt){ui.toast.error("Missing token mint addresses"),U(false);return}if(!Ve){Y(true),U(false);return}let ur=(await Vr()).data?.transaction;if(!ur){ui.toast.error(r("predict.trade.submitError")),U(false);return}let Bt=Uint8Array.from(atob(ur),zt=>zt.charCodeAt(0)),St=await u.signTransaction(Bt),wt=await At({signedTransaction:btoa(String.fromCharCode(...St)),orderContext:{user_public_key:f,input_mint:at,output_mint:Gt,amount:He,price:String(we),side:"BUY",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});y(wt.signature);},[f,u,Vr,At,at,Gt,He,we,S,e.slug,r,Ve]),Pr=react.useCallback(async()=>{if(!p||!l)return;let D=p.chain,Te=D!==types.Chain.POLYGON;Te&&await i(types.Chain.POLYGON);try{let lt=await p.getEip1193Provider();if(!lt){ui.toast.error(r("predict.trade.submitError")),U(!1);return}let ur=!!nt,Bt={address:p.address,signatureType:ur?2:0,signTypedData:async(ue,Ht,en,jn)=>{let $t=[];"name"in ue&&$t.push({name:"name",type:"string"}),"version"in ue&&$t.push({name:"version",type:"string"}),"chainId"in ue&&$t.push({name:"chainId",type:"uint256"}),"verifyingContract"in ue&&$t.push({name:"verifyingContract",type:"address"}),"salt"in ue&&$t.push({name:"salt",type:"bytes32"});let jo={EIP712Domain:$t,...Ht};return await lt.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:ue,types:jo,primaryType:en,message:jn})]})}},St=l.credentials??await l.authenticate(Bt),wt=S==="yes"?0:1,zt="",Pt=e.provider_meta?.["polymarket.clobTokenIds"];Pt&&(zt=(typeof Pt=="string"?JSON.parse(Pt):Pt)[wt]??"");let mr=e.provider_meta?.["polymarket.negRisk"]??!1,Qr=A==="limit"&&!isNaN(E)?E:we,Nt=dn(Qr,w),Xr=A==="limit"?q?"GTD":"GTC":"FOK",Jr=A==="market"?P:Nt>0?P/Nt:0,Zr={tokenId:zt,price:Nt,size:Jr,side:"BUY",orderType:Xr,tickSize:w,negRisk:mr,...nt&&{funderAddress:nt},...A==="limit"&&q&&{expiration:cn(Se,he,ze)}},M=reactPredict.buildCtfExchangeDomain(mr),xe=reactPredict.buildOrderMessage({...Zr,signerAddress:Bt.address,signatureType:Bt.signatureType,feeRateBps:N}),je=await Bt.signTypedData(M,reactPredict.CTF_ORDER_TYPES,"Order",xe),De=reactPredict.buildSignedOrder(xe,je,Zr.orderType),ot=reactPredict.buildClobPayload(De,St.apiKey),We=JSON.stringify(ot),Ct=await reactPredict.buildPolymarketL2Headers(St.address,{apiKey:St.apiKey,secret:St.secret,passphrase:St.passphrase,method:"POST",requestPath:"/order",body:We});await a.createPolymarketOrder(ot,Ct),s.invalidateQueries({queryKey:["predict","orders"]}),s.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),ft(),U(!1);}finally{Te&&D&&i(D).catch(()=>{});}},[p,l,i,S,e.provider_meta,A,E,we,P,a,s,q,Se,he,ze,ft,r,w,N,nt]),Vn=react.useCallback(async()=>{if(!(!kt.isValid||!d)){U(true),y(null),Y(false);try{c==="kalshi"?await qr():await Pr();}catch(D){let Te=D instanceof Error?D.message:"",lt=c==="polymarket"&&Te?pn(Te,r,"buy"):Te||void 0;ui.toast.error(lt||r("predict.trade.submitError")),U(false);}}},[kt.isValid,d,c,qr,Pr,r]);return {outcome:S,orderType:A,quantity:P,limitPrice:E,shares:Oe,estimatedCost:jr,potentialPayout:Yr,potentialProfit:Vo,usdcBalance:pr,isBalanceLoading:Un,isMarketDataLoading:c==="polymarket"&&(x||k),isSubmitting:de,validation:kt,supportsLimitOrder:m,kycRequired:j,kycUrl:rt,expirationEnabled:q,expirationPreset:Se,customDuration:he,customDurationUnit:ze,setOutcome:ge,setOrderType:B,setQuantity:Gr,setLimitPrice:Kn,setExpirationEnabled:pe,setExpirationPreset:st,setCustomDuration:Be,setCustomDurationUnit:bt,submit:Vn}}function un({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:o=>{o||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:n("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(o=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:n(o)})]},o))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[n("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:n("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.ok")})]})]})})})}var bc=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,yc=["5m","1h","12h","24h","eod","custom"],kc={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Sc=["minutes","hours","days"],wc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Pc={maximumFractionDigits:0};function vi({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,shares:l,potentialProfit:s,potentialPayout:c,estimatedCost:m,usdcBalance:u,isBalanceLoading:p,isMarketDataLoading:d,isSubmitting:f,isValid:g,validationErrors:h,supportsLimitOrder:v,kycRequired:k,kycUrl:w,expirationEnabled:R,expirationPreset:x,customDuration:N,customDurationUnit:S,onOutcomeChange:K,onOrderTypeChange:A,onQuantityChange:Q,onLimitPriceChange:P,onExpirationEnabledChange:L,onExpirationPresetChange:E,onCustomDurationChange:O,onCustomDurationUnitChange:de,onSubmit:U}){let{t:b}=i18n.useTranslation(),[y,j]=react.useState(false),Y=ui.useDisclosure(),[q,pe]=react.useState(""),Se=react.useRef(false);react.useEffect(()=>{Se.current||pe(isNaN(i)?"":String(i));},[i]);let[st,he]=react.useState(""),Be=react.useRef(false);react.useEffect(()=>{Be.current||(isNaN(a)?he(""):he(String(parseFloat((a*100).toFixed(2)))));},[a]);let ze=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if(he(I),I===""||I==="."){P(NaN);return}let yt=parseFloat(I);isNaN(yt)||P(yt/100);},[P]),bt=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if(pe(I),Oe(false),I===""||I==="."){Q(NaN);return}let yt=parseFloat(I);isNaN(yt)||Q(yt);},[Q]);react.useEffect(()=>{k&&!Y.isOpen&&Y.onOpen();},[k]);let ve=react.useMemo(()=>{let I=n==="yes"?t.yesAsk:t.noAsk;return I!=null?parseFloat((Number(I)*100).toFixed(2)):null},[n,t]),Ve=!isNaN(i)&&i>0,rt=react.useMemo(()=>{if(p)return b("predict.trade.loadingBalance");if(d)return b("predict.trade.loadingMarketData");if(f)return b("predict.trade.submitting");if(k)return b("predict.trade.kycRequired");if(!Ve)return b("predict.trade.enterAmount");let I=b(n==="yes"?"predict.trade.yes":"predict.trade.no"),Ee=s>0?` \u2192 Win $${s.toFixed(2)}`:"";return `${b("predict.trade.buy")} ${I}${Ee}`},[p,d,f,k,Ve,n,s,b]),nt=react.useMemo(()=>n==="yes"?"primary":"secondary",[n]),we=()=>{Q(Math.floor((u??0)/2*100)/100);},B=()=>{Q(Pe(u??0,2));},[ge,Oe]=react.useState(false),He=()=>{if(k){Y.onOpen();return}if(!g){Oe(true);return}Oe(false),U();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:I=>{r==="bordered"&&(I.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:I=>{r==="bordered"&&(I.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:n==="yes"?"text-bullish":"text-bearish",children:[b("predict.trade.buy")," ",b(n==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[v?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:I=>A(I),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:b("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:b("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:b("predict.trade.market")}),o==="limit"&&v?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:st,onChange:I=>ze(I.target.value),onFocus:()=>{Be.current=true;},onBlur:()=>{Be.current=false,isNaN(a)?he(""):he(String(parseFloat((a*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ve!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ve," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(I=>{let Ee=I==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>K(I),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===I?I==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:b(I==="yes"?"predict.trade.yes":"predict.trade.no")}),Ee!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ee)*100).toFixed(2)),"\xA2"]})]})},I)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:b("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:bc,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:u!=null?`${Pe(u,2).toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:we,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:b("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:B,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:b("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:q,onChange:I=>bt(I.target.value),onFocus:()=>{Se.current=true;},onBlur:()=>{Se.current=false,pe(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ge&&h.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:h.map(I=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:I},I))})]}),o==="limit"&&v&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:b("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:R,onValueChange:L,"aria-label":b("predict.trade.setExpiration")})]}),R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":b("predict.trade.setExpiration"),selectedKeys:[x],onSelectionChange:I=>{let Ee=Array.from(I)[0];Ee&&E(Ee);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:yc.map(I=>jsxRuntime.jsx(ui.SelectItem,{children:b(kc[I])},I))}),x==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(N)?void 0:N,onValueChange:O,minValue:1,step:1,formatOptions:Pc,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:[S],onSelectionChange:I=>{let Ee=Array.from(I)[0];Ee&&de(Ee);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Sc.map(I=>jsxRuntime.jsx(ui.SelectItem,{children:b(wc[I])},I))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>j(I=>!I),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:b("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",y&&"rotate-180")})]}),ve!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:b("predict.trade.chance",{percent:ve})})]}),y&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?Cr(l):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&s>0?`+$${s.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:nt,fullWidth:true,radius:"lg",size:"lg",isDisabled:p||d||!Ve||f,isLoading:f||p||d,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:He,children:rt})]}),jsxRuntime.jsx(un,{isOpen:Y.isOpen,onClose:Y.onClose,kycUrl:w})]})}function fn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:a,quantity:l,limitPrice:s,shares:c,estimatedCost:m,potentialPayout:u,potentialProfit:p,usdcBalance:d,isBalanceLoading:f,isMarketDataLoading:g,isSubmitting:h,validation:v,supportsLimitOrder:k,kycRequired:w,kycUrl:R,expirationEnabled:x,expirationPreset:N,customDuration:S,customDurationUnit:K,setOutcome:A,setOrderType:Q,setQuantity:P,setLimitPrice:L,setExpirationEnabled:E,setExpirationPreset:O,setCustomDuration:de,setCustomDurationUnit:U,submit:b}=ci({market:t,initialOutcome:n}),y=walletConnector.useAuthCallback(b),j=react.useMemo(()=>e?rn(e):void 0,[e]),Y=react.useMemo(()=>nn(t),[t]);return jsxRuntime.jsx(vi,{event:j,market:Y,variant:r,outcome:i,orderType:a,quantity:l,limitPrice:s,shares:c,estimatedCost:m,potentialPayout:u,potentialProfit:p,usdcBalance:d,isBalanceLoading:f,isMarketDataLoading:g,isSubmitting:h,isValid:v.isValid,validationErrors:v.errors,supportsLimitOrder:k,kycRequired:w,kycUrl:R,expirationEnabled:x,expirationPreset:N,customDuration:S,customDurationUnit:K,onOutcomeChange:A,onOrderTypeChange:Q,onQuantityChange:P,onLimitPriceChange:L,onExpirationEnabledChange:E,onExpirationPresetChange:O,onCustomDurationChange:de,onCustomDurationUnitChange:U,onSubmit:y})}var Mr="predict-trade";function gn({id:e=Mr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Rc,{...t})})}function Rc({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(fn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var Zn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function eo(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function bi({isOpen:e,onClose:t,value:r,onChange:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(r),l=react.useCallback(h=>{h?a(r):t();},[r,t]),s=react.useCallback(()=>{a(Zn);},[]),c=react.useCallback(()=>{n(i),t();},[i,n,t]),m=react.useCallback((h,v)=>{a(k=>({...k,[h]:v}));},[]),u=react.useMemo(()=>eo(i),[i]),p=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"polymarket",label:o("predict.platform.polymarket")},{value:"kalshi",label:o("predict.platform.kalshi")}],[o]),d=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1d",label:o("predict.filter.lessThanDay")},{value:"7d",label:o("predict.filter.lessThanWeek")},{value:"30d",label:o("predict.filter.lessThanMonth")}],[o]),f=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]),g=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,size:"md",backdrop:"blur",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.filter.title")}),jsxRuntime.jsx(Bc,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(vn,{label:o("predict.filter.platform"),children:jsxRuntime.jsx(xn,{options:p,selected:i.source,onSelect:h=>m("source",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.timeRemaining"),children:jsxRuntime.jsx(xn,{options:d,selected:i.timeRemaining,onSelect:h=>m("timeRemaining",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.minVolume"),children:jsxRuntime.jsx(xn,{options:f,selected:i.minVolume,onSelect:h=>m("minVolume",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.minLiquidity"),children:jsxRuntime.jsx(xn,{options:g,selected:i.minLiquidity,onSelect:h=>m("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:s,children:o("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:c,children:[o("predict.filter.showResults"),u>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",u,")"]})]})]})]})})})}function vn({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 Bc({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 xn({options:e,selected:t,onSelect:r,allowDeselect:n=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(o=>{let i=t===o.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&n?void 0:o.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.8)",a.currentTarget.style.color="#fff");},onMouseLeave:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.4)",a.currentTarget.style.color="#a1a1aa");},children:o.label},o.value??"__all")})})}var Pi={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},ki={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},Yc=["start_time","volume","liquidity","ending_soon"],Si={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},Gc={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Ni({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:a}){let{t:l}=i18n.useTranslation(),[s,c]=react.useState(false),m=react.useRef(null),u=react.useCallback(d=>{m.current&&!m.current.contains(d.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)),[u]),react.useEffect(()=>{if(!s)return;let d=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[s]);let p=wi[e];return jsxRuntime.jsxs("div",{className:a,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:m,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Si,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(d=>!d),children:[jsxRuntime.jsx(qc,{}),jsxRuntime.jsx(p,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(ki[e])}),jsxRuntime.jsx(Xc,{open:s})]}),s&&jsxRuntime.jsx("div",{style:{...Gc,width:224,padding:4},children:Yc.map(d=>{let f=wi[d],g=e===d;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:h=>{g||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{g||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),c(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:l(ki[d])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},d)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:Si,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(Qc,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var wi={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function qc(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Qc(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function Xc({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Ei(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:n,isFetching:o,isFetchingNextPage:i,isError:a,error:l,hasNextPage:s,fetchNextPage:c,refetch:m}=reactPredict.useInfiniteEvents(t),u=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),p=react.useCallback(()=>{c();},[c]),d=react.useCallback(()=>{m();},[m]);return {data:u,isLoading:n,isFetching:o&&!i,isFetchingMore:i,isError:a,error:l??null,hasMore:s??false,fetchMore:p,refetch:d}}var Ti=`
1
+ 'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),Qn=require('canvas-confetti'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qn__default=/*#__PURE__*/_interopDefault(Qn);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="1.0.0");var yl="1.0.0";var kl={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},qo=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Gn=(()=>{let e=t=>{let r=qo.indexOf(t);return r===-1?qo.length:r};return Object.entries(kl).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(n=>({slug:n,label:n}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function Jo({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:a,pulsingTab:l="Trending",className:s}){let{t:c}=i18n.useTranslation(),p=react.useCallback(()=>{o(null);},[o]),m=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",s),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(Qo,{label:m,isSelected:t===null,onPress:p,showPulse:m===l}),jsxRuntime.jsx(Nl,{}),e.map(u=>jsxRuntime.jsx(Qo,{label:u.category,isSelected:t===u.category,onPress:()=>o(u.category),badge:u.badge,showPulse:u.category===l},u.category))]})}),a&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a})]}),t&&n.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(Xo,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(u=>jsxRuntime.jsx(Xo,{label:u.label,icon:u.icon,isSelected:r===u.label,onPress:()=>i(u.label)},u.label))]})})]})}function Qo({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[o?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,n&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:n})]})}function Nl(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function Xo({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function _0({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 Cl(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function Ml(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function ti({onSelect:e,trailing:t,className:r}){let[n,o]=react.useState(null),[i,a]=react.useState(null),l=react.useCallback(u=>{o(u),a(null),e?.({categorySlug:u,tagSlug:null});},[e]),s=react.useCallback(u=>{a(u),e?.({categorySlug:n,tagSlug:u});},[n,e]),c=Cl(Gn),p=Gn.find(u=>u.slug===n),m=Ml(p);return jsxRuntime.jsx(Jo,{categories:c,selectedCategory:n,selectedTag:i,activeTags:m,onCategorySelect:l,onTagSelect:s,trailing:t,className:r})}function rn(e){return {title:e.title,imageUrl:e.image_url}}function nn(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 Nr=24,Yn=4,on={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Ge={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},sn=Ge.ALL,z0={[Ge.ONE_DAY]:on.ONE_MINUTE,[Ge.ONE_WEEK]:on.ONE_HOUR,[Ge.ONE_MONTH]:on.ONE_HOUR,[Ge.ALL]:on.ONE_DAY},$0={[Ge.ONE_DAY]:300,[Ge.ONE_WEEK]:3600,[Ge.ONE_MONTH]:10800,[Ge.ALL]:1440*60},W0={[Ge.ONE_DAY]:1440*60,[Ge.ONE_WEEK]:10080*60,[Ge.ONE_MONTH]:720*60*60,[Ge.ALL]:null},an=1,ln=1,U0=1,K0=1,V0=99,gr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},j0=gr.ONE_WEEK,G0={[gr.ONE_HOUR]:60,[gr.SIX_HOURS]:60,[gr.ONE_DAY]:300,[gr.ONE_WEEK]:1800,[gr.MAX]:1800};var oi=react.createContext(null);function Jt(){let e=react.useContext(oi);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ol=1e4;function Dl({pollingInterval:e=Ol,enabled:t=true,children:r}){let n=walletConnector.useWallets(),o=react.useMemo(()=>n.find(v=>v.chainNamespace===types.ChainNamespace.SOLANA&&v.isConnected)?.address,[n]),i=react.useMemo(()=>n.find(v=>v.chainNamespace===types.ChainNamespace.EVM&&v.isConnected)?.address,[n]),{data:a,isLoading:l,isFetching:s,error:c}=reactPredict.useBalance({source:"kalshi",user:o??""},{enabled:t&&!!o,refetchInterval:e}),{data:p,isLoading:m}=reactPredict.useDFlowKYC(o,{enabled:t&&!!o,refetchInterval:3e4}),{data:u,isLoading:d}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=u?.safe_address,g=u?.verified??false,{data:h,isLoading:x,isFetching:S,error:P}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&g&&!!i,refetchInterval:e}),E=react.useMemo(()=>({solanaAddress:o,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:p?.verified??false,kalshiKycUrl:p?.kyc_url??null,kalshiKycLoading:m,polymarketSetupVerified:g,polymarketSafeDeployed:u?.safe_deployed??false,polymarketTokenApproved:u?.token_approved??false,polymarketSetupLoading:d,isLoading:l||x,isFetching:s||S,error:c??P??null}),[o,i,f,a,h,g,p,m,u,d,l,x,s,S,c,P]);return jsxRuntime.jsx(oi.Provider,{value:E,children:r})}var Fl={minutes:60,hours:3600,days:86400};function cn(e,t,r){let n=Math.floor(Date.now()/1e3);switch(e){case "5m":return n+300;case "1h":return n+3600;case "12h":return n+720*60;case "24h":return n+1440*60;case "eod":{let o=new Date;return o.setUTCHours(23,59,59,0),Math.floor(o.getTime()/1e3)}case "custom":return n+t*Fl[r]}}function dn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function Pe(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function pn(e,t,r){let n=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(n)return t("predict.trade.polymarket.minOrderSize",{current:n[1],min:n[2]});let o=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(o){let a=parseInt(o[1],10)/1e6,l=parseInt(o[2],10)/1e6,s=Math.max(0,a-l);return t("predict.trade.polymarket.insufficientBalance",{total:Pe(a,2).toFixed(2),active:Pe(l,2).toFixed(2),available:Pe(s,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function Cr(e,t=2){return parseFloat(Pe(e,t).toFixed(t)).toString()}function Zt(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Qn__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Qn__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Qn__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function li({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),s=reactQuery.useQueryClient(),c=e.source,p=c==="polymarket",m=o.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected),u=o.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected&&"switchChain"in O),d=n==="authenticated",f=m?.address,g=u?.address,h=react.useMemo(()=>{if(c!=="polymarket")return;let O=e.provider_meta?.["polymarket.clobTokenIds"];return O?(typeof O=="string"?JSON.parse(O):O)[0]:void 0},[c,e.provider_meta]),{data:x,isLoading:S}=reactPredict.useTickSize(h),P=x?.minimum_tick_size?String(x.minimum_tick_size):"0.01",{data:E,isLoading:v}=reactPredict.useFeeRate(h),w=String(E?.base_fee??0),[k,K]=react.useState(t),[I,q]=react.useState("market"),[N,H]=react.useState(NaN),[R,$]=react.useState(NaN),[Z,B]=react.useState(false),[b,y]=react.useState(null),[V,G]=react.useState(false),[Q,pe]=react.useState(false),[Se,st]=react.useState("1h"),[he,Be]=react.useState(30),[He,bt]=react.useState("minutes"),ve=null,Ve=false,rt=null,nt;try{let O=Jt();ve={kalshiUsdcBalance:O.kalshiUsdcBalance,polymarketUsdcBalance:O.polymarketUsdcBalance,isLoading:O.isLoading},Ve=O.kalshiKycVerified,rt=O.kalshiKycUrl,nt=O.polymarketSafeAddress;}catch{}let we=react.useMemo(()=>{let O=k==="yes"?0:1,Te=e.outcomes[O];return Te?.best_ask??Te?.price??.5},[e.outcomes,k]),A=react.useCallback(O=>{q(O);},[]),ge=react.useCallback(O=>{K(O),$(NaN);},[]);react.useEffect(()=>{I==="limit"&&isNaN(R)&&$(Math.round(we*100)/100);},[I,R,we]);let Oe=react.useMemo(()=>isNaN(N)||N<=0?0:we>0?N/we:0,[N,we]),ze=react.useMemo(()=>isNaN(N)||N<=0?"0":String(Math.round(N*1e6)),[N]),_=e.provider_meta?.["dflow.yesMint"]??"",Ee=e.provider_meta?.["dflow.noMint"]??"",yt=utils.SOLANA_TOKENS.stablecoins.USDC.address,Wn=k==="yes"?_:Ee,at=yt,Yt=Wn,dr=c==="kalshi"?f??"":g??"",{data:qt,isLoading:Dt}=reactPredict.usePositions({source:c,user:dr},{enabled:!!dr}),$e=c==="kalshi"&&!!at&&!!Yt&&!!f&&ze!=="0",{refetch:Vr}=reactPredict.useDFlowQuote({inputMint:at,outputMint:Yt,amount:ze,userPublicKey:f??"",slippageBps:100},{enabled:$e}),pr=react.useMemo(()=>ve?c==="kalshi"?ve.kalshiUsdcBalance:ve.polymarketUsdcBalance:qt&&qt.positions.reduce((Te,lt)=>lt.side==="USDC"||lt.side==="collateral"?Te+(lt.current_value??0):Te,0)||null,[ve,qt,c]),Un=ve?ve.isLoading:Dt,mt=react.useMemo(()=>I==="limit"&&p&&!isNaN(R)?R:we,[I,p,R,we]),jr=react.useMemo(()=>isNaN(N)||N<=0?0:N,[N]),Gr=react.useMemo(()=>isNaN(N)||N<=0?0:mt>0?N/mt*1:0,[N,mt]),Ko=Gr-jr,Yr=react.useCallback(O=>{if(isNaN(O)){H(NaN);return}H(Math.round(Math.max(0,O)*100)/100);},[]),Kn=react.useCallback(O=>{if(isNaN(O)){$(NaN);return}let Te=Math.max(.01,Math.min(.99,O));$(Math.round(Te*100)/100);},[]),ft=react.useCallback(()=>{H(NaN),$(NaN),q("market"),pe(false),st("1h"),Be(30),bt("minutes");},[]),kt=react.useMemo(()=>{let O=[];return isNaN(N)||N<=0?O.push(r("predict.trade.minAmountUsd",{amount:ln})):N<ln&&O.push(r("predict.trade.minAmountUsd",{amount:ln})),e.status!=="open"&&O.push(r("predict.trade.marketNotActive")),pr!=null&&!isNaN(N)&&N>0&&N>Pe(pr,2)&&O.push(r("predict.trade.insufficientBalance")),I==="limit"&&p&&(isNaN(R)||R<.01||R>.99)&&O.push(r("predict.trade.limitPriceRange")),I==="limit"&&p&&Q&&Se==="custom"&&(isNaN(he)||he<=0)&&O.push(r("predict.trade.expiration.invalidDate")),{isValid:O.length===0,errors:O}},[N,e.status,pr,I,p,R,Q,Se,he,r]),{mutateAsync:At}=reactPredict.useDFlowSubmit(),{data:Ft}=reactPredict.useOrder({id:b??"",source:c},{enabled:!!b});react.useEffect(()=>{if(!Ft||!b)return;let{status:O}=Ft;O==="closed"?(y(null),B(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),ft(),s.invalidateQueries({queryKey:["predict","positions"]})):(O==="failed"||O==="expired")&&(B(false),y(null),ui.toast.error(r("predict.trade.submitError")));},[Ft,b,s,ft,r]);let qr=react.useCallback(async()=>{if(!f||!m)return;if(!at||!Yt){ui.toast.error("Missing token mint addresses"),B(false);return}if(!Ve){G(true),B(false);return}let ur=(await Vr()).data?.transaction;if(!ur){ui.toast.error(r("predict.trade.submitError")),B(false);return}let Bt=Uint8Array.from(atob(ur),Ht=>Ht.charCodeAt(0)),St=await m.signTransaction(Bt),wt=await At({signedTransaction:btoa(String.fromCharCode(...St)),orderContext:{user_public_key:f,input_mint:at,output_mint:Yt,amount:ze,price:String(we),side:"BUY",outcome:k==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});y(wt.signature);},[f,m,Vr,At,at,Yt,ze,we,k,e.slug,r,Ve]),Pr=react.useCallback(async()=>{if(!u||!l)return;let O=u.chain,Te=O!==types.Chain.POLYGON;Te&&await i(types.Chain.POLYGON);try{let lt=await u.getEip1193Provider();if(!lt){ui.toast.error(r("predict.trade.submitError")),B(!1);return}let ur=!!nt,Bt={address:u.address,signatureType:ur?2:0,signTypedData:async(ue,zt,en,jn)=>{let $t=[];"name"in ue&&$t.push({name:"name",type:"string"}),"version"in ue&&$t.push({name:"version",type:"string"}),"chainId"in ue&&$t.push({name:"chainId",type:"uint256"}),"verifyingContract"in ue&&$t.push({name:"verifyingContract",type:"address"}),"salt"in ue&&$t.push({name:"salt",type:"bytes32"});let Vo={EIP712Domain:$t,...zt};return await lt.request({method:"eth_signTypedData_v4",params:[u.address,JSON.stringify({domain:ue,types:Vo,primaryType:en,message:jn})]})}},St=l.credentials??await l.authenticate(Bt),wt=k==="yes"?0:1,Ht="",Pt=e.provider_meta?.["polymarket.clobTokenIds"];Pt&&(Ht=(typeof Pt=="string"?JSON.parse(Pt):Pt)[wt]??"");let mr=e.provider_meta?.["polymarket.negRisk"]??!1,Qr=I==="limit"&&!isNaN(R)?R:we,Nt=dn(Qr,P),Xr=I==="limit"?Q?"GTD":"GTC":"FOK",Jr=I==="market"?N:Nt>0?N/Nt:0,Zr={tokenId:Ht,price:Nt,size:Jr,side:"BUY",orderType:Xr,tickSize:P,negRisk:mr,...nt&&{funderAddress:nt},...I==="limit"&&Q&&{expiration:cn(Se,he,He)}},M=reactPredict.buildCtfExchangeDomain(mr),xe=reactPredict.buildOrderMessage({...Zr,signerAddress:Bt.address,signatureType:Bt.signatureType,feeRateBps:w}),je=await Bt.signTypedData(M,reactPredict.CTF_ORDER_TYPES,"Order",xe),De=reactPredict.buildSignedOrder(xe,je,Zr.orderType),ot=reactPredict.buildClobPayload(De,St.apiKey),We=JSON.stringify(ot),Ct=await reactPredict.buildPolymarketL2Headers(St.address,{apiKey:St.apiKey,secret:St.secret,passphrase:St.passphrase,method:"POST",requestPath:"/order",body:We});await a.createPolymarketOrder(ot,Ct),s.invalidateQueries({queryKey:["predict","orders"]}),s.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),ft(),B(!1);}finally{Te&&O&&i(O).catch(()=>{});}},[u,l,i,k,e.provider_meta,I,R,we,N,a,s,Q,Se,he,He,ft,r,P,w,nt]),Vn=react.useCallback(async()=>{if(!(!kt.isValid||!d)){B(true),y(null),G(false);try{c==="kalshi"?await qr():await Pr();}catch(O){let Te=O instanceof Error?O.message:"",lt=c==="polymarket"&&Te?pn(Te,r,"buy"):Te||void 0;ui.toast.error(lt||r("predict.trade.submitError")),B(false);}}},[kt.isValid,d,c,qr,Pr,r]);return {outcome:k,orderType:I,quantity:N,limitPrice:R,shares:Oe,estimatedCost:jr,potentialPayout:Gr,potentialProfit:Ko,usdcBalance:pr,isBalanceLoading:Un,isMarketDataLoading:c==="polymarket"&&(v||S),isSubmitting:Z,validation:kt,supportsLimitOrder:p,kycRequired:V,kycUrl:rt,expirationEnabled:Q,expirationPreset:Se,customDuration:he,customDurationUnit:He,setOutcome:ge,setOrderType:A,setQuantity:Yr,setLimitPrice:Kn,setExpirationEnabled:pe,setExpirationPreset:st,setCustomDuration:Be,setCustomDurationUnit:bt,submit:Vn}}function un({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:o=>{o||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:n("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(o=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:n(o)})]},o))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[n("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:n("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.ok")})]})]})})})}var xc=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,bc=["5m","1h","12h","24h","eod","custom"],yc={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},kc=["minutes","hours","days"],Sc={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},wc={maximumFractionDigits:0};function hi({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,shares:l,potentialProfit:s,potentialPayout:c,estimatedCost:p,usdcBalance:m,isBalanceLoading:u,isMarketDataLoading:d,isSubmitting:f,isValid:g,validationErrors:h,supportsLimitOrder:x,kycRequired:S,kycUrl:P,expirationEnabled:E,expirationPreset:v,customDuration:w,customDurationUnit:k,onOutcomeChange:K,onOrderTypeChange:I,onQuantityChange:q,onLimitPriceChange:N,onExpirationEnabledChange:H,onExpirationPresetChange:R,onCustomDurationChange:$,onCustomDurationUnitChange:Z,onSubmit:B}){let{t:b}=i18n.useTranslation(),[y,V]=react.useState(false),G=ui.useDisclosure(),[Q,pe]=react.useState(""),Se=react.useRef(false);react.useEffect(()=>{Se.current||pe(isNaN(i)?"":String(i));},[i]);let[st,he]=react.useState(""),Be=react.useRef(false);react.useEffect(()=>{Be.current||(isNaN(a)?he(""):he(String(parseFloat((a*100).toFixed(2)))));},[a]);let He=react.useCallback(_=>{if(_!==""&&!/^\d*\.?\d{0,2}$/.test(_))return;if(he(_),_===""||_==="."){N(NaN);return}let yt=parseFloat(_);isNaN(yt)||N(yt/100);},[N]),bt=react.useCallback(_=>{if(_!==""&&!/^\d*\.?\d{0,2}$/.test(_))return;if(pe(_),Oe(false),_===""||_==="."){q(NaN);return}let yt=parseFloat(_);isNaN(yt)||q(yt);},[q]);react.useEffect(()=>{S&&!G.isOpen&&G.onOpen();},[S]);let ve=react.useMemo(()=>{let _=n==="yes"?t.yesAsk:t.noAsk;return _!=null?parseFloat((Number(_)*100).toFixed(2)):null},[n,t]),Ve=!isNaN(i)&&i>0,rt=react.useMemo(()=>{if(u)return b("predict.trade.loadingBalance");if(d)return b("predict.trade.loadingMarketData");if(f)return b("predict.trade.submitting");if(S)return b("predict.trade.kycRequired");if(!Ve)return b("predict.trade.enterAmount");let _=b(n==="yes"?"predict.trade.yes":"predict.trade.no"),Ee=s>0?` \u2192 Win $${s.toFixed(2)}`:"";return `${b("predict.trade.buy")} ${_}${Ee}`},[u,d,f,S,Ve,n,s,b]),nt=react.useMemo(()=>n==="yes"?"primary":"secondary",[n]),we=()=>{q(Math.floor((m??0)/2*100)/100);},A=()=>{q(Pe(m??0,2));},[ge,Oe]=react.useState(false),ze=()=>{if(S){G.onOpen();return}if(!g){Oe(true);return}Oe(false),B();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:n==="yes"?"text-bullish":"text-bearish",children:[b("predict.trade.buy")," ",b(n==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[x?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:_=>I(_),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:b("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:b("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:b("predict.trade.market")}),o==="limit"&&x?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:st,onChange:_=>He(_.target.value),onFocus:()=>{Be.current=true;},onBlur:()=>{Be.current=false,isNaN(a)?he(""):he(String(parseFloat((a*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):ve!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[ve," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(_=>{let Ee=_==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>K(_),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===_?_==="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:b(_==="yes"?"predict.trade.yes":"predict.trade.no")}),Ee!=null&&jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ee)*100).toFixed(2)),"\xA2"]})]})},_)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:b("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:xc,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?`${Pe(m,2).toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:we,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:b("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:A,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:b("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Q,onChange:_=>bt(_.target.value),onFocus:()=>{Se.current=true;},onBlur:()=>{Se.current=false,pe(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ge&&h.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:h.map(_=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:_},_))})]}),o==="limit"&&x&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:b("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:E,onValueChange:H,"aria-label":b("predict.trade.setExpiration")})]}),E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":b("predict.trade.setExpiration"),selectedKeys:[v],onSelectionChange:_=>{let Ee=Array.from(_)[0];Ee&&R(Ee);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:bc.map(_=>jsxRuntime.jsx(ui.SelectItem,{children:b(yc[_])},_))}),v==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(w)?void 0:w,onValueChange:$,minValue:1,step:1,formatOptions:wc,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:[k],onSelectionChange:_=>{let Ee=Array.from(_)[0];Ee&&Z(Ee);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:kc.map(_=>jsxRuntime.jsx(ui.SelectItem,{children:b(Sc[_])},_))})]})]})]}),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:()=>V(_=>!_),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:b("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",y&&"rotate-180")})]}),ve!=null&&jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:b("predict.trade.chance",{percent:ve})})]}),y&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?Cr(l):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:b("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&s>0?`+$${s.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:nt,fullWidth:true,radius:"lg",size:"lg",isDisabled:u||d||!Ve||f,isLoading:f||u||d,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:ze,children:rt})]}),jsxRuntime.jsx(un,{isOpen:G.isOpen,onClose:G.onClose,kycUrl:P})]})}function fn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:a,quantity:l,limitPrice:s,shares:c,estimatedCost:p,potentialPayout:m,potentialProfit:u,usdcBalance:d,isBalanceLoading:f,isMarketDataLoading:g,isSubmitting:h,validation:x,supportsLimitOrder:S,kycRequired:P,kycUrl:E,expirationEnabled:v,expirationPreset:w,customDuration:k,customDurationUnit:K,setOutcome:I,setOrderType:q,setQuantity:N,setLimitPrice:H,setExpirationEnabled:R,setExpirationPreset:$,setCustomDuration:Z,setCustomDurationUnit:B,submit:b}=li({market:t,initialOutcome:n}),y=walletConnector.useAuthCallback(b),V=react.useMemo(()=>e?rn(e):void 0,[e]),G=react.useMemo(()=>nn(t),[t]);return jsxRuntime.jsx(hi,{event:V,market:G,variant:r,outcome:i,orderType:a,quantity:l,limitPrice:s,shares:c,estimatedCost:p,potentialPayout:m,potentialProfit:u,usdcBalance:d,isBalanceLoading:f,isMarketDataLoading:g,isSubmitting:h,isValid:x.isValid,validationErrors:x.errors,supportsLimitOrder:S,kycRequired:P,kycUrl:E,expirationEnabled:v,expirationPreset:w,customDuration:k,customDurationUnit:K,onOutcomeChange:I,onOrderTypeChange:q,onQuantityChange:N,onLimitPriceChange:H,onExpirationEnabledChange:R,onExpirationPresetChange:$,onCustomDurationChange:Z,onCustomDurationUnitChange:B,onSubmit:y})}var Mr="predict-trade";function gn({id:e=Mr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_c,{...t})})}function _c({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(fn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var Zn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function eo(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function xi({isOpen:e,onClose:t,value:r,onChange:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(r),l=react.useCallback(h=>{h?a(r):t();},[r,t]),s=react.useCallback(()=>{a(Zn);},[]),c=react.useCallback(()=>{n(i),t();},[i,n,t]),p=react.useCallback((h,x)=>{a(S=>({...S,[h]:x}));},[]),m=react.useMemo(()=>eo(i),[i]),u=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"polymarket",label:o("predict.platform.polymarket")},{value:"kalshi",label:o("predict.platform.kalshi")}],[o]),d=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1d",label:o("predict.filter.lessThanDay")},{value:"7d",label:o("predict.filter.lessThanWeek")},{value:"30d",label:o("predict.filter.lessThanMonth")}],[o]),f=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]),g=react.useMemo(()=>[{value:void 0,label:o("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[o]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,size:"md",backdrop:"blur",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:o("predict.filter.title")}),jsxRuntime.jsx(Fc,{onClick:()=>l(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[jsxRuntime.jsx(vn,{label:o("predict.filter.platform"),children:jsxRuntime.jsx(xn,{options:u,selected:i.source,onSelect:h=>p("source",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.timeRemaining"),children:jsxRuntime.jsx(xn,{options:d,selected:i.timeRemaining,onSelect:h=>p("timeRemaining",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.minVolume"),children:jsxRuntime.jsx(xn,{options:f,selected:i.minVolume,onSelect:h=>p("minVolume",h)})}),jsxRuntime.jsx(vn,{label:o("predict.filter.minLiquidity"),children:jsxRuntime.jsx(xn,{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:s,children:o("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:c,children:[o("predict.filter.showResults"),m>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",m,")"]})]})]})]})})})}function vn({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 Fc({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 xn({options:e,selected:t,onSelect:r,allowDeselect:n=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(o=>{let i=t===o.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&n?void 0:o.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.8)",a.currentTarget.style.color="#fff");},onMouseLeave:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.4)",a.currentTarget.style.color="#a1a1aa");},children:o.label},o.value??"__all")})})}var wi={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},yi={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},jc=["start_time","volume","liquidity","ending_soon"],ki={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},Gc={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Pi({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:a}){let{t:l}=i18n.useTranslation(),[s,c]=react.useState(false),p=react.useRef(null),m=react.useCallback(d=>{p.current&&!p.current.contains(d.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)),[m]),react.useEffect(()=>{if(!s)return;let d=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[s]);let u=Si[e];return jsxRuntime.jsxs("div",{className:a,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:p,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:ki,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>c(d=>!d),children:[jsxRuntime.jsx(Yc,{}),jsxRuntime.jsx(u,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(yi[e])}),jsxRuntime.jsx(Qc,{open:s})]}),s&&jsxRuntime.jsx("div",{style:{...Gc,width:224,padding:4},children:jc.map(d=>{let f=Si[d],g=e===d;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:g?"rgba(199,255,46,0.08)":"transparent",color:g?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:h=>{g||(h.currentTarget.style.background="rgba(39,39,42,0.5)",h.currentTarget.style.color="#fff");},onMouseLeave:h=>{g||(h.currentTarget.style.background="transparent",h.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),c(false);},children:[jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:l(yi[d])}),g&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},d)})})]}),jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:14},onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:ki,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(qc,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var Si={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Yc(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function qc(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function Qc({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Mi(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit]),{data:r,isLoading:n,isFetching:o,isFetchingNextPage:i,isError:a,error:l,hasNextPage:s,fetchNextPage:c,refetch:p}=reactPredict.useInfiniteEvents(t),m=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),u=react.useCallback(()=>{c();},[c]),d=react.useCallback(()=>{p();},[p]);return {data:m,isLoading:n,isFetching:o&&!i,isFetchingMore:i,isError:a,error:l??null,hasMore:s??false,fetchMore:u,refetch:d}}var Ei=`
2
2
  @keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
3
3
  @media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
4
4
  @media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
@@ -14,7 +14,7 @@
14
14
  .evt-skel-hero-wrap{padding:40px 16px 32px}
15
15
  @media(min-width:640px){.evt-skel-hero-wrap{padding:48px 24px 40px}}
16
16
  @media(min-width:1024px){.evt-skel-hero-wrap{padding:52px 32px 44px}}
17
- `,Li={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function dt(e){return {...Li,animationDelay:`${e}ms`}}function to({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ti}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ed,{index:r},r))})]})}function ed({index:e}){let t=e*120,r={...Li,animationDelay:`${t}ms`},n=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:n}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(o=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:o===0?"55%":o===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},o))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function td(){return jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)",width:"100vw",marginLeft:"calc(-50vw + 50%)"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px",pointerEvents:"none"}}),jsxRuntime.jsx("div",{className:"evt-skel-hero-wrap",style:{position:"relative",zIndex:1,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsxs("div",{className:"evt-skel-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-skel-hero-left",style:{minWidth:0,flex:1,gap:16},children:[jsxRuntime.jsx("div",{style:{...dt(0),width:120,height:28,borderRadius:9999}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...dt(50),width:280,height:28,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...dt(80),width:200,height:28,borderRadius:8}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...dt(120),height:14,width:360,maxWidth:"100%"}}),jsxRuntime.jsx("div",{style:{...dt(150),height:14,width:300,maxWidth:"100%"}})]})]}),jsxRuntime.jsx("div",{className:"evt-skel-stat-grid",children:[0,1,2,3].map(e=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:"rgba(255,255,255,0.02)",borderRight:e%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:e<2?"1px solid rgba(39,39,42,0.4)":"none"},children:[jsxRuntime.jsx("div",{style:{...dt(200+e*60),height:22,width:56,borderRadius:4}}),jsxRuntime.jsx("div",{style:{...dt(230+e*60),height:14,width:64,borderRadius:4,marginTop:4}})]},e))})]})})]})}function rd(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:"1px solid rgba(39,39,42,0.3)",background:"rgba(10,10,11,0.8)"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...dt(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...dt(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...dt(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...dt(100),height:36,width:80,borderRadius:10}})]})]})}function ev({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Ti}),jsxRuntime.jsx(td,{}),jsxRuntime.jsx(rd,{}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(to,{count:e})})]})}var _i=3,pd={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},ud={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},no={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Ai={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},md={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Tr=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function Ri(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function fd(e){let t=e.outcomes?.map(a=>a.label?.toLowerCase().trim()??"")??[];if(t.some(a=>a==="up")&&t.some(a=>a==="down"))return [no,md];if(t.some(a=>a==="yes")&&t.some(a=>a==="no"))return [no,Ai];let r=t[0]??"",n=t[1]??"",o=Ri(r)%Tr.length,i=Ri(n)%Tr.length;return i===o&&(i=(i+1)%Tr.length),[Tr[o],Tr[i]]}function gd(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Fi(e){let t=gd(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Bi(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Ii(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Oi(e){let t=e.outcomes?.[1];if(t){let o=t.best_ask??t.price??0;return parseFloat((o*100).toFixed(2)).toString()}let r=e.outcomes?.[0],n=r?.best_ask??r?.price??0;return parseFloat(((1-n)*100).toFixed(2)).toString()}function hd(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),o=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),n>0&&i.push(`${n}h`),i.push(`${o}m`),i.join(" ")}var vd=`
17
+ `,Ti={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function dt(e){return {...Ti,animationDelay:`${e}ms`}}function to({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ei}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(Zc,{index:r},r))})]})}function Zc({index:e}){let t=e*120,r={...Ti,animationDelay:`${t}ms`},n=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:n}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(o=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:o===0?"55%":o===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},o))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function ed(){return jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)",width:"100vw",marginLeft:"calc(-50vw + 50%)"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px",pointerEvents:"none"}}),jsxRuntime.jsx("div",{className:"evt-skel-hero-wrap",style:{position:"relative",zIndex:1,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsxs("div",{className:"evt-skel-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-skel-hero-left",style:{minWidth:0,flex:1,gap:16},children:[jsxRuntime.jsx("div",{style:{...dt(0),width:120,height:28,borderRadius:9999}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...dt(50),width:280,height:28,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...dt(80),width:200,height:28,borderRadius:8}})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...dt(120),height:14,width:360,maxWidth:"100%"}}),jsxRuntime.jsx("div",{style:{...dt(150),height:14,width:300,maxWidth:"100%"}})]})]}),jsxRuntime.jsx("div",{className:"evt-skel-stat-grid",children:[0,1,2,3].map(e=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:"rgba(255,255,255,0.02)",borderRight:e%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:e<2?"1px solid rgba(39,39,42,0.4)":"none"},children:[jsxRuntime.jsx("div",{style:{...dt(200+e*60),height:22,width:56,borderRadius:4}}),jsxRuntime.jsx("div",{style:{...dt(230+e*60),height:14,width:64,borderRadius:4,marginTop:4}})]},e))})]})})]})}function td(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:"1px solid rgba(39,39,42,0.3)",background:"rgba(10,10,11,0.8)"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...dt(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...dt(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...dt(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...dt(100),height:36,width:80,borderRadius:10}})]})]})}function rv({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Ei}),jsxRuntime.jsx(ed,{}),jsxRuntime.jsx(td,{}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(to,{count:e})})]})}var Li=3,dd={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},pd={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},no={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Di={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},ud={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Tr=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function _i(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function md(e){let t=e.outcomes?.map(a=>a.label?.toLowerCase().trim()??"")??[];if(t.some(a=>a==="up")&&t.some(a=>a==="down"))return [no,ud];if(t.some(a=>a==="yes")&&t.some(a=>a==="no"))return [no,Di];let r=t[0]??"",n=t[1]??"",o=_i(r)%Tr.length,i=_i(n)%Tr.length;return i===o&&(i=(i+1)%Tr.length),[Tr[o],Tr[i]]}function fd(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Ai(e){let t=fd(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Fi(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Ri(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Ii(e){let t=e.outcomes?.[1];if(t){let o=t.best_ask??t.price??0;return parseFloat((o*100).toFixed(2)).toString()}let r=e.outcomes?.[0],n=r?.best_ask??r?.price??0;return parseFloat(((1-n)*100).toFixed(2)).toString()}function gd(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),o=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),n>0&&i.push(`${n}h`),i.push(`${o}m`),i.join(" ")}var hd=`
18
18
  .badge-shine { position: relative; overflow: hidden; }
19
19
  .badge-shine::after {
20
20
  content: "";
@@ -38,13 +38,13 @@
38
38
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
39
39
  outline-offset: 2px;
40
40
  }
41
- `;function zi({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[a,l]=react.useState(null),s=e.markets??[],m=react.useMemo(()=>s.length>2?[...s].sort((x,N)=>(N.outcomes?.[0]?.price??0)-(x.outcomes?.[0]?.price??0)):s,[s]).filter(x=>x.status==="open"),u=m.length===1,p=m.slice(0,_i),d=m.length-_i,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=a?m.find(x=>x.slug===a)??null:null,h=!!g||u,v=()=>{h||n?.(e);},k=x=>{x.stopPropagation(),g&&(x.preventDefault(),l(null));},w=x=>{x.stopPropagation(),t||(x.preventDefault(),n?.(e));},R=u?jsxRuntime.jsx(Td,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(_d,{onCollapse:()=>l(null)}):jsxRuntime.jsx(Nd,{moreCount:d,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:w});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:h?void 0:"pointer"},onMouseEnter:x=>{let N=x.currentTarget,S=pd[e.source]??ud;N.style.borderColor=S.border,N.style.boxShadow=S.shadow,i?.(e);},onMouseLeave:x=>{let N=x.currentTarget;N.style.borderColor="rgba(39,39,42,0.6)",N.style.boxShadow="none";},onClick:v,children:[jsxRuntime.jsx("style",{children:vd}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(xd,{event:e,href:t,LinkComponent:r,onClick:k,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:u?jsxRuntime.jsx(Ed,{market:m[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(Ld,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:o}):jsxRuntime.jsx(Pd,{displayedMarkets:p,onMarketClick:x=>l(x.slug)})})]}),jsxRuntime.jsx(Cd,{children:R})]})}function xd({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?hd(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:n,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(yd,{event:e})]})}function bd(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(o=>o.label?.toLowerCase()==="crypto"),n=e.tags?.some(o=>o.label?.toLowerCase()==="live");if(r&&e.end_at){let o=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,a=900*1e3;if(o>0&&o<=a){let l=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:l});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function yd({event:e}){let t=react.useMemo(()=>bd(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,n)=>{switch(r.kind){case "live":return jsxRuntime.jsx(kd,{},n);case "crypto-short":return jsxRuntime.jsx(Sd,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(wd,{},n)}})})}function kd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function Sd({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui.TimerIcon,{className:"size-3 shrink-0"}),e]})}function wd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function Pd({displayedMarkets:e,onMarketClick:t}){return e.length>0?jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(r=>{let n=Fi(r);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:o=>{o.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:r.outcomes?.[0]?.label??r.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:Bi(n)}),jsxRuntime.jsx(Md,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Nd({moreCount:e,formattedVolume:t,source:r,href:n,LinkComponent:o,onShowMore:i}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui.Linkable,{href:n,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[a("predict.event.showMore"),jsxRuntime.jsx($i,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",a("predict.event.volume"),jsxRuntime.jsx(Wi,{source:r})]})]})}function Cd({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function Di({bgColor:e,textColor:t,shadowColor:r,onClick:n,children:o}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:l=>{let s=l.currentTarget;s.style.setProperty("--shadow-offset","2px"),s.style.transform="translateY(2px)";},onMouseLeave:l=>{let s=l.currentTarget;s.style.setProperty("--shadow-offset","4px"),s.style.transform="translateY(0px)";},onClick:n,children:o})}function Hi({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[a,l]=n?fd(e):[no,Ai],s=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",m=o==="label"&&s===c?"action":o,u=m==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Ii(e)}\xA2`:i("predict.market.action.yes",{price:Ii(e)}),p=m==="label"?`${e.outcomes?.[1]?.label??"No"} ${Oi(e)}\xA2`:i("predict.market.action.no",{price:Oi(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Di,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:u}),jsxRuntime.jsx(Di,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:p})]})}function Md(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function Ed({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Hi,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function Td({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui.Linkable,{href:r,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:l=>{l.stopPropagation(),r||(l.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx($i,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx(Wi,{source:e.source})]})]})}function Ld({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=Fi(e);return jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:i=>{i.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:Bi(o)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Hi,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function _d({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(Rd,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function $i({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Rd({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wi({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var Ad=8;function Ki({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:a,LinkComponent:l,onHover:s}){let{t:c}=i18n.useTranslation(),m=react.useRef(null);react.useEffect(()=>{let d=m.current;if(!d)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return f.observe(d),()=>f.disconnect()},[t,r,n]);let u=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),p=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
41
+ `;function Bi({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[a,l]=react.useState(null),s=e.markets??[],p=react.useMemo(()=>s.length>2?[...s].sort((v,w)=>(w.outcomes?.[0]?.price??0)-(v.outcomes?.[0]?.price??0)):s,[s]).filter(v=>v.status==="open"),m=p.length===1,u=p.slice(0,Li),d=p.length-Li,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=a?p.find(v=>v.slug===a)??null:null,h=!!g||m,x=()=>{h||n?.(e);},S=v=>{v.stopPropagation(),g&&(v.preventDefault(),l(null));},P=v=>{v.stopPropagation(),t||(v.preventDefault(),n?.(e));},E=m?jsxRuntime.jsx(Ed,{event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(Ld,{onCollapse:()=>l(null)}):jsxRuntime.jsx(Pd,{moreCount:d,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onShowMore:P});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:h?void 0:"pointer"},onMouseEnter:v=>{let w=v.currentTarget,k=dd[e.source]??pd;w.style.borderColor=k.border,w.style.boxShadow=k.shadow,i?.(e);},onMouseLeave:v=>{let w=v.currentTarget;w.style.borderColor="rgba(39,39,42,0.6)",w.style.boxShadow="none";},onClick:x,children:[jsxRuntime.jsx("style",{children:hd}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(vd,{event:e,href:t,LinkComponent:r,onClick:S,isExpanded:h}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:m?jsxRuntime.jsx(Md,{market:p[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(Td,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:o}):jsxRuntime.jsx(wd,{displayedMarkets:u,onMarketClick:v=>l(v.slug)})})]}),jsxRuntime.jsx(Nd,{children:E})]})}function vd({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?gd(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:n,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(bd,{event:e})]})}function xd(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(o=>o.label?.toLowerCase()==="crypto"),n=e.tags?.some(o=>o.label?.toLowerCase()==="live");if(r&&e.end_at){let o=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,a=900*1e3;if(o>0&&o<=a){let l=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:l});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function bd({event:e}){let t=react.useMemo(()=>xd(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,n)=>{switch(r.kind){case "live":return jsxRuntime.jsx(yd,{},n);case "crypto-short":return jsxRuntime.jsx(kd,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(Sd,{},n)}})})}function yd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function kd({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui.TimerIcon,{className:"size-3 shrink-0"}),e]})}function Sd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function wd({displayedMarkets:e,onMarketClick:t}){return e.length>0?jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(r=>{let n=Ai(r);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:o=>{o.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:r.outcomes?.[0]?.label??r.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:Fi(n)}),jsxRuntime.jsx(Cd,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Pd({moreCount:e,formattedVolume:t,source:r,href:n,LinkComponent:o,onShowMore:i}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui.Linkable,{href:n,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[a("predict.event.showMore"),jsxRuntime.jsx(zi,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",a("predict.event.volume"),jsxRuntime.jsx($i,{source:r})]})]})}function Nd({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function Oi({bgColor:e,textColor:t,shadowColor:r,onClick:n,children:o}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:l=>{let s=l.currentTarget;s.style.setProperty("--shadow-offset","2px"),s.style.transform="translateY(2px)";},onMouseLeave:l=>{let s=l.currentTarget;s.style.setProperty("--shadow-offset","4px"),s.style.transform="translateY(0px)";},onClick:n,children:o})}function Hi({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[a,l]=n?md(e):[no,Di],s=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",p=o==="label"&&s===c?"action":o,m=p==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${Ri(e)}\xA2`:i("predict.market.action.yes",{price:Ri(e)}),u=p==="label"?`${e.outcomes?.[1]?.label??"No"} ${Ii(e)}\xA2`:i("predict.market.action.no",{price:Ii(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Oi,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:m}),jsxRuntime.jsx(Oi,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:u})]})}function Cd(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function Md({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Hi,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function Ed({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui.Linkable,{href:r,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:l=>{l.stopPropagation(),r||(l.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(zi,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx($i,{source:e.source})]})]})}function Td({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=Ai(e);return jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:i=>{i.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:Fi(o)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Hi,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function Ld({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(_d,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function zi({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function _d({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function $i({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var Dd=8;function Ui({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:a,LinkComponent:l,onHover:s}){let{t:c}=i18n.useTranslation(),p=react.useRef(null);react.useEffect(()=>{let d=p.current;if(!d)return;let f=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return f.observe(d),()=>f.disconnect()},[t,r,n]);let m=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),u=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
42
42
  @keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
43
43
  @keyframes evt-load-spin{to{transform:rotate(360deg)}}
44
44
  @media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
45
45
  @media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
46
46
  @media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
47
- `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,f)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:Ad,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(zi,{event:d,href:a?.(d),LinkComponent:l,onSelect:o,onSelectOutcome:i,onHover:s})},`${d.source}-${d.slug}`))}),jsxRuntime.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),c("predict.events.loadMore")]})}),p&&jsxRuntime.jsx(Fd,{onScrollToTop:u})]})}function Fd({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function ji({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:l,minVolume:s,minLiquidity:c,markets_limit:m,onSelect:u,onSelectOutcome:p,getEventHref:d,LinkComponent:f,onHover:g}){let{data:h,hasMore:v,fetchMore:k,isFetching:w,isFetchingMore:R}=Ei({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:l,minVolume:s,minLiquidity:c,markets_limit:m});return w?jsxRuntime.jsx(to,{count:24}):jsxRuntime.jsx(Ki,{events:h,hasMore:v,isFetchingMore:R,onFetchMore:k,onSelect:u,onSelectOutcome:p,getEventHref:d,LinkComponent:f,onHover:g})}function Mv({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i}){let[a,l]=react.useState({categorySlug:null,tagSlug:null}),[s,c]=react.useState(Zn),{isOpen:m,onOpen:u,onClose:p}=ui.useDisclosure(),{onOpen:d}=uiScaffold.useAsyncModal(Mr),f=react.useCallback((N,S,K)=>{t?.(N,S,K),d({params:{event:N,market:S,initialOutcome:K}});},[t,d]),g=react.useCallback(N=>{l(N);},[]),h=react.useCallback(N=>{c(S=>({...S,sortPreset:N}));},[]),v=react.useCallback(N=>{c(S=>({...S,sortAsc:N}));},[]),k=react.useCallback(N=>{c(N);},[]),w=react.useMemo(()=>Pi[s.sortPreset].sort_by,[s.sortPreset]),R=react.useMemo(()=>eo(s),[s]),x=react.useMemo(()=>jsxRuntime.jsx(Ni,{sortPreset:s.sortPreset,onSortChange:h,sortAsc:s.sortAsc,onSortAscChange:v,onFilterPress:u,filterCount:R}),[s.sortPreset,s.sortAsc,R,h,v,u]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(ri,{onSelect:g,trailing:x})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(bi,{isOpen:m,onClose:p,value:s,onChange:k}),jsxRuntime.jsx(ji,{tagSlugSelection:a,sort_by:w,sort_asc:s.sortAsc,source:s.source,timeRemaining:s.timeRemaining,minVolume:s.minVolume,minLiquidity:s.minLiquidity,onSelect:e,onSelectOutcome:f,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(gn,{})]})}function qi(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 $d=[{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:qi,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:qi,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 _v({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
47
+ `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,f)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:Dd,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${f%4*35}ms both`},children:jsxRuntime.jsx(Bi,{event:d,href:a?.(d),LinkComponent:l,onSelect:o,onSelectOutcome:i,onHover:s})},`${d.source}-${d.slug}`))}),jsxRuntime.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),c("predict.events.loadMore")]})}),u&&jsxRuntime.jsx(Ad,{onScrollToTop:m})]})}function Ad({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function Vi({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:l,minVolume:s,minLiquidity:c,markets_limit:p,onSelect:m,onSelectOutcome:u,getEventHref:d,LinkComponent:f,onHover:g}){let{data:h,hasMore:x,fetchMore:S,isFetching:P,isFetchingMore:E}=Mi({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:l,minVolume:s,minLiquidity:c,markets_limit:p});return P?jsxRuntime.jsx(to,{count:24}):jsxRuntime.jsx(Ui,{events:h,hasMore:x,isFetchingMore:E,onFetchMore:S,onSelect:m,onSelectOutcome:u,getEventHref:d,LinkComponent:f,onHover:g})}function Tv({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i}){let[a,l]=react.useState({categorySlug:null,tagSlug:null}),[s,c]=react.useState(Zn),{isOpen:p,onOpen:m,onClose:u}=ui.useDisclosure(),{onOpen:d}=uiScaffold.useAsyncModal(Mr),f=react.useCallback((w,k,K)=>{t?.(w,k,K),d({params:{event:w,market:k,initialOutcome:K}});},[t,d]),g=react.useCallback(w=>{l(w);},[]),h=react.useCallback(w=>{c(k=>({...k,sortPreset:w}));},[]),x=react.useCallback(w=>{c(k=>({...k,sortAsc:w}));},[]),S=react.useCallback(w=>{c(w);},[]),P=react.useMemo(()=>wi[s.sortPreset].sort_by,[s.sortPreset]),E=react.useMemo(()=>eo(s),[s]),v=react.useMemo(()=>jsxRuntime.jsx(Pi,{sortPreset:s.sortPreset,onSortChange:h,sortAsc:s.sortAsc,onSortAscChange:x,onFilterPress:m,filterCount:E}),[s.sortPreset,s.sortAsc,E,h,x,m]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:jsxRuntime.jsx(ti,{onSelect:g,trailing:v})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(xi,{isOpen:p,onClose:u,value:s,onChange:S}),jsxRuntime.jsx(Vi,{tagSlugSelection:a,sort_by:P,sort_asc:s.sortAsc,source:s.source,timeRemaining:s.timeRemaining,minVolume:s.minVolume,minLiquidity:s.minLiquidity,onSelect:e,onSelectOutcome:f,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(gn,{})]})}function Yi(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 zd=[{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:Yi,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:Yi,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 Iv({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
48
48
  @keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
49
49
  @keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
50
50
  @keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@@ -82,15 +82,15 @@
82
82
  .evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
83
83
  @media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
84
84
  `}),jsxRuntime.jsxs("div",{className:"evt-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-hero-left",style:{minWidth:0,flex:1,animation:"evtHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"evt-hero-live",style:{marginBottom:16},children:jsxRuntime.jsxs("div",{className:"inline-flex items-center",style:{gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",width:8,height:8},children:[jsxRuntime.jsx("span",{style:{position:"absolute",display:"inline-flex",width:"100%",height:"100%",borderRadius:9999,background:"#00d492",opacity:.75,animation:"evt-live-ping 1.2s cubic-bezier(0,0,0.2,1) infinite"}}),jsxRuntime.jsx("span",{style:{position:"relative",display:"inline-flex",width:8,height:8,borderRadius:9999,background:"#00bc7d",animation:"evt-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.events.liveBadge")})]})}),jsxRuntime.jsxs("h1",{className:"evt-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.events.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.events.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"evt-hero-subtitle evt-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.events.heroSubtitle")).split(`
85
- `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:$d.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function es({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i}=i18n.useTranslation(),{mutateAsync:a}=reactPredict.useRedeemPosition(),{evmAddress:l}=Jt(),s=walletConnector.useWallets(),[c,m]=react.useState("idle"),[u,p]=react.useState(null),d=t.provider_meta?.["polymarket.conditionId"],f=t.provider_meta?.["polymarket.negRisk"]??false,g=l??"",h=react.useMemo(()=>s.find(L=>L.chainNamespace===types.ChainNamespace.EVM&&L.isConnected),[s]),v=Zi(r.side,t.outcomes),w=t.outcomes?.[v]?.label??r.side,R=t.result!=null?Zi(t.result,t.outcomes):-1,N=(R>=0?t.outcomes?.[R]:void 0)?.label??t.result??"",S=t.result!=null?v===R:true,K=react.useMemo(()=>S?r.size:0,[S,r.size]),A=react.useCallback(async()=>{if(!(!d||!g||!h)){m("pending"),p(null);try{let L=await h.getEip1193Provider();if(!L)throw new Error("EIP-1193 provider unavailable");await a({wallet_address:g,condition_id:d,neg_risk:f,signMessage:async E=>await L.request({method:"personal_sign",params:[E,g]})}),m("success"),n?.();}catch(L){m("error"),p(L instanceof Error?L.message:i("predict.redeem.error"));}}},[d,g,f,h,a,n,i]),Q=walletConnector.useAuthCallback(A),P=c==="idle"&&!!d&&!!g&&!!h&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(bn,{label:i("predict.positions.side"),value:w,valueClassName:S?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(bn,{label:i("predict.redeem.result"),value:N,valueClassName:"text-green-400"}),jsxRuntime.jsx(bn,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(bn,{label:i("predict.redeem.expectedPayout"),value:`$${K.toFixed(2)}`,valueClassName:K>0?"text-green-400":"text-zinc-400"})]}),!S&&K===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),c==="error"&&u&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:u}),c==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[c!=="success"&&jsxRuntime.jsx(ui.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!P,isLoading:c==="pending",onPress:Q,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&c!=="success"&&jsxRuntime.jsx("button",{type:"button",onClick:o,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),c==="success"&&o&&jsxRuntime.jsx(ui.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function bn({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function Zi(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let n=t.findIndex(o=>o.label.toLowerCase()===r);return n>=0?n:1}var tp="predict-redeem";function rs({id:e=tp}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(rp,{...t})})}function rp({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:n("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:n("predict.redeem.description")})]}),jsxRuntime.jsx(es,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function as({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),s=reactQuery.useQueryClient(),c=e.source,m=c==="polymarket",u=o.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),p=o.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),d=n==="authenticated",f=u?.address,g=p?.address,h=react.useMemo(()=>{if(c!=="polymarket")return;let M=e.provider_meta?.["polymarket.clobTokenIds"];return M?(typeof M=="string"?JSON.parse(M):M)[0]:void 0},[c,e.provider_meta]),{data:v,isLoading:k}=reactPredict.useTickSize(h),w=v?.minimum_tick_size?String(v.minimum_tick_size):"0.01",{data:R,isLoading:x}=reactPredict.useFeeRate(h),N=String(R?.base_fee??0),[S,K]=react.useState(t),[A,Q]=react.useState("market"),[P,L]=react.useState(NaN),[E,O]=react.useState(NaN),[de,U]=react.useState(false),[b,y]=react.useState(false),[j,Y]=react.useState(null),[q,pe]=react.useState(null),[Se,st]=react.useState(false),[he,Be]=react.useState(false),[ze,bt]=react.useState("1h"),[ve,Ve]=react.useState(30),[rt,nt]=react.useState("minutes"),we=false,B=null,ge;try{let M=Jt();we=M.kalshiKycVerified,B=M.kalshiKycUrl,ge=M.polymarketSafeAddress;}catch{}let Oe=react.useCallback(async()=>{if(!p||!l)return null;let M=await p.getEip1193Provider();if(!M)return null;let xe=!!ge,je={address:p.address,signatureType:xe?2:0,signTypedData:async(De,ot,We,Ct)=>{let ue=[];"name"in De&&ue.push({name:"name",type:"string"}),"version"in De&&ue.push({name:"version",type:"string"}),"chainId"in De&&ue.push({name:"chainId",type:"uint256"}),"verifyingContract"in De&&ue.push({name:"verifyingContract",type:"address"}),"salt"in De&&ue.push({name:"salt",type:"bytes32"});let Ht={EIP712Domain:ue,...ot};return await M.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:De,types:Ht,primaryType:We,message:Ct})]})}};return l.credentials??await l.authenticate(je)},[ge,p,l]),He=react.useMemo(()=>{let M=S==="yes"?0:1,xe=e.outcomes[M];return xe?.best_bid??xe?.price??.5},[e.outcomes,S]),I=c==="kalshi"?f??"":g??"",{data:Ee,isLoading:yt}=reactPredict.usePositions({source:c,user:I},{enabled:!!I,refetchInterval:3e4}),Wn=react.useCallback(async()=>{let M=await Oe();return M?await reactPredict.buildPolymarketL2Headers(M.address,{apiKey:M.apiKey,secret:M.secret,passphrase:M.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[Oe]),{data:at,isLoading:Gt}=reactPredict.useAvailableShares({source:c,user:I,market:e.slug,side:S},c==="polymarket"?{getHeaders:Wn}:void 0,{enabled:!!I&&!!e.slug,refetchOnMount:"always"}),dr=at?.total_shares??0,qt=at?.active_order_shares??0,Dt=at?.available_shares??0,$e=react.useMemo(()=>c==="polymarket"?reactPredict.getPolymarketSharesPrecision(w):at?.precision??0,[c,w,at?.precision]),Vr=Gt||yt,pr=e.provider_meta?.["dflow.yesMint"]??"",Un=e.provider_meta?.["dflow.noMint"]??"",mt=utils.SOLANA_TOKENS.stablecoins.USDC.address,jr=e.provider_meta?.["dflow.collateralMint"]||"",Yr=S==="yes"?pr:Un,Gr=react.useMemo(()=>Ee?Ee.positions.find(M=>M.side?.toLowerCase()===S&&M.market?.slug===e.slug)??null:null,[Ee,e.slug,S])?.market?.provider_meta,Kn=Gr?.["dflow.outcomeMint"]||Yr,ft=Gr?.["dflow.collateralMint"]||jr,kt=Kn,At=ft||mt,Ft=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),qr=c==="kalshi"&&!!kt&&!!At&&!!f&&Ft!=="0",{refetch:Pr}=reactPredict.useDFlowQuote({inputMint:kt,outputMint:At,amount:Ft,userPublicKey:f??"",slippageBps:100},{enabled:qr}),Vn=react.useMemo(()=>isNaN(P)||P<=0?0:P,[P]),D=react.useMemo(()=>{if(isNaN(P)||P<=0)return 0;let M=A==="limit"&&m&&!isNaN(E)?E:He;return P*M},[P,A,m,E,He]),Te=react.useCallback(M=>{K(M),O(NaN),L(NaN),y(false);},[]),lt=react.useCallback(M=>{Q(M);},[]);react.useEffect(()=>{A==="limit"&&O(Math.round(He*100)/100);},[A,S]);let ur=react.useCallback(M=>{if(y(false),isNaN(M)){L(NaN);return}L(Pe(Math.max(0,M),$e));},[$e]),Bt=react.useCallback(()=>{y(true),L(Pe(Dt,$e));},[Dt,$e]),St=react.useCallback(M=>{if(isNaN(M)){O(NaN);return}let xe=Math.max(.01,Math.min(.99,M));O(Math.round(xe*100)/100);},[]),wt=react.useCallback(()=>{L(NaN),O(NaN),Q("market"),y(false),Be(false),bt("1h"),Ve(30),nt("minutes");},[]),zt=react.useMemo(()=>{let M=[];return isNaN(P)||P<=0?M.push(r("predict.trade.minQuantity",{amount:an})):P<an&&M.push(r("predict.trade.minQuantity",{amount:an})),e.status!=="open"&&M.push(r("predict.trade.marketNotActive")),!isNaN(P)&&P>0&&!b&&P>Dt&&M.push(r("predict.trade.insufficientSharesDetail",{total:Pe(dr,$e).toFixed($e),active:Pe(qt,$e).toFixed($e),available:Pe(Dt,$e).toFixed($e)})),A==="limit"&&m&&(isNaN(E)||E<.01||E>.99)&&M.push(r("predict.trade.limitPriceRange")),A==="limit"&&m&&he&&ze==="custom"&&(isNaN(ve)||ve<=0)&&M.push(r("predict.trade.expiration.invalidDate")),{isValid:M.length===0,errors:M}},[P,e.status,Dt,dr,qt,b,A,m,E,he,ze,ve,$e,r]),{mutateAsync:Pt}=reactPredict.useDFlowSubmit(),{data:mr}=reactPredict.useOrder({id:j??"",source:c},{enabled:!!j}),Qr=react.useCallback(async()=>{if(!q||!f||!u)return;let{cashAmount:M,collateral:xe}=q;pe(null);try{let De=(await a.createDFlowQuote({inputMint:xe,outputMint:mt,amount:M,userPublicKey:f,slippageBps:100}))?.transaction;if(!De)return;let ot=Uint8Array.from(atob(De),Ct=>Ct.charCodeAt(0)),We=await u.signTransaction(ot);await Pt({signedTransaction:btoa(String.fromCharCode(...We)),orderContext:{user_public_key:f,input_mint:xe,output_mint:mt,amount:M,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[q,f,u,a,Pt,mt]),Nt=react.useCallback(()=>{s.invalidateQueries({queryKey:["predict","positions"]}),s.invalidateQueries({queryKey:["predict","orders"]}),s.invalidateQueries({queryKey:["predict","available-shares"]});},[s]);react.useEffect(()=>{if(!mr||!j)return;let{status:M}=mr;M==="closed"?(Y(null),q?Qr().finally(()=>{U(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),Nt(),wt();}):(U(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),Nt(),wt())):(M==="failed"||M==="expired")&&(U(false),Y(null),pe(null),ui.toast.error(r("predict.trade.submitError")));},[mr,j,q,Qr,Nt,wt,r]);let Xr=react.useCallback(async()=>{if(!f||!u)return;if(!kt||!At){ui.toast.error("Missing token mint addresses"),U(false);return}if(!we){st(true),U(false);return}let je=(await Pr()).data,De=je?.transaction;if(!De){ui.toast.error(r("predict.trade.submitError")),U(false);return}if(ft&&ft!==mt){let ue=String(je?.outAmount??"");ue&&ue!=="0"&&pe({cashAmount:ue,collateral:ft});}let ot=Uint8Array.from(atob(De),ue=>ue.charCodeAt(0)),We=await u.signTransaction(ot),Ct=await Pt({signedTransaction:btoa(String.fromCharCode(...We)),orderContext:{user_public_key:f,input_mint:kt,output_mint:At,amount:Ft,price:String(He),side:"SELL",outcome:S==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});Y(Ct.signature);},[f,u,Pr,Pt,kt,At,Ft,He,S,e.slug,ft,mt,r,we]),Jr=react.useCallback(async()=>{if(!p||!l)return;let M=p.chain,xe=M!==types.Chain.POLYGON;xe&&await i(types.Chain.POLYGON);try{let je=await p.getEip1193Provider();if(!je){ui.toast.error(r("predict.trade.submitError")),U(!1);return}let De=!!ge,ot={address:p.address,signatureType:De?2:0,signTypedData:async(Qt,vl,xl,bl)=>{let fr=[];"name"in Qt&&fr.push({name:"name",type:"string"}),"version"in Qt&&fr.push({name:"version",type:"string"}),"chainId"in Qt&&fr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Qt&&fr.push({name:"verifyingContract",type:"address"}),"salt"in Qt&&fr.push({name:"salt",type:"bytes32"});let yl={EIP712Domain:fr,...vl};return await je.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:Qt,types:yl,primaryType:xl,message:bl})]})}},We=await Oe();if(!We){ui.toast.error(r("predict.trade.submitError")),U(!1);return}let Ct=S==="yes"?0:1,ue="",Ht=e.provider_meta?.["polymarket.clobTokenIds"];Ht&&(ue=(typeof Ht=="string"?JSON.parse(Ht):Ht)[Ct]??"");let en=e.provider_meta?.["polymarket.negRisk"]??!1,jn=A==="limit"&&!isNaN(E)?E:He,$t=dn(jn,w),Yo={tokenId:ue,price:$t,size:P,side:"SELL",orderType:A==="limit"?he?"GTD":"GTC":"FOK",tickSize:w,negRisk:en,...ge&&{funderAddress:ge},...A==="limit"&&he&&{expiration:cn(ze,ve,rt)}},ul=reactPredict.buildCtfExchangeDomain(en),Go=reactPredict.buildOrderMessage({...Yo,signerAddress:ot.address,signatureType:ot.signatureType,feeRateBps:N}),ml=await ot.signTypedData(ul,reactPredict.CTF_ORDER_TYPES,"Order",Go),fl=reactPredict.buildSignedOrder(Go,ml,Yo.orderType),qo=reactPredict.buildClobPayload(fl,We.apiKey),gl=JSON.stringify(qo),hl=await reactPredict.buildPolymarketL2Headers(We.address,{apiKey:We.apiKey,secret:We.secret,passphrase:We.passphrase,method:"POST",requestPath:"/order",body:gl});await a.createPolymarketOrder(qo,hl),Nt(),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),wt(),U(!1);}finally{xe&&M&&i(M).catch(()=>{});}},[p,l,Oe,i,S,e.provider_meta,A,E,He,P,a,Nt,he,ze,ve,rt,wt,r,w,N,e.slug]),Zr=react.useCallback(async()=>{if(!(!zt.isValid||!d)){U(true),Y(null),st(false);try{c==="kalshi"?await Xr():await Jr();}catch(M){let xe=M instanceof Error?M.message:"",je=c==="polymarket"&&xe?pn(xe,r,"sell"):xe||void 0;ui.toast.error(je||r("predict.trade.submitError")),U(false);}}},[zt.isValid,d,c,Xr,Jr,r]);return {outcome:S,orderType:A,quantity:P,limitPrice:E,shares:Vn,estimatedReturn:D,isMarketDataLoading:c==="polymarket"&&(x||k),isSubmitting:de,validation:zt,supportsLimitOrder:m,kycRequired:Se,kycUrl:B,totalShares:dr,activeOrderShares:qt,availableShares:Dt,isAvailableLoading:Vr,isSellAll:b,precision:$e,expirationEnabled:he,expirationPreset:ze,customDuration:ve,customDurationUnit:rt,setOutcome:Te,setOrderType:lt,setQuantity:ur,setLimitPrice:St,setSellAll:Bt,setExpirationEnabled:Be,setExpirationPreset:bt,setCustomDuration:Ve,setCustomDurationUnit:nt,submit:Zr}}var Rp=["5m","1h","12h","24h","eod","custom"],Ip={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},Op=["minutes","hours","days"],Dp={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Ap={maximumFractionDigits:0};function hs({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,estimatedReturn:l,isMarketDataLoading:s,isSubmitting:c,isValid:m,validationErrors:u,supportsLimitOrder:p,kycRequired:d,kycUrl:f,totalShares:g,activeOrderShares:h,availableShares:v,isAvailableLoading:k,precision:w,expirationEnabled:R,expirationPreset:x,customDuration:N,customDurationUnit:S,onOutcomeChange:K,onOrderTypeChange:A,onQuantityChange:Q,onLimitPriceChange:P,onSellAll:L,onExpirationEnabledChange:E,onExpirationPresetChange:O,onCustomDurationChange:de,onCustomDurationUnitChange:U,onSubmit:b}){let{t:y}=i18n.useTranslation(),[j,Y]=react.useState(false),q=ui.useDisclosure(),[pe,Se]=react.useState(""),st=react.useRef(false);react.useEffect(()=>{st.current||Se(isNaN(i)?"":String(i));},[i]);let[he,Be]=react.useState(""),ze=react.useRef(false);react.useEffect(()=>{ze.current||(isNaN(a)?Be(""):Be(String(parseFloat((a*100).toFixed(2)))));},[a]);let bt=react.useCallback(B=>{if(B!==""&&!/^\d*\.?\d{0,2}$/.test(B))return;if(Be(B),B===""||B==="."){P(NaN);return}let Oe=parseFloat(B);isNaN(Oe)||P(Oe/100);},[P]),ve=react.useCallback(B=>{let ge=new RegExp(`^\\d*\\.?\\d{0,${w}}$`);if(B!==""&&!ge.test(B))return;if(Se(B),Y(false),B===""||B==="."){Q(NaN);return}let Oe=parseFloat(B);isNaN(Oe)||Q(Oe);},[Q,w]);react.useEffect(()=>{d&&!q.isOpen&&q.onOpen();},[d]);let Ve=react.useMemo(()=>{let B=n==="yes"?t.yesBid:t.noBid;return B!=null?parseFloat((Number(B)*100).toFixed(2)):null},[n,t]),rt=!isNaN(i)&&i>0,nt=react.useMemo(()=>{if(k)return y("predict.trade.loadingBalance");if(s)return y("predict.trade.loadingMarketData");if(c)return y("predict.trade.submitting");if(d)return y("predict.trade.kycRequired");if(!rt)return y("predict.trade.enterAmount");let B=y(n==="yes"?"predict.trade.yes":"predict.trade.no");return `${y("predict.trade.sell")} ${B}`},[k,s,c,d,rt,n,y]),we=()=>{if(d){q.onOpen();return}if(!m){Y(true);return}Y(false),b();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:B=>{r==="bordered"&&(B.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:B=>{r==="bordered"&&(B.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[y("predict.trade.sell")," ",y(n==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[p?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:B=>A(B),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.market")}),o==="limit"&&p?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:he,onChange:B=>bt(B.target.value),onFocus:()=>{ze.current=true;},onBlur:()=>{ze.current=false,isNaN(a)?Be(""):Be(String(parseFloat((a*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):Ve!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Ve," \xA2"]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(B=>{let ge=Math.pow(10,w);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{Q(Math.floor(v*B/100*ge)/ge);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:[B,"%"]},B)}),jsxRuntime.jsx("button",{type:"button",onClick:L,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("common.all")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:pe,onChange:B=>ve(B.target.value),onFocus:()=>{st.current=true;},onBlur:()=>{st.current=false,Se(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),j&&u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:u.map(B=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:B},B))})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:k?"\u2013":`${Pe(g,w).toFixed(w)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:k?"\u2013":h>0?`-${Pe(h,w).toFixed(w)}${y("predict.trade.sharesUnit")}`:`0${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:k?"\u2013":`${Pe(v,w).toFixed(w)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:"\u2013"})]})]}),o==="limit"&&p&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:y("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:R,onValueChange:E,"aria-label":y("predict.trade.setExpiration")})]}),R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":y("predict.trade.setExpiration"),selectedKeys:[x],onSelectionChange:B=>{let ge=Array.from(B)[0];ge&&O(ge);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Rp.map(B=>jsxRuntime.jsx(ui.SelectItem,{children:y(Ip[B])},B))}),x==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(N)?void 0:N,onValueChange:de,minValue:1,step:1,formatOptions:Ap,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[S],onSelectionChange:B=>{let ge=Array.from(B)[0];ge&&U(ge);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Op.map(B=>jsxRuntime.jsx(ui.SelectItem,{children:y(Dp[B])},B))})]})]})]}),jsxRuntime.jsx(ui.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:k||s||!rt||c,isLoading:c||k||s,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:we,children:nt})]}),jsxRuntime.jsx(un,{isOpen:q.isOpen,onClose:q.onClose,kycUrl:f})]})}function kn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:a,quantity:l,limitPrice:s,estimatedReturn:c,isMarketDataLoading:m,isSubmitting:u,validation:p,supportsLimitOrder:d,kycRequired:f,kycUrl:g,totalShares:h,activeOrderShares:v,availableShares:k,isAvailableLoading:w,precision:R,expirationEnabled:x,expirationPreset:N,customDuration:S,customDurationUnit:K,setOutcome:A,setOrderType:Q,setQuantity:P,setLimitPrice:L,setSellAll:E,setExpirationEnabled:O,setExpirationPreset:de,setCustomDuration:U,setCustomDurationUnit:b,submit:y}=as({market:t,initialOutcome:n}),j=walletConnector.useAuthCallback(y),Y=react.useMemo(()=>e?rn(e):void 0,[e]),q=react.useMemo(()=>nn(t),[t]);return jsxRuntime.jsx(hs,{event:Y,market:q,variant:r,outcome:i,orderType:a,quantity:l,limitPrice:s,estimatedReturn:c,isMarketDataLoading:m,isSubmitting:u,isValid:p.isValid,validationErrors:p.errors,supportsLimitOrder:d,kycRequired:f,kycUrl:g,totalShares:h,activeOrderShares:v,availableShares:k,isAvailableLoading:w,precision:R,expirationEnabled:x,expirationPreset:N,customDuration:S,customDurationUnit:K,onOutcomeChange:A,onOrderTypeChange:Q,onQuantityChange:P,onLimitPriceChange:L,onSellAll:E,onExpirationEnabledChange:O,onExpirationPresetChange:de,onCustomDurationChange:U,onCustomDurationUnitChange:b,onSubmit:j})}var co="predict-sell";function xs({id:e=co}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Kp,{...t})})}function Kp({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(kn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var mo=40,Pn=36,Or=480,fo=Or-Pn;function ks({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(u=>u.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),s=react.useMemo(()=>!l?.positions||!t?0:a.length===0?l.positions.length:l.positions.filter(u=>u.market&&a.includes(u.market.slug)).length,[l?.positions,a,t]),m=[{key:"positions",label:s>0?`${n("predict.positions.title")} (${s})`:n("predict.positions.title")},{key:"orders",label:n("predict.openOrders.title")},{key:"trades",label:n("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:m.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(u.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===u.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:u.label},u.key))}),t?jsxRuntime.jsxs("div",{style:{height:Or},children:[o==="positions"&&jsxRuntime.jsx(Xp,{source:e.source,walletAddress:t,marketSlugs:a}),o==="orders"&&jsxRuntime.jsx(Zp,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(ru,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Or},children:n("predict.trade.connectWallet")})]})}function Xp({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositions({source:e,user:t}),a=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(l=>l.market&&r.includes(l.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(ho,{}):a.length===0?jsxRuntime.jsx(go,{message:n("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:n("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},rowComponent:Jp,rowCount:a.length,rowHeight:mo,rowProps:{positions:a,closeLabel:n("predict.positions.close")}})]})}function Jp({index:e,style:t,positions:r,closeLabel:n}){let o=r[e];if(!o)return null;let i=o.pnl??0,a=o.pnl_percent??0,l=o.avg_price??0,s=o.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",m=i>0?"+":"",u=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",p=o.side,d=o.size,f=o.size*s,g=o.market?.end_at?iu(o.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:u}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",p.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:p})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:o.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Sn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Sn(s)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[m,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",m,a.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:n})})]})}function Zp({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:a,fetchNextPage:l,hasNextPage:s}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),m=react.useMemo(()=>{let v=i?.pages?.flatMap(R=>R.items)??[],k=new Set(["live","open","submitted","pending"]),w=v.filter(R=>k.has(R.status));return r.length>0&&(w=w.filter(R=>R.market_id&&r.includes(R.market_id))),w},[i?.pages,r]),u=react.useCallback(v=>{n?n(v.id):c.mutate({source:v.source,id:v.id});},[n,c]),p=m.length,d=p+(s?1:0),f=react.useCallback(v=>v<p,[p]),g=react.useCallback(async()=>{await l();},[l]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:d,threshold:5});return a?jsxRuntime.jsx(ho,{}):m.length===0&&!s?jsxRuntime.jsx(go,{message:o("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:o("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:o("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},onRowsRendered:h,rowComponent:eu,rowCount:d,rowHeight:mo,rowProps:{orders:m,itemCount:p,onCancel:u,isCancelling:c.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function eu({index:e,style:t,orders:r,itemCount:n,onCancel:o,isCancelling:i,cancelLabel:a}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let l=r[e];if(!l)return null;let s=l.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",s?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:l.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:l.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:l.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:l.price?Sn(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(tu,{status:l.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(l),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):a})})]})}function tu({status:e}){return jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function ru({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:n,isLoading:o,fetchNextPage:i,hasNextPage:a}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),l=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),s=l.length,c=s+(a?1:0),m=react.useCallback(d=>d<s,[s]),u=react.useCallback(async()=>{await i();},[i]),p=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:u,rowCount:c,threshold:5});return o?jsxRuntime.jsx(ho,{}):l.length===0&&!a?jsxRuntime.jsx(go,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},onRowsRendered:p,rowComponent:nu,rowCount:c,rowHeight:mo,rowProps:{trades:l,itemCount:s}})]})}function nu({index:e,style:t,trades:r,itemCount:n}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",a=ou(o.timestamp),l=o.price??0,s=o.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:o.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:o.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Sn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:a})]})}function go({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Or},children:e})}function ho(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Or},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Sn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function ou(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),o=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${n} ${o}:${i}`}function iu(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Ss=`
85
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:zd.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function Zi({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i}=i18n.useTranslation(),{mutateAsync:a}=reactPredict.useRedeemPosition(),{evmAddress:l}=Jt(),s=walletConnector.useWallets(),[c,p]=react.useState("idle"),[m,u]=react.useState(null),d=t.provider_meta?.["polymarket.conditionId"],f=t.provider_meta?.["polymarket.negRisk"]??false,g=l??"",h=react.useMemo(()=>s.find(H=>H.chainNamespace===types.ChainNamespace.EVM&&H.isConnected),[s]),x=Ji(r.side,t.outcomes),P=t.outcomes?.[x]?.label??r.side,E=t.result!=null?Ji(t.result,t.outcomes):-1,w=(E>=0?t.outcomes?.[E]:void 0)?.label??t.result??"",k=t.result!=null?x===E:true,K=react.useMemo(()=>k?r.size:0,[k,r.size]),I=react.useCallback(async()=>{if(!(!d||!g||!h)){p("pending"),u(null);try{let H=await h.getEip1193Provider();if(!H)throw new Error("EIP-1193 provider unavailable");await a({wallet_address:g,condition_id:d,neg_risk:f,signMessage:async R=>await H.request({method:"personal_sign",params:[R,g]})}),p("success"),n?.();}catch(H){p("error"),u(H instanceof Error?H.message:i("predict.redeem.error"));}}},[d,g,f,h,a,n,i]),q=walletConnector.useAuthCallback(I),N=c==="idle"&&!!d&&!!g&&!!h&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(bn,{label:i("predict.positions.side"),value:P,valueClassName:k?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(bn,{label:i("predict.redeem.result"),value:w,valueClassName:"text-green-400"}),jsxRuntime.jsx(bn,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(bn,{label:i("predict.redeem.expectedPayout"),value:`$${K.toFixed(2)}`,valueClassName:K>0?"text-green-400":"text-zinc-400"})]}),!k&&K===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),c==="error"&&m&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:m}),c==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[c!=="success"&&jsxRuntime.jsx(ui.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!N,isLoading:c==="pending",onPress:q,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&c!=="success"&&jsxRuntime.jsx("button",{type:"button",onClick:o,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),c==="success"&&o&&jsxRuntime.jsx(ui.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function bn({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function Ji(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let n=t.findIndex(o=>o.label.toLowerCase()===r);return n>=0?n:1}var ep="predict-redeem";function ts({id:e=ep}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(tp,{...t})})}function tp({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:n("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:n("predict.redeem.description")})]}),jsxRuntime.jsx(Zi,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function ss({market:e,initialOutcome:t="yes"}){let{t:r}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),o=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),a=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),s=reactQuery.useQueryClient(),c=e.source,p=c==="polymarket",m=o.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),u=o.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),d=n==="authenticated",f=m?.address,g=u?.address,h=react.useMemo(()=>{if(c!=="polymarket")return;let M=e.provider_meta?.["polymarket.clobTokenIds"];return M?(typeof M=="string"?JSON.parse(M):M)[0]:void 0},[c,e.provider_meta]),{data:x,isLoading:S}=reactPredict.useTickSize(h),P=x?.minimum_tick_size?String(x.minimum_tick_size):"0.01",{data:E,isLoading:v}=reactPredict.useFeeRate(h),w=String(E?.base_fee??0),[k,K]=react.useState(t),[I,q]=react.useState("market"),[N,H]=react.useState(NaN),[R,$]=react.useState(NaN),[Z,B]=react.useState(false),[b,y]=react.useState(false),[V,G]=react.useState(null),[Q,pe]=react.useState(null),[Se,st]=react.useState(false),[he,Be]=react.useState(false),[He,bt]=react.useState("1h"),[ve,Ve]=react.useState(30),[rt,nt]=react.useState("minutes"),we=false,A=null,ge;try{let M=Jt();we=M.kalshiKycVerified,A=M.kalshiKycUrl,ge=M.polymarketSafeAddress;}catch{}let Oe=react.useCallback(async()=>{if(!u||!l)return null;let M=await u.getEip1193Provider();if(!M)return null;let xe=!!ge,je={address:u.address,signatureType:xe?2:0,signTypedData:async(De,ot,We,Ct)=>{let ue=[];"name"in De&&ue.push({name:"name",type:"string"}),"version"in De&&ue.push({name:"version",type:"string"}),"chainId"in De&&ue.push({name:"chainId",type:"uint256"}),"verifyingContract"in De&&ue.push({name:"verifyingContract",type:"address"}),"salt"in De&&ue.push({name:"salt",type:"bytes32"});let zt={EIP712Domain:ue,...ot};return await M.request({method:"eth_signTypedData_v4",params:[u.address,JSON.stringify({domain:De,types:zt,primaryType:We,message:Ct})]})}};return l.credentials??await l.authenticate(je)},[ge,u,l]),ze=react.useMemo(()=>{let M=k==="yes"?0:1,xe=e.outcomes[M];return xe?.best_bid??xe?.price??.5},[e.outcomes,k]),_=c==="kalshi"?f??"":g??"",{data:Ee,isLoading:yt}=reactPredict.usePositions({source:c,user:_},{enabled:!!_,refetchInterval:3e4}),Wn=react.useCallback(async()=>{let M=await Oe();return M?await reactPredict.buildPolymarketL2Headers(M.address,{apiKey:M.apiKey,secret:M.secret,passphrase:M.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[Oe]),{data:at,isLoading:Yt}=reactPredict.useAvailableShares({source:c,user:_,market:e.slug,side:k},c==="polymarket"?{getHeaders:Wn}:void 0,{enabled:!!_&&!!e.slug,refetchOnMount:"always"}),dr=at?.total_shares??0,qt=at?.active_order_shares??0,Dt=at?.available_shares??0,$e=react.useMemo(()=>c==="polymarket"?reactPredict.getPolymarketSharesPrecision(P):at?.precision??0,[c,P,at?.precision]),Vr=Yt||yt,pr=e.provider_meta?.["dflow.yesMint"]??"",Un=e.provider_meta?.["dflow.noMint"]??"",mt=utils.SOLANA_TOKENS.stablecoins.USDC.address,jr=e.provider_meta?.["dflow.collateralMint"]||"",Gr=k==="yes"?pr:Un,Yr=react.useMemo(()=>Ee?Ee.positions.find(M=>M.side?.toLowerCase()===k&&M.market?.slug===e.slug)??null:null,[Ee,e.slug,k])?.market?.provider_meta,Kn=Yr?.["dflow.outcomeMint"]||Gr,ft=Yr?.["dflow.collateralMint"]||jr,kt=Kn,At=ft||mt,Ft=react.useMemo(()=>isNaN(N)||N<=0?"0":String(Math.round(N*1e6)),[N]),qr=c==="kalshi"&&!!kt&&!!At&&!!f&&Ft!=="0",{refetch:Pr}=reactPredict.useDFlowQuote({inputMint:kt,outputMint:At,amount:Ft,userPublicKey:f??"",slippageBps:100},{enabled:qr}),Vn=react.useMemo(()=>isNaN(N)||N<=0?0:N,[N]),O=react.useMemo(()=>{if(isNaN(N)||N<=0)return 0;let M=I==="limit"&&p&&!isNaN(R)?R:ze;return N*M},[N,I,p,R,ze]),Te=react.useCallback(M=>{K(M),$(NaN),H(NaN),y(false);},[]),lt=react.useCallback(M=>{q(M);},[]);react.useEffect(()=>{I==="limit"&&$(Math.round(ze*100)/100);},[I,k]);let ur=react.useCallback(M=>{if(y(false),isNaN(M)){H(NaN);return}H(Pe(Math.max(0,M),$e));},[$e]),Bt=react.useCallback(()=>{y(true),H(Pe(Dt,$e));},[Dt,$e]),St=react.useCallback(M=>{if(isNaN(M)){$(NaN);return}let xe=Math.max(.01,Math.min(.99,M));$(Math.round(xe*100)/100);},[]),wt=react.useCallback(()=>{H(NaN),$(NaN),q("market"),y(false),Be(false),bt("1h"),Ve(30),nt("minutes");},[]),Ht=react.useMemo(()=>{let M=[];return isNaN(N)||N<=0?M.push(r("predict.trade.minQuantity",{amount:an})):N<an&&M.push(r("predict.trade.minQuantity",{amount:an})),e.status!=="open"&&M.push(r("predict.trade.marketNotActive")),!isNaN(N)&&N>0&&!b&&N>Dt&&M.push(r("predict.trade.insufficientSharesDetail",{total:Pe(dr,$e).toFixed($e),active:Pe(qt,$e).toFixed($e),available:Pe(Dt,$e).toFixed($e)})),I==="limit"&&p&&(isNaN(R)||R<.01||R>.99)&&M.push(r("predict.trade.limitPriceRange")),I==="limit"&&p&&he&&He==="custom"&&(isNaN(ve)||ve<=0)&&M.push(r("predict.trade.expiration.invalidDate")),{isValid:M.length===0,errors:M}},[N,e.status,Dt,dr,qt,b,I,p,R,he,He,ve,$e,r]),{mutateAsync:Pt}=reactPredict.useDFlowSubmit(),{data:mr}=reactPredict.useOrder({id:V??"",source:c},{enabled:!!V}),Qr=react.useCallback(async()=>{if(!Q||!f||!m)return;let{cashAmount:M,collateral:xe}=Q;pe(null);try{let De=(await a.createDFlowQuote({inputMint:xe,outputMint:mt,amount:M,userPublicKey:f,slippageBps:100}))?.transaction;if(!De)return;let ot=Uint8Array.from(atob(De),Ct=>Ct.charCodeAt(0)),We=await m.signTransaction(ot);await Pt({signedTransaction:btoa(String.fromCharCode(...We)),orderContext:{user_public_key:f,input_mint:xe,output_mint:mt,amount:M,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[Q,f,m,a,Pt,mt]),Nt=react.useCallback(()=>{s.invalidateQueries({queryKey:["predict","positions"]}),s.invalidateQueries({queryKey:["predict","orders"]}),s.invalidateQueries({queryKey:["predict","available-shares"]});},[s]);react.useEffect(()=>{if(!mr||!V)return;let{status:M}=mr;M==="closed"?(G(null),Q?Qr().finally(()=>{B(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),Nt(),wt();}):(B(false),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),Nt(),wt())):(M==="failed"||M==="expired")&&(B(false),G(null),pe(null),ui.toast.error(r("predict.trade.submitError")));},[mr,V,Q,Qr,Nt,wt,r]);let Xr=react.useCallback(async()=>{if(!f||!m)return;if(!kt||!At){ui.toast.error("Missing token mint addresses"),B(false);return}if(!we){st(true),B(false);return}let je=(await Pr()).data,De=je?.transaction;if(!De){ui.toast.error(r("predict.trade.submitError")),B(false);return}if(ft&&ft!==mt){let ue=String(je?.outAmount??"");ue&&ue!=="0"&&pe({cashAmount:ue,collateral:ft});}let ot=Uint8Array.from(atob(De),ue=>ue.charCodeAt(0)),We=await m.signTransaction(ot),Ct=await Pt({signedTransaction:btoa(String.fromCharCode(...We)),orderContext:{user_public_key:f,input_mint:kt,output_mint:At,amount:Ft,price:String(ze),side:"SELL",outcome:k==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});G(Ct.signature);},[f,m,Pr,Pt,kt,At,Ft,ze,k,e.slug,ft,mt,r,we]),Jr=react.useCallback(async()=>{if(!u||!l)return;let M=u.chain,xe=M!==types.Chain.POLYGON;xe&&await i(types.Chain.POLYGON);try{let je=await u.getEip1193Provider();if(!je){ui.toast.error(r("predict.trade.submitError")),B(!1);return}let De=!!ge,ot={address:u.address,signatureType:De?2:0,signTypedData:async(Qt,hl,vl,xl)=>{let fr=[];"name"in Qt&&fr.push({name:"name",type:"string"}),"version"in Qt&&fr.push({name:"version",type:"string"}),"chainId"in Qt&&fr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Qt&&fr.push({name:"verifyingContract",type:"address"}),"salt"in Qt&&fr.push({name:"salt",type:"bytes32"});let bl={EIP712Domain:fr,...hl};return await je.request({method:"eth_signTypedData_v4",params:[u.address,JSON.stringify({domain:Qt,types:bl,primaryType:vl,message:xl})]})}},We=await Oe();if(!We){ui.toast.error(r("predict.trade.submitError")),B(!1);return}let Ct=k==="yes"?0:1,ue="",zt=e.provider_meta?.["polymarket.clobTokenIds"];zt&&(ue=(typeof zt=="string"?JSON.parse(zt):zt)[Ct]??"");let en=e.provider_meta?.["polymarket.negRisk"]??!1,jn=I==="limit"&&!isNaN(R)?R:ze,$t=dn(jn,P),jo={tokenId:ue,price:$t,size:N,side:"SELL",orderType:I==="limit"?he?"GTD":"GTC":"FOK",tickSize:P,negRisk:en,...ge&&{funderAddress:ge},...I==="limit"&&he&&{expiration:cn(He,ve,rt)}},pl=reactPredict.buildCtfExchangeDomain(en),Go=reactPredict.buildOrderMessage({...jo,signerAddress:ot.address,signatureType:ot.signatureType,feeRateBps:w}),ul=await ot.signTypedData(pl,reactPredict.CTF_ORDER_TYPES,"Order",Go),ml=reactPredict.buildSignedOrder(Go,ul,jo.orderType),Yo=reactPredict.buildClobPayload(ml,We.apiKey),fl=JSON.stringify(Yo),gl=await reactPredict.buildPolymarketL2Headers(We.address,{apiKey:We.apiKey,secret:We.secret,passphrase:We.passphrase,method:"POST",requestPath:"/order",body:fl});await a.createPolymarketOrder(Yo,gl),Nt(),ui.toast.success(r("predict.trade.submitSuccess")),Zt(),wt(),B(!1);}finally{xe&&M&&i(M).catch(()=>{});}},[u,l,Oe,i,k,e.provider_meta,I,R,ze,N,a,Nt,he,He,ve,rt,wt,r,P,w,e.slug]),Zr=react.useCallback(async()=>{if(!(!Ht.isValid||!d)){B(true),G(null),st(false);try{c==="kalshi"?await Xr():await Jr();}catch(M){let xe=M instanceof Error?M.message:"",je=c==="polymarket"&&xe?pn(xe,r,"sell"):xe||void 0;ui.toast.error(je||r("predict.trade.submitError")),B(false);}}},[Ht.isValid,d,c,Xr,Jr,r]);return {outcome:k,orderType:I,quantity:N,limitPrice:R,shares:Vn,estimatedReturn:O,isMarketDataLoading:c==="polymarket"&&(v||S),isSubmitting:Z,validation:Ht,supportsLimitOrder:p,kycRequired:Se,kycUrl:A,totalShares:dr,activeOrderShares:qt,availableShares:Dt,isAvailableLoading:Vr,isSellAll:b,precision:$e,expirationEnabled:he,expirationPreset:He,customDuration:ve,customDurationUnit:rt,setOutcome:Te,setOrderType:lt,setQuantity:ur,setLimitPrice:St,setSellAll:Bt,setExpirationEnabled:Be,setExpirationPreset:bt,setCustomDuration:Ve,setCustomDurationUnit:nt,submit:Zr}}var _p=["5m","1h","12h","24h","eod","custom"],Rp={"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"},Ip=["minutes","hours","days"],Op={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Dp={maximumFractionDigits:0};function gs({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,estimatedReturn:l,isMarketDataLoading:s,isSubmitting:c,isValid:p,validationErrors:m,supportsLimitOrder:u,kycRequired:d,kycUrl:f,totalShares:g,activeOrderShares:h,availableShares:x,isAvailableLoading:S,precision:P,expirationEnabled:E,expirationPreset:v,customDuration:w,customDurationUnit:k,onOutcomeChange:K,onOrderTypeChange:I,onQuantityChange:q,onLimitPriceChange:N,onSellAll:H,onExpirationEnabledChange:R,onExpirationPresetChange:$,onCustomDurationChange:Z,onCustomDurationUnitChange:B,onSubmit:b}){let{t:y}=i18n.useTranslation(),[V,G]=react.useState(false),Q=ui.useDisclosure(),[pe,Se]=react.useState(""),st=react.useRef(false);react.useEffect(()=>{st.current||Se(isNaN(i)?"":String(i));},[i]);let[he,Be]=react.useState(""),He=react.useRef(false);react.useEffect(()=>{He.current||(isNaN(a)?Be(""):Be(String(parseFloat((a*100).toFixed(2)))));},[a]);let bt=react.useCallback(A=>{if(A!==""&&!/^\d*\.?\d{0,2}$/.test(A))return;if(Be(A),A===""||A==="."){N(NaN);return}let Oe=parseFloat(A);isNaN(Oe)||N(Oe/100);},[N]),ve=react.useCallback(A=>{let ge=new RegExp(`^\\d*\\.?\\d{0,${P}}$`);if(A!==""&&!ge.test(A))return;if(Se(A),G(false),A===""||A==="."){q(NaN);return}let Oe=parseFloat(A);isNaN(Oe)||q(Oe);},[q,P]);react.useEffect(()=>{d&&!Q.isOpen&&Q.onOpen();},[d]);let Ve=react.useMemo(()=>{let A=n==="yes"?t.yesBid:t.noBid;return A!=null?parseFloat((Number(A)*100).toFixed(2)):null},[n,t]),rt=!isNaN(i)&&i>0,nt=react.useMemo(()=>{if(S)return y("predict.trade.loadingBalance");if(s)return y("predict.trade.loadingMarketData");if(c)return y("predict.trade.submitting");if(d)return y("predict.trade.kycRequired");if(!rt)return y("predict.trade.enterAmount");let A=y(n==="yes"?"predict.trade.yes":"predict.trade.no");return `${y("predict.trade.sell")} ${A}`},[S,s,c,d,rt,n,y]),we=()=>{if(d){Q.onOpen();return}if(!p){G(true);return}G(false),b();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:A=>{r==="bordered"&&(A.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:A=>{r==="bordered"&&(A.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:"text-bearish",children:[y("predict.trade.sell")," ",y(n==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[u?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:A=>I(A),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.market")}),o==="limit"&&u?jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:he,onChange:A=>bt(A.target.value),onFocus:()=>{He.current=true;},onBlur:()=>{He.current=false,isNaN(a)?Be(""):Be(String(parseFloat((a*100).toFixed(2))));},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):Ve!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Ve," \xA2"]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(A=>{let ge=Math.pow(10,P);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{q(Math.floor(x*A/100*ge)/ge);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:[A,"%"]},A)}),jsxRuntime.jsx("button",{type:"button",onClick:H,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("common.all")})]})]}),jsxRuntime.jsx(ui.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:pe,onChange:A=>ve(A.target.value),onFocus:()=>{st.current=true;},onBlur:()=>{st.current=false,Se(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),V&&m.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:m.map(A=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:A},A))})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:S?"\u2013":`${Pe(g,P).toFixed(P)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:S?"\u2013":h>0?`-${Pe(h,P).toFixed(P)}${y("predict.trade.sharesUnit")}`:`0${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:S?"\u2013":`${Pe(x,P).toFixed(P)}${y("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:y("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:"\u2013"})]})]}),o==="limit"&&u&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:y("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:E,onValueChange:R,"aria-label":y("predict.trade.setExpiration")})]}),E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":y("predict.trade.setExpiration"),selectedKeys:[v],onSelectionChange:A=>{let ge=Array.from(A)[0];ge&&$(ge);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:_p.map(A=>jsxRuntime.jsx(ui.SelectItem,{children:y(Rp[A])},A))}),v==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(w)?void 0:w,onValueChange:Z,minValue:1,step:1,formatOptions:Dp,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:[k],onSelectionChange:A=>{let ge=Array.from(A)[0];ge&&B(ge);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ip.map(A=>jsxRuntime.jsx(ui.SelectItem,{children:y(Op[A])},A))})]})]})]}),jsxRuntime.jsx(ui.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:S||s||!rt||c,isLoading:c||S||s,spinner:jsxRuntime.jsx(ui.Spinner,{size:"sm",color:"current"}),onPress:we,children:nt})]}),jsxRuntime.jsx(un,{isOpen:Q.isOpen,onClose:Q.onClose,kycUrl:f})]})}function kn({event:e,market:t,variant:r,initialOutcome:n,chain:o}){let{outcome:i,orderType:a,quantity:l,limitPrice:s,estimatedReturn:c,isMarketDataLoading:p,isSubmitting:m,validation:u,supportsLimitOrder:d,kycRequired:f,kycUrl:g,totalShares:h,activeOrderShares:x,availableShares:S,isAvailableLoading:P,precision:E,expirationEnabled:v,expirationPreset:w,customDuration:k,customDurationUnit:K,setOutcome:I,setOrderType:q,setQuantity:N,setLimitPrice:H,setSellAll:R,setExpirationEnabled:$,setExpirationPreset:Z,setCustomDuration:B,setCustomDurationUnit:b,submit:y}=ss({market:t,initialOutcome:n}),V=walletConnector.useAuthCallback(y),G=react.useMemo(()=>e?rn(e):void 0,[e]),Q=react.useMemo(()=>nn(t),[t]);return jsxRuntime.jsx(gs,{event:G,market:Q,variant:r,outcome:i,orderType:a,quantity:l,limitPrice:s,estimatedReturn:c,isMarketDataLoading:p,isSubmitting:m,isValid:u.isValid,validationErrors:u.errors,supportsLimitOrder:d,kycRequired:f,kycUrl:g,totalShares:h,activeOrderShares:x,availableShares:S,isAvailableLoading:P,precision:E,expirationEnabled:v,expirationPreset:w,customDuration:k,customDurationUnit:K,onOutcomeChange:I,onOrderTypeChange:q,onQuantityChange:N,onLimitPriceChange:H,onSellAll:R,onExpirationEnabledChange:$,onExpirationPresetChange:Z,onCustomDurationChange:B,onCustomDurationUnitChange:b,onSubmit:V})}var co="predict-sell";function vs({id:e=co}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Up,{...t})})}function Up({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(kn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var mo=40,Pn=36,Or=480,fo=Or-Pn;function ys({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(m=>m.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),s=react.useMemo(()=>!l?.positions||!t?0:a.length===0?l.positions.length:l.positions.filter(m=>m.market&&a.includes(m.market.slug)).length,[l?.positions,a,t]),p=[{key:"positions",label:s>0?`${n("predict.positions.title")} (${s})`:n("predict.positions.title")},{key:"orders",label:n("predict.openOrders.title")},{key:"trades",label:n("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:p.map(m=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(m.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===m.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:m.label},m.key))}),t?jsxRuntime.jsxs("div",{style:{height:Or},children:[o==="positions"&&jsxRuntime.jsx(Qp,{source:e.source,walletAddress:t,marketSlugs:a}),o==="orders"&&jsxRuntime.jsx(Jp,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(tu,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Or},children:n("predict.trade.connectWallet")})]})}function Qp({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositions({source:e,user:t}),a=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(l=>l.market&&r.includes(l.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(ho,{}):a.length===0?jsxRuntime.jsx(go,{message:n("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:n("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},rowComponent:Xp,rowCount:a.length,rowHeight:mo,rowProps:{positions:a,closeLabel:n("predict.positions.close")}})]})}function Xp({index:e,style:t,positions:r,closeLabel:n}){let o=r[e];if(!o)return null;let i=o.pnl??0,a=o.pnl_percent??0,l=o.avg_price??0,s=o.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",p=i>0?"+":"",m=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",u=o.side,d=o.size,f=o.size*s,g=o.market?.end_at?ou(o.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:m}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",u.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:u})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:o.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Sn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Sn(s)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[p,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,a.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:n})})]})}function Jp({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:a,fetchNextPage:l,hasNextPage:s}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),p=react.useMemo(()=>{let x=i?.pages?.flatMap(E=>E.items)??[],S=new Set(["live","open","submitted","pending"]),P=x.filter(E=>S.has(E.status));return r.length>0&&(P=P.filter(E=>E.market_id&&r.includes(E.market_id))),P},[i?.pages,r]),m=react.useCallback(x=>{n?n(x.id):c.mutate({source:x.source,id:x.id});},[n,c]),u=p.length,d=u+(s?1:0),f=react.useCallback(x=>x<u,[u]),g=react.useCallback(async()=>{await l();},[l]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:d,threshold:5});return a?jsxRuntime.jsx(ho,{}):p.length===0&&!s?jsxRuntime.jsx(go,{message:o("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:o("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:o("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},onRowsRendered:h,rowComponent:Zp,rowCount:d,rowHeight:mo,rowProps:{orders:p,itemCount:u,onCancel:m,isCancelling:c.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function Zp({index:e,style:t,orders:r,itemCount:n,onCancel:o,isCancelling:i,cancelLabel:a}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let l=r[e];if(!l)return null;let s=l.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",s?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:l.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:l.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:l.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:l.price?Sn(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(eu,{status:l.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(l),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):a})})]})}function eu({status:e}){return jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function tu({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:n,isLoading:o,fetchNextPage:i,hasNextPage:a}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),l=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),s=l.length,c=s+(a?1:0),p=react.useCallback(d=>d<s,[s]),m=react.useCallback(async()=>{await i();},[i]),u=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:m,rowCount:c,threshold:5});return o?jsxRuntime.jsx(ho,{}):l.length===0&&!a?jsxRuntime.jsx(go,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:Pn},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:fo},onRowsRendered:u,rowComponent:ru,rowCount:c,rowHeight:mo,rowProps:{trades:l,itemCount:s}})]})}function ru({index:e,style:t,trades:r,itemCount:n}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",a=nu(o.timestamp),l=o.price??0,s=o.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:o.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:o.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Sn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:a})]})}function go({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Or},children:e})}function ho(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Or},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Sn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function nu(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),o=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${n} ${o}:${i}`}function ou(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var ks=`
86
86
  @keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
87
- `,ws={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function ae(e){return {...ws,animationDelay:`${e}ms`}}function Dr({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ss}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...ws,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...ae(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...ae(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...ae(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...ae(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...ae(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...ae(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...ae(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...ae(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...ae(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...ae(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ae(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...ae(240),height:14,width:56}})}),Array.from({length:e}).map((r,n)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...ae(260+n*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...ae(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...ae(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...ae(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...ae(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ae(360+n*40),height:32,width:80,borderRadius:8}})]})]},n))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...ae(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...ae(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...ae(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...ae(460),height:14,width:"60%"}})]})]})]})}function Ps(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ss}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...ae(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ae(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ae(120),height:40,width:"100%",borderRadius:8}})]})]})}var Ts="var(--color-bullish)",Ls="var(--color-bearish)";function Ar(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function lu(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function cu(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let f=Math.round(d.price*100);f>=0&&f<=100&&(r[f]+=d.quantity);}for(let d of t){let f=Math.round(d.price*100);f>=0&&f<=100&&(n[f]+=d.quantity);}let o=0,i=0,a=new Float64Array(101),l=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,a[d]=o,l[d]=i;let s=0,c=0,m=new Float64Array(101),u=new Float64Array(101);for(let d=0;d<=100;d++)s+=n[d],c+=n[d]*d/100,m[d]=s,u[d]=c;let p=Math.max(a[0]??0,m[100]??0);return Array.from({length:101},(d,f)=>{let g=a[f]>0,h=m[f]>0,v=a[f]||m[f],k=r[f]>0||n[f]>0;return {priceCents:f,displayHeight:lu(v,p),opacity:v>0?k?1:.5:0,isBid:g,isAsk:h,bidCumTotal:a[f],askCumTotal:m[f],bidCumCost:l[f],askCumCost:u[f]}})}function du({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Ts:Ls,n=e.leftPct>65?void 0:`${e.leftPct}%`,o=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:n,right:o,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:Ar(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Ar(Math.round(e.cumCost))]})]})}var pu=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,a=t.isBid?Ts:t.isAsk?Ls:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,o.current),onMouseLeave:n,children:i&&jsxRuntime.jsx("div",{ref:o,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:a,opacity:t.opacity}})})}),uu=[0,10,20,30,40,50,60,70,80,90,100];function mu(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:uu.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function _s({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>cu(e,t),[e,t]),o=react.useMemo(()=>{let u=e.length>0?Math.max(...e.map(d=>d.price)):0,p=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((u+p)/2*100)},[e,t]),i=react.useMemo(()=>n.some(u=>u.isBid||u.isAsk),[n]),[a,l]=react.useState(null),s=react.useRef(null),c=react.useCallback((u,p)=>{s.current&&(s.current.style.filter=""),p?(p.style.filter="brightness(1.5)",s.current=p):s.current=null,u.isBid||u.isAsk?l({priceCents:u.priceCents,isBid:u.isBid,cumTotal:u.isBid?u.bidCumTotal:u.askCumTotal,cumCost:u.isBid?u.bidCumCost:u.askCumCost,leftPct:u.priceCents}):l(null);},[]),m=react.useCallback(()=>{s.current&&(s.current.style.filter="",s.current=null),l(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[o>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${o}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),a&&jsxRuntime.jsx(du,{info:a}),n.map(u=>jsxRuntime.jsx(pu,{slot:u,onEnter:c,onLeave:m},u.priceCents))]}),jsxRuntime.jsx(mu,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function xo(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Rs(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function As({market:e,outcome:t="yes",onTradeAction:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("depth"),a=t==="no",l=e.source,{data:s,isLoading:c,isFetching:m,refetch:u}=reactPredict.useOrderbook({slug:e.slug,source:l}),p=react.useMemo(()=>((a?s?.asks:s?.bids)??[]).map(k=>({price:a?1-k.price:k.price,quantity:k.size})),[s?.bids,s?.asks,a]),d=react.useMemo(()=>((a?s?.bids:s?.asks)??[]).map(k=>({price:a?1-k.price:k.price,quantity:k.size})),[s?.bids,s?.asks,a]),f=react.useMemo(()=>p.length>0?Math.max(...p.map(v=>v.price)):null,[p]),g=react.useMemo(()=>d.length>0?Math.min(...d.map(v=>v.price)):null,[d]),h=react.useMemo(()=>{if(f==null||g==null)return null;let v=(g-f)*100;return Math.round(v*10)/10},[f,g]);return jsxRuntime.jsxs("div",{className:"flex flex-col h-[262px]",children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:h!=null?`${n("predict.orderBook.spread")}: ${Number.isInteger(h)?`${h}\xA2`:`${h.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[f!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[n("predict.trade.bestBid"),": ",xo(f)]}),f!=null&&g!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),g!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[n("predict.trade.bestAsk"),": ",xo(g)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:o==="depth"?"Orderbook":"Depth chart",onClick:()=>i(v=>v==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:o==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>u(),disabled:m,className:ui.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",m&&"animate-spin"),children:jsxRuntime.jsx(ui.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[o==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Rs,{}):jsxRuntime.jsx(_s,{bids:p,asks:d})}),o==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Rs,{}):jsxRuntime.jsx(ku,{bids:p,asks:d,bestBid:f??void 0,bestAsk:g??void 0,spread:h??void 0})})]})]})}var Is=8;function ku({bids:e,asks:t,spread:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>[...t].sort((s,c)=>s.price-c.price).slice(0,Is).reverse(),[t]),i=react.useMemo(()=>[...e].sort((s,c)=>c.price-s.price).slice(0,Is),[e]),a=react.useMemo(()=>{let s=[...o,...i].map(c=>c.quantity);return Math.max(...s,1)},[o,i]);return o.length===0&&i.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:n("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[o.map(s=>jsxRuntime.jsx(Os,{price:s.price,quantity:s.quantity,side:"ask",maxQty:a},`ask-${s.price}`)),jsxRuntime.jsx("div",{className:"flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:r!=null&&jsxRuntime.jsxs("span",{children:[n("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]})}),i.map(s=>jsxRuntime.jsx(Os,{price:s.price,quantity:s.quantity,side:"bid",maxQty:a},`bid-${s.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:n("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:n("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:n("predict.orderBook.total")})]})]})}function Os({price:e,quantity:t,side:r,maxQty:n}){let o=r==="ask",i=Math.min(t/n*100,100),a=o?"bg-bearish/10":"bg-bullish/10",l=o?"text-bearish":"text-bullish",s=Ar(Math.round(t)),c=Math.round(t*e),m=`$${Ar(c)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${a} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:xo(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:s}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:m})]})}var ko=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},Mn=4,Fs=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Iu(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Ou(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Bs(e){return `${(e*100).toFixed(2)}%`}var Du=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function Au({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Du.map(({range:r,label:n})=>{let o=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:o?"#f9fafb":"#6b7280",fontWeight:o?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:n},r)})})}function Fu(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(o=>{let i=e.current,a=t.current;if(!i||!a)return;let l=i.getBoundingClientRect(),s=(o.clientX-l.left)/l.width*100;a.style.background=`linear-gradient(to right, transparent ${s}%, rgba(0,0,0,0.55) ${s}%)`,a.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function Bu({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let a=new Map;t?.forEach(s=>a.set(s.dataKey,s));let l=o.map(s=>a.get(s.slug)??{dataKey:s.slug,value:void 0,stroke:s.color,color:s.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?Ou(r,i):r}),l.map(s=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:s.stroke??s.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:n.get(s.dataKey)??s.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s.value!=null?Bs(s.value):"--"})]},s.dataKey))]})}function zu({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!o)return;function c(m){a.current&&!a.current.contains(m.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]);let l=t.length>=Mn,s=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(m=>m.slug===t[0]);return c?.outcomes?.[0]?.label??c?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(c=>!c),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[s,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),o&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",Mn," markets"]}),e.map((c,m)=>{let u=t.includes(c.slug),p=!u&&l,d=u&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(v=>v.label.toLowerCase()==="yes")??c.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||p||n(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:u?"rgba(255,255,255,0.05)":"transparent",cursor:p||d?"not-allowed":"pointer",opacity:p?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!p&&!d&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.currentTarget.style.background=u?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:u?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:u?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:u&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:u?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${m}-${c.slug}`)})]})]})}function Hu({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(n=>{let o=t.get(n.marketSlug)??"#6b7280",i=r.get(n.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:o,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:n.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?Bs(i):"--"})]})]},n.marketSlug)})})}function $u(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Wu(e,t){if(e.length<=t)return e;let r=[],n=e.length/t;for(let o=0;o<t;o++){let i=Math.floor(o*n),a=Math.min(Math.floor((o+1)*n),e.length),l=e.slice(i,a),s=l.map(c=>c.price).sort((c,m)=>c-m);r.push({timestamp:l[l.length-1].timestamp,price:$u(s)});}return r}function Uu(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:Wu(l.data,t)})),n=new Set;r.forEach(l=>l.data.forEach(s=>n.add(s.timestamp)));let o=Array.from(n).sort((l,s)=>l-s),i=r.map(l=>{let s=new Map;return l.data.forEach(c=>s.set(c.timestamp,c.price)),{slug:l.marketSlug,map:s}}),a=new Map;return o.map(l=>{let s={timestamp:l};return i.forEach(({slug:c,map:m})=>{let u=m.get(l);if(u!==void 0)a.set(c,u),s[c]=u;else {let p=a.get(c);p!==void 0&&(s[c]=p);}}),s})}function zs(e){return jsxRuntime.jsx(ko,{children:jsxRuntime.jsx(Ku,{...e})})}function Ku({event:e,isLoading:t,className:r,volume:n}){let o=react.useMemo(()=>{let b=new Set;return (e.markets??[]).filter(y=>y.status!=="open"||b.has(y.slug)?false:(b.add(y.slug),true))},[e.markets]),i=react.useMemo(()=>[...o].sort((b,y)=>{let j=Y=>(Y.outcomes.find(q=>q.label.toLowerCase()==="yes")??Y.outcomes[0])?.price??0;return j(y)-j(b)}),[o]),[a,l]=react.useState(()=>i.slice(0,Mn).map(b=>b.slug)),[s,c]=react.useState(sn),m=react.useMemo(()=>{let b=new Map;return a.forEach((y,j)=>{b.set(y,Fs[j%Fs.length]);}),b},[a]),u=react.useMemo(()=>o.filter(b=>a.includes(b.slug)),[o,a]),{series:p,isLoading:d}=reactPredict.useMarketHistory(u,s),f=t||d,g=react.useMemo(()=>{if(p.length>0&&p.some(j=>j.data.length>0))return p;let b=Date.now(),y=864e5;return u.map(j=>{let q=(j.outcomes?.find(pe=>pe.label.toLowerCase()==="yes")??j.outcomes?.[0])?.price??.5;return {marketSlug:j.slug,label:j.outcomes?.[0]?.label??j.question,data:[{timestamp:b-7*y,price:q},{timestamp:b,price:q}]}})},[p,u]),h=react.useMemo(()=>s===reactPredict.ChartRange.ONE_DAY?96:s===reactPredict.ChartRange.ONE_WEEK?168:s===reactPredict.ChartRange.ONE_MONTH?180:300,[s]),v=react.useMemo(()=>Uu(g,h),[g,h]),k=react.useMemo(()=>{if(v.length===0)return [0,1];let b=1/0,y=-1/0;if(a.forEach(Y=>{v.forEach(q=>{let pe=q[Y];pe!=null&&(pe<b&&(b=pe),pe>y&&(y=pe));});}),!isFinite(b))return [0,1];let j=Math.max((y-b)*.15,.05);return [Math.max(0,b-j),Math.min(1,y+j)]},[v,a]),w=react.useMemo(()=>{let b=new Map;return g.forEach(y=>{y.data.length>0&&b.set(y.marketSlug,y.data[y.data.length-1].price);}),b},[g]),R=react.useMemo(()=>{let b=new Map;return g.forEach(y=>b.set(y.marketSlug,y.label)),b},[g]),x=react.useMemo(()=>g.map(b=>({slug:b.marketSlug,color:m.get(b.marketSlug)??"#6b7280"})),[g,m]),{wrapperRef:N,overlayRef:S,onMouseMove:K,onMouseLeave:A}=Fu(),Q=react.useCallback(b=>{l(y=>y.includes(b)?y.length<=1?y:y.filter(j=>j!==b):y.length>=Mn?y:[...y,b]);},[]),[P,L]=react.useState(null),E=react.useRef(null),O=react.useRef(""),de=react.useRef(0),U=!f&&v.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Hu,{series:g,colorMap:m,displayValues:P??w}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:N,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:U?b=>{K(b),cancelAnimationFrame(de.current),de.current=requestAnimationFrame(()=>{L(E.current);});}:void 0,onMouseLeave:U?()=>{A(),cancelAnimationFrame(de.current),O.current="",E.current=null,L(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):v.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:S,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:v,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:b=>Iu(b,s),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:k,tickFormatter:b=>`${Math.round(b*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:b=>{let y=b;if(y.active&&y.payload?.length){let j=y.payload.map(Y=>`${Y.dataKey}:${Y.value}`).join(",");if(j!==O.current){O.current=j;let Y=new Map;y.payload.forEach(q=>{q.value!=null&&Y.set(q.dataKey,q.value);}),E.current=Y;}}return jsxRuntime.jsx(Bu,{...y,labelMap:R,allSeries:x,range:s})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(b=>{let y=m.get(b.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:b.marketSlug,stroke:y,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:y},connectNulls:true,isAnimationActive:false},b.marketSlug)}),P==null&&v.length>0&&g.map(b=>{let y=v[v.length-1],j=y[b.marketSlug];if(j==null)return null;let Y=m.get(b.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:y.timestamp,y:j,ifOverflow:"extendDomain",shape:q=>{let{cx:pe,cy:Se}=q;return pe==null||Se==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:pe,cy:Se,r:6,fill:Y,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:pe,cy:Se,r:3.5,fill:Y})]})}},`pulse-${b.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[n!=null&&n>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:["$",Math.round(n).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(Au,{value:s,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(zu,{markets:i,selectedSlugs:a,colorMap:m,onToggle:Q})})]})]})]})}function Br(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function nm(e){return `${parseFloat((e*100).toFixed(2))}%`}function Hs(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function En(e){return e.outcomes?.[0]?.label??e.question}function om(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Fr(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return `${r} ${n}, ${o} ${i}:${a}`}function $s(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let m=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(m)},[e]),!e||t===0)return null;let n=new Date(e).getTime();if(isNaN(n))return null;let o=n-t;if(o<=0)return null;let i=Math.floor(o/864e5),a=Math.floor(o%864e5/36e5),l=Math.floor(o%36e5/6e4),s=Math.floor(o%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(a).padStart(2,"0")}h`),c.push(`${String(l).padStart(2,"0")}m`),c.push(`${String(s).padStart(2,"0")}s`),c.join(" ")}function Ws(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),a=t.getFullYear(),l=-t.getTimezoneOffset(),s=l>=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}function js({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let u=[...e.markets||[]],p=u.filter(f=>f.status==="open").sort((f,g)=>Br(g)-Br(f)),d=u.filter(f=>f.status!=="open").sort((f,g)=>Br(g)-Br(f));return [...p,...d]},[e.markets]),a=e.status==="closed"||e.status==="voided",l=$s(a?void 0:e.start_at),s=$s(a?void 0:e.end_at),c=Ws(e.start_at),m=Ws(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:n,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${o?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${o?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!o&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((u,p)=>jsxRuntime.jsxs(react.Fragment,{children:[p>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:u.label})]},u.slug)),jsxRuntime.jsx(lm,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${o?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(l||s||a)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:a?m&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:m})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:l})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:s})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:m})]})]}):null}),jsxRuntime.jsx(zs,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(im,{markets:i,onTradeAction:t}),jsxRuntime.jsx(am,{markets:i,event:e})]})}var Us=5;function im({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui.useScreen(),[o,i]=react.useState(false),[a,l]=react.useState(null),s=react.useMemo(()=>{let h=new Set;return e.filter(v=>h.has(v.slug)?false:(h.add(v.slug),true))},[e]),c=s.find(h=>h.status==="open")?.slug,[m,u]=react.useState(c?`${c}:yes`:null);if(s.length===0)return null;let p=s.length>Us,d=o?s:s.slice(0,Us),f=h=>{l(v=>v===h?null:h);},g=(h,v,k)=>{u(`${h.slug}:${v}`),n&&l(h.slug),t?.(h,v,k);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:d.map((h,v)=>{let k=Br(h),w=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,R=a===h.slug;return jsxRuntime.jsx(sm,{market:h,yesPrice:k,noPrice:w??void 0,activeYes:m===`${h.slug}:yes`,activeNo:m===`${h.slug}:no`,isExpanded:R,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${v}-${h.slug}`)})})]}),p&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function sm({market:e,yesPrice:t,noPrice:r,activeYes:n,activeNo:o,isExpanded:i,onToggleExpand:a,onTradeAction:l}){let{t:s}=i18n.useTranslation(),c=e.status==="open",m=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:a,role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:En(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:En(e)}),m&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:m})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:nm(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",n?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:u=>{u.stopPropagation(),l?.(e,"yes","buy");},children:s("predict.market.action.yes",{price:Hs(t)})}),jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",o?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:u=>{u.stopPropagation(),l?.(e,"no","buy");},children:r!=null?s("predict.market.action.no",{price:Hs(r)}):s("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?s("predict.event.status.closed"):e.status==="voided"?s("predict.event.status.voided"):s("predict.event.status.pending")})})})]}),i&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(As,{market:e,outcome:o?"no":"yes",onTradeAction:l})})})})]})}function am({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,a]=react.useState(false),[l,s]=react.useState(0),c=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(c.length===0)return null;let m=c[l]??c[0],u=m.rules&&m.rules.length>0?m.rules.join(`
87
+ `,Ss={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function le(e){return {...Ss,animationDelay:`${e}ms`}}function Dr({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:ks}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...Ss,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...le(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...le(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...le(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...le(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...le(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...le(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...le(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...le(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...le(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...le(240),height:14,width:56}})}),Array.from({length:e}).map((r,n)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...le(260+n*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...le(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...le(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...le(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(360+n*40),height:32,width:80,borderRadius:8}})]})]},n))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...le(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...le(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...le(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...le(460),height:14,width:"60%"}})]})]})]})}function ws(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:ks}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...le(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...le(120),height:40,width:"100%",borderRadius:8}})]})]})}var Es="var(--color-bullish)",Ts="var(--color-bearish)";function Ar(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function au(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function lu(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let f=Math.round(d.price*100);f>=0&&f<=100&&(r[f]+=d.quantity);}for(let d of t){let f=Math.round(d.price*100);f>=0&&f<=100&&(n[f]+=d.quantity);}let o=0,i=0,a=new Float64Array(101),l=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,a[d]=o,l[d]=i;let s=0,c=0,p=new Float64Array(101),m=new Float64Array(101);for(let d=0;d<=100;d++)s+=n[d],c+=n[d]*d/100,p[d]=s,m[d]=c;let u=Math.max(a[0]??0,p[100]??0);return Array.from({length:101},(d,f)=>{let g=a[f]>0,h=p[f]>0,x=a[f]||p[f],S=r[f]>0||n[f]>0;return {priceCents:f,displayHeight:au(x,u),opacity:x>0?S?1:.5:0,isBid:g,isAsk:h,bidCumTotal:a[f],askCumTotal:p[f],bidCumCost:l[f],askCumCost:m[f]}})}function cu({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Es:Ts,n=e.leftPct>65?void 0:`${e.leftPct}%`,o=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:n,right:o,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:Ar(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Ar(Math.round(e.cumCost))]})]})}var du=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,a=t.isBid?Es:t.isAsk?Ts:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,o.current),onMouseLeave:n,children:i&&jsxRuntime.jsx("div",{ref:o,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:a,opacity:t.opacity}})})}),pu=[0,10,20,30,40,50,60,70,80,90,100];function uu(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:pu.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function Ls({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>lu(e,t),[e,t]),o=react.useMemo(()=>{let m=e.length>0?Math.max(...e.map(d=>d.price)):0,u=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((m+u)/2*100)},[e,t]),i=react.useMemo(()=>n.some(m=>m.isBid||m.isAsk),[n]),[a,l]=react.useState(null),s=react.useRef(null),c=react.useCallback((m,u)=>{s.current&&(s.current.style.filter=""),u?(u.style.filter="brightness(1.5)",s.current=u):s.current=null,m.isBid||m.isAsk?l({priceCents:m.priceCents,isBid:m.isBid,cumTotal:m.isBid?m.bidCumTotal:m.askCumTotal,cumCost:m.isBid?m.bidCumCost:m.askCumCost,leftPct:m.priceCents}):l(null);},[]),p=react.useCallback(()=>{s.current&&(s.current.style.filter="",s.current=null),l(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[o>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${o}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),a&&jsxRuntime.jsx(cu,{info:a}),n.map(m=>jsxRuntime.jsx(du,{slot:m,onEnter:c,onLeave:p},m.priceCents))]}),jsxRuntime.jsx(uu,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function xo(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function _s(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function Ds({market:e,outcome:t="yes",onTradeAction:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("depth"),a=t==="no",l=e.source,{data:s,isLoading:c,isFetching:p,refetch:m}=reactPredict.useOrderbook({slug:e.slug,source:l}),u=react.useMemo(()=>((a?s?.asks:s?.bids)??[]).map(S=>({price:a?1-S.price:S.price,quantity:S.size})),[s?.bids,s?.asks,a]),d=react.useMemo(()=>((a?s?.bids:s?.asks)??[]).map(S=>({price:a?1-S.price:S.price,quantity:S.size})),[s?.bids,s?.asks,a]),f=react.useMemo(()=>u.length>0?Math.max(...u.map(x=>x.price)):null,[u]),g=react.useMemo(()=>d.length>0?Math.min(...d.map(x=>x.price)):null,[d]),h=react.useMemo(()=>{if(f==null||g==null)return null;let x=(g-f)*100;return Math.round(x*10)/10},[f,g]);return jsxRuntime.jsxs("div",{className:"flex flex-col h-[262px]",children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:h!=null?`${n("predict.orderBook.spread")}: ${Number.isInteger(h)?`${h}\xA2`:`${h.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[f!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[n("predict.trade.bestBid"),": ",xo(f)]}),f!=null&&g!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),g!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[n("predict.trade.bestAsk"),": ",xo(g)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:o==="depth"?"Orderbook":"Depth chart",onClick:()=>i(x=>x==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:o==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>m(),disabled:p,className:ui.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",p&&"animate-spin"),children:jsxRuntime.jsx(ui.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[o==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(_s,{}):jsxRuntime.jsx(Ls,{bids:u,asks:d})}),o==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(_s,{}):jsxRuntime.jsx(yu,{bids:u,asks:d,bestBid:f??void 0,bestAsk:g??void 0,spread:h??void 0})})]})]})}var Rs=8;function yu({bids:e,asks:t,spread:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>[...t].sort((s,c)=>s.price-c.price).slice(0,Rs).reverse(),[t]),i=react.useMemo(()=>[...e].sort((s,c)=>c.price-s.price).slice(0,Rs),[e]),a=react.useMemo(()=>{let s=[...o,...i].map(c=>c.quantity);return Math.max(...s,1)},[o,i]);return o.length===0&&i.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:n("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[o.map(s=>jsxRuntime.jsx(Is,{price:s.price,quantity:s.quantity,side:"ask",maxQty:a},`ask-${s.price}`)),jsxRuntime.jsx("div",{className:"flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:r!=null&&jsxRuntime.jsxs("span",{children:[n("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]})}),i.map(s=>jsxRuntime.jsx(Is,{price:s.price,quantity:s.quantity,side:"bid",maxQty:a},`bid-${s.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:n("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:n("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:n("predict.orderBook.total")})]})]})}function Is({price:e,quantity:t,side:r,maxQty:n}){let o=r==="ask",i=Math.min(t/n*100,100),a=o?"bg-bearish/10":"bg-bullish/10",l=o?"text-bearish":"text-bullish",s=Ar(Math.round(t)),c=Math.round(t*e),p=`$${Ar(c)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${a} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:xo(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:s}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:p})]})}var ko=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},Mn=4,As=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Ru(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Iu(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Fs(e){return `${(e*100).toFixed(2)}%`}var Ou=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function Du({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Ou.map(({range:r,label:n})=>{let o=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:o?"#f9fafb":"#6b7280",fontWeight:o?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:n},r)})})}function Au(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(o=>{let i=e.current,a=t.current;if(!i||!a)return;let l=i.getBoundingClientRect(),s=(o.clientX-l.left)/l.width*100;a.style.background=`linear-gradient(to right, transparent ${s}%, rgba(0,0,0,0.55) ${s}%)`,a.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function Fu({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let a=new Map;t?.forEach(s=>a.set(s.dataKey,s));let l=o.map(s=>a.get(s.slug)??{dataKey:s.slug,value:void 0,stroke:s.color,color:s.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?Iu(r,i):r}),l.map(s=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:s.stroke??s.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:n.get(s.dataKey)??s.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s.value!=null?Fs(s.value):"--"})]},s.dataKey))]})}function Bu({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!o)return;function c(p){a.current&&!a.current.contains(p.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]);let l=t.length>=Mn,s=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(p=>p.slug===t[0]);return c?.outcomes?.[0]?.label??c?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(c=>!c),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[s,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),o&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",Mn," markets"]}),e.map((c,p)=>{let m=t.includes(c.slug),u=!m&&l,d=m&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(x=>x.label.toLowerCase()==="yes")??c.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||u||n(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:m?"rgba(255,255,255,0.05)":"transparent",cursor:u||d?"not-allowed":"pointer",opacity:u?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!u&&!d&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=m?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:m?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:m?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:m&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:m?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${p}-${c.slug}`)})]})]})}function Hu({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(n=>{let o=t.get(n.marketSlug)??"#6b7280",i=r.get(n.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:o,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:n.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?Fs(i):"--"})]})]},n.marketSlug)})})}function zu(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function $u(e,t){if(e.length<=t)return e;let r=[],n=e.length/t;for(let o=0;o<t;o++){let i=Math.floor(o*n),a=Math.min(Math.floor((o+1)*n),e.length),l=e.slice(i,a),s=l.map(c=>c.price).sort((c,p)=>c-p);r.push({timestamp:l[l.length-1].timestamp,price:zu(s)});}return r}function Wu(e,t=200){if(e.length===0)return [];let r=e.map(l=>({...l,data:$u(l.data,t)})),n=new Set;r.forEach(l=>l.data.forEach(s=>n.add(s.timestamp)));let o=Array.from(n).sort((l,s)=>l-s),i=r.map(l=>{let s=new Map;return l.data.forEach(c=>s.set(c.timestamp,c.price)),{slug:l.marketSlug,map:s}}),a=new Map;return o.map(l=>{let s={timestamp:l};return i.forEach(({slug:c,map:p})=>{let m=p.get(l);if(m!==void 0)a.set(c,m),s[c]=m;else {let u=a.get(c);u!==void 0&&(s[c]=u);}}),s})}function Bs(e){return jsxRuntime.jsx(ko,{children:jsxRuntime.jsx(Uu,{...e})})}function Uu({event:e,isLoading:t,className:r,volume:n}){let o=react.useMemo(()=>{let b=new Set;return (e.markets??[]).filter(y=>y.status!=="open"||b.has(y.slug)?false:(b.add(y.slug),true))},[e.markets]),i=react.useMemo(()=>[...o].sort((b,y)=>{let V=G=>(G.outcomes.find(Q=>Q.label.toLowerCase()==="yes")??G.outcomes[0])?.price??0;return V(y)-V(b)}),[o]),[a,l]=react.useState(()=>i.slice(0,Mn).map(b=>b.slug)),[s,c]=react.useState(sn),p=react.useMemo(()=>{let b=new Map;return a.forEach((y,V)=>{b.set(y,As[V%As.length]);}),b},[a]),m=react.useMemo(()=>o.filter(b=>a.includes(b.slug)),[o,a]),{series:u,isLoading:d}=reactPredict.useMarketHistory(m,s),f=t||d,g=react.useMemo(()=>{if(u.length>0&&u.some(V=>V.data.length>0))return u;let b=Date.now(),y=864e5;return m.map(V=>{let Q=(V.outcomes?.find(pe=>pe.label.toLowerCase()==="yes")??V.outcomes?.[0])?.price??.5;return {marketSlug:V.slug,label:V.outcomes?.[0]?.label??V.question,data:[{timestamp:b-7*y,price:Q},{timestamp:b,price:Q}]}})},[u,m]),h=react.useMemo(()=>s===reactPredict.ChartRange.ONE_DAY?96:s===reactPredict.ChartRange.ONE_WEEK?168:s===reactPredict.ChartRange.ONE_MONTH?180:300,[s]),x=react.useMemo(()=>Wu(g,h),[g,h]),S=react.useMemo(()=>{if(x.length===0)return [0,1];let b=1/0,y=-1/0;if(a.forEach(G=>{x.forEach(Q=>{let pe=Q[G];pe!=null&&(pe<b&&(b=pe),pe>y&&(y=pe));});}),!isFinite(b))return [0,1];let V=Math.max((y-b)*.15,.05);return [Math.max(0,b-V),Math.min(1,y+V)]},[x,a]),P=react.useMemo(()=>{let b=new Map;return g.forEach(y=>{y.data.length>0&&b.set(y.marketSlug,y.data[y.data.length-1].price);}),b},[g]),E=react.useMemo(()=>{let b=new Map;return g.forEach(y=>b.set(y.marketSlug,y.label)),b},[g]),v=react.useMemo(()=>g.map(b=>({slug:b.marketSlug,color:p.get(b.marketSlug)??"#6b7280"})),[g,p]),{wrapperRef:w,overlayRef:k,onMouseMove:K,onMouseLeave:I}=Au(),q=react.useCallback(b=>{l(y=>y.includes(b)?y.length<=1?y:y.filter(V=>V!==b):y.length>=Mn?y:[...y,b]);},[]),[N,H]=react.useState(null),R=react.useRef(null),$=react.useRef(""),Z=react.useRef(0),B=!f&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Hu,{series:g,colorMap:p,displayValues:N??P}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:w,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:B?b=>{K(b),cancelAnimationFrame(Z.current),Z.current=requestAnimationFrame(()=>{H(R.current);});}:void 0,onMouseLeave:B?()=>{I(),cancelAnimationFrame(Z.current),$.current="",R.current=null,H(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):x.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:k,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:x,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:b=>Ru(b,s),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:S,tickFormatter:b=>`${Math.round(b*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:b=>{let y=b;if(y.active&&y.payload?.length){let V=y.payload.map(G=>`${G.dataKey}:${G.value}`).join(",");if(V!==$.current){$.current=V;let G=new Map;y.payload.forEach(Q=>{Q.value!=null&&G.set(Q.dataKey,Q.value);}),R.current=G;}}return jsxRuntime.jsx(Fu,{...y,labelMap:E,allSeries:v,range:s})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(b=>{let y=p.get(b.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:b.marketSlug,stroke:y,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:y},connectNulls:true,isAnimationActive:false},b.marketSlug)}),N==null&&x.length>0&&g.map(b=>{let y=x[x.length-1],V=y[b.marketSlug];if(V==null)return null;let G=p.get(b.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:y.timestamp,y:V,ifOverflow:"extendDomain",shape:Q=>{let{cx:pe,cy:Se}=Q;return pe==null||Se==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:pe,cy:Se,r:6,fill:G,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:pe,cy:Se,r:3.5,fill:G})]})}},`pulse-${b.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[n!=null&&n>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:["$",Math.round(n).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(Du,{value:s,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Bu,{markets:i,selectedSlugs:a,colorMap:p,onToggle:q})})]})]})]})}function Br(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function rm(e){return `${parseFloat((e*100).toFixed(2))}%`}function Hs(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function En(e){return e.outcomes?.[0]?.label??e.question}function nm(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Fr(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return `${r} ${n}, ${o} ${i}:${a}`}function zs(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let p=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(p)},[e]),!e||t===0)return null;let n=new Date(e).getTime();if(isNaN(n))return null;let o=n-t;if(o<=0)return null;let i=Math.floor(o/864e5),a=Math.floor(o%864e5/36e5),l=Math.floor(o%36e5/6e4),s=Math.floor(o%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(a).padStart(2,"0")}h`),c.push(`${String(l).padStart(2,"0")}m`),c.push(`${String(s).padStart(2,"0")}s`),c.join(" ")}function $s(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),a=t.getFullYear(),l=-t.getTimezoneOffset(),s=l>=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}function Vs({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let m=[...e.markets||[]],u=m.filter(f=>f.status==="open").sort((f,g)=>Br(g)-Br(f)),d=m.filter(f=>f.status!=="open").sort((f,g)=>Br(g)-Br(f));return [...u,...d]},[e.markets]),a=e.status==="closed"||e.status==="voided",l=zs(a?void 0:e.start_at),s=zs(a?void 0:e.end_at),c=$s(e.start_at),p=$s(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:n,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${o?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${o?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!o&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((m,u)=>jsxRuntime.jsxs(react.Fragment,{children:[u>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:m.label})]},m.slug)),jsxRuntime.jsx(am,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${o?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(l||s||a)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:a?p&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:p})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:l})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:s})}),p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:p})]})]}):null}),jsxRuntime.jsx(Bs,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(om,{markets:i,onTradeAction:t}),jsxRuntime.jsx(sm,{markets:i,event:e})]})}var Ws=5;function om({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui.useScreen(),[o,i]=react.useState(false),[a,l]=react.useState(null),s=react.useMemo(()=>{let h=new Set;return e.filter(x=>h.has(x.slug)?false:(h.add(x.slug),true))},[e]),c=s.find(h=>h.status==="open")?.slug,[p,m]=react.useState(c?`${c}:yes`:null);if(s.length===0)return null;let u=s.length>Ws,d=o?s:s.slice(0,Ws),f=h=>{l(x=>x===h?null:h);},g=(h,x,S)=>{m(`${h.slug}:${x}`),n&&l(h.slug),t?.(h,x,S);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:d.map((h,x)=>{let S=Br(h),P=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,E=a===h.slug;return jsxRuntime.jsx(im,{market:h,yesPrice:S,noPrice:P??void 0,activeYes:p===`${h.slug}:yes`,activeNo:p===`${h.slug}:no`,isExpanded:E,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${x}-${h.slug}`)})})]}),u&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function im({market:e,yesPrice:t,noPrice:r,activeYes:n,activeNo:o,isExpanded:i,onToggleExpand:a,onTradeAction:l}){let{t:s}=i18n.useTranslation(),c=e.status==="open",p=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:a,role:"button",tabIndex:0,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:En(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:En(e)}),p&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:p})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:rm(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",n?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:m=>{m.stopPropagation(),l?.(e,"yes","buy");},children:s("predict.market.action.yes",{price:Hs(t)})}),jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",o?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:m=>{m.stopPropagation(),l?.(e,"no","buy");},children:r!=null?s("predict.market.action.no",{price:Hs(r)}):s("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?s("predict.event.status.closed"):e.status==="voided"?s("predict.event.status.voided"):s("predict.event.status.pending")})})})]}),i&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(Ds,{market:e,outcome:o?"no":"yes",onTradeAction:l})})})})]})}function sm({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,a]=react.useState(false),[l,s]=react.useState(0),c=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(c.length===0)return null;let p=c[l]??c[0],m=p.rules&&p.rules.length>0?p.rules.join(`
88
88
 
89
- `):m.description??"";if(!u)return null;let p=u.length>200&&!n?u.slice(0,200)+"...":u;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),c.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:En(m)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:d=>{s(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((d,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:En(d)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:p}),u.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(d=>!d),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(n?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(d=>!d),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let d=m.status,f=[];return m.created_at&&f.push({label:r("predict.event.timeline.created"),value:Fr(m.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Fr(m.start_at),isActive:d!=="pending"}),d==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Fr(m.closed_at??m.end_at),isActive:true}):d==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Fr(m.closed_at??m.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Fr(m.end_at),isActive:false}),f})().map((d,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${d.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:m.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:om(m.source)})]})]})]})]})}function lm({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function Ys({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(Dr,{}):i||!n?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(js,{event:n,onTradeAction:r})}var mm={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},fm={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ht(e){return mm[e]??fm}function Cb({source:e,className:t}){let r=ht(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var qs="rgba(39,39,42,0.6)",ym="rgba(63,63,70,0.8)";function km(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Xs({eventSlug:e,source:t,limit:r=4,onEventClick:n,onEventHover:o}){let{t:i}=i18n.useTranslation(),{data:a,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!a||a.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:a.map(s=>jsxRuntime.jsx(Sm,{event:s,onClick:n,onHover:o},`${s.source}-${s.slug}`))})]})}function Sm({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=ht(e.source),i=react.useMemo(()=>km(e.volume),[e.volume]),a=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=ym,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=qs;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${qs}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:o.color,flexShrink:0},children:[o.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",n("predict.event.volume")]}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:a.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function Ln(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Qb({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:a,renderActivitySection:l}){let{t:s}=i18n.useTranslation(),{isDesktop:c}=ui.useScreen(),{onOpen:m}=uiScaffold.useAsyncModal(Mr),{onOpen:u}=uiScaffold.useAsyncModal(co),{data:p,isLoading:d}=reactPredict.useEvent({slug:e,source:t}),f=react.useMemo(()=>{let x=[...p?.markets||[]],N=x.filter(K=>K.status==="open").sort((K,A)=>Ln(A)-Ln(K)),S=x.filter(K=>K.status!=="open").sort((K,A)=>Ln(A)-Ln(K));return [...N,...S]},[p?.markets]),[g,h]=react.useState(null),v=react.useCallback((x,N,S)=>{h(K=>({market:x,outcome:N,side:S,version:(K?.version??0)+1})),!c&&p&&(S==="sell"?u({params:{event:p,market:x,initialOutcome:N,chain:r}}):m({params:{event:p,market:x,initialOutcome:N,chain:r}}));},[c,p,r,m,u]),k=g?.market??f[0];if(d){let x=!!a;return c?jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Dr,{showBack:x})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx(Ps,{})})})]}):jsxRuntime.jsx(Dr,{showBack:x})}let w=g?`${g.market.slug}-${g.version}`:k?.slug??"default",R=g?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[a&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:a,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:s("common.back")})}),jsxRuntime.jsx(Ys,{eventSlug:e,source:t,onTradeAction:v})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[k&&(R?jsxRuntime.jsx(kn,{event:p,market:k,initialOutcome:g?.outcome,chain:r},w):jsxRuntime.jsx(fn,{event:p,market:k,initialOutcome:g?.outcome,chain:r},w)),p&&jsxRuntime.jsx(Xs,{eventSlug:e,source:p.source,onEventClick:o,onEventHover:i})]})]}),p&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:l?l({event:p,walletAddress:n}):jsxRuntime.jsx(ks,{event:p,walletAddress:n})}),jsxRuntime.jsx(gn,{}),jsxRuntime.jsx(xs,{}),jsxRuntime.jsx(rs,{})]})}function Zs(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Am(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var ny=e=>{let{candlestickMarketSlugs:t,chartRange:r=sn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Am(r),[r]),{data:a,isLoading:l,error:s}=reactPredict.useEvent({slug:e.eventSlug,source:n}),c=react.useMemo(()=>{if(!a?.markets)return [];let f=new Set,g=a.markets.filter(v=>f.has(v.slug)?false:(f.add(v.slug),true));return (t&&t.length>0?t.slice(0,4).map(v=>g.find(k=>k.slug===v)).filter(v=>v!==void 0):[...g].sort((v,k)=>Zs(k)-Zs(v)).slice(0,4)).map(v=>v.slug)},[t,a?.markets]),m=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>o.listCandlesticks(f,i),enabled:c.length>0}))}),u=m.some(f=>f.isLoading),p=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let v=m[h]?.error;v&&f.set(g,v);}),f},[c,m]),d=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let v=m[h]?.data;v&&f.set(g,v);}),f},[c,m]);return {event:a,isEventLoading:l,eventError:s,candlestickParams:i,candlesticks:d,isCandlesticksLoading:u,candlestickErrors:p}};var zm=10,Hm=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function In(){let[e,t]=jotai.useAtom(Hm),r=react.useCallback(o=>{let i=o.trim();i&&t(a=>{let l=a.filter(s=>s!==i);return [i,...l].slice(0,zm)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function na({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",n),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:o("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function oa({onSelect:e,className:t}){let{histories:r,clearHistories:n}=In();return jsxRuntime.jsx(na,{className:ui.cn(t),histories:r,onSelect:e,onClear:n})}function ia({value:e,onValueChange:t,onClear:r,onEscape:n,className:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:o,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:a=>{a.preventDefault(),n?.();},children:"Esc"})})})}function sf(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function sa({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:a}=i18n.useTranslation(),l=e.tags?.[0],s=ht(e.source),c=react.useMemo(()=>sf(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:m=>{t&&n&&m.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color:s.color},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:s.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[c," ",a("predict.event.volume")]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:l.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function aa({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:l}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>n?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:l}}var hf=64;function pa({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:a,isLoading:l,isFetchingNextPage:s,hasNextPage:c,fetchNextPage:m}=aa(i),u=react.useRef(null),{height:p}=hooks.useResizeObserver({ref:u}),d=react.useCallback(v=>v<a.length,[a]),f=react.useCallback(async()=>{c&&!s&&await m();},[c,s,m]),g=react.useMemo(()=>c?a.length+1:a.length,[a,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(xf,{className:o}):a.length===0?jsxRuntime.jsx(bf,{className:o}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:u,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:p},onRowsRendered:h,rowComponent:vf,rowCount:g,rowHeight:hf,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function vf({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:a}){let l=r[e];return l?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(sa,{event:l,href:o?.(l),LinkComponent:i,onSelect:n,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function xf({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function bf({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function ga({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=In(),a=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),s=react.useMemo(()=>utils.debounce(p=>{o(p),a(p),p&&l(p);},500),[a,l]),c=react.useCallback(p=>{r(p),s(p);},[s]),m=react.useCallback(p=>{s.cancel(),r(p),o(p),a(p),p&&l(p);},[s,a,l]),u=react.useCallback(()=>m(""),[m]);return {text:t,keyword:n,setText:c,setKeyword:m,clearKeyword:u}}function ha({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:a}){let{text:l,keyword:s,setText:c,setKeyword:m,clearKeyword:u}=ga({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(ia,{value:l,onValueChange:c,onClear:u,onEscape:i}),!s&&jsxRuntime.jsx(oa,{onSelect:m}),jsxRuntime.jsx(pa,{className:"flex-auto min-h-0",keyword:s,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:a})]})}var Mo="predict-search";function _1({id:e=Mo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Rf,{...t})})}function Rf({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),a=react.useCallback(s=>{n(s);},[n]),l=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui.ModalBody,{className:"p-4",children:jsxRuntime.jsx(ha,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:l})})]})})}function H1({onSelectEvent:e,modalParams:t,className:r,displayMode:n="auto"}){let{t:o}=i18n.useTranslation(),i=ui.useScreen(),a=n==="auto"?i.isDesktop:n==="desktop",l=n==="auto"?i.isMobile:n==="compact",{onOpen:s,onClose:c}=uiScaffold.useAsyncModal(Mo),m=hooks.useCallbackRef(e),u=hooks.useCallbackRef(async()=>{let d=await s({params:t});d&&m(d);}),p=hooks.useCallbackRef(()=>{c();});return react.useEffect(()=>{let d=f=>{let g=document.activeElement,h=!!g&&(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.getAttribute("contenteditable")==="true");f.key==="/"&&!h&&(f.preventDefault(),u()),f.key==="Escape"&&(f.preventDefault(),p());};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d);}},[u,p]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!a,onPress:u,variant:l?"flat":"bordered",startContent:a?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:a?jsxRuntime.jsx(ui.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui.cn(a&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:a?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var To=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],Na=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],Sa={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},wa={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function Wf(e,t){if(!e)return "$5K+";let r=Na.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function Ca({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:a}){let{t:l}=i18n.useTranslation(),[s,c]=react.useState(false),[m,u]=react.useState(false),[p,d]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),v=react.useRef(null),k=To.find(x=>x.value===e)??To[0],w=react.useCallback(x=>{h.current&&!h.current.contains(x.target)&&c(false),v.current&&!v.current.contains(x.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)),[w]);let R=react.useCallback(()=>{a?.(),g(true),setTimeout(()=>g(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
89
+ `):p.description??"";if(!m)return null;let u=m.length>200&&!n?m.slice(0,200)+"...":m;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),c.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:En(p)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:d=>{s(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((d,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:En(d)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:u}),m.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(d=>!d),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(n?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(d=>!d),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let d=p.status,f=[];return p.created_at&&f.push({label:r("predict.event.timeline.created"),value:Fr(p.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Fr(p.start_at),isActive:d!=="pending"}),d==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Fr(p.closed_at??p.end_at),isActive:true}):d==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Fr(p.closed_at??p.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Fr(p.end_at),isActive:false}),f})().map((d,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${d.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:p.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:nm(p.source)})]})]})]})]})}function am({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function js({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(Dr,{}):i||!n?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(Vs,{event:n,onTradeAction:r})}var um={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},mm={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ht(e){return um[e]??mm}function Eb({source:e,className:t}){let r=ht(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var Ys="rgba(39,39,42,0.6)",bm="rgba(63,63,70,0.8)";function ym(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Qs({eventSlug:e,source:t,limit:r=4,onEventClick:n,onEventHover:o}){let{t:i}=i18n.useTranslation(),{data:a,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!a||a.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:i("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:a.map(s=>jsxRuntime.jsx(km,{event:s,onClick:n,onHover:o},`${s.source}-${s.slug}`))})]})}function km({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=ht(e.source),i=react.useMemo(()=>ym(e.volume),[e.volume]),a=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:l=>{l.currentTarget.style.borderColor=bm,r?.(e);},onMouseLeave:l=>{l.currentTarget.style.borderColor=Ys;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${Ys}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:o.color,flexShrink:0},children:[o.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[i," ",n("predict.event.volume")]}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:a.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function Ln(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Jb({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:a,renderActivitySection:l}){let{t:s}=i18n.useTranslation(),{isDesktop:c}=ui.useScreen(),{onOpen:p}=uiScaffold.useAsyncModal(Mr),{onOpen:m}=uiScaffold.useAsyncModal(co),{data:u,isLoading:d}=reactPredict.useEvent({slug:e,source:t}),f=react.useMemo(()=>{let v=[...u?.markets||[]],w=v.filter(K=>K.status==="open").sort((K,I)=>Ln(I)-Ln(K)),k=v.filter(K=>K.status!=="open").sort((K,I)=>Ln(I)-Ln(K));return [...w,...k]},[u?.markets]),[g,h]=react.useState(null),x=react.useCallback((v,w,k)=>{h(K=>({market:v,outcome:w,side:k,version:(K?.version??0)+1})),!c&&u&&(k==="sell"?m({params:{event:u,market:v,initialOutcome:w,chain:r}}):p({params:{event:u,market:v,initialOutcome:w,chain:r}}));},[c,u,r,p,m]),S=g?.market??f[0];if(d){let v=!!a;return c?jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Dr,{showBack:v})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx(ws,{})})})]}):jsxRuntime.jsx(Dr,{showBack:v})}let P=g?`${g.market.slug}-${g.version}`:S?.slug??"default",E=g?.side==="sell";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[a&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:a,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:s("common.back")})}),jsxRuntime.jsx(js,{eventSlug:e,source:t,onTradeAction:x})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[S&&(E?jsxRuntime.jsx(kn,{event:u,market:S,initialOutcome:g?.outcome,chain:r},P):jsxRuntime.jsx(fn,{event:u,market:S,initialOutcome:g?.outcome,chain:r},P)),u&&jsxRuntime.jsx(Qs,{eventSlug:e,source:u.source,onEventClick:o,onEventHover:i})]})]}),u&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:l?l({event:u,walletAddress:n}):jsxRuntime.jsx(ys,{event:u,walletAddress:n})}),jsxRuntime.jsx(gn,{}),jsxRuntime.jsx(vs,{}),jsxRuntime.jsx(ts,{})]})}function Js(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Dm(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var iy=e=>{let{candlestickMarketSlugs:t,chartRange:r=sn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Dm(r),[r]),{data:a,isLoading:l,error:s}=reactPredict.useEvent({slug:e.eventSlug,source:n}),c=react.useMemo(()=>{if(!a?.markets)return [];let f=new Set,g=a.markets.filter(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(S=>S.slug===x)).filter(x=>x!==void 0):[...g].sort((x,S)=>Js(S)-Js(x)).slice(0,4)).map(x=>x.slug)},[t,a?.markets]),p=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>o.listCandlesticks(f,i),enabled:c.length>0}))}),m=p.some(f=>f.isLoading),u=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=p[h]?.error;x&&f.set(g,x);}),f},[c,p]),d=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=p[h]?.data;x&&f.set(g,x);}),f},[c,p]);return {event:a,isEventLoading:l,eventError:s,candlestickParams:i,candlesticks:d,isCandlesticksLoading:m,candlestickErrors:u}};var Bm=10,Hm=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function In(){let[e,t]=jotai.useAtom(Hm),r=react.useCallback(o=>{let i=o.trim();i&&t(a=>{let l=a.filter(s=>s!==i);return [i,...l].slice(0,Bm)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function ra({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",n),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:o("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function na({onSelect:e,className:t}){let{histories:r,clearHistories:n}=In();return jsxRuntime.jsx(ra,{className:ui.cn(t),histories:r,onSelect:e,onClear:n})}function oa({value:e,onValueChange:t,onClear:r,onEscape:n,className:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:o,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:a=>{a.preventDefault(),n?.();},children:"Esc"})})})}function of(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function ia({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:a}=i18n.useTranslation(),l=e.tags?.[0],s=ht(e.source),c=react.useMemo(()=>of(e.volume),[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:p=>{t&&n&&p.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color:s.color},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:s.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[c," ",a("predict.event.volume")]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:l.label})]})]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function sa({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:l}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>n?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:l}}var gf=64;function da({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:a,isLoading:l,isFetchingNextPage:s,hasNextPage:c,fetchNextPage:p}=sa(i),m=react.useRef(null),{height:u}=hooks.useResizeObserver({ref:m}),d=react.useCallback(x=>x<a.length,[a]),f=react.useCallback(async()=>{c&&!s&&await p();},[c,s,p]),g=react.useMemo(()=>c?a.length+1:a.length,[a,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(vf,{className:o}):a.length===0?jsxRuntime.jsx(xf,{className:o}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:m,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:u},onRowsRendered:h,rowComponent:hf,rowCount:g,rowHeight:gf,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function hf({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:a}){let l=r[e];return l?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(ia,{event:l,href:o?.(l),LinkComponent:i,onSelect:n,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function vf({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function xf({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function fa({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=In(),a=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),s=react.useMemo(()=>utils.debounce(u=>{o(u),a(u),u&&l(u);},500),[a,l]),c=react.useCallback(u=>{r(u),s(u);},[s]),p=react.useCallback(u=>{s.cancel(),r(u),o(u),a(u),u&&l(u);},[s,a,l]),m=react.useCallback(()=>p(""),[p]);return {text:t,keyword:n,setText:c,setKeyword:p,clearKeyword:m}}function ga({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:a}){let{text:l,keyword:s,setText:c,setKeyword:p,clearKeyword:m}=fa({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(oa,{value:l,onValueChange:c,onClear:m,onEscape:i}),!s&&jsxRuntime.jsx(na,{onSelect:p}),jsxRuntime.jsx(da,{className:"flex-auto min-h-0",keyword:s,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:a})]})}var Mo="predict-search";function I1({id:e=Mo}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(_f,{...t})})}function _f({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),a=react.useCallback(s=>{n(s);},[n]),l=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui.ModalBody,{className:"p-4",children:jsxRuntime.jsx(ga,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:l})})]})})}function W1({onSelectEvent:e,modalParams:t,className:r,displayMode:n="auto"}){let{t:o}=i18n.useTranslation(),i=ui.useScreen(),a=n==="auto"?i.isDesktop:n==="desktop",l=n==="auto"?i.isMobile:n==="compact",{onOpen:s,onClose:c}=uiScaffold.useAsyncModal(Mo),p=hooks.useCallbackRef(e),m=hooks.useCallbackRef(async()=>{let d=await s({params:t});d&&p(d);}),u=hooks.useCallbackRef(()=>{c();});return react.useEffect(()=>{let d=f=>{let g=document.activeElement,h=!!g&&(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.getAttribute("contenteditable")==="true");f.key==="/"&&!h&&(f.preventDefault(),m()),f.key==="Escape"&&(f.preventDefault(),u());};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d);}},[m,u]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!a,onPress:m,variant:l?"flat":"bordered",startContent:a?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:a?jsxRuntime.jsx(ui.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui.cn(a&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:a?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var To=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],Pa=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],ka={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},Sa={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function $f(e,t){if(!e)return "$5K+";let r=Pa.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function Na({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:a}){let{t:l}=i18n.useTranslation(),[s,c]=react.useState(false),[p,m]=react.useState(false),[u,d]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),x=react.useRef(null),S=To.find(v=>v.value===e)??To[0],P=react.useCallback(v=>{h.current&&!h.current.contains(v.target)&&c(false),x.current&&!x.current.contains(v.target)&&m(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)),[P]);let E=react.useCallback(()=>{a?.(),g(true),setTimeout(()=>g(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
90
90
  @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
91
91
  .match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
92
92
  .match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
93
- `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:Sa,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(x=>!x),u(false);},children:[jsxRuntime.jsx(Uf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(k.labelKey)}),jsxRuntime.jsx(Pa,{open:s})]}),s&&jsxRuntime.jsx("div",{style:{...wa,width:224,padding:4},children:To.map(x=>{let N=e===x.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:N?"rgba(199,255,46,0.08)":"transparent",color:N?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:S=>{N||(S.currentTarget.style.background="rgba(39,39,42,0.5)",S.currentTarget.style.color="#fff");},onMouseLeave:S=>{N||(S.currentTarget.style.background="transparent",S.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===x.value?n(!r):t(x.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:N?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Kf,{type:x.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(x.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(x.descKey)})]}),N&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:Sa,onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(x=>!x),c(false);},children:[jsxRuntime.jsx(Vf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Wf(o,l)}),jsxRuntime.jsx(jf,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(Pa,{open:m})]}),p&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),l("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:l("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:l("predict.matches.filter.tooltipNote")})]})]})]}),m&&jsxRuntime.jsxs("div",{style:{...wa,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:l("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:Na.map(x=>{let N=x.value===0?!o:o===x.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:N?"rgba(199,255,46,0.08)":"transparent",color:N?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:S=>{N||(S.currentTarget.style.background="rgba(39,39,42,0.5)",S.currentTarget.style.color="#fff");},onMouseLeave:S=>{N||(S.currentTarget.style.background="transparent",S.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(x.value===0?void 0:x.value),u(false);},children:[jsxRuntime.jsx("span",{children:x.labelKey?l(x.labelKey):x.label}),N&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]})]}),a&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(39,39,42,1)",x.currentTarget.style.color="#fff";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(39,39,42,0.6)",x.currentTarget.style.color="#a1a1aa";},onClick:R,children:jsxRuntime.jsxs("svg",{className:f?"match-refresh-spin":void 0,viewBox:"0 0 24 24",style:{width:16,height:16},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})})]})]})}function Uf(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Kf({type:e}){let t={width:16,height:16},r={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="trending-up"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M16 7h6v6"}),jsxRuntime.jsx("path",{d:"m22 7-8.5 8.5-5-5L2 17"})]}):e==="chart-column"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}):jsxRuntime.jsx("svg",{...r,style:t,children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})})}function Vf(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function jf({onMouseEnter:e,onMouseLeave:t}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"hidden sm:block",style:{width:12,height:12,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onMouseEnter:e,onMouseLeave:t,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 16v-4"}),jsxRuntime.jsx("path",{d:"M12 8h.01"})]})}function Pa({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function qf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var Qf=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>e.toLocaleString(),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:qf,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function Ma({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
93
+ `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ka,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(v=>!v),m(false);},children:[jsxRuntime.jsx(Wf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:l(S.labelKey)}),jsxRuntime.jsx(wa,{open:s})]}),s&&jsxRuntime.jsx("div",{style:{...Sa,width:224,padding:4},children:To.map(v=>{let w=e===v.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:w?"rgba(199,255,46,0.08)":"transparent",color:w?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:k=>{w||(k.currentTarget.style.background="rgba(39,39,42,0.5)",k.currentTarget.style.color="#fff");},onMouseLeave:k=>{w||(k.currentTarget.style.background="transparent",k.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===v.value?n(!r):t(v.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:w?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Uf,{type:v.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:l(v.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:l(v.descKey)})]}),w&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},v.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ka,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{m(v=>!v),c(false);},children:[jsxRuntime.jsx(Kf,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:$f(o,l)}),jsxRuntime.jsx(Vf,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(wa,{open:p})]}),u&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),l("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:l("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:l("predict.matches.filter.tooltipNote")})]})]})]}),p&&jsxRuntime.jsxs("div",{style:{...Sa,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:l("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:Pa.map(v=>{let w=v.value===0?!o:o===v.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:w?"rgba(199,255,46,0.08)":"transparent",color:w?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:k=>{w||(k.currentTarget.style.background="rgba(39,39,42,0.5)",k.currentTarget.style.color="#fff");},onMouseLeave:k=>{w||(k.currentTarget.style.background="transparent",k.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(v.value===0?void 0:v.value),m(false);},children:[jsxRuntime.jsx("span",{children:v.labelKey?l(v.labelKey):v.label}),w&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},v.value)})})]})]}),a&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)",v.currentTarget.style.color="#fff";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)",v.currentTarget.style.color="#a1a1aa";},onClick:E,children:jsxRuntime.jsxs("svg",{className:f?"match-refresh-spin":void 0,viewBox:"0 0 24 24",style:{width:16,height:16},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})})]})]})}function Wf(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function Uf({type:e}){let t={width:16,height:16},r={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="trending-up"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M16 7h6v6"}),jsxRuntime.jsx("path",{d:"m22 7-8.5 8.5-5-5L2 17"})]}):e==="chart-column"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}):jsxRuntime.jsx("svg",{...r,style:t,children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})})}function Kf(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function Vf({onMouseEnter:e,onMouseLeave:t}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"hidden sm:block",style:{width:12,height:12,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onMouseEnter:e,onMouseLeave:t,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 16v-4"}),jsxRuntime.jsx("path",{d:"M12 8h.01"})]})}function wa({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Yf(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var qf=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>e.toLocaleString(),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>e.toLocaleString(),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:Yf,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function Ca({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
94
94
  @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
95
95
  @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
96
96
  @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@@ -128,21 +128,21 @@
128
128
  .matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
129
129
  @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
130
130
  `}),jsxRuntime.jsxs("div",{className:"matches-hero-outer",style:{display:"flex",marginBottom:0},children:[jsxRuntime.jsxs("div",{className:"matches-hero-left",style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,animation:"matchHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"matches-hero-live",style:{display:"flex",marginBottom:16},children:jsxRuntime.jsxs("div",{className:"inline-flex items-center",style:{gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",width:8,height:8},children:[jsxRuntime.jsx("span",{style:{position:"absolute",display:"inline-flex",width:"100%",height:"100%",borderRadius:9999,background:"#00d492",opacity:.75,animation:"match-live-ping 1.2s cubic-bezier(0,0,0.2,1) infinite"}}),jsxRuntime.jsx("span",{style:{position:"relative",display:"inline-flex",width:8,height:8,borderRadius:9999,background:"#00bc7d",animation:"match-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.matches.liveBadge")}),jsxRuntime.jsx("span",{style:{borderRadius:4,background:"rgba(199,255,46,0.12)",padding:"2px 6px",fontSize:10,fontWeight:600,color:"#c7ff2e",textTransform:"uppercase",border:"1px solid rgba(199,255,46,0.22)"},children:t("predict.matches.betaTag")})]})}),jsxRuntime.jsxs("h1",{className:"matches-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontSize:46,fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.matches.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.matches.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"matches-hero-subtitle matches-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.matches.heroSubtitle")).split(`
131
- `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:Qf.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function Lo(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function _o(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function Jf(e){return e.outcomes?.[0]?.label||null}function Zf(e){return e==null?"low":e>=3?"high":e>=2?"medium":"low"}var _a={high:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},medium:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},low:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},eg={high:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},medium:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},low:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},Ea={high:{dot:"#17c964",label:"predict.matches.confidenceHigh"},medium:{dot:"#f5a524",label:"predict.matches.confidenceMed"},low:{dot:"#71717a",label:"predict.matches.confidenceLow"}};function tg(e,t){return e||(t==null?"low":t>=.9?"high":t>=.7?"medium":"low")}function rg({tier:e}){let t=_a[e],r=e==="high"?5:e==="medium"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(n,o)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:o<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},o))})}var ng={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},og={text:"#9ca3af",icon:"#9ca3af"};function ig(e){return ng[e]??og}var sg=`
131
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:qf.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function Lo(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Xf(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var La={wide:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},moderate:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},narrow:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},Jf={wide:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},moderate:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},narrow:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},Ma={liquid_gap:{dot:"#17c964",label:"predict.matches.signalLiquidGap"},active_gap:{dot:"#c7ff2e",label:"predict.matches.signalActiveGap"},stale_gap:{dot:"#f5a524",label:"predict.matches.signalStaleGap"},stale_data:{dot:"#71717a",label:"predict.matches.signalStaleData"}};function Zf(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var eg={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},tg={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},rg={text:"#9ca3af",icon:"#9ca3af"};function ng(e){return tg[e]??rg}var og=`
132
132
  .match-card button:focus-visible,
133
133
  .match-card a:focus-visible,
134
134
  .match-card [role="button"]:focus-visible {
135
135
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
136
136
  outline-offset: 2px;
137
137
  }
138
- `;function Ra({match:e,onSelect:t,onHover:r,getMarketHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=_o(e.market_a),l=_o(e.market_b),s=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=Zf(s),m=_a[c],u=a!=null&&l!=null?a<=l?e.source_a:e.source_b:null,p=e.event_a_title||e.event_b_title,d=tg(e.confidence_tier,e.similarity_score),f=Ea[d]??Ea.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,k=eg[c];v.style.borderColor=k.border,v.style.boxShadow=k.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:sg}),s!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${m.bandFrom}, ${m.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:m.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:m.color},children:[s.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(rg,{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:p}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(Ta,{source:e.source_a,market:e.market_a,isCheaper:u===e.source_a,onClick:()=>t?.(e,e.source_a),href:n?.(e,e.source_a),LinkComponent:o}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(Ta,{source:e.source_b,market:e.market_b,isCheaper:u===e.source_b,onClick:()=>t?.(e,e.source_b),href:n?.(e,e.source_b),LinkComponent:o})]}),u&&s!=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:s.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"})]}),Lo(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"})}),Lo(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 Ta({source:e,market:t,isCheaper:r,onClick:n,href:o,LinkComponent:i}){let{t:a}=i18n.useTranslation(),l=ht(e),s=ig(e),c=_o(t),m=Jf(t),u=t.volume,p=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",cursor:o||n?"pointer":void 0,transition:"background 0.15s",background:r?"rgba(199,255,46,0.03)":"transparent"},onMouseEnter: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:n,children:[r?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:90,flexShrink:0},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:s.text,textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[m&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[Lo(u)," ",a("predict.matches.volume")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:r?"#c7ff2e":"#f4f4f5"},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:a("predict.matches.centsYes")})]}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]});return o&&i?jsxRuntime.jsx(i,{href:o,className:"block",children:p}):p}var Aa=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,onSelect:o,onHover:i,getMarketHref:a,LinkComponent:l,onStatsChange:s},c){let{t:m}=i18n.useTranslation(),{data:u,hasNextPage:p,fetchNextPage:d,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:v}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[k,w]=react.useState(0),[R,x]=react.useState(false);R&&!h?(x(false),w(L=>L+1)):h&&!R&&x(true),react.useImperativeHandle(c,()=>({refetch:()=>{v();}}),[v]);let N=react.useMemo(()=>u?.pages.flatMap(L=>L.items??[])??[],[u]),S=u?.pages[0]?.total,K=react.useMemo(()=>{let L=0,E=0,O=0;for(let de of N){let U=de.spread??0;U>L&&(L=U),U>=.03&&O++,de.combined_volume!=null&&(E+=de.combined_volume);}return {activePairs:S??N.length,maxSpread:L,highSpreadCount:O,totalVolume:E}},[N,S]);react.useEffect(()=>{K.activePairs>0&&s?.(K);},[K,s]);let A=react.useRef(null),Q=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let L=A.current;if(!L)return;let E=new IntersectionObserver(O=>{O[0]?.isIntersecting&&p&&!f&&d();},{rootMargin:"200px"});return E.observe(L),()=>E.disconnect()},[p,f,d]),react.useEffect(()=>{if(p)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[p]),g)return jsxRuntime.jsx(fg,{});if(N.length===0)return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:m("predict.matches.empty")})});let P=!p&&N.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
138
+ `;function ig({tier:e}){let t=La[e],r=e==="wide"?5:e==="moderate"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(n,o)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:o<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},o))})}function sg(e){if(Array.isArray(e.legs)&&e.legs.length===2)return [e.legs[0],e.legs[1]];let t=(r,n,o)=>({source:r,event_title:n,event_slug:o?.event_slug??"",market_id:o?.id??0,market_slug:o?.slug??"",question:o?.question??"",status:o?.status??"open",outcomes:o?.outcomes,best_price:o?.outcomes?.[0]?.best_ask??o?.outcomes?.[0]?.price??void 0,vol_24h_usd:o?.volume_24h??void 0});return !e.market_a||!e.market_b?null:[t(e.source_a,e.event_a_title??"",e.market_a),t(e.source_b,e.event_b_title??"",e.market_b)]}function _a({match:e,onSelectMatch:t,getMatchHref:r,onHover:n,getMarketHref:o,LinkComponent:i}){let{t:a}=i18n.useTranslation(),l=sg(e);if(!l)return null;let[s,c]=l,p=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,m=Xf(p),u=La[m],d=s.best_price!=null&&c.best_price!=null?s.best_price<=c.best_price?s.source:c.source:null,f=s.event_title||c.event_title,g=e.signal_tag??"stale_data",h=Ma[g]??Ma.stale_data,x=r?.(e),S=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:og}),p!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${u.bandFrom}, ${u.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:u.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:u.color},children:[p.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:a("predict.matches.gap")})]}),jsxRuntime.jsx(ig,{tier:m})]}),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:f}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(Ea,{leg:s,isCheaper:d===s.source,externalUrlFallback:o?.(e,s.source)}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(Ea,{leg:c,isCheaper:d===c.source,externalUrlFallback:o?.(e,c.source)})]})]}),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"})]}),Lo(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"})}),Lo(e.combined_volume_24h)," ",a("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:a("predict.matches.updatedAgo",{seconds:e.age_seconds}),style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),ag(a,e.age_seconds)]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:h.dot,flexShrink:0}}),a(h.label)]})]})]}),P={display:"block",color:"inherit",textDecoration:"none",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:x||t?"pointer":void 0},E=w=>{let k=w.currentTarget,K=Jf[m];k.style.borderColor=K.border,k.style.boxShadow=K.shadow,n?.(e);},v=w=>{let k=w.currentTarget;k.style.borderColor="rgba(39,39,42,0.6)",k.style.boxShadow="none";};return x&&i?jsxRuntime.jsx(i,{href:x,className:"group match-card",children:jsxRuntime.jsx("div",{style:P,onMouseEnter:E,onMouseLeave:v,onClick:()=>t?.(e),children:S})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:P,onMouseEnter:E,onMouseLeave:v,onClick:()=>t?.(e),onKeyDown:w=>{t&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),t(e));},children:S})}function ag(e,t){if(t<60)return e("predict.matches.ageJustNow");if(t<3600){let n=Math.floor(t/60);return e("predict.matches.ageMinutes",{count:n})}let r=Math.floor(t/3600);return e("predict.matches.ageHours",{count:r})}function Ea({leg:e,isCheaper:t,externalUrlFallback:r}){let{t:n}=i18n.useTranslation(),o=ht(e.source),i=ng(e.source),a=e.best_price,l=e.outcomes?.[0]?.label??null,s=e.external_url??r,c=Zf(e.age_seconds);return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent"},children:[t?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:100,flexShrink:0},children:[o.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:i.text,textTransform:"uppercase"},children:o.label}),c&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?n("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:eg[c],flexShrink:0}})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[l&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[Lo(e.vol_24h_usd)," ",n("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?"#c7ff2e":"#f4f4f5"},children:a!=null?(a*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:n("predict.matches.centsYes")})]}),s?jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer","aria-label":n("predict.matches.viewOn",{platform:o.label}),title:n("predict.matches.viewOn",{platform:o.label}),onClick:p=>p.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:p=>{p.currentTarget.style.color="#d4d4d8",p.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:p=>{p.currentTarget.style.color="#71717a",p.currentTarget.style.background="transparent";},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})}):jsxRuntime.jsx("span",{style:{width:18,flexShrink:0}})]})}var Da=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,signal:o,onSelectMatch:i,getMatchHref:a,onSelect:l,onHover:s,getMarketHref:c,LinkComponent:p,onStatsChange:m},u){let{t:d}=i18n.useTranslation(),{data:f,hasNextPage:g,fetchNextPage:h,isFetchingNextPage:x,isLoading:S,isPlaceholderData:P,refetch:E}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,signal:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[v,w]=react.useState(0),[k,K]=react.useState(false);k&&!P?(K(false),w(Z=>Z+1)):P&&!k&&K(true),react.useImperativeHandle(u,()=>({refetch:()=>{E();}}),[E]);let I=react.useMemo(()=>f?.pages.flatMap(Z=>Z.items??[])??[],[f]),q=f?.pages[0]?.total,N=react.useMemo(()=>{let Z=0,B=0,b=0;for(let y of I){let V=y.spread??0;V>Z&&(Z=V),V>=.03&&b++,y.combined_volume!=null&&(B+=y.combined_volume);}return {activePairs:q??I.length,maxSpread:Z,highSpreadCount:b,totalVolume:B}},[I,q]);react.useEffect(()=>{N.activePairs>0&&m?.(N);},[N,m]);let H=react.useRef(null),R=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let Z=H.current;if(!Z)return;let B=new IntersectionObserver(b=>{b[0]?.isIntersecting&&g&&!x&&h();},{rootMargin:"200px"});return B.observe(Z),()=>B.disconnect()},[g,x,h]),react.useEffect(()=>{if(g)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[g]),S)return jsxRuntime.jsx(hg,{});if(I.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:d("predict.matches.empty")})});let $=!g&&I.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
139
139
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
140
140
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
141
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:u?.pages.map(L=>L.items?.map((E,O)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${O*35}ms both`},children:jsxRuntime.jsx(Ra,{match:E,onSelect:o,onHover:i,getMarketHref:a,LinkComponent:l})},`${k}-${E.match_id}-${E.source_a}-${E.market_a?.slug??O}`)))}),jsxRuntime.jsxs("div",{ref:A,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"})}),m("predict.matches.loadMore")]})]}),P&&jsxRuntime.jsx(mg,{onScrollToTop:Q})]})});function mg({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 fg(){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(gg,{index:t},t))})]})}function gg({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(n=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},n))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var yg={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function kg(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let o=new Date;return `${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`};t(r());let n=setInterval(()=>t(r()),1e4);return ()=>clearInterval(n)},[]),jsxRuntime.jsx("span",{children:e})}function Sg({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(kg,{})]})]})]})]})}function P2({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,bgImageSrc:o}){let{t:i}=i18n.useTranslation(),[a,l]=react.useState("spread"),[s,c]=react.useState(false),[m,u]=react.useState(5e3),[p,d]=react.useState(),f=react.useRef(null),g=react.useCallback(w=>{l(w);},[]),h=react.useCallback(w=>{c(w);},[]),v=react.useCallback(w=>{react.startTransition(()=>{d(w);});},[]),k=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
141
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:f?.pages.map(Z=>Z.items?.map((B,b)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${b*35}ms both`},children:jsxRuntime.jsx(_a,{match:B,onSelectMatch:i,getMatchHref:a,onHover:s,onSelect:l,getMarketHref:c,LinkComponent:p})},`${v}-${B.match_id}-${B.source_a}-${B.market_a?.slug??b}`)))}),jsxRuntime.jsxs("div",{ref:H,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)}}"}),x&&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"})}),d("predict.matches.loadMore")]})]}),$&&jsxRuntime.jsx(gg,{onScrollToTop:R})]})});function gg({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 hg(){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(vg,{index:t},t))})]})}function vg({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(n=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},n))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var Sg={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function wg(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let o=new Date;return `${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`};t(r());let n=setInterval(()=>t(r()),1e4);return ()=>clearInterval(n)},[]),jsxRuntime.jsx("span",{children:e})}function Pg({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(wg,{})]})]})]})]})}function C2({onSelectMatch:e,getMatchHref:t,onHover:r,onSelect:n,getMarketHref:o,LinkComponent:i,bgImageSrc:a}){let{t:l}=i18n.useTranslation(),[s,c]=react.useState("spread"),[p,m]=react.useState(false),[u,d]=react.useState(void 0),[f,g]=react.useState(),h=react.useRef(null),x=react.useCallback(v=>{c(v);},[]),S=react.useCallback(v=>{m(v);},[]),P=react.useCallback(v=>{react.startTransition(()=>{g(v);});},[]),E=react.useCallback(()=>{h.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
142
142
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
143
143
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
144
144
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
145
145
  .match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
146
- `}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:0,overflow:"hidden"},children:[o&&jsxRuntime.jsx("img",{src:o,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(Ma,{stats:p})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i(yg[a])}),p&&p.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:i("predict.matches.pairsFound",{count:p.activePairs})})]})]}),jsxRuntime.jsx(Ca,{sortBy:a,onSortChange:g,sortAsc:s,onSortAscChange:h,minVolume:m,onMinVolumeChange:u,onRefresh:k})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:i("predict.matches.experimentalFeature")})," \u2014 ",i("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Aa,{ref:f,sortBy:a,sortAsc:s,minVolume:m,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:n,onStatsChange:v})]}),jsxRuntime.jsx(Sg,{stats:p})]})}function Io(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Pg={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},Ng={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function Cg(e){return Pg[e]??Ng}function Mg(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let n of e.matched_markets){let o=n.spread??0;o>r&&(r=o,t=n);}return t}function Eg(e,t){let r=e.entries.find(l=>l.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(l=>l.source===(t?.source_b??e.entries[1]?.source)),o=l=>{if(!l?.outcomes?.[0])return {name:null,price:null};let s=l.outcomes[0];return {name:s.label||null,price:s.best_ask??s.price??null}},i=o(t?.market_a),a=o(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??n?.source??"unknown",outcomeName:a.name,yesPrice:a.price,volume:n?.event?.volume??null,event:n?.event}]}function L2({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Mg(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[l,s]=react.useMemo(()=>Eg(e,i),[e,i]),c=a!=null&&a>=3;l.yesPrice!=null&&s.yesPrice!=null?l.source==="kalshi"?l.yesPrice>s.yesPrice:s.yesPrice>l.yesPrice:false;let u=l.yesPrice!=null&&s.yesPrice!=null?l.yesPrice<=s.yesPrice?l:s:null,p=u?ht(u.source):null,d=c?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[a!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${c?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":a>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),a.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(za,{data:l,isCheaper:u===l,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(za,{data:s,isCheaper:u===s,onSelect:t,getEventHref:r,LinkComponent:n})]}),u&&p&&a!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>u.event&&t?.(u.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:u.source.charAt(0).toUpperCase()+u.source.slice(1),spread:a.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Io(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Io(e.combined_volume_24h)," ",o("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",o("predict.matches.match")]})]})]})}function za({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=ht(e.source),l=Cg(e.source),s=e.event?n?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${l.border}`,background:l.bg,padding:12,cursor:s||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=l.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:l.text,textTransform:"uppercase"},children:a.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?l.priceActiveColor:l.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Io(e.volume)," ",i("predict.matches.volume")]})]});return s&&o?jsxRuntime.jsx(o,{href:s,className:"block",children:c}):c}function _g(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function D2({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,a=new Set;for(let l of e){l.max_spread!=null&&l.max_spread>o&&(o=l.max_spread),l.combined_volume!=null&&(i+=l.combined_volume);for(let s of l.entries)a.add(typeof s.source=="string"?s.source:"");}return {count:t??e.length,maxSpread:o,totalVolume:i,platformCount:a.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Oo,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.totalVolume"),value:_g(n.totalVolume)}),jsxRuntime.jsx(Oo,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Oo,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Fn({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Oo(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Wa(e){return `${(e*100).toFixed(1)}\xA2`}function Rg(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function z2({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui.cn("text-sm font-semibold",Rg(e)),children:Wa(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Wa(t)]})]})}var Wr=10,Bg=64,ja=40,Bn=48;function Ya({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:a,isLoading:l,fetchNextPage:s,hasNextPage:c,isFetchingNextPage:m}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:u,isLoading:p,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=l||p,v=m||g,k=c||f,w=react.useMemo(()=>{let L=[];return a?.pages&&L.push(...a.pages.flatMap(E=>E.items)),u?.pages&&L.push(...u.pages.flatMap(E=>E.items)),L.sort((E,O)=>(O.timestamp??0)-(E.timestamp??0)),L},[a,u]),R=Math.max(1,Math.ceil(w.length/Wr)+(k?1:0)),x=(o-1)*Wr,N=w.slice(x,x+Wr),S=react.useCallback(()=>{i(L=>Math.max(1,L-1));},[]),K=react.useCallback(async()=>{o*Wr>=w.length&&k&&(c&&await s(),f&&await d()),i(E=>E+1);},[o,w.length,k,c,f,s,d]),A=o>1,Q=o*Wr<w.length||k;if(h)return jsxRuntime.jsx(Kg,{height:r});if(w.length===0&&!k)return jsxRuntime.jsx(Ug,{message:n("predict.profile.noHistory"),height:r});let P=r-ja-Bn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:ja},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:P},children:[N.map((L,E)=>jsxRuntime.jsx(zg,{trade:L},L.id??`${x+E}`)),v&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Bn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!A,onClick:S,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",A?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(R,5)},(L,E)=>{let O=E+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(O),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",O===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:O},O)}),jsxRuntime.jsxs("button",{type:"button",disabled:!Q,onClick:K,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",Q?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Bn},children:N.map((L,E)=>jsxRuntime.jsx(Hg,{trade:L},L.id??`m-${x+E}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Bn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!A,onClick:S,className:ui.cn("text-sm cursor-pointer",A?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:o}),jsxRuntime.jsx("button",{type:"button",disabled:!Q,onClick:K,className:ui.cn("text-sm cursor-pointer",Q?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function zg({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=Ga(e.type,t),l=r||n,s=l?"+":"-",c=l?"text-success":"text-foreground",m=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,p=e.outcome??"",d=Ja(e.timestamp),f=qa(e),g=$g(e),h=Wg(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Bg},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[u&&jsxRuntime.jsx("img",{src:u,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[p&&jsxRuntime.jsx("span",{className:"mr-1",children:p}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:a}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Xa(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",c),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:h!==null?`$${h.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:f&&jsxRuntime.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Qa,{})})})]})}function Hg({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=Ga(e.type,t),l=e.event?.title??e.market?.question??"\u2014",s=Ja(e.timestamp),c=qa(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:l})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:s})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui.cn("font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:a})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Xa(o)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),c&&jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Qa,{})})]})]})}function Ga(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function qa(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function $g(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let n=parseFloat(r);if(!Number.isNaN(n))return n}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function Wg(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let n=parseFloat(r);if(!Number.isNaN(n))return n}}return null}function Qa(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function Ug({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Kg({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Xa(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Ja(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),l=t.getTimezoneOffset(),s=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}var Ur=10,Xg=64,el=40,zn=48;function rl({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,a]=react.useState(1),{data:l,isLoading:s,fetchNextPage:c,hasNextPage:m,isFetchingNextPage:u}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:p,isLoading:d,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),v=s||d,k=u||h,w=m||g,R=react.useMemo(()=>{let O=[],de=new Set(["live","open","submitted","pending"]);return l?.pages&&O.push(...l.pages.flatMap(U=>U.items).filter(U=>de.has(U.status))),p?.pages&&O.push(...p.pages.flatMap(U=>U.items).filter(U=>de.has(U.status))),O},[l,p]),x=react.useCallback(O=>{o.mutate({source:O.source,id:O.id});},[o]),N=Math.max(1,Math.ceil(R.length/Ur)+(w?1:0)),S=(i-1)*Ur,K=R.slice(S,S+Ur),A=react.useCallback(()=>{a(O=>Math.max(1,O-1));},[]),Q=react.useCallback(async()=>{i*Ur>=R.length&&w&&(m&&await c(),g&&await f()),a(de=>de+1);},[i,R.length,w,m,g,c,f]),P=i>1,L=i*Ur<R.length||w;if(v)return jsxRuntime.jsx(t0,{height:r});if(R.length===0&&!w)return jsxRuntime.jsx(e0,{message:n("predict.profile.noOrders"),height:r});let E=r-el-zn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:el},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:E},children:[K.map(O=>jsxRuntime.jsx(Jg,{order:O,onCancel:x},O.id)),k&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(tl,{className:"hidden lg:flex",currentPage:i,totalPages:N,canGoPrev:P,canGoNext:L,onPrev:A,onNext:Q,onPage:a,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zn},children:K.map(O=>jsxRuntime.jsx(Zg,{order:O,onCancel:x},O.id))}),jsxRuntime.jsx(tl,{className:"lg:hidden",currentPage:i,totalPages:N,canGoPrev:P,canGoNext:L,onPrev:A,onNext:Q,onPage:a,t:n,compact:true})]})}function Jg({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):o*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Xg},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",n?"text-success":"text-danger"),children:r(n?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o>0?nl(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Zg({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui.cn("text-xs font-medium px-1.5 py-0.5 rounded",n?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:o>0?nl(o):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function tl({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:a,onPage:l,t:s,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:zn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:a,className:ui.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:zn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",s("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(m,u)=>{let p=u+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(p),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",p===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:p},p)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[s("predict.profile.next")," \u2192"]})]})}function e0({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function t0({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function nl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var zo=10,i0=64,ol=40,Hn=48;function il({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[a,l]=react.useState(1),s=react.useCallback(()=>{for(let g of e)n?.(g);},[e,n]);if(t)return jsxRuntime.jsx(c0,{height:r});if(e.length===0)return jsxRuntime.jsx(l0,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/zo)),m=(a-1)*zo,u=e.slice(m,m+zo),p=a>1,d=a<c,f=r-ol-Hn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:ol},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:n&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:s,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:u.map((g,h)=>jsxRuntime.jsx(s0,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??m+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Hn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!p,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(g,h)=>{let v=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(v),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",v===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:v},v)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>l(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Hn},children:u.map((g,h)=>jsxRuntime.jsx(a0,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${m+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Hn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!p,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:a}),jsxRuntime.jsx("button",{type:"button",disabled:!d,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function s0({position:e,onClosePosition:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.avg_price??0,l=e.current_price??0,s=e.current_value??e.size*l,c=e.size,m=o>0?"text-success":o<0?"text-danger":"text-foreground",u=o>0?"+":"",p=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?d0(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:i0},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[d&&jsxRuntime.jsx("img",{src:d,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:p}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:Cr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ho(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ho(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",m),children:[jsxRuntime.jsxs("span",{children:[u,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function a0({position:e,onClose:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.current_price??0,l=o>0?"text-success":o<0?"text-danger":"text-foreground",s=o>0?"+":"",c=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:c})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx($n,{label:n("predict.profile.totalSize"),value:Cr(e.size)}),jsxRuntime.jsx($n,{label:n("predict.profile.markPrice"),value:Ho(a)}),jsxRuntime.jsx($n,{label:n("predict.profile.pnl"),value:`${s}$${Math.abs(o).toFixed(2)} (${s}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx($n,{label:n("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:n("predict.profile.close")})})]})}function $n({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function l0({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function c0({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ho(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function d0(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),l=t.getTimezoneOffset(),s=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}catch{return "\u2014"}}function al({positions:e,trades:t,isLoading:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>{let l=0,s=0;for(let d of e)l+=d.realized_pnl??0,s+=d.current_value??d.size*(d.current_price??0);let c=0,m=0,u=0;for(let d of t)c+=d.usd_size??0,d.type==="REDEEM"&&(u++,(d.usd_size??0)>0&&m++);let p=u>0?`${m} / ${u}`:"0 / 0";return {realizedPnl:l,positionsValue:s,volume:c,winRateStr:p}},[e,t]),i=o.realizedPnl>0?"text-success":o.realizedPnl<0?"text-danger":"text-foreground",a=o.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:n("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui.cn("text-5xl font-bold tabular-nums",i),children:[a,"$",Math.abs(o.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Wo,{label:n("predict.profile.winRate"),value:o.winRateStr,isLoading:r}),jsxRuntime.jsx(Wo,{label:n("predict.profile.positions"),value:`$${o.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Wo,{label:n("predict.profile.volume"),value:`$${o.volume.toFixed(2)}`,isLoading:r})]})]})}function Wo({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Uo=600;function x0({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState("positions"),l=!!(e||t),{data:s,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:m,isLoading:u}=reactPredict.usePositions({source:"polymarket",user:t??""}),p=react.useMemo(()=>{let S=[];return s?.positions&&S.push(...s.positions),m?.positions&&S.push(...m.positions),S},[s,m]),d=c||u,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:v}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),k=react.useMemo(()=>[...f?.pages?.flatMap(K=>K.items)??[],...h?.pages?.flatMap(K=>K.items)??[]],[f,h]),w=d||g||v,R=p.length,N=[{key:"positions",label:R>0?`${o("predict.profile.positionsTab")} (${R})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("predict.profile.historyTab")}];return l?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(al,{positions:p,trades:k,isLoading:w}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:N.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(S.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===S.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:S.label},S.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(il,{positions:p,isLoading:d,listHeight:Uo,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(rl,{solanaAddress:e,evmAddress:t,listHeight:Uo}),i==="history"&&jsxRuntime.jsx(Ya,{solanaAddress:e,evmAddress:t,listHeight:Uo})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function Ak({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[a,l]=react.useState(false),[s,c]=react.useState(null),[m,u]=react.useState(false),p=r||m,d=n||m,f=p?"done":a?"running":"pending",g=d?"done":p&&a?"running":"pending",h=p&&d,v=react.useCallback(async()=>{c(null),u(false),l(true);try{await o(),u(!0);}catch(x){c(x instanceof Error?x.message:String(x));}finally{l(false);}},[o]),k=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:f},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],w=()=>{h?t():v();},R=i(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:x=>{x||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:k.map((x,N)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(w0,{index:N+1,status:x.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:x.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${x.status==="done"?"text-[#c7ff2e]":x.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:x.status==="done"?i("predict.setup.stepComplete"):x.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:x.desc})]})]},x.key))}),s&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:s})}),jsxRuntime.jsx("button",{type:"button",onClick:w,disabled:a,className:h?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:a?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):R}),!h&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function w0({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
147
- Object.defineProperty(exports,"PredictClient",{enumerable:true,get:function(){return reactPredict.PredictClient}});Object.defineProperty(exports,"PredictContext",{enumerable:true,get:function(){return reactPredict.PredictContext}});Object.defineProperty(exports,"PredictProvider",{enumerable:true,get:function(){return reactPredict.PredictProvider}});Object.defineProperty(exports,"PredictWsClient",{enumerable:true,get:function(){return reactPredict.PredictWsClient}});Object.defineProperty(exports,"createPredictClient",{enumerable:true,get:function(){return reactPredict.createPredictClient}});Object.defineProperty(exports,"createPredictWsClient",{enumerable:true,get:function(){return reactPredict.createPredictWsClient}});Object.defineProperty(exports,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositions",{enumerable:true,get:function(){return reactPredict.usePositions}});Object.defineProperty(exports,"usePredictClient",{enumerable:true,get:function(){return reactPredict.usePredictClient}});Object.defineProperty(exports,"usePriceHistory",{enumerable:true,get:function(){return reactPredict.usePriceHistory}});Object.defineProperty(exports,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});Object.defineProperty(exports,"useSearchEvents",{enumerable:true,get:function(){return reactPredict.useSearchEvents}});Object.defineProperty(exports,"useSimilarEvents",{enumerable:true,get:function(){return reactPredict.useSimilarEvents}});Object.defineProperty(exports,"useTrades",{enumerable:true,get:function(){return reactPredict.useTrades}});exports.CHART_RANGE_DURATION=H0;exports.CHART_RANGE_PERIOD=B0;exports.CHART_RANGE_SAMPLE_INTERVAL=z0;exports.CandlestickPeriod=on;exports.CategoriesSkeleton=T0;exports.CategoriesUI=Zo;exports.CategoriesWidget=ri;exports.ChartRange=Ye;exports.DEFAULT_CHART_RANGE=sn;exports.DEFAULT_FILTER_STATE=Zn;exports.DEFAULT_PAGE_SIZE=Nr;exports.DEFAULT_PRICE_HISTORY_INTERVAL=K0;exports.EventDetailPage=Qb;exports.EventDetailSkeleton=Dr;exports.EventDetailUI=js;exports.EventDetailWidget=Ys;exports.EventItem=zi;exports.EventMarketDepthChartUI=_s;exports.EventMarketDetailWidget=As;exports.EventPriceChart=zs;exports.EventsFilterUI=bi;exports.EventsHero=_v;exports.EventsPage=Mv;exports.EventsPageSkeleton=ev;exports.EventsSkeleton=to;exports.EventsToolbarUI=Ni;exports.EventsUI=Ki;exports.EventsWidget=ji;exports.KycModal=un;exports.MAX_PRICE_HISTORY_MARKETS=Gn;exports.MatchGroupCard=L2;exports.MatchMarketCard=Ra;exports.MatchesFilterBar=Ca;exports.MatchesHero=Ma;exports.MatchesPage=P2;exports.MatchesStatsBar=D2;exports.MatchesWidget=Aa;exports.ORDER_MAX_PRICE=U0;exports.ORDER_MIN_PRICE=W0;exports.ORDER_MIN_QUANTITY=an;exports.ORDER_MIN_USDC=ln;exports.ORDER_PRICE_STEP=$0;exports.PREDICT_REDEEM_MODAL_ID=tp;exports.PREDICT_SEARCH_MODAL_ID=Mo;exports.PREDICT_SELL_MODAL_ID=co;exports.PREDICT_TRADE_MODAL_ID=Mr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=V0;exports.PredictRedeemModal=rs;exports.PredictSearchModal=_1;exports.PredictSellModal=xs;exports.PredictTradeModal=gn;exports.PredictWalletProvider=Al;exports.PriceHistoryInterval=gr;exports.ProfilePage=x0;exports.RedeemFormWidget=es;exports.SORT_PRESETS=Pi;exports.STATIC_CATEGORIES=Yn;exports.SearchEventsButton=H1;exports.SearchHistoryUI=na;exports.SearchHistoryWidget=oa;exports.SearchInputUI=ia;exports.SearchResultItemUI=sa;exports.SearchResultListWidget=pa;exports.SearchWidget=ha;exports.SellFormUI=hs;exports.SellFormWidget=kn;exports.SetupModal=Ak;exports.SimilarEventCard=Sm;exports.SimilarEventsSection=Xs;exports.SourceBadge=Cb;exports.SpreadIndicator=z2;exports.TradeFormSkeleton=Ps;exports.TradeFormUI=vi;exports.TradeFormWidget=fn;exports.UserActivitySection=ks;exports.countActiveFilters=eo;exports.fireCelebration=Zt;exports.floorToDecimals=Pe;exports.formatKMB=Ar;exports.formatShares=Cr;exports.getSourceMeta=ht;exports.parsePolymarketError=pn;exports.resolveExpiration=cn;exports.roundToTickSize=dn;exports.useEventDetail=ny;exports.useEventsInfinite=Ei;exports.usePredictSearchHistory=In;exports.usePredictWallet=Jt;exports.useSearchResultListScript=aa;exports.useSearchScript=ga;exports.useSellForm=as;exports.useTradeForm=ci;exports.version=kl;//# sourceMappingURL=index.js.map
146
+ `}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:0,overflow:"hidden"},children:[a&&jsxRuntime.jsx("img",{src:a,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(Ca,{stats:f})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l(Sg[s])}),f&&f.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:l("predict.matches.pairsFound",{count:f.activePairs})})]})]}),jsxRuntime.jsx(Na,{sortBy:s,onSortChange:x,sortAsc:p,onSortAscChange:S,minVolume:u,onMinVolumeChange:d,onRefresh:E})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:l("predict.matches.experimentalFeature")})," \u2014 ",l("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Da,{ref:h,sortBy:s,sortAsc:p,minVolume:u,onSelectMatch:e,getMatchHref:t,onHover:r,onSelect:n,getMarketHref:o,LinkComponent:i,onStatsChange:P})]}),jsxRuntime.jsx(Pg,{stats:f})]})}function Ro(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Cg={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},Mg={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function Eg(e){return Cg[e]??Mg}function Tg(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let n of e.matched_markets){let o=n.spread??0;o>r&&(r=o,t=n);}return t}function Lg(e,t){let r=e.entries.find(l=>l.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(l=>l.source===(t?.source_b??e.entries[1]?.source)),o=l=>{if(!l?.outcomes?.[0])return {name:null,price:null};let s=l.outcomes[0];return {name:s.label||null,price:s.best_ask??s.price??null}},i=o(t?.market_a),a=o(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??n?.source??"unknown",outcomeName:a.name,yesPrice:a.price,volume:n?.event?.volume??null,event:n?.event}]}function R2({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Tg(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[l,s]=react.useMemo(()=>Lg(e,i),[e,i]),c=a!=null&&a>=3;l.yesPrice!=null&&s.yesPrice!=null?l.source==="kalshi"?l.yesPrice>s.yesPrice:s.yesPrice>l.yesPrice:false;let m=l.yesPrice!=null&&s.yesPrice!=null?l.yesPrice<=s.yesPrice?l:s:null,u=m?ht(m.source):null,d=c?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[a!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${c?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":a>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),a.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(Ba,{data:l,isCheaper:m===l,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(Ba,{data:s,isCheaper:m===s,onSelect:t,getEventHref:r,LinkComponent:n})]}),m&&u&&a!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>m.event&&t?.(m.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:m.source.charAt(0).toUpperCase()+m.source.slice(1),spread:a.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Ro(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Ro(e.combined_volume_24h)," ",o("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",o("predict.matches.match")]})]})]})}function Ba({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=ht(e.source),l=Eg(e.source),s=e.event?n?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${l.border}`,background:l.bg,padding:12,cursor:s||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:p=>{p.currentTarget.style.borderColor=l.hoverBorder;},onMouseLeave:p=>{p.currentTarget.style.borderColor=l.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:l.text,textTransform:"uppercase"},children:a.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?l.priceActiveColor:l.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Ro(e.volume)," ",i("predict.matches.volume")]})]});return s&&o?jsxRuntime.jsx(o,{href:s,className:"block",children:c}):c}function Ig(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function F2({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,a=new Set;for(let l of e){l.max_spread!=null&&l.max_spread>o&&(o=l.max_spread),l.combined_volume!=null&&(i+=l.combined_volume);for(let s of l.entries)a.add(typeof s.source=="string"?s.source:"");}return {count:t??e.length,maxSpread:o,totalVolume:i,platformCount:a.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Io,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.totalVolume"),value:Ig(n.totalVolume)}),jsxRuntime.jsx(Io,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Io,{}),jsxRuntime.jsx(Fn,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Fn({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Io(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function $a(e){return `${(e*100).toFixed(1)}\xA2`}function Og(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function $2({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui.cn("text-sm font-semibold",Og(e)),children:$a(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",$a(t)]})]})}var Wr=10,zg=64,Va=40,Bn=48;function ja({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:a,isLoading:l,fetchNextPage:s,hasNextPage:c,isFetchingNextPage:p}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:m,isLoading:u,fetchNextPage:d,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=l||u,x=p||g,S=c||f,P=react.useMemo(()=>{let H=[];return a?.pages&&H.push(...a.pages.flatMap(R=>R.items)),m?.pages&&H.push(...m.pages.flatMap(R=>R.items)),H.sort((R,$)=>($.timestamp??0)-(R.timestamp??0)),H},[a,m]),E=Math.max(1,Math.ceil(P.length/Wr)+(S?1:0)),v=(o-1)*Wr,w=P.slice(v,v+Wr),k=react.useCallback(()=>{i(H=>Math.max(1,H-1));},[]),K=react.useCallback(async()=>{o*Wr>=P.length&&S&&(c&&await s(),f&&await d()),i(R=>R+1);},[o,P.length,S,c,f,s,d]),I=o>1,q=o*Wr<P.length||S;if(h)return jsxRuntime.jsx(jg,{height:r});if(P.length===0&&!S)return jsxRuntime.jsx(Vg,{message:n("predict.profile.noHistory"),height:r});let N=r-Va-Bn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Va},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:N},children:[w.map((H,R)=>jsxRuntime.jsx($g,{trade:H},H.id??`${v+R}`)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Bn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!I,onClick:k,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",I?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(E,5)},(H,R)=>{let $=R+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i($),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",$===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:$},$)}),jsxRuntime.jsxs("button",{type:"button",disabled:!q,onClick:K,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",q?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Bn},children:w.map((H,R)=>jsxRuntime.jsx(Wg,{trade:H},H.id??`m-${v+R}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Bn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!I,onClick:k,className:ui.cn("text-sm cursor-pointer",I?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:o}),jsxRuntime.jsx("button",{type:"button",disabled:!q,onClick:K,className:ui.cn("text-sm cursor-pointer",q?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function $g({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=Ga(e.type,t),l=r||n,s=l?"+":"-",c=l?"text-success":"text-foreground",p=e.event?.title??e.market?.question??"\u2014",m=e.event?.image_url,u=e.outcome??"",d=Xa(e.timestamp),f=Ya(e),g=Ug(e),h=Kg(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:zg},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[m&&jsxRuntime.jsx("img",{src:m,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:p}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[u&&jsxRuntime.jsx("span",{className:"mr-1",children:u}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:a}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Qa(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",c),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:h!==null?`$${h.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:f&&jsxRuntime.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(qa,{})})})]})}function Wg({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=Ga(e.type,t),l=e.event?.title??e.market?.question??"\u2014",s=Xa(e.timestamp),c=Ya(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:l})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:s})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui.cn("font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:a})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Qa(o)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),c&&jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(qa,{})})]})]})}function Ga(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function Ya(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function Ug(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let n=parseFloat(r);if(!Number.isNaN(n))return n}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function Kg(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let n=parseFloat(r);if(!Number.isNaN(n))return n}}return null}function qa(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function Vg({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function jg({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Qa(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Xa(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),l=t.getTimezoneOffset(),s=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}var Ur=10,Zg=64,Za=40,Hn=48;function tl({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,a]=react.useState(1),{data:l,isLoading:s,fetchNextPage:c,hasNextPage:p,isFetchingNextPage:m}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:u,isLoading:d,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=s||d,S=m||h,P=p||g,E=react.useMemo(()=>{let $=[],Z=new Set(["live","open","submitted","pending"]);return l?.pages&&$.push(...l.pages.flatMap(B=>B.items).filter(B=>Z.has(B.status))),u?.pages&&$.push(...u.pages.flatMap(B=>B.items).filter(B=>Z.has(B.status))),$},[l,u]),v=react.useCallback($=>{o.mutate({source:$.source,id:$.id});},[o]),w=Math.max(1,Math.ceil(E.length/Ur)+(P?1:0)),k=(i-1)*Ur,K=E.slice(k,k+Ur),I=react.useCallback(()=>{a($=>Math.max(1,$-1));},[]),q=react.useCallback(async()=>{i*Ur>=E.length&&P&&(p&&await c(),g&&await f()),a(Z=>Z+1);},[i,E.length,P,p,g,c,f]),N=i>1,H=i*Ur<E.length||P;if(x)return jsxRuntime.jsx(n0,{height:r});if(E.length===0&&!P)return jsxRuntime.jsx(r0,{message:n("predict.profile.noOrders"),height:r});let R=r-Za-Hn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Za},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:R},children:[K.map($=>jsxRuntime.jsx(e0,{order:$,onCancel:v},$.id)),S&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(el,{className:"hidden lg:flex",currentPage:i,totalPages:w,canGoPrev:N,canGoNext:H,onPrev:I,onNext:q,onPage:a,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Hn},children:K.map($=>jsxRuntime.jsx(t0,{order:$,onCancel:v},$.id))}),jsxRuntime.jsx(el,{className:"lg:hidden",currentPage:i,totalPages:w,canGoPrev:N,canGoNext:H,onPrev:I,onNext:q,onPage:a,t:n,compact:true})]})}function e0({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):o*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Zg},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",n?"text-success":"text-danger"),children:r(n?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o>0?rl(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function t0({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui.cn("text-xs font-medium px-1.5 py-0.5 rounded",n?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:o>0?rl(o):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function el({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:a,onPage:l,t:s,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Hn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:a,className:ui.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Hn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",s("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(p,m)=>{let u=m+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(u),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",u===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:u},u)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[s("predict.profile.next")," \u2192"]})]})}function r0({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function n0({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function rl(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Bo=10,a0=64,nl=40,zn=48;function ol({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[a,l]=react.useState(1),s=react.useCallback(()=>{for(let g of e)n?.(g);},[e,n]);if(t)return jsxRuntime.jsx(p0,{height:r});if(e.length===0)return jsxRuntime.jsx(d0,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/Bo)),p=(a-1)*Bo,m=e.slice(p,p+Bo),u=a>1,d=a<c,f=r-nl-zn;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:nl},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:n&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:s,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:m.map((g,h)=>jsxRuntime.jsx(l0,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??p+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:zn},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!u,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",u?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(g,h)=>{let x=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>l(x),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>l(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zn},children:m.map((g,h)=>jsxRuntime.jsx(c0,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${p+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:zn},children:[jsxRuntime.jsx("button",{type:"button",disabled:!u,onClick:()=>l(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",u?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:a}),jsxRuntime.jsx("button",{type:"button",disabled:!d,onClick:()=>l(g=>g+1),className:ui.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function l0({position:e,onClosePosition:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.avg_price??0,l=e.current_price??0,s=e.current_value??e.size*l,c=e.size,p=o>0?"text-success":o<0?"text-danger":"text-foreground",m=o>0?"+":"",u=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?u0(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:a0},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[d&&jsxRuntime.jsx("img",{src:d,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:u}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:Cr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ho(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ho(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",p),children:[jsxRuntime.jsxs("span",{children:[m,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",m,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function c0({position:e,onClose:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.current_price??0,l=o>0?"text-success":o<0?"text-danger":"text-foreground",s=o>0?"+":"",c=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:c})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx($n,{label:n("predict.profile.totalSize"),value:Cr(e.size)}),jsxRuntime.jsx($n,{label:n("predict.profile.markPrice"),value:Ho(a)}),jsxRuntime.jsx($n,{label:n("predict.profile.pnl"),value:`${s}$${Math.abs(o).toFixed(2)} (${s}${i.toFixed(1)}%)`,className:l}),jsxRuntime.jsx($n,{label:n("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:n("predict.profile.close")})})]})}function $n({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function d0({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function p0({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ho(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function u0(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),l=t.getTimezoneOffset(),s=l<=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${s}${c})`}catch{return "\u2014"}}function sl({positions:e,trades:t,isLoading:r}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>{let l=0,s=0;for(let d of e)l+=d.realized_pnl??0,s+=d.current_value??d.size*(d.current_price??0);let c=0,p=0,m=0;for(let d of t)c+=d.usd_size??0,d.type==="REDEEM"&&(m++,(d.usd_size??0)>0&&p++);let u=m>0?`${p} / ${m}`:"0 / 0";return {realizedPnl:l,positionsValue:s,volume:c,winRateStr:u}},[e,t]),i=o.realizedPnl>0?"text-success":o.realizedPnl<0?"text-danger":"text-foreground",a=o.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:n("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui.cn("text-5xl font-bold tabular-nums",i),children:[a,"$",Math.abs(o.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx($o,{label:n("predict.profile.winRate"),value:o.winRateStr,isLoading:r}),jsxRuntime.jsx($o,{label:n("predict.profile.positions"),value:`$${o.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx($o,{label:n("predict.profile.volume"),value:`$${o.volume.toFixed(2)}`,isLoading:r})]})]})}function $o({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Wo=600;function y0({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState("positions"),l=!!(e||t),{data:s,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:p,isLoading:m}=reactPredict.usePositions({source:"polymarket",user:t??""}),u=react.useMemo(()=>{let k=[];return s?.positions&&k.push(...s.positions),p?.positions&&k.push(...p.positions),k},[s,p]),d=c||m,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),S=react.useMemo(()=>[...f?.pages?.flatMap(K=>K.items)??[],...h?.pages?.flatMap(K=>K.items)??[]],[f,h]),P=d||g||x,E=u.length,w=[{key:"positions",label:E>0?`${o("predict.profile.positionsTab")} (${E})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("predict.profile.historyTab")}];return l?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(sl,{positions:u,trades:S,isLoading:P}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:w.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(k.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===k.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:k.label},k.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(ol,{positions:u,isLoading:d,listHeight:Wo,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(tl,{solanaAddress:e,evmAddress:t,listHeight:Wo}),i==="history"&&jsxRuntime.jsx(ja,{solanaAddress:e,evmAddress:t,listHeight:Wo})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function Bk({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[a,l]=react.useState(false),[s,c]=react.useState(null),[p,m]=react.useState(false),u=r||p,d=n||p,f=u?"done":a?"running":"pending",g=d?"done":u&&a?"running":"pending",h=u&&d,x=react.useCallback(async()=>{c(null),m(false),l(true);try{await o(),m(!0);}catch(v){c(v instanceof Error?v.message:String(v));}finally{l(false);}},[o]),S=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:f},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],P=()=>{h?t():x();},E=i(h?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:v=>{v||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:S.map((v,w)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(N0,{index:w+1,status:v.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:v.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${v.status==="done"?"text-[#c7ff2e]":v.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:v.status==="done"?i("predict.setup.stepComplete"):v.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:v.desc})]})]},v.key))}),s&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:s})}),jsxRuntime.jsx("button",{type:"button",onClick:P,disabled:a,className:h?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:a?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):E}),!h&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function N0({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
147
+ Object.defineProperty(exports,"PredictClient",{enumerable:true,get:function(){return reactPredict.PredictClient}});Object.defineProperty(exports,"PredictContext",{enumerable:true,get:function(){return reactPredict.PredictContext}});Object.defineProperty(exports,"PredictProvider",{enumerable:true,get:function(){return reactPredict.PredictProvider}});Object.defineProperty(exports,"PredictWsClient",{enumerable:true,get:function(){return reactPredict.PredictWsClient}});Object.defineProperty(exports,"createPredictClient",{enumerable:true,get:function(){return reactPredict.createPredictClient}});Object.defineProperty(exports,"createPredictWsClient",{enumerable:true,get:function(){return reactPredict.createPredictWsClient}});Object.defineProperty(exports,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositions",{enumerable:true,get:function(){return reactPredict.usePositions}});Object.defineProperty(exports,"usePredictClient",{enumerable:true,get:function(){return reactPredict.usePredictClient}});Object.defineProperty(exports,"usePriceHistory",{enumerable:true,get:function(){return reactPredict.usePriceHistory}});Object.defineProperty(exports,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});Object.defineProperty(exports,"useSearchEvents",{enumerable:true,get:function(){return reactPredict.useSearchEvents}});Object.defineProperty(exports,"useSimilarEvents",{enumerable:true,get:function(){return reactPredict.useSimilarEvents}});Object.defineProperty(exports,"useTrades",{enumerable:true,get:function(){return reactPredict.useTrades}});exports.CHART_RANGE_DURATION=W0;exports.CHART_RANGE_PERIOD=z0;exports.CHART_RANGE_SAMPLE_INTERVAL=$0;exports.CandlestickPeriod=on;exports.CategoriesSkeleton=_0;exports.CategoriesUI=Jo;exports.CategoriesWidget=ti;exports.ChartRange=Ge;exports.DEFAULT_CHART_RANGE=sn;exports.DEFAULT_FILTER_STATE=Zn;exports.DEFAULT_PAGE_SIZE=Nr;exports.DEFAULT_PRICE_HISTORY_INTERVAL=j0;exports.EventDetailPage=Jb;exports.EventDetailSkeleton=Dr;exports.EventDetailUI=Vs;exports.EventDetailWidget=js;exports.EventItem=Bi;exports.EventMarketDepthChartUI=Ls;exports.EventMarketDetailWidget=Ds;exports.EventPriceChart=Bs;exports.EventsFilterUI=xi;exports.EventsHero=Iv;exports.EventsPage=Tv;exports.EventsPageSkeleton=rv;exports.EventsSkeleton=to;exports.EventsToolbarUI=Pi;exports.EventsUI=Ui;exports.EventsWidget=Vi;exports.KycModal=un;exports.MAX_PRICE_HISTORY_MARKETS=Yn;exports.MatchGroupCard=R2;exports.MatchMarketCard=_a;exports.MatchesFilterBar=Na;exports.MatchesHero=Ca;exports.MatchesPage=C2;exports.MatchesStatsBar=F2;exports.MatchesWidget=Da;exports.ORDER_MAX_PRICE=V0;exports.ORDER_MIN_PRICE=K0;exports.ORDER_MIN_QUANTITY=an;exports.ORDER_MIN_USDC=ln;exports.ORDER_PRICE_STEP=U0;exports.PREDICT_REDEEM_MODAL_ID=ep;exports.PREDICT_SEARCH_MODAL_ID=Mo;exports.PREDICT_SELL_MODAL_ID=co;exports.PREDICT_TRADE_MODAL_ID=Mr;exports.PRICE_HISTORY_SAMPLE_INTERVAL=G0;exports.PredictRedeemModal=ts;exports.PredictSearchModal=I1;exports.PredictSellModal=vs;exports.PredictTradeModal=gn;exports.PredictWalletProvider=Dl;exports.PriceHistoryInterval=gr;exports.ProfilePage=y0;exports.RedeemFormWidget=Zi;exports.SORT_PRESETS=wi;exports.STATIC_CATEGORIES=Gn;exports.SearchEventsButton=W1;exports.SearchHistoryUI=ra;exports.SearchHistoryWidget=na;exports.SearchInputUI=oa;exports.SearchResultItemUI=ia;exports.SearchResultListWidget=da;exports.SearchWidget=ga;exports.SellFormUI=gs;exports.SellFormWidget=kn;exports.SetupModal=Bk;exports.SimilarEventCard=km;exports.SimilarEventsSection=Qs;exports.SourceBadge=Eb;exports.SpreadIndicator=$2;exports.TradeFormSkeleton=ws;exports.TradeFormUI=hi;exports.TradeFormWidget=fn;exports.UserActivitySection=ys;exports.countActiveFilters=eo;exports.fireCelebration=Zt;exports.floorToDecimals=Pe;exports.formatKMB=Ar;exports.formatShares=Cr;exports.getSourceMeta=ht;exports.parsePolymarketError=pn;exports.resolveExpiration=cn;exports.roundToTickSize=dn;exports.useEventDetail=iy;exports.useEventsInfinite=Mi;exports.usePredictSearchHistory=In;exports.usePredictWallet=Jt;exports.useSearchResultListScript=sa;exports.useSearchScript=fa;exports.useSellForm=ss;exports.useTradeForm=li;exports.version=yl;//# sourceMappingURL=index.js.map
148
148
  //# sourceMappingURL=index.js.map