1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,344663,110420,896782,369094,e=>{"use strict";var t=e.i(394390),n=e.i(183023),r=e.i(43690),l=e.i(395244),a=e.i(924399),i=e.i(386964),s=e.i(185521),o=e.i(942553),u=e.i(243733),c=e.i(60685),d=e.i(617397),p=e.i(77175),f=e.i(403353),m=e.i(906450),h=e.i(13283),x=e.i(827023),g=e.i(444171),v=e.i(894771),b=e.i(142298),w=e.i(188944),y=e.i(284139),j=e.i(872501),C=e.i(98046),k=e.i(127550);let N=[[1200,8e3],[1400,2e3],[2400,5200]],R=([e,t])=>e+Math.random()*(t-e),S=[{symbol:"BTC",weight:28,leverageBps:394477},{symbol:"SOL",weight:28,leverageBps:247831},{symbol:"ETH",weight:18,leverageBps:247831},{symbol:"HYPE",weight:8,leverageBps:99650},{symbol:"SUI",weight:5,leverageBps:99650},{symbol:"DOGE",weight:5,leverageBps:99650},{symbol:"LINK",weight:4,leverageBps:99650},{symbol:"PUMP",weight:4,leverageBps:99650}];function M(e,t){return e>0&&t>0&&Math.abs(t-e)>=1}async function P(e,t,n){let r=(0,C.packLazerSymbol)(e);if(null===r)return[];try{return(await (0,y.fetchPythBenchmarksOHLCV)(r,"1H",n-t,n)).filter(e=>Number.isFinite(e.close)&&e.close>0)}catch{return[]}}function E(e,t,n,r,l){let a=e.at(-1)?.close;if(void 0===a||!M(t,n))return null;let i=n/100*(r/1e4),s=a*(1+(l?1:-1)*(t-n)/100/i);if(!Number.isFinite(s)||s<=0)return null;for(let t=e.length-1;t>=0;t-=1)if(e[t].low<=s&&s<=e[t].high)return{price:s,at:e[t].time};return null}function A(e){return e>=250?3:e>0?2:1}async function B(e,t,n,r=0){let l=function(){let e=Math.random()*S.reduce((e,t)=>e+t.weight,0);for(let t of S)if((e-=t.weight)<=0)return t;return S[0]}(),a=.5>Math.random(),i=Math.round(e*l.leverageBps/1e4),s=Math.min(i,5e6),o=s<i,u=o?Math.round(1e4*s/Math.max(e,1)):l.leverageBps,c=Math.floor(Date.now()/1e3),d=A(r)>=3?function(e,t){let n=t/2;if(e<=n)return Math.round(t*(.525+.225*Math.random()));let r=Math.min(Math.max(n,.5*e),.98*e);return Math.round(r+Math.random()*(.98*e-r))}(e,t):null,p=d??t-r,f=function(e,t,n){let r=t/100*(n/1e4);if(r<=0)return 604800;let l=Math.abs(e-t)/100/r;return l<.02?604800:l<.05?2592e3:l<.1?10368e3:3456e4}(p,e,u),m=await P(l.symbol,f,c),h=E(m,p,e,u,a);if(null===h&&m.length>0&&f<3456e4&&M(p,e)){let t=await P(l.symbol,3456e4,c);t.length>0&&(h=E(m=t,p,e,u,a))}let x=m.at(-1)?.close??null;return{venue:"phoenix",market:l.symbol,isLong:a,leverageBps:u,rolledLeverageBps:l.leverageBps,notionalCapped:o,collateralCents:e,notionalCents:s,entryPriceMicros:null===x?null:Math.round(1e6*x),backdatedEntryPriceMicros:null===h?null:Math.round(1e6*h.price),backdatedEntryAt:h?.at??null,stakeCents:t,ripFeeCents:r,storyCollateralCents:d,payoutVersion:A(r),positionRef:null,profileIndex:n,epochId:7,nonce:Math.floor(900*Math.random())+100,clientSeed:"simulated",serverSeedHash:"simulated"}}let T=0;var U=e.i(762974),_=e.i(423816);function I(e){let t=function(e){let t=e.priceCents/2,n=0,r=0;for(let l of e.tiers)(l.maxValueCents??1/0)<=t&&(n+=l.probabilityBps),l.minValueCents>=e.priceCents&&(r+=l.probabilityBps);return{inProfitBps:1e4-n,beatsPriceBps:r}}(e),n=e=>`${Math.round(e/100)}%`;return{inProfit:n(t.inProfitBps),beatsPrice:n(t.beatsPriceBps)}}e.s(["issueOddsParams",0,I],110420);var F=e.i(299959),L=e.i(621617),O=e.i(88622),$=e.i(442700),z=e.i(916484),D=e.i(255381);let K={packs:0,spentCents:0};function H(){let e={state:K,counted:new Set,listeners:new Set,subscribe:t=>(e.listeners.add(t),()=>e.listeners.delete(t)),snapshot:()=>e.state};return e}let G={live:H(),bench:H()},W=()=>K;var V=e.i(167921),q=e.i(153517),Y=e.i(44971),Q=e.i(430232);let X={state:"ready",payFromProfileIndex:0,needUsdc:0,walletUsdc:0,profileAvailableUsdc:0,shortfallUsdc:0,loanBlockKnown:!0,needsSol:!1,solLamports:0,minSolLamports:0,isFunding:!1,fund:async()=>{}},J={generating:"stepGenerating",signing:"stepSigning",submitting:"stepSubmitting",opening:"stepOpening"},Z=$.RIP_GESTURE.armCooldown;function ee(e){let{wallet:t,machine:s,onBusyChange:o}=e,u=!!t&&"imperial"===e.venue&&!e.simulate,c=(0,r.useQuery)({queryKey:["rip","free-packs",t],queryFn:()=>(0,l.fetchFreePacks)(t),enabled:u,staleTime:0,refetchOnMount:"always",refetchInterval:15e3}
1),[d,p]=(0,n.useState)(null),[f,m]=(0,n.useState)(null);(0,n.useEffect)(()=>{let n=(0,i.readInFlightPack)(t);p(!!(t&&((0,i.readPendingKey)(t,e.venue,s.id)||n?.venue===e.venue&&n.machine===s.id)))},[t,e.venue,s.id]);let h=u&&null!==d&&c.isFetchedAfterMount&&!c.isError?(0,a.freePackForMachine)(c.data?.packs??[],s,d):null;!f&&h&&m({pack:h});let x=f?f.pack:h,g=(0,n.useCallback)(e=>{e&&m(e=>e??{pack:null}),o?.(e)},[o]),v=u&&!f&&!d&&(null===d||c.isPending||!c.isFetchedAfterMount),b=u&&!f&&!d&&c.isError;return(0,n.createElement)(et,{...e,key:x?.campaign??"paid",campaign:x?.campaign,claimProfileIndex:x?.profileIndex??void 0,claimCheck:b?"error":v?"loading":void 0,onRetryClaimCheck:()=>void c.refetch(),onBusyChange:g})}function et({venue:e,machine:r,venueName:l,basisLabel:a,packArt:i=null,picker:y=null,oddsHref:C=null,onBusyChange:S,simulate:M=!1,campaign:P,claimProfileIndex:E,claimCheck:A,onRetryClaimCheck:L}){let K,H,W=(0,o.useTranslations)("rip"),V=(0,o.useTranslations)("wallet"),{intlTag:ee}=(0,F.useFormatters)(),{publicKey:el}=(0,b.useUnifiedWallet)(),{activeProfileIndex:ea}=(0,v.useProfile)(),ei=void 0!==P;(0,n.useEffect)(O.unlock,[]);let es=(0,n.useMemo)(()=>({usdcCents:r.priceCents,needsSol:j.VENUE_USER_PAYS_NETWORK_FEE[e]}),[r.priceCents,e]),eo=j.VENUE_PAYS_POSITIONS[r.venue],eu=!1!==M,ec=(0,g.useRipFunding)(eu||ei||A?null:es),ed=eu?X:ec,ep=(0,_.useRipPurchase)(e,r.id,ei?E??ea:ed.payFromProfileIndex,{inert:eu,ripFeeCents:r.ripFeeCents,campaign:P}),ef=function(e,{forcedTier:t=null}={}){let[r,l]=(0,n.useState)("idle"),[a,i]=(0,n.useState)(null),s=(0,n.useRef)([]),o=(0,n.useRef)(0),u=(0,w.useRipFeed)(30),c=(0,n.useCallback)(()=>{s.current.forEach(e=>window.clearTimeout(e)),s.current=[]},[]);(0,n.useEffect)(()=>c,[c]);let d=(0,n.useCallback)((e,t)=>{s.current.push(window.setTimeout(t,e))},[]),p=(0,n.useCallback)(()=>{c(),i(null),l("idle")},[c]),f=(0,n.useCallback)(async()=>{c();let n=++T;o.current=n,i(null),l("generating");let[r,a,s]=N.map(R);d(r,()=>l("submitting")),d(r+a,()=>l("opening")),d(r+a+s,()=>void(async()=>
1{let r=(0,k.byRarity)(e.tiers),a=(t?e.tiers.find(e=>e.name===t)??null:null)??function(e){if(0===e.length)return null;let t=e.reduce((e,t)=>e+t.probabilityBps,0);if(t<=0)return e[0];let n=Math.random()*t;for(let t of e)if((n-=t.probabilityBps)<=0)return t;return e[e.length-1]}(e.tiers),s=(u.data?.entries??[]).find(e=>e.imageUrl),c={mint:`simulated-${n}`,name:s?.cardName??"1999 Pokémon Game Charizard-Holo",tier:a?.name??r[r.length-1]?.name??null,valueCents:function(e){if(!e)return 1300;let t=e.maxValueCents??4*e.minValueCents;return Math.round(e.minValueCents+Math.random()*Math.max(0,t-e.minValueCents))}(a),valueBasis:e.valueBasis,imageUrl:s?.imageUrl??null,grade:"10",gradingCompany:"PSA",category:null,nftStandard:"core",cashedOut:!1,cashedOutCents:null};j.VENUE_PAYS_POSITIONS[e.venue]&&(c.mint=null,c.imageUrl=null,c.grade=null,c.gradingCompany=null,c.name=null,c.position=await B(c.valueCents??0,e.priceCents,0,e.ripFeeCents??0),o.current!==n)||(i({venue:e.venue,venueRef:`simulated-${n}`,memo:null,status:"completed",card:c,retryAfterMs:null,openSignature:null}),l("revealed"))})())},[d,c,u.data,e,t]);return{step:r,order:null,signature:null,opened:a,error:null,hasLivePack:!1,inFlight:"idle"!==r&&"revealed"!==r&&"failed"!==r,hasUnresolvedPurchase:!1,failedAt:null,prepaid:!0,start:f,resume:f,reset:p}}(r,"object"==typeof M?M:{}),em=eu?ef:ep,eh=em.opened?.card??null,ex="revealed"===em.step,[eg,ev]=(0,n.use
1State)(!1),eb=em.inFlight,ew=(0,h.fmtUsdMicro)(1e4*r.priceCents,ee),ey=!1===M?"live":"bench",ej=(0,n.useMemo)(()=>(0,D.perpPackArt)(r),[r]);(0,n.useEffect)(()=>{eo&&!ej&&console.error(`rip: no pouch art for ${r.venue}/${r.id}; the stage falls back to the drawn pack`)},[eo,ej,r.venue,r.id]);let eC=(0,n.useCallback)(()=>{ei||(ev(!1),em.reset(),em.start())},[em.reset,em.start,ei]),ek="opening"===em.step||ex,eN=em.order?.venueRef??em.opened?.venueRef??null;(0,n.useEffect)(()=>{ek&&eN&&function(e,t,n,r){let l=G[e],a=`${t}:${n}`;if(!l.counted.has(a))for(let e of(l.counted.add(a),l.state={packs:l.state.packs+1,spentCents:l.state.spentCents+r},l.listeners))e()}(ey,e,eN,ei?0:r.priceCents)},[ek,eN,ey,e,r.priceCents,ei]);let eR=eh?(0,k.ceremonyOf)(eh,r):null,eS=eh?(0,k.hitOf)(eh,r)?.rank??null:null,[eM,eP]=(0,n.useState)(!1),[eE,eA]=(0,n.useState)(!1),eB=(0,n.useCallback)(()=>eA(!0),[]),eT=(0,n.useRef)(null),[eU,e_]=(0,n.useState)(0),eI=(0,n.useCallback)(()=>{eP(!0),e_(Math.floor(Date.now()/1e3))},[]);(0,n.useEffect)(()=>{if(!ex){eP(!1),eA(!1),eO(!1),null!==eT.current&&window.clearTimeout(eT.current),eT.current=null;return}let e=(0,$.ripTimeline)($.RIP_TIMING,eR);return eT.current=window.setTimeout(eI,e.faceAt+$.RIP_TIMING.minCharge+1500),()=>{null!==eT.current&&window.clearTimeout(eT.current),eT.current=null}},[ex,eR]);let eF=(K=em.step,U.CHARGING_STEPS.has(K)||ex&&!eM);(0,n.useEffect)(()=>(S?.(eF||eb),()=>S?.(!1)),[eF,eb,S]);let[eL,eO]=(0,n.useState)(!1),e$=(0,U.useRipCharge)(em.step,{blown:eL,faceUp:eM}),ez=(em.hasLivePack||em.hasUnresolvedPurchase)&&!ex,eD=!A&&!eF&&r.active&&!(ei&&ex)&&(ez||(ei?!!el:"ready"===ed.state)),eK=!A&&!eF&&!ez&&(ei?!el:"noWallet"===ed.state),[eH,eG]=(0,n.useState)(0),eW=(0,n.useRef)(0),eV=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=eV.current;if(eV.current=eD,!eD||!0===e)return;let t=performance.now();t-eW.current<Z||(eW.current=t,eG(e=>e+1))},[eD]);let eq=()=>{if(!eF&&eD){if(ev(!1),em.hasLivePack&&!ex)return void em.resume();ex&&em.reset(),em.start()}},eY=!eD||ez,eQ=(0,n.useRef)(null),eX=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{null!==eX.current&&window.clearTimeout(eX.current)},[]),(0,n.useEffect)(()=>{eQ.current===em.step||(eQ.current=em.step,"revealed"!==em.step&&"failed"===em.step&&"signing"!==em.failedAt&&(0,O.play)("error"))},[em.step,em.opened,em.failedAt,r]);let eJ=(0,n.useRef)(null),eZ=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!U.CHARGING_STEPS.has(em.step))return;let e=()=>{let e=e$.ref.current;for(let t of eJ.current?.getAnimations()??[])"rip-charge-sweep"===t.animationName&&(t.playbackRate=1+$.SWEEP_GAIN*e)};e();let t=window.setInterval(e,U.CHARGE_TICK_MS);return()=>window.clearInterval(t)},[em.step,e$]),(0,n.useEffect)(()=>{("idle"===em.step||"failed"===em.step)&&(eZ.current?.cancel(),eZ.current=null)},[em.step]),(0,n.useEffect)(()=>()=>{eZ.current?.cancel(),eZ.current=null},[]);let e0=(0,n.useCallback)(()=>{eO(!0),eZ.current?.release(),eZ.current=null},[]),e1=(0,n.useCallback)(e=>{eZ.current?.cancel(),eZ.current=(0,O.openRise)(e/1e3)},[]),e2=(0,n.useCallback)(e=>{null!==eX.current&&window.clearTimeout(eX.current),eX.current=window.setTimeout(()=>(0,O.fanfare)(eR),e)},[eR]),e4=ez?W("resumeRip"):null,e3=(H=em.step)in J?J[H]:null,e5=e3?W(e3):eF?W("revealPending"):null,e6=(0,q.cn)(x.METAL_KEY,"rip-buy-key",eh?"w-full":"w-full max-w-[340px]",eF&&"rip-neon--charging !opacity-100"),e9=(0,t.jsxs)(t.Fragment,{children:[eF?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"flex items-center gap-4 opacity-0",children:(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:W("rip"),figure:ew})}),(0,t.jsx)("span",{"aria-live":"polite",className:"absolute inset-0 z-[1] flex items-center justify-center px-6",children:(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:e5??W("stepOpening")})}),(0,t.jsx)("span",{ref:eJ,"aria-hidden":!0,className:"rip-charge-bar"})]}):e4?(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:e4}):eK?(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:ei?W("claimFreeRip"):V("connectWallet")}):ei?(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:W("claimFreeRip")}):(0,t.jsx)(x.NeonKeyFace,{tone:"metal",label:W(ex?eg?"ripAnotherPlain":"ripAgain":"rip"),figure:ew}),eH>
10&&eD&&(0,t.jsx)("span",{"aria-hidden":!0,className:"rip-arm-flash"},eH)]});return(0,t.jsxs)("div",{className:"flex w-full flex-col items-center gap-5",style:(0,$.ripCssVars)(),children:[(0,t.jsx)(f.RipStage,{onCardShown:e2,onOpenStart:e1,onBlowout:e0,onFaceUp:eI,onCeremonyDone:eB,packArt:i,card:eh,step:em.step,charge:e$,rank:eR,packPriceCents:r.priceCents,positionPrize:eo,simulate:eu,basisLabel:a,holdLabel:W(ei?"claimFreeRip":"holdToRip"),holdDisabled:eY,onHoldComplete:eq,packOpener:ej}),y,(0,t.jsx)(p.LeaveGuard,{active:eb}),(0,t.jsxs)("div",{className:(0,q.cn)("flex flex-col items-center gap-3",eo?"w-full max-w-[340px]":m.STAGE_WIDTH),children:[eo&&!eF&&!eM&&(0,t.jsx)("p",{className:"w-full text-center text-[11px] leading-relaxed text-text-muted",children:W("packIssueOddsShort",I(r))}),ei&&eM&&ex?null:r.active?eK?(0,t.jsx)("button",{type:"button",onPointerEnter:e=>(0,O.hover)(e),onClick:Q.promptConnectWallet,className:e6,children:e9}):(0,t.jsx)(s.HoldToRip,{bare:!0,label:W(ei?"claimFreeRip":ex?eg?"ripAnotherPlain":"ripAgain":"rip"),disabled:!eD,onComplete:()=>{(0,O.play)("coin"),eq()},className:e6,children:e9}):(0,t.jsx)("span",{className:(0,q.cn)("flex w-full items-center justify-center rounded-xl border border-border py-4","px-5 font-mono text-[11px] tracking-tight text-text-disabled"),children:W("packUnavailable")}),eM&&eh&&(0,t.jsx)(u.ExitRouter,{card:eh,venue:e,venueRef:em.order?.venueRef??null,custodied:em.prepaid,simulate:eu,onSold:em.reset,onPositionClosed:()=>ev(!0),receiptReady:eE||eu,packPrice:ew,canRipAnother:!ei&&eD,onRipAnother:ei?void 0:eC}),eM&&eh&&(0,t.jsx)(c.RipShareButton,{variant:"key",subject:(0,z.shareOfPulledCard)({card:eh,venue:e,rank:eS,packPriceCents:r.priceCents,basisLabel:a,packArt:ej?.front??null,timestamp:eU})}),"loading"===A&&(0,t.jsx)(Y.Note,{children:W("checkingFreePacks")}),"error"===A&&(0,t.jsx)("button",{type:"button",onClick:L,className:"text-xs text-text-muted underline",children:W("freePacksRetry")}),(0,t.jsx)(er,{scope:ey,oddsHref:C})]}),!ez&&!ei&&!A&&(0,t.jsx)(d.FundingBlocker,{funding:ed,venueName:l,needsSol:em.order?.funding.needsSol??es.needsSol}),em.signature&&(0,t.jsx)("a",{href:`https://solscan.io/tx/${em.signature}`,target:"_blank",rel:"noreferrer",className:"font-mono text-[11px] text-muted-foreground hover:text-foreground",children:W("viewTransaction")}),em.error&&(ei?(0,t.jsx)(Y.Note,{tone:"error",children:em.error.message}):(0,t.jsx)(en,{error:em.error,hasLivePack:em.hasLivePack&&!ex,failedAt:em.failedAt}))]})}function en({error:e,hasLivePack:n,failedAt:r}){let l=(0,o.useTranslations)("rip");if("signing"===r&&!(e instanceof V.VenueTransactionMutatedError)&&!(e instanceof _.VenueCannotBroadcastError))return null;if(e instanceof V.VenueTransactionMutatedError)return(0,t.jsx)(Y.Note,{tone:"error",children:l("errorTransactionMutated",{detail:e.detail})});if(e instanceof _.VenueCannotBroadcastError)return(0,t.jsx)(Y.Note,{tone:"error",children:l("errorVenueCannotBroadcast")});
1if(e instanceof L.RipRequestError&&e.isComparisonOnly)return(0,t.jsx)(Y.Note,{tone:"error",children:l("errorVenueComparisonOnly")});let a=e instanceof L.RipRequestError&&429===e.status;return(0,t.jsxs)("div",{className:"flex w-full max-w-[420px] flex-col gap-1",children:[(0,t.jsx)(Y.Note,{tone:"error",children:e.message}),a&&(0,t.jsx)(Y.Note,{tone:"warn",children:l("errorRateLimited")}),n&&(0,t.jsx)(Y.Note,{tone:"warn",children:l("errorPackIsLive")})]})}function er({scope:e,oddsHref:r}){let l,a=(0,o.useTranslations)("rip"),{intlTag:i}=(0,F.useFormatters)(),s=(l=G[e],(0,n.useSyncExternalStore)(l.subscribe,l.snapshot,W));return(0,t.jsxs)("p",{className:"flex items-center justify-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)("span",{children:a("sessionLine",{packs:s.packs,spent:(0,h.fmtUsdMicro)(1e4*s.spentCents,i)})}),r&&(0,t.jsxs)("span",{className:"contents lg:hidden",children:[(0,t.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,t.jsxs)("a",{href:r,className:"underline decoration-dotted underline-offset-4 hover:text-foreground",children:[a("columnOdds")," âº"]})]})]})}e.s(["RipCheckout",0,function(e){let{publicKey:n}=(0,b.useUnifiedWallet)(),r=n?.toBase58()??null;return(0,t.jsx)(ee,{...e,wallet:r},`${r}:${e.venue}:${e.machine.id}`)}],344663);var el=e.i(807956),ea=e.i(457058),ei=e.i(811076),es=e.i(454028);let eo=(0,el.default)(()=>e.A(509314),{loadableGenerated:{modules:[283757]},ssr:!1});function eu({priceCents:e,className:r}){let[l,a]=(0,n.useState)(!1),i=(0,n.useCallback)(()=>a(!0),[]),s=`$${Math.round(e/100).toLocaleString("en-US")}`;return(0,t.jsx)("div",{className:(0,q.cn)("relative aspect-[0.58] w-full",r),children:l?(0,t.jsx)(ec,{priceCents:e}):(0,t.jsx)(eo,{priceCents:e,label:`Imperial ${s} perps pack`,onUnavailable:i})})}function ec({priceCents:e}){let r=(0,n.useRef)(null);return(0,n.useEffect)(()=>{let t=r.current;if(!t)return;let n=!1,l=()=>{if(n)return;let r=Math.min(window.devicePixelRatio||1,2);t.width=es.PACK_W*r,t.height=es.PACK_H*r;let l=t.getContext("2d");l?(l.scale(r,r),(0,es.paintPerpPackFace)(l,e)):console.warn("[rip] no 2d context for the flat perp pack")};return l(),(0,es.packFaceFontReady)().then(l),()=>{n=!0}},[e]),(0,t.jsx)("canvas",{ref:r,className:"size-full motion-safe:animate-pack-float drop-shadow-[0_18px_36px_rgba(0,0,0,0.6)]",style:{width:"100%",height:"100%"}})}let ed=(0,el.default)(()=>e.A(2378),{loadableGenerated:{modules:[460648]},ssr:!1}),ep="aspect-[0.58]";e.s(["PackArt",0,function({name:e,venueName:r,venue:l,artKey:a=null,imageUrl:i,priceCents:s,className:o,priority:u=!1}){let[c,d]=(0,n.useState)(null),[p,f]=(0,n.useState)([]),m=(0,n.useCallback)(()=>d(a),[a]),h=(0,n.useMemo)(()=>[i,a&&(0,ei.hasVenueModel)(l,a)?(0,ei.packTextureUrl)(l,a,"front"):null].filter(e=>!!e).find(e=>!p.includes(e))??null,[i,l,a,p]);return(0,ei.isSelfDrawnPack)(l)?(0,t.jsx)(eu,{priceCents:s??0,className:o}):c!==a&&null!==a&&(0,ei.hasVenueModel)(l,a)?(0,t.jsx)("div",{className:(0,q.cn)("relative w-full",ep,o),children:(0,t.jsx)(ed,{venue:l,artKey:a,label:`${r} â ${e}`,onUnavailable:m})}):h?(0,t.jsx)("div",{className:(0,q.cn)("relative motion-safe:animate-pack-float",o),children:(0,t.jsx)(ea.default,{src:h,alt:e,width:1638,height:3e3,sizes:"(min-width: 1024px) 320px, 60vw",priority:u,draggable:!1,unoptimized:!0,onError:()=>f(e=>e.includes(h)?e:[...e,h]),className:(0,q.cn)("w-full object-contain",ep)},h)}):null}],896782);var ef=e.i(956327),em=e.i(854354),eh=e.i(36520),ex=e.i(213076),eg=e.i(201992);function ev({card:e,compact:n,intlTag:r,onOpen:l}){let a=(0,o.useTranslations)("rip"),i=e.name??a("cardNameUnavailable"),s=null===e.valueCents?null:(0,h.fmtUsdMicro)(1e4*e.valueCents,r);return(0,t.jsxs)("button",{type:"button",onClick:l,className:"group/prize focus-ring block w-full rounded-xl text-left","aria-label":i,title:i,children:[(0,t.jsx)("div",{className:"rip-prize rounded-xl p-2",children:(0,t.jsx)(em.Slab,{card:(0,eg.slabMetaFor)(e,a("cardNameUnavailable")),className:"rounded-[4px] bg-transparent ring-0 hover:ring-0",sizes:n?"(min-width: 1280px) 176px, 148px":"(min-width: 1280px) 200px, 174px"})}),(0,t.jsx)("div",{className:"-mt-4 flex justify-center",children:(0,t.jsx)("span",{className:(0,q.cn)("rip-prize__plate max-w-full truncate px-3.5 py-1 font-mono font-semibold leading-[1.4] tabular-nums",null===s?"rip-prize__plate--unknown text-[11px]":"text-[16px]"),children:s??a("valueUnknown")})})]})}function eb({card:e,onClose:n}){let r=(0,o.useTranslations)("rip");return(0,t.jsx)(eh.RipPullDialog,{pull:e&&{card:(0,eg.slabMetaFor)(e,r("cardNameUnavailable")),tierName:e.tier,tierProbabilityBps:null,hitRank:null,valueCents:e.valueCents,caption:null},onClose:n})}e.s(["PackTopHits",0,function({cards:e,hasMore:r,isLoadingMore:l,onLoadMore:a,c
1ompact:i=!1}){let s=(0,o.useTranslations)("rip"),{intlTag:u}=(0,F.useFormatters)(),[c,d]=(0,n.useState)(null);return 0===e.length?null:(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("h2",{className:(0,q.cn)("rip-prize-heading font-mono uppercase tracking-[0.2em]",i?"text-[12px]":"text-[13px] font-semibold"),title:i?s("topHitsCaveat"):void 0,children:s("topHitsHeading")}),(0,t.jsx)("p",{className:(0,q.cn)("max-w-[80ch] text-sm text-muted-foreground",i&&"text-[12px] lg:hidden"),children:s("topHitsCaveat")}),(0,t.jsxs)(ef.CardCarousel,{label:s("topHitsHeading"),onNearEnd:i&&r&&!l?a:void 0,children:[e.map((e,n)=>(0,t.jsx)("li",{className:(0,q.cn)("shrink-0 snap-start",i?"w-[164px] xl:w-[192px]":"w-[190px] xl:w-[216px]"),children:(0,t.jsx)(ev,{card:e,compact:i,intlTag:u,onOpen:()=>d(e)})},e.mint??`${e.name??"card"}-${n}`)),i&&l&&(0,t.jsx)("li",{"aria-hidden":!0,className:"flex w-[164px] shrink-0 items-center justify-center text-[10px] text-text-disabled xl:w-[192px]",children:s("loading")})]}),r&&!i&&(0,t.jsx)("div",{children:(0,t.jsx)(ex.Button,{size:"sm",variant:"outline",onClick:a,disabled:l,children:s(l?"loading":"topHitsMore")})}),(0,t.jsx)(eb,{card:c,onClose:()=>d(null)})]})}],369094)},924399,185521,201992,243733,617397,77175,906450,762974,403353,444171,e=>{"use strict";e.s(["freePackForMachine",0,function(e,t,n){return"imperial"!==t.venue||n?null:e.find(e=>e.machine===t.id&&e.priceCents===t.priceCents)??null}],924399);var t=e.i(394390),n=e.i(183023),r=e.i(88622),l=e.i(442700),a=e.i(153517);let i=l.RIP_GESTURE.hold;function s({children:e,label:l,disabled:o=!1,holdMs:u=i,bare:c=!1,completionSound:d=!0,onComplete:p,onCancel:f,onProgress:m,className:h}){let[x,g]=(0,n.useState)(0),v=(0,n.useRef)(null),b=(0,n.useRef)(!1),w=(0,n.useRef)(!1),y=(0,n.useRef)(null),j=(0,n.useRef)(null),C=(0,n.useRef)(0),k=(0,n.useRef)(p);(0,n.useEffect)(()=>{k.current=p},[p]);let N=(0,n.useRef)(m);(0,n.useEffect)(()=>{N.current=m},[m]);let R=(0,n.useRef)(f);(0,n.useEffect)(()=>{R.current=f},[f]);let S=(0,n.useCallback)(()=>{let e=b.current&&!w.current;null!==v.current&&cancelAnimationFrame(v.current),v.current=null,b.current=!1,y.current?.(),y.current=null,performance.now()-C.current<140?j.current?.silence():j.current?.cancel(),j.current=null,g(0),N.current?.(0),e&&R.current?.()},[]);(0,n.useEffect)(()=>()=>{null!==v.current&&cancelAnimationFrame(v.current),y.current?.(),j.current?.silence()},[]);let M=(0,n.useRef)(o);(0,n.useEffect)(()=>{M.current=o},[o]);let P=(0,n.useCallback)(()=>{if(o||b.current)return;w.current=!1,b.current=!0,C.current=performance.now(),j.current=(0,r.charge)();let e=()=>S();window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),y.current=()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e),window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e)};let t=()=>{if(M.current)return void S();let e=Math.min(1,(performance.now()-C.current)/u);if(e<1){g(e),j.current?.update(e),N.current?.(e),v.current=requestAnimationFrame(t);return}w.current||(w.current=!0,d?j.current?.release():j.current?.silence(),j.current=null,S(),k.current())};v.current=requestAnimationFrame(t)},[o,S,u,d]);return(0,t.jsxs)("button",{type:"button",disabled:o,"aria-label":l,onPointerDown:e=>{e.preventDefault(),P()},onPointerEnter:e=>(0,r.hover)(e,"packTick"),onPointerUp:S,onPointerCancel:S,onContextMenu:e=>e.preventDefault(),onKeyDown:e=>{e.repeat||(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),P())},onKeyUp:e=>{(" "===e.key||"Enter"===e.key)&&S()},onBlur:S,className:(0,a.cn)("group relative block w-full select-none [touch-action:pan-y]",!c&&"focus-ring rounded-xl transition-[filter] duration-200",!o&&"cursor-pointer",h),style:c?{"--rip-fill":x}:e&&x>0&&!o?{filter:`drop-shadow(0 0 ${12+28*x}px rgba(255,138,61,${.25+.45*x}))`,transform:`scale(${1+.022*x}) scaleY(${1-.05*Math.max(0,(x-.84)/.16)})`,transformOrigin:"50% 62%"}
1:void 0,children:[e,!o&&!c&&(0,t.jsx)("span",{"aria-hidden":!0,className:(0,a.cn)("pointer-events-none absolute inset-0 flex items-center justify-center","opacity-0 transition-opacity duration-150","group-hover:opacity-100 group-focus-visible:opacity-100","[@media(hover:none)]:opacity-100",x>0&&"!opacity-100"),children:(0,t.jsxs)("span",{className:"relative isolate overflow-hidden rounded-md border border-white/20 bg-black/70 px-5 py-2.5 backdrop-blur-sm",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 -z-10 bg-primary/80",style:{width:`${100*x}%`}}),(0,t.jsx)("span",{className:"font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-foreground",children:l})]})})]})}e.s(["HoldToRip",0,s],185521);var o=e.i(942553),u=e.i(72226),c=e.i(679278),d=e.i(162388);let p={warm:"255, 244, 216",gold:"255, 214, 122",silver:"219, 230, 255",green:"150, 232, 190"},f=null,m=(e,t=.4)=>e*(1-t+Math.random()*t*2),h=(0,n.forwardRef)(function({className:e},r){let l=(0,n.useRef)(null),i=(0,n.useRef)(null),s=(0,d.useReducedMotion)();return((0,n.useEffect)(()=>{if(s||!l.current)return;let e=function(e){let t=e.getContext("2d");if(!t)return{emit:()=>{},stream:()=>{},clear:()=>{},timeScale:()=>{},destroy:()=>{}};f||(f=function(){let e={};for(let[t,n]of Object.entries(p)){let r=document.createElement("canvas");r.width=32,r.height=32;let l=r.getContext("2d");if(!l){e[t]=r;continue}let a=l.createRadialGradient(16,16,0,16,16,6.72);for(let e of(a.addColorStop(0,"rgba(255, 255, 255, 1)"),a.addColorStop(.4,`rgba(${n}, 0.85)`),a.addColorStop(1,`rgba(${n}, 0)`),l.fillStyle=a,l.fillRect(0,0,32,32),l.fillStyle=`rgba(${n}, 0.9)`,[0,Math.PI/2]))l.save(),l.translate(16,16),l.rotate(e),l.beginPath(),l.moveTo(0,-16),l.quadraticCurveTo(1.6,0,0,16),l.quadraticCurveTo(-1.6,0,0,-16),l.fill(),l.restore();e[t]=r}return e}());let n=f,r=1,l=[],a=new Map,i=null,s=0,o=0,u=0,c=!1,d=()=>{let n=Math.min(window.devicePixelRatio||1,2);o=e.clientWidth,u=e.clientHeight,e.width=Math.max(1,Math.round(o*n)),e.height=Math.max(1,Math.round(u*n)),t.setTransform(n,0,0,n,0,0)};d();let h=new ResizeObserver(d);h.observe(e);let x=(e,t)=>{let r=n[e.tint??"warm"],a=(e.spread??0)*Math.min(o,u),i=e.direction??-Math.PI/2,s=e.spray??.7,c=e.speed??140;for(let n=0;n<t;n+=1){if(l.length>=340)return;let t=i+(Math.random()-.5)*s*2,n=m(c);l.push({x:e.x*o+(Math.random()-.5)*a,y:e.y*u+(Math.random()-.5)*a,vx:Math.cos(t)*n,vy:Math.sin(t)*n,gravity:e.gravity??-30,age:0,life:m(e.life??1.1),size:m(e.size??9),spin:(Math.random()-.5)*4,angle:Math.random()*Math.PI,drag:.4+.5*Math.random(),sprite:r})}},g=e=>{let n=Math.min((e-s)/1e3,.05)*r;for(let t of(s=e,a.values())){t.debt+=t.rate*n;let e=Math.floor(t.debt);e<=0||(t.debt-=e,x({x:t.x,y:t.y,tint:t.tint,count:e,spread:.16,speed:110,spray:.5,life:1.3,size:7},e))}t.clearRect(0,0,o,u),t.globalCompositeOperation="lighter";for(let e=l.length-1;e>=0;e-=1){let r=l[e];if(r.age+=n,r.age>=r.life){l.splice(e,1);continue}let a=Math.exp(-r.drag*n);r.vx*=a,r.vy=r.vy*a+r.gravity*n,r.x+=r.vx*n,r.y+=r.vy*n,r.angle+=r.spin*n;let i=r.age/r.life,s=i<.12?i/.12:(1-i)/.88,o=r.size*(.7+.5*s);t.globalAlpha=Math.max(0,s),t.save(),t.translate(r.x,r.y),t.rotate(r.angle),t.drawImage(r.sprite,-o/2,-o/2,o,o),t.restore()}if(t.globalAlpha=1,t.globalCompositeOperation="source-over",0===l.length&&0===a.size){i=null;return}i=requestAnimationFrame(g)},v=()=>{null!==i||c||(s=performance.now(),i=requestAnimationFrame(g))};return{emit(e){c||(x(e,e.count),v())},stream(e,t){if(!c){if(!t)return void a.delete(e);a.set(e,{x:t.x,y:t.y,rate:t.rate,tint:t.tint??"warm",debt:a.get(e)?.debt??0}),v()}},clear(){l.length=0,a.clear(),t.clearRect(0,0,o,u)},timeScale(e){r=e>0?e:1},destroy(){c=!0,null!==i&&cancelAnimationFrame(i),i=null,l.length=0,a.clear(),h.disconnect()}}}(l.current);return i.current=e,()=>{e.destroy(),i.current=null}},[s]),(0,n.useImperativeHandle)(r,()=>({emit:e=>i.current?.emit(e),stream:(e,t)=>i.current?.stream(e,t),clear:()=>i.current?.clear(),timeScale:e=>i.current?.timeScale(e)})),s)?null:(0,t.jsx)("canvas",{ref:l,"aria-hidden":!0,className:(0,a.cn)("pointer-events-none absolute inset-0 z-30 h-full w-full",e)})});l.RIP_TIMING.soar;let x=()=>()=>{};function g({origin:e,onDone:r,timing:a=l.RIP_TIMING,timeScale:i=1}
1){let s=(0,n.useRef)(null),o=(0,n.useSyncExternalStore)(x,()=>!0,()=>!1);return((0,n.useEffect)(()=>{if(!e)return;s.current?.timeScale(i),s.current?.emit({x:(e.left+e.width/2)/window.innerWidth,y:e.top/window.innerHeight,spread:.04,count:26,speed:620,spray:.9,life:1.4,size:13,gravity:420,tint:"gold"});let t=window.setTimeout(r,a.soar/Math.max(i,.01));return()=>window.clearTimeout(t)},[e,r,i,a.soar]),o&&e)?(0,c.createPortal)((0,t.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0 z-[60]",style:{...(0,l.ripCssVars)(a),"--rip-soar-ms":`${a.soar/Math.max(i,.01)}ms`,"--rip-godray-ms":`${a.godray/Math.max(i,.01)}ms`},children:[(0,t.jsx)("div",{className:"rip-godray",style:{"--rip-ray-x":`${e.left+e.width/2}px`,"--rip-ray-y":`${e.top}px`}}),(0,t.jsx)(h,{ref:s}),(0,t.jsx)("div",{className:"rip-soar absolute font-mono text-sm font-semibold tabular-nums text-[#e8c766]",style:{left:e.left,top:e.top,width:e.width,textAlign:"center"},children:e.text})]}),document.body):null}var v=e.i(13283),b=e.i(803817),w=e.i(780975),y=e.i(761750),j=e.i(697634),C=e.i(188944),k=e.i(369474),N=e.i(142298),R=e.i(299959),S=e.i(435267);function M(e,t){return{image:e.imageUrl,name:e.name??t,gradingCompany:e.gradingCompany,grade:e.grade}}let P=new Set(["pnft","programmable","programmablenonfungible"]);function E(e,t){if(e.cashedOut)return{pledgeable:!1,blockedBy:"cashedOut"};if(!e.mint)return{pledgeable:!1,blockedBy:"noMint"};let n=e.nftStandard?.trim().toLowerCase()??"";if(P.has(n))return{pledgeable:!1,blockedBy:"programmable"};switch(t){case"match":return{pledgeable:!0};case"pending":return{pledgeable:!1,blockedBy:"checking"};case"unreadable":return{pledgeable:!1,blockedBy:"unreadable"};case"mismatch":return{pledgeable:!1,blockedBy:"otherCollection"}}}let A={cashedOut:"borrowBlockedCashedOut",noMint:"borrowBlockedNoMint",programmable:"borrowBlockedProgrammable",checking:"borrowBlockedChecking",unreadable:"borrowBlockedUnreadable",otherCollection:"borrowBlockedOtherCollection"};e.s(["PLEDGE_BLOCK_KEY",0,A,"pledgeability",0,E,"slabMetaFor",0,M],201992);var B=e.i(794494),T=e.i(832424),U=e.i(668987),_=e.i(44971),I=e.i(827023),F=e.i(567978),L=e.i(473344),O=e.i(687229),$=e.i(56516),z=e.i(691887),D=e.i(365221),K=e.i(432533),H=e.i(937505),G=e.i(265172),W=e.i(727322),V=e.i(936548),q=e.i(190459),Y=e.i(255094),Q=e.i(562955),X=e.i(915402),J=e.i(800239);let Z="h-[46px] w-full min-w-0",ee=Q.SUNRISE_SETTLEMENT_GIVE_UP_MS+15e3,et={idle:null,settling:"exitSettling",stuck:"exitClosedStuck",unfunded:"exitClosedUnfunded"};function en({label:e,figure:n=null,disabled:r,onComplete:i,onCancel:o,className:u}){return(0,t.jsx)(s,{bare:!0,label:e,disabled:r,onComplete:i,onCancel:o,holdMs:l.RIP_RISE_GESTURE.hold,completionSound:!1,className:(0,a.cn)(Z,u),children:(0,t.jsx)("span",{className:(0,a.cn)(I.EDGE_KEY,"h-full w-full"),children:(0,t.jsx)(I.NeonKeyFace,{tone:"edge",label:e,figure:n})})})}function er({position:e,packPrice:l=null,onClosed:i,canRipAnother:s=!1,onRipAnother:u,receiptReady:c=!0}){let d=(0,o.useTranslations)("rip"),{fixed:p,usdNumber:f}=(0,R.useFormatters)(),m=(0,$.useRipPerpLive)(e),h=(0,$.useRipPerpTarget)(e),x=(0,z.useManualCloseTarget)(h),{cache:g,auth:v,jwt:w}=(0,K.useAccountReadSession)(),y=(0,o.useTranslations)("positions"),{refreshPositions:j,sunriseSettlementOutcome:C}=(0,O.useUnifiedPositions)(),{addPendingPosition:k,hasPendingCloseForPda:S}=(0,F.usePendingPositions)(),M=(0,n.useRef)(null),{closePosition:P,getLastActionError:E}=(0,W.useTradeActions)(),{publicKey:A}=(0,N.useUnifiedWallet)(),B=A?.toBase58()??null,[T,U]=(0,n.useState)(!1),[Q,el]=(0,n.use
1State)(null),[ea,ei]=(0,n.useState)(!1),[es,eo]=(0,n.useState)("idle"),[eu,ec]=(0,n.useState)(null),[ed,ep]=(0,n.useState)(null),ef=(0,n.useRef)(!1),em=(0,n.useRef)(!0);(0,n.useEffect)(()=>(em.current=!0,()=>{em.current=!1}),[]);let[eh,ex]=(0,n.useState)(null),eg=(0,n.useRef)(null),ev=(0,n.useRef)("stay"),eb=p((0,X.leverageXOf)(e.leverageBps),2),ew=!!h&&S(h.row.positionPda,h.row.asset);(0,n.useEffect)(()=>{null===h&&B&&!ea&&j()},[h,B,j,ea]);let ey=(0,n.useMemo)(()=>"available"===x.status&&"imperial"===x.input.ownership?{...x.input,submissionSound:!1}:null,[x]),ej=null!==ey&&!ea&&!!B&&"idle"===es&&!T&&!ew,eC=(0,n.useCallback)(async e=>{if(!(0,D.manualCloseIsCurrent)(x)||!h||!ey||ea||!B||!A||!g.isCurrent(v)||ef.current||ew||"idle"!==es)return;ef.current=!0,U(!0),ec(null),ep(null);let t=null,n=null;try{(t=await P(ey))||(n=E())}catch(e){n=e}finally{ef.current=!1,em.current&&U(!1)}if(em.current&&g.isCurrent(v)){if(!t){ep(n),ec("failed"),j();return}eg.current=m?.valueUsd??null,ev.current=e,ex({pda:h.row.positionPda,asset:h.row.asset,side:ey.side,wallet:B,signature:t,settledAtSubmit:(0,q.settlesSynchronously)(ey.underwriter),venue:ey.underwriter,lifecycleId:(0,D.manualTargetIdentity)(h).lifecycleId,submittedAt:Date.now()}),A&&k({id:t,market:(0,L.pendingMarketKey)(ey.marketMint),owner:A,type:"closing",isLong:"long"===h.row.side,timestamp:Date.now(),status:"pending",positionPda:h.row.positionPda,asset:h.row.asset,profileIndex:h.row.profileIndex??void 0,venue:ey.underwriter,sizeUsdAtIntent:ey.sizeUsd,settledAtSubmit:(0,q.settlesSynchronously)(ey.underwriter)}),eo("settling"),j()}},[m,h,ey,x,ea,g,v,B,ew,es,P,E,A,k,j]),ek=(0,n.useRef)({walletAddress:B,canRipAnother:s,onRipAnother:u,onClosed:i});(0,n.useEffect)(()=>{ek.current={walletAddress:B,canRipAnother:s,onRipAnother:u,onClosed:i}}),(0,n.useEffect)(()=>{if("settling"!==es||!eh)return;let e=eh.submittedAt,t=!1,n=!1,l=0,a=window.setInterval(async()=>{if(t)return;let i=(0,q.confirmsAfterResponse)(eh.venue)&&"confirmed"!==C(eh.signature);if(Date.now()-e>(i?ee:45e3)){t=!0,window.clearInterval(a),eo("stuck");return}if(n||ek.current.walletAddress!==eh.wallet)return;let s=C(eh.signature);if("failed"===s){t=!0,window.clearInterval(a),eo("idle"),ec("failed"),j();return}let o=(0,Y.settlementProven)({...eh,signatureConfirmed:"confirmed"===s});if(!o){if(Date.now()-l<7500)return;l=Date.now(),n=!0;try{let e={wallet:eh.wallet,resource:"trades",page:{limit:50,offset:0}},t=(0,H.historyKey)(eh.wallet);o=(await g.client.fetchQuery({queryKey:t,retry:!1,staleTime:0,queryFn:()=>g.read(t,e,v,t=>(0,G.fetchAccountRead)(e,w,t),e=>e)})).dataList.some(e=>e.positionPda===eh.pda&&e.asset===eh.asset&&e.side===eh.side&&"closed"===e.status&&null!==e.closedAt&&(eh.lifecycleId&&(e.lifecycleId??e.id)===eh.lifecycleId||e.actions.some(e=>"decrease"===e.actionType&&e.tx1Signature===eh.signature)))}catch{}finally{n=!1}}if(!o||t||ek.current.walletAddress!==eh.wallet)return;t=!0,window.clearInterval(a);let u=ek.current;if(ei(!0),el(eg.current),u.onClosed?.(),(0,r.play)("cash"),"open"===ev.current&&u.canRipAnother&&u.onRipAnother){eo("idle"),u.onRipAnother();return}eo("open"===ev.current?"unfunded":"idle")},500),i=window.setInterval(j,7500);return()=>{t=!0,window.clearInterval(a),window.clearInterval(i)}},[es,eh,j,C,g,v,w]),(0,n.useEffect)(()=>{let e=M.current;e&&(e.scrollIntoView({block:"nearest"}),e.querySelector("button:not([disabled]), a[href]")?.focus({preventScroll:!0}))},[]);let eN=et[es],eR=null===eN?null:d(eN),eS=null===l?null:d("exitHoldToCloseAndOpen",{price:l}),eM=(0,X.perpStartingBasisCents)(e),eP=c&&(0,X.perpHasIssueReceipt)(e)&&null!=e.stakeCents&&null!==eM&&(0,t.jsx)("div",{className:"w-full rounded-md border border-border bg-surface/60 p-3",children:(0,t.jsx)(J.PackPositionBreakdown,{priceCents:e.stakeCents,basisCents:eM,awardCents:e.collateralCents,pnlUsd:null===Q?(0,X.perpPnlNow)(e,m?.pnlUsd??null):Q-eM/100,tradingCostsUsd:m?.feesUsd})});return ea?(0,t.jsxs)("div",{ref:M,className:"rip-exits-in flex w-full flex-col items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-center gap-x-2.5 gap-y-1",children:[(0,t.jsx)("span",{className:"font-mono text-4xl tabular-nums tracking-[-0.035em] text-side-long",children:null===Q?"â":`+${f(Q)}`}),(0,t.jsx)("span",{className:"font-mono text-[10px] tracking-[0.18em] text-text-muted",children:null===Q?y("accountReadClosedAmountUnknown"):d("exitBanked")})]}),eP,eR&&(0,t.jsx)(_.Note,{tone:"muted",children:eR})]}):(0,t.jsxs)("div",{ref:M,className:"rip-exits-in flex w-full flex-col gap-3",children:[eP,u&&null!==eS&&(null!==ey||"idle"!==es)&&(0,t.jsx)(en,{label:T?d("exitClosing"):eS,figure:l,disabled:!ej,onComplete:()=>void eC("open"),onCancel:()=>ec("interrupted")}),(0,t.jsx)("div",{className:"mt-1 flex w-full flex-col gap-3 border-t border-border-subtle pt-4",children:(0,t.jsxs)("div",{className:"grid w-full grid-cols-2 gap-2",children:[(0,t.jsx)(en,{label:d(T?"exit
1Closing":"exitHoldToClose"),disabled:!ej,onComplete:()=>void eC("stay"),onCancel:()=>ec("interrupted")}),(0,t.jsx)(b.Link,{href:(0,X.perpDeskHref)(e),onPointerEnter:e=>(0,r.hover)(e),className:(0,a.cn)(I.QUIET_KEY,Z),children:(0,t.jsx)(I.NeonKeyFace,{tone:"quiet",label:d("exitManagePosition")})})]})}),(0,t.jsx)("div",{role:"status","aria-live":"polite",children:T?(0,t.jsx)(_.Note,{children:d("exitClosing")}):ew?(0,t.jsx)(_.Note,{children:d("exitSettling")}):"failed"===eu?(0,t.jsxs)(_.Note,{tone:"error",children:[d("exitCloseFailed"),ed?` ${(0,V.displayClientError)(ed)}`:""]}):"interrupted"===eu?(0,t.jsx)(_.Note,{children:d("exitCloseInterrupted")}):eR?(0,t.jsx)(_.Note,{tone:"muted",children:eR}):null===h?(0,t.jsx)(_.Note,{tone:"muted",children:d("exitCloseWaiting")}):"unavailable"===x.status?(0,t.jsx)(_.Note,{tone:"muted",children:y({owner:"accountReadCloseOwner",identity:"accountReadCloseIdentity",market:"accountReadCloseMarket",seat:"accountReadCloseSeat",amount:"accountReadCloseAmount",price:"accountReadClosePrice",intent:"accountReadCloseIntent",observation:"accountReadCloseObservation"}[x.reason])}):null}),e.notionalCapped&&(0,t.jsx)(_.Note,{tone:"warn",children:d("exitPositionCappedNote",{rolled:p((0,X.leverageXOf)(e.rolledLeverageBps),2),opened:eb})})]})}var el=e.i(239702);let ea=(0,a.cn)("focus-ring flex min-w-0 flex-1 flex-col items-center justify-center gap-1 rounded-md","border border-border bg-surface/60 px-3 py-2.5 transition-colors","hover:border-border-strong hover:bg-surface-raised","disabled:cursor-default disabled:opacity-40 disabled:hover:border-border","disabled:hover:bg-surface/60"),ei="font-mono text-[10px] tracking-tight text-muted-foreground",es="truncate font-mono text-sm tabular-nums text-foreground",eo=(0,a.cn)("pair-suggestion border-[#e8c766]/30 hover:border-[#e8c766]/60 hover:bg-[#e8c766]/15");function eu({figureRef:e,label:n,figure:r,hidden:l}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:(0,a.cn)(ei,"flex items-center gap-1 text-[#e8c766]"),children:[(0,t.jsx)(u.Sparkles,{className:"size-2.5 shrink-0","aria-hidden":!0}),n]}),(0,t.jsx)("span",{ref:e,className:(0,a.cn)(es,"font-semibold text-[#e8c766]",l&&"opacity-0"),children:r})]})}function ec({card:e,venue:i,venueRef:s,custodied:u=!1,simulate:c=!1,onSold:p}){let f,m=(0,o.useTranslations)("rip"),h=(0,o.useTranslations)("pawn"),{intlTag:x}=(0,R.useFormatters)(),M=(0,b.useRouter)(),P=(0,d.useReducedMotion)(),{canSignTransaction:I}=(0,N.useUnifiedWallet)(),F=(0,w.usePawnPool)(),L=(0,C.useRipMachines)(),O=(0,k.useRipBuybackQuote)(c?null:i,e.mint,s),$=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{null!==$.current&&window.clearTimeout($.current)},[]);let z=(0,n.useCallback)(()=>{null!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>p?.(),l.RIP_TIMING.soldHold)},[p]),D=(0,k.useRipSell)(c?null:i,e.mint,s,z,u),K=null===e.valueCents?null:{venue:i,venueRef:s,available:!0,offerCents:Math.round(8500*e.valueCents/U.BPS),valueBasis:e.valueBasis,transaction:null,settled:!0,saleSignature:null,reason:null},[H,G]=(0,n.useState)(!1),W=c?K:O.offer,V=c?{canSell:!0,isSelling:!1,sold:H,signature:null,error:null,sell:async()=>{G(!0),z()}}:D,q=!c&&O.asking,Y=!c&&O.unanswered,Q=(0,y.usePawnCardMetadata)((0,n.useMemo)(()=>c||!e.mint?[]:[e.mint],[e.mint,c])),X=e.mint?(Q.data??y.NO_METADATA).get(e.mint):void 0,J=E(e,c?"match":Q.isLoading?"pending":X?(0,S.isGradedCollectorCryptCard)(X)?"match":"mismatch":"unreadable"),Z=J.pledgeable?null:A[J.blockedBy],ee=!J.pledgeable&&"checking"===J.blockedBy,et=J.pledgeable&&!u&&!I,en=e=>null===e?m("valueUnknown"):(0,v.fmtUsdMicro)(e,x),er=(0,n.useMemo)(()=>(0,B.floorTermsOf)(F.data??null),[F.data]),ed=(0,B.loanOffer)(null===e.valueCents?null:1e4*e.valueCents,er),ep="offer"===ed.kind?ed.receivesUsd:null,ef=!!W?.available&&V.canSell&&!V.isSelling&&!V.sold,em=W?W.available?null===(f=W.offerCents??null)?m("valueUnknown"):(0,v.fmtUsdMicro)(1e4*f,x):m("exitUnavailable"):q?m("exitQuoteChecking"):Y?m("exitQuoteRetry"):m("exitUnavailable"),eh=u&&!c,ex=e.mint?`/lending/${e.mint}`:null,eg=(0,n.useCallback)(()=>z(),[z]),ev=(0,j.useRipBorrow)(!c&&i&&s?{kind:"pull",venue:i,venueRef:s}
1:null,eh,eg,X?.collection?.toBase58()??null),[eb,ew]=(0,n.useState)(!1),ey=!c&&ev.isBorrowing,ej=c?eb:ev.borrowed,eC=!c&&ev.payoutPending,ek=eC&&ev.payoutRetryable,eN=J.pledgeable&&(c||(eh?ev.canBorrow:I)),eR=(0,n.useRef)(null),[eS,eM]=(0,n.useState)(null),eP=()=>{let e=P?null:eR.current?.getBoundingClientRect();if(!e){(0,r.play)("cash"),c&&ew(!0);return}(0,r.play)("soar"),eM({left:e.left,top:e.top,width:e.width,text:en(ep)})},eE=ey?m("exitBorrowing"):ek?m("exitBorrowFinish"):ej?m("exitBorrowed"):m("exitBorrow"),eA=en(ev.disbursedUsd??ep),eB=(0,n.useCallback)(()=>{(eM(null),c)?ew(!0):!eh&&ex&&M.push(ex)},[ex,eh,M,c]);return(0,t.jsxs)("div",{className:"rip-exits-in flex w-full flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex items-stretch gap-3",children:[(0,t.jsxs)("button",{type:"button",disabled:!Y&&!ef,title:Y?m("exitQuoteRetryHint"):V.canSell?void 0:m("exitSellNeedsSigner"),onClick:()=>{Y?O.retry():((0,r.play)("cash"),V.sell())},className:ea,children:[(0,t.jsx)("span",{className:ei,children:V.sold?m("exitSold"):V.isSelling?m("exitSelling"):m("exitSell")}),(0,t.jsx)("span",{className:es,children:em})]}),eN&&(eh||ex)?eh?(0,t.jsx)("button",{type:"button",disabled:ey||ej&&!ek,onPointerEnter:e=>(0,r.hover)(e),onClick:()=>{ek?(0,r.play)("cash"):eP(),ev.borrow()},className:(0,a.cn)(ea,eo,eS&&"rip-strike"),children:(0,t.jsx)(eu,{figureRef:eR,label:eE,figure:eA,hidden:!!eS})}):(0,t.jsx)(b.Link,{href:ex,onClick:e=>{P?(0,r.play)("cash"):eR.current&&(e.preventDefault(),M.prefetch(ex),eP())},className:(0,a.cn)(ea,eo,eS&&"rip-strike"),children:(0,t.jsx)(eu,{figureRef:eR,label:eE,figure:eA,hidden:!!eS})}):(0,t.jsxs)("button",{type:"button",disabled:!0,className:ea,title:et?h("borrowNeedsWalletSigner"):Z?m(Z):void 0,children:[(0,t.jsx)("span",{className:ei,children:m("exitBorrow")}),(0,t.jsx)("span",{className:es,children:ee?m("exitBorrowChecking"):et?m("exitBorrowNeedsSigner"):m("exitBorrowUnavailable")})]})]}),!V.sold&&(0,t.jsx)(el.SellWindowStatement,{windowSecs:(0,T.sellWindowSecsFor)(L.data?.venues??[],i)}),ej&&!ev.error&&(0,t.jsx)(_.Note,{tone:eC?"warn":"ok",children:eC?ek?m("exitBorrowPendingNote",{amount:eA}):m("exitBorrowReviewNote",{amount:eA}):m("exitBorrowedNote",{amount:eA})}),ev.error&&(0,t.jsx)(_.Note,{tone:"error",children:ev.error.message}),et&&(0,t.jsx)(_.Note,{tone:"warn",children:h("borrowNeedsWalletSigner")}),!V.canSell&&(0,t.jsx)(_.Note,{tone:"warn",children:m("exitSellNeedsSigner")}),V.error&&(0,t.jsx)(_.SellError,{error:V.error}),(0,t.jsx)(g,{origin:eS,onDone:eB})]})}e.s(["ExitRouter",0,function(e){let{publicKey:n}=(0,N.useUnifiedWallet)();return e.card.position?(0,t.jsx)(er,{position:e.card.position,onClosed:e.onPositionClosed,packPrice:e.packPrice??null,canRipAnother:e.canRipAnother??!1,onRipAnother:e.onRipAnother,receiptReady:e.receiptReady??!0},`${n?.toBase58()}:${e.venueRef}:${e.card.position.positionRef}:${e.card.position.market}:${e.card.position.isLong}`):(0,t.jsx)(ec,{...e})}],243733);var ed=e.i(623984),ep=e.i(213076),ef=e.i(872501),em=e.i(799227),eh=e.i(860991),ex=e.i(739835),eg=e.i(653982),ev=e.i(858007),eb=e.i(308146),ew=e.i(801637);class ey extends Error{constructor(){super("profile withdrawal is blocked by an open loan (0x45)"),this.name="ProfileLoanBlockedError"}}class ej extends Error{constructor(){super("this session cannot sign a sponsored transaction"),this.name="SponsoredSigningUnavailableError"}}async function eC({connection:e,publicKey:t,signTransaction:n,sendTransaction:r,profileIndex:l,amountUsdc:a}){let i=(0,eb.numberToBaseUnits)(a,6);if(null===i||i<BigInt(1e4))return;let s=await (0,ew.planSelfPaidProfileTx)({connection:e,publicKey:t,profileIndex:l,mint:eg.USDC_MINT,amount:i,mode:"withdraw"});try{if(s.canSelfPay){let n=new em.Transaction;s.instructions.forEach(e=>n.add(e));let{blockhash:l,lastValidBlockHeight:a}=await e.getLatestBlockhash();n.recentBlockhash=l,n.feePayer=t;let i=await r(n);await (0,eh.confirmOrVerifyLanded)(e,{signature:i,blockhash:l,lastValidBlockHeight:a});return}if(!n)throw new ej;await (0,ew.sendSponsoredProfileTx)({publicKey:t,signTransaction:n,profileIndex:l,amount:i,mode:"withdraw"})}catch(n){let e;if((0,ex.isUserRejection)(n)||n instanceof ej)throw n;if(e=n instanceof Error?`${n.message}`:String(n),/0x45\b/.test(e)||/custom program error:?\s*69\b/i.test(e)||/Custom\(69\)/.test(e))throw new ey;throw(0,ev.logErrorToServer)({type:"rip_autofund_withdraw_failed",wallet:t.toBase58(),profileIndex:l,amount:Number(i),lamportsAvailable:s.lamportsAvailable,lamportsRequired:s.lamportsRequired,errorMessage:n instanceof Error?n.message:String(n)}),n}}var ek=e.i(466134);function eN({funding:e,onFund:n,onDeposit:r,onramp:l,usd:a,sol:i}){let s=(0,o.useTranslations)("rip"),u=(0,o.useTranslations)("wallet");switch(e.state){case"walletBalanceUnknown":return(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingWalletUnknown")});case"loanBlocked":return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingLoanBlocked")}),(0,t.jsx)(b.Link,{href:"/lending",className:"text-[11px] text-primary underline underline-offset-2",children:s("fundingLoanBlockedLink")})]});case"profileBalanceUnknown":return(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingProfileUnknown")});case"shortEverywhere":return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingShort",{amount:a(e.shortfallUsdc)})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(ep.Button,{size:"sm",variant:"outline",onClick:r,children:u("deposit")}),l.available&&(0,t.jsx)(ep.Button,{size:"sm",variant:"outline",disabled:l.isOpening,onClick:()=>void l.buy(Math.ceil(e.shortfallUsdc)),children:u("buyWithCard")})]})]});case"canAutoFund":return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(_.Note,{children:s("fundingCanAutoFund",{amount:a(e.shortfallUsdc)})}),(0,t.jsx)(ep.Button,{size:"sm",variant:"outline",onClick:n,disabled:e.isFunding,children:s(e.isFunding?"fundingMoving":"fundingMove")}
1)]});case"solBalanceUnknown":return(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingSolUnknown")});case"needsSol":return(0,t.jsx)(_.Note,{tone:"warn",children:s("fundingNeedsSol",{amount:i(e.minSolLamports)})});case"ready":return null}}function eR({error:e}){let n=(0,o.useTranslations)("rip");return e instanceof ey?(0,t.jsx)(_.Note,{tone:"error",children:n("fundingLoanBlocked")}):e instanceof ej?(0,t.jsx)(_.Note,{tone:"warn",children:n("fundingSponsoredUnavailable")}):(0,t.jsx)(_.Note,{tone:"error",children:e.message})}function eS({label:e,value:n,muted:r}){return(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("dt",{className:"tracking-tight text-text-disabled",children:e}),(0,t.jsx)("dd",{className:r?"font-mono tabular-nums text-muted-foreground":"font-mono tabular-nums text-foreground",children:n})]})}e.s(["FundingBlocker",0,function({funding:e,venueName:r,needsSol:l}){let a=(0,o.useTranslations)("rip"),{intlTag:i,fixed:s}=(0,R.useFormatters)(),[u,c]=(0,n.useState)(null),[d,p]=(0,n.useState)(null),f=(0,ed.useOnramp)();if("ready"===e.state||"noWallet"===e.state)return null;let m=e=>(0,v.fmtUsdMicro)(Math.round(1e6*e),i),h=e=>`${s(e/ef.LAMPORTS_PER_SOL,4)} SOL`,x=async()=>{c(null);try{await e.fund()}catch(e){c(e instanceof Error?e:Error(String(e)))}};return(0,t.jsxs)("section",{className:"flex w-full max-w-[420px] flex-col gap-2 rounded-lg border border-border p-3",children:[(0,t.jsx)(eN,{funding:e,onFund:x,onDeposit:()=>p("deposit"),onramp:f,usd:m,sol:h}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 font-mono text-[10px]",children:[(0,t.jsx)(eS,{label:a("fundingPackPrice"),value:m(e.needUsdc)}),(0,t.jsx)(eS,{label:a("fundingWalletUsdc"),value:null===e.walletUsdc?"â":m(e.walletUsdc),muted:null===e.walletUsdc}),(0,t.jsx)(eS,{label:a("fundingProfileAvailable"),value:null===e.profileAvailableUsdc?"â":m(e.profileAvailableUsdc),muted:null===e.profileAvailableUsdc}),l&&(0,t.jsx)(eS,{label:a("fundingWalletSol"),value:null===e.solLamports?"â":h(e.solLamports),muted:null===e.solLamports})]}),(0,t.jsx)("span",{className:"text-[10px] leading-tight text-muted-foreground",children:l?a("fundingNeedsUsdcAndSol",{venue:r,amount:h(e.minSolLamports)}):a("fundingNeedsUsdcOnly",{venue:r})})]}),u&&(0,t.jsx)(eR,{error:u}),null!==d&&(0,t.jsx)(ek.DepositWithdrawDialog,{open:!0,onOpenChange:e=>{e||p(null)},initialMode:d},d)]})}],617397);var eM=e.i(859394),eP=e.i(623075);function eE(){let e=(0,o.useTranslations)("rip"),r=(0,eM.useRouter)(),[l,a]=(0,n.useState)(null),i=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{let e=e=>{let t;if(i.current||e.defaultPrevented||0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=e.target?.closest?.("a[href]");if(!(!(n instanceof HTMLAnchorElement)||n.target&&"_self"!==n.target||n.hasAttribute("download")||(n.getAttribute("href")??"").startsWith("#"))){try{t=new URL(n.href,window.location.href)}catch{return}"http:"!==t.protocol&&"https:"!==t.protocol||t.origin!==window.location.origin||t.pathname!==window.location.pathname&&(e.preventDefault(),e.stopPropagation(),a({href:t.pathname+t.search+t.hash,anchor:n}))}};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),(0,t.jsx)(eP.Dialog,{open:null!==l,onOpenChange:e=>{e||a(null)},children:(0,t.jsxs)(eP.DialogContent,{className:"sm:max-w-[360px]",children:[(0,t.jsx)(eP.DialogHeader,{children:(0,t.jsx)(eP.DialogTitle,{children:e("leaveTitle")})}),(0,t.jsx)(eP.DialogDescription,{className:"px-4",children:e("leaveBody")}),(0,t.jsxs)(eP.DialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-start",children:[(0,t.jsx)(ep.Button,{type:"button",autoFocus:!0,onClick:()=>a(null),children:e("leaveStay")}),(0,t.jsx)(ep.Button,{type:"button",variant:"outline",onClick:()=>{if(!l)return;let{href:e,anchor:t}=l;if(a(null),t.isConnected){i.current=!0;try{t.click()}finally{i.current=!1}return}r.push(e)},children:e("leaveAnyway")})]})]})})}e.s(["LeaveGuard",0,function({active:e}){return e?(0,t.jsx)(eE,{}):null}],77175);var eA=e.i(829981);let eB=[0,90,180];
1function eT(){return(0,t.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30 rounded-[inherit]",children:[eB.map(e=>(0,t.jsx)("div",{className:"rip-ring",style:{"--rip-ring-delay":`${e}ms`}},e)),(0,t.jsx)("div",{className:"rip-flash"})]})}function eU({active:e,children:n}){return(0,t.jsxs)("div",{className:"relative h-full w-full overflow-visible",children:[(0,t.jsx)("div",{className:(0,a.cn)("h-full w-full",e&&"rip-cut__pack"),children:n}),e&&(0,t.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-20 overflow-visible",children:[(0,t.jsxs)("div",{className:"rip-cut__mouth",children:[(0,t.jsx)("span",{className:"rip-cut__lip rip-cut__lip--top"}),(0,t.jsx)("span",{className:"rip-cut__lip rip-cut__lip--bottom"})]}),(0,t.jsx)("div",{className:"rip-cut__track"}),(0,t.jsx)("div",{className:"rip-cut__pull",children:(0,t.jsx)("span",{className:"rip-cut__curl"})})]})]})}var e_=e.i(457058),eI=e.i(255381),eF=e.i(454028);let eL=eF.PACK_W/eF.PACK_H;function eO(e){let t=Math.min(1,eL/e.aspect);return(1-t)/2*100+e.tearLine*t}function e$({art:e,phase:r,springing:l=!1,charging:i=!1,arriving:s=!1,onArrived:o,surface:u=null,cardSlotRef:c,ref:d,children:p}){let f=eO(e),m=(0,n.useMemo)(()=>(function(e,t){let n=e||1,r=()=>(n=(0x41c64e6d*n+12345)%0x80000000)/0x80000000,l=[];for(let e=0;e<=16;e++){let n=e/16*100,a=0===e||16===e?t:t+(r()-.5)*2.4;l.push(`${n.toFixed(2)}% ${a.toFixed(2)}%`)}return{above:`polygon(0% 0%, 100% 0%, ${[...l].reverse().join(", ")})`,below:`polygon(${l.join(", ")}, 100% 100%, 0% 100%)`}})((0,eI.hashOf)(e.front),f),[e.front,f]);return(0,t.jsxs)("div",{ref:d,className:(0,a.cn)("rip-pouch relative mx-auto w-full max-w-[300px]","sealed"!==r&&`rip-pouch--${r}`,l&&"rip-pouch--springing","sealed"===r&&!l&&"rip-pouch--held",i&&"rip-pouch--charging",s&&"rip-pouch--arriving"),onAnimationEnd:e=>{"rip-pouch-arrive"===e.animationName&&o?.()},style:{"--rip-pack-glow":e.glow,"--rip-tear-line":`${f.toFixed(2)}%`},children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"rip-pack-halo rip-pouch__halo"}),(0,t.jsx)("div",{"aria-hidden":!0,className:"rip-pouch__interior",children:(0,t.jsx)(e_.default,{src:e.back,alt:"",fill:!0,sizes:"330px",draggable:!1,className:"object-cover"})}),(0,t.jsx)("div",{ref:c,className:"rip-pouch__slot",children:p}),(0,t.jsx)(ez,{art:e,alt:"",clipPath:m.below,aspect:eL,className:"rip-pouch__mouth relative w-full"}),(0,t.jsx)(ez,{art:e,alt:"",clipPath:m.above,className:"rip-pouch__strip absolute inset-0 h-full w-full"}),(0,t.jsx)("span",{"aria-hidden":!0,className:"rip-pouch__cut"}),(0,t.jsx)("span",{"aria-hidden":!0,className:"rip-pouch__track",children:(0,t.jsx)("span",{className:"rip-pouch__spark"})}),u]})}function ez({art:e,alt:n,clipPath:r,aspect:l,className:i}){return(0,t.jsx)(e_.default,{src:e.front,alt:n,"aria-hidden":""===n||void 0,width:eF.PACK_W,height:eF.PACK_H,unoptimized:!0,priority:!0,draggable:!1,className:(0,a.cn)("select-none object-contain [-webkit-touch-callout:none]",i),style:{clipPath:r,aspectRatio:l}})}var eD=e.i(854354),eK=e.i(418230);let eH={0:"rgba(255, 226, 160, 0.9)",1:"rgba(215, 230, 255, 0.85)",2:"rgba(190, 235, 210, 0.80)",3:"rgba(79, 183, 131, 0.70)"},eG={0:540,1:360,2:360,3:180};function eW({card:e,basisLabel:r,rank:i=null,packPriceCents:s=null,simulate:u=!1,animate:c=!1,timing:p=l.RIP_TIMING,timeScale:f=1,rise:m=null,onCeremonyDone:h}){let x=(0,o.useTranslations)("rip"),{intlTag:g}=(0,R.useFormatters)(),b=(0,d.useReducedMotion)(),w=null===i?null:eH[i],y=e.position??null,j=e.name??x("cardNameUnavailable"),C=(0,l.ripTimeline)(p,i),k=m??C,N=m?0:C.cardInAt,S=k.faceAt-N,P=k.verdictAt-N,E=k.shakeAt-N,A=function(e,t,r,l=1,a=0){let i=(0,d.useReducedMotion)(),s=null!==e&&r&&!i&&t>
10,[o,u]=(0,n.useState)(null),c=(0,n.useRef)(0);return((0,n.useEffect)(()=>{if(!s||null===e){c.current=e??0;return}let n=c.current;if(n===e)return;let r=performance.now(),i=requestAnimationFrame(function s(o){let d=Math.max(0,Math.min(1,((o-r)*Math.max(l,.01)-a)/t));c.current=n+(e-n)*(1-Math.pow(1-d,3)),u(c.current),d<1?i=requestAnimationFrame(s):c.current=e});return()=>{cancelAnimationFrame(i)}},[e,t,s,l,a]),s)?o??c.current:e}(e.valueCents,p.countUp,c,f,S);return(0,t.jsxs)("div",{className:(0,a.cn)("absolute inset-0 z-10",c&&0===i&&!b&&"rip-shake"),style:{perspective:"1200px","--rip-spin-ms":`${(0,l.spinMsOf)(i,p)}ms`,"--rip-spin-turn":`${null===i?180:eG[i]}deg`,"--rip-spin-delay":`${C.spinAt-C.cardInAt}ms`,"--rip-face-delay":`${S}ms`,"--rip-verdict-delay":`${P}ms`,"--rip-shake-delay":`${E}ms`},children:[c&&w&&!b&&(0,t.jsx)("div",{"aria-hidden":!0,className:"rip-bloom pointer-events-none absolute z-0",style:{"--rip-verdict":w}}),w&&null!==i&&i<=2&&(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 -z-10 flex items-center justify-center",children:(0,t.jsx)("div",{className:"rip-beam",style:{"--rip-verdict":w}})}),(0,t.jsxs)("div",{className:(0,a.cn)("absolute inset-0",y&&"flex flex-col items-center justify-center gap-2"),children:[(0,t.jsx)("div",{"data-rip-card":!0,className:(0,a.cn)(y?m?"w-[71%]":"w-[47%]":"absolute left-1/2 top-[3.4%] w-[62%] -translate-x-1/2",c&&!m&&"rip-card-in"),children:(0,t.jsx)("div",{className:(0,a.cn)("drop-shadow-[0_18px_30px_rgba(0,0,0,0.55)]",c&&"rip-card-land"),children:(0,t.jsxs)("div",{className:(0,a.cn)("relative",c&&!m&&"rip-flip"),children:[(0,t.jsx)("div",{className:"rip-flip__face",children:e.position?(0,t.jsx)(eK.PositionFace,{position:e.position,countUpCents:A,packPriceCents:s,ceremony:c?{delayMs:S/Math.max(f,.01),onDone:h}:null,simulate:u}):(0,t.jsx)(eD.Slab,{card:M(e,x("cardNameUnavailable")),sizes:"(min-width: 1024px) 350px, 60vw",priority:!0})}),c&&!m&&(0,t.jsx)("div",{"aria-hidden":!0,className:"rip-flip__face rip-flip__back rip-card-back absolute inset-0 rounded-md"})]})})}),(0,t.jsxs)("div",{className:(0,a.cn)("flex flex-col items-center gap-1 px-[7%] text-center",y?"w-full":"absolute inset-x-0 top-[70%]",c&&"rip-meta"),children:[(0,t.jsxs)("div",{"aria-live":"polite","aria-atomic":"true",className:"contents",children:[!y&&(0,t.jsx)("span",{className:"line-clamp-2 text-lg text-foreground",children:j}),!y&&(0,t.jsx)("span",{className:"sr-only",children:null===e.valueCents?x("valueUnknown"):(0,v.fmtUsdMicro)(1e4*e.valueCents,g)}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[!y&&(0,t.jsx)(eD.GradeChip,{gradingCompany:e.gradingCompany,grade:e.grade}),!y&&e.tier&&(0,t.jsx)("span",{className:(0,a.cn)("font-mono text-[10px] tracking-tight",0===i?"text-[#e8c766]":"text-muted-foreground"),children:e.tier})]})]}),!y&&(0,t.jsx)("span",{"aria-hidden":!0,className:(0,a.cn)("font-mono text-2xl tabular-nums",0===i?"text-[#e8c766]":"text-foreground"),children:null===A?x("valueUnknown"):(0,v.fmtUsdMicro)(1e4*A,g)}),(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-[0.06em] text-text-disabled",children:y?x("positionSerial",{epoch:y.epochId,nonce:y.nonce}):x("valuesDenominatedIn",{basis:r})}),e.cashedOut&&(0,t.jsx)("span",{className:"mt-1 text-[11px] text-amber-500",children:x("cardCashedOut",{amount:null===e.cashedOutCents?x("valueUnknown"):(0,v.fmtUsdMicro)(1e4*e.cashedOutCents,g)})})]})]})]})}let eV="w-full max-w-[480px] lg:max-w-[clamp(294px,calc((100svh-var(--rip-stage-reserve,21rem))*0.75),480px)] 2xl:max-w-[clamp(294px,calc((100svh-var(--rip-stage-reserve,21rem))*0.75),640px)]";e.s(["STAGE_WIDTH",0,eV],906450);let eq=new Set(["generating","signing","submitting","opening"]),eY="--rip-charge",eQ="--rip-dark";e.s(["CHARGE_TICK_MS",0,250,"CHARGING_STEPS",0,eq,"useRipCharge",0,function(e,t){let{blown:r,faceUp:a,timeScale:i=1}=t,s=(0,n.useRef)(0),o=(0,n.useRef)(0),u=(0,n.useRef)(null),c=(0,n.useRef)(!1),d=(0,n.useRef)(null),p=(0,n.useRef)(null),f=(0,n.useRef)(i);f.current=i;let m=(0,n.useCallback)(()=>null===u.current?null:(performance.now()-u.current)*f.current,[]),h=(0,n.useRef)({blown:r,faceUp:a});return h.current={blown:r,faceUp:a},(0,n.useEffect)(()=>{let t=document.documentElement,n=()=>{t.style.setProperty(eY,s.current.toFixed(3)),t.style.setProperty(eQ,o.current.toFixed(3))};if("idle"===e||"failed"===e){u.current=null,c.current=!1,d.current=null,p.current=null,s.current=0,o.current=0,n();return}let r=eq.has(e);r&&!c.current&&(u.current=performance.now(),d.current=null,p.current=null,s.current=0,o.current=0),c.current=r;let a=(e,t,n)=>e.value*Math.max(0,1-(t-e.at)/n),i=requestAnimationFrame(function e(){let t=performance.now(),c=u.current;r&&null!==c?(s.current=(0,l.chargeIntensity)((t-c)*f.current),o.current=s.current):(h.current.blown&&(d.current??={at:t,value:s.current},s.current=a(d.current,t,260)),h.current.faceUp&&(p.current??={at:t,value:o.current},o.current=a(p.current,t,900))),n(),i=requestAnimationFrame(e)});return()=>cancelAnimationFrame(i)},[e]),(0,n.useEffect)(()=>()=>{document.documentElement.style.removeProperty(eY),document.documentElement.style.removeProperty(eQ)},[]),(0,n.useMemo)(()=>({ref:s,elapsedMs:m}),[m])}],762974);let eX={0:96,1:44,2:26,3:18},eJ={0:"gold",1:"silver",2:"green",3:"green"};function eZ(e){return{x:.5,y:.4,spread:.24,count:null===e?14:eX[e],speed:null===e?90:e<=2?330:150,spray:Math.PI,life:null===e?.9:e<=2?1.5:1.1,size:null===e?7:e<=2?12:9,gravity:null===e?-20:e<=2?120:30,tint:null===e?"warm":eJ[e]}}e.s(["RipStage",0,function({packArt:e,packOpener:i=null,card:o,step:u,charge:p,rank:f,packPriceCents:m,positionPrize:x=!1,simulate:g=!1,basisLabel:v,holdLabel:b,holdDisabled:w,onHoldComplete:y,onCardShown:j,onOpenStart:C,onBlowout:k,onFaceUp:N,onCeremonyDone:R,timing:S=l.RIP_TIMING,timeScale:M=1,seekMs:P=null}
1){let E=(0,n.useRef)(null),[A,B]=(0,n.useState)("idle"),[T,U]=(0,n.useState)(null),[_,I]=(0,n.useState)(!1),[F,L]=(0,n.useState)("sealed"),[O,$]=(0,n.useState)(!1),z=(0,n.useRef)(!1),D=(0,n.useRef)(null),K=(0,n.useRef)(null),H=(0,n.useRef)(null),G=(0,n.useCallback)(e=>{D.current?.style.setProperty("--rip-tear",String(e))},[]),W=(0,n.useRef)(!1),V=(0,n.useCallback)(e=>{W.current!==e&&(W.current=e,I(e))},[]),q=(0,n.useRef)(!1),Y=(0,n.useCallback)(()=>{$(!1),q.current=!1,z.current=!1,H.current=null,L("sealed"),V(!0),G(0);let e=K.current;if(e){for(let t of e.getAnimations())t.cancel();e.removeAttribute("style")}},[V,G]),Q=(0,d.useReducedMotion)(),X=(0,n.useMemo)(()=>(0,l.riseTimeline)(S),[S]),J=(0,n.useRef)(0),Z=(0,n.useRef)(null),ee=(0,n.useRef)(null),et=(0,n.useRef)(null),en=(0,n.useRef)(!1),er=o?o.mint??o.name??"card":null,el=(0,n.useMemo)(()=>(0,l.ripTimeline)(S,f),[S,f]),ea=(0,n.useCallback)(()=>{Z.current?.cancelAll()},[]),ei=(0,n.useCallback)(()=>{null!==ee.current&&window.clearInterval(ee.current),ee.current=null},[]);(0,n.useEffect)(()=>ei,[ei]);let es=(0,n.useCallback)((e,t)=>{Z.current?.at(e,t)},[]);(0,n.useEffect)(()=>{let e=function(e={now:()=>performance.now(),setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)}){let t=0,n=1,r=[],l=(l,a,i)=>{l.remaining=Math.max(0,a),l.armedAt=e.now(),l.id=e.setTimeout(()=>{i===t&&(r=r.filter(e=>e!==l),l.action())},l.remaining/n)};return{at(n,a){let i=t,s={id:0,remaining:n,armedAt:e.now(),action:a};r.push(s),l(s,n,i)},cancelAll(){for(let n of(t+=1,r))e.clearTimeout(n.id);r=[]},setRate(a){let i=a>0?a:1;if(i===n)return;let s=e.now(),o=t;for(let t of r)e.clearTimeout(t.id),t.remaining-=(s-t.armedAt)*n;for(let e of(n=i,r))l(e,e.remaining,o)},rate:()=>n}}();return Z.current=e,e.setRate(M),()=>{e.cancelAll(),Z.current=null}},[]),(0,n.useEffect)(()=>{Z.current?.setRate(M),E.current?.timeScale(M)},[M]),(0,n.useEffect)(()=>{null!==P&&(ea(),E.current?.stream("column",null),en.current=!0,et.current=er)},[P,er,ea]);let eo=(0,n.useCallback)(e=>{if(e<.2)return;let t=performance.now();t-J.current<70||(J.current=t,E.current?.emit({x:.5,y:.46,spread:.34,count:1+Math.round(2*e),speed:40+90*e,spray:1.1,life:.55+.4*e,size:5+4*e,gravity:-20}))},[]);(0,n.useEffect)(()=>{if(null!==P)return;if("idle"===u||"failed"===u){ea(),ei(),en.current=!1,et.current=null,B("idle"),U(null),Y(),E.current?.stream("column",null);return}let e=eq.has(u),t=e&&!en.current;en.current=e,t&&(ea(),et.current=null,U(null),q.current&&(Y(),$(!0)),B("charging"),E.current?.stream("column",{x:.5,y:.46,rate:(0,l.chargeRate)(0)}),ei(),ee.current=window.setInterval(()=>{E.current?.stream("column",{x:.5,y:.46,rate:(0,l.chargeRate)(p.elapsedMs()??0)})},250))},[u,ea,P,ei,p,Y]),(0,n.useEffect)(()=>{if(null!==P||i||!o||et.current===er)return;et.current=er;let e=p.elapsedMs()??el.minCharge,t=Math.max(0,el.minCharge-e);C?.(t+el.flashAt),es(t,()=>B("squash")),es(t+el.cutAt,()=>B("cut")),es(t+el.flashAt,()=>{B("flash"),(0,r.play)("burst"),k?.(),ei(),E.current?.stream("column",null),E.current?.emit({x:.5,y:.46,spread:.5,count:44,speed:460,spray:Math.PI,life:1,size:12,gravity:60})}),es(t+el.cardInAt,()=>{B("card"),U(o),j?.(el.verdictAt-el.cardInAt)}),es(t+el.spinAt,()=>{(0,r.play)("turn")}),es(t+el.faceAt,()=>N?.()),es(t+el.sparkAt,()=>{E.current?.emit(eZ(f))})},[o,er,f,el,es,j,C,k,N,P,p,ei]);let eu=(0,n.useCallback)(e=>{if(eo(e),e<=0){if(z.current)return;V(!0),G(0);return}V(!1),G(Math.min(1,e))},[eo,V,G]),ec=(0,n.useCallback)(()=>{z.current=!0,V(!1),G(1),L("torn"),y()},[y,V,G]);(0,n.useLayoutEffect)(()=>{if(!i||!T)return;let e=K.current,t=D.current,n=e?.querySelector("[data-rip-card]");if(!e||!t||!n)return;if(Q){e.style.opacity="0";return}let r=t.getBoundingClientRect(),l=n.getBoundingClientRect(),a=r.top+r.height*(eO(i)/100),s=a+.04*r.height-l.top;H.current={startY:s,peekY:a-.17*l.height-l.top},e.style.transform=`translateY(${s}px)`},[T]),(0,n.useEffect)(()=>{if(!i||null!==P||!o||et.current===er)return;et.current=er;let e=p.elapsedMs()??X.minCharge,t=Math.max(0,X.minCharge-e);C?.(t+X.stripAt);let n="cubic-bezier(0.16, 1, 0.3, 1)";es(t,()=>{B("card"),U(o),q.current=!0,L("rising"),V(!1),D.current?.scrollIntoView({block:"center",behavior:Q?"auto":"smooth"}),(0,r.play)("burst"),k?.(),ei(),E.current?.stream("column",null),j?.(X.verdictAt)}),es(t+X.riseAt,()=>{let e=K.current,t=H.current;if(e){if(Q||!t){e.style.transition=`opacity ${S.fade/M}ms`,e.style.opacity="1";return}e.animate([{transform:`translateY(${t.startY}px)`},{transform:`translateY(${t.peekY}px)`}],{duration:S.rise/M,easing:n,fill:"forwards"})}}),es(t+X.launchAt,()=>{L("dropped");let e=K.current,t=H.current;if(!e||Q||!t)return;
1e.getAnimations().forEach(e=>e.cancel());let r=e.animate([{transform:`translateY(${t.peekY}px)`},{transform:"translateY(0)"}],{duration:S.launch/M,easing:n,fill:"forwards"});r.finished.then(()=>{r.cancel(),e.style.transform=""}).catch(()=>{})}),es(t+X.dropAt+S.drop,()=>L("gone")),es(t+X.faceAt,()=>N?.()),es(t+X.sparkAt,()=>{Q||E.current?.emit(eZ(f))})},[i,o,er,f,X,S,M,Q,es,j,C,k,N,P,p,ei]);let ed=null===P?A:P<el.flashAt?P<el.cutAt?"squash":"cut":P<el.cardInAt?"flash":"card",[ep,ef]=(0,n.useState)(!1);(0,n.useEffect)(()=>ef(!0),[]);let em=null===P?T:o,eh="card"===ed&&null!==em,ex=ep&&i?(0,c.createPortal)((0,t.jsx)("span",{"aria-hidden":!0,className:"rip-stage-wash",style:{"--rip-stage-glow":i.glow}}),document.body):null;return(0,t.jsxs)("div",{className:(0,a.cn)("relative",eV),style:{...(0,l.ripCssVars)(S),...i?{"--rip-stage-glow":i.glow}:null},children:[ex,(0,t.jsxs)("div",{className:(0,a.cn)("relative w-full overflow-hidden rounded-xl",x?"aspect-[0.86] max-h-[530px]":"aspect-[3/4]"),children:[!x&&(0,t.jsx)("div",{"aria-hidden":!0,className:(0,a.cn)("pawn-stage-surface absolute inset-0 rounded-xl border border-border","transition-opacity duration-300",eh?"opacity-100":"opacity-0")}),i&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,t.jsx)("div",{className:x?"h-full w-[66%] max-w-[300px]":"h-[88%] w-[66%] max-w-[300px]",children:(0,t.jsx)(e$,{ref:D,cardSlotRef:K,art:i,phase:F,springing:_,charging:"charging"===A,arriving:O,onArrived:()=>$(!1),surface:"sealed"===F&&(0,t.jsx)(s,{label:b,disabled:w||"idle"!==A,holdMs:l.RIP_RISE_GESTURE.hold,onComplete:ec,onProgress:eu,className:"absolute inset-0 z-[6] h-full",children:null}),children:eh&&em&&(0,t.jsx)(eW,{card:em,basisLabel:v,rank:f,packPriceCents:m,simulate:g,timing:S,timeScale:M,animate:!0,rise:X,onCeremonyDone:R},er??"card")})})}),!i&&e&&(0,t.jsx)("div",{className:(0,a.cn)("absolute inset-0 flex items-center justify-center","transition-opacity duration-150","card"!==ed?"opacity-100":"opacity-0"),children:(0,t.jsx)("div",{className:(0,a.cn)(x?"h-full max-w-[66%]":"h-[88%] max-w-[66%]","squash"===ed&&"rip-squash"),children:(0,t.jsx)(s,{label:b,disabled:w||"idle"!==A,onComplete:y,onProgress:eo,children:(0,t.jsx)(eU,{active:"cut"===ed||"flash"===ed,children:(0,t.jsx)(eA.RipChargeProvider,{charge:p.ref,children:e})})})})}),!i&&("flash"===ed||"card"===ed)&&(0,t.jsx)(eT,{}),!i&&eh&&em&&(0,t.jsx)(eW,{card:em,basisLabel:v,rank:f,packPriceCents:m,simulate:g,timing:S,timeScale:M,animate:!0,onCeremonyDone:R},er??"card"),(0,t.jsx)(h,{ref:E})]})]})}],403353);var e0=e.i(43690),e1=e.i(894771),e2=e.i(122097),e4=e.i(307052),e3=e.i(432313);e.s(["useRipFunding",0,function(e){let{publicKey:t,connection:r,signTransaction:l,sendTransaction:a}=(0,N.useUnifiedWallet)(),{profiles:i,activeProfileIndex:s}
1=(0,e1.useProfile)(),[o,u]=(0,n.useState)(!1),c=(e?.usdcCents??0)/100,d=e?.needsSol??!1,p=(0,e3.useUsdcWalletBalance)(t??null),f=p.known?p.uiBalance:null,{balances:m,isLoading:h}=(0,e2.useAllProfileUsdcBalances)(i),x=(0,e4.useProfileLoanBlock)(t??null,s,!!t),g=(0,e0.useQuery)({queryKey:["rip","sol-balance",t?.toBase58()??null],queryFn:()=>r.getBalance(t),enabled:d&&!!t,staleTime:2e4,refetchInterval:3e4}).data??null,v=(0,ef.solReadiness)(d,g),b=(0,n.useMemo)(()=>{var e;return null===s?null:(e=m.get(s),void 0===e||h?null:e)},[s,m,h]),w=null===f?c:Math.max(0,c-f),y=(0,n.useMemo)(()=>!t||null===s||x.blocked||null===b||c<=0?null:b+1e-6>=c?s:null,[s,x.blocked,c,b,t]),j=(0,n.useMemo)(()=>t?null!==y?"ready":null===f?"walletBalanceUnknown":w>0?x.blocked?"loanBlocked":null===b?"profileBalanceUnknown":b+1e-6<w?"shortEverywhere":"canAutoFund":"unknown"===v?"solBalanceUnknown":"short"===v?"needsSol":"ready":"noWallet",[x.blocked,y,b,t,w,v,f]),C=(0,n.useCallback)(async()=>{if(t&&null!==s&&null!==f&&!(w<=0)){u(!0);try{await eC({connection:r,publicKey:t,signTransaction:l??null,sendTransaction:a,profileIndex:s,amountUsdc:Math.ceil(100*w)/100}),(0,e2.requestProfileBalancesBurstRefresh)()}finally{u(!1)}}},[s,r,t,a,w,l,f]);return{state:j,payFromProfileIndex:y,needUsdc:c,walletUsdc:f,profileAvailableUsdc:b,shortfallUsdc:w,loanBlockKnown:!x.isLoading,needsSol:d,solLamports:g,minSolLamports:ef.MIN_SOL_LAMPORTS,isFunding:o,fund:C}}],444171)},127550,e=>{"use strict";var t=e.i(668987);function n(e){return[...e].sort((e,t)=>e.probabilityBps-t.probabilityBps||t.minValueCents-e.minValueCents)}function r(e){let t=n(e);return t.length<2?[]:t.slice(0,t.length<3?1:2)}let l=(e,t)=>e.trim().toLowerCase()===t.trim().toLowerCase();e.s(["byRarity",0,n,"ceremonyOf",0,function(e,a){if(void 0===a)return null;let i=function(e){let l=n(e.tiers);if(l.length<2)return[];if(!(0,t.comparableBases)(e.valueBasis,"cash"))return r(e.tiers);let a=l.filter(t=>t.minValueCents>=e.priceCents),i=a.length>=2?a:r(e.tiers);return i.length>=l.length?r(e.tiers):i.slice(0,4)}(a);if(0===i.length)return null;if(null!==e.tier){let t=a.tiers.find(t=>l(t.name,e.tier));if(t){let e=i.findIndex(e=>l(e.name,t.name));return e<0?null:Math.min(e,3)}}if(null===e.valueCents||!(0,t.comparableBases)(e.valueBasis,a.valueBasis))return null;let s=i.findIndex(t=>e.valueCents>=t.minValueCents);return s<0?null:Math.min(s,3)},"hitOf",0,function(e,n){if(void 0===n)return null;let a=r(n.tiers);if(0===a.length)return null;if(null!==e.tier){let t=n.tiers.find(t=>l(t.name,e.tier));if(t){let e=a.findIndex(e=>l(e.name,t.name));return e<0?null:{tier:t,rank:e}}}if(null===e.valueCents||!(0,t.comparableBases)(e.valueBasis,n.valueBasis))return null;let i=a.findIndex(t=>e.valueCents>=t.minValueCents);return i<0?null:{tier:a[i],rank:i}},"markedBands",0,r])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.