@liberfi.io/ui-predict 4.0.62 → 4.0.64
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 +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';var react=require('react'),ui$1=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),zo=require('canvas-confetti'),reactQuery=require('@tanstack/react-query'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var zo__default=/*#__PURE__*/_interopDefault(zo);var Lc={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},Ki=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Ao=(()=>{let e=t=>{let r=Ki.indexOf(t);return r===-1?Ki.length:r};return Object.entries(Lc).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 Gi({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:a,pulsingTab:s="Trending",className:l}){let{t:u}=i18n.useTranslation(),m=react.useCallback(()=>{o(null);},[o]),c=u("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui$1.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",l),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(Vi,{label:c,isSelected:t===null,onPress:m,showPulse:c===s}),jsxRuntime.jsx(Oc,{}),e.map(f=>{let d=f.slug??f.category,p=f.label??f.category;return jsxRuntime.jsx(Vi,{label:p,isSelected:t===d,onPress:()=>o(d),badge:f.badge,showPulse:d===s||p===s},d)})]})}),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(ji,{label:u("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(f=>{let d=f.slug??f.label;return jsxRuntime.jsx(ji,{label:f.label,icon:f.icon,isSelected:r===d,onPress:()=>i(d)},d)})]})})]})}function Vi({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[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 Oc(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function ji({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Vv({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function Yi(e){return e.trim().toLowerCase().replace(/&/g,"and").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Ac(e){return `predict.categories.category.${Yi(e)}`}function Qi(e){return `predict.categories.tag.${Yi(e)}`}function Fc(e,t){return e.map(r=>({category:r.slug,slug:r.slug,label:t(Ac(r.slug),r.label),tags:r.tags.map(n=>({slug:n.slug,label:t(Qi(n.slug),n.label),icon:n.icon}))}))}function Bc(e,t){return e?e.tags.map(r=>({slug:r.slug,label:t(Qi(r.slug),r.label),icon:r.icon})):[]}function Xi({onSelect:e,trailing:t,className:r}){let{t:n}=i18n.useTranslation(),o=react.useCallback((p,g)=>{let h=n(p);return typeof h=="string"&&h!==p?h:g},[n]),[i,a]=react.useState(null),[s,l]=react.useState(null),u=react.useCallback(p=>{a(p),l(null),e?.({categorySlug:p,tagSlug:null});},[e]),m=react.useCallback(p=>{l(p),e?.({categorySlug:i,tagSlug:p});},[i,e]),c=Fc(Ao,o),f=Ao.find(p=>p.slug===i),d=Bc(f,o);return jsxRuntime.jsx(Gi,{categories:c,selectedCategory:i,selectedTag:s,activeTags:d,onCategorySelect:u,onTagSelect:m,trailing:t,className:r})}function Fn(e){return {title:e.title,imageUrl:e.image_url}}function Bn(e,t){let r=e.outcomes[0],n=e.outcomes[1];return {question:e.question,yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??n?.best_ask??n?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??n?.best_bid,yesSubTitle:r?.label??"Yes",noSubTitle:n?.label??"No"}}var an=24,Bo=4,Hn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},le={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},zn=le.ALL,tb={[le.ONE_DAY]:Hn.ONE_MINUTE,[le.ONE_WEEK]:Hn.ONE_HOUR,[le.ONE_MONTH]:Hn.ONE_HOUR,[le.ALL]:Hn.ONE_DAY},rb={[le.ONE_DAY]:300,[le.ONE_WEEK]:3600,[le.ONE_MONTH]:10800,[le.ALL]:1440*60},nb={[le.ONE_DAY]:1440*60,[le.ONE_WEEK]:10080*60,[le.ONE_MONTH]:720*60*60,[le.ALL]:null},Wn=1,Un=1,ob=1,ib=1,sb=99,Wr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},ab=Wr.ONE_WEEK,lb={[Wr.ONE_HOUR]:60,[Wr.SIX_HOURS]:60,[Wr.ONE_DAY]:300,[Wr.ONE_WEEK]:1800,[Wr.MAX]:1800};var es=react.createContext(null);function yr(){let e=react.useContext(es);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Vc=1e4;function jc({pollingInterval:e=Vc,enabled:t=true,enableKalshi:r=true,children:n}){let o=walletConnector.useWallets(),i=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.SOLANA&&C.isConnected)?.address,[o]),a=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.EVM&&C.isConnected)?.address,[o]),{data:s,isLoading:l,isFetching:u,error:m}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:c,isLoading:f}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:d,isLoading:p}=reactPredict.usePolymarketSetup(a,{enabled:t&&!!a,refetchInterval:3e4}),g=d?.safe_address,v=d?.verified??false,h=d?.wallet_kind??"deposit",x=d?.deposit_wallet_address,S=h==="safe"?d?.safe_address:x,k=h==="safe"?d?.safe_deployed??false:d?.deposit_wallet_deployed??false,{data:b,isLoading:y,isFetching:M,error:R}=reactPredict.useBalance({source:"polymarket",user:a??""},{enabled:t&&v&&!!a,refetchInterval:e}),P=react.useMemo(()=>({enableKalshi:r,solanaAddress:i,evmAddress:a,polymarketWalletKind:h,polymarketWalletAddress:S,polymarketDepositWalletAddress:x,polymarketWalletDeployed:k,polymarketSafeAddress:g,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:v&&b?Number(b.balance):null,kalshiKycVerified:c?.verified??false,kalshiKycUrl:c?.kyc_url??null,kalshiKycLoading:f,polymarketSetupVerified:v,polymarketSafeDeployed:d?.safe_deployed??false,polymarketTokenApproved:d?.token_approved??false,polymarketSetupLoading:p,isLoading:l||y,isFetching:u||M,error:m??R??null}),[r,i,a,h,S,x,k,g,s,b,v,c,f,d,p,l,y,u,M,m,R]);return jsxRuntime.jsx(es.Provider,{value:P,children:n})}var qc={minutes:60,hours:3600,days:86400};function $n(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*qc[r]}}function Kn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function be(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function Yc(e){let t=e;return !Number.isFinite(t)||t<=0||t>=1?1:1-t}var Qc=100,Xc=300;function Wo(e,t){return Qc/1e4+Math.max(0,e)/1e4*Yc(t)}function Jc(e,t){let r=e?.[t],n=typeof r=="number"?r:Number(r);return Number.isFinite(n)?n:void 0}function Zc(e,t){let r=e?.[t];return typeof r=="string"?r:void 0}function ts(e){let t=Jc(e,"polymarket.effectiveTakerFeeBps");if(t!==void 0&&t>=0)return t;let r=e?.["polymarket.feeDescriptor"],n=typeof r?.r=="number"?r.r:Number(r?.r);return Number.isFinite(n)&&n>=0?n*1e4:Zc(e,"polymarket.sportsMarketType")?Xc:0}function rs({source:e,usdcBalance:t,safetyBufferUsd:r=.01,feeRateBps:n=0,pricePerShare:o}){if(t==null||!Number.isFinite(t))return 0;let i=be(Math.max(0,t),2);if(e!=="polymarket")return i;let a=Wo(n,o??NaN),s=i/(1+a)-r;return be(Math.max(0,s),2)}function ns({usdcAmount:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=Wo(r,t);return e*n}function os({grossReturn:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=Wo(r,t);return e*n}function Vn(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,s=parseInt(o[2],10)/1e6,l=Math.max(0,a-s);return t("predict.trade.polymarket.insufficientBalance",{total:be(a,2).toFixed(2),active:be(s,2).toFixed(2),available:be(l,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=2){return parseFloat(be(e,t).toFixed(t)).toString()}function is(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};zo__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{zo__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{zo__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}var ss={en:{submitted:"Your trade was submitted successfully. Confirming the result.",completed:"Trade completed",delayed:"Your trade was submitted successfully. Confirmation is taking a little longer."},zh:{submitted:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u7ED3\u679C",completed:"\u4EA4\u6613\u5DF2\u5B8C\u6210",delayed:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u786E\u8BA4\u65F6\u95F4\u6BD4\u9884\u671F\u7A0D\u957F"}};function ed(e){return (e?.resolvedLanguage??e?.language??"").toLowerCase().startsWith("zh")}function Uo(e,t,r){let n=e(t);return n&&n!==t?n:r}function Ur(e,t){let r=ed(t)?ss.zh:ss.en;return {submitted:Uo(e,"predict.trade.resultSubmitted",r.submitted),completed:Uo(e,"predict.trade.resultCompleted",r.completed),delayed:Uo(e,"predict.trade.resultDelayed",r.delayed)}}function od({deadlineAt:e}){let[t,r]=react.useState(()=>Math.max(0,e-Date.now()));return react.useEffect(()=>{let n=setInterval(()=>{r(Math.max(0,e-Date.now()));},1e3);return ()=>clearInterval(n)},[e]),`${Math.max(0,Math.ceil(t/1e3))}s`}function $r({id:e=`predict-trade-result-${Date.now()}`,durationMs:t=3e4,celebrateOnCompleted:r=false,messages:n}){return {id:e,submitted:()=>{let o=Date.now()+t;ui$1.toast.progress({id:e,message:n.submitted,duration:t,progress:true,action:react.createElement(od,{deadlineAt:o})});},completed:()=>{ui$1.toast.update(e,{type:"success",message:n.completed,duration:5e3}),r&&is();},delayed:()=>{ui$1.toast.update(e,{type:"blank",message:n.delayed,duration:8e3});},failed:o=>{ui$1.toast.update(e,{type:"error",message:o,duration:8e3});}}}function cs({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:n}){let{t:o,i18n:i}=i18n.useTranslation(),{status:a}=walletConnector.useAuth(),s=walletConnector.useWallets(),l=reactPredict.usePredictClient(),u=react.useContext(reactPredict.PolymarketContext),{start:m}=reactPredict.useTradeResultConfirmation(),c=e.source,f=c==="polymarket",d=s.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected),p=s.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected&&"switchChain"in O),g=a==="authenticated",v=d?.address,h=p?.address,[x,S]=react.useState(t),[k,b]=react.useState("market"),[y,M]=react.useState(NaN),[R,P]=react.useState(NaN),[C,_]=react.useState(false),[U,Q]=react.useState(null),[H,Y]=react.useState(false),[q,te]=react.useState(false),[N,E]=react.useState("1h"),[B,J]=react.useState(30),[de,se]=react.useState("minutes"),Ve=react.useMemo(()=>Ur(o,i),[i,o]),je=true,Ge=react.useCallback(async(O,Te)=>{let ke=$r({celebrateOnCompleted:true,messages:Ve});ke.submitted(),await m({source:c,user:c==="kalshi"?v:h,kalshiUser:je?v:void 0,polymarketUser:h,marketSlug:e.slug,eventSlug:e.event_slug,expectation:O,getOrdersHeaders:Te})==="confirmed"?ke.completed():ke.delayed();},[m,je,h,e.event_slug,e.slug,c,Ve,v]),w=react.useMemo(()=>{if(c!=="polymarket")return;let O=e.provider_meta?.["polymarket.clobTokenIds"];return O?(typeof O=="string"?JSON.parse(O):O)[x==="yes"?0:1]:void 0},[c,e.provider_meta,x]),{data:dt,isLoading:qe}=reactPredict.useTickSize(w),Re=dt?.minimum_tick_size?String(dt.minimum_tick_size):"0.01",{data:Nt,isLoading:_e}=reactPredict.useFeeRate(w),Ye=Nt?.base_fee??0,ot=String(Ye),we=react.useMemo(()=>ts(e.provider_meta),[e.provider_meta]),{data:et}=reactPredict.useRebateConfig(),Ie=et?.builder_enabled&&et.builder_code?et.builder_code:void 0,it=null,Ot=false,Ct=null,Mt=false,tt,gt,We;try{let O=yr();je=O.enableKalshi,it={kalshiUsdcBalance:O.kalshiUsdcBalance,polymarketUsdcBalance:O.polymarketUsdcBalance,isLoading:O.isLoading},Ot=O.kalshiKycVerified,Ct=O.kalshiKycUrl,Mt=O.polymarketSetupVerified,tt=O.polymarketSafeAddress,gt=O.polymarketWalletKind,We=O.polymarketWalletAddress;}catch{}let Yt=c==="kalshi"&&!Ot,Oe=c==="polymarket"&&!Mt,{data:Qe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:c,outcome:x},{enabled:e.status==="open"}),me=react.useMemo(()=>{let O=reactPredict.pickBestAsk(Qe,x);if(O!=null&&O>0)return O;let Te=x==="yes"?0:1,ke=e.outcomes[Te];return ke?.best_ask??ke?.price??.5},[Qe,e.outcomes,x]),st=react.useCallback(O=>{b(O);},[]),ht=react.useCallback(O=>{S(O),P(NaN);},[]);react.useEffect(()=>{ht(t);},[t,ht]),react.useEffect(()=>{k==="limit"&&isNaN(R)&&P(Math.round(me*1e4)/1e4);},[k,R,me]);let ve=react.useMemo(()=>k==="limit"&&f&&!isNaN(R)?R:me,[k,f,R,me]),Xe=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve:0,[y,ve]),Ne=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Qe,outcome:x,side:"buy",sharesNeeded:Xe,slippageBps:r}),[Qe,x,Xe,r]),Tt=react.useMemo(()=>Ne.status==="ok"&&Ne.worstPrice!=null&&Ne.worstPrice>0?Ne.worstPrice:me,[Ne,me]),I=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),Ce=e.provider_meta?.["dflow.yesMint"]??"",Ue=e.provider_meta?.["dflow.noMint"]??"",en=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,A=x==="yes"?Ce:Ue,Me=en,vt=A,Dt=c==="kalshi"?v??"":h??"",{data:tn,isLoading:Mo}=reactPredict.usePositionsMulti({kalshi_user:c==="kalshi"?Dt:void 0,polymarket_user:c==="polymarket"?Dt:void 0},{enabled:!!Dt}),To=c==="kalshi"&&!!Me&&!!vt&&!!v&&I!=="0",{refetch:Qt}=reactPredict.useDFlowQuote({inputMint:Me,outputMint:vt,amount:I,userPublicKey:v??"",slippageBps:100},{enabled:To}),Rr=react.useMemo(()=>it?c==="kalshi"?it.kalshiUsdcBalance:it.polymarketUsdcBalance:tn&&tn.positions.reduce((Te,ke)=>ke.side==="USDC"||ke.side==="collateral"?Te+(ke.current_value??0):Te,0)||null,[it,tn,c]),Eo=it?it.isLoading:Mo,at=react.useMemo(()=>rs({source:c,usdcBalance:Rr,feeRateBps:we,pricePerShare:ve}),[c,Rr,we,ve]),Et=Rr==null?null:at,_r=react.useMemo(()=>isNaN(y)||y<=0?0:y,[y]),rn=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve*1:0,[y,ve]),Ir=react.useMemo(()=>c!=="polymarket"||isNaN(y)||y<=0?0:ns({usdcAmount:y,pricePerShare:ve,feeRateBps:we}),[c,y,ve,we]),ar=rn-_r-Ir,Lo=react.useCallback(O=>{if(isNaN(O)){M(NaN);return}M(Math.round(Math.max(0,O)*100)/100);},[]),Ln=react.useCallback(O=>{if(isNaN(O)){P(NaN);return}P(Math.round(O*1e4)/1e4);},[]),Or=react.useCallback(()=>{M(NaN),P(NaN),b("market"),te(false),E("1h"),J(30),se("minutes");},[]),Xt=react.useMemo(()=>{let O=[];return isNaN(y)||y<=0?O.push(o("predict.trade.minAmountUsd",{amount:Un})):y<Un&&O.push(o("predict.trade.minAmountUsd",{amount:Un})),e.status!=="open"&&O.push(o("predict.trade.marketNotActive")),Et!=null&&!isNaN(y)&&y>0&&y>Et&&O.push(o("predict.trade.insufficientBalance")),k==="limit"&&f&&(isNaN(R)||R<.01||R>.99)&&O.push(o("predict.trade.limitPriceRange")),k==="limit"&&f&&q&&N==="custom"&&(isNaN(B)||B<=0)&&O.push(o("predict.trade.expiration.invalidDate")),c==="polymarket"&&k==="market"&&!isNaN(y)&&y>0&&Xe>0&&(Ne.status==="insufficient_liquidity"?O.push(o("predict.trade.insufficientLiquidity",{available:be(Ne.totalAvailable,2)})):Ne.status==="exceeds_slippage"&&O.push(o("predict.trade.priceImpactTooHigh",{impact:(Ne.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:O.length===0,errors:O}},[y,e.status,Et,k,f,R,q,N,B,c,Xe,Ne,r,o]),fr=react.useMemo(()=>Et==null||isNaN(y)||y<=0?false:y>Et,[Et,y]),gr=react.useCallback(()=>{n?.(c);},[n,c]),{mutateAsync:hr}=reactPredict.useDFlowSubmit(),{data:nn}=reactPredict.useOrder({id:U??"",source:c},{enabled:!!U});react.useEffect(()=>{if(!nn||!U)return;let{status:O}=nn;O==="closed"?(Q(null),_(false),Ge("buy-market"),Or()):(O==="failed"||O==="expired")&&(_(false),Q(null),ui$1.toast.error(o("predict.trade.submitError")));},[Ge,nn,U,Or,o]);let on=react.useCallback(async()=>{if(!v||!d)return;if(!Me||!vt){ui$1.toast.error("Missing token mint addresses"),_(false);return}if(!Ot){Y(true),_(false);return}let Rt=(await Qt()).data?.transaction;if(!Rt){ui$1.toast.error(o("predict.trade.submitError")),_(false);return}let sn=Uint8Array.from(atob(Rt),lt=>lt.charCodeAt(0)),Jt=await d.signTransaction(sn),Zt=await hr({signedTransaction:btoa(String.fromCharCode(...Jt)),orderContext:{user_public_key:v,input_mint:Me,output_mint:vt,amount:I,price:String(me),side:"BUY",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});Q(Zt.signature);},[v,d,Qt,hr,Me,vt,I,me,x,e.slug,o,Ot]),Dr=react.useCallback(async()=>{if(!p||!u)return;let O=p.chain,Te=O!==types.Chain.POLYGON;Te&&await p.switchChain(types.Chain.POLYGON);try{let ke=await p.getEip1193Provider();if(!ke){ui$1.toast.error(o("predict.trade.submitError")),_(!1);return}let Rt=gt==="deposit"&&!!We,sn=!Rt&&!!tt,Jt=Rt?We:tt,Zt={address:p.address,signatureType:Rt?3:sn?2:0,signTypedData:async(_t,T,Se,Pe)=>{let De=[];"name"in _t&&De.push({name:"name",type:"string"}),"version"in _t&&De.push({name:"version",type:"string"}),"chainId"in _t&&De.push({name:"chainId",type:"uint256"}),"verifyingContract"in _t&&De.push({name:"verifyingContract",type:"address"}),"salt"in _t&&De.push({name:"salt",type:"bytes32"});let ut={EIP712Domain:De,...T};return await ke.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:_t,types:ut,primaryType:Se,message:Pe})]})}},lt=u.credentials??await u.authenticate(Zt),Ro=x==="yes"?0:1,Rn="",Ht=e.provider_meta?.["polymarket.clobTokenIds"];Ht&&(Rn=(typeof Ht=="string"?JSON.parse(Ht):Ht)[Ro]??"");let Ar=e.provider_meta?.["polymarket.negRisk"]??!1,Fr=k==="limit"&&!isNaN(R)?R:Tt,vr=Kn(Fr,Re),_n=k==="limit"?q?"GTD":"GTC":"FOK",br=k==="market"?y:vr>0?y/vr:0,Br={tokenId:Rn,price:vr,size:br,side:"BUY",orderType:_n,tickSize:Re,negRisk:Ar,...Jt&&{funderAddress:Jt},...Ie&&{builderCode:Ie},...k==="limit"&&q&&{expiration:$n(N,B,de)}},Hr;if(Rt)Hr=await reactPredict.buildSignedV2OrderPayload({signer:Zt,depositWalletAddress:Jt,input:Br,owner:lt.apiKey});else {let _t=reactPredict.buildCtfExchangeDomain(Ar),T=reactPredict.buildOrderMessage({...Br,signerAddress:Zt.address,signatureType:Zt.signatureType,feeRateBps:ot}),Se=await Zt.signTypedData(_t,reactPredict.CTF_ORDER_TYPES,"Order",T),Pe=reactPredict.buildSignedOrder(T,Se,Br.orderType);Hr=reactPredict.buildClobPayload(Pe,lt.apiKey);}await l.executePolymarketOrder({payload:Hr,l2_api_key:lt.apiKey,l2_secret:lt.secret,l2_passphrase:lt.passphrase,signer_address:lt.address,owner:lt.apiKey}),Ge(k==="limit"?"buy-limit":"buy-market",async()=>await reactPredict.buildPolymarketL2Headers(lt.address,{apiKey:lt.apiKey,secret:lt.secret,passphrase:lt.passphrase,method:"GET",requestPath:"/data/orders"})),Or(),_(!1);}finally{Te&&O&&p.switchChain(O).catch(()=>{});}},[p,u,x,e.provider_meta,k,Ge,R,Tt,y,l,q,N,B,de,Or,o,Re,ot,tt,gt,We,Ie]),Lt=react.useCallback(async()=>{if(!(!Xt.isValid||!g)){_(true),Q(null),Y(false);try{c==="kalshi"?await on():await Dr();}catch(O){let Te=O instanceof Error?O.message:"",ke=c==="polymarket"&&Te?Vn(Te,o,"buy"):Te||void 0;ui$1.toast.error(ke||o("predict.trade.submitError")),_(false);}}},[Xt.isValid,g,c,on,Dr,o]);return {outcome:x,orderType:k,quantity:y,limitPrice:R,shares:Xe,effectivePrice:ve,estimatedCost:_r,estimatedFee:Ir,potentialPayout:rn,potentialProfit:ar,pricePerShare:me,usdcBalance:Rr,maxBuyAmount:at,spendableUsdcBalance:Et,isBalanceLoading:Eo,isMarketDataLoading:c==="polymarket"&&(_e||qe),isSubmitting:C,authStatus:a,validation:Xt,isInsufficientBalance:fr,source:c,supportsLimitOrder:f,kycRequired:H,needsKyc:Yt,needsSetup:Oe,kycUrl:Ct,expirationEnabled:q,expirationPreset:N,customDuration:B,customDurationUnit:de,setOutcome:ht,setOrderType:st,setQuantity:Lo,setLimitPrice:Ln,setExpirationEnabled:te,setExpirationPreset:E,setCustomDuration:J,setCustomDurationUnit:se,submit:Lt,notifyInsufficientBalance:gr}}function Gn({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui$1.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$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.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 Ud=["5m","1h","12h","24h","eod","custom"],$d={"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"},Kd=["minutes","hours","days"],Vd={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},jd={maximumFractionDigits:0},cr="-";function vs({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,shares:s,effectivePrice:l,potentialProfit:u,potentialPayout:m,estimatedCost:c,estimatedFee:f=0,usdcBalance:d,isBalanceLoading:p,isMarketDataLoading:g,isSubmitting:v,authStatus:h,isValid:x,validationErrors:S,isInsufficientBalance:k,onInsufficientBalance:b,supportsLimitOrder:y,maxBuyAmount:M,kycRequired:R,needsKyc:P,needsSetup:C,kycUrl:_,expirationEnabled:U,expirationPreset:Q,customDuration:H,customDurationUnit:Y,oddsFormatter:q,outcomeLabels:te,onOutcomeChange:N,onOrderTypeChange:E,onQuantityChange:B,onLimitPriceChange:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[dt,qe]=react.useState(true),Re=ui$1.useDisclosure(),[Nt,_e]=react.useState(""),Ye=react.useRef(false);react.useEffect(()=>{Ye.current||_e(isNaN(i)?"":String(i));},[i]);let[ot,we]=react.useState(""),et=react.useRef(false);react.useEffect(()=>{et.current||(isNaN(a)?we(""):we(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ie=react.useCallback(A=>{if(A!==""&&!/^\d*\.?\d{0,2}$/.test(A))return;if(we(A),A===""||A==="."){J(NaN);return}let vt=parseFloat(A);isNaN(vt)||J(vt/100);},[J]),it=react.useCallback(A=>{if(A!==""&&!/^\d*\.?\d{0,2}$/.test(A))return;if(_e(A),Ue(false),A===""||A==="."){B(NaN);return}let vt=parseFloat(A);isNaN(vt)||B(vt);},[B]);react.useEffect(()=>{R&&!Re.isOpen&&Re.onOpen();},[R]);let Ot=react.useMemo(()=>{let A=n==="yes"?t.yesAsk:t.noAsk;return A!=null?parseFloat((Number(A)*100).toFixed(2)):null},[n,t]),Ct=n==="yes"?t.yesAsk:t.noAsk,Mt=Ct!=null&&q?q(Number(Ct)):Ot!=null?`${Ot} \xA2`:cr,tt=Number.isFinite(l)?parseFloat((l*100).toFixed(2)):null,gt=Number.isFinite(l)&&q?q(l):tt!=null?`${tt} \xA2`:cr,We=!isNaN(i)&&i>0,Yt=We?c+f:0,Oe=We&&s>0?Yt/s:0,Qe=Oe>0&&q?q(Oe):Oe>0?`${parseFloat((Oe*100).toFixed(2))}\xA2`:cr,me=h==="authenticated",st=h==="authenticating"||h==="deauthenticating",ht=me&&(P||C),ve=react.useCallback(A=>te?.[A]??w(A==="yes"?"predict.trade.yes":"predict.trade.no"),[te,w]),Xe=react.useMemo(()=>{if(st)return w("predict.trade.checkingLogin");if(!me)return w("predict.trade.loginToTrade");if(P)return w("predict.trade.kycRequired");if(C)return w("predict.trade.setupRequired");if(p)return w("predict.trade.loadingBalance");if(g)return w("predict.trade.loadingMarketData");if(v)return w("predict.trade.submitting");if(R)return w("predict.trade.kycRequired");if(!We)return w("predict.trade.enterAmount");let A=ve(n),Me=u>0?` \u2192 Win $${u.toFixed(2)}`:"";return `${w("predict.trade.buy")} ${A}${Me}`},[st,me,P,C,p,g,v,R,We,n,ve,u,w]),Ne="primary",Tt=()=>{let A=M??be(d??0,2);B(be(A/2,2));},I=()=>{B(M??be(d??0,2));},[Ce,Ue]=react.useState(false),en=()=>{if(!me){Ue(false),Ge();return}if(P){Re.onOpen();return}if(C&&b){Ue(false),b();return}if(R){Re.onOpen();return}if(k&&b){Ue(false),b();return}if(!x){Ue(true);return}Ue(false),Ge();};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-bullish",children:[w("predict.trade.buy")," ",ve(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[y?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:A=>E(A),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&y?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:ot,onChange:A=>Ie(A.target.value),onFocus:()=>{et.current=true;},onBlur:()=>{et.current=false,isNaN(a)?we(""):we(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"}}):Mt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:Mt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(A=>{let Me=A==="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:()=>N(A),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===A?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:ve(A)}),Me!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:q?q(Number(Me)):`${parseFloat((Number(Me)*100).toFixed(2))}\xA2`})]})},A)})}),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:w("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:Tt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:I,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Nt,onChange:A=>it(A.target.value),onFocus:()=>{Ye.current=true;},onBlur:()=>{Ye.current=false,_e(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"}}),Ce&&S.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:S.map(A=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:A},A))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:w("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`$${be(d,2).toFixed(2)}`:"$0"})]}),o==="limit"&&y&&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:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:U,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[Q],onSelectionChange:A=>{let Me=Array.from(A)[0];Me&&se(Me);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ud.map(A=>jsxRuntime.jsx(ui$1.SelectItem,{children:w($d[A])},A))}),Q==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(H)?void 0:H,onValueChange:Ve,minValue:1,step:1,formatOptions:jd,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[Y],onSelectionChange:A=>{let Me=Array.from(A)[0];Me&&je(Me);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Kd.map(A=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(Vd[A])},A))})]})]})]}),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:()=>qe(A=>!A),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",dt&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:q&&Number.isFinite(l)?gt:tt!=null?w("predict.trade.chance",{percent:tt}):cr})]}),dt&&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:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:cr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?kr(s):cr})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${f.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalPayment")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${Yt.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Qe})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:cr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&u>0?`+$${u.toFixed(2)}`:cr})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:Ne,fullWidth:true,radius:"lg",size:"lg",isDisabled:st||me&&!ht&&(p||g||!We||v),isLoading:st||me&&!ht&&(v||p||g),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:en,children:Xe})]}),jsxRuntime.jsx(Gn,{isOpen:Re.isOpen,onClose:Re.onClose,kycUrl:_})]})}function Yn({event:e,market:t,variant:r,initialOutcome:n,chain:o,slippageBps:i,onInsufficientBalance:a,onOutcomeChange:s,oddsFormatter:l,outcomeLabels:u}){let{outcome:m,orderType:c,quantity:f,limitPrice:d,shares:p,effectivePrice:g,estimatedCost:v,estimatedFee:h,potentialPayout:x,potentialProfit:S,pricePerShare:k,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:R,isSubmitting:P,authStatus:C,validation:_,isInsufficientBalance:U,supportsLimitOrder:Q,kycRequired:H,needsKyc:Y,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:B,customDurationUnit:J,setOutcome:de,setOrderType:se,setQuantity:Ve,setLimitPrice:je,setExpirationEnabled:Ge,setExpirationPreset:w,setCustomDuration:dt,setCustomDurationUnit:qe,submit:Re,notifyInsufficientBalance:Nt}=cs({market:t,initialOutcome:n,slippageBps:i,onInsufficientBalance:a}),_e=walletConnector.useAuthCallback(Re),Ye=react.useCallback(et=>{de(et),s?.(et);},[de,s]),ot=react.useMemo(()=>e?Fn(e):void 0,[e]),we=react.useMemo(()=>Bn(t,{yesAsk:m==="yes"?k:void 0,noAsk:m==="no"?k:void 0}),[t,m,k]);return jsxRuntime.jsx(vs,{event:ot,market:we,variant:r,outcome:m,orderType:c,quantity:f,limitPrice:d,shares:p,effectivePrice:g,estimatedCost:v,estimatedFee:h,potentialPayout:x,potentialProfit:S,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:R,isSubmitting:P,authStatus:C,isValid:_.isValid,validationErrors:_.errors,isInsufficientBalance:U,onInsufficientBalance:a?Nt:void 0,supportsLimitOrder:Q,kycRequired:H,needsKyc:Y,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:B,customDurationUnit:J,oddsFormatter:l,outcomeLabels:u,onOutcomeChange:Ye,onOrderTypeChange:se,onQuantityChange:Ve,onLimitPriceChange:je,onExpirationEnabledChange:Ge,onExpirationPresetChange:w,onCustomDurationChange:dt,onCustomDurationUnitChange:qe,onSubmit:_e})}var cn="predict-trade";function Qn({id:e=cn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(tu,{...t})})}function tu({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(Yn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),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 dn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function jo(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function xs({isOpen:e,onClose:t,value:r,onChange:n,enableKalshi:o=true}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(r),l=react.useMemo(()=>o?dn:{...dn,source:"polymarket"},[o]),u=react.useCallback(x=>{x?s(r):t();},[r,t]),m=react.useCallback(()=>{s(l);},[l]),c=react.useCallback(()=>{n(a),t();},[a,n,t]),f=react.useCallback((x,S)=>{s(k=>({...k,[x]:S}));},[]),d=react.useMemo(()=>jo(a,o),[a,o]),p=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),g=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),h=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:u,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(au,{onClick:()=>u(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[o&&jsxRuntime.jsx(Jn,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(Zn,{options:p,selected:a.source,onSelect:x=>f("source",x)})}),jsxRuntime.jsx(Jn,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Zn,{options:g,selected:a.timeRemaining,onSelect:x=>f("timeRemaining",x)})}),jsxRuntime.jsx(Jn,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(Zn,{options:v,selected:a.minVolume,onSelect:x=>f("minVolume",x)})}),jsxRuntime.jsx(Jn,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Zn,{options:h,selected:a.minLiquidity,onSelect:x=>f("minLiquidity",x)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:m,children:i("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:[i("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function Jn({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 au({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 Zn({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 ws={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},ks={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},hu=["start_time","volume","liquidity","ending_soon"],Ss={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},vu={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 Ns({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:a}){let{t:s}=i18n.useTranslation(),[l,u]=react.useState(false),m=react.useRef(null),c=react.useCallback(d=>{m.current&&!m.current.contains(d.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c]),react.useEffect(()=>{if(!l)return;let d=p=>{p.key==="Escape"&&u(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let f=Ps[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:Ss,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>u(d=>!d),children:[jsxRuntime.jsx(bu,{}),jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(ks[e])}),jsxRuntime.jsx(yu,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...vu,width:224,padding:4},children:hu.map(d=>{let p=Ps[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:v=>{g||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{g||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),u(false);},children:[jsxRuntime.jsx(p,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:s(ks[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:Ss,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(xu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s("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 Ps={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function bu(){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 xu(){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 yu({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 Ts(e={}){let{i18n:t}=i18n.useTranslation(),r=e.lang??t.resolvedLanguage??t.language,n=react.useMemo(()=>reactPredict.resolveEventsParams({...e,lang:r}),[r,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,e.lang]),{data:o,isLoading:i,isFetching:a,isFetchingNextPage:s,isError:l,error:u,hasNextPage:m,fetchNextPage:c,refetch:f}=reactPredict.useInfiniteEvents(n),d=react.useMemo(()=>o?.pages.flatMap(v=>v.items).filter(v=>v!=null)??[],[o]),p=react.useCallback(()=>{c();},[c]),g=react.useCallback(()=>{f();},[f]);return {data:d,isLoading:i,isFetching:a&&!s,isFetchingMore:s,isError:l,error:u??null,hasMore:m??false,fetchMore:p,refetch:g}}var Es=`
|
|
1
|
+
'use strict';var react=require('react'),ui$1=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),Ho=require('canvas-confetti'),reactQuery=require('@tanstack/react-query'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ho__default=/*#__PURE__*/_interopDefault(Ho);var Lc={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},Ki=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Do=(()=>{let e=t=>{let r=Ki.indexOf(t);return r===-1?Ki.length:r};return Object.entries(Lc).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 Gi({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:a,pulsingTab:s="Trending",className:c}){let{t:u}=i18n.useTranslation(),m=react.useCallback(()=>{o(null);},[o]),l=u("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui$1.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",c),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(Vi,{label:l,isSelected:t===null,onPress:m,showPulse:l===s}),jsxRuntime.jsx(Oc,{}),e.map(f=>{let d=f.slug??f.category,p=f.label??f.category;return jsxRuntime.jsx(Vi,{label:p,isSelected:t===d,onPress:()=>o(d),badge:f.badge,showPulse:d===s||p===s},d)})]})}),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(ji,{label:u("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(f=>{let d=f.slug??f.label;return jsxRuntime.jsx(ji,{label:f.label,icon:f.icon,isSelected:r===d,onPress:()=>i(d)},d)})]})})]})}function Vi({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[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 Oc(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function ji({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Gv({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function Yi(e){return e.trim().toLowerCase().replace(/&/g,"and").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Ac(e){return `predict.categories.category.${Yi(e)}`}function Qi(e){return `predict.categories.tag.${Yi(e)}`}function Fc(e,t){return e.map(r=>({category:r.slug,slug:r.slug,label:t(Ac(r.slug),r.label),tags:r.tags.map(n=>({slug:n.slug,label:t(Qi(n.slug),n.label),icon:n.icon}))}))}function Bc(e,t){return e?e.tags.map(r=>({slug:r.slug,label:t(Qi(r.slug),r.label),icon:r.icon})):[]}function Xi({onSelect:e,trailing:t,className:r}){let{t:n}=i18n.useTranslation(),o=react.useCallback((p,g)=>{let h=n(p);return typeof h=="string"&&h!==p?h:g},[n]),[i,a]=react.useState(null),[s,c]=react.useState(null),u=react.useCallback(p=>{a(p),c(null),e?.({categorySlug:p,tagSlug:null});},[e]),m=react.useCallback(p=>{c(p),e?.({categorySlug:i,tagSlug:p});},[i,e]),l=Fc(Do,o),f=Do.find(p=>p.slug===i),d=Bc(f,o);return jsxRuntime.jsx(Gi,{categories:l,selectedCategory:i,selectedTag:s,activeTags:d,onCategorySelect:u,onTagSelect:m,trailing:t,className:r})}function Dn(e){return {title:e.title,imageUrl:e.image_url}}function An(e,t){let r=e.outcomes[0],n=e.outcomes[1];return {question:e.question,yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??n?.best_ask??n?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??n?.best_bid,yesSubTitle:r?.label??"Yes",noSubTitle:n?.label??"No"}}var on=24,Fo=4,Fn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},le={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},Bn=le.ALL,nb={[le.ONE_DAY]:Fn.ONE_MINUTE,[le.ONE_WEEK]:Fn.ONE_HOUR,[le.ONE_MONTH]:Fn.ONE_HOUR,[le.ALL]:Fn.ONE_DAY},ob={[le.ONE_DAY]:300,[le.ONE_WEEK]:3600,[le.ONE_MONTH]:10800,[le.ALL]:1440*60},ib={[le.ONE_DAY]:1440*60,[le.ONE_WEEK]:10080*60,[le.ONE_MONTH]:720*60*60,[le.ALL]:null},Hn=1,zn=1,sb=1,ab=1,lb=99,zr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},cb=zr.ONE_WEEK,db={[zr.ONE_HOUR]:60,[zr.SIX_HOURS]:60,[zr.ONE_DAY]:300,[zr.ONE_WEEK]:1800,[zr.MAX]:1800};var es=react.createContext(null);function yr(){let e=react.useContext(es);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Vc=1e4;function jc({pollingInterval:e=Vc,enabled:t=true,enableKalshi:r=true,children:n}){let o=walletConnector.useWallets(),i=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.SOLANA&&C.isConnected)?.address,[o]),a=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.EVM&&C.isConnected)?.address,[o]),{data:s,isLoading:c,isFetching:u,error:m}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:l,isLoading:f}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:d,isLoading:p}=reactPredict.usePolymarketSetup(a,{enabled:t&&!!a,refetchInterval:3e4}),g=d?.safe_address,v=d?.verified??false,h=d?.wallet_kind??"deposit",x=d?.deposit_wallet_address,S=h==="safe"?d?.safe_address:x,k=h==="safe"?d?.safe_deployed??false:d?.deposit_wallet_deployed??false,{data:b,isLoading:y,isFetching:M,error:R}=reactPredict.useBalance({source:"polymarket",user:a??""},{enabled:t&&v&&!!a,refetchInterval:e}),P=react.useMemo(()=>({enableKalshi:r,solanaAddress:i,evmAddress:a,polymarketWalletKind:h,polymarketWalletAddress:S,polymarketDepositWalletAddress:x,polymarketWalletDeployed:k,polymarketSafeAddress:g,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:v&&b?Number(b.balance):null,kalshiKycVerified:l?.verified??false,kalshiKycUrl:l?.kyc_url??null,kalshiKycLoading:f,polymarketSetupVerified:v,polymarketSafeDeployed:d?.safe_deployed??false,polymarketTokenApproved:d?.token_approved??false,polymarketSetupLoading:p,isLoading:c||y,isFetching:u||M,error:m??R??null}),[r,i,a,h,S,x,k,g,s,b,v,l,f,d,p,c,y,u,M,m,R]);return jsxRuntime.jsx(es.Provider,{value:P,children:n})}var qc={minutes:60,hours:3600,days:86400};function Wn(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*qc[r]}}function Un(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function be(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function Yc(e){let t=e;return !Number.isFinite(t)||t<=0||t>=1?1:1-t}var Qc=100,Xc=300;function zo(e,t){return Qc/1e4+Math.max(0,e)/1e4*Yc(t)}function Jc(e,t){let r=e?.[t],n=typeof r=="number"?r:Number(r);return Number.isFinite(n)?n:void 0}function Zc(e,t){let r=e?.[t];return typeof r=="string"?r:void 0}function ts(e){let t=Jc(e,"polymarket.effectiveTakerFeeBps");if(t!==void 0&&t>=0)return t;let r=e?.["polymarket.feeDescriptor"],n=typeof r?.r=="number"?r.r:Number(r?.r);return Number.isFinite(n)&&n>=0?n*1e4:Zc(e,"polymarket.sportsMarketType")?Xc:0}function rs({source:e,usdcBalance:t,safetyBufferUsd:r=.01,feeRateBps:n=0,pricePerShare:o}){if(t==null||!Number.isFinite(t))return 0;let i=be(Math.max(0,t),2);if(e!=="polymarket")return i;let a=zo(n,o??NaN),s=i/(1+a)-r;return be(Math.max(0,s),2)}function ns({usdcAmount:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=zo(r,t);return e*n}function os({grossReturn:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=zo(r,t);return e*n}function $n(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,s=parseInt(o[2],10)/1e6,c=Math.max(0,a-s);return t("predict.trade.polymarket.insufficientBalance",{total:be(a,2).toFixed(2),active:be(s,2).toFixed(2),available:be(c,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=2){return parseFloat(be(e,t).toFixed(t)).toString()}function is(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Ho__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Ho__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Ho__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}var ss={en:{submitted:"Your trade was submitted successfully. Confirming the result.",completed:"Trade completed",delayed:"Your trade was submitted successfully. Confirmation is taking a little longer."},zh:{submitted:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u7ED3\u679C",completed:"\u4EA4\u6613\u5DF2\u5B8C\u6210",delayed:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u786E\u8BA4\u65F6\u95F4\u6BD4\u9884\u671F\u7A0D\u957F"}};function ed(e){return (e?.resolvedLanguage??e?.language??"").toLowerCase().startsWith("zh")}function Wo(e,t,r){let n=e(t);return n&&n!==t?n:r}function Wr(e,t){let r=ed(t)?ss.zh:ss.en;return {submitted:Wo(e,"predict.trade.resultSubmitted",r.submitted),completed:Wo(e,"predict.trade.resultCompleted",r.completed),delayed:Wo(e,"predict.trade.resultDelayed",r.delayed)}}function od({deadlineAt:e}){let[t,r]=react.useState(()=>Math.max(0,e-Date.now()));return react.useEffect(()=>{let n=setInterval(()=>{r(Math.max(0,e-Date.now()));},1e3);return ()=>clearInterval(n)},[e]),`${Math.max(0,Math.ceil(t/1e3))}s`}function Ur({id:e=`predict-trade-result-${Date.now()}`,durationMs:t=3e4,celebrateOnCompleted:r=false,messages:n}){return {id:e,submitted:()=>{let o=Date.now()+t;ui$1.toast.progress({id:e,message:n.submitted,duration:t,progress:true,action:react.createElement(od,{deadlineAt:o})});},completed:()=>{ui$1.toast.update(e,{type:"success",message:n.completed,duration:5e3}),r&&is();},delayed:()=>{ui$1.toast.update(e,{type:"blank",message:n.delayed,duration:8e3});},failed:o=>{ui$1.toast.update(e,{type:"error",message:o,duration:8e3});}}}function cs({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:n}){let{t:o,i18n:i}=i18n.useTranslation(),{status:a}=walletConnector.useAuth(),s=walletConnector.useWallets(),c=reactPredict.usePredictClient(),u=react.useContext(reactPredict.PolymarketContext),{start:m}=reactPredict.useTradeResultConfirmation(),l=e.source,f=l==="polymarket",d=s.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected),p=s.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected&&"switchChain"in O),g=a==="authenticated",v=d?.address,h=p?.address,[x,S]=react.useState(t),[k,b]=react.useState("market"),[y,M]=react.useState(NaN),[R,P]=react.useState(NaN),[C,_]=react.useState(false),[U,Q]=react.useState(null),[H,Y]=react.useState(false),[q,te]=react.useState(false),[N,E]=react.useState("1h"),[B,J]=react.useState(30),[de,se]=react.useState("minutes"),Ve=react.useMemo(()=>Wr(o,i),[i,o]),je=true,Ge=react.useCallback(async(O,Me)=>{let ke=Ur({celebrateOnCompleted:true,messages:Ve});ke.submitted(),await m({source:l,user:l==="kalshi"?v:h,kalshiUser:je?v:void 0,polymarketUser:h,marketSlug:e.slug,eventSlug:e.event_slug,expectation:O,getOrdersHeaders:Me})==="confirmed"?ke.completed():ke.delayed();},[m,je,h,e.event_slug,e.slug,l,Ve,v]),w=react.useMemo(()=>{if(l!=="polymarket")return;let O=e.provider_meta?.["polymarket.clobTokenIds"];return O?(typeof O=="string"?JSON.parse(O):O)[x==="yes"?0:1]:void 0},[l,e.provider_meta,x]),{data:ft,isLoading:qe}=reactPredict.useTickSize(w),Le=reactPredict.normalizePolymarketTickSize(ft?.minimum_tick_size),{data:Nt,isLoading:Re}=reactPredict.useFeeRate(w),Ye=Nt?.base_fee??0,ot=String(Ye),_e=react.useMemo(()=>ts(e.provider_meta),[e.provider_meta]),{data:et}=reactPredict.useRebateConfig(),Ie=et?.builder_enabled&&et.builder_code?et.builder_code:void 0,it=null,Ot=false,Ct=null,Mt=false,tt,gt,We;try{let O=yr();je=O.enableKalshi,it={kalshiUsdcBalance:O.kalshiUsdcBalance,polymarketUsdcBalance:O.polymarketUsdcBalance,isLoading:O.isLoading},Ot=O.kalshiKycVerified,Ct=O.kalshiKycUrl,Mt=O.polymarketSetupVerified,tt=O.polymarketSafeAddress,gt=O.polymarketWalletKind,We=O.polymarketWalletAddress;}catch{}let qt=l==="kalshi"&&!Ot,Oe=l==="polymarket"&&!Mt,{data:Qe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:l,outcome:x},{enabled:e.status==="open"}),me=react.useMemo(()=>{let O=reactPredict.pickBestAsk(Qe,x);if(O!=null&&O>0)return O;let Me=x==="yes"?0:1,ke=e.outcomes[Me];return ke?.best_ask??ke?.price??.5},[Qe,e.outcomes,x]),st=react.useCallback(O=>{b(O);},[]),ht=react.useCallback(O=>{S(O),P(NaN);},[]);react.useEffect(()=>{ht(t);},[t,ht]),react.useEffect(()=>{k==="limit"&&isNaN(R)&&P(Math.round(me*1e4)/1e4);},[k,R,me]);let ve=react.useMemo(()=>k==="limit"&&f&&!isNaN(R)?R:me,[k,f,R,me]),Xe=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve:0,[y,ve]),we=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Qe,outcome:x,side:"buy",sharesNeeded:Xe,slippageBps:r}),[Qe,x,Xe,r]),Tt=react.useMemo(()=>we.status==="ok"&&we.worstPrice!=null&&we.worstPrice>0?we.worstPrice:me,[we,me]),I=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),Ne=e.provider_meta?.["dflow.yesMint"]??"",Ue=e.provider_meta?.["dflow.noMint"]??"",Jr=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,A=x==="yes"?Ne:Ue,Ce=Jr,vt=A,Dt=l==="kalshi"?v??"":h??"",{data:Zr,isLoading:Co}=reactPredict.usePositionsMulti({kalshi_user:l==="kalshi"?Dt:void 0,polymarket_user:l==="polymarket"?Dt:void 0},{enabled:!!Dt}),Mo=l==="kalshi"&&!!Ce&&!!vt&&!!v&&I!=="0",{refetch:Yt}=reactPredict.useDFlowQuote({inputMint:Ce,outputMint:vt,amount:I,userPublicKey:v??"",slippageBps:100},{enabled:Mo}),Lr=react.useMemo(()=>it?l==="kalshi"?it.kalshiUsdcBalance:it.polymarketUsdcBalance:Zr&&Zr.positions.reduce((Me,ke)=>ke.side==="USDC"||ke.side==="collateral"?Me+(ke.current_value??0):Me,0)||null,[it,Zr,l]),To=it?it.isLoading:Co,at=react.useMemo(()=>rs({source:l,usdcBalance:Lr,feeRateBps:_e,pricePerShare:ve}),[l,Lr,_e,ve]),Et=Lr==null?null:at,Rr=react.useMemo(()=>isNaN(y)||y<=0?0:y,[y]),en=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve*1:0,[y,ve]),_r=react.useMemo(()=>l!=="polymarket"||isNaN(y)||y<=0?0:ns({usdcAmount:y,pricePerShare:ve,feeRateBps:_e}),[l,y,ve,_e]),sr=en-Rr-_r,Eo=react.useCallback(O=>{if(isNaN(O)){M(NaN);return}M(Math.round(Math.max(0,O)*100)/100);},[]),Tn=react.useCallback(O=>{if(isNaN(O)){P(NaN);return}P(Math.round(O*1e4)/1e4);},[]),Ir=react.useCallback(()=>{M(NaN),P(NaN),b("market"),te(false),E("1h"),J(30),se("minutes");},[]),Qt=react.useMemo(()=>{let O=[];return isNaN(y)||y<=0?O.push(o("predict.trade.minAmountUsd",{amount:zn})):y<zn&&O.push(o("predict.trade.minAmountUsd",{amount:zn})),e.status!=="open"&&O.push(o("predict.trade.marketNotActive")),Et!=null&&!isNaN(y)&&y>0&&y>Et&&O.push(o("predict.trade.insufficientBalance")),k==="limit"&&f&&(isNaN(R)||R<.01||R>.99)&&O.push(o("predict.trade.limitPriceRange")),k==="limit"&&f&&q&&N==="custom"&&(isNaN(B)||B<=0)&&O.push(o("predict.trade.expiration.invalidDate")),l==="polymarket"&&k==="market"&&!isNaN(y)&&y>0&&Xe>0&&(we.status==="insufficient_liquidity"?O.push(o("predict.trade.insufficientLiquidity",{available:be(we.totalAvailable,2)})):we.status==="exceeds_slippage"&&O.push(o("predict.trade.priceImpactTooHigh",{impact:(we.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:O.length===0,errors:O}},[y,e.status,Et,k,f,R,q,N,B,l,Xe,we,r,o]),fr=react.useMemo(()=>Et==null||isNaN(y)||y<=0?false:y>Et,[Et,y]),gr=react.useCallback(()=>{n?.(l);},[n,l]),{mutateAsync:hr}=reactPredict.useDFlowSubmit(),{data:tn}=reactPredict.useOrder({id:U??"",source:l},{enabled:!!U});react.useEffect(()=>{if(!tn||!U)return;let{status:O}=tn;O==="closed"?(Q(null),_(false),Ge("buy-market"),Ir()):(O==="failed"||O==="expired")&&(_(false),Q(null),ui$1.toast.error(o("predict.trade.submitError")));},[Ge,tn,U,Ir,o]);let rn=react.useCallback(async()=>{if(!v||!d)return;if(!Ce||!vt){ui$1.toast.error("Missing token mint addresses"),_(false);return}if(!Ot){Y(true),_(false);return}let Rt=(await Yt()).data?.transaction;if(!Rt){ui$1.toast.error(o("predict.trade.submitError")),_(false);return}let nn=Uint8Array.from(atob(Rt),lt=>lt.charCodeAt(0)),Xt=await d.signTransaction(nn),Jt=await hr({signedTransaction:btoa(String.fromCharCode(...Xt)),orderContext:{user_public_key:v,input_mint:Ce,output_mint:vt,amount:I,price:String(me),side:"BUY",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});Q(Jt.signature);},[v,d,Yt,hr,Ce,vt,I,me,x,e.slug,o,Ot]),Or=react.useCallback(async()=>{if(!p||!u)return;let O=p.chain,Me=O!==types.Chain.POLYGON;Me&&await p.switchChain(types.Chain.POLYGON);try{let ke=await p.getEip1193Provider();if(!ke){ui$1.toast.error(o("predict.trade.submitError")),_(!1);return}let Rt=gt==="deposit"&&!!We,nn=!Rt&&!!tt,Xt=Rt?We:tt,Jt={address:p.address,signatureType:Rt?3:nn?2:0,signTypedData:async(_t,T,Se,Pe)=>{let De=[];"name"in _t&&De.push({name:"name",type:"string"}),"version"in _t&&De.push({name:"version",type:"string"}),"chainId"in _t&&De.push({name:"chainId",type:"uint256"}),"verifyingContract"in _t&&De.push({name:"verifyingContract",type:"address"}),"salt"in _t&&De.push({name:"salt",type:"bytes32"});let dt={EIP712Domain:De,...T};return await ke.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:_t,types:dt,primaryType:Se,message:Pe})]})}},lt=u.credentials??await u.authenticate(Jt),Lo=x==="yes"?0:1,En="",Ht=e.provider_meta?.["polymarket.clobTokenIds"];Ht&&(En=(typeof Ht=="string"?JSON.parse(Ht):Ht)[Lo]??"");let Dr=e.provider_meta?.["polymarket.negRisk"]??!1,Ar=k==="limit"&&!isNaN(R)?R:Tt,vr=Un(Ar,Le),Ln=k==="limit"?q?"GTD":"GTC":"FOK",br=k==="market"?y:vr>0?y/vr:0,Fr={tokenId:En,price:vr,size:br,side:"BUY",orderType:Ln,tickSize:Le,negRisk:Dr,...Xt&&{funderAddress:Xt},...Ie&&{builderCode:Ie},...k==="limit"&&q&&{expiration:Wn(N,B,de)}},Br;if(Rt)Br=await reactPredict.buildSignedV2OrderPayload({signer:Jt,depositWalletAddress:Xt,input:Fr,owner:lt.apiKey});else {let _t=reactPredict.buildCtfExchangeDomain(Dr),T=reactPredict.buildOrderMessage({...Fr,signerAddress:Jt.address,signatureType:Jt.signatureType,feeRateBps:ot}),Se=await Jt.signTypedData(_t,reactPredict.CTF_ORDER_TYPES,"Order",T),Pe=reactPredict.buildSignedOrder(T,Se,Fr.orderType);Br=reactPredict.buildClobPayload(Pe,lt.apiKey);}await c.executePolymarketOrder({payload:Br,l2_api_key:lt.apiKey,l2_secret:lt.secret,l2_passphrase:lt.passphrase,signer_address:lt.address,owner:lt.apiKey}),Ge(k==="limit"?"buy-limit":"buy-market",async()=>await reactPredict.buildPolymarketL2Headers(lt.address,{apiKey:lt.apiKey,secret:lt.secret,passphrase:lt.passphrase,method:"GET",requestPath:"/data/orders"})),Ir(),_(!1);}finally{Me&&O&&p.switchChain(O).catch(()=>{});}},[p,u,x,e.provider_meta,k,Ge,R,Tt,y,c,q,N,B,de,Ir,o,Le,ot,tt,gt,We,Ie]),Lt=react.useCallback(async()=>{if(!(!Qt.isValid||!g)){_(true),Q(null),Y(false);try{l==="kalshi"?await rn():await Or();}catch(O){let Me=O instanceof Error?O.message:"",ke=l==="polymarket"&&Me?$n(Me,o,"buy"):Me||void 0;ui$1.toast.error(ke||o("predict.trade.submitError")),_(false);}}},[Qt.isValid,g,l,rn,Or,o]);return {outcome:x,orderType:k,quantity:y,limitPrice:R,shares:Xe,effectivePrice:ve,estimatedCost:Rr,estimatedFee:_r,potentialPayout:en,potentialProfit:sr,pricePerShare:me,usdcBalance:Lr,maxBuyAmount:at,spendableUsdcBalance:Et,isBalanceLoading:To,isMarketDataLoading:l==="polymarket"&&(Re||qe),isSubmitting:C,authStatus:a,validation:Qt,isInsufficientBalance:fr,source:l,supportsLimitOrder:f,kycRequired:H,needsKyc:qt,needsSetup:Oe,kycUrl:Ct,expirationEnabled:q,expirationPreset:N,customDuration:B,customDurationUnit:de,setOutcome:ht,setOrderType:st,setQuantity:Eo,setLimitPrice:Tn,setExpirationEnabled:te,setExpirationPreset:E,setCustomDuration:J,setCustomDurationUnit:se,submit:Lt,notifyInsufficientBalance:gr}}function Vn({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui$1.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$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.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 $d=["5m","1h","12h","24h","eod","custom"],Kd={"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"},Vd=["minutes","hours","days"],jd={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Gd={maximumFractionDigits:0},lr="-";function vs({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,shares:s,effectivePrice:c,potentialProfit:u,potentialPayout:m,estimatedCost:l,estimatedFee:f=0,usdcBalance:d,isBalanceLoading:p,isMarketDataLoading:g,isSubmitting:v,authStatus:h,isValid:x,validationErrors:S,isInsufficientBalance:k,onInsufficientBalance:b,supportsLimitOrder:y,maxBuyAmount:M,kycRequired:R,needsKyc:P,needsSetup:C,kycUrl:_,expirationEnabled:U,expirationPreset:Q,customDuration:H,customDurationUnit:Y,oddsFormatter:q,outcomeLabels:te,onOutcomeChange:N,onOrderTypeChange:E,onQuantityChange:B,onLimitPriceChange:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[ft,qe]=react.useState(true),Le=ui$1.useDisclosure(),[Nt,Re]=react.useState(""),Ye=react.useRef(false);react.useEffect(()=>{Ye.current||Re(isNaN(i)?"":String(i));},[i]);let[ot,_e]=react.useState(""),et=react.useRef(false);react.useEffect(()=>{et.current||(isNaN(a)?_e(""):_e(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ie=react.useCallback(A=>{if(A!==""&&!/^\d*\.?\d{0,2}$/.test(A))return;if(_e(A),A===""||A==="."){J(NaN);return}let vt=parseFloat(A);isNaN(vt)||J(vt/100);},[J]),it=react.useCallback(A=>{if(A!==""&&!/^\d*\.?\d{0,2}$/.test(A))return;if(Re(A),Ue(false),A===""||A==="."){B(NaN);return}let vt=parseFloat(A);isNaN(vt)||B(vt);},[B]);react.useEffect(()=>{R&&!Le.isOpen&&Le.onOpen();},[R]);let Ot=react.useMemo(()=>{let A=n==="yes"?t.yesAsk:t.noAsk;return A!=null?parseFloat((Number(A)*100).toFixed(2)):null},[n,t]),Ct=n==="yes"?t.yesAsk:t.noAsk,Mt=Ct!=null&&q?q(Number(Ct)):Ot!=null?`${Ot} \xA2`:lr,tt=Number.isFinite(c)?parseFloat((c*100).toFixed(2)):null,gt=Number.isFinite(c)&&q?q(c):tt!=null?`${tt} \xA2`:lr,We=!isNaN(i)&&i>0,qt=We?l+f:0,Oe=We&&s>0?qt/s:0,Qe=Oe>0&&q?q(Oe):Oe>0?`${parseFloat((Oe*100).toFixed(2))}\xA2`:lr,me=h==="authenticated",st=h==="authenticating"||h==="deauthenticating",ht=me&&(P||C),ve=react.useCallback(A=>te?.[A]??w(A==="yes"?"predict.trade.yes":"predict.trade.no"),[te,w]),Xe=react.useMemo(()=>{if(st)return w("predict.trade.checkingLogin");if(!me)return w("predict.trade.loginToTrade");if(P)return w("predict.trade.kycRequired");if(C)return w("predict.trade.setupRequired");if(p)return w("predict.trade.loadingBalance");if(g)return w("predict.trade.loadingMarketData");if(v)return w("predict.trade.submitting");if(R)return w("predict.trade.kycRequired");if(!We)return w("predict.trade.enterAmount");let A=ve(n),Ce=u>0?` \u2192 Win $${u.toFixed(2)}`:"";return `${w("predict.trade.buy")} ${A}${Ce}`},[st,me,P,C,p,g,v,R,We,n,ve,u,w]),we="primary",Tt=()=>{let A=M??be(d??0,2);B(be(A/2,2));},I=()=>{B(M??be(d??0,2));},[Ne,Ue]=react.useState(false),Jr=()=>{if(!me){Ue(false),Ge();return}if(P){Le.onOpen();return}if(C&&b){Ue(false),b();return}if(R){Le.onOpen();return}if(k&&b){Ue(false),b();return}if(!x){Ue(true);return}Ue(false),Ge();};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-bullish",children:[w("predict.trade.buy")," ",ve(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[y?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:A=>E(A),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&y?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:ot,onChange:A=>Ie(A.target.value),onFocus:()=>{et.current=true;},onBlur:()=>{et.current=false,isNaN(a)?_e(""):_e(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"}}):Mt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:Mt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(A=>{let Ce=A==="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:()=>N(A),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===A?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:ve(A)}),Ce!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:q?q(Number(Ce)):`${parseFloat((Number(Ce)*100).toFixed(2))}\xA2`})]})},A)})}),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:w("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:Tt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:I,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Nt,onChange:A=>it(A.target.value),onFocus:()=>{Ye.current=true;},onBlur:()=>{Ye.current=false,Re(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"}}),Ne&&S.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:S.map(A=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:A},A))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:w("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`$${be(d,2).toFixed(2)}`:"$0"})]}),o==="limit"&&y&&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:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:U,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[Q],onSelectionChange:A=>{let Ce=Array.from(A)[0];Ce&&se(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:$d.map(A=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(Kd[A])},A))}),Q==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(H)?void 0:H,onValueChange:Ve,minValue:1,step:1,formatOptions:Gd,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[Y],onSelectionChange:A=>{let Ce=Array.from(A)[0];Ce&&je(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Vd.map(A=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(jd[A])},A))})]})]})]}),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:()=>qe(A=>!A),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",ft&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:q&&Number.isFinite(c)?gt:tt!=null?w("predict.trade.chance",{percent:tt}):lr})]}),ft&&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:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:lr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?kr(s):lr})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${f.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalPayment")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${qt.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Qe})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:lr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&u>0?`+$${u.toFixed(2)}`:lr})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:we,fullWidth:true,radius:"lg",size:"lg",isDisabled:st||me&&!ht&&(p||g||!We||v),isLoading:st||me&&!ht&&(v||p||g),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Jr,children:Xe})]}),jsxRuntime.jsx(Vn,{isOpen:Le.isOpen,onClose:Le.onClose,kycUrl:_})]})}function Gn({event:e,market:t,variant:r,initialOutcome:n,chain:o,slippageBps:i,onInsufficientBalance:a,onOutcomeChange:s,oddsFormatter:c,outcomeLabels:u}){let{outcome:m,orderType:l,quantity:f,limitPrice:d,shares:p,effectivePrice:g,estimatedCost:v,estimatedFee:h,potentialPayout:x,potentialProfit:S,pricePerShare:k,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:R,isSubmitting:P,authStatus:C,validation:_,isInsufficientBalance:U,supportsLimitOrder:Q,kycRequired:H,needsKyc:Y,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:B,customDurationUnit:J,setOutcome:de,setOrderType:se,setQuantity:Ve,setLimitPrice:je,setExpirationEnabled:Ge,setExpirationPreset:w,setCustomDuration:ft,setCustomDurationUnit:qe,submit:Le,notifyInsufficientBalance:Nt}=cs({market:t,initialOutcome:n,slippageBps:i,onInsufficientBalance:a}),Re=walletConnector.useAuthCallback(Le),Ye=react.useCallback(et=>{de(et),s?.(et);},[de,s]),ot=react.useMemo(()=>e?Dn(e):void 0,[e]),_e=react.useMemo(()=>An(t,{yesAsk:m==="yes"?k:void 0,noAsk:m==="no"?k:void 0}),[t,m,k]);return jsxRuntime.jsx(vs,{event:ot,market:_e,variant:r,outcome:m,orderType:l,quantity:f,limitPrice:d,shares:p,effectivePrice:g,estimatedCost:v,estimatedFee:h,potentialPayout:x,potentialProfit:S,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:R,isSubmitting:P,authStatus:C,isValid:_.isValid,validationErrors:_.errors,isInsufficientBalance:U,onInsufficientBalance:a?Nt:void 0,supportsLimitOrder:Q,kycRequired:H,needsKyc:Y,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:B,customDurationUnit:J,oddsFormatter:c,outcomeLabels:u,onOutcomeChange:Ye,onOrderTypeChange:se,onQuantityChange:Ve,onLimitPriceChange:je,onExpirationEnabledChange:Ge,onExpirationPresetChange:w,onCustomDurationChange:ft,onCustomDurationUnitChange:qe,onSubmit:Re})}var an="predict-trade";function qn({id:e=an}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(ru,{...t})})}function ru({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(Gn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var ln={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function Vo(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function xs({isOpen:e,onClose:t,value:r,onChange:n,enableKalshi:o=true}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(r),c=react.useMemo(()=>o?ln:{...ln,source:"polymarket"},[o]),u=react.useCallback(x=>{x?s(r):t();},[r,t]),m=react.useCallback(()=>{s(c);},[c]),l=react.useCallback(()=>{n(a),t();},[a,n,t]),f=react.useCallback((x,S)=>{s(k=>({...k,[x]:S}));},[]),d=react.useMemo(()=>Vo(a,o),[a,o]),p=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),g=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),h=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:u,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(lu,{onClick:()=>u(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[o&&jsxRuntime.jsx(Qn,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(Xn,{options:p,selected:a.source,onSelect:x=>f("source",x)})}),jsxRuntime.jsx(Qn,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Xn,{options:g,selected:a.timeRemaining,onSelect:x=>f("timeRemaining",x)})}),jsxRuntime.jsx(Qn,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(Xn,{options:v,selected:a.minVolume,onSelect:x=>f("minVolume",x)})}),jsxRuntime.jsx(Qn,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Xn,{options:h,selected:a.minLiquidity,onSelect:x=>f("minLiquidity",x)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:m,children:i("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:l,children:[i("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function Qn({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 lu({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 ws={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},ks={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},vu=["start_time","volume","liquidity","ending_soon"],Ss={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},bu={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 Ns({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:a}){let{t:s}=i18n.useTranslation(),[c,u]=react.useState(false),m=react.useRef(null),l=react.useCallback(d=>{m.current&&!m.current.contains(d.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)),[l]),react.useEffect(()=>{if(!c)return;let d=p=>{p.key==="Escape"&&u(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[c]);let f=Ps[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:Ss,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>u(d=>!d),children:[jsxRuntime.jsx(xu,{}),jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(ks[e])}),jsxRuntime.jsx(ku,{open:c})]}),c&&jsxRuntime.jsx("div",{style:{...bu,width:224,padding:4},children:vu.map(d=>{let p=Ps[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:v=>{g||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{g||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),u(false);},children:[jsxRuntime.jsx(p,{className:"size-4 shrink-0",style:{color:g?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:s(ks[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:Ss,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(yu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s("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 Ps={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function xu(){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 yu(){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 ku({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 Ts(e={}){let{i18n:t}=i18n.useTranslation(),r=e.lang??t.resolvedLanguage??t.language,n=react.useMemo(()=>reactPredict.resolveEventsParams({...e,lang:r}),[r,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,e.lang]),{data:o,isLoading:i,isFetching:a,isFetchingNextPage:s,isError:c,error:u,hasNextPage:m,fetchNextPage:l,refetch:f}=reactPredict.useInfiniteEvents(n),d=react.useMemo(()=>o?.pages.flatMap(v=>v.items).filter(v=>v!=null)??[],[o]),p=react.useCallback(()=>{l();},[l]),g=react.useCallback(()=>{f();},[f]);return {data:d,isLoading:i,isFetching:a&&!s,isFetchingMore:s,isError:c,error:u??null,hasMore:m??false,fetchMore:p,refetch:g}}var Es=`
|
|
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}}
|
|
5
5
|
@media(max-width:767px){.evt-skel-grid{grid-template-columns:1fr!important}}
|
|
6
|
-
`,Ls={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
|
|
6
|
+
`,Ls={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 Jn(e){return {...Ls,animationDelay:`${e}ms`}}function jo({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Es}),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(Nu,{index:r},r))})]})}function Nu({index:e}){let t=e*120,r={...Ls,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 Cu(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px"},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:{...Jn(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:{...Jn(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Jn(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Jn(100),height:36,width:80,borderRadius:10}})]})]})}function Nx({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Es}),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(Cu,{})}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(jo,{count:e})})]})}var Rs=3,Au={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)"}},Fu={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},qo={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Fs={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Bu={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},cn=[{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 _s(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 Hu(e){let t=e.outcomes?.map(a=>a.label?.toLowerCase().trim()??"")??[];if(t.some(a=>a==="up")&&t.some(a=>a==="down"))return [qo,Bu];if(t.some(a=>a==="yes")&&t.some(a=>a==="no"))return [qo,Fs];let r=t[0]??"",n=t[1]??"",o=_s(r)%cn.length,i=_s(n)%cn.length;return i===o&&(i=(i+1)%cn.length),[cn[o],cn[i]]}function Is(e){return e.title_trans||e.title}function zu(e){return e.question_trans||e.question}function Yo(e,t){return e?.label_trans||e?.label||t}function Bs(e){return Yo(e.outcomes?.[0],zu(e))}function Wu(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Hs(e){let t=Wu(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function zs(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Os(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Ds(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 Uu(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 $u=`
|
|
7
7
|
.badge-shine { position: relative; overflow: hidden; }
|
|
8
8
|
.badge-shine::after {
|
|
9
9
|
content: "";
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
outline: 2px solid hsl(var(--heroui-primary) / 0.4);
|
|
28
28
|
outline-offset: 2px;
|
|
29
29
|
}
|
|
30
|
-
`;function Ws({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[a,s]=react.useState(null),l=e.markets??[],m=react.useMemo(()=>l.length>2?[...l].sort((b,y)=>(y.outcomes?.[0]?.price??0)-(b.outcomes?.[0]?.price??0)):l,[l]).filter(b=>b.status==="open"),c=m.length===1,f=m.slice(0,Rs),d=m.length-Rs,p=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),g=a?m.find(b=>b.slug===a)??null:null,v=!!g||c,h=()=>{v||n?.(e);},x=b=>{b.stopPropagation(),g&&(b.preventDefault(),s(null));},S=b=>{b.stopPropagation(),t||(b.preventDefault(),n?.(e));},k=c?jsxRuntime.jsx(ep,{event:e,formattedVolume:p,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(rp,{onCollapse:()=>s(null)}):jsxRuntime.jsx(Qu,{moreCount:d,formattedVolume:p,source:e.source,href:t,LinkComponent:r,onShowMore:S});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:b=>{let y=b.currentTarget,M=Du[e.source]??Au;y.style.borderColor=M.border,y.style.boxShadow=M.shadow,i?.(e);},onMouseLeave:b=>{let y=b.currentTarget;y.style.borderColor="rgba(39,39,42,0.6)",y.style.boxShadow="none";},onClick:h,children:[jsxRuntime.jsx("style",{children:Uu}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx($u,{event:e,href:t,LinkComponent:r,onClick:x,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:c?jsxRuntime.jsx(Zu,{market:m[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(tp,{market:g,event:e,onCollapse:()=>s(null),onSelectOutcome:o}):jsxRuntime.jsx(Yu,{displayedMarkets:f,onMarketClick:b=>s(b.slug)})})]}),jsxRuntime.jsx(Xu,{children:k})]})}function $u({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?Wu(e.start_at):null;return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:n,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:Is(e)||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:Is(e)}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(Vu,{event:e})]})}function Ku(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 s=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:s});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function Vu({event:e}){let t=react.useMemo(()=>Ku(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(ju,{},n);case "crypto-short":return jsxRuntime.jsx(Gu,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(qu,{},n)}})})}function ju(){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 Gu({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui$1.TimerIcon,{className:"size-3 shrink-0"}),e]})}function qu(){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 Yu({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=Hs(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:Bs(r)}),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:zs(n)}),jsxRuntime.jsx(Ju,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Qu({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$1.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($s,{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(Ks,{source:r})]})]})}function Xu({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 As({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:s=>{let l=s.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:s=>{let l=s.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:n,children:o})}function Us({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[a,s]=n?Bu(e):[Yo,Fs],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",u=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",m=o==="label"&&l===u?"action":o,c=m==="label"?`${Qo(e.outcomes?.[0],"Yes")} ${Os(e)}\xA2`:i("predict.market.action.yes",{price:Os(e)}),f=m==="label"?`${Qo(e.outcomes?.[1],"No")} ${Ds(e)}\xA2`:i("predict.market.action.no",{price:Ds(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(As,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:c}),jsxRuntime.jsx(As,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:f})]})}function Ju(){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 Zu({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Us,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function ep({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.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:s=>{s.stopPropagation(),r||(s.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx($s,{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(Ks,{source:e.source})]})]})}function tp({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=Hs(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:Bs(e)}),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:zs(o)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Us,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function rp({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(np,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function $s({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 np({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 Ks({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var ap=8;function js({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:a,LinkComponent:s,onHover:l}){let{t:u}=i18n.useTranslation(),m=react.useRef(null);react.useEffect(()=>{let d=m.current;if(!d)return;let p=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return p.observe(d),()=>p.disconnect()},[t,r,n]);let c=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),f=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
|
|
30
|
+
`;function Ws({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[a,s]=react.useState(null),c=e.markets??[],m=react.useMemo(()=>c.length>2?[...c].sort((b,y)=>(y.outcomes?.[0]?.price??0)-(b.outcomes?.[0]?.price??0)):c,[c]).filter(b=>b.status==="open"),l=m.length===1,f=m.slice(0,Rs),d=m.length-Rs,p=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),g=a?m.find(b=>b.slug===a)??null:null,v=!!g||l,h=()=>{v||n?.(e);},x=b=>{b.stopPropagation(),g&&(b.preventDefault(),s(null));},S=b=>{b.stopPropagation(),t||(b.preventDefault(),n?.(e));},k=l?jsxRuntime.jsx(tp,{event:e,formattedVolume:p,href:t,LinkComponent:r,onSelect:n}):g?jsxRuntime.jsx(np,{onCollapse:()=>s(null)}):jsxRuntime.jsx(Xu,{moreCount:d,formattedVolume:p,source:e.source,href:t,LinkComponent:r,onShowMore:S});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:b=>{let y=b.currentTarget,M=Au[e.source]??Fu;y.style.borderColor=M.border,y.style.boxShadow=M.shadow,i?.(e);},onMouseLeave:b=>{let y=b.currentTarget;y.style.borderColor="rgba(39,39,42,0.6)",y.style.boxShadow="none";},onClick:h,children:[jsxRuntime.jsx("style",{children:$u}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(Ku,{event:e,href:t,LinkComponent:r,onClick:x,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:l?jsxRuntime.jsx(ep,{market:m[0],event:e,onSelectOutcome:o}):g?jsxRuntime.jsx(rp,{market:g,event:e,onCollapse:()=>s(null),onSelectOutcome:o}):jsxRuntime.jsx(Qu,{displayedMarkets:f,onMarketClick:b=>s(b.slug)})})]}),jsxRuntime.jsx(Ju,{children:k})]})}function Ku({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?Uu(e.start_at):null;return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:n,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:Is(e)||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:Is(e)}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(ju,{event:e})]})}function Vu(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 s=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:s});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function ju({event:e}){let t=react.useMemo(()=>Vu(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(Gu,{},n);case "crypto-short":return jsxRuntime.jsx(qu,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(Yu,{},n)}})})}function Gu(){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 qu({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui$1.TimerIcon,{className:"size-3 shrink-0"}),e]})}function Yu(){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 Qu({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=Hs(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:Bs(r)}),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:zs(n)}),jsxRuntime.jsx(Zu,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function Xu({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$1.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($s,{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(Ks,{source:r})]})]})}function Ju({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 As({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:s=>{let c=s.currentTarget;c.style.setProperty("--shadow-offset","2px"),c.style.transform="translateY(2px)";},onMouseLeave:s=>{let c=s.currentTarget;c.style.setProperty("--shadow-offset","4px"),c.style.transform="translateY(0px)";},onClick:n,children:o})}function Us({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[a,s]=n?Hu(e):[qo,Fs],c=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",u=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",m=o==="label"&&c===u?"action":o,l=m==="label"?`${Yo(e.outcomes?.[0],"Yes")} ${Os(e)}\xA2`:i("predict.market.action.yes",{price:Os(e)}),f=m==="label"?`${Yo(e.outcomes?.[1],"No")} ${Ds(e)}\xA2`:i("predict.market.action.no",{price:Ds(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(As,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:l}),jsxRuntime.jsx(As,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:f})]})}function Zu(){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 ep({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(Us,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function tp({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.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:s=>{s.stopPropagation(),r||(s.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx($s,{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(Ks,{source:e.source})]})]})}function rp({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=Hs(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:Bs(e)}),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:zs(o)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(Us,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function np({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(op,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function $s({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 op({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 Ks({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var lp=8;function js({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:a,LinkComponent:s,onHover:c}){let{t:u}=i18n.useTranslation(),m=react.useRef(null);react.useEffect(()=>{let d=m.current;if(!d)return;let p=new IntersectionObserver(g=>{g[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return p.observe(d),()=>p.disconnect()},[t,r,n]);let l=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),f=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
|
|
31
31
|
@keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
|
|
32
32
|
@keyframes evt-load-spin{to{transform:rotate(360deg)}}
|
|
33
33
|
@media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
|
|
34
34
|
@media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
|
|
35
35
|
@media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
|
|
36
|
-
`}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,p)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:
|
|
36
|
+
`}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,p)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:lp,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${p%4*35}ms both`},children:jsxRuntime.jsx(Ws,{event:d,href:a?.(d),LinkComponent:s,onSelect:o,onSelectOutcome:i,onHover:c})},`${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"})}),u("predict.events.loadMore")]})}),f&&jsxRuntime.jsx(cp,{onScrollToTop:l})]})}function cp({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 qs({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:s,minVolume:c,minLiquidity:u,markets_limit:m,lang:l,onSelect:f,onSelectOutcome:d,getEventHref:p,LinkComponent:g,onHover:v}){let{data:h,hasMore:x,fetchMore:S,isFetching:k,isFetchingMore:b}=Ts({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:s,minVolume:c,minLiquidity:u,markets_limit:m,lang:l});return k?jsxRuntime.jsx(jo,{count:24}):jsxRuntime.jsx(js,{events:h,hasMore:x,isFetchingMore:b,onFetchMore:S,onSelect:f,onSelectOutcome:d,getEventHref:p,LinkComponent:g,onHover:v})}function Zx({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i,onInsufficientBalance:a,enableKalshi:s=true,lang:c}){let[u,m]=react.useState({categorySlug:null,tagSlug:null}),[l,f]=react.useState(()=>s?ln:{...ln,source:"polymarket"}),{isOpen:d,onOpen:p,onClose:g}=ui$1.useDisclosure(),{onOpen:v}=uiScaffold.useAsyncModal(an),h=react.useCallback((P,C,_)=>{t?.(P,C,_),v({params:{event:P,market:C,initialOutcome:_,onInsufficientBalance:a}});},[t,v,a]),x=react.useCallback(P=>{m(P);},[]),S=react.useCallback(P=>{f(C=>({...C,sortPreset:P}));},[]),k=react.useCallback(P=>{f(C=>({...C,sortAsc:P}));},[]),b=react.useCallback(P=>{f(P);},[]),y=react.useMemo(()=>ws[l.sortPreset].sort_by,[l.sortPreset]),M=react.useMemo(()=>Vo(l,s),[l,s]),R=react.useMemo(()=>jsxRuntime.jsx(Ns,{sortPreset:l.sortPreset,onSortChange:S,sortAsc:l.sortAsc,onSortAscChange:k,onFilterPress:p,filterCount:M}),[l.sortPreset,l.sortAsc,M,S,k,p]);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(Xi,{onSelect:x,trailing:R})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(xs,{isOpen:d,onClose:g,value:l,onChange:b,enableKalshi:s}),jsxRuntime.jsx(qs,{tagSlugSelection:u,lang:c,sort_by:y,sort_asc:l.sortAsc,source:l.source,timeRemaining:l.timeRemaining,minVolume:l.minVolume,minLiquidity:l.minLiquidity,onSelect:e,onSelectOutcome:h,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(qn,{})]})}function Js(e){return utils$1.formatAmountInUsd(e)}var fp=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>utils$1.formatAmount(e),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:Js,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:Js,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=>utils$1.formatAmount(e),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function oy({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
37
37
|
@keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
|
|
38
38
|
@keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
|
|
39
39
|
@keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
.evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
|
|
72
72
|
@media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
|
|
73
73
|
`}),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(`
|
|
74
|
-
`).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:mp.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 ra({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i,i18n:a}=i18n.useTranslation(),{mutateAsync:s}=reactPredict.useRedeemPosition(),{start:l}=reactPredict.useTradeResultConfirmation(),{evmAddress:u}=yr(),m=walletConnector.useWallets(),[c,f]=react.useState("idle"),[d,p]=react.useState(null),g=t.provider_meta?.["polymarket.conditionId"],v=t.provider_meta?.["polymarket.negRisk"]??false,h=u??"",x=react.useMemo(()=>Ur(i,a),[a,i]),S=react.useMemo(()=>m.find(Y=>Y.chainNamespace===types.ChainNamespace.EVM&&Y.isConnected),[m]),k=ta(r.side,t.outcomes),y=t.outcomes?.[k]?.label??r.side,M=t.result!=null?ta(t.result,t.outcomes):-1,P=(M>=0?t.outcomes?.[M]:void 0)?.label??t.result??"",C=t.result!=null?k===M:true,_=react.useMemo(()=>C?r.size:0,[C,r.size]),U=react.useCallback(async()=>{if(!(!g||!h||!S)){f("pending"),p(null);try{let Y=await S.getEip1193Provider();if(!Y)throw new Error("EIP-1193 provider unavailable");await s({wallet_address:h,condition_id:g,neg_risk:v,signMessage:async N=>await Y.request({method:"personal_sign",params:[N,h]}),signTypedData:async N=>await Y.request({method:"eth_signTypedData_v4",params:[h,JSON.stringify(N)]})}),f("confirming");let q=$r({messages:x});q.submitted(),await l({source:r.source,user:h,marketSlug:r.market?.slug??t.slug,eventSlug:r.event?.slug??e?.slug,expectation:"redeem",expectedPayout:_})==="confirmed"?(f("success"),q.completed()):(f("delayed"),q.delayed()),n?.();}catch(Y){f("error"),p(Y instanceof Error?Y.message:i("predict.redeem.error"));}}},[g,h,v,S,s,x,l,r.source,r.market?.slug,r.event?.slug,t.slug,e?.slug,_,n,i]),Q=walletConnector.useAuthCallback(U),H=c==="idle"&&!!g&&!!h&&!!S&&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(to,{label:i("predict.positions.side"),value:y,valueClassName:C?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(to,{label:i("predict.redeem.result"),value:P,valueClassName:"text-green-400"}),jsxRuntime.jsx(to,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(to,{label:i("predict.redeem.expectedPayout"),value:`$${_.toFixed(2)}`,valueClassName:_>0?"text-green-400":"text-zinc-400"})]}),!C&&_===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),c==="error"&&d&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:d}),c==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),c==="delayed"&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-400",children:i("predict.trade.resultDelayed",{defaultValue:"Your trade was submitted successfully. Confirmation is taking a little longer."})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[c!=="success"&&c!=="delayed"&&jsxRuntime.jsx(ui$1.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!H,isLoading:c==="pending"||c==="confirming",onPress:Q,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&c!=="success"&&c!=="delayed"&&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"||c==="delayed")&&o&&jsxRuntime.jsx(ui$1.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function to({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 ta(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 oa({id:e=Tp}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Ep,{...t})})}function Ep({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className: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(ra,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function ni(e){return e?.trim().toLowerCase()??""}function ri(e,t){let r=e.provider_meta?.[t];return typeof r=="string"?r:""}function la(e,t){return !!(e&&t&&e.trim().toLowerCase().includes(t))}function om(e,t){let r=ni(e.side);if(r==="yes"||r==="no")return r;if(r==="over"||r==="odd")return "yes";if(r==="under"||r==="even")return "no";let n=[t.outcomes?.[0]?.label,ri(t,"polymarket.groupItemTitle"),ri(t,"polymarket.groupItemTitleTrans"),ri(t,"polymarket.group_item_title_trans")],o=[t.outcomes?.[1]?.label];return n.some(i=>la(i,r))?"yes":o.some(i=>la(i,r))?"no":null}function ca({market:e,initialOutcome:t="yes",initialPositionSide:r,slippageBps:n=100,onSuccess:o}){let{t:i,i18n:a}=i18n.useTranslation(),s=react.useRef(o);s.current=o;let{status:l}=walletConnector.useAuth(),u=walletConnector.useWallets(),m=reactPredict.usePredictClient(),c=react.useContext(reactPredict.PolymarketContext),f=reactQuery.useQueryClient(),{start:d}=reactPredict.useTradeResultConfirmation(),p=e.source,g=p==="polymarket",v=u.find(T=>T.chainNamespace===types.ChainNamespace.SOLANA&&T.isConnected),h=u.find(T=>T.chainNamespace===types.ChainNamespace.EVM&&T.isConnected&&"switchChain"in T),x=l==="authenticated",S=v?.address,k=h?.address,[b,y]=react.useState(t),[M,R]=react.useState("market"),[P,C]=react.useState(NaN),[_,U]=react.useState(NaN),[Q,H]=react.useState(false),[Y,q]=react.useState(false),[te,N]=react.useState(null),[E,B]=react.useState(null),[J,de]=react.useState(false),[se,Ve]=react.useState(false),[je,Ge]=react.useState("1h"),[w,dt]=react.useState(30),[qe,Re]=react.useState("minutes"),Nt=react.useMemo(()=>Ur(i,a),[a,i]),_e=true,Ye=react.useCallback(async(T,Se)=>{let Pe=$r({messages:Nt});Pe.submitted(),await d({source:p,user:p==="kalshi"?S:k,kalshiUser:_e?S:void 0,polymarketUser:k,marketSlug:e.slug,eventSlug:e.event_slug,expectation:T,getOrdersHeaders:Se})==="confirmed"?Pe.completed():Pe.delayed();},[d,_e,k,e.event_slug,e.slug,p,Nt,S]),ot=react.useMemo(()=>{if(p!=="polymarket")return;let T=e.provider_meta?.["polymarket.clobTokenIds"];return T?(typeof T=="string"?JSON.parse(T):T)[b==="yes"?0:1]:void 0},[p,e.provider_meta,b]),{data:we,isLoading:et}=reactPredict.useTickSize(ot),Ie=we?.minimum_tick_size?String(we.minimum_tick_size):"0.01",{data:it,isLoading:Ot}=reactPredict.useFeeRate(ot),Ct=String(it?.base_fee??0),{data:Mt}=reactPredict.useRebateConfig(),tt=Mt?.builder_enabled&&Mt.builder_code?Mt.builder_code:void 0,gt=false,We=null,Yt=false,Oe,Qe,me;try{let T=yr();_e=T.enableKalshi,gt=T.kalshiKycVerified,We=T.kalshiKycUrl,Yt=T.polymarketSetupVerified,Oe=T.polymarketSafeAddress,Qe=T.polymarketWalletKind,me=T.polymarketWalletAddress;}catch{}let st=p==="kalshi"&&!gt,ht=p==="polymarket"&&!Yt,ve=react.useCallback(async()=>{if(!h||!c)return null;let T=await h.getEip1193Provider();if(!T)return null;let Se=Qe==="deposit"&&!!me,Pe=!Se&&!!Oe,De={address:h.address,signatureType:Se?3:Pe?2:0,signTypedData:async(ut,er,zt,Ae)=>{let lr=[];"name"in ut&&lr.push({name:"name",type:"string"}),"version"in ut&&lr.push({name:"version",type:"string"}),"chainId"in ut&&lr.push({name:"chainId",type:"uint256"}),"verifyingContract"in ut&&lr.push({name:"verifyingContract",type:"address"}),"salt"in ut&&lr.push({name:"salt",type:"bytes32"});let In={EIP712Domain:lr,...er};return await T.request({method:"eth_signTypedData_v4",params:[h.address,JSON.stringify({domain:ut,types:In,primaryType:zt,message:Ae})]})}};return c.credentials??await c.authenticate(De)},[Oe,Qe,me,h,c]),{data:Xe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:b},{enabled:e.status==="open"}),Ne=react.useMemo(()=>{let T=reactPredict.pickBestBid(Xe,b);if(T!=null&&T>0)return T;let Se=b==="yes"?0:1,Pe=e.outcomes[Se];return Pe?.best_bid??Pe?.price??.5},[Xe,e.outcomes,b]),Tt=p==="kalshi"?S??"":k??"",{data:I,isLoading:Ce}=reactPredict.usePositionsMulti({kalshi_user:p==="kalshi"?Tt:void 0,polymarket_user:p==="polymarket"?Tt:void 0},{enabled:!!Tt,refetchInterval:3e4}),Ue=ni(r),en=r?.trim(),A=react.useMemo(()=>I?I.positions.find(T=>T.market?.slug!==e.slug?false:Ue?ni(T.side)===Ue:om(T,e)===b)??null:null,[I,e,e.slug,b,Ue]),Me=en||A?.side||b,vt=react.useCallback(async()=>{let T=await ve();return T?await reactPredict.buildPolymarketL2Headers(T.address,{apiKey:T.apiKey,secret:T.secret,passphrase:T.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[ve]),{data:Dt,isLoading:tn}=reactPredict.useAvailableShares({source:p,user:Tt,market:e.slug,side:Me},p==="polymarket"?{getHeaders:vt}:void 0,{enabled:!!Tt&&!!e.slug,refetchOnMount:"always"}),Mo=e.provider_meta?.["dflow.yesMint"]??"",To=e.provider_meta?.["dflow.noMint"]??"",Qt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Rr=e.provider_meta?.["dflow.collateralMint"]||"",Eo=b==="yes"?Mo:To,at=react.useMemo(()=>p==="polymarket"?reactPredict.getPolymarketSharesPrecision(Ie):Dt?.precision??0,[p,Ie,Dt?.precision]),Et=Dt?.active_order_shares??0,_r=p==="polymarket"&&!!A?.size&&(Dt?.total_shares??0)<=0&&(Dt?.available_shares??0)<=0,rn=_r?A?.size??0:0,Ir=_r?rn:Dt?.total_shares??0,ar=_r?Math.max(0,rn-Et):Dt?.available_shares??0,Lo=tn||Ce,Ln=A?.market?.provider_meta,Or=Ln?.["dflow.outcomeMint"]||Eo,Xt=Ln?.["dflow.collateralMint"]||Rr,fr=Or,gr=Xt||Qt,hr=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),nn=p==="kalshi"&&!!fr&&!!gr&&!!S&&hr!=="0",{refetch:on}=reactPredict.useDFlowQuote({inputMint:fr,outputMint:gr,amount:hr,userPublicKey:S??"",slippageBps:100},{enabled:nn}),Dr=react.useMemo(()=>isNaN(P)||P<=0?0:P,[P]),Lt=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Xe,outcome:b,side:"sell",sharesNeeded:Dr,slippageBps:n}),[Xe,b,Dr,n]),O=react.useMemo(()=>Lt.status==="ok"&&Lt.worstPrice!=null&&Lt.worstPrice>0?Lt.worstPrice:Ne,[Lt,Ne]),Te=react.useMemo(()=>M==="limit"&&g&&!isNaN(_)?_:O,[M,g,_,O]),ke=react.useMemo(()=>isNaN(P)||P<=0?0:P*Te,[P,Te]),Rt=react.useMemo(()=>p!=="polymarket"?0:os({grossReturn:ke,pricePerShare:Te,feeRateBps:Number(Ct)}),[p,ke,Te,Ct]),sn=react.useMemo(()=>Math.max(0,ke-Rt),[ke,Rt]),Jt=react.useCallback(T=>{y(T),U(NaN),C(NaN),q(false);},[]);react.useEffect(()=>{Jt(t);},[t,Jt]);let Zt=react.useCallback(T=>{R(T);},[]);react.useEffect(()=>{M==="limit"&&U(Math.round(Ne*1e4)/1e4);},[M,b]);let lt=react.useCallback(T=>{if(q(false),isNaN(T)){C(NaN);return}C(be(Math.max(0,T),at));},[at]),Ro=react.useCallback(()=>{q(true),C(be(ar,at));},[ar,at]),Rn=react.useCallback(T=>{if(isNaN(T)){U(NaN);return}U(Math.round(T*1e4)/1e4);},[]),Ht=react.useCallback(()=>{C(NaN),U(NaN),R("market"),q(false),Ve(false),Ge("1h"),dt(30),Re("minutes");},[]),Ar=react.useMemo(()=>{let T=[];return isNaN(P)||P<=0?T.push(i("predict.trade.minQuantity",{amount:Wn})):P<Wn&&T.push(i("predict.trade.minQuantity",{amount:Wn})),e.status!=="open"&&T.push(i("predict.trade.marketNotActive")),!isNaN(P)&&P>0&&!Y&&P>ar&&T.push(i("predict.trade.insufficientSharesDetail",{total:be(Ir,at).toFixed(at),active:be(Et,at).toFixed(at),available:be(ar,at).toFixed(at)})),M==="limit"&&g&&(isNaN(_)||_<.01||_>.99)&&T.push(i("predict.trade.limitPriceRange")),M==="limit"&&g&&se&&je==="custom"&&(isNaN(w)||w<=0)&&T.push(i("predict.trade.expiration.invalidDate")),p==="polymarket"&&M==="market"&&!isNaN(P)&&P>0&&(Lt.status==="insufficient_liquidity"?T.push(i("predict.trade.insufficientLiquidity",{available:be(Lt.totalAvailable,2)})):Lt.status==="exceeds_slippage"&&T.push(i("predict.trade.priceImpactTooHigh",{impact:(Lt.priceImpactBps/100).toFixed(2),slippage:(n/100).toFixed(2)}))),{isValid:T.length===0,errors:T}},[P,e.status,ar,Ir,Et,Y,M,g,_,se,je,w,at,p,Lt,n,i]),{mutateAsync:Fr}=reactPredict.useDFlowSubmit(),{data:vr}=reactPredict.useOrder({id:te??"",source:p},{enabled:!!te}),_n=react.useCallback(async()=>{if(!E||!S||!v)return;let{cashAmount:T,collateral:Se}=E;B(null);try{let De=(await m.createDFlowQuote({inputMint:Se,outputMint:Qt,amount:T,userPublicKey:S,slippageBps:100}))?.transaction;if(!De)return;let ut=Uint8Array.from(atob(De),zt=>zt.charCodeAt(0)),er=await v.signTransaction(ut);await Fr({signedTransaction:btoa(String.fromCharCode(...er)),orderContext:{user_public_key:S,input_mint:Se,output_mint:Qt,amount:T,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[E,S,v,m,Fr,Qt]),br=react.useCallback(()=>{f.invalidateQueries({queryKey:["predict","available-shares"]});},[f]);react.useEffect(()=>{if(!vr||!te)return;let{status:T}=vr;T==="closed"?(N(null),E?_n().finally(()=>{H(false),Ye("sell-market"),br(),Ht(),s.current?.();}):(H(false),Ye("sell-market"),br(),Ht(),s.current?.())):(T==="failed"||T==="expired")&&(H(false),N(null),B(null),ui$1.toast.error(i("predict.trade.submitError")));},[vr,te,E,_n,Ye,br,Ht,i]);let Br=react.useCallback(async()=>{if(!S||!v)return;if(!fr||!gr){ui$1.toast.error("Missing token mint addresses"),H(false);return}if(!gt){de(true),H(false);return}let Pe=(await on()).data,De=Pe?.transaction;if(!De){ui$1.toast.error(i("predict.trade.submitError")),H(false);return}if(Xt&&Xt!==Qt){let Ae=String(Pe?.outAmount??"");Ae&&Ae!=="0"&&B({cashAmount:Ae,collateral:Xt});}let ut=Uint8Array.from(atob(De),Ae=>Ae.charCodeAt(0)),er=await v.signTransaction(ut),zt=await Fr({signedTransaction:btoa(String.fromCharCode(...er)),orderContext:{user_public_key:S,input_mint:fr,output_mint:gr,amount:hr,price:String(Ne),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});N(zt.signature);},[S,v,on,Fr,fr,gr,hr,Ne,b,e.slug,Xt,Qt,i,gt]),Hr=react.useCallback(async()=>{if(!h||!c)return;let T=h.chain,Se=T!==types.Chain.POLYGON;Se&&await h.switchChain(types.Chain.POLYGON);try{let Pe=await h.getEip1193Provider();if(!Pe){ui$1.toast.error(i("predict.trade.submitError")),H(!1);return}let De=Qe==="deposit"&&!!me,ut=!De&&!!Oe,er=De?me:Oe,zt={address:h.address,signatureType:De?3:ut?2:0,signTypedData:async(Wt,Dn,Oo,Do)=>{let zr=[];"name"in Wt&&zr.push({name:"name",type:"string"}),"version"in Wt&&zr.push({name:"version",type:"string"}),"chainId"in Wt&&zr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Wt&&zr.push({name:"verifyingContract",type:"address"}),"salt"in Wt&&zr.push({name:"salt",type:"bytes32"});let Ec={EIP712Domain:zr,...Dn};return await Pe.request({method:"eth_signTypedData_v4",params:[h.address,JSON.stringify({domain:Wt,types:Ec,primaryType:Oo,message:Do})]})}},Ae=await ve();if(!Ae){ui$1.toast.error(i("predict.trade.submitError")),H(!1);return}let lr=b==="yes"?0:1,In="",On=e.provider_meta?.["polymarket.clobTokenIds"];On&&(In=(typeof On=="string"?JSON.parse(On):On)[lr]??"");let $i=e.provider_meta?.["polymarket.negRisk"]??!1,Mc=M==="limit"&&!isNaN(_)?_:O,Tc=Kn(Mc,Ie),_o={tokenId:In,price:Tc,size:P,side:"SELL",orderType:M==="limit"?se?"GTD":"GTC":"FOK",tickSize:Ie,negRisk:$i,...er&&{funderAddress:er},...tt&&{builderCode:tt},...M==="limit"&&se&&{expiration:$n(je,w,qe)}},Io;if(De)Io=await reactPredict.buildSignedV2OrderPayload({signer:zt,depositWalletAddress:er,input:_o,owner:Ae.apiKey});else {let Wt=reactPredict.buildCtfExchangeDomain($i),Dn=reactPredict.buildOrderMessage({..._o,signerAddress:zt.address,signatureType:zt.signatureType,feeRateBps:Ct}),Oo=await zt.signTypedData(Wt,reactPredict.CTF_ORDER_TYPES,"Order",Dn),Do=reactPredict.buildSignedOrder(Dn,Oo,_o.orderType);Io=reactPredict.buildClobPayload(Do,Ae.apiKey);}await m.executePolymarketOrder({payload:Io,l2_api_key:Ae.apiKey,l2_secret:Ae.secret,l2_passphrase:Ae.passphrase,signer_address:Ae.address,owner:Ae.apiKey}),br(),Ye(M==="limit"?"sell-limit":"sell-market",async()=>await reactPredict.buildPolymarketL2Headers(Ae.address,{apiKey:Ae.apiKey,secret:Ae.secret,passphrase:Ae.passphrase,method:"GET",requestPath:"/data/orders"})),Ht(),H(!1),s.current?.();}finally{Se&&T&&h.switchChain(T).catch(()=>{});}},[h,c,ve,b,e.provider_meta,M,Ye,_,O,P,m,br,se,je,w,qe,Ht,i,Ie,Ct,e.slug,Oe,Qe,me,tt]),_t=react.useCallback(async()=>{if(!(!Ar.isValid||!x)){H(true),N(null),de(false);try{p==="kalshi"?await Br():await Hr();}catch(T){let Se=T instanceof Error?T.message:"",Pe=p==="polymarket"&&Se?Vn(Se,i,"sell"):Se||void 0;ui$1.toast.error(Pe||i("predict.trade.submitError")),H(false);}}},[Ar.isValid,x,p,Br,Hr,i]);return {outcome:b,orderType:M,quantity:P,limitPrice:_,shares:Dr,effectivePrice:Te,grossReturn:ke,estimatedFee:Rt,estimatedReturn:sn,pricePerShare:Ne,isMarketDataLoading:p==="polymarket"&&(Ot||et),isSubmitting:Q,authStatus:l,validation:Ar,supportsLimitOrder:g,kycRequired:J,needsKyc:st,needsSetup:ht,kycUrl:We,totalShares:Ir,activeOrderShares:Et,availableShares:ar,isAvailableLoading:Lo,isSellAll:Y,precision:at,expirationEnabled:se,expirationPreset:je,customDuration:w,customDurationUnit:qe,setOutcome:Jt,setOrderType:Zt,setQuantity:lt,setLimitPrice:Rn,setSellAll:Ro,setExpirationEnabled:Ve,setExpirationPreset:Ge,setCustomDuration:dt,setCustomDurationUnit:Re,submit:_t}}var fm=["5m","1h","12h","24h","eod","custom"],gm={"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"},hm=["minutes","hours","days"],vm={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},bm={maximumFractionDigits:0},fn="-";function va({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,effectivePrice:s,grossReturn:l,estimatedFee:u,estimatedReturn:m,isMarketDataLoading:c,isSubmitting:f,authStatus:d,isValid:p,validationErrors:g,supportsLimitOrder:v,kycRequired:h,needsKyc:x,needsSetup:S,onSetupRequired:k,kycUrl:b,totalShares:y,activeOrderShares:M,availableShares:R,isAvailableLoading:P,precision:C,expirationEnabled:_,expirationPreset:U,customDuration:Q,customDurationUnit:H,oddsFormatter:Y,outcomeLabels:q,onOutcomeChange:te,onOrderTypeChange:N,onQuantityChange:E,onLimitPriceChange:B,onSellAll:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[dt,qe]=react.useState(false),[Re,Nt]=react.useState(true),_e=ui$1.useDisclosure(),[Ye,ot]=react.useState(""),we=react.useRef(false);react.useEffect(()=>{we.current||ot(isNaN(i)?"":String(i));},[i]);let[et,Ie]=react.useState(""),it=react.useRef(false);react.useEffect(()=>{it.current||(isNaN(a)?Ie(""):Ie(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ot=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if(Ie(I),I===""||I==="."){B(NaN);return}let Ue=parseFloat(I);isNaN(Ue)||B(Ue/100);},[B]),Ct=react.useCallback(I=>{let Ce=new RegExp(`^\\d*\\.?\\d{0,${C}}$`);if(I!==""&&!Ce.test(I))return;if(ot(I),qe(false),I===""||I==="."){E(NaN);return}let Ue=parseFloat(I);isNaN(Ue)||E(Ue);},[E,C]);react.useEffect(()=>{h&&!_e.isOpen&&_e.onOpen();},[h]);let Mt=react.useMemo(()=>{let I=n==="yes"?t.yesBid:t.noBid;return I!=null?parseFloat((Number(I)*100).toFixed(2)):null},[n,t]),tt=n==="yes"?t.yesBid:t.noBid,gt=tt!=null&&Y?Y(Number(tt)):Mt!=null?`${Mt} \xA2`:null,We=Number.isFinite(s)?parseFloat((s*100).toFixed(2)):null,Yt=Number.isFinite(s)&&Y?Y(s):We!=null?`${We} \xA2`:null,Oe=!isNaN(i)&&i>0,Qe=Oe&&i>0?m/i:0,me=Qe>0&&Y?Y(Qe):Qe>0?`${parseFloat((Qe*100).toFixed(2))} \xA2`:fn,st=d==="authenticated",ht=d==="authenticating"||d==="deauthenticating",ve=st&&(x||S),Xe=react.useCallback(I=>q?.[I]??w(I==="yes"?"predict.trade.yes":"predict.trade.no"),[q,w]),Ne=react.useMemo(()=>{if(ht)return w("predict.trade.checkingLogin");if(!st)return w("predict.trade.loginToTrade");if(x)return w("predict.trade.kycRequired");if(S)return w("predict.trade.setupRequired");if(P)return w("predict.trade.loadingBalance");if(c)return w("predict.trade.loadingMarketData");if(f)return w("predict.trade.submitting");if(h)return w("predict.trade.kycRequired");if(!Oe)return w("predict.trade.enterAmount");let I=Xe(n);return `${w("predict.trade.sell")} ${I}`},[ht,st,x,S,P,c,f,h,Oe,n,Xe,w]),Tt=()=>{if(!st){qe(false),Ge();return}if(x){_e.onOpen();return}if(S&&k){qe(false),k();return}if(h){_e.onOpen();return}if(!p){qe(true);return}qe(false),Ge();};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:"text-bearish",children:[w("predict.trade.sell")," ",Xe(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[v?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:I=>N(I),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&v?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:et,onChange:I=>Ot(I.target.value),onFocus:()=>{it.current=true;},onBlur:()=>{it.current=false,isNaN(a)?Ie(""):Ie(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"}}):gt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:gt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(I=>{let Ce=I==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>te(I),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===I?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:Xe(I)}),Ce!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:Y?Y(Number(Ce)):`${parseFloat((Number(Ce)*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:w("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(I=>{let Ce=Math.pow(10,C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{E(Math.floor(R*I/100*Ce)/Ce);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[I,"%"]},I)}),jsxRuntime.jsx("button",{type:"button",onClick:J,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Ye,onChange:I=>Ct(I.target.value),onFocus:()=>{we.current=true;},onBlur:()=>{we.current=false,ot(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"}}),dt&&g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:g.map(I=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:I},I))})]}),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:w("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:P?"\u2013":`${be(y,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:P?"\u2013":M>0?`-${be(M,C).toFixed(C)}${w("predict.trade.sharesUnit")}`:`0${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:P?"\u2013":`${be(R,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:"\u2013"})]})]}),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:()=>Nt(I=>!I),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",Re&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:Y&&Number.isFinite(s)?Yt:We!=null?w("predict.trade.chance",{percent:We}):fn})]}),Re&&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:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?kr(i):fn})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${l.toFixed(2)}`:fn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${(u??0).toFixed(2)}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturnAfterFees")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${m.toFixed(2)}`:fn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:me})]})]})]}),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:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:_,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[U],onSelectionChange:I=>{let Ce=Array.from(I)[0];Ce&&se(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:fm.map(I=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(gm[I])},I))}),U==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(Q)?void 0:Q,onValueChange:Ve,minValue:1,step:1,formatOptions:bm,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[H],onSelectionChange:I=>{let Ce=Array.from(I)[0];Ce&&je(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:hm.map(I=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(vm[I])},I))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:ht||st&&!ve&&(P||c||!Oe||f),isLoading:ht||st&&!ve&&(f||P||c),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Tt,children:Ne})]}),jsxRuntime.jsx(Gn,{isOpen:_e.isOpen,onClose:_e.onClose,kycUrl:b})]})}function oo({event:e,market:t,variant:r,initialOutcome:n,initialPositionSide:o,chain:i,slippageBps:a,onOutcomeChange:s,onSetupRequired:l,onSuccess:u,oddsFormatter:m,outcomeLabels:c}){let{outcome:f,orderType:d,quantity:p,limitPrice:g,effectivePrice:v,grossReturn:h,estimatedFee:x,estimatedReturn:S,pricePerShare:k,isMarketDataLoading:b,isSubmitting:y,authStatus:M,validation:R,supportsLimitOrder:P,kycRequired:C,needsKyc:_,needsSetup:U,kycUrl:Q,totalShares:H,activeOrderShares:Y,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:B,customDuration:J,customDurationUnit:de,setOutcome:se,setOrderType:Ve,setQuantity:je,setLimitPrice:Ge,setSellAll:w,setExpirationEnabled:dt,setExpirationPreset:qe,setCustomDuration:Re,setCustomDurationUnit:Nt,submit:_e}=ca({market:t,initialOutcome:n,initialPositionSide:o,slippageBps:a,onSuccess:u}),Ye=walletConnector.useAuthCallback(_e),ot=react.useCallback(Ie=>{se(Ie),s?.(Ie);},[se,s]),we=react.useMemo(()=>e?Fn(e):void 0,[e]),et=react.useMemo(()=>Bn(t,{yesBid:f==="yes"?k:void 0,noBid:f==="no"?k:void 0}),[t,f,k]);return jsxRuntime.jsx(va,{event:we,market:et,variant:r,outcome:f,orderType:d,quantity:p,limitPrice:g,effectivePrice:v,grossReturn:h,estimatedFee:x,estimatedReturn:S,isMarketDataLoading:b,isSubmitting:y,authStatus:M,isValid:R.isValid,validationErrors:R.errors,supportsLimitOrder:P,kycRequired:C,needsKyc:_,needsSetup:U,onSetupRequired:l,kycUrl:Q,totalShares:H,activeOrderShares:Y,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:B,customDuration:J,customDurationUnit:de,oddsFormatter:m,outcomeLabels:c,onOutcomeChange:ot,onOrderTypeChange:Ve,onQuantityChange:je,onLimitPriceChange:Ge,onSellAll:w,onExpirationEnabledChange:dt,onExpirationPresetChange:qe,onCustomDurationChange:Re,onCustomDurationUnitChange:Nt,onSubmit:Ye})}var si="predict-sell";function xa({id:e=si}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Mm,{...t})})}function Mm({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(oo,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialPositionSide:e.initialPositionSide,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),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 ci=40,ao=36,vn=480,di=vn-ao;function Sa({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(c=>c.slug)??[],[e.markets]),{data:s}=reactPredict.usePositionsMulti({kalshi_user:e.source==="kalshi"?t:void 0,polymarket_user:e.source==="polymarket"?t:void 0}),l=react.useMemo(()=>!s?.positions||!t?0:a.length===0?s.positions.length:s.positions.filter(c=>c.market&&a.includes(c.market.slug)).length,[s?.positions,a,t]),m=[{key:"positions",label:l>0?`${n("predict.positions.title")} (${l})`: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(c=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(c.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===c.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:c.label},c.key))}),t?jsxRuntime.jsxs("div",{style:{height:vn},children:[o==="positions"&&jsxRuntime.jsx(Om,{source:e.source,walletAddress:t,marketSlugs:a}),o==="orders"&&jsxRuntime.jsx(Am,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(Hm,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:vn},children:n("predict.trade.connectWallet")})]})}function Om({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositionsMulti({kalshi_user:e==="kalshi"?t:void 0,polymarket_user:e==="polymarket"?t:void 0}),a=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(s=>s.market&&r.includes(s.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(pi,{}):a.length===0?jsxRuntime.jsx(ui,{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:ao},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:di},rowComponent:Dm,rowCount:a.length,rowHeight:ci,rowProps:{positions:a,closeLabel:n("predict.positions.close")}})]})}function Dm({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,s=o.avg_price??0,l=o.current_price??0,u=i>0?"text-success":i<0?"text-danger":"text-foreground",m=i>0?"+":"",c=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",f=o.side,d=o.size,p=o.size*l,g=o.market?.end_at?Um(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:c}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",f.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:f})]})}),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:["$",p.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:io(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:io(l)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",u),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 Am({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:a,fetchNextPage:s,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),u=reactPredict.useCancelOrder(),m=react.useMemo(()=>{let h=i?.pages?.flatMap(k=>k.items)??[],x=new Set(["live","open","submitted","pending"]),S=h.filter(k=>x.has(k.status));return r.length>0&&(S=S.filter(k=>k.market_id&&r.includes(k.market_id))),S},[i?.pages,r]),c=react.useCallback(h=>{n?n(h.id):u.mutate({source:h.source,id:h.id});},[n,u]),f=m.length,d=f+(l?1:0),p=react.useCallback(h=>h<f,[f]),g=react.useCallback(async()=>{await s();},[s]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:g,rowCount:d,threshold:5});return a?jsxRuntime.jsx(pi,{}):m.length===0&&!l?jsxRuntime.jsx(ui,{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:ao},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:di},onRowsRendered:v,rowComponent:Fm,rowCount:d,rowHeight:ci,rowProps:{orders:m,itemCount:f,onCancel:c,isCancelling:u.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function Fm({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$1.Spinner,{size:"sm"})});let s=r[e];if(!s)return null;let l=s.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",l?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:s.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:s.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:s.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:s.price?io(parseFloat(s.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[s.size_matched??"0","/",s.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Bm,{status:s.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(s),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):a})})]})}function Bm({status:e}){return jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Hm({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}),s=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),l=s.length,u=l+(a?1:0),m=react.useCallback(d=>d<l,[l]),c=react.useCallback(async()=>{await i();},[i]),f=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:c,rowCount:u,threshold:5});return o?jsxRuntime.jsx(pi,{}):s.length===0&&!a?jsxRuntime.jsx(ui,{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:ao},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:di},onRowsRendered:f,rowComponent:zm,rowCount:u,rowHeight:ci,rowProps:{trades:s,itemCount:l}})]})}function zm({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$1.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",a=Wm(o.timestamp),s=o.price??0,l=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$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children: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:io(s)}),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:["$",l.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:a})]})}function ui({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:vn},children:e})}function pi(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:vn},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function io(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Wm(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 Um(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Pa=`
|
|
74
|
+
`).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:fp.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 ra({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i,i18n:a}=i18n.useTranslation(),{mutateAsync:s}=reactPredict.useRedeemPosition(),{start:c}=reactPredict.useTradeResultConfirmation(),{evmAddress:u}=yr(),m=walletConnector.useWallets(),[l,f]=react.useState("idle"),[d,p]=react.useState(null),g=t.provider_meta?.["polymarket.conditionId"],v=t.provider_meta?.["polymarket.negRisk"]??false,h=u??"",x=react.useMemo(()=>Wr(i,a),[a,i]),S=react.useMemo(()=>m.find(Y=>Y.chainNamespace===types.ChainNamespace.EVM&&Y.isConnected),[m]),k=ta(r.side,t.outcomes),y=t.outcomes?.[k]?.label??r.side,M=t.result!=null?ta(t.result,t.outcomes):-1,P=(M>=0?t.outcomes?.[M]:void 0)?.label??t.result??"",C=t.result!=null?k===M:true,_=react.useMemo(()=>C?r.size:0,[C,r.size]),U=react.useCallback(async()=>{if(!(!g||!h||!S)){f("pending"),p(null);try{let Y=await S.getEip1193Provider();if(!Y)throw new Error("EIP-1193 provider unavailable");await s({wallet_address:h,condition_id:g,neg_risk:v,signMessage:async N=>await Y.request({method:"personal_sign",params:[N,h]}),signTypedData:async N=>await Y.request({method:"eth_signTypedData_v4",params:[h,JSON.stringify(N)]})}),f("confirming");let q=Ur({messages:x});q.submitted(),await c({source:r.source,user:h,marketSlug:r.market?.slug??t.slug,eventSlug:r.event?.slug??e?.slug,expectation:"redeem",expectedPayout:_})==="confirmed"?(f("success"),q.completed()):(f("delayed"),q.delayed()),n?.();}catch(Y){f("error"),p(Y instanceof Error?Y.message:i("predict.redeem.error"));}}},[g,h,v,S,s,x,c,r.source,r.market?.slug,r.event?.slug,t.slug,e?.slug,_,n,i]),Q=walletConnector.useAuthCallback(U),H=l==="idle"&&!!g&&!!h&&!!S&&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(Zn,{label:i("predict.positions.side"),value:y,valueClassName:C?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(Zn,{label:i("predict.redeem.result"),value:P,valueClassName:"text-green-400"}),jsxRuntime.jsx(Zn,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(Zn,{label:i("predict.redeem.expectedPayout"),value:`$${_.toFixed(2)}`,valueClassName:_>0?"text-green-400":"text-zinc-400"})]}),!C&&_===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),l==="error"&&d&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:d}),l==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),l==="delayed"&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-400",children:i("predict.trade.resultDelayed",{defaultValue:"Your trade was submitted successfully. Confirmation is taking a little longer."})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[l!=="success"&&l!=="delayed"&&jsxRuntime.jsx(ui$1.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!H,isLoading:l==="pending"||l==="confirming",onPress:Q,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&l!=="success"&&l!=="delayed"&&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")}),(l==="success"||l==="delayed")&&o&&jsxRuntime.jsx(ui$1.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function Zn({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 ta(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 oa({id:e=Ep}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Lp,{...t})})}function Lp({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className: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(ra,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function ri(e){return e?.trim().toLowerCase()??""}function ti(e,t){let r=e.provider_meta?.[t];return typeof r=="string"?r:""}function la(e,t){return !!(e&&t&&e.trim().toLowerCase().includes(t))}function sm(e,t){let r=ri(e.side);if(r==="yes"||r==="no")return r;if(r==="over"||r==="odd")return "yes";if(r==="under"||r==="even")return "no";let n=[t.outcomes?.[0]?.label,ti(t,"polymarket.groupItemTitle"),ti(t,"polymarket.groupItemTitleTrans"),ti(t,"polymarket.group_item_title_trans")],o=[t.outcomes?.[1]?.label];return n.some(i=>la(i,r))?"yes":o.some(i=>la(i,r))?"no":null}function ca({market:e,initialOutcome:t="yes",initialPositionSide:r,slippageBps:n=100,onSuccess:o}){let{t:i,i18n:a}=i18n.useTranslation(),s=react.useRef(o);s.current=o;let{status:c}=walletConnector.useAuth(),u=walletConnector.useWallets(),m=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),f=reactQuery.useQueryClient(),{start:d}=reactPredict.useTradeResultConfirmation(),p=e.source,g=p==="polymarket",v=u.find(T=>T.chainNamespace===types.ChainNamespace.SOLANA&&T.isConnected),h=u.find(T=>T.chainNamespace===types.ChainNamespace.EVM&&T.isConnected&&"switchChain"in T),x=c==="authenticated",S=v?.address,k=h?.address,[b,y]=react.useState(t),[M,R]=react.useState("market"),[P,C]=react.useState(NaN),[_,U]=react.useState(NaN),[Q,H]=react.useState(false),[Y,q]=react.useState(false),[te,N]=react.useState(null),[E,B]=react.useState(null),[J,de]=react.useState(false),[se,Ve]=react.useState(false),[je,Ge]=react.useState("1h"),[w,ft]=react.useState(30),[qe,Le]=react.useState("minutes"),Nt=react.useMemo(()=>Wr(i,a),[a,i]),Re=true,Ye=react.useCallback(async(T,Se)=>{let Pe=Ur({messages:Nt});Pe.submitted(),await d({source:p,user:p==="kalshi"?S:k,kalshiUser:Re?S:void 0,polymarketUser:k,marketSlug:e.slug,eventSlug:e.event_slug,expectation:T,getOrdersHeaders:Se})==="confirmed"?Pe.completed():Pe.delayed();},[d,Re,k,e.event_slug,e.slug,p,Nt,S]),ot=react.useMemo(()=>{if(p!=="polymarket")return;let T=e.provider_meta?.["polymarket.clobTokenIds"];return T?(typeof T=="string"?JSON.parse(T):T)[b==="yes"?0:1]:void 0},[p,e.provider_meta,b]),{data:_e,isLoading:et}=reactPredict.useTickSize(ot),Ie=reactPredict.normalizePolymarketTickSize(_e?.minimum_tick_size),{data:it,isLoading:Ot}=reactPredict.useFeeRate(ot),Ct=String(it?.base_fee??0),{data:Mt}=reactPredict.useRebateConfig(),tt=Mt?.builder_enabled&&Mt.builder_code?Mt.builder_code:void 0,gt=false,We=null,qt=false,Oe,Qe,me;try{let T=yr();Re=T.enableKalshi,gt=T.kalshiKycVerified,We=T.kalshiKycUrl,qt=T.polymarketSetupVerified,Oe=T.polymarketSafeAddress,Qe=T.polymarketWalletKind,me=T.polymarketWalletAddress;}catch{}let st=p==="kalshi"&&!gt,ht=p==="polymarket"&&!qt,ve=react.useCallback(async()=>{if(!h||!l)return null;let T=await h.getEip1193Provider();if(!T)return null;let Se=Qe==="deposit"&&!!me,Pe=!Se&&!!Oe,De={address:h.address,signatureType:Se?3:Pe?2:0,signTypedData:async(dt,Zt,zt,Ae)=>{let ar=[];"name"in dt&&ar.push({name:"name",type:"string"}),"version"in dt&&ar.push({name:"version",type:"string"}),"chainId"in dt&&ar.push({name:"chainId",type:"uint256"}),"verifyingContract"in dt&&ar.push({name:"verifyingContract",type:"address"}),"salt"in dt&&ar.push({name:"salt",type:"bytes32"});let Rn={EIP712Domain:ar,...Zt};return await T.request({method:"eth_signTypedData_v4",params:[h.address,JSON.stringify({domain:dt,types:Rn,primaryType:zt,message:Ae})]})}};return l.credentials??await l.authenticate(De)},[Oe,Qe,me,h,l]),{data:Xe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:b},{enabled:e.status==="open"}),we=react.useMemo(()=>{let T=reactPredict.pickBestBid(Xe,b);if(T!=null&&T>0)return T;let Se=b==="yes"?0:1,Pe=e.outcomes[Se];return Pe?.best_bid??Pe?.price??.5},[Xe,e.outcomes,b]),Tt=p==="kalshi"?S??"":k??"",{data:I,isLoading:Ne}=reactPredict.usePositionsMulti({kalshi_user:p==="kalshi"?Tt:void 0,polymarket_user:p==="polymarket"?Tt:void 0},{enabled:!!Tt,refetchInterval:3e4}),Ue=ri(r),Jr=r?.trim(),A=react.useMemo(()=>I?I.positions.find(T=>T.market?.slug!==e.slug?false:Ue?ri(T.side)===Ue:sm(T,e)===b)??null:null,[I,e,e.slug,b,Ue]),Ce=Jr||A?.side||b,vt=react.useCallback(async()=>{let T=await ve();return T?await reactPredict.buildPolymarketL2Headers(T.address,{apiKey:T.apiKey,secret:T.secret,passphrase:T.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[ve]),{data:Dt,isLoading:Zr}=reactPredict.useAvailableShares({source:p,user:Tt,market:e.slug,side:Ce},p==="polymarket"?{getHeaders:vt}:void 0,{enabled:!!Tt&&!!e.slug,refetchOnMount:"always"}),Co=e.provider_meta?.["dflow.yesMint"]??"",Mo=e.provider_meta?.["dflow.noMint"]??"",Yt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Lr=e.provider_meta?.["dflow.collateralMint"]||"",To=b==="yes"?Co:Mo,at=react.useMemo(()=>p==="polymarket"?reactPredict.getPolymarketSharesPrecision(Ie):Dt?.precision??0,[p,Ie,Dt?.precision]),Et=Dt?.active_order_shares??0,Rr=p==="polymarket"&&!!A?.size&&(Dt?.total_shares??0)<=0&&(Dt?.available_shares??0)<=0,en=Rr?A?.size??0:0,_r=Rr?en:Dt?.total_shares??0,sr=Rr?Math.max(0,en-Et):Dt?.available_shares??0,Eo=Zr||Ne,Tn=A?.market?.provider_meta,Ir=Tn?.["dflow.outcomeMint"]||To,Qt=Tn?.["dflow.collateralMint"]||Lr,fr=Ir,gr=Qt||Yt,hr=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),tn=p==="kalshi"&&!!fr&&!!gr&&!!S&&hr!=="0",{refetch:rn}=reactPredict.useDFlowQuote({inputMint:fr,outputMint:gr,amount:hr,userPublicKey:S??"",slippageBps:100},{enabled:tn}),Or=react.useMemo(()=>isNaN(P)||P<=0?0:P,[P]),Lt=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Xe,outcome:b,side:"sell",sharesNeeded:Or,slippageBps:n}),[Xe,b,Or,n]),O=react.useMemo(()=>Lt.status==="ok"&&Lt.worstPrice!=null&&Lt.worstPrice>0?Lt.worstPrice:we,[Lt,we]),Me=react.useMemo(()=>M==="limit"&&g&&!isNaN(_)?_:O,[M,g,_,O]),ke=react.useMemo(()=>isNaN(P)||P<=0?0:P*Me,[P,Me]),Rt=react.useMemo(()=>p!=="polymarket"?0:os({grossReturn:ke,pricePerShare:Me,feeRateBps:Number(Ct)}),[p,ke,Me,Ct]),nn=react.useMemo(()=>Math.max(0,ke-Rt),[ke,Rt]),Xt=react.useCallback(T=>{y(T),U(NaN),C(NaN),q(false);},[]);react.useEffect(()=>{Xt(t);},[t,Xt]);let Jt=react.useCallback(T=>{R(T);},[]);react.useEffect(()=>{M==="limit"&&U(Math.round(we*1e4)/1e4);},[M,b]);let lt=react.useCallback(T=>{if(q(false),isNaN(T)){C(NaN);return}C(be(Math.max(0,T),at));},[at]),Lo=react.useCallback(()=>{q(true),C(be(sr,at));},[sr,at]),En=react.useCallback(T=>{if(isNaN(T)){U(NaN);return}U(Math.round(T*1e4)/1e4);},[]),Ht=react.useCallback(()=>{C(NaN),U(NaN),R("market"),q(false),Ve(false),Ge("1h"),ft(30),Le("minutes");},[]),Dr=react.useMemo(()=>{let T=[];return isNaN(P)||P<=0?T.push(i("predict.trade.minQuantity",{amount:Hn})):P<Hn&&T.push(i("predict.trade.minQuantity",{amount:Hn})),e.status!=="open"&&T.push(i("predict.trade.marketNotActive")),!isNaN(P)&&P>0&&!Y&&P>sr&&T.push(i("predict.trade.insufficientSharesDetail",{total:be(_r,at).toFixed(at),active:be(Et,at).toFixed(at),available:be(sr,at).toFixed(at)})),M==="limit"&&g&&(isNaN(_)||_<.01||_>.99)&&T.push(i("predict.trade.limitPriceRange")),M==="limit"&&g&&se&&je==="custom"&&(isNaN(w)||w<=0)&&T.push(i("predict.trade.expiration.invalidDate")),p==="polymarket"&&M==="market"&&!isNaN(P)&&P>0&&(Lt.status==="insufficient_liquidity"?T.push(i("predict.trade.insufficientLiquidity",{available:be(Lt.totalAvailable,2)})):Lt.status==="exceeds_slippage"&&T.push(i("predict.trade.priceImpactTooHigh",{impact:(Lt.priceImpactBps/100).toFixed(2),slippage:(n/100).toFixed(2)}))),{isValid:T.length===0,errors:T}},[P,e.status,sr,_r,Et,Y,M,g,_,se,je,w,at,p,Lt,n,i]),{mutateAsync:Ar}=reactPredict.useDFlowSubmit(),{data:vr}=reactPredict.useOrder({id:te??"",source:p},{enabled:!!te}),Ln=react.useCallback(async()=>{if(!E||!S||!v)return;let{cashAmount:T,collateral:Se}=E;B(null);try{let De=(await m.createDFlowQuote({inputMint:Se,outputMint:Yt,amount:T,userPublicKey:S,slippageBps:100}))?.transaction;if(!De)return;let dt=Uint8Array.from(atob(De),zt=>zt.charCodeAt(0)),Zt=await v.signTransaction(dt);await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:S,input_mint:Se,output_mint:Yt,amount:T,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[E,S,v,m,Ar,Yt]),br=react.useCallback(()=>{f.invalidateQueries({queryKey:["predict","available-shares"]});},[f]);react.useEffect(()=>{if(!vr||!te)return;let{status:T}=vr;T==="closed"?(N(null),E?Ln().finally(()=>{H(false),Ye("sell-market"),br(),Ht(),s.current?.();}):(H(false),Ye("sell-market"),br(),Ht(),s.current?.())):(T==="failed"||T==="expired")&&(H(false),N(null),B(null),ui$1.toast.error(i("predict.trade.submitError")));},[vr,te,E,Ln,Ye,br,Ht,i]);let Fr=react.useCallback(async()=>{if(!S||!v)return;if(!fr||!gr){ui$1.toast.error("Missing token mint addresses"),H(false);return}if(!gt){de(true),H(false);return}let Pe=(await rn()).data,De=Pe?.transaction;if(!De){ui$1.toast.error(i("predict.trade.submitError")),H(false);return}if(Qt&&Qt!==Yt){let Ae=String(Pe?.outAmount??"");Ae&&Ae!=="0"&&B({cashAmount:Ae,collateral:Qt});}let dt=Uint8Array.from(atob(De),Ae=>Ae.charCodeAt(0)),Zt=await v.signTransaction(dt),zt=await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:S,input_mint:fr,output_mint:gr,amount:hr,price:String(we),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});N(zt.signature);},[S,v,rn,Ar,fr,gr,hr,we,b,e.slug,Qt,Yt,i,gt]),Br=react.useCallback(async()=>{if(!h||!l)return;let T=h.chain,Se=T!==types.Chain.POLYGON;Se&&await h.switchChain(types.Chain.POLYGON);try{let Pe=await h.getEip1193Provider();if(!Pe){ui$1.toast.error(i("predict.trade.submitError")),H(!1);return}let De=Qe==="deposit"&&!!me,dt=!De&&!!Oe,Zt=De?me:Oe,zt={address:h.address,signatureType:De?3:dt?2:0,signTypedData:async(Wt,In,Io,Oo)=>{let Hr=[];"name"in Wt&&Hr.push({name:"name",type:"string"}),"version"in Wt&&Hr.push({name:"version",type:"string"}),"chainId"in Wt&&Hr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Wt&&Hr.push({name:"verifyingContract",type:"address"}),"salt"in Wt&&Hr.push({name:"salt",type:"bytes32"});let Ec={EIP712Domain:Hr,...In};return await Pe.request({method:"eth_signTypedData_v4",params:[h.address,JSON.stringify({domain:Wt,types:Ec,primaryType:Io,message:Oo})]})}},Ae=await ve();if(!Ae){ui$1.toast.error(i("predict.trade.submitError")),H(!1);return}let ar=b==="yes"?0:1,Rn="",_n=e.provider_meta?.["polymarket.clobTokenIds"];_n&&(Rn=(typeof _n=="string"?JSON.parse(_n):_n)[ar]??"");let $i=e.provider_meta?.["polymarket.negRisk"]??!1,Mc=M==="limit"&&!isNaN(_)?_:O,Tc=Un(Mc,Ie),Ro={tokenId:Rn,price:Tc,size:P,side:"SELL",orderType:M==="limit"?se?"GTD":"GTC":"FOK",tickSize:Ie,negRisk:$i,...Zt&&{funderAddress:Zt},...tt&&{builderCode:tt},...M==="limit"&&se&&{expiration:Wn(je,w,qe)}},_o;if(De)_o=await reactPredict.buildSignedV2OrderPayload({signer:zt,depositWalletAddress:Zt,input:Ro,owner:Ae.apiKey});else {let Wt=reactPredict.buildCtfExchangeDomain($i),In=reactPredict.buildOrderMessage({...Ro,signerAddress:zt.address,signatureType:zt.signatureType,feeRateBps:Ct}),Io=await zt.signTypedData(Wt,reactPredict.CTF_ORDER_TYPES,"Order",In),Oo=reactPredict.buildSignedOrder(In,Io,Ro.orderType);_o=reactPredict.buildClobPayload(Oo,Ae.apiKey);}await m.executePolymarketOrder({payload:_o,l2_api_key:Ae.apiKey,l2_secret:Ae.secret,l2_passphrase:Ae.passphrase,signer_address:Ae.address,owner:Ae.apiKey}),br(),Ye(M==="limit"?"sell-limit":"sell-market",async()=>await reactPredict.buildPolymarketL2Headers(Ae.address,{apiKey:Ae.apiKey,secret:Ae.secret,passphrase:Ae.passphrase,method:"GET",requestPath:"/data/orders"})),Ht(),H(!1),s.current?.();}finally{Se&&T&&h.switchChain(T).catch(()=>{});}},[h,l,ve,b,e.provider_meta,M,Ye,_,O,P,m,br,se,je,w,qe,Ht,i,Ie,Ct,e.slug,Oe,Qe,me,tt]),_t=react.useCallback(async()=>{if(!(!Dr.isValid||!x)){H(true),N(null),de(false);try{p==="kalshi"?await Fr():await Br();}catch(T){let Se=T instanceof Error?T.message:"",Pe=p==="polymarket"&&Se?$n(Se,i,"sell"):Se||void 0;ui$1.toast.error(Pe||i("predict.trade.submitError")),H(false);}}},[Dr.isValid,x,p,Fr,Br,i]);return {outcome:b,orderType:M,quantity:P,limitPrice:_,shares:Or,effectivePrice:Me,grossReturn:ke,estimatedFee:Rt,estimatedReturn:nn,pricePerShare:we,isMarketDataLoading:p==="polymarket"&&(Ot||et),isSubmitting:Q,authStatus:c,validation:Dr,supportsLimitOrder:g,kycRequired:J,needsKyc:st,needsSetup:ht,kycUrl:We,totalShares:_r,activeOrderShares:Et,availableShares:sr,isAvailableLoading:Eo,isSellAll:Y,precision:at,expirationEnabled:se,expirationPreset:je,customDuration:w,customDurationUnit:qe,setOutcome:Xt,setOrderType:Jt,setQuantity:lt,setLimitPrice:En,setSellAll:Lo,setExpirationEnabled:Ve,setExpirationPreset:Ge,setCustomDuration:ft,setCustomDurationUnit:Le,submit:_t}}var hm=["5m","1h","12h","24h","eod","custom"],vm={"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"},bm=["minutes","hours","days"],xm={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},ym={maximumFractionDigits:0},pn="-";function va({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,effectivePrice:s,grossReturn:c,estimatedFee:u,estimatedReturn:m,isMarketDataLoading:l,isSubmitting:f,authStatus:d,isValid:p,validationErrors:g,supportsLimitOrder:v,kycRequired:h,needsKyc:x,needsSetup:S,onSetupRequired:k,kycUrl:b,totalShares:y,activeOrderShares:M,availableShares:R,isAvailableLoading:P,precision:C,expirationEnabled:_,expirationPreset:U,customDuration:Q,customDurationUnit:H,oddsFormatter:Y,outcomeLabels:q,onOutcomeChange:te,onOrderTypeChange:N,onQuantityChange:E,onLimitPriceChange:B,onSellAll:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[ft,qe]=react.useState(false),[Le,Nt]=react.useState(true),Re=ui$1.useDisclosure(),[Ye,ot]=react.useState(""),_e=react.useRef(false);react.useEffect(()=>{_e.current||ot(isNaN(i)?"":String(i));},[i]);let[et,Ie]=react.useState(""),it=react.useRef(false);react.useEffect(()=>{it.current||(isNaN(a)?Ie(""):Ie(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ot=react.useCallback(I=>{if(I!==""&&!/^\d*\.?\d{0,2}$/.test(I))return;if(Ie(I),I===""||I==="."){B(NaN);return}let Ue=parseFloat(I);isNaN(Ue)||B(Ue/100);},[B]),Ct=react.useCallback(I=>{let Ne=new RegExp(`^\\d*\\.?\\d{0,${C}}$`);if(I!==""&&!Ne.test(I))return;if(ot(I),qe(false),I===""||I==="."){E(NaN);return}let Ue=parseFloat(I);isNaN(Ue)||E(Ue);},[E,C]);react.useEffect(()=>{h&&!Re.isOpen&&Re.onOpen();},[h]);let Mt=react.useMemo(()=>{let I=n==="yes"?t.yesBid:t.noBid;return I!=null?parseFloat((Number(I)*100).toFixed(2)):null},[n,t]),tt=n==="yes"?t.yesBid:t.noBid,gt=tt!=null&&Y?Y(Number(tt)):Mt!=null?`${Mt} \xA2`:null,We=Number.isFinite(s)?parseFloat((s*100).toFixed(2)):null,qt=Number.isFinite(s)&&Y?Y(s):We!=null?`${We} \xA2`:null,Oe=!isNaN(i)&&i>0,Qe=Oe&&i>0?m/i:0,me=Qe>0&&Y?Y(Qe):Qe>0?`${parseFloat((Qe*100).toFixed(2))} \xA2`:pn,st=d==="authenticated",ht=d==="authenticating"||d==="deauthenticating",ve=st&&(x||S),Xe=react.useCallback(I=>q?.[I]??w(I==="yes"?"predict.trade.yes":"predict.trade.no"),[q,w]),we=react.useMemo(()=>{if(ht)return w("predict.trade.checkingLogin");if(!st)return w("predict.trade.loginToTrade");if(x)return w("predict.trade.kycRequired");if(S)return w("predict.trade.setupRequired");if(P)return w("predict.trade.loadingBalance");if(l)return w("predict.trade.loadingMarketData");if(f)return w("predict.trade.submitting");if(h)return w("predict.trade.kycRequired");if(!Oe)return w("predict.trade.enterAmount");let I=Xe(n);return `${w("predict.trade.sell")} ${I}`},[ht,st,x,S,P,l,f,h,Oe,n,Xe,w]),Tt=()=>{if(!st){qe(false),Ge();return}if(x){Re.onOpen();return}if(S&&k){qe(false),k();return}if(h){Re.onOpen();return}if(!p){qe(true);return}qe(false),Ge();};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:"text-bearish",children:[w("predict.trade.sell")," ",Xe(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[v?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:I=>N(I),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&v?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:et,onChange:I=>Ot(I.target.value),onFocus:()=>{it.current=true;},onBlur:()=>{it.current=false,isNaN(a)?Ie(""):Ie(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"}}):gt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:gt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(I=>{let Ne=I==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>te(I),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===I?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:Xe(I)}),Ne!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:Y?Y(Number(Ne)):`${parseFloat((Number(Ne)*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:w("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(I=>{let Ne=Math.pow(10,C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{E(Math.floor(R*I/100*Ne)/Ne);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[I,"%"]},I)}),jsxRuntime.jsx("button",{type:"button",onClick:J,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Ye,onChange:I=>Ct(I.target.value),onFocus:()=>{_e.current=true;},onBlur:()=>{_e.current=false,ot(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"}}),ft&&g.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:g.map(I=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:I},I))})]}),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:w("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:P?"\u2013":`${be(y,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:P?"\u2013":M>0?`-${be(M,C).toFixed(C)}${w("predict.trade.sharesUnit")}`:`0${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:P?"\u2013":`${be(R,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:"\u2013"})]})]}),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:()=>Nt(I=>!I),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",Le&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:Y&&Number.isFinite(s)?qt:We!=null?w("predict.trade.chance",{percent:We}):pn})]}),Le&&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:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?kr(i):pn})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${c.toFixed(2)}`:pn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${(u??0).toFixed(2)}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturnAfterFees")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${m.toFixed(2)}`:pn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:me})]})]})]}),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:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:_,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),_&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[U],onSelectionChange:I=>{let Ne=Array.from(I)[0];Ne&&se(Ne);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:hm.map(I=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(vm[I])},I))}),U==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(Q)?void 0:Q,onValueChange:Ve,minValue:1,step:1,formatOptions:ym,classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui$1.Select,{"aria-label":"Duration unit",selectedKeys:[H],onSelectionChange:I=>{let Ne=Array.from(I)[0];Ne&&je(Ne);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:bm.map(I=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(xm[I])},I))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:ht||st&&!ve&&(P||l||!Oe||f),isLoading:ht||st&&!ve&&(f||P||l),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Tt,children:we})]}),jsxRuntime.jsx(Vn,{isOpen:Re.isOpen,onClose:Re.onClose,kycUrl:b})]})}function ro({event:e,market:t,variant:r,initialOutcome:n,initialPositionSide:o,chain:i,slippageBps:a,onOutcomeChange:s,onSetupRequired:c,onSuccess:u,oddsFormatter:m,outcomeLabels:l}){let{outcome:f,orderType:d,quantity:p,limitPrice:g,effectivePrice:v,grossReturn:h,estimatedFee:x,estimatedReturn:S,pricePerShare:k,isMarketDataLoading:b,isSubmitting:y,authStatus:M,validation:R,supportsLimitOrder:P,kycRequired:C,needsKyc:_,needsSetup:U,kycUrl:Q,totalShares:H,activeOrderShares:Y,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:B,customDuration:J,customDurationUnit:de,setOutcome:se,setOrderType:Ve,setQuantity:je,setLimitPrice:Ge,setSellAll:w,setExpirationEnabled:ft,setExpirationPreset:qe,setCustomDuration:Le,setCustomDurationUnit:Nt,submit:Re}=ca({market:t,initialOutcome:n,initialPositionSide:o,slippageBps:a,onSuccess:u}),Ye=walletConnector.useAuthCallback(Re),ot=react.useCallback(Ie=>{se(Ie),s?.(Ie);},[se,s]),_e=react.useMemo(()=>e?Dn(e):void 0,[e]),et=react.useMemo(()=>An(t,{yesBid:f==="yes"?k:void 0,noBid:f==="no"?k:void 0}),[t,f,k]);return jsxRuntime.jsx(va,{event:_e,market:et,variant:r,outcome:f,orderType:d,quantity:p,limitPrice:g,effectivePrice:v,grossReturn:h,estimatedFee:x,estimatedReturn:S,isMarketDataLoading:b,isSubmitting:y,authStatus:M,isValid:R.isValid,validationErrors:R.errors,supportsLimitOrder:P,kycRequired:C,needsKyc:_,needsSetup:U,onSetupRequired:c,kycUrl:Q,totalShares:H,activeOrderShares:Y,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:B,customDuration:J,customDurationUnit:de,oddsFormatter:m,outcomeLabels:l,onOutcomeChange:ot,onOrderTypeChange:Ve,onQuantityChange:je,onLimitPriceChange:Ge,onSellAll:w,onExpirationEnabledChange:ft,onExpirationPresetChange:qe,onCustomDurationChange:Le,onCustomDurationUnitChange:Nt,onSubmit:Ye})}var ii="predict-sell";function xa({id:e=ii}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Em,{...t})})}function Em({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(ro,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialPositionSide:e.initialPositionSide,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),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 li=40,io=36,gn=480,ci=gn-io;function Sa({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(l=>l.slug)??[],[e.markets]),{data:s}=reactPredict.usePositionsMulti({kalshi_user:e.source==="kalshi"?t:void 0,polymarket_user:e.source==="polymarket"?t:void 0}),c=react.useMemo(()=>!s?.positions||!t?0:a.length===0?s.positions.length:s.positions.filter(l=>l.market&&a.includes(l.market.slug)).length,[s?.positions,a,t]),m=[{key:"positions",label:c>0?`${n("predict.positions.title")} (${c})`: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(l=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(l.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===l.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:l.label},l.key))}),t?jsxRuntime.jsxs("div",{style:{height:gn},children:[o==="positions"&&jsxRuntime.jsx(Am,{source:e.source,walletAddress:t,marketSlugs:a}),o==="orders"&&jsxRuntime.jsx(Bm,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(Wm,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:gn},children:n("predict.trade.connectWallet")})]})}function Am({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositionsMulti({kalshi_user:e==="kalshi"?t:void 0,polymarket_user:e==="polymarket"?t:void 0}),a=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(s=>s.market&&r.includes(s.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(ui,{}):a.length===0?jsxRuntime.jsx(di,{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:io},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:ci},rowComponent:Fm,rowCount:a.length,rowHeight:li,rowProps:{positions:a,closeLabel:n("predict.positions.close")}})]})}function Fm({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,s=o.avg_price??0,c=o.current_price??0,u=i>0?"text-success":i<0?"text-danger":"text-foreground",m=i>0?"+":"",l=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",f=o.side,d=o.size,p=o.size*c,g=o.market?.end_at?Km(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:l}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",f.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:f})]})}),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:["$",p.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:no(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:no(c)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",u),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 Bm({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:a,fetchNextPage:s,hasNextPage:c}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),u=reactPredict.useCancelOrder(),m=react.useMemo(()=>{let h=i?.pages?.flatMap(k=>k.items)??[],x=new Set(["live","open","submitted","pending"]),S=h.filter(k=>x.has(k.status));return r.length>0&&(S=S.filter(k=>k.market_id&&r.includes(k.market_id))),S},[i?.pages,r]),l=react.useCallback(h=>{n?n(h.id):u.mutate({source:h.source,id:h.id});},[n,u]),f=m.length,d=f+(c?1:0),p=react.useCallback(h=>h<f,[f]),g=react.useCallback(async()=>{await s();},[s]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:g,rowCount:d,threshold:5});return a?jsxRuntime.jsx(ui,{}):m.length===0&&!c?jsxRuntime.jsx(di,{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:io},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:ci},onRowsRendered:v,rowComponent:Hm,rowCount:d,rowHeight:li,rowProps:{orders:m,itemCount:f,onCancel:l,isCancelling:u.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function Hm({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$1.Spinner,{size:"sm"})});let s=r[e];if(!s)return null;let c=s.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",c?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:s.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:s.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:s.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:s.price?no(parseFloat(s.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[s.size_matched??"0","/",s.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(zm,{status:s.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(s),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):a})})]})}function zm({status:e}){return jsxRuntime.jsx("span",{className:ui$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Wm({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}),s=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),c=s.length,u=c+(a?1:0),m=react.useCallback(d=>d<c,[c]),l=react.useCallback(async()=>{await i();},[i]),f=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:l,rowCount:u,threshold:5});return o?jsxRuntime.jsx(ui,{}):s.length===0&&!a?jsxRuntime.jsx(di,{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:io},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:ci},onRowsRendered:f,rowComponent:Um,rowCount:u,rowHeight:li,rowProps:{trades:s,itemCount:c}})]})}function Um({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$1.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",a=$m(o.timestamp),s=o.price??0,c=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$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children: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:no(s)}),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:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:a})]})}function di({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:gn},children:e})}function ui(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:gn},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function no(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function $m(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 Km(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Pa=`
|
|
75
75
|
@keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
|
76
|
-
`,wa={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 fe(e){return {...wa,animationDelay:`${e}ms`}}function bn({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Pa}),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:{...wa,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:{...fe(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...fe(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...fe(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...fe(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...fe(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...fe(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...fe(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(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:{...fe(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:{...fe(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...fe(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...fe(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...fe(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...fe(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...fe(460),height:14,width:"60%"}})]})]})]})}function Na(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Pa}),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:{...fe(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(120),height:40,width:"100%",borderRadius:8}})]})]})}var La="var(--color-bullish)",Ra="var(--color-bearish)";function xn(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 Vm(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function jm(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let p=Math.round(d.price*100);p>=0&&p<=100&&(r[p]+=d.quantity);}for(let d of t){let p=Math.round(d.price*100);p>=0&&p<=100&&(n[p]+=d.quantity);}let o=0,i=0,a=new Float64Array(101),s=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,a[d]=o,s[d]=i;let l=0,u=0,m=new Float64Array(101),c=new Float64Array(101);for(let d=0;d<=100;d++)l+=n[d],u+=n[d]*d/100,m[d]=l,c[d]=u;let f=Math.max(a[0]??0,m[100]??0);return Array.from({length:101},(d,p)=>{let g=a[p]>0,v=m[p]>0,h=a[p]||m[p],x=r[p]>0||n[p]>0;return {priceCents:p,displayHeight:Vm(h,f),opacity:h>0?x?1:.5:0,isBid:g,isAsk:v,bidCumTotal:a[p],askCumTotal:m[p],bidCumCost:s[p],askCumCost:c[p]}})}function Gm({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?La:Ra,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:xn(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",xn(Math.round(e.cumCost))]})]})}var qm=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,a=t.isBid?La:t.isAsk?Ra: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}})})}),Ym=[0,10,20,30,40,50,60,70,80,90,100];function Qm(){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:Ym.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 _a({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>jm(e,t),[e,t]),o=react.useMemo(()=>{let c=e.length>0?Math.max(...e.map(d=>d.price)):0,f=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((c+f)/2*100)},[e,t]),i=react.useMemo(()=>n.some(c=>c.isBid||c.isAsk),[n]),[a,s]=react.useState(null),l=react.useRef(null),u=react.useCallback((c,f)=>{l.current&&(l.current.style.filter=""),f?(f.style.filter="brightness(1.5)",l.current=f):l.current=null,c.isBid||c.isAsk?s({priceCents:c.priceCents,isBid:c.isBid,cumTotal:c.isBid?c.bidCumTotal:c.askCumTotal,cumCost:c.isBid?c.bidCumCost:c.askCumCost,leftPct:c.priceCents}):s(null);},[]),m=react.useCallback(()=>{l.current&&(l.current.style.filter="",l.current=null),s(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(Gm,{info:a}),n.map(c=>jsxRuntime.jsx(qm,{slot:c,onEnter:u,onLeave:m},c.priceCents))]}),jsxRuntime.jsx(Qm,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function Ba(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Oa(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function Ha({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:n="depth",className:o,oddsFormatter:i}){let{t:a}=i18n.useTranslation(),[s,l]=react.useState(n),u=i??Ba,m=e.source,{data:c,isLoading:f,isFetching:d,refetch:p}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:m,outcome:t}),g=react.useMemo(()=>(c?.bids??[]).map(k=>({price:k.price,quantity:k.size})),[c?.bids]),v=react.useMemo(()=>(c?.asks??[]).map(k=>({price:k.price,quantity:k.size})),[c?.asks]),h=react.useMemo(()=>g.length>0?Math.max(...g.map(k=>k.price)):null,[g]),x=react.useMemo(()=>v.length>0?Math.min(...v.map(k=>k.price)):null,[v]),S=react.useMemo(()=>{if(h==null||x==null)return null;let k=(x-h)*100;return Math.round(k*10)/10},[h,x]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col",o??"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:S!=null?`${a("predict.orderBook.spread")}: ${Number.isInteger(S)?`${S}\xA2`:`${S.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[h!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[a("predict.trade.bestBid"),": ",u(h)]}),h!=null&&x!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),x!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[a("predict.trade.bestAsk"),": ",u(x)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:s==="depth"?"Orderbook":"Depth chart",onClick:()=>l(k=>k==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:s==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>p(),disabled:d,className:ui$1.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",d&&"animate-spin"),children:jsxRuntime.jsx(ui$1.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Oa,{}):jsxRuntime.jsx(_a,{bids:g,asks:v})}),s==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Oa,{}):jsxRuntime.jsx(rf,{bids:g,asks:v,bestBid:h??void 0,bestAsk:x??void 0,spread:S??void 0,oddsFormatter:i})})]})]})}var fi=4,tf=8;function rf({bids:e,asks:t,spread:r,oddsFormatter:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=i?tf:fi,l=t.length>fi||e.length>fi,u=react.useMemo(()=>[...t].sort((d,p)=>d.price-p.price).slice(0,s).reverse(),[t,s]),m=react.useMemo(()=>[...e].sort((d,p)=>p.price-d.price).slice(0,s),[e,s]),c=react.useMemo(()=>{let d=[...u,...m].map(p=>p.quantity);return Math.max(...d,1)},[u,m]);return u.length===0&&m.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:o("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[u.map(d=>jsxRuntime.jsx(Da,{price:d.price,quantity:d.quantity,side:"ask",maxQty:c,oddsFormatter:n},`ask-${d.price}`)),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:[r!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]}),l&&jsxRuntime.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:o(i?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),m.map(d=>jsxRuntime.jsx(Da,{price:d.price,quantity:d.quantity,side:"bid",maxQty:c,oddsFormatter:n},`bid-${d.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:o("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:o("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:o("predict.orderBook.total")})]})]})}function Da({price:e,quantity:t,side:r,maxQty:n,oddsFormatter:o}){let i=r==="ask",a=Math.min(t/n*100,100),s=i?"bg-bearish/10":"bg-bullish/10",l=i?"text-bearish":"text-bullish",u=xn(Math.round(t)),m=Math.round(t*e),c=`$${xn(m)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${s} transition-[width] duration-200`,style:{width:`${a}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:o?o(e):Ba(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:u}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:c})]})}var vi=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},yn=4,za=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function gf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function hf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===le.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 Ua(e){return `${(e*100).toFixed(2)}%`}var vf=[{range:le.ONE_DAY,label:"1D"},{range:le.ONE_WEEK,label:"1W"},{range:le.ONE_MONTH,label:"1M"},{range:le.ALL,label:"ALL"}];function bf({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:vf.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 xf(){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 s=i.getBoundingClientRect(),l=(o.clientX-s.left)/s.width*100;a.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,a.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function yf({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let a=new Map;t?.forEach(l=>a.set(l.dataKey,l));let s=o.map(l=>a.get(l.slug)??{dataKey:l.slug,value:void 0,stroke:l.color,color:l.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?hf(r,i):r}),s.map(l=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:l.stroke??l.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:n.get(l.dataKey)??l.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:l.value!=null?Ua(l.value):"--"})]},l.dataKey))]})}function kf({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!o)return;function u(m){a.current&&!a.current.contains(m.target)&&i(false);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]);let s=t.length>=yn,l=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(u=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(u)??"#6b7280",display:"inline-block"}},u))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let u=e.find(m=>m.slug===t[0]);return u?.outcomes?.[0]?.label??u?.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(u=>!u),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[l,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:o?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),o&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",yn," markets"]}),e.map((u,m)=>{let c=t.includes(u.slug),f=!c&&s,d=c&&t.length===1,p=r.get(u.slug)??"#6b7280",g=u.outcomes.find(h=>h.label.toLowerCase()==="yes")??u.outcomes[0],v=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||f||n(u.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:c?"rgba(255,255,255,0.05)":"transparent",cursor:f||d?"not-allowed":"pointer",opacity:f?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:h=>{!f&&!d&&(h.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:h=>{h.currentTarget.style.background=c?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:c?`2px solid ${p}`:"2px solid rgba(255,255,255,0.2)",background:c?`${p}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:c&&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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:p,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:c?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.outcomes?.[0]?.label??u.question}),v&&jsxRuntime.jsx("span",{style:{color:p,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},u.id??`${m}-${u.slug}`)})]})]})}function Sf({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?Ua(i):"--"})]})]},n.marketSlug)})})}function Pf(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function wf(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),s=e.slice(i,a),l=s.map(u=>u.price).sort((u,m)=>u-m);r.push({timestamp:s[s.length-1].timestamp,price:Pf(l)});}return r}function Nf(e,t=200){if(e.length===0)return [];let r=e.map(s=>({...s,data:wf(s.data,t)})),n=new Set;r.forEach(s=>s.data.forEach(l=>n.add(l.timestamp)));let o=Array.from(n).sort((s,l)=>s-l),i=r.map(s=>{let l=new Map;return s.data.forEach(u=>l.set(u.timestamp,u.price)),{slug:s.marketSlug,map:l}}),a=new Map;return o.map(s=>{let l={timestamp:s};return i.forEach(({slug:u,map:m})=>{let c=m.get(s);if(c!==void 0)a.set(u,c),l[u]=c;else {let f=a.get(u);f!==void 0&&(l[u]=f);}}),l})}function $a(e){return jsxRuntime.jsx(vi,{children:jsxRuntime.jsx(Cf,{...e})})}function Cf({event:e,isLoading:t,className:r,volume:n,fillHeight:o=false}){let i=react.useMemo(()=>{let N=new Set;return (e.markets??[]).filter(E=>N.has(E.slug)?false:(N.add(E.slug),true))},[e.markets]),a=react.useMemo(()=>[...i].sort((N,E)=>{let B=J=>(J.outcomes.find(de=>de.label.toLowerCase()==="yes")??J.outcomes[0])?.price??0;return B(E)-B(N)}),[i]),[s,l]=react.useState(()=>a.slice(0,yn).map(N=>N.slug));react.useEffect(()=>{let N=new Set(i.map(E=>E.slug));l(E=>{let B=E.filter(J=>N.has(J));return B.length===E.length?E:B.length>0?B:a.slice(0,yn).map(J=>J.slug)});},[i,a]);let[u,m]=react.useState(zn),c=react.useMemo(()=>{let N=new Map;return s.forEach((E,B)=>{N.set(E,za[B%za.length]);}),N},[s]),f=react.useMemo(()=>i.filter(N=>s.includes(N.slug)),[i,s]),{series:d,isLoading:p}=reactPredict.useMarketHistory(f,u),g=t||p,v=react.useMemo(()=>{if(d.length>0&&d.some(B=>B.data.length>0))return d;let N=Date.now(),E=864e5;return f.map(B=>{let de=(B.outcomes?.find(se=>se.label.toLowerCase()==="yes")??B.outcomes?.[0])?.price??.5;return {marketSlug:B.slug,label:B.outcomes?.[0]?.label??B.question,data:[{timestamp:N-7*E,price:de},{timestamp:N,price:de}]}})},[d,f]),h=react.useMemo(()=>u===le.ONE_DAY?96:u===le.ONE_WEEK?168:u===le.ONE_MONTH?180:300,[u]),x=react.useMemo(()=>Nf(v,h),[v,h]),S=react.useMemo(()=>{if(x.length===0)return [0,1];let N=1/0,E=-1/0;if(s.forEach(J=>{x.forEach(de=>{let se=de[J];se!=null&&(se<N&&(N=se),se>E&&(E=se));});}),!isFinite(N))return [0,1];let B=Math.max((E-N)*.15,.05);return [Math.max(0,N-B),Math.min(1,E+B)]},[x,s]),k=react.useMemo(()=>{let N=new Map;return v.forEach(E=>{E.data.length>0&&N.set(E.marketSlug,E.data[E.data.length-1].price);}),N},[v]),b=react.useMemo(()=>{let N=new Map;return v.forEach(E=>N.set(E.marketSlug,E.label)),N},[v]),y=react.useMemo(()=>v.map(N=>({slug:N.marketSlug,color:c.get(N.marketSlug)??"#6b7280"})),[v,c]),{wrapperRef:M,overlayRef:R,onMouseMove:P,onMouseLeave:C}=xf(),_=react.useCallback(N=>{l(E=>E.includes(N)?E.length<=1?E:E.filter(B=>B!==N):E.length>=yn?E:[...E,N]);},[]),[U,Q]=react.useState(null),H=react.useRef(null),Y=react.useRef(""),q=react.useRef(0),te=!g&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...o?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(Sf,{series:v,colorMap:c,displayValues:U??k}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...o?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:M,style:{width:"100%",userSelect:"none",position:"relative",...o?{flex:1,minHeight:240}:{height:300}},onMouseMove:te?N=>{P(N),cancelAnimationFrame(q.current),q.current=requestAnimationFrame(()=>{Q(H.current);});}:void 0,onMouseLeave:te?()=>{C(),cancelAnimationFrame(q.current),Y.current="",H.current=null,Q(null);}:void 0,children:g?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):x.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:R,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:N=>gf(N,u),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:S,tickFormatter:N=>`${Math.round(N*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:N=>{let E=N;if(E.active&&E.payload?.length){let B=E.payload.map(J=>`${J.dataKey}:${J.value}`).join(",");if(B!==Y.current){Y.current=B;let J=new Map;E.payload.forEach(de=>{de.value!=null&&J.set(de.dataKey,de.value);}),H.current=J;}}return jsxRuntime.jsx(yf,{...E,labelMap:b,allSeries:y,range:u})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),v.map(N=>{let E=c.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:N.marketSlug,stroke:E,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:E},connectNulls:true,isAnimationActive:false},N.marketSlug)}),U==null&&x.length>0&&v.map(N=>{let E=x[x.length-1],B=E[N.marketSlug];if(B==null)return null;let J=c.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:B,ifOverflow:"extendDomain",shape:de=>{let{cx:se,cy:Ve}=de;return se==null||Ve==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:se,cy:Ve,r:6,fill:J,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:se,cy:Ve,r:3.5,fill:J})]})}},`pulse-${N.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:[utils$1.formatAmountInUsd(n)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(bf,{value:u,onChange:m}),a.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(kf,{markets:a,selectedSlugs:s,colorMap:c,onToggle:_})})]})]})]})}function uo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Va(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function Uf(e){return `${parseFloat((e*100).toFixed(2))}%`}function ja(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function po(e){return e.outcomes?.[0]?.label??e.question}function $f(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function kn(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 Ga(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),s=Math.floor(o%36e5/6e4),l=Math.floor(o%6e4/1e3),u=[];return i>0&&u.push(`${i}d`),u.push(`${String(a).padStart(2,"0")}h`),u.push(`${String(s).padStart(2,"0")}m`),u.push(`${String(l).padStart(2,"0")}s`),u.join(" ")}function qa(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(),s=-t.getTimezoneOffset(),l=s>=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${l}${u})`}function Ja({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let c=[...e.markets||[]],f=c.filter(p=>p.status==="open").sort((p,g)=>uo(g)-uo(p)),d=c.filter(p=>p.status!=="open").sort((p,g)=>uo(g)-uo(p));return [...f,...d]},[e.markets]),a=e.status==="closed"||e.status==="voided",s=Ga(a?void 0:e.start_at),l=Ga(a?void 0:e.end_at),u=qa(e.start_at),m=qa(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$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${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((c,f)=>jsxRuntime.jsxs(react.Fragment,{children:[f>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:c.label})]},c.slug)),jsxRuntime.jsx(Gf,{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})]})]}),(s||l||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})}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:s})}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:u})]})]}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:l})}),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($a,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Kf,{markets:i,onTradeAction:t}),jsxRuntime.jsx(jf,{markets:i,event:e})]})}var Ya=5;function Kf({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui$1.useScreen(),[o,i]=react.useState(false),[a,s]=react.useState(null),l=react.useMemo(()=>{let v=new Set;return e.filter(h=>v.has(h.slug)?false:(v.add(h.slug),true))},[e]),u=l.find(v=>v.status==="open")?.slug,[m,c]=react.useState(u?`${u}:yes`:null);if(l.length===0)return null;let f=l.length>Ya,d=o?l:l.slice(0,Ya),p=v=>{s(h=>h===v?null:v);},g=(v,h,x)=>{c(`${v.slug}:${h}`),n&&s(v.slug),t?.(v,h,x);};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((v,h)=>{let x=a===v.slug;return jsxRuntime.jsx(Vf,{market:v,activeYes:m===`${v.slug}:yes`,activeNo:m===`${v.slug}:no`,isExpanded:x,onToggleExpand:()=>p(v.slug),onTradeAction:g},v.id??`${h}-${v.slug}`)})})]}),f&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(v=>!v),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function Vf({market:e,activeYes:t,activeNo:r,isExpanded:n,onToggleExpand:o,onTradeAction:i}){let{t:a}=i18n.useTranslation(),s=e.status==="open",l=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,{data:u}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:e.source,outcome:"yes"},{enabled:s}),{data:m}=reactPredict.useOrderbook({slug:e.slug,source:e.source,outcome:"no"},{enabled:false,refetchInterval:false}),c=reactPredict.pickBestAsk(u,"yes")??Va(e,"yes")??0,f=reactPredict.pickBestAsk(m,"no")??Va(e,"no");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:o,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url,name:po(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:po(e)}),l&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:l})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Uf(c)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:s?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:d=>{d.stopPropagation(),i?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:ja(c)})}),jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:d=>{d.stopPropagation(),i?.(e,"no","buy");},children:f!=null?a("predict.market.action.no",{price:ja(f)}):a("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?a("predict.event.status.closed"):e.status==="voided"?a("predict.event.status.voided"):a("predict.event.status.pending")})})})]}),n&&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(Ha,{market:e,outcome:r?"no":"yes",onTradeAction:i})})})})]})}function jf({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,a]=react.useState(false),[s,l]=react.useState(0),u=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(u.length===0)return null;let m=u[s]??u[0],c=m.rules&&m.rules.length>0?m.rules.join(`
|
|
76
|
+
`,wa={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 fe(e){return {...wa,animationDelay:`${e}ms`}}function hn({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Pa}),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:{...wa,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:{...fe(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...fe(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...fe(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...fe(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...fe(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...fe(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...fe(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(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:{...fe(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:{...fe(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...fe(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...fe(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(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:{...fe(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...fe(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...fe(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...fe(460),height:14,width:"60%"}})]})]})]})}function Na(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Pa}),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:{...fe(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(120),height:40,width:"100%",borderRadius:8}})]})]})}var La="var(--color-bullish)",Ra="var(--color-bearish)";function vn(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 Gm(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function qm(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let p=Math.round(d.price*100);p>=0&&p<=100&&(r[p]+=d.quantity);}for(let d of t){let p=Math.round(d.price*100);p>=0&&p<=100&&(n[p]+=d.quantity);}let o=0,i=0,a=new Float64Array(101),s=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,a[d]=o,s[d]=i;let c=0,u=0,m=new Float64Array(101),l=new Float64Array(101);for(let d=0;d<=100;d++)c+=n[d],u+=n[d]*d/100,m[d]=c,l[d]=u;let f=Math.max(a[0]??0,m[100]??0);return Array.from({length:101},(d,p)=>{let g=a[p]>0,v=m[p]>0,h=a[p]||m[p],x=r[p]>0||n[p]>0;return {priceCents:p,displayHeight:Gm(h,f),opacity:h>0?x?1:.5:0,isBid:g,isAsk:v,bidCumTotal:a[p],askCumTotal:m[p],bidCumCost:s[p],askCumCost:l[p]}})}function Ym({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?La:Ra,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:vn(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",vn(Math.round(e.cumCost))]})]})}var Qm=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,a=t.isBid?La:t.isAsk?Ra: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}})})}),Xm=[0,10,20,30,40,50,60,70,80,90,100];function Jm(){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:Xm.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 _a({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>qm(e,t),[e,t]),o=react.useMemo(()=>{let l=e.length>0?Math.max(...e.map(d=>d.price)):0,f=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((l+f)/2*100)},[e,t]),i=react.useMemo(()=>n.some(l=>l.isBid||l.isAsk),[n]),[a,s]=react.useState(null),c=react.useRef(null),u=react.useCallback((l,f)=>{c.current&&(c.current.style.filter=""),f?(f.style.filter="brightness(1.5)",c.current=f):c.current=null,l.isBid||l.isAsk?s({priceCents:l.priceCents,isBid:l.isBid,cumTotal:l.isBid?l.bidCumTotal:l.askCumTotal,cumCost:l.isBid?l.bidCumCost:l.askCumCost,leftPct:l.priceCents}):s(null);},[]),m=react.useCallback(()=>{c.current&&(c.current.style.filter="",c.current=null),s(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(Ym,{info:a}),n.map(l=>jsxRuntime.jsx(Qm,{slot:l,onEnter:u,onLeave:m},l.priceCents))]}),jsxRuntime.jsx(Jm,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function Ba(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Oa(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function Ha({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:n="depth",className:o,oddsFormatter:i}){let{t:a}=i18n.useTranslation(),[s,c]=react.useState(n),u=i??Ba,m=e.source,{data:l,isLoading:f,isFetching:d,refetch:p}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:m,outcome:t}),g=react.useMemo(()=>(l?.bids??[]).map(k=>({price:k.price,quantity:k.size})),[l?.bids]),v=react.useMemo(()=>(l?.asks??[]).map(k=>({price:k.price,quantity:k.size})),[l?.asks]),h=react.useMemo(()=>g.length>0?Math.max(...g.map(k=>k.price)):null,[g]),x=react.useMemo(()=>v.length>0?Math.min(...v.map(k=>k.price)):null,[v]),S=react.useMemo(()=>{if(h==null||x==null)return null;let k=(x-h)*100;return Math.round(k*10)/10},[h,x]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col",o??"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:S!=null?`${a("predict.orderBook.spread")}: ${Number.isInteger(S)?`${S}\xA2`:`${S.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[h!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[a("predict.trade.bestBid"),": ",u(h)]}),h!=null&&x!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),x!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[a("predict.trade.bestAsk"),": ",u(x)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:s==="depth"?"Orderbook":"Depth chart",onClick:()=>c(k=>k==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:s==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>p(),disabled:d,className:ui$1.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",d&&"animate-spin"),children:jsxRuntime.jsx(ui$1.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Oa,{}):jsxRuntime.jsx(_a,{bids:g,asks:v})}),s==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Oa,{}):jsxRuntime.jsx(of,{bids:g,asks:v,bestBid:h??void 0,bestAsk:x??void 0,spread:S??void 0,oddsFormatter:i})})]})]})}var mi=4,nf=8;function of({bids:e,asks:t,spread:r,oddsFormatter:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=i?nf:mi,c=t.length>mi||e.length>mi,u=react.useMemo(()=>[...t].sort((d,p)=>d.price-p.price).slice(0,s).reverse(),[t,s]),m=react.useMemo(()=>[...e].sort((d,p)=>p.price-d.price).slice(0,s),[e,s]),l=react.useMemo(()=>{let d=[...u,...m].map(p=>p.quantity);return Math.max(...d,1)},[u,m]);return u.length===0&&m.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:o("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[u.map(d=>jsxRuntime.jsx(Da,{price:d.price,quantity:d.quantity,side:"ask",maxQty:l,oddsFormatter:n},`ask-${d.price}`)),jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:[r!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]}),c&&jsxRuntime.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:o(i?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),m.map(d=>jsxRuntime.jsx(Da,{price:d.price,quantity:d.quantity,side:"bid",maxQty:l,oddsFormatter:n},`bid-${d.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:o("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:o("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:o("predict.orderBook.total")})]})]})}function Da({price:e,quantity:t,side:r,maxQty:n,oddsFormatter:o}){let i=r==="ask",a=Math.min(t/n*100,100),s=i?"bg-bearish/10":"bg-bullish/10",c=i?"text-bearish":"text-bullish",u=vn(Math.round(t)),m=Math.round(t*e),l=`$${vn(m)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${s} transition-[width] duration-200`,style:{width:`${a}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${c}`,children:o?o(e):Ba(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:u}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:l})]})}var hi=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}},bn=4,za=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function vf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function bf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===le.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 Ua(e){return `${(e*100).toFixed(2)}%`}var xf=[{range:le.ONE_DAY,label:"1D"},{range:le.ONE_WEEK,label:"1W"},{range:le.ONE_MONTH,label:"1M"},{range:le.ALL,label:"ALL"}];function yf({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:xf.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 kf(){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 s=i.getBoundingClientRect(),c=(o.clientX-s.left)/s.width*100;a.style.background=`linear-gradient(to right, transparent ${c}%, rgba(0,0,0,0.55) ${c}%)`,a.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function Sf({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let a=new Map;t?.forEach(c=>a.set(c.dataKey,c));let s=o.map(c=>a.get(c.slug)??{dataKey:c.slug,value:void 0,stroke:c.color,color:c.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"?bf(r,i):r}),s.map(c=>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:c.stroke??c.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:n.get(c.dataKey)??c.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:c.value!=null?Ua(c.value):"--"})]},c.dataKey))]})}function Pf({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!o)return;function u(m){a.current&&!a.current.contains(m.target)&&i(false);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]);let s=t.length>=bn,c=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(u=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(u)??"#6b7280",display:"inline-block"}},u))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let u=e.find(m=>m.slug===t[0]);return u?.outcomes?.[0]?.label??u?.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(u=>!u),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:[c,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 ",bn," markets"]}),e.map((u,m)=>{let l=t.includes(u.slug),f=!l&&s,d=l&&t.length===1,p=r.get(u.slug)??"#6b7280",g=u.outcomes.find(h=>h.label.toLowerCase()==="yes")??u.outcomes[0],v=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||f||n(u.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:l?"rgba(255,255,255,0.05)":"transparent",cursor:f||d?"not-allowed":"pointer",opacity:f?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:h=>{!f&&!d&&(h.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:h=>{h.currentTarget.style.background=l?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:l?`2px solid ${p}`:"2px solid rgba(255,255,255,0.2)",background:l?`${p}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:l&&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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:p,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:l?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.outcomes?.[0]?.label??u.question}),v&&jsxRuntime.jsx("span",{style:{color:p,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},u.id??`${m}-${u.slug}`)})]})]})}function wf({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?Ua(i):"--"})]})]},n.marketSlug)})})}function Nf(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Cf(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),s=e.slice(i,a),c=s.map(u=>u.price).sort((u,m)=>u-m);r.push({timestamp:s[s.length-1].timestamp,price:Nf(c)});}return r}function Mf(e,t=200){if(e.length===0)return [];let r=e.map(s=>({...s,data:Cf(s.data,t)})),n=new Set;r.forEach(s=>s.data.forEach(c=>n.add(c.timestamp)));let o=Array.from(n).sort((s,c)=>s-c),i=r.map(s=>{let c=new Map;return s.data.forEach(u=>c.set(u.timestamp,u.price)),{slug:s.marketSlug,map:c}}),a=new Map;return o.map(s=>{let c={timestamp:s};return i.forEach(({slug:u,map:m})=>{let l=m.get(s);if(l!==void 0)a.set(u,l),c[u]=l;else {let f=a.get(u);f!==void 0&&(c[u]=f);}}),c})}function $a(e){return jsxRuntime.jsx(hi,{children:jsxRuntime.jsx(Tf,{...e})})}function Tf({event:e,isLoading:t,className:r,volume:n,fillHeight:o=false}){let i=react.useMemo(()=>{let N=new Set;return (e.markets??[]).filter(E=>N.has(E.slug)?false:(N.add(E.slug),true))},[e.markets]),a=react.useMemo(()=>[...i].sort((N,E)=>{let B=J=>(J.outcomes.find(de=>de.label.toLowerCase()==="yes")??J.outcomes[0])?.price??0;return B(E)-B(N)}),[i]),[s,c]=react.useState(()=>a.slice(0,bn).map(N=>N.slug));react.useEffect(()=>{let N=new Set(i.map(E=>E.slug));c(E=>{let B=E.filter(J=>N.has(J));return B.length===E.length?E:B.length>0?B:a.slice(0,bn).map(J=>J.slug)});},[i,a]);let[u,m]=react.useState(Bn),l=react.useMemo(()=>{let N=new Map;return s.forEach((E,B)=>{N.set(E,za[B%za.length]);}),N},[s]),f=react.useMemo(()=>i.filter(N=>s.includes(N.slug)),[i,s]),{series:d,isLoading:p}=reactPredict.useMarketHistory(f,u),g=t||p,v=react.useMemo(()=>{if(d.length>0&&d.some(B=>B.data.length>0))return d;let N=Date.now(),E=864e5;return f.map(B=>{let de=(B.outcomes?.find(se=>se.label.toLowerCase()==="yes")??B.outcomes?.[0])?.price??.5;return {marketSlug:B.slug,label:B.outcomes?.[0]?.label??B.question,data:[{timestamp:N-7*E,price:de},{timestamp:N,price:de}]}})},[d,f]),h=react.useMemo(()=>u===le.ONE_DAY?96:u===le.ONE_WEEK?168:u===le.ONE_MONTH?180:300,[u]),x=react.useMemo(()=>Mf(v,h),[v,h]),S=react.useMemo(()=>{if(x.length===0)return [0,1];let N=1/0,E=-1/0;if(s.forEach(J=>{x.forEach(de=>{let se=de[J];se!=null&&(se<N&&(N=se),se>E&&(E=se));});}),!isFinite(N))return [0,1];let B=Math.max((E-N)*.15,.05);return [Math.max(0,N-B),Math.min(1,E+B)]},[x,s]),k=react.useMemo(()=>{let N=new Map;return v.forEach(E=>{E.data.length>0&&N.set(E.marketSlug,E.data[E.data.length-1].price);}),N},[v]),b=react.useMemo(()=>{let N=new Map;return v.forEach(E=>N.set(E.marketSlug,E.label)),N},[v]),y=react.useMemo(()=>v.map(N=>({slug:N.marketSlug,color:l.get(N.marketSlug)??"#6b7280"})),[v,l]),{wrapperRef:M,overlayRef:R,onMouseMove:P,onMouseLeave:C}=kf(),_=react.useCallback(N=>{c(E=>E.includes(N)?E.length<=1?E:E.filter(B=>B!==N):E.length>=bn?E:[...E,N]);},[]),[U,Q]=react.useState(null),H=react.useRef(null),Y=react.useRef(""),q=react.useRef(0),te=!g&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...o?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(wf,{series:v,colorMap:l,displayValues:U??k}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...o?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:M,style:{width:"100%",userSelect:"none",position:"relative",...o?{flex:1,minHeight:240}:{height:300}},onMouseMove:te?N=>{P(N),cancelAnimationFrame(q.current),q.current=requestAnimationFrame(()=>{Q(H.current);});}:void 0,onMouseLeave:te?()=>{C(),cancelAnimationFrame(q.current),Y.current="",H.current=null,Q(null);}:void 0,children:g?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):x.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:R,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:N=>vf(N,u),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:S,tickFormatter:N=>`${Math.round(N*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:N=>{let E=N;if(E.active&&E.payload?.length){let B=E.payload.map(J=>`${J.dataKey}:${J.value}`).join(",");if(B!==Y.current){Y.current=B;let J=new Map;E.payload.forEach(de=>{de.value!=null&&J.set(de.dataKey,de.value);}),H.current=J;}}return jsxRuntime.jsx(Sf,{...E,labelMap:b,allSeries:y,range:u})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),v.map(N=>{let E=l.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:N.marketSlug,stroke:E,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:E},connectNulls:true,isAnimationActive:false},N.marketSlug)}),U==null&&x.length>0&&v.map(N=>{let E=x[x.length-1],B=E[N.marketSlug];if(B==null)return null;let J=l.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:B,ifOverflow:"extendDomain",shape:de=>{let{cx:se,cy:Ve}=de;return se==null||Ve==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:se,cy:Ve,r:6,fill:J,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:se,cy:Ve,r:3.5,fill:J})]})}},`pulse-${N.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:[utils$1.formatAmountInUsd(n)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(yf,{value:u,onChange:m}),a.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Pf,{markets:a,selectedSlugs:s,colorMap:l,onToggle:_})})]})]})]})}function lo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Va(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function Kf(e){return `${parseFloat((e*100).toFixed(2))}%`}function ja(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function co(e){return e.outcomes?.[0]?.label??e.question}function Vf(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function xn(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 Ga(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),s=Math.floor(o%36e5/6e4),c=Math.floor(o%6e4/1e3),u=[];return i>0&&u.push(`${i}d`),u.push(`${String(a).padStart(2,"0")}h`),u.push(`${String(s).padStart(2,"0")}m`),u.push(`${String(c).padStart(2,"0")}s`),u.join(" ")}function qa(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(),s=-t.getTimezoneOffset(),c=s>=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}function Ja({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let l=[...e.markets||[]],f=l.filter(p=>p.status==="open").sort((p,g)=>lo(g)-lo(p)),d=l.filter(p=>p.status!=="open").sort((p,g)=>lo(g)-lo(p));return [...f,...d]},[e.markets]),a=e.status==="closed"||e.status==="voided",s=Ga(a?void 0:e.start_at),c=Ga(a?void 0:e.end_at),u=qa(e.start_at),m=qa(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$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${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((l,f)=>jsxRuntime.jsxs(react.Fragment,{children:[f>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:l.label})]},l.slug)),jsxRuntime.jsx(Yf,{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})]})]}),(s||c||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})}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:s})}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:u})]})]}):c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:c})}),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($a,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(jf,{markets:i,onTradeAction:t}),jsxRuntime.jsx(qf,{markets:i,event:e})]})}var Ya=5;function jf({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui$1.useScreen(),[o,i]=react.useState(false),[a,s]=react.useState(null),c=react.useMemo(()=>{let v=new Set;return e.filter(h=>v.has(h.slug)?false:(v.add(h.slug),true))},[e]),u=c.find(v=>v.status==="open")?.slug,[m,l]=react.useState(u?`${u}:yes`:null);if(c.length===0)return null;let f=c.length>Ya,d=o?c:c.slice(0,Ya),p=v=>{s(h=>h===v?null:v);},g=(v,h,x)=>{l(`${v.slug}:${h}`),n&&s(v.slug),t?.(v,h,x);};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((v,h)=>{let x=a===v.slug;return jsxRuntime.jsx(Gf,{market:v,activeYes:m===`${v.slug}:yes`,activeNo:m===`${v.slug}:no`,isExpanded:x,onToggleExpand:()=>p(v.slug),onTradeAction:g},v.id??`${h}-${v.slug}`)})})]}),f&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(v=>!v),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function Gf({market:e,activeYes:t,activeNo:r,isExpanded:n,onToggleExpand:o,onTradeAction:i}){let{t:a}=i18n.useTranslation(),s=e.status==="open",c=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,{data:u}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:e.source,outcome:"yes"},{enabled:s}),{data:m}=reactPredict.useOrderbook({slug:e.slug,source:e.source,outcome:"no"},{enabled:false,refetchInterval:false}),l=reactPredict.pickBestAsk(u,"yes")??Va(e,"yes")??0,f=reactPredict.pickBestAsk(m,"no")??Va(e,"no");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:o,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url,name:co(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:co(e)}),c&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:c})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Kf(l)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:s?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:d=>{d.stopPropagation(),i?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:ja(l)})}),jsxRuntime.jsx("button",{type:"button",className:ui$1.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:d=>{d.stopPropagation(),i?.(e,"no","buy");},children:f!=null?a("predict.market.action.no",{price:ja(f)}):a("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui$1.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?a("predict.event.status.closed"):e.status==="voided"?a("predict.event.status.voided"):a("predict.event.status.pending")})})})]}),n&&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(Ha,{market:e,outcome:r?"no":"yes",onTradeAction:i})})})})]})}function qf({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,a]=react.useState(false),[s,c]=react.useState(0),u=e.filter(d=>d.rules&&d.rules.length>0||d.description);if(u.length===0)return null;let m=u[s]??u[0],l=m.rules&&m.rules.length>0?m.rules.join(`
|
|
77
77
|
|
|
78
|
-
`):m.description??"";if(!c)return null;let f=c.length>200&&!n?c.slice(0,200)+"...":c;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")}),u.length>1&&jsxRuntime.jsxs(ui$1.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui$1.DropdownTrigger,{children:jsxRuntime.jsx(ui$1.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:po(m)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(s)],onAction:d=>{l(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:u.map((d,p)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(p===s?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:po(d)},String(p)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:f}),c.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$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let d=m.status,p=[];return m.created_at&&p.push({label:r("predict.event.timeline.created"),value:kn(m.created_at),isActive:true}),p.push({label:r("predict.event.timeline.open"),value:kn(m.start_at),isActive:d!=="pending"}),d==="voided"?p.push({label:r("predict.event.timeline.voided"),value:kn(m.closed_at??m.end_at),isActive:true}):d==="closed"?p.push({label:r("predict.event.timeline.closed"),value:kn(m.closed_at??m.end_at),isActive:true}):p.push({label:r("predict.event.timeline.close"),value:kn(m.end_at),isActive:false}),p})().map((d,p,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"}`}),p<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${p<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:$f(m.source)})]})]})]})]})}function Gf({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function Za({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(bn,{}):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(Ja,{event:n,onTradeAction:r})}var Jf={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui$1.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},Zf={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function Kt(e){return Jf[e]??Zf}function n2({source:e,className:t}){let r=Kt(e);return jsxRuntime.jsxs("span",{className:ui$1.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var tl="rgba(39,39,42,0.6)",sg="rgba(63,63,70,0.8)";function ag(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function nl({eventSlug:e,source:t,limit:r=4,onEventClick:n,onEventHover:o}){let{t:i}=i18n.useTranslation(),{data:a,isLoading:s}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return s||!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(l=>jsxRuntime.jsx(lg,{event:l,onClick:n,onHover:o},`${l.source}-${l.slug}`))})]})}function lg({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=Kt(e.source),i=react.useMemo(()=>ag(e.volume),[e.volume]),a=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:s=>{s.currentTarget.style.borderColor=sg,r?.(e);},onMouseLeave:s=>{s.currentTarget.style.borderColor=tl;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${tl}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color: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$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function fo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function T2({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:a,renderActivitySection:s,onInsufficientBalance:l,onSetupRequired:u,slippageBps:m}){let{t:c}=i18n.useTranslation(),{isDesktop:f}=ui$1.useScreen(),{onOpen:d}=uiScaffold.useAsyncModal(cn),{onOpen:p}=uiScaffold.useAsyncModal(si),{data:g,isLoading:v}=reactPredict.useEvent({slug:e,source:t}),h=react.useMemo(()=>{let R=[...g?.markets||[]],P=R.filter(_=>_.status==="open").sort((_,U)=>fo(U)-fo(_)),C=R.filter(_=>_.status!=="open").sort((_,U)=>fo(U)-fo(_));return [...P,...C]},[g?.markets]),[x,S]=react.useState(null),k=react.useCallback((R,P,C)=>{S(_=>({market:R,outcome:P,side:C,version:(_?.version??0)+1})),!f&&g&&(C==="sell"?p({params:{event:g,market:R,initialOutcome:P,chain:r,slippageBps:m,onSetupRequired:u}}):d({params:{event:g,market:R,initialOutcome:P,chain:r,slippageBps:m,onInsufficientBalance:l}}));},[f,g,r,m,d,p,l,u]),b=x?.market??h[0];if(v){let R=!!a;return f?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(bn,{showBack:R})}),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(Na,{})})})]}):jsxRuntime.jsx(bn,{showBack:R})}let y=x?`${x.market.slug}-${x.version}`:b?.slug??"default",M=x?.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$1.Button,{as:"a",onPress:a,startContent:jsxRuntime.jsx(ui$1.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:c("common.back")})}),jsxRuntime.jsx(Za,{eventSlug:e,source:t,onTradeAction:k})]}),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:[b&&(M?jsxRuntime.jsx(oo,{event:g,market:b,initialOutcome:x?.outcome,chain:r,slippageBps:m,onSetupRequired:u},y):jsxRuntime.jsx(Yn,{event:g,market:b,initialOutcome:x?.outcome,chain:r,slippageBps:m,onInsufficientBalance:l},y)),g&&jsxRuntime.jsx(nl,{eventSlug:e,source:g.source,onEventClick:o,onEventHover:i})]})]}),g&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:s?s({event:g,walletAddress:n}):jsxRuntime.jsx(Sa,{event:g,walletAddress:n})}),jsxRuntime.jsx(Qn,{}),jsxRuntime.jsx(xa,{}),jsxRuntime.jsx(oa,{})]})}function il(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Sg(e){switch(e){case le.ONE_DAY:return {interval:"15m",limit:96};case le.ONE_WEEK:return {interval:"1h",limit:168};case le.ONE_MONTH:return {interval:"4h",limit:180};case le.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var D2=e=>{let{candlestickMarketSlugs:t,chartRange:r=zn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Sg(r),[r]),{data:a,isLoading:s,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:n}),u=react.useMemo(()=>{if(!a?.markets)return [];let p=new Set,g=a.markets.filter(h=>p.has(h.slug)?false:(p.add(h.slug),true));return (t&&t.length>0?t.slice(0,4).map(h=>g.find(x=>x.slug===h)).filter(h=>h!==void 0):[...g].sort((h,x)=>il(x)-il(h)).slice(0,4)).map(h=>h.slug)},[t,a?.markets]),m=reactQuery.useQueries({queries:u.map(p=>({queryKey:reactPredict.candlesticksQueryKey(p,i),queryFn:()=>o.listCandlesticks(p,i),enabled:u.length>0}))}),c=m.some(p=>p.isLoading),f=react.useMemo(()=>{let p=new Map;return u.forEach((g,v)=>{let h=m[v]?.error;h&&p.set(g,h);}),p},[u,m]),d=react.useMemo(()=>{let p=new Map;return u.forEach((g,v)=>{let h=m[v]?.data;h&&p.set(g,h);}),p},[u,m]);return {event:a,isEventLoading:s,eventError:l,candlestickParams:i,candlesticks:d,isCandlesticksLoading:c,candlestickErrors:f}};function yi({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:n}=e,o=n.name||n.pseudonym||t,i=react.useMemo(()=>Cg(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(Pg,{src:n.profile_image,name:o,className:ui$1.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:o}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(wg,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function Pg({src:e,name:t,className:r}){let n=t.trim().charAt(0).toUpperCase()||"?",o=react.useMemo(()=>Ng(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui$1.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui$1.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:o},"aria-hidden":true,children:n})}function wg({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function Ng(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function Cg(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let n=Math.floor(r/60);if(n<60)return `${n}m`;let o=Math.floor(n/60);if(o<24)return `${o}h`;let i=Math.floor(o/24);if(i<7)return `${i}d`;let a=Math.floor(i/7);return a<5?`${a}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Ag={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},ll={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},Fg=["latest","oldest","mostLiked"],Bg=600,Hg=112;function zg({slug:e,source:t,limit:r=20,height:n,className:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState("latest"),[l,u]=react.useState(false),m=Ag[a],{data:c,isLoading:f,isFetchingNextPage:d,hasNextPage:p,fetchNextPage:g}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:m.order,ascending:m.ascending,holders_only:l}),v=react.useMemo(()=>c?.pages?.flatMap(C=>C.items)??[],[c?.pages]),h=react.useRef(null),{height:x}=hooks.useResizeObserver({ref:h}),S=n??(x||Bg),k=reactWindow.useDynamicRowHeight({defaultRowHeight:Hg,key:`${e}:${t}:${a}:${l}`}),b=v.length,y=b+(p?1:0),M=react.useCallback(C=>C<b,[b]),R=react.useCallback(async()=>{p&&!d&&await g();},[p,d,g]),P=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:M,loadMoreRows:R,rowCount:y,threshold:5});return jsxRuntime.jsxs("div",{className:ui$1.cn("flex h-full w-full flex-col",o),children:[jsxRuntime.jsx(Ug,{sort:a,onSortChange:s,holdersOnly:l,onHoldersOnlyChange:u}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:h,children:f?jsxRuntime.jsx($g,{}):v.length===0?jsxRuntime.jsx(Kg,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:S},onRowsRendered:P,rowComponent:Wg,rowCount:y,rowHeight:k,rowProps:{comments:v,itemCount:b,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function Wg({index:e,style:t,comments:r,itemCount:n,anonymousLabel:o}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(yi,{comment:i,anonymousLabel:o,isReply:!!i.parent_comment_id})}):null}function Ug({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!i)return;let l=m=>{s.current&&!s.current.contains(m.target)&&a(false);},u=m=>{m.key==="Escape"&&a(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(l=>!l),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(Vg,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:o(ll[e])}),jsxRuntime.jsx(jg,{className:ui$1.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:Fg.map(l=>{let u=l===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(l),a(false);},className:ui$1.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",u?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:o(ll[l])}),u&&jsxRuntime.jsx(cl,{className:"size-4 text-primary"})]},l)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>n(!r),className:ui$1.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui$1.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(cl,{className:"size-3 text-background"})}),o("predict.comments.holdersOnly")]})]})}function $g(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function Kg({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function Vg({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,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 jg({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function cl({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var Yg=10,Qg=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function xo(){let[e,t]=jotai.useAtom(Qg),r=react.useCallback(o=>{let i=o.trim();i&&t(a=>{let s=a.filter(l=>l!==i);return [i,...s].slice(0,Yg)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function gl({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.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$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function hl({onSelect:e,className:t}){let{histories:r,clearHistories:n}=xo();return jsxRuntime.jsx(gl,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:n})}function vl({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$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:a=>{a.preventDefault(),n?.();},children:"Esc"})})})}function h0(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function bl({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:a}=i18n.useTranslation(),s=e.tags?.[0],l=Kt(e.source),u=react.useMemo(()=>h0(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:m=>{t&&n&&m.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 shrink-0",style:{color:l.color},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:l.label})]}),jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[u," ",a("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral-500",children:s.label})]})]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function xl({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:s}=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(u=>u.items).filter(u=>u!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:s}}var C0=64;function Pl({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:a,isLoading:s,isFetchingNextPage:l,hasNextPage:u,fetchNextPage:m}=xl(i),c=react.useRef(null),{height:f}=hooks.useResizeObserver({ref:c}),d=react.useCallback(h=>h<a.length,[a]),p=react.useCallback(async()=>{u&&!l&&await m();},[u,l,m]),g=react.useMemo(()=>u?a.length+1:a.length,[a,u]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:p,rowCount:g,threshold:5});return s?jsxRuntime.jsx(T0,{className:o}):a.length===0?jsxRuntime.jsx(E0,{className:o}):jsxRuntime.jsx("div",{className:ui$1.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:c,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:f},onRowsRendered:v,rowComponent:M0,rowCount:g,rowHeight:C0,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function M0({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:a}){let s=r[e];return s?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(bl,{event:s,href:o?.(s),LinkComponent:i,onSelect:n,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function T0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function E0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Ml({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=xo(),a=hooks.useCallbackRef(e),s=hooks.useCallbackRef(i),l=react.useMemo(()=>utils$1.debounce(f=>{o(f),a(f),f&&s(f);},500),[a,s]),u=react.useCallback(f=>{r(f),l(f);},[l]),m=react.useCallback(f=>{l.cancel(),r(f),o(f),a(f),f&&s(f);},[l,a,s]),c=react.useCallback(()=>m(""),[m]);return {text:t,keyword:n,setText:u,setKeyword:m,clearKeyword:c}}function Tl({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:a}){let{text:s,keyword:l,setText:u,setKeyword:m,clearKeyword:c}=Ml({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(vl,{value:s,onValueChange:u,onClear:c,onEscape:i}),!l&&jsxRuntime.jsx(hl,{onSelect:m}),jsxRuntime.jsx(Pl,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:a})]})}var Ni="predict-search";function TS({id:e=Ni}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(U0,{...t})})}function U0({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),a=react.useCallback(l=>{n(l);},[n]),s=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(Tl,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:s})})]})})}function FS({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),{onOpen:i,onClose:a}=uiScaffold.useAsyncModal(Ni),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(async()=>{let m=await i({params:t});m&&s(m);}),u=hooks.useCallbackRef(()=>{a();});return react.useEffect(()=>{let m=c=>{let f=document.activeElement,d=!!f&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.getAttribute("contenteditable")==="true");c.key==="/"&&!d&&(c.preventDefault(),l()),c.key==="Escape"&&(c.preventDefault(),u());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[l,u]),o?jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui$1.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:n("predict.search.placeholder")}):jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:ui$1.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var Mi=[{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"}],Hl=[{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}],Al={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"},Fl={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 Q0(e,t){if(!e)return "$5K+";let r=Hl.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function zl({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:a}){let{t:s}=i18n.useTranslation(),[l,u]=react.useState(false),[m,c]=react.useState(false),[f,d]=react.useState(false),[p,g]=react.useState(false),v=react.useRef(null),h=react.useRef(null),x=Mi.find(b=>b.value===e)??Mi[0],S=react.useCallback(b=>{v.current&&!v.current.contains(b.target)&&u(false),h.current&&!h.current.contains(b.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)),[S]);let k=react.useCallback(()=>{a?.(),g(true),setTimeout(()=>g(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
78
|
+
`):m.description??"";if(!l)return null;let f=l.length>200&&!n?l.slice(0,200)+"...":l;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")}),u.length>1&&jsxRuntime.jsxs(ui$1.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui$1.DropdownTrigger,{children:jsxRuntime.jsx(ui$1.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:co(m)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(s)],onAction:d=>{c(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:u.map((d,p)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(p===s?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:co(d)},String(p)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:f}),l.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$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let d=m.status,p=[];return m.created_at&&p.push({label:r("predict.event.timeline.created"),value:xn(m.created_at),isActive:true}),p.push({label:r("predict.event.timeline.open"),value:xn(m.start_at),isActive:d!=="pending"}),d==="voided"?p.push({label:r("predict.event.timeline.voided"),value:xn(m.closed_at??m.end_at),isActive:true}):d==="closed"?p.push({label:r("predict.event.timeline.closed"),value:xn(m.closed_at??m.end_at),isActive:true}):p.push({label:r("predict.event.timeline.close"),value:xn(m.end_at),isActive:false}),p})().map((d,p,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"}`}),p<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${p<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:Vf(m.source)})]})]})]})]})}function Yf({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function Za({eventSlug:e,source:t,onTradeAction:r}){let{data:n,isLoading:o,error:i}=reactPredict.useEvent({slug:e,source:t});return o?jsxRuntime.jsx(hn,{}):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(Ja,{event:n,onTradeAction:r})}var eg={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui$1.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui$1.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},tg={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ur(e){return eg[e]??tg}function i2({source:e,className:t}){let r=ur(e);return jsxRuntime.jsxs("span",{className:ui$1.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}var tl="rgba(39,39,42,0.6)",lg="rgba(63,63,70,0.8)";function cg(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function nl({eventSlug:e,source:t,limit:r=4,onEventClick:n,onEventHover:o}){let{t:i}=i18n.useTranslation(),{data:a,isLoading:s}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return s||!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(c=>jsxRuntime.jsx(dg,{event:c,onClick:n,onHover:o},`${c.source}-${c.slug}`))})]})}function dg({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=ur(e.source),i=react.useMemo(()=>cg(e.volume),[e.volume]),a=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:s=>{s.currentTarget.style.borderColor=lg,r?.(e);},onMouseLeave:s=>{s.currentTarget.style.borderColor=tl;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${tl}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color: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$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function po(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function L2({eventSlug:e,source:t,chain:r,walletAddress:n,onSimilarEventClick:o,onSimilarEventHover:i,onBack:a,renderActivitySection:s,onInsufficientBalance:c,onSetupRequired:u,slippageBps:m}){let{t:l}=i18n.useTranslation(),{isDesktop:f}=ui$1.useScreen(),{onOpen:d}=uiScaffold.useAsyncModal(an),{onOpen:p}=uiScaffold.useAsyncModal(ii),{data:g,isLoading:v}=reactPredict.useEvent({slug:e,source:t}),h=react.useMemo(()=>{let R=[...g?.markets||[]],P=R.filter(_=>_.status==="open").sort((_,U)=>po(U)-po(_)),C=R.filter(_=>_.status!=="open").sort((_,U)=>po(U)-po(_));return [...P,...C]},[g?.markets]),[x,S]=react.useState(null),k=react.useCallback((R,P,C)=>{S(_=>({market:R,outcome:P,side:C,version:(_?.version??0)+1})),!f&&g&&(C==="sell"?p({params:{event:g,market:R,initialOutcome:P,chain:r,slippageBps:m,onSetupRequired:u}}):d({params:{event:g,market:R,initialOutcome:P,chain:r,slippageBps:m,onInsufficientBalance:c}}));},[f,g,r,m,d,p,c,u]),b=x?.market??h[0];if(v){let R=!!a;return f?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(hn,{showBack:R})}),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(Na,{})})})]}):jsxRuntime.jsx(hn,{showBack:R})}let y=x?`${x.market.slug}-${x.version}`:b?.slug??"default",M=x?.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$1.Button,{as:"a",onPress:a,startContent:jsxRuntime.jsx(ui$1.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:l("common.back")})}),jsxRuntime.jsx(Za,{eventSlug:e,source:t,onTradeAction:k})]}),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:[b&&(M?jsxRuntime.jsx(ro,{event:g,market:b,initialOutcome:x?.outcome,chain:r,slippageBps:m,onSetupRequired:u},y):jsxRuntime.jsx(Gn,{event:g,market:b,initialOutcome:x?.outcome,chain:r,slippageBps:m,onInsufficientBalance:c},y)),g&&jsxRuntime.jsx(nl,{eventSlug:e,source:g.source,onEventClick:o,onEventHover:i})]})]}),g&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:s?s({event:g,walletAddress:n}):jsxRuntime.jsx(Sa,{event:g,walletAddress:n})}),jsxRuntime.jsx(qn,{}),jsxRuntime.jsx(xa,{}),jsxRuntime.jsx(oa,{})]})}function il(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function wg(e){switch(e){case le.ONE_DAY:return {interval:"15m",limit:96};case le.ONE_WEEK:return {interval:"1h",limit:168};case le.ONE_MONTH:return {interval:"4h",limit:180};case le.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var F2=e=>{let{candlestickMarketSlugs:t,chartRange:r=Bn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>wg(r),[r]),{data:a,isLoading:s,error:c}=reactPredict.useEvent({slug:e.eventSlug,source:n}),u=react.useMemo(()=>{if(!a?.markets)return [];let p=new Set,g=a.markets.filter(h=>p.has(h.slug)?false:(p.add(h.slug),true));return (t&&t.length>0?t.slice(0,4).map(h=>g.find(x=>x.slug===h)).filter(h=>h!==void 0):[...g].sort((h,x)=>il(x)-il(h)).slice(0,4)).map(h=>h.slug)},[t,a?.markets]),m=reactQuery.useQueries({queries:u.map(p=>({queryKey:reactPredict.candlesticksQueryKey(p,i),queryFn:()=>o.listCandlesticks(p,i),enabled:u.length>0}))}),l=m.some(p=>p.isLoading),f=react.useMemo(()=>{let p=new Map;return u.forEach((g,v)=>{let h=m[v]?.error;h&&p.set(g,h);}),p},[u,m]),d=react.useMemo(()=>{let p=new Map;return u.forEach((g,v)=>{let h=m[v]?.data;h&&p.set(g,h);}),p},[u,m]);return {event:a,isEventLoading:s,eventError:c,candlestickParams:i,candlesticks:d,isCandlesticksLoading:l,candlestickErrors:f}};function xi({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:n}=e,o=n.name||n.pseudonym||t,i=react.useMemo(()=>Tg(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(Ng,{src:n.profile_image,name:o,className:ui$1.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:o}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(Cg,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function Ng({src:e,name:t,className:r}){let n=t.trim().charAt(0).toUpperCase()||"?",o=react.useMemo(()=>Mg(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui$1.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui$1.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:o},"aria-hidden":true,children:n})}function Cg({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function Mg(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function Tg(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let n=Math.floor(r/60);if(n<60)return `${n}m`;let o=Math.floor(n/60);if(o<24)return `${o}h`;let i=Math.floor(o/24);if(i<7)return `${i}d`;let a=Math.floor(i/7);return a<5?`${a}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Bg={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},ll={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},Hg=["latest","oldest","mostLiked"],zg=600,Wg=112;function Ug({slug:e,source:t,limit:r=20,height:n,className:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState("latest"),[c,u]=react.useState(false),m=Bg[a],{data:l,isLoading:f,isFetchingNextPage:d,hasNextPage:p,fetchNextPage:g}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:m.order,ascending:m.ascending,holders_only:c}),v=react.useMemo(()=>l?.pages?.flatMap(C=>C.items)??[],[l?.pages]),h=react.useRef(null),{height:x}=hooks.useResizeObserver({ref:h}),S=n??(x||zg),k=reactWindow.useDynamicRowHeight({defaultRowHeight:Wg,key:`${e}:${t}:${a}:${c}`}),b=v.length,y=b+(p?1:0),M=react.useCallback(C=>C<b,[b]),R=react.useCallback(async()=>{p&&!d&&await g();},[p,d,g]),P=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:M,loadMoreRows:R,rowCount:y,threshold:5});return jsxRuntime.jsxs("div",{className:ui$1.cn("flex h-full w-full flex-col",o),children:[jsxRuntime.jsx(Kg,{sort:a,onSortChange:s,holdersOnly:c,onHoldersOnlyChange:u}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:h,children:f?jsxRuntime.jsx(Vg,{}):v.length===0?jsxRuntime.jsx(jg,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:S},onRowsRendered:P,rowComponent:$g,rowCount:y,rowHeight:k,rowProps:{comments:v,itemCount:b,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function $g({index:e,style:t,comments:r,itemCount:n,anonymousLabel:o}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(xi,{comment:i,anonymousLabel:o,isReply:!!i.parent_comment_id})}):null}function Kg({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!i)return;let c=m=>{s.current&&!s.current.contains(m.target)&&a(false);},u=m=>{m.key==="Escape"&&a(false);};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(c=>!c),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(Gg,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:o(ll[e])}),jsxRuntime.jsx(qg,{className:ui$1.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:Hg.map(c=>{let u=c===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(c),a(false);},className:ui$1.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",u?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:o(ll[c])}),u&&jsxRuntime.jsx(cl,{className:"size-4 text-primary"})]},c)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>n(!r),className:ui$1.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui$1.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(cl,{className:"size-3 text-background"})}),o("predict.comments.holdersOnly")]})]})}function Vg(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function jg({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function Gg({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,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 qg({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function cl({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var Xg=10,Jg=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function vo(){let[e,t]=jotai.useAtom(Jg),r=react.useCallback(o=>{let i=o.trim();i&&t(a=>{let s=a.filter(c=>c!==i);return [i,...s].slice(0,Xg)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function gl({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.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$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function hl({onSelect:e,className:t}){let{histories:r,clearHistories:n}=vo();return jsxRuntime.jsx(gl,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:n})}function vl({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$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:a=>{a.preventDefault(),n?.();},children:"Esc"})})})}function b0(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function x0(e){return e.title_trans||e.title}function bl({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:a}=i18n.useTranslation(),s=x0(e),c=react.useMemo(()=>b0(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:u=>{t&&n&&u.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:s||"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:s}),jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[c," ",a("predict.event.volume")]})})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function xl({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:s}=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(u=>u.items).filter(u=>u!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:s}}var T0=64;function Pl({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:a,isLoading:s,isFetchingNextPage:c,hasNextPage:u,fetchNextPage:m}=xl(i),l=react.useRef(null),{height:f}=hooks.useResizeObserver({ref:l}),d=react.useCallback(h=>h<a.length,[a]),p=react.useCallback(async()=>{u&&!c&&await m();},[u,c,m]),g=react.useMemo(()=>u?a.length+1:a.length,[a,u]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:p,rowCount:g,threshold:5});return s?jsxRuntime.jsx(L0,{className:o}):a.length===0?jsxRuntime.jsx(R0,{className:o}):jsxRuntime.jsx("div",{className:ui$1.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:l,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:f},onRowsRendered:v,rowComponent:E0,rowCount:g,rowHeight:T0,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function E0({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:a}){let s=r[e];return s?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(bl,{event:s,href:o?.(s),LinkComponent:i,onSelect:n,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function L0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function R0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Ml({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=vo(),a=hooks.useCallbackRef(e),s=hooks.useCallbackRef(i),c=react.useMemo(()=>utils$1.debounce(f=>{o(f),a(f),f&&s(f);},500),[a,s]),u=react.useCallback(f=>{r(f),c(f);},[c]),m=react.useCallback(f=>{c.cancel(),r(f),o(f),a(f),f&&s(f);},[c,a,s]),l=react.useCallback(()=>m(""),[m]);return {text:t,keyword:n,setText:u,setKeyword:m,clearKeyword:l}}function Tl({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:a}){let{text:s,keyword:c,setText:u,setKeyword:m,clearKeyword:l}=Ml({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(vl,{value:s,onValueChange:u,onClear:l,onEscape:i}),!c&&jsxRuntime.jsx(hl,{onSelect:m}),jsxRuntime.jsx(Pl,{className:"flex-auto min-h-0",keyword:c,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:a})]})}var Ni="predict-search";function ES({id:e=Ni}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(K0,{...t})})}function K0({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),a=react.useCallback(c=>{n(c);},[n]),s=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(Tl,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:s})})]})})}function BS({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),{onOpen:i,onClose:a}=uiScaffold.useAsyncModal(Ni),s=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let m=await i({params:t});m&&s(m);}),u=hooks.useCallbackRef(()=>{a();});return react.useEffect(()=>{let m=l=>{let f=document.activeElement,d=!!f&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.getAttribute("contenteditable")==="true");l.key==="/"&&!d&&(l.preventDefault(),c()),l.key==="Escape"&&(l.preventDefault(),u());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[c,u]),o?jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",onPress:c,variant:"bordered",startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui$1.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:n("predict.search.placeholder")}):jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:c,variant:"bordered",className:ui$1.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var Mi=[{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"}],Hl=[{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}],Al={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"},Fl={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 J0(e,t){if(!e)return "$5K+";let r=Hl.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function zl({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:a}){let{t:s}=i18n.useTranslation(),[c,u]=react.useState(false),[m,l]=react.useState(false),[f,d]=react.useState(false),[p,g]=react.useState(false),v=react.useRef(null),h=react.useRef(null),x=Mi.find(b=>b.value===e)??Mi[0],S=react.useCallback(b=>{v.current&&!v.current.contains(b.target)&&u(false),h.current&&!h.current.contains(b.target)&&l(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)),[S]);let k=react.useCallback(()=>{a?.(),g(true),setTimeout(()=>g(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
79
79
|
@keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
|
|
80
80
|
.match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
|
|
81
81
|
.match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
|
|
82
|
-
`}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:Al,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(b=>!b),
|
|
82
|
+
`}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:Al,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(b=>!b),l(false);},children:[jsxRuntime.jsx(Z0,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(x.labelKey)}),jsxRuntime.jsx(Bl,{open:c})]}),c&&jsxRuntime.jsx("div",{style:{...Fl,width:224,padding:4},children:Mi.map(b=>{let y=e===b.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:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:M=>{y||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{y||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===b.value?n(!r):t(b.value),u(false);},children:[jsxRuntime.jsx("div",{style:{color:y?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(eh,{type:b.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:s(b.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:s(b.descKey)})]}),y&&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"})})]},b.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:Al,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{l(b=>!b),u(false);},children:[jsxRuntime.jsx(th,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:J0(o,s)}),jsxRuntime.jsx(rh,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(Bl,{open:m})]}),f&&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"})}),s("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:s("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:s("predict.matches.filter.tooltipNote")})]})]})]}),m&&jsxRuntime.jsxs("div",{style:{...Fl,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:s("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:Hl.map(b=>{let y=b.value===0?!o:o===b.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:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:M=>{y||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{y||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(b.value===0?void 0:b.value),l(false);},children:[jsxRuntime.jsx("span",{children:b.labelKey?s(b.labelKey):b.label}),y&&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"})})]},b.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:b=>{b.currentTarget.style.background="rgba(39,39,42,1)",b.currentTarget.style.color="#fff";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)",b.currentTarget.style.color="#a1a1aa";},onClick:k,children:jsxRuntime.jsxs("svg",{className:p?"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 Z0(){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 eh({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 th(){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 rh({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 Bl({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 sh(e){return utils$1.formatAmountInUsd(e)}var ah=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>utils$1.formatAmount(e),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=>utils$1.formatAmount(e),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:sh,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function Ul({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
83
83
|
@keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
|
|
84
84
|
@keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
|
|
85
85
|
@keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -117,21 +117,21 @@
|
|
|
117
117
|
.matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
|
|
118
118
|
@media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
|
|
119
119
|
`}),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(`
|
|
120
|
-
`).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:
|
|
120
|
+
`).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:ah.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 Ti(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function dh(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var jl={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)"}},uh={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)"}},$l={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 ph(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var mh={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},fh={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},gh={text:"#9ca3af",icon:"#9ca3af"};function hh(e){return fh[e]??gh}var vh=`
|
|
121
121
|
.match-card button:focus-visible,
|
|
122
122
|
.match-card a:focus-visible,
|
|
123
123
|
.match-card [role="button"]:focus-visible {
|
|
124
124
|
outline: 2px solid hsl(var(--heroui-primary) / 0.4);
|
|
125
125
|
outline-offset: 2px;
|
|
126
126
|
}
|
|
127
|
-
`;function hh({tier:e}){let t=jl[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 vh(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 Gl({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:n,getLegHref:o,onHover:i,getMarketHref:a,LinkComponent:s}){let{t:l}=i18n.useTranslation(),u=vh(e);if(!u)return null;let[m,c]=u,f=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=lh(f),p=jl[d],g=m.best_price!=null&&c.best_price!=null?m.best_price<=c.best_price?m.source:c.source:null,v=m.event_title||c.event_title,h=e.signal_tag??"stale_data",x=$l[h]??$l.stale_data,S=r?.(e),k=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:gh}),f!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[f.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:l("predict.matches.gap")})]}),jsxRuntime.jsx(hh,{tier:d})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:v}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(Kl,{leg:m,isCheaper:g===m.source,externalUrlFallback:a?.(e,m.source),internalHref:o?.(e,m),onSelect:n?()=>n(e,m):void 0,LinkComponent:s}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(Kl,{leg:c,isCheaper:g===c.source,externalUrlFallback:a?.(e,c.source),internalHref:o?.(e,c),onSelect:n?()=>n(e,c):void 0,LinkComponent:s})]})]}),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"})]}),Ti(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"})}),Ti(e.combined_volume_24h)," ",l("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:l("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"})]}),bh(l,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:x.dot,flexShrink:0}}),l(x.label)]})]})]}),b={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:S||t?"pointer":void 0},y=R=>{let P=R.currentTarget,C=ch[d];P.style.borderColor=C.border,P.style.boxShadow=C.shadow,i?.(e);},M=R=>{let P=R.currentTarget;P.style.borderColor="rgba(39,39,42,0.6)",P.style.boxShadow="none";};return S&&s?jsxRuntime.jsx(s,{href:S,className:"group match-card",children:jsxRuntime.jsx("div",{style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),children:k})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),onKeyDown:R=>{t&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),t(e));},children:k})}function bh(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 Kl({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:n,onSelect:o,LinkComponent:i}){let{t:a}=i18n.useTranslation(),s=Kt(e.source),l=fh(e.source),u=e.best_price,m=e.outcomes?.[0]?.label??null,c=e.external_url??r,f=dh(e.age_seconds),d=h=>{h.stopPropagation();},p=!!(n||o),g={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:p?"pointer":void 0,color:"inherit",textDecoration:"none"},v=jsxRuntime.jsxs(jsxRuntime.Fragment,{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:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:l.text,textTransform:"uppercase"},children:s.label}),f&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?a("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:uh[f],flexShrink:0}})]}),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:[Ti(e.vol_24h_usd)," ",a("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:u!=null?(u*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:a("predict.matches.centsYes")})]}),c?jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer","aria-label":a("predict.matches.viewOn",{platform:s.label}),title:a("predict.matches.viewOn",{platform:s.label}),onClick:h=>h.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:h=>{h.currentTarget.style.color="#d4d4d8",h.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:h=>{h.currentTarget.style.color="#71717a",h.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}})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"match-card-leg-link",onClick:h=>{d(h),o?.();},children:jsxRuntime.jsx("div",{style:g,children:v})}):p?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:g,onClick:h=>{d(h),o?.();},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d(h),o?.());},children:v}):jsxRuntime.jsx("div",{style:g,children:v})}var Jl=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,signal:o,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:l,onSelect:u,onHover:m,getMarketHref:c,LinkComponent:f,onStatsChange:d},p){let{t:g}=i18n.useTranslation(),{data:v,hasNextPage:h,fetchNextPage:x,isFetchingNextPage:S,isLoading:k,isPlaceholderData:b,refetch:y}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,signal:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[M,R]=react.useState(0),[P,C]=react.useState(false);P&&!b?(C(false),R(te=>te+1)):b&&!P&&C(true),react.useImperativeHandle(p,()=>({refetch:()=>{y();}}),[y]);let _=react.useMemo(()=>v?.pages.flatMap(te=>te.items??[])??[],[v]),U=v?.pages[0]?.total,Q=react.useMemo(()=>{let te=0,N=0,E=0;for(let B of _){let J=B.spread??0;J>te&&(te=J),J>=.03&&E++,B.combined_volume!=null&&(N+=B.combined_volume);}return {activePairs:U??_.length,maxSpread:te,highSpreadCount:E,totalVolume:N}},[_,U]);react.useEffect(()=>{Q.activePairs>0&&d?.(Q);},[Q,d]);let H=react.useRef(null),Y=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let te=H.current;if(!te)return;let N=new IntersectionObserver(E=>{E[0]?.isIntersecting&&h&&!S&&x();},{rootMargin:"200px"});return N.observe(te),()=>N.disconnect()},[h,S,x]),react.useEffect(()=>{if(h)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[h]),k)return jsxRuntime.jsx(Ch,{});if(_.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:g("predict.matches.empty")})});let q=!h&&_.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
|
|
127
|
+
`;function bh({tier:e}){let t=jl[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 xh(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 Gl({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:n,getLegHref:o,onHover:i,getMarketHref:a,LinkComponent:s}){let{t:c}=i18n.useTranslation(),u=xh(e);if(!u)return null;let[m,l]=u,f=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=dh(f),p=jl[d],g=m.best_price!=null&&l.best_price!=null?m.best_price<=l.best_price?m.source:l.source:null,v=m.event_title||l.event_title,h=e.signal_tag??"stale_data",x=$l[h]??$l.stale_data,S=r?.(e),k=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:vh}),f!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[f.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:c("predict.matches.gap")})]}),jsxRuntime.jsx(bh,{tier:d})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:v}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(Kl,{leg:m,isCheaper:g===m.source,externalUrlFallback:a?.(e,m.source),internalHref:o?.(e,m),onSelect:n?()=>n(e,m):void 0,LinkComponent:s}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(Kl,{leg:l,isCheaper:g===l.source,externalUrlFallback:a?.(e,l.source),internalHref:o?.(e,l),onSelect:n?()=>n(e,l):void 0,LinkComponent:s})]})]}),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"})]}),Ti(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"})}),Ti(e.combined_volume_24h)," ",c("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:c("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"})]}),yh(c,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:x.dot,flexShrink:0}}),c(x.label)]})]})]}),b={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:S||t?"pointer":void 0},y=R=>{let P=R.currentTarget,C=uh[d];P.style.borderColor=C.border,P.style.boxShadow=C.shadow,i?.(e);},M=R=>{let P=R.currentTarget;P.style.borderColor="rgba(39,39,42,0.6)",P.style.boxShadow="none";};return S&&s?jsxRuntime.jsx(s,{href:S,className:"group match-card",children:jsxRuntime.jsx("div",{style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),children:k})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),onKeyDown:R=>{t&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),t(e));},children:k})}function yh(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 Kl({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:n,onSelect:o,LinkComponent:i}){let{t:a}=i18n.useTranslation(),s=ur(e.source),c=hh(e.source),u=e.best_price,m=e.outcomes?.[0]?.label??null,l=e.external_url??r,f=ph(e.age_seconds),d=h=>{h.stopPropagation();},p=!!(n||o),g={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:p?"pointer":void 0,color:"inherit",textDecoration:"none"},v=jsxRuntime.jsxs(jsxRuntime.Fragment,{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:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:c.text,textTransform:"uppercase"},children:s.label}),f&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?a("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:mh[f],flexShrink:0}})]}),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:[Ti(e.vol_24h_usd)," ",a("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:u!=null?(u*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:a("predict.matches.centsYes")})]}),l?jsxRuntime.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer","aria-label":a("predict.matches.viewOn",{platform:s.label}),title:a("predict.matches.viewOn",{platform:s.label}),onClick:h=>h.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:h=>{h.currentTarget.style.color="#d4d4d8",h.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:h=>{h.currentTarget.style.color="#71717a",h.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}})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"match-card-leg-link",onClick:h=>{d(h),o?.();},children:jsxRuntime.jsx("div",{style:g,children:v})}):p?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:g,onClick:h=>{d(h),o?.();},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),d(h),o?.());},children:v}):jsxRuntime.jsx("div",{style:g,children:v})}var Jl=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,signal:o,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:c,onSelect:u,onHover:m,getMarketHref:l,LinkComponent:f,onStatsChange:d},p){let{t:g}=i18n.useTranslation(),{data:v,hasNextPage:h,fetchNextPage:x,isFetchingNextPage:S,isLoading:k,isPlaceholderData:b,refetch:y}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,signal:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[M,R]=react.useState(0),[P,C]=react.useState(false);P&&!b?(C(false),R(te=>te+1)):b&&!P&&C(true),react.useImperativeHandle(p,()=>({refetch:()=>{y();}}),[y]);let _=react.useMemo(()=>v?.pages.flatMap(te=>te.items??[])??[],[v]),U=v?.pages[0]?.total,Q=react.useMemo(()=>{let te=0,N=0,E=0;for(let B of _){let J=B.spread??0;J>te&&(te=J),J>=.03&&E++,B.combined_volume!=null&&(N+=B.combined_volume);}return {activePairs:U??_.length,maxSpread:te,highSpreadCount:E,totalVolume:N}},[_,U]);react.useEffect(()=>{Q.activePairs>0&&d?.(Q);},[Q,d]);let H=react.useRef(null),Y=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let te=H.current;if(!te)return;let N=new IntersectionObserver(E=>{E[0]?.isIntersecting&&h&&!S&&x();},{rootMargin:"200px"});return N.observe(te),()=>N.disconnect()},[h,S,x]),react.useEffect(()=>{if(h)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[h]),k)return jsxRuntime.jsx(Th,{});if(_.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:g("predict.matches.empty")})});let q=!h&&_.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
|
|
128
128
|
@media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
|
|
129
129
|
@keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
|
|
130
|
-
`}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:v?.pages.map(te=>te.items?.map((N,E)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${E*35}ms both`},children:jsxRuntime.jsx(Gl,{match:N,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:l,onHover:m,onSelect:u,getMarketHref:c,LinkComponent:f})},`${M}-${N.match_id}-${N.source_a}-${N.market_a?.slug??E}`)))}),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)}}"}),S&&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"})}),g("predict.matches.loadMore")]})]}),q&&jsxRuntime.jsx(Nh,{onScrollToTop:Y})]})});function Nh({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 Ch(){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, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(Mh,{index:t},t))})]})}function Mh({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 Ih={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Oh(){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 Dh({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:utils$1.formatAmount(e.activePairs)})]}),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(Oh,{})]})]})]})]})}function wP({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,bgImageSrc:l}){let{t:u}=i18n.useTranslation(),[m,c]=react.useState("spread"),[f,d]=react.useState(false),[p,g]=react.useState(void 0),[v,h]=react.useState(),x=react.useRef(null),S=react.useCallback(M=>{c(M);},[]),k=react.useCallback(M=>{d(M);},[]),b=react.useCallback(M=>{react.startTransition(()=>{h(M);});},[]),y=react.useCallback(()=>{x.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
|
|
130
|
+
`}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:v?.pages.map(te=>te.items?.map((N,E)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${E*35}ms both`},children:jsxRuntime.jsx(Gl,{match:N,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:c,onHover:m,onSelect:u,getMarketHref:l,LinkComponent:f})},`${M}-${N.match_id}-${N.source_a}-${N.market_a?.slug??E}`)))}),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)}}"}),S&&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"})}),g("predict.matches.loadMore")]})]}),q&&jsxRuntime.jsx(Mh,{onScrollToTop:Y})]})});function Mh({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 Th(){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, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(Eh,{index:t},t))})]})}function Eh({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 Dh={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Ah(){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 Fh({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:utils$1.formatAmount(e.activePairs)})]}),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(Ah,{})]})]})]})]})}function NP({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,bgImageSrc:c}){let{t:u}=i18n.useTranslation(),[m,l]=react.useState("spread"),[f,d]=react.useState(false),[p,g]=react.useState(void 0),[v,h]=react.useState(),x=react.useRef(null),S=react.useCallback(M=>{l(M);},[]),k=react.useCallback(M=>{d(M);},[]),b=react.useCallback(M=>{react.startTransition(()=>{h(M);});},[]),y=react.useCallback(()=>{x.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
|
|
131
131
|
@keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
|
|
132
132
|
.match-fade-in{animation:matchFadeIn .5s ease-out both}
|
|
133
133
|
.match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
|
|
134
134
|
.match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
|
|
135
|
-
`}),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:[l&&jsxRuntime.jsx("img",{src:l,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(Ul,{stats:v})})]}),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:u(Ih[m])}),v&&v.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:u("predict.matches.pairsFound",{count:v.activePairs})})]})]}),jsxRuntime.jsx(zl,{sortBy:m,onSortChange:S,sortAsc:f,onSortAscChange:k,minVolume:p,onMinVolumeChange:g,onRefresh:y})]})]}),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:u("predict.matches.experimentalFeature")})," \u2014 ",u("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Jl,{ref:x,sortBy:m,sortAsc:f,minVolume:p,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,onStatsChange:b})]}),jsxRuntime.jsx(Dh,{stats:v})]})}function Li(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var Bh={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"}},Hh={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 zh(e){return Bh[e]??Hh}function Wh(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 Uh(e,t){let r=e.entries.find(s=>s.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(s=>s.source===(t?.source_b??e.entries[1]?.source)),o=s=>{if(!s?.outcomes?.[0])return {name:null,price:null};let l=s.outcomes[0];return {name:l.label||null,price:l.best_ask??l.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 RP({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Wh(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[s,l]=react.useMemo(()=>Uh(e,i),[e,i]),u=a!=null&&a>=3;s.yesPrice!=null&&l.yesPrice!=null?s.source==="kalshi"?s.yesPrice>l.yesPrice:l.yesPrice>s.yesPrice:false;let c=s.yesPrice!=null&&l.yesPrice!=null?s.yesPrice<=l.yesPrice?s:l:null,f=c?Kt(c.source):null,d=u?"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:p=>{let g=p.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:p=>{let g=p.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 ${u?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:u?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:u?"#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(tc,{data:s,isCheaper:c===s,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(tc,{data:l,isCheaper:c===l,onSelect:t,getEventHref:r,LinkComponent:n})]}),c&&f&&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:()=>c.event&&t?.(c.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:c.source.charAt(0).toUpperCase()+c.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"})]}),Li(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"})}),Li(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 tc({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=Kt(e.source),s=zh(e.source),l=e.event?n?.(e.event):void 0,u=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${s.border}`,background:s.bg,padding:12,cursor:l||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=s.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=s.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:s.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?s.priceActiveColor:s.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:[Li(e.volume)," ",i("predict.matches.volume")]})]});return l&&o?jsxRuntime.jsx(o,{href:l,className:"block",children:u}):u}function jh(e){return utils$1.formatAmountInUsd(e)}function FP({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,a=new Set;for(let s of e){s.max_spread!=null&&s.max_spread>o&&(o=s.max_spread),s.combined_volume!=null&&(i+=s.combined_volume);for(let l of s.entries)a.add(typeof l.source=="string"?l.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(So,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(So,{label:r("predict.matches.stats.totalVolume"),value:jh(n.totalVolume)}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(So,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(So,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function So({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 Ri(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function oc(e){return `${(e*100).toFixed(1)}\xA2`}function Gh(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function WP({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-semibold",Gh(e)),children:oc(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",oc(t)]})]})}var Mn=10,Zh=64,lc=40,Po=48;function cc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:a,isLoading:s,fetchNextPage:l,hasNextPage:u,isFetchingNextPage:m}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:c,isLoading:f,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=s||f,h=m||g,x=u||p,S=react.useMemo(()=>{let U=[];return a?.pages&&U.push(...a.pages.flatMap(Q=>Q.items)),c?.pages&&U.push(...c.pages.flatMap(Q=>Q.items)),U.sort((Q,H)=>(H.timestamp??0)-(Q.timestamp??0)),U},[a,c]),k=Math.max(1,Math.ceil(S.length/Mn)+(x?1:0)),b=(o-1)*Mn,y=S.slice(b,b+Mn),M=react.useCallback(()=>{i(U=>Math.max(1,U-1));},[]),R=react.useCallback(async()=>{o*Mn>=S.length&&x&&(u&&await l(),p&&await d()),i(Q=>Q+1);},[o,S.length,x,u,p,l,d]),P=o>1,C=o*Mn<S.length||x;if(v)return jsxRuntime.jsx(iv,{height:r});if(S.length===0&&!x)return jsxRuntime.jsx(ov,{message:n("predict.profile.noHistory"),height:r});let _=r-lc-Po;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:lc},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:_},children:[y.map((U,Q)=>jsxRuntime.jsx(ev,{trade:U},U.id??`${b+Q}`)),h&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Po},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!P,onClick:M,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",P?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(k,5)},(U,Q)=>{let H=Q+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(H),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",H===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:H},H)}),jsxRuntime.jsxs("button",{type:"button",disabled:!C,onClick:R,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Po},children:y.map((U,Q)=>jsxRuntime.jsx(tv,{trade:U},U.id??`m-${b+Q}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Po},children:[jsxRuntime.jsx("button",{type:"button",disabled:!P,onClick:M,className:ui$1.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:o}),jsxRuntime.jsx("button",{type:"button",disabled:!C,onClick:R,className:ui$1.cn("text-sm cursor-pointer",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function ev({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=dc(e.type,t),s=r||n,l=s?"+":"-",u=s?"text-success":"text-foreground",m=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,f=e.outcome??"",d=fc(e.timestamp),p=uc(e),g=rv(e),v=nv(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Zh},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:[c&&jsxRuntime.jsx("img",{src:c,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[f&&jsxRuntime.jsx("span",{className:"mr-1",children:f}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.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:mc(o)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:v!==null?`$${v.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:p&&jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(pc,{})})})]})}function tv({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=dc(e.type,t),s=e.event?.title??e.market?.question??"\u2014",l=fc(e.timestamp),u=uc(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:s})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:l})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",r?"text-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:mc(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"})]}),u&&jsxRuntime.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(pc,{})})]})]})}function dc(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 uc(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function rv(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 nv(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 pc(){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 ov({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function iv({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function mc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function fc(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(),s=t.getTimezoneOffset(),l=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${l}${u})`}var Tn=10,pv=64,hc=40,wo=48;function bc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,a]=react.useState(1),{data:s,isLoading:l,fetchNextPage:u,hasNextPage:m,isFetchingNextPage:c}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:f,isLoading:d,fetchNextPage:p,hasNextPage:g,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),h=l||d,x=c||v,S=m||g,k=react.useMemo(()=>{let H=[],Y=new Set(["live","open","submitted","pending"]);return s?.pages&&H.push(...s.pages.flatMap(q=>q.items).filter(q=>Y.has(q.status))),f?.pages&&H.push(...f.pages.flatMap(q=>q.items).filter(q=>Y.has(q.status))),H},[s,f]),b=react.useCallback(H=>{o.mutate({source:H.source,id:H.id});},[o]),y=Math.max(1,Math.ceil(k.length/Tn)+(S?1:0)),M=(i-1)*Tn,R=k.slice(M,M+Tn),P=react.useCallback(()=>{a(H=>Math.max(1,H-1));},[]),C=react.useCallback(async()=>{i*Tn>=k.length&&S&&(m&&await u(),g&&await p()),a(Y=>Y+1);},[i,k.length,S,m,g,u,p]),_=i>1,U=i*Tn<k.length||S;if(h)return jsxRuntime.jsx(hv,{height:r});if(k.length===0&&!S)return jsxRuntime.jsx(gv,{message:n("predict.profile.noOrders"),height:r});let Q=r-hc-wo;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:hc},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:Q},children:[R.map(H=>jsxRuntime.jsx(mv,{order:H,onCancel:b},H.id)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(vc,{className:"hidden lg:flex",currentPage:i,totalPages:y,canGoPrev:_,canGoNext:U,onPrev:P,onNext:C,onPage:a,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-wo},children:R.map(H=>jsxRuntime.jsx(fv,{order:H,onCancel:b},H.id))}),jsxRuntime.jsx(vc,{className:"lg:hidden",currentPage:i,totalPages:y,canGoPrev:_,canGoNext:U,onPrev:P,onNext:C,onPage:a,t:n,compact:true})]})}function mv({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:pv},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",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?xc(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function fv({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$1.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?xc(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 vc({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:a,onPage:s,t:l,compact:u}){return u?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:wo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui$1.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$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:wo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",l("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(m,c)=>{let f=c+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(f),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",f===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:f},f)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[l("predict.profile.next")," \u2192"]})]})}function gv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function hv({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function xc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Ai=10,yv=64,yc=40,No=48;function kc({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(1),l=react.useCallback(()=>{for(let g of e)n?.(g);},[e,n]);if(t)return jsxRuntime.jsx(wv,{height:r});if(e.length===0)return jsxRuntime.jsx(Pv,{message:i("predict.profile.noPositions"),height:r});let u=Math.max(1,Math.ceil(e.length/Ai)),m=(a-1)*Ai,c=e.slice(m,m+Ai),f=a>1,d=a<u,p=r-yc-No;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:yc},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:l,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:p},children:c.map((g,v)=>jsxRuntime.jsx(kv,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??m+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:No},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!f,onClick:()=>s(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",f?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(u,5)},(g,v)=>{let h=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(h),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",h===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:h},h)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>s(g=>g+1),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-No},children:c.map((g,v)=>jsxRuntime.jsx(Sv,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${m+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:No},children:[jsxRuntime.jsx("button",{type:"button",disabled:!f,onClick:()=>s(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm cursor-pointer",f?"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:()=>s(g=>g+1),className:ui$1.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function kv({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,s=e.current_price??0,l=e.current_value??e.size*s,u=e.size,m=o>0?"text-success":o<0?"text-danger":"text-foreground",c=o>0?"+":"",f=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,p=e.side,g=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?Nv(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:yv},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:f}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",p.toLowerCase()==="yes"?"text-success":"text-danger"),children:p}),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:["$",l.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:kr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fi(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fi(s)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",m),children:[jsxRuntime.jsxs("span",{children:[c,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",c,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",u.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:v}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function Sv({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,s=o>0?"text-success":o<0?"text-danger":"text-foreground",l=o>0?"+":"",u=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:u})]}),jsxRuntime.jsx("span",{className:ui$1.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(Co,{label:n("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx(Co,{label:n("predict.profile.markPrice"),value:Fi(a)}),jsxRuntime.jsx(Co,{label:n("predict.profile.pnl"),value:`${l}$${Math.abs(o).toFixed(2)} (${l}${i.toFixed(1)}%)`,className:s}),jsxRuntime.jsx(Co,{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 Co({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui$1.cn("font-mono text-foreground",r),children:t})]})}function Pv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function wv({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Fi(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Nv(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(),s=t.getTimezoneOffset(),l=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${l}${u})`}catch{return "\u2014"}}function Pc({positions:e,trades:t,isLoading:r,positionsValue:n,positionsValueLoading:o}){let{t:i}=i18n.useTranslation(),a=react.useMemo(()=>{let u=0,m=0;for(let g of e)u+=g.realized_pnl??0,m+=g.current_value??g.size*(g.current_price??0);let c=0,f=0,d=0;for(let g of t)c+=g.usd_size??0,g.type==="REDEEM"&&(d++,(g.usd_size??0)>0&&f++);let p=d>0?`${f} / ${d}`:"0 / 0";return {realizedPnl:u,positionsValue:n??m,volume:c,winRateStr:p}},[e,n,t]),s=a.realizedPnl>0?"text-success":a.realizedPnl<0?"text-danger":"text-foreground",l=a.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:i("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",s),children:[l,"$",Math.abs(a.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Hi,{label:i("predict.profile.winRate"),value:a.winRateStr,isLoading:r}),jsxRuntime.jsx(Hi,{label:i("predict.profile.positions"),value:`$${a.positionsValue.toFixed(2)}`,isLoading:o??r}),jsxRuntime.jsx(Hi,{label:i("predict.profile.volume"),value:`$${a.volume.toFixed(2)}`,isLoading:r})]})]})}function Hi({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Wi=600;function Ov({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState("positions"),s=!!(e||t),{data:l,isLoading:u}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:m,isLoading:c}=reactPredict.usePositions({source:"polymarket",user:t??""}),f=react.useMemo(()=>{let C=[];return l?.positions&&C.push(...l.positions),m?.positions&&C.push(...m.positions),C},[l,m]),d=u||c,{data:p,isLoading:g}=reactPredict.usePositionValueMulti({kalshi_user:e||void 0,polymarket_user:t||void 0}),v=react.useMemo(()=>{if(!p)return;let C=Number(p.value);return Number.isFinite(C)?C:void 0},[p?.value]),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:S,isLoading:k}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...h?.pages?.flatMap(_=>_.items)??[],...S?.pages?.flatMap(_=>_.items)??[]],[h,S]),y=d||x||k,M=f.length,P=[{key:"positions",label:M>0?`${o("predict.profile.positionsTab")} (${M})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("predict.profile.historyTab")}];return s?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Pc,{positions:f,trades:b,isLoading:y,positionsValue:v,positionsValueLoading:g}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:P.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(C.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===C.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:C.label},C.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(kc,{positions:f,isLoading:d,listHeight:Wi,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(bc,{solanaAddress:e,evmAddress:t,listHeight:Wi}),i==="history"&&jsxRuntime.jsx(cc,{solanaAddress:e,evmAddress:t,listHeight:Wi})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function Bw({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(false),[l,u]=react.useState(null),[m,c]=react.useState(false),f=r||m,d=n||m,p=f?"done":a?"running":"pending",g=d?"done":f&&a?"running":"pending",v=f&&d,h=react.useCallback(async()=>{u(null),c(false),s(true);try{await o(),c(!0);}catch(b){u(b instanceof Error?b.message:String(b));}finally{s(false);}},[o]),x=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:p},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],S=()=>{v?t():h();},k=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:b=>{b||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:x.map((b,y)=>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(Hv,{index:y+1,status:b.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:b.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${b.status==="done"?"text-[#c7ff2e]":b.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:b.status==="done"?i("predict.setup.stepComplete"):b.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:b.desc})]})]},b.key))}),l&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:l})}),jsxRuntime.jsx("button",{type:"button",onClick:S,disabled:a,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children: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")]}):k}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Hv({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})}
|
|
136
|
-
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,"usePositionValue",{enumerable:true,get:function(){return reactPredict.usePositionValue}});Object.defineProperty(exports,"usePositionValueMulti",{enumerable:true,get:function(){return reactPredict.usePositionValueMulti}});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=
|
|
135
|
+
`}),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:[c&&jsxRuntime.jsx("img",{src:c,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(Ul,{stats:v})})]}),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:u(Dh[m])}),v&&v.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:u("predict.matches.pairsFound",{count:v.activePairs})})]})]}),jsxRuntime.jsx(zl,{sortBy:m,onSortChange:S,sortAsc:f,onSortAscChange:k,minVolume:p,onMinVolumeChange:g,onRefresh:y})]})]}),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:u("predict.matches.experimentalFeature")})," \u2014 ",u("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Jl,{ref:x,sortBy:m,sortAsc:f,minVolume:p,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,onStatsChange:b})]}),jsxRuntime.jsx(Fh,{stats:v})]})}function Li(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var zh={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"}},Wh={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 Uh(e){return zh[e]??Wh}function $h(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 Kh(e,t){let r=e.entries.find(s=>s.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(s=>s.source===(t?.source_b??e.entries[1]?.source)),o=s=>{if(!s?.outcomes?.[0])return {name:null,price:null};let c=s.outcomes[0];return {name:c.label||null,price:c.best_ask??c.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 _P({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>$h(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[s,c]=react.useMemo(()=>Kh(e,i),[e,i]),u=a!=null&&a>=3;s.yesPrice!=null&&c.yesPrice!=null?s.source==="kalshi"?s.yesPrice>c.yesPrice:c.yesPrice>s.yesPrice:false;let l=s.yesPrice!=null&&c.yesPrice!=null?s.yesPrice<=c.yesPrice?s:c:null,f=l?ur(l.source):null,d=u?"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:p=>{let g=p.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:p=>{let g=p.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 ${u?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:u?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:u?"#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(tc,{data:s,isCheaper:l===s,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(tc,{data:c,isCheaper:l===c,onSelect:t,getEventHref:r,LinkComponent:n})]}),l&&f&&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:()=>l.event&&t?.(l.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:l.source.charAt(0).toUpperCase()+l.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"})]}),Li(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"})}),Li(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 tc({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=ur(e.source),s=Uh(e.source),c=e.event?n?.(e.event):void 0,u=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${s.border}`,background:s.bg,padding:12,cursor:c||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=s.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=s.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:s.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?s.priceActiveColor:s.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:[Li(e.volume)," ",i("predict.matches.volume")]})]});return c&&o?jsxRuntime.jsx(o,{href:c,className:"block",children:u}):u}function qh(e){return utils$1.formatAmountInUsd(e)}function BP({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,a=new Set;for(let s of e){s.max_spread!=null&&s.max_spread>o&&(o=s.max_spread),s.combined_volume!=null&&(i+=s.combined_volume);for(let c of s.entries)a.add(typeof c.source=="string"?c.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(ko,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(ko,{label:r("predict.matches.stats.totalVolume"),value:qh(n.totalVolume)}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(ko,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Ri,{}),jsxRuntime.jsx(ko,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function ko({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 Ri(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function oc(e){return `${(e*100).toFixed(1)}\xA2`}function Yh(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function UP({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-semibold",Yh(e)),children:oc(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",oc(t)]})]})}var Nn=10,tv=64,lc=40,So=48;function cc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:a,isLoading:s,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:m}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:l,isLoading:f,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=s||f,h=m||g,x=u||p,S=react.useMemo(()=>{let U=[];return a?.pages&&U.push(...a.pages.flatMap(Q=>Q.items)),l?.pages&&U.push(...l.pages.flatMap(Q=>Q.items)),U.sort((Q,H)=>(H.timestamp??0)-(Q.timestamp??0)),U},[a,l]),k=Math.max(1,Math.ceil(S.length/Nn)+(x?1:0)),b=(o-1)*Nn,y=S.slice(b,b+Nn),M=react.useCallback(()=>{i(U=>Math.max(1,U-1));},[]),R=react.useCallback(async()=>{o*Nn>=S.length&&x&&(u&&await c(),p&&await d()),i(Q=>Q+1);},[o,S.length,x,u,p,c,d]),P=o>1,C=o*Nn<S.length||x;if(v)return jsxRuntime.jsx(av,{height:r});if(S.length===0&&!x)return jsxRuntime.jsx(sv,{message:n("predict.profile.noHistory"),height:r});let _=r-lc-So;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:lc},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:_},children:[y.map((U,Q)=>jsxRuntime.jsx(rv,{trade:U},U.id??`${b+Q}`)),h&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:So},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!P,onClick:M,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",P?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(k,5)},(U,Q)=>{let H=Q+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(H),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",H===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:H},H)}),jsxRuntime.jsxs("button",{type:"button",disabled:!C,onClick:R,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-So},children:y.map((U,Q)=>jsxRuntime.jsx(nv,{trade:U},U.id??`m-${b+Q}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:So},children:[jsxRuntime.jsx("button",{type:"button",disabled:!P,onClick:M,className:ui$1.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:o}),jsxRuntime.jsx("button",{type:"button",disabled:!C,onClick:R,className:ui$1.cn("text-sm cursor-pointer",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function rv({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=dc(e.type,t),s=r||n,c=s?"+":"-",u=s?"text-success":"text-foreground",m=e.event?.title??e.market?.question??"\u2014",l=e.event?.image_url,f=e.outcome??"",d=fc(e.timestamp),p=uc(e),g=ov(e),v=iv(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:tv},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:[l&&jsxRuntime.jsx("img",{src:l,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:[f&&jsxRuntime.jsx("span",{className:"mr-1",children:f}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.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:mc(o)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-1 pr-2 text-right font-mono",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:v!==null?`$${v.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:p&&jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(pc,{})})})]})}function nv({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=dc(e.type,t),s=e.event?.title??e.market?.question??"\u2014",c=fc(e.timestamp),u=uc(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:s})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",r?"text-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:mc(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"})]}),u&&jsxRuntime.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(pc,{})})]})]})}function dc(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 uc(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function ov(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 iv(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 pc(){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 sv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function av({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function mc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function fc(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(),s=t.getTimezoneOffset(),c=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}var Cn=10,fv=64,hc=40,Po=48;function bc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,a]=react.useState(1),{data:s,isLoading:c,fetchNextPage:u,hasNextPage:m,isFetchingNextPage:l}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:f,isLoading:d,fetchNextPage:p,hasNextPage:g,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),h=c||d,x=l||v,S=m||g,k=react.useMemo(()=>{let H=[],Y=new Set(["live","open","submitted","pending"]);return s?.pages&&H.push(...s.pages.flatMap(q=>q.items).filter(q=>Y.has(q.status))),f?.pages&&H.push(...f.pages.flatMap(q=>q.items).filter(q=>Y.has(q.status))),H},[s,f]),b=react.useCallback(H=>{o.mutate({source:H.source,id:H.id});},[o]),y=Math.max(1,Math.ceil(k.length/Cn)+(S?1:0)),M=(i-1)*Cn,R=k.slice(M,M+Cn),P=react.useCallback(()=>{a(H=>Math.max(1,H-1));},[]),C=react.useCallback(async()=>{i*Cn>=k.length&&S&&(m&&await u(),g&&await p()),a(Y=>Y+1);},[i,k.length,S,m,g,u,p]),_=i>1,U=i*Cn<k.length||S;if(h)return jsxRuntime.jsx(bv,{height:r});if(k.length===0&&!S)return jsxRuntime.jsx(vv,{message:n("predict.profile.noOrders"),height:r});let Q=r-hc-Po;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:hc},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:Q},children:[R.map(H=>jsxRuntime.jsx(gv,{order:H,onCancel:b},H.id)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(vc,{className:"hidden lg:flex",currentPage:i,totalPages:y,canGoPrev:_,canGoNext:U,onPrev:P,onNext:C,onPage:a,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Po},children:R.map(H=>jsxRuntime.jsx(hv,{order:H,onCancel:b},H.id))}),jsxRuntime.jsx(vc,{className:"lg:hidden",currentPage:i,totalPages:y,canGoPrev:_,canGoNext:U,onPrev:P,onNext:C,onPage:a,t:n,compact:true})]})}function gv({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:fv},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",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?xc(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function hv({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$1.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?xc(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 vc({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:a,onPage:s,t:c,compact:u}){return u?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Po},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui$1.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$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Po},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",c("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(m,l)=>{let f=l+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(f),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",f===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:f},f)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[c("predict.profile.next")," \u2192"]})]})}function vv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function bv({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function xc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var Ai=10,Sv=64,yc=40,wo=48;function kc({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(1),c=react.useCallback(()=>{for(let g of e)n?.(g);},[e,n]);if(t)return jsxRuntime.jsx(Cv,{height:r});if(e.length===0)return jsxRuntime.jsx(Nv,{message:i("predict.profile.noPositions"),height:r});let u=Math.max(1,Math.ceil(e.length/Ai)),m=(a-1)*Ai,l=e.slice(m,m+Ai),f=a>1,d=a<u,p=r-yc-wo;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:yc},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:c,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:p},children:l.map((g,v)=>jsxRuntime.jsx(Pv,{position:g,onClosePosition:n,onEventClick:o},`${g.source}-${g.market?.slug??m+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:wo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!f,onClick:()=>s(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",f?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(u,5)},(g,v)=>{let h=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(h),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",h===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:h},h)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>s(g=>g+1),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-wo},children:l.map((g,v)=>jsxRuntime.jsx(wv,{position:g,onClose:n,onEventClick:o},`${g.source}-${g.market?.slug??`m-${m+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:wo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!f,onClick:()=>s(g=>Math.max(1,g-1)),className:ui$1.cn("text-sm cursor-pointer",f?"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:()=>s(g=>g+1),className:ui$1.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Pv({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,s=e.current_price??0,c=e.current_value??e.size*s,u=e.size,m=o>0?"text-success":o<0?"text-danger":"text-foreground",l=o>0?"+":"",f=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,p=e.side,g=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?Mv(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:Sv},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:f}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",p.toLowerCase()==="yes"?"text-success":"text-danger"),children:p}),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:["$",c.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:kr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fi(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fi(s)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",m),children:[jsxRuntime.jsxs("span",{children:[l,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",l,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",u.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:v}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),n("predict.profile.close")]})})]})}function wv({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,s=o>0?"text-success":o<0?"text-danger":"text-foreground",c=o>0?"+":"",u=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:u})]}),jsxRuntime.jsx("span",{className:ui$1.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(No,{label:n("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx(No,{label:n("predict.profile.markPrice"),value:Fi(a)}),jsxRuntime.jsx(No,{label:n("predict.profile.pnl"),value:`${c}$${Math.abs(o).toFixed(2)} (${c}${i.toFixed(1)}%)`,className:s}),jsxRuntime.jsx(No,{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 No({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui$1.cn("font-mono text-foreground",r),children:t})]})}function Nv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Cv({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Fi(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Mv(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(),s=t.getTimezoneOffset(),c=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}catch{return "\u2014"}}function Pc({positions:e,trades:t,isLoading:r,positionsValue:n,positionsValueLoading:o}){let{t:i}=i18n.useTranslation(),a=react.useMemo(()=>{let u=0,m=0;for(let g of e)u+=g.realized_pnl??0,m+=g.current_value??g.size*(g.current_price??0);let l=0,f=0,d=0;for(let g of t)l+=g.usd_size??0,g.type==="REDEEM"&&(d++,(g.usd_size??0)>0&&f++);let p=d>0?`${f} / ${d}`:"0 / 0";return {realizedPnl:u,positionsValue:n??m,volume:l,winRateStr:p}},[e,n,t]),s=a.realizedPnl>0?"text-success":a.realizedPnl<0?"text-danger":"text-foreground",c=a.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:i("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",s),children:[c,"$",Math.abs(a.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Hi,{label:i("predict.profile.winRate"),value:a.winRateStr,isLoading:r}),jsxRuntime.jsx(Hi,{label:i("predict.profile.positions"),value:`$${a.positionsValue.toFixed(2)}`,isLoading:o??r}),jsxRuntime.jsx(Hi,{label:i("predict.profile.volume"),value:`$${a.volume.toFixed(2)}`,isLoading:r})]})]})}function Hi({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Wi=600;function Av({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState("positions"),s=!!(e||t),{data:c,isLoading:u}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:m,isLoading:l}=reactPredict.usePositions({source:"polymarket",user:t??""}),f=react.useMemo(()=>{let C=[];return c?.positions&&C.push(...c.positions),m?.positions&&C.push(...m.positions),C},[c,m]),d=u||l,{data:p,isLoading:g}=reactPredict.usePositionValueMulti({kalshi_user:e||void 0,polymarket_user:t||void 0}),v=react.useMemo(()=>{if(!p)return;let C=Number(p.value);return Number.isFinite(C)?C:void 0},[p?.value]),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:S,isLoading:k}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...h?.pages?.flatMap(_=>_.items)??[],...S?.pages?.flatMap(_=>_.items)??[]],[h,S]),y=d||x||k,M=f.length,P=[{key:"positions",label:M>0?`${o("predict.profile.positionsTab")} (${M})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("predict.profile.historyTab")}];return s?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Pc,{positions:f,trades:b,isLoading:y,positionsValue:v,positionsValueLoading:g}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:P.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(C.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===C.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:C.label},C.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(kc,{positions:f,isLoading:d,listHeight:Wi,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(bc,{solanaAddress:e,evmAddress:t,listHeight:Wi}),i==="history"&&jsxRuntime.jsx(cc,{solanaAddress:e,evmAddress:t,listHeight:Wi})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function Hw({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(false),[c,u]=react.useState(null),[m,l]=react.useState(false),f=r||m,d=n||m,p=f?"done":a?"running":"pending",g=d?"done":f&&a?"running":"pending",v=f&&d,h=react.useCallback(async()=>{u(null),l(false),s(true);try{await o(),l(!0);}catch(b){u(b instanceof Error?b.message:String(b));}finally{s(false);}},[o]),x=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:p},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:g}],S=()=>{v?t():h();},k=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:b=>{b||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:x.map((b,y)=>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(Wv,{index:y+1,status:b.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:b.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${b.status==="done"?"text-[#c7ff2e]":b.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:b.status==="done"?i("predict.setup.stepComplete"):b.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:b.desc})]})]},b.key))}),c&&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:c})}),jsxRuntime.jsx("button",{type:"button",onClick:S,disabled:a,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children: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")]}):k}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Wv({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})}
|
|
136
|
+
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,"usePositionValue",{enumerable:true,get:function(){return reactPredict.usePositionValue}});Object.defineProperty(exports,"usePositionValueMulti",{enumerable:true,get:function(){return reactPredict.usePositionValueMulti}});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=ib;exports.CHART_RANGE_PERIOD=nb;exports.CHART_RANGE_SAMPLE_INTERVAL=ob;exports.CandlestickPeriod=Fn;exports.CategoriesSkeleton=Gv;exports.CategoriesUI=Gi;exports.CategoriesWidget=Xi;exports.ChartRange=le;exports.CommentItemUI=xi;exports.DEFAULT_CHART_RANGE=Bn;exports.DEFAULT_FILTER_STATE=ln;exports.DEFAULT_PAGE_SIZE=on;exports.DEFAULT_PRICE_HISTORY_INTERVAL=cb;exports.EventCommentsWidget=Ug;exports.EventDetailPage=L2;exports.EventDetailSkeleton=hn;exports.EventDetailUI=Ja;exports.EventDetailWidget=Za;exports.EventItem=Ws;exports.EventMarketDepthChartUI=_a;exports.EventMarketDetailWidget=Ha;exports.EventPriceChart=$a;exports.EventsFilterUI=xs;exports.EventsHero=oy;exports.EventsPage=Zx;exports.EventsPageSkeleton=Nx;exports.EventsSkeleton=jo;exports.EventsToolbarUI=Ns;exports.EventsUI=js;exports.EventsWidget=qs;exports.KycModal=Vn;exports.MAX_PRICE_HISTORY_MARKETS=Fo;exports.MatchGroupCard=_P;exports.MatchMarketCard=Gl;exports.MatchesFilterBar=zl;exports.MatchesHero=Ul;exports.MatchesPage=NP;exports.MatchesStatsBar=BP;exports.MatchesWidget=Jl;exports.ORDER_MAX_PRICE=lb;exports.ORDER_MIN_PRICE=ab;exports.ORDER_MIN_QUANTITY=Hn;exports.ORDER_MIN_USDC=zn;exports.ORDER_PRICE_STEP=sb;exports.POLYMARKET_BUILDER_TAKER_FEE_BPS=Qc;exports.POLYMARKET_SPORTS_TAKER_FEE_BPS=Xc;exports.PREDICT_REDEEM_MODAL_ID=Ep;exports.PREDICT_SEARCH_MODAL_ID=Ni;exports.PREDICT_SELL_MODAL_ID=ii;exports.PREDICT_TRADE_MODAL_ID=an;exports.PRICE_HISTORY_SAMPLE_INTERVAL=db;exports.PredictRedeemModal=oa;exports.PredictSearchModal=ES;exports.PredictSellModal=xa;exports.PredictTradeModal=qn;exports.PredictWalletProvider=jc;exports.PriceHistoryInterval=zr;exports.ProfilePage=Av;exports.RedeemFormWidget=ra;exports.SORT_PRESETS=ws;exports.STATIC_CATEGORIES=Do;exports.SearchEventsButton=BS;exports.SearchHistoryUI=gl;exports.SearchHistoryWidget=hl;exports.SearchInputUI=vl;exports.SearchResultItemUI=bl;exports.SearchResultListWidget=Pl;exports.SearchWidget=Tl;exports.SellFormUI=va;exports.SellFormWidget=ro;exports.SetupModal=Hw;exports.SimilarEventCard=dg;exports.SimilarEventsSection=nl;exports.SourceBadge=i2;exports.SpreadIndicator=UP;exports.TradeFormSkeleton=Na;exports.TradeFormUI=vs;exports.TradeFormWidget=Gn;exports.UserActivitySection=Sa;exports.computeMaxBuyAmount=rs;exports.countActiveFilters=Vo;exports.createTradeResultToast=Ur;exports.estimatePolymarketBuyFee=ns;exports.estimatePolymarketSellFee=os;exports.fireCelebration=is;exports.floorToDecimals=be;exports.formatKMB=vn;exports.formatShares=kr;exports.getSourceMeta=ur;exports.parsePolymarketError=$n;exports.polymarketFeeFactor=Yc;exports.resolveExpiration=Wn;exports.resolvePolymarketDisplayFeeRateBps=ts;exports.roundToTickSize=Un;exports.useEventDetail=F2;exports.useEventsInfinite=Ts;exports.usePredictSearchHistory=vo;exports.usePredictWallet=yr;exports.useSearchResultListScript=xl;exports.useSearchScript=Ml;exports.useSellForm=ca;exports.useTradeForm=cs;//# sourceMappingURL=index.js.map
|
|
137
137
|
//# sourceMappingURL=index.js.map
|