tokentracker-cli 1.3.6 → 1.3.7
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/THIRD_PARTY_NOTICES.md +39 -0
- package/dashboard/dist/THIRD_PARTY_NOTICES.txt +39 -0
- package/dashboard/dist/assets/{AchievementBadge-CHDt55IP.js → AchievementBadge-B6Ys-Iv6.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-DpbRHmb8.js → AchievementsPage-C7EJYb05.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-Ck5CiX4P.js → AchievementsSection-KjJeaWDP.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-BVPqlh0X.js → BadgeDetailModal-BdoapwT5.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-CVsv6kxT.js → BotAnimated-coLP7eiI.js} +1 -1
- package/dashboard/dist/assets/{Card-C9FjyAwh.js → Card-CMShFKqX.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-ChkjId9l.js → CloudCheckoutPage-DQ16a4Ui.js} +1 -1
- package/dashboard/dist/assets/CloudPage-D1PEMzr2.js +2 -0
- package/dashboard/dist/assets/{CloudUsageExport-jXdoiD0e.js → CloudUsageExport-Dn7_qVGy.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-DFnEeZzc.js → CommandPalette-t3sXFKqr.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CZDS8gPA.js → CommunityStatsModal-DHyreMHY.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DRhgBoGE.js → ConfirmModal-DiguIoDY.js} +1 -1
- package/dashboard/dist/assets/{Controls-BmT6-x_L.js → Controls-D6267L_q.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-DfwwXZBo.js → DashboardPage-0xC6i2rZ.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-DuqNLatr.js → DateRangePopover-CVZTfOUX.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-BtI0bWyg.js → DevicePage-BagH0rTy.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-DjnC3P4V.js → DialogClose-IWs31AbB.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-JwE-wyWI.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-B9NNSz5p.js → DialogTitle-CI8xcLkd.js} +1 -1
- package/dashboard/dist/assets/ElectricLogo-CakZnEiu.js +282 -0
- package/dashboard/dist/assets/ElectricLogo-D0wiAojj.css +1 -0
- package/dashboard/dist/assets/{FadeIn-fsVQmJGa.js → FadeIn-BJiqknMG.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-Cg-f1iZc.js → HeaderGithubStar-Bo6VoGCl.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-DRIRlzXH.js → HoverTooltip-DjJmYzbc.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-DaAubaJQ.js → IpCheckPage-Cp2ELhP8.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-DjBGIjHk.js → LandingPage-gvBFMTKh.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-BkCXqhz7.js → LeaderboardPage-CbWwclwl.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-Ds-wiWcN.js → LeaderboardProBadge-QK4hLmn1.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-X_rfSQT5.js → LeaderboardProfileModal-DuggTNlv.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-rpl1Ozwj.js → LeaderboardProfilePage-CZZAm33s.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-BUvDBmgD.js → LimitsPage-DJkws70g.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-LBH1DBrs.js → LocalOnlyNotice-Cf9NPAL1.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-B0vRJEcg.js → LoginCard-s3qsEOET.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DdzgP43f.js → LoginModal-BTLHl4eP.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-B4VCQxzn.js → LoginPage-DDqQpy85.js} +1 -1
- package/dashboard/dist/assets/{PetPage-Cmf6aXc9.js → PetPage-D4P5yDL8.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BzfELnIC.js → PopoverPopup-B_fwRpm_.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-ClHXNkQ0.js → ProviderIcon-B1oef_V8.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-BeUpNt_6.js → ResetPasswordPage-BduujSou.js} +1 -1
- package/dashboard/dist/assets/{Select-BHEXdYHu.js → Select-ClkKzKsi.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-aaQK_QIt.js → SelectItemText-D_4VNKEi.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-ClNhKnlP.js → SelfHostPage-CDNLHmOx.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-Byd_s6FS.js → ServiceStatusPage-V1exv7gK.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-u3_b4PO7.js → SessionsPage-BR5gBSc1.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-LJJCS1G0.js +2 -0
- package/dashboard/dist/assets/{SkillsPage-Bb-PVfux.js → SkillsPage-D0oeWRew.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-CubA3PXu.js → TokenGalaxy-h5USfWnF.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-DMliWhoK.js → TooltipPopup-1KxZ_iHu.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-as8idaOy.js → TrendMonitor-gMTrGZzH.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DDPR4v0R.js → WidgetsPage-xghIyvm_.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-zZzgYz6s.js → WrappedPage-O4zzP87x.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-DKVGjnxf.js +45 -0
- package/dashboard/dist/assets/__vite-browser-external-DvNSoTb8.css +1 -0
- package/dashboard/dist/assets/{agent-logos-CoNhCm9-.js → agent-logos-CyXPIQ5S.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-C5hDp7fc.js → arrow-left-BqMZ7dgK.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-DEvMmSiA.js → arrow-right-D2cfRUf2.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DxY0neJ4.js → arrow-up-right-DSJpQHMH.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-bzh7-lab.js → calendar-days-Cpu5CPAM.js} +1 -1
- package/dashboard/dist/assets/{check-CSZvcC3X.js → check-BTSG8HIW.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-CsiGcG0G.js → chevron-down-0nuZGQbD.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-z_eDVwm6.js → cloud-checkout-Jv0vhd5v.js} +1 -1
- package/dashboard/dist/assets/{composite-Cq0CmNAv.js → composite-_t6vz49X.js} +1 -1
- package/dashboard/dist/assets/{download-DqLpubIF.js → download-CzxvhDR9.js} +1 -1
- package/dashboard/dist/assets/{external-link-B8E8tbB3.js → external-link-BwKhoPLM.js} +1 -1
- package/dashboard/dist/assets/{flame-CrJDlnro.js → flame-Bni4FlSO.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DPIGGOlt.js → format-tokens-BLPhLm4w.js} +1 -1
- package/dashboard/dist/assets/{gift-CCp4Hh50.js → gift-lj3smodH.js} +1 -1
- package/dashboard/dist/assets/{host-mode-xzpMLcwP.js → host-mode-DluVCV7W.js} +1 -1
- package/dashboard/dist/assets/{icons-CbB9Y-eV.js → icons-BThVE2Zq.js} +1 -1
- package/dashboard/dist/assets/{index-BiK5-tQp.js → index-CETYrL7R.js} +1 -1
- package/dashboard/dist/assets/{index-zuC7FU-t.js → index-CarMa6Pv.js} +1 -1
- package/dashboard/dist/assets/{index-DX7nYrHb.js → index-D_ERbEBI.js} +1 -1
- package/dashboard/dist/assets/{info-B3NKYwWG.js → info-DSgWF_40.js} +1 -1
- package/dashboard/dist/assets/{link-2-BRc8d8M9.js → link-2-C7H_UH8Q.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-Cm5Nsgp-.js → loader-circle-B2ln5DKm.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-CYLYBECB.js → modifiers.esm-DHEGy9eE.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone--IZ4D84F.js → monitor-smartphone-BI3aJPNi.js} +1 -1
- package/dashboard/dist/assets/{play-CUrMOLtq.js → play-CVxzAkNo.js} +1 -1
- package/dashboard/dist/assets/{plus-0hrCDl4r.js → plus-UGoZah-U.js} +1 -1
- package/dashboard/dist/assets/{provider-display-CNK0FN3Q.js → provider-display-C-ibpm5u.js} +1 -1
- package/dashboard/dist/assets/{react-CCNSVHEA.js → react-_bbDNdaT.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-DsolkMUX.js → safePolygon-DeLf2a7a.js} +1 -1
- package/dashboard/dist/assets/{search-DYmYb9xY.js → search-BzL7DvcZ.js} +1 -1
- package/dashboard/dist/assets/{server-CYcqzdSW.js → server-BsilXoLs.js} +1 -1
- package/dashboard/dist/assets/{shield-check-5zABLIr6.js → shield-check-Dx8cSMB0.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CD-ojBGj.js → skills-api-CnOpyIPR.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-BCn2Ms6R.js → sortable.esm-DrIfxJ2p.js} +1 -1
- package/dashboard/dist/assets/{store-B22kwLs0.js → store-CjkDYjXp.js} +1 -1
- package/dashboard/dist/assets/{terminal-CTv-oTU2.js → terminal-CExBqXDx.js} +1 -1
- package/dashboard/dist/assets/{trash-C5MAh3GO.js → trash-DSHRpaMy.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-BrgrxUD2.js → use-community-stats-B1W63PCE.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-B1_rbvgH.js → use-latest-request-guard-8-lur0NI.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BOk5f-HM.js → use-limits-display-prefs-Dq0e_5PV.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-B2gc_m9W.js → use-native-settings-CkPyWn4W.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-N3sGpJ0u.js → use-ordered-list-Cul7GZDv.js} +1 -1
- package/dashboard/dist/assets/{use-pet-settings-sWFXgR3m.js → use-pet-settings-DkNURWe6.js} +2 -2
- package/dashboard/dist/assets/use-reduced-motion-CkHJN2uY.js +1 -0
- package/dashboard/dist/assets/{use-transform-BsaLmw46.js → use-transform-DzUhSbxH.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-wL7v-S0r.js → use-usage-limits-3ZkgTe7n.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-CbCnjf-N.js → useCurrency-EbqxSlEF.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-MepYlL0A.js → usePositioner-cTX1WPQP.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-Bq-rwuKa.js → useTokenFormat-CanmWK4w.js} +1 -1
- package/dashboard/dist/assets/{zap-1ah5e11g.js → zap-DQHYg9o6.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/ip-check.html +2 -2
- package/dashboard/dist/leaderboard.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/dashboard/dist/token-tracker-bolt-outline.svg +3 -0
- package/dashboard/dist/token-tracker-bolt.svg +3 -0
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/CloudPage-D1nrt3MG.js +0 -1
- package/dashboard/dist/assets/DialogDescription-yy_QHg7O.js +0 -1
- package/dashboard/dist/assets/SettingsPage-DweCAbsy.js +0 -2
- package/dashboard/dist/assets/__vite-browser-external-DWN9Fb-H.js +0 -45
- package/dashboard/dist/assets/__vite-browser-external-LpFw4zXh.css +0 -1
- package/dashboard/dist/assets/use-reduced-motion-C3MBYVqm.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as ie,j as U,a0 as Ui,a1 as Vi,ar as Ji,d as Qi,u as qi,as as tl,a3 as el,c as st,ad as nl,af as rl,am as sl,B as Dr,L as Gs,at as al,aa as Ja,au as g0,a8 as ol,a9 as Yn,av as cl,aw as il}from"./__vite-browser-external-DWN9Fb-H.js";import{S as ll}from"./Controls-BmT6-x_L.js";import{C as x0}from"./Card-C9FjyAwh.js";import{A as Qa}from"./arrow-right-DEvMmSiA.js";import{C as b0}from"./chevron-down-CsiGcG0G.js";import{S as ul}from"./server-CYcqzdSW.js";import{S as fl}from"./shield-check-5zABLIr6.js";import{C as dl}from"./check-CSZvcC3X.js";var qa={plate:"#ffffff",hi:"#232327",edge:"#a4a4ac",mid:"#c3c3c9",lo:"#e0e0e4"},to={plate:"#08090a",hi:"#d0d6e0",edge:"#5b5d64",mid:"#3e3e44",lo:"#29292d"},Ci=["plate","hi","edge","mid","lo"],Or=t=>Ci.map(e=>`--hl-${e}:var(--hairline-${e},${t[e]});`).join(""),y0="cubic-bezier(0.5,0,0.1,1)",be=":where([data-hairline]>svg)";function hl(t){const e=Object.fromEntries(Ci.map(s=>[s,`light-dark(${qa[s]},${to[s]})`]));return[`:where([data-hairline]){display:block;position:relative;aspect-ratio:5/4;touch-action:pan-y;user-select:none;-webkit-user-select:none;--hl-sw:var(--hairline-stroke,0.9);${Or(qa)}}`,t?`:where([data-hairline]){${Or(e)}}`:"",`:where(.dark,[data-theme="dark"]) :where([data-hairline]){${Or(to)}}`,`:where([data-hairline][data-hairline-theme="light"]){${Or(qa)}}`,`:where([data-hairline][data-hairline-theme="dark"]){${Or(to)}}`,":where([data-hairline]:focus-visible){outline:1.5px solid var(--hl-hi);outline-offset:2px}",`${be}{position:absolute;inset:0;width:100%;height:100%;display:block}`,":where([data-hairline]>[data-hairline-live]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}",`${be} :where(path,polygon,ellipse,line){fill:var(--hl-plate);stroke:var(--hl-mid);stroke-width:var(--hl-sw);vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round;transition:stroke 260ms ${y0}}`,`${be} :where(.nf){fill:none}`,`${be} :where(.fo){stroke:none}`,`${be} :where(.sil){stroke:var(--hl-edge)}`,`${be} :where(.hi){stroke:var(--hl-hi)}`,`${be} :where(.lo){stroke:var(--hl-lo)}`,`${be} :where(.dash){stroke-dasharray:1 3}`,`${be} :where(.dot){stroke:none;fill:var(--hl-hi);transition:fill 260ms ${y0}}`,`${be} :where(.dot.m){fill:var(--hl-edge)}`,`${be} :where(.dot.off){fill:var(--hl-lo)}`,`${be} :where(.ghost path){fill:none;stroke:var(--hl-mid)}`].join("")}var M0=new WeakSet;function pl(t){if(M0.has(t))return;M0.add(t);const e=t.nodeType===9?t:t.ownerDocument,s=e.defaultView,u=hl(!!s?.CSS?.supports?.("color","light-dark(#000,#fff)"));if(s&&"adoptedStyleSheets"in t)try{const c=new s.CSSStyleSheet;c.replaceSync(u),t.adoptedStyleSheets=[...t.adoptedStyleSheets,c];return}catch{}const o=e.createElement("style");o.setAttribute("data-hairline-style",""),o.textContent=u,(t.nodeType===9?e.head??e.documentElement:t).appendChild(o)}var lt=(t,e,s)=>Math.max(e,Math.min(s,t)),bt=(t,e,s)=>t+(e-t)*s,vt=t=>t*Math.PI/180,$t=t=>Math.round(t*100)/100,tt=t=>"M"+t.map(e=>$t(e[0])+" "+$t(e[1])).join("L")+"Z",ft=(t,e)=>`M${$t(t[0])} ${$t(t[1])}L${$t(e[0])} ${$t(e[1])}`,jt=t=>t.length<2?"":"M"+t.map(e=>$t(e[0])+" "+$t(e[1])).join("L"),At=(t,e,s)=>({az:vt(t),k:e,S:s,ox:0,oy:0});function Mt(t){const e=Math.cos(t.az),s=Math.sin(t.az),u=Math.sqrt(1-t.k*t.k);return(o,c,r)=>{const i=o*e-c*s,h=o*s+c*e;return[t.ox+t.S*i,t.oy+t.S*(h*t.k-r*u)]}}function le(t,e,s,u){const o=Math.cos(t.az),c=Math.sin(t.az),r=Math.sqrt(1-t.k*t.k),i=(e-t.ox)/t.S,h=((s-t.oy)/t.S+u*r)/t.k;return[i*o+h*c,-i*c+h*o]}function Ct(t,e,s,u){t.ox=0,t.oy=0;const o=Mt(t);let c=1e9,r=-1e9,i=1e9,h=-1e9;for(const v of e){const y=o(v[0],v[1],v[2]);c=Math.min(c,y[0]),r=Math.max(r,y[0]),i=Math.min(i,y[1]),h=Math.max(h,y[1])}t.ox=s-(c+r)/2,t.oy=u-(i+h)/2}function rt(t,e,s,u,o,c=4){o=Math.max(0,Math.min(o,(s-t)/2,(u-e)/2));const r=[];for(const[i,h,v]of[[s-o,u-o,0],[t+o,u-o,90],[t+o,e+o,180],[s-o,e+o,270]])for(let y=0;y<=c;y++){const p=vt(v+90*y/c),g=Math.cos(p),N=Math.sin(p);r.push({u:i+o*g,v:h+o*N,nu:g,nv:N})}return r}function ht(t,e=96){const s=[];for(let u=0;u<e;u++){const o=u/e*Math.PI*2,c=Math.cos(o),r=Math.sin(o);s.push({u:t*c,v:t*r,nu:c,nv:r})}return s}function Pt(t){const e=t.slice().sort((c,r)=>c[0]-r[0]||c[1]-r[1]),s=(c,r,i)=>(r[0]-c[0])*(i[1]-c[1])-(r[1]-c[1])*(i[0]-c[0]),u=[],o=[];for(const c of e){for(;u.length>1&&s(u[u.length-2],u[u.length-1],c)<=0;)u.pop();u.push(c)}for(let c=e.length-1;c>=0;c--){const r=e[c];for(;o.length>1&&s(o[o.length-2],o[o.length-1],r)<=0;)o.pop();o.push(r)}return u.pop(),o.pop(),u.concat(o)}var pt=(t,e,s)=>e.map(u=>t(u.u,u.v,s)),Bt=t=>{const e=Math.sin(t.az),s=Math.cos(t.az);return u=>u.nu*e+u.nv*s>=-1e-6};function Kt(t,e){const s=t.length;let u=-1;for(let c=0;c<s;c++)if(e(t[c])&&!e(t[(c+s-1)%s])){u=c;break}if(u<0)return e(t[0])?t.slice():[];const o=[];for(let c=0;c<s&&e(t[(u+c)%s]);c++)o.push(t[(u+c)%s]);return o}function it(t,e,s,u,o,c){return{sil:tt(Pt(pt(t,s,c).concat(pt(t,s,o)))),crease:u?jt(pt(t,Kt(u,e),c)):""}}var mt=(t,e,s,u,o,c)=>[rt(t,e,s,u,o),rt(t+c,e+c,s-c,u-c,Math.max(.3,o-c))];function d0(t,e){const s=e.map(r=>t(r.u,r.v,0));let u=0,o=0,c=0;return s.forEach((r,i)=>{r[0]<s[u][0]&&(u=i),r[0]>s[o][0]&&(o=i),r[1]>s[c][1]&&(c=i)}),[e[u],e[o],e[c]]}function ge(t,e,s=4){const u=t.length,o=[];for(let c=0;c<u;c++){const r=t[(c+u-1)%u],i=t[c],h=t[(c+1)%u],v=Math.hypot(r[0]-i[0],r[1]-i[1]),y=Math.hypot(h[0]-i[0],h[1]-i[1]),p=Math.min(e[c],v/2,y/2),g=[i[0]+(r[0]-i[0])/v*p,i[1]+(r[1]-i[1])/v*p],N=[i[0]+(h[0]-i[0])/y*p,i[1]+(h[1]-i[1])/y*p];for(let I=0;I<=s;I++){const L=I/s,H=1-L;o.push([H*H*g[0]+2*H*L*i[0]+L*L*N[0],H*H*g[1]+2*H*L*i[1]+L*L*N[1]])}}return o}function vl(t,e,s,u,o){const c=Kt(s,e),r=pt(t,c,u-o);return{d:jt(r)+[c[0],c[c.length-1]].map(i=>ft(t(i.u,i.v,u),t(i.u,i.v,u-o))).join(""),y0:Math.min(...pt(t,c,u).map(i=>i[1])),y1:Math.max(...r.map(i=>i[1]))+2}}var Ws=!1,ji=t=>{Ws=t},Le=()=>Ws;function yt(t,e={}){return{x:t,v:0,t,k:e.k??100,c:e.c??18,m:e.m??1,eps:e.eps??.01}}function wt(t,e){if(Ws)return t.x=t.t,t.v=0,!1;const s=Math.max(1,Math.ceil(e*240)),u=e/s;for(let o=0;o<s;o++){const c=(-t.k*(t.x-t.t)-t.c*t.v)/t.m;t.v+=c*u,t.x+=t.v*u}return Math.abs(t.x-t.t)<t.eps&&Math.abs(t.v)<t.eps*10?(t.x=t.t,t.v=0,!1):!0}function ml(t,e,s,u){const o=3*t,c=3*(s-t)-o,r=1-o-c,i=3*e,h=3*(u-e)-i,v=1-i-h,y=N=>((r*N+c)*N+o)*N,p=N=>((v*N+h)*N+i)*N,g=N=>(3*r*N+2*c)*N+o;return N=>{if(N<=0)return 0;if(N>=1)return 1;let I=N;for(let L=0;L<8;L++){const H=y(I)-N;if(Math.abs(H)<1e-5)break;const W=g(I);if(Math.abs(W)<1e-6)break;I-=H/W}if(!(I>=0&&I<=1)||Math.abs(y(I)-N)>1e-4){let L=0,H=1;I=N;for(let W=0;W<24;W++)y(I)<N?L=I:H=I,I=(L+H)/2}return p(I)}}var h0=ml(.32,.72,0,1),Ft=(t,e=700)=>({from:t,to:t,t0:-1e9,dur:e}),Wt=(t,e)=>{const s=lt((e-t.t0)/t.dur,0,1);return t.from+(t.to-t.from)*(Ws?1:h0(s))},oe=(t,e,s,u)=>{t.to!==e&&(t.from=Wt(t,s),t.to=e,t.t0=s+u)},Jt=(t,e)=>Ws||e>=t.t0+t.dur,gl="http://www.w3.org/2000/svg";function _(t,e,s){const u=document.createElementNS(gl,t);if(e)for(const o in e)u.setAttribute(o,String(e[o]));return s&&s.appendChild(u),u}function q(t){const e=_("g",{},t);return{g:e,sil:_("path",{class:"sil"},e),cr:_("path",{class:"nf lo"},e)}}var Q=(t,e)=>{t.sil.setAttribute("d",e.sil),t.cr.setAttribute("d",e.crease)},en=(t,e,s,u)=>_("ellipse",{rx:$t(s*e.S),ry:$t(s*e.S*e.k),class:u},t),Qt=(t,e)=>{t.setAttribute("cx",String($t(e[0]))),t.setAttribute("cy",String($t(e[1])))},xl=0;function bl(t,e,s,u=.7){const o="hl-fd"+ ++xl,c=_("defs",{},t),r=_("linearGradient",{id:o+"g",gradientUnits:"userSpaceOnUse",x1:0,y1:$t(e),x2:0,y2:$t(s)},c);_("stop",{offset:0,"stop-color":"#fff","stop-opacity":u},r),_("stop",{offset:1,"stop-color":"#fff","stop-opacity":0},r);const i=_("mask",{id:o,maskUnits:"userSpaceOnUse",x:0,y:0,width:400,height:320},c);return _("rect",{x:0,y:0,width:400,height:320,fill:`url(#${o}g)`},i),`url(#${o})`}function Ri(t,e,s,u,o,c,r){const i=vl(s,u,o,c,r),h=_("g",{class:"ghost",mask:bl(t,i.y0,i.y1)},e);_("path",{d:i.d},h)}var Er=[],ks=new Map,Cr=0,qo=0,_r=null,jr=null;function Pi(t){const e=Math.min(.05,Math.max(0,(t-qo)/1e3));qo=t;let s=!1;for(const u of Er.slice())if(u.vis&&u.awake){try{u.awake=!!u.tick(e,t)}catch(o){u.awake=!1,setTimeout(()=>{throw o})}s=s||u.awake}Cr=s?requestAnimationFrame(Pi):0}function $a(t){t.awake=!0,Cr||(qo=performance.now(),Cr=requestAnimationFrame(Pi))}var Bi=()=>{ji(!!jr?.matches),Er.forEach($a)};function yl(){_r||(_r=new IntersectionObserver(t=>{for(const e of t){const s=ks.get(e.target);if(s)for(const u of s)u.vis=e.isIntersecting,u.vis&&$a(u)}},{rootMargin:"80px"}),jr=matchMedia("(prefers-reduced-motion: reduce)"),ji(jr.matches),jr.addEventListener("change",Bi))}function Ml(){Cr&&cancelAnimationFrame(Cr),Cr=0,_r?.disconnect(),_r=null,jr?.removeEventListener("change",Bi),jr=null}function kt(t,e){yl();const s={stage:t,tick:e,vis:!1,awake:!0};Er.push(s);const u=ks.get(t);if(u){for(const c of u)s.vis=c.vis;u.add(s),s.vis&&$a(s)}else ks.set(t,new Set([s])),_r.observe(t);e(0,performance.now());let o=!1;return{wake:()=>{o||$a(s)},unregister:()=>{if(o)return;o=!0,Er=Er.filter(r=>r!==s);const c=ks.get(t);c&&(c.delete(s),c.size||(ks.delete(t),_r?.unobserve(t))),Er.length||Ml()}}}var Hs=new WeakMap,Rr=new WeakMap;function Et(t,e){Hs.set(t,e);let s=0;const u=i=>{const h=t.getBoundingClientRect();return[(i.clientX-h.left)/h.width*400,(i.clientY-h.top)/h.height*320]},o=i=>{clearTimeout(s),Rr.get(t)?.hold(),e.move(u(i),i)},c=i=>{clearTimeout(s),Rr.get(t)?.hold(),i.pointerType!=="mouse"&&t.releasePointerCapture?.(i.pointerId),e.down?e.down(u(i),i):e.move(u(i),i)},r=i=>{clearTimeout(s),s=window.setTimeout(()=>{e.leave(i),Rr.get(t)?.release()},i.pointerType==="mouse"?0:1400)};return t.addEventListener("pointermove",o),t.addEventListener("pointerdown",c),t.addEventListener("pointerleave",r),()=>{clearTimeout(s),Hs.get(t)===e&&Hs.delete(t),t.removeEventListener("pointermove",o),t.removeEventListener("pointerdown",c),t.removeEventListener("pointerleave",r)}}var w0=[[128,150],[200,118],[272,150],[200,206],null],eo=900,wl=1200,kl=1800,k0=1200,Al=450,A0={pointerType:"ghost"},El=0;function Tl([t,e]){const s=t-200,u=e-160;if(!s&&!u)return[200,320];const o=Math.min(s?(s>0?200:-200)/s:1/0,u?(u>0?160:-160)/u:1/0);return[200+s*o,160+u*o]}function E0(t,e,s){let u=0,o=k0+Al*(El++%4),c=-1,r=null,i=[200,320],h=!1,v=t.contains(t.ownerDocument.activeElement),y=!1;const p=()=>{r=null,c=-1,Hs.get(t)?.leave(A0)},g=j=>{if(h||v||!e.length)return!1;if(Le())return r&&p(),!1;if(o>0)return o-=j*1e3,!0;const F=e[u];if(F===null)return r&&p(),u=(u+1)%e.length,o=kl,!0;const X=Hs.get(t);if(!X)return!0;c<0&&(i=r??Tl(F),c=0),c=Math.min(eo,c+j*1e3);const z=h0(c/eo);return r=[i[0]+(F[0]-i[0])*z,i[1]+(F[1]-i[1])*z],X.move(r,A0),c<eo||(u=(u+1)%e.length,c=-1,o=wl),!0},N=()=>{r=null,c=-1},I=()=>{h||v||(u=0,c=-1,o=k0,P.wake())},L={hold:()=>{h=!0,N()},release:()=>{h&&(h=!1,I())}},H=()=>{v=!0,N()},W=j=>{v&&!t.contains(j.relatedTarget)&&(v=!1,I())};t.addEventListener("focusin",H),t.addEventListener("focusout",W),Rr.set(t,L);const P=kt(t,g);return{stop:()=>{y||(y=!0,P.unregister(),t.removeEventListener("focusin",H),t.removeEventListener("focusout",W),Rr.get(t)===L&&Rr.delete(t),r&&p())}}}function Tt(){let t=[];return{add:e=>{t.push(e)},on:(e,s,u,o)=>{const c=u;e.addEventListener(s,c,o),t.push(()=>e.removeEventListener(s,c,o))},dispose:()=>{const e=t;t=[];for(let s=e.length-1;s>=0;s--)e[s]()}}}var zr={riffle:[0,40,90],terrain:[1.5,3,5],exploded:[12,28,40],phosphor:[150,520,1500],slow:[.6,.2,.05],turntable:[200,650,1500],keyboard:[1,2,3.5],elevator:[40,100,220],phone:[16,28,40],laptop:[100,125,150],terminal:[1,2,3.5],cabinet:[1.5,3,5],branches:[1,3,6],vault:[250,600,1500],lockers:[55,90,120],padlock:[45,90,100],patch:[1,2.5,5],dish:[30,50,70],router:[.5,1.5,3],loupe:[1.3,1.8,2.6],sieve:[6,14,24],rail:[1,2,3.5],plug:[.35,.6,.9],query:[20,40,55],drawer:[12,22,34],basket:[8,16,28],plot:[3,6,12],hub:[10,16,24],relay:[40,120,220],settle:[90,120,150],format:[9,12,14],rebuild:[8,14,20],stack:[22,34,46]},Sl=.5;function Nl(t){const e=typeof t=="string"&&t.trim()!==""?Number(t):t;return typeof e!="number"||!Number.isFinite(e)?Sl:Math.min(1,Math.max(0,e))}function T0(t,e){const[s,u,o]=zr[t],c=Nl(e),r=c<=.5?s+c/.5*(u-s):u+(c-.5)/.5*(o-u);return Math.round(r*1e3)/1e3}var Cl="http://www.w3.org/2000/svg",Ys=new WeakMap,jl=t=>{typeof reportError=="function"?reportError(t):setTimeout(()=>{throw t})};function St(t,e,s){if(typeof document>"u")throw new Error(`hairline: ${t.id}() needs a DOM. Call it in the browser, once the element exists: in an effect, in onMount, or in a script after the element.`);if(!e||e.nodeType!==1)throw new TypeError(`hairline: ${t.id}() takes an element as its first argument, and got ${e===null?"null":typeof e}.`);Ys.get(e)?.();const u={...s},o=e.ownerDocument,c=e.getRootNode();pl(c.nodeType===9||"host"in c?c:o);const r=new Set,i=(P,j)=>{!r.has(P)&&e.hasAttribute(P)||(j===null?(e.removeAttribute(P),r.delete(P)):(e.setAttribute(P,j),r.add(P)))},h=()=>{i("data-hairline-theme",u.theme==="light"||u.theme==="dark"?u.theme:null),i("aria-label",e.hasAttribute("aria-labelledby")?null:typeof u.label=="string"?u.label:t.label)};i("data-hairline",t.id),i("role",t.focusable?"group":"img"),t.focusable&&i("tabindex","0"),h();const v=o.createElementNS(Cl,"svg");v.setAttribute("viewBox","0 0 400 320"),v.setAttribute("aria-hidden","true"),e.appendChild(v);let y=null;t.focusable&&(y=o.createElement("span"),y.setAttribute("data-hairline-live",""),y.setAttribute("aria-live","polite"),e.appendChild(y));let p=null,g=null;const N={get textContent(){return p},set textContent(P){const j=P??"";if(j===p)return;p=j,y&&y.textContent!==j&&(!g||j===t.rest||e.matches(":hover, :focus-within"))&&(y.textContent=j);const F=u.onRead;if(typeof F=="function")try{F(j)}catch(X){jl(X)}}};let I=T0(t.id,u.intensity);g=u.play===!0?E0(e,t.tour??w0):null;let L;try{L=t.engine({stage:e,svg:v,read:N},I)}catch(P){throw g?.stop(),P}p===null&&(N.textContent=t.rest);let H=!1;const W=()=>{if(!H){H=!0,Ys.get(e)===W&&Ys.delete(e),g?.stop(),g=null,L.destroy(),v.remove(),y?.remove();for(const P of r)e.removeAttribute(P);r.clear()}};return Ys.set(e,W),{update(P){if(H||!P)return;const j=u,F=P;for(const D in F)F[D]===void 0?delete j[D]:j[D]=F[D];const X=T0(t.id,u.intensity);X!==I&&(I=X,L.set(X));const z=u.play===!0;z!==!!g&&(g?.stop(),g=z?E0(e,t.tour??w0):null),h()},destroy:W}}var Zs=40,Tn=25,S0=8,N0=1.5,Mr=30,ue=.8,$r=3,Fr=1.4,Rl=44,Pl=[.45],Fa=30,fn=8,Bl=1.3,C0=9,Ll=2.6,Ks=-46,j0=.6,Il=70,Us=3;function R0(t,e,s){const u=Math.min(0,(t+e)*Math.SQRT1_2)/2;return[s*(t-u*Math.SQRT1_2),s*(e-u*Math.SQRT1_2)]}function no(t,e){const s=Math.hypot(t,e),u=s?-e/s:0,o=s?t/s:0,c=Math.cos(vt(s)),r=Math.sin(vt(s));return(i,h,v)=>{const y=(u*i+o*h)*(1-c);return[i*c+o*v*r+u*y,h*c-u*v*r+o*y,v*c+(u*h-o*i)*r]}}function _l(t,e){const s=[0];for(let u=1;u<=t.length;u++){const o=t[u-1],c=t[u%t.length];s.push(s[u-1]+Math.hypot(c.u-o.u,c.v-o.v))}return Array.from({length:e},(u,o)=>{const c=o/e*s[t.length];let r=0;for(;s[r+1]<c;)r++;const i=t[r],h=t[(r+1)%t.length],v=(c-s[r])/(s[r+1]-s[r]||1);return{u:i.u+(h.u-i.u)*v,v:i.v+(h.v-i.v)*v,nu:i.nu,nv:i.nv}})}function ro(t,e,s=!1){const u=t.length,o=[],c=[],r=[];for(let h=0;h<u;h++){const v=t[s?(h+u-1)%u:Math.max(h-1,0)],y=t[s?(h+1)%u:Math.min(h+1,u-1)],p=Math.hypot(y[0]-v[0],y[1]-v[1])||1,g=(y[0]-v[0])/p,N=(y[1]-v[1])/p;r.push([g,N]),o.push([t[h][0]-N*e,t[h][1]+g*e]),c.push([t[h][0]+N*e,t[h][1]-g*e])}if(s)return tt(o)+tt(c.reverse());const i=(h,v,y)=>Array.from({length:7},(p,g)=>{const N=Math.PI*(g+1)/8,I=Math.cos(N)*y,L=Math.sin(N)*y;return[h[0]+e*(-v[1]*I+v[0]*L),h[1]+e*(v[0]*I+v[1]*L)]});return tt([...o,...i(t[u-1],r[u-1],1),...c.reverse(),...i(t[0],r[0],-1)])}var P0=[[-Tn,0],...Array.from({length:9},(t,e)=>{const s=Math.PI-Math.PI/2*(e/8);return[-Tn+fn+fn*Math.cos(s),Fa-fn+fn*Math.sin(s)]}),...Array.from({length:9},(t,e)=>{const s=Math.PI/2*(1-e/8);return[Tn-fn+fn*Math.cos(s),Fa-fn+fn*Math.sin(s)]}),[Tn,0]],zl=[[-C0,Fa],[C0,Fa]],B0=t=>{const e=Math.cos(vt(t)),s=Math.sin(vt(t));return u=>[u[1]*s,u[0],Mr+u[1]*e]},Hl=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,Us),r=zr.basket[2],i=Ks+j0*r,h=rt(-Zs,-Tn,Zs,Tn,S0,14),v=_l(h,Rl),y=h.map(E=>({...E,u:E.u*ue,v:E.v*ue})),p=rt(-Zs*ue+Fr,-Tn*ue+Fr,Zs*ue-Fr,Tn*ue-Fr,S0*ue-Fr,14),g=[];for(let E=-1;E<8;E++){const $=no(...R0(Math.cos(E*Math.PI/4),Math.sin(E*Math.PI/4),E<0?0:r));for(const G of h)g.push($(G.u,G.v,Mr+N0),$(G.u*ue,G.v*ue,0));for(const G of[Ks,i])for(const J of P0)g.push($(...B0(G)(J)))}Ct(c,g,200,166);const N=Mt(c),I=Math.sqrt(1-c.k*c.k),L=[Math.sin(c.az)*I,Math.cos(c.az)*I,c.k],H=_("g",{},e),W=_("path",{class:"nf lo"},H),P=q(H),j=_("path",{class:"nf lo"},H),F=_("path",{class:"sil"},H),X=_("path",{class:"sil"},H),z=_("path",{class:"sil"},H),D=yt(0),k=yt(0),b=yt(Ks,{k:60,c:6,eps:.02});let T=NaN,n=NaN,a=NaN,l=no(0,0);const d=E=>N(...l(...E)),f=E=>{const $=l(E.nu,E.nv,0);return $[0]*L[0]+$[1]*L[1]+$[2]*L[2]>=0};function x(){const E=D.x!==T||k.x!==n;if(E){T=D.x,n=k.x,l=no(T,n),Q(P,{sil:tt(Pt(y.map(G=>d([G.u,G.v,0])).concat(y.map(G=>d([G.u,G.v,$r]))))),crease:jt(Kt(p,f).map(G=>d([G.u,G.v,$r])))});const $=["",""];for(const G of v)$[+f(G)]+=ft(d([G.u*ue-G.nu,G.v*ue-G.nv,$r]),d([G.u,G.v,Mr]));for(const G of Pl){const J=$r+(Mr-$r)*G,B=ue+(1-ue)*G;h.forEach((R,Y)=>{const Z=h[(Y+1)%h.length];$[+f(R)]+=ft(d([R.u*B,R.v*B,J]),d([Z.u*B,Z.v*B,J]))})}W.setAttribute("d",$[0]),j.setAttribute("d",$[1]),F.setAttribute("d",ro(h.map(G=>d([G.u,G.v,Mr])),N0*Us,!0))}if(E||b.x!==a){a=b.x;const $=B0(a);X.setAttribute("d",ro(P0.map(G=>d($(G))),Bl*Us)),z.setAttribute("d",ro(zl.map(G=>d($(G))),Ll*Us))}}const M=kt(t,E=>{const $=wt(D,E),G=wt(k,E);b.t=Math.min(Ks+j0*Math.hypot(D.x,k.x),i);const J=wt(b,E);return x(),$||G||J});o.add(M.unregister);let S=u,A=!1,m=0,C=0;function w(){const E=Math.hypot(m,C),$=A&&E?lt(S,0,r)*lt(E/Il,0,1):0;[D.t,k.t]=$?R0(m/E,C/E,$):[0,0],s.textContent=A?`tilt ${Math.round(Math.hypot(D.t,k.t))}° · 0`:"rest",F.classList.toggle("hi",!A),P.sil.classList.toggle("hi",A),M.wake()}return w(),o.add(Et(t,{move:E=>{A=!0,[m,C]=le(c,E[0],E[1],Mr/2),w()},leave:()=>{A=!1,w()}})),o.add(()=>e.replaceChildren()),{set:E=>{S=E,w()},destroy:o.dispose}},As=30,ja=58,Vs=7,wr=2.6,L0=8,Ra=2.4,I0=6.6,Li=6,so=36,Dl=45,Wr=-15,Xr=7*As+15,Zn=-16,Js=ja+14,ao=wr+Ra+Li;function Ol(){const t=[],e=(r,i,h,v,y)=>(t.push({lane:r,n:i,x:h,y:v,parent:y}),t.length-1),s=[];for(let r=0;r<8;r++)s.push(e("main",r+1,r*As,0,r?s[r-1]:-1));const u=e("feature",1,2.5*As,ja,s[1]),o=e("feature",2,3.5*As,ja,u),c=e("feature",3,4.5*As,ja,o);return{cs:t,m:s,f:[u,o,c]}}var _0=(t,e,s,u,o,c)=>{const r=[];for(let i=0;i<=c;i++){const h=i/c,v=1-h,y=[v*v*v,3*v*v*h,3*v*h*h,h*h*h],p=[t[0],t[0]+s,e[0]-o,e[0]],g=[t[1],t[1]+u,e[1],e[1]];r.push([y[0]*p[0]+y[1]*p[1]+y[2]*p[2]+y[3]*p[3],y[0]*g[0]+y[1]*g[1]+y[2]*g[2]+y[3]*g[3]])}return r};function $l(t){const e=[],s=[];return t.forEach((u,o)=>{const c=t[Math.max(0,o-1)],r=t[Math.min(t.length-1,o+1)],i=r[0]-c[0],h=r[1]-c[1],v=Math.hypot(i,h),y=-h/v,p=i/v;e.push([u[0]+y*Vs/2,u[1]+p*Vs/2]),s.push([u[0]-y*Vs/2,u[1]-p*Vs/2])}),e.concat(s.reverse())}var Fl=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r=At(45,.5,1.4);Ct(r,[[Wr,Zn,-6],[Xr,Js,-6],[Xr,Zn,-6],[Wr,Js,-6],[Wr,Zn,ao+so],[Xr,Zn,ao+so]],200,166);const i=Mt(r),h=Bt(r),{cs:v,m:y,f:p}=Ol(),g=w=>[v[w].x,v[w].y],N=_("g",{},e),[I,L]=mt(Wr,Zn,Xr,Js,12,2.2);Q(q(N),it(i,h,I,L,-6,0));const H=(w,E)=>_0(w,E,(E[0]-w[0])*.3,(E[1]-w[1])*.5,(E[0]-w[0])*.45,14),W=(w,E)=>_0(E,w,(w[0]-E[0])*.3,(w[1]-E[1])*.5,(w[0]-E[0])*.45,14).reverse(),P=[[g(y[0]),g(y[7])],[...H(g(y[1]),g(p[0])),...W(g(p[2]),g(y[6])).slice(1)]];for(const w of P){const E=$l(w);_("path",{d:tt(E.map($=>i($[0],$[1],0))),class:"lo"},N),_("path",{d:tt(E.map($=>i($[0],$[1],wr))),class:""},N)}const[j,F]=[ht(L0,24),ht(L0-1.4,24)],[X,z]=[ht(I0,24),ht(I0-1.2,24)],D=(w,E,$)=>w.map(G=>({...G,u:G.u+E,v:G.v+$})),k=v.map((w,E)=>E).sort((w,E)=>v[w].x+v[w].y-(v[E].x+v[E].y)),b=[];for(const w of k){const E=v[w];Q(q(N),it(i,h,D(j,E.x,E.y),D(F,E.x,E.y),wr,Ra+wr));const $=_("path",{class:"dash nf"},N);b[w]={...E,drop:$,el:q(N),ring:D(X,E.x,E.y),inner:D(z,E.x,E.y),z:Ft(0),drawn:NaN}}const T=w=>{const E=[];for(let $=w,G=0;$>=0;$=b[$].parent,G++)E.push([$,G]);return E},n=p[2],a=2.2,l=.5;function d(w,E){if(E===w.drawn)return;w.drawn=E;const $=Ra+wr+E;Q(w.el,it(i,h,w.ring,w.inner,$,$+Li)),w.drop.setAttribute("d",ft(i(w.x,w.y,Ra+wr),i(w.x,w.y,$)))}const f=kt(t,(w,E)=>{let $=!1;for(const G of b)d(G,Wt(G.z,E)),Jt(G.z,E)||($=!0);return $});o.add(f.unregister);let x=null,M=null,S=new Map;function A(w,E,$,G){const J=performance.now(),B=new Map;for(const[R,Y]of T(w))Y<=E&&B.set(R,[so*$*lt(1-Y/(E+1),0,1),Y]);b.forEach((R,Y)=>{const[Z,V]=B.get(Y)||[0,(S.get(Y)||[0,0])[1]];G?R.z=Ft(Z):oe(R.z,Z,J,V*Dl)}),S=B,M!==w&&(M!==null&&b[M].el.sil.classList.remove("hi"),M=w,b[w].el.sil.classList.add("hi")),f.wake()}A(n,a,l,!0);function m(w){w!==x&&(x=w,w===null?(A(n,a,l),s.textContent="rest"):(A(w,c,1),s.textContent=`${b[w].lane} · ${b[w].n}`))}function C(w){const E=le(r,w[0],w[1],ao);if(E[0]<Wr||E[0]>Xr||E[1]<Zn||E[1]>Js)return null;let $=null,G=1/0;return b.forEach((J,B)=>{const R=Math.hypot(J.x-E[0],J.y-E[1]);R<G&&(G=R,$=B)}),$}return o.add(Et(t,{move:w=>m(C(w)),leave:()=>m(null)})),o.add(()=>e.replaceChildren()),{set:w=>{c=w,x!==null&&A(x,c,1)},destroy:o.dispose}},Es=12,Ts=10.4,Ce=9.6,ve=84,rn=4,Qs=2,te=44,Sn=26,Gr=-10,Nn=ve+10,oo=6,Mn=11,t0=Mn+(Es-1)*Ts+Ce,Kn=t0+6,co=[0,0,.2,0,0,.3,.58,.26,0,0,.13,0],z0=6,Wl=t=>t>=1?0:(1-t)*(1-t),Xl=t=>.375*t.nu+.307*t.nv>0;function H0(t,e,s,u,o){const c=(r,i)=>r.map(h=>t(h.u,i,h.v));return{sil:tt(Pt(c(e,u).concat(c(e,o)))),crease:s?jt(c(Kt(s,Xl),o)):""}}var Gl=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.5),r=te+Qs+Sn;Ct(c,[[Gr,0,0],[Nn,0,Kn],[Nn,te,0],[Gr,0,Kn],[-rn,r,Mn],[-rn,r,t0],[ve+rn,r,Mn]],200,166);const i=Mt(c),h=Bt(c);let v=u,y=null,p=null;const g=_("g",{},e),[N,I]=mt(Gr+3,3,Nn-3,te-3,3,1.2);Q(q(g),it(i,h,N,I,0,oo));const[L,H]=mt(Gr,0,Nn,te,3.5,1.6);Q(q(g),it(i,h,L,H,oo,Kn));const W=l=>l.map(d=>i(d.u,te,d.v)),P=l=>l.map(d=>i(Nn,d.u,d.v));_("path",{d:tt(W(rt(-7.6,Mn-2.2,ve+7.6,t0+2.2,2,4)))+tt(P(rt(5,oo+7,te-5,Kn-7,3,4))),class:"lo nf"},g);for(let l=0;l<Es;l++)for(const d of[-5.8,ve+5.8])Qt(_("circle",{r:.75,class:"dot off"},g),i(d,te,Mn+l*Ts+Ce/2));const j=[];for(let l=0;l<Es;l++){const d=Mn+l*Ts,f=_("g",{},g);j.push({i:l,z:d,body:rt(0,d+.4,ve,d+Ce-.4,1.6,4),face:rt(-rn,d,ve+rn,d+Ce,2,4),faceIn:rt(-rn+.8,d+.8,ve+rn-.8,d+Ce-.8,1.2,4),chassis:q(f),plate:q(f),marks:_("path",{class:"lo nf"},f),lamp:_("circle",{r:1.1,class:"dot off"},f),sp:yt(Sn*co[l],{eps:.02}),drawn:NaN})}function F(l,d){const f=l.z,x=S=>tt(S.map(A=>i(A.u,d,A.v)));let M=x(rt(-3.4,f+2,-1.2,f+Ce-2,1,3))+x(rt(ve+1.2,f+2,ve+3.4,f+Ce-2,1,3));for(let S=0;S<4;S++)M+=x(rt(4+S*10.6,f+2,13.8+S*10.6,f+Ce-2,1,3));for(let S=0;S<8;S++)M+=ft(i(50+S*2.6,d,f+2.5),i(50+S*2.6,d,f+Ce-2.5));return M}function X(l){const d=l.sp.x;if(d===l.drawn)return;l.drawn=d;const f=te+d+Qs,x=l.z+Ce/2,M=H0(i,l.body,null,te,te+d+.5);Q(l.chassis,{sil:M.sil,crease:ft(i(ve,te,x),i(ve,te+d,x))}),Q(l.plate,H0(i,l.face,l.faceIn,te+d,f)),l.marks.setAttribute("d",F(l,f)),Qt(l.lamp,i(ve-5,f,x))}function z(l){l!==p&&(p&&(p.plate.sil.classList.remove("hi"),p.lamp.setAttribute("class","dot off")),p=l,p.plate.sil.classList.add("hi"),p.lamp.setAttribute("class","dot"))}const D=kt(t,l=>{let d=!1;for(const f of j)wt(f.sp,l)&&(d=!0),X(f);return d});o.add(D.unregister);const k=i(0,0,0),b=[i(1,0,0),i(0,1,0),i(0,0,1)].map(l=>[l[0]-k[0],l[1]-k[1]]);function T(l,d,f){const[x,M]=[0,1,2].filter($=>$!==d),S=b[x],A=b[M],m=l[0]-k[0]-f*b[d][0],C=l[1]-k[1]-f*b[d][1],w=S[0]*A[1]-S[1]*A[0],E=[0,0,0];return E[d]=f,E[x]=(m*A[1]-C*A[0])/w,E[M]=(S[0]*C-S[1]*m)/w,E}function n(l){for(let M=Es-1;M>=0;M--){const S=T(l,1,te+Qs+Sn*co[M]),A=(S[2]-Mn-Ce/2)/Ts;if(S[0]>=-rn&&S[0]<=ve+rn&&Math.abs(A-M)<=.5)return A}const d=T(l,1,te+Qs),f=T(l,0,Nn);let x=null;return d[0]>=Gr-Sn-4&&d[0]<=Nn&&d[2]>=-Sn*.8&&d[2]<=Kn?x=d[2]:f[1]>=0&&f[1]<=te&&f[2]>=0&&f[2]<=Kn+4&&(x=f[2]),x===null?null:lt((x-Mn-Ce/2)/Ts,0,Es-1)}function a(){if(y===null){for(const l of j)l.sp.t=Sn*co[l.i];z(j[z0]),s.textContent="rest"}else{for(const d of j)d.sp.t=Sn*Wl(Math.max(0,Math.abs(d.i-y)-.5)/v);const l=Math.round(y);z(j[l]),s.textContent="blade "+(l+1)}D.wake()}return z(j[z0]),o.add(Et(t,{move:l=>{y=n(l),a()},leave:()=>{y=null,a()}})),o.add(()=>e.replaceChildren()),{set:l=>{v=l,y!==null&&a()},destroy:o.dispose}},Oe=26,kr=17,Yl=1.4,Yr=Oe*Oe/(4*kr),Pa=46,Xe=31,Ge=5,io=10,D0=16,Zl=45,Kl=40,Zr=[-20,30],Je=[0,0,Pa],Pe=(t,e,s)=>[t[0]+e[0]*s,t[1]+e[1]*s,t[2]+e[2]*s],O0=(t,e)=>t[0]*e[0]+t[1]*e[1]+t[2]*e[2];function $0(t,e){const s=vt(t),u=vt(e),o=Math.cos(u),c=Math.sin(u),r=[Math.cos(s),Math.sin(s),0],i=[-Math.sin(s),Math.cos(s),0];return{th:t,h:r,e:i,a:[r[0]*o,r[1]*o,c],u:[-r[0]*c,-r[1]*c,o]}}var Un=(t,e,s,u)=>Pe(Pe(Pe(Je,t.a,e),t.e,s*Math.cos(u)),t.u,s*Math.sin(u)),dn=(t,e,s,u,o)=>Array.from({length:o},(c,r)=>Pe(Pe(t,e,u*Math.cos(2*Math.PI*r/o)),s,u*Math.sin(2*Math.PI*r/o))),Kr=(t,e)=>t.map(s=>({u:s.u*e.h[0]+s.v*e.e[0],v:s.u*e.h[1]+s.v*e.e[1],nu:s.nu*e.h[0]+s.nv*e.e[0],nv:s.nu*e.h[1]+s.nv*e.e[1]})),Ul=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=null;const i=At(45,.5,2.5),h=[[-30,-30,0],[30,30,0],[30,-30,0],[-30,30,0]];for(const[Z,V]of[[-25,5],[-25,75],[115,5],[115,75],Zr]){const K=$0(Z,V);h.push(...dn(Je,K.e,K.u,Oe,16),Un(K,kr-Yr+3,0,0));for(const O of[-1,1])h.push(Pe(Pe(Je,K.e,O*(Xe+Ge/2)),[0,0,1],6))}Ct(i,h,200,166);const v=Mt(i),y=Bt(i),p=Z=>v(Z[0],Z[1],Z[2]),g=v(0,0,0),N=v(1,0,0),I=v(0,1,0),L=v(0,0,1),H=[N[0]-g[0],I[0]-g[0],L[0]-g[0]],W=[N[1]-g[1],I[1]-g[1],L[1]-g[1]],P=[H[1]*W[2]-H[2]*W[1],H[2]*W[0]-H[0]*W[2],H[0]*W[1]-H[1]*W[0]],j=Math.hypot(...P)*Math.sign(P[2]),F=P.map(Z=>Z/j),X=_("g",{},e),[z,D]=mt(-30,-30,30,30,9,2);Q(q(X),it(v,y,z,D,0,5));for(let Z=0;Z<36;Z++){const V=Z/36*2*Math.PI,K=Z%9===0?26.5:25.5;Qt(en(X,i,Z%9===0?.75:.5,"dot off"),v(K*Math.cos(V),K*Math.sin(V),5))}Q(q(X),it(v,y,ht(20,48),ht(18.8,48),5,io));const k=en(X,i,.8,"dot m"),b=q(X),T=Xe+Ge/2+1,[n,a]=mt(-9,-T,9,T,4,1.4),l=_("g",{},X),d=[-1,1].map(Z=>{const V=_("g",{},X);return{s:Z,g:V,near:null,ring:_("path",{class:"nf"},V),arm:q(V),trun:_("path",{class:"sil"},V),foot:rt(-8,Z*Xe-Ge/2,8,Z*Xe+Ge/2,2.5,4),top:rt(-5.5,Z*Xe-Ge/2,5.5,Z*Xe+Ge/2,2.5,4),inner:rt(-4.5,Z*Xe-Ge/2+1,4.5,Z*Xe+Ge/2-1,1.5,4)}}),f=_("path",{class:"sil"},l),x=_("path",{class:"nf lo"},l),M=_("path",{class:"nf lo"},l),S=_("path",{class:"nf hi"},l),A=_("path",{class:"nf"},l),m=q(l),C=[0,.35,.6,.78,.9,.97,1];function w(Z,V,K){const O=V*V/(4*kr)-Yr,et=-O/O0(Z.a,F),nt=[],ct=[];for(let It=0;It<K;It++){nt.push(Un(Z,O,V,2*Math.PI*It/K));const Xt=Pe(nt[It],F,et);ct.push(Oe-Math.hypot(Xt[0]-Je[0],Xt[1]-Je[1],Xt[2]-Je[2]))}if(ct.every(It=>It>0))return tt(nt.map(p));const _t=ct.findIndex((It,Xt)=>It>0&&ct[(Xt+K-1)%K]<=0);if(_t<0)return"";const ot=(It,Xt)=>p(Pe(nt[It],[nt[Xt][0]-nt[It][0],nt[Xt][1]-nt[It][1],nt[Xt][2]-nt[It][2]],ct[It]/(ct[It]-ct[Xt]))),zt=[ot((_t+K-1)%K,_t)];let Lt=_t;for(;ct[Lt]>0;)zt.push(p(nt[Lt])),Lt=(Lt+1)%K;return zt.push(ot((Lt+K-1)%K,Lt)),jt(zt)}let E="";function $(Z,V){const K=Z.toFixed(3)+","+V.toFixed(3);if(K===E)return;E=K;const O=$0(Z,V);Qt(k,v(18*O.h[0],18*O.h[1],io)),Q(b,it(v,y,Kr(n,O),Kr(a,O),io,D0));for(const ot of d){const zt=ot.s*O0(O.e,F)>0;zt!==ot.near&&(ot.near=zt,zt?(ot.g.append(ot.trun,ot.arm.g,ot.ring),l.after(ot.g)):(ot.g.append(ot.ring,ot.arm.g,ot.trun),l.before(ot.g))),Q(ot.arm,{sil:tt(Pt(pt(v,Kr(ot.foot,O),D0).concat(pt(v,Kr(ot.top,O),Pa+6)))),crease:jt(pt(v,Kt(Kr(ot.inner,O),y),Pa+6))});const Lt=[0,0,1],It=Pe(Je,O.e,ot.s*(Xe+Ge/2));ot.ring.setAttribute("d",tt(dn(It,O.h,Lt,3.4,24).map(p))),ot.trun.setAttribute("d",tt(Pt(dn(Pe(Je,O.e,ot.s*Oe),O.h,Lt,2.2,16).concat(dn(Pe(Je,O.e,ot.s*(Xe-Ge/2)),O.h,Lt,2.2,16)).map(p))))}const et=dn(Je,O.e,O.u,Oe,72),nt=[];for(const ot of C)for(let zt=0;zt<40;zt++)nt.push(Un(O,ot*ot*Oe*Oe/(4*kr)-Yr-Yl,ot*Oe,2*Math.PI*zt/40));f.setAttribute("d",tt(Pt(et.concat(nt).map(p)))),x.setAttribute("d",w(O,.62*Oe,48)),M.setAttribute("d",w(O,3.2,20)),S.setAttribute("d",tt(et.map(p)));const ct=Un(O,kr-Yr-3,0,0),_t=Un(O,kr-Yr+3,0,0);A.setAttribute("d",[90,210,330].map(ot=>ft(p(Un(O,0,Oe,vt(ot))),p(ct))).join("")),Q(m,{sil:tt(Pt(dn(ct,O.e,O.u,3.6,16).concat(dn(_t,O.e,O.u,2.4,16)).map(p))),crease:tt(dn(_t,O.e,O.u,1.3,16).map(p))})}const G=yt(Zr[0],{eps:.01}),J=yt(Zr[1],{eps:.01}),B=kt(t,Z=>{const V=wt(G,Z),K=wt(J,Z);return $(G.x,J.x),V||K});o.add(B.unregister);const R=v(0,0,Pa);function Y(){r?(G.t=Zl-c*Math.tanh((r[0]-R[0])/120),J.t=Kl+c/2*Math.tanh((R[1]-r[1])/90),s.textContent=`az ${Math.round((G.t+360)%360)} · el ${Math.round(J.t)}`):(G.t=Zr[0],J.t=Zr[1],s.textContent="rest"),B.wake()}return o.add(Et(t,{move:Z=>{r=Z,Y()},leave:()=>{r=null,Y()}})),o.add(()=>e.replaceChildren()),{set:Z=>{c=Z,r&&Y()},destroy:o.dispose}},Ss=3,ye=54,ce=60,e0=5,$e=3,Ns=26,qs=1.6,ta=2.4,Vn=1.3,F0=3.2,W0=2.2,X0=3.6,Vl=2.6,Jl=2.1,Cs=e0+$e,Ur=Cs+Ss*Ns+$e,lo=.7,Ql=t=>.375*t.nu+.307*t.nv>0;function ql(t,e,s,u,o){const c=(r,i)=>r.map(h=>t(h.u,i,h.v));return{sil:tt(Pt(c(e,u).concat(c(e,o)))),crease:jt(c(Kt(s,Ql),o))}}var t1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=zr.drawer[2],r=At(45,.5,Jl),i=ce+c+ta,h=[[0,0,0],[ye,0,0],[0,0,Ur],[ye,0,Ur],[ye,ce,0],[0,i,Cs],[0,i,Ur-$e],[ye,i,Cs]];Ct(r,h.concat(h.map(([A,m,C])=>[ye-A,ce-m,Ur-C])),200,166);const v=Mt(r),y=Bt(r),p=_("g",{},e),[g,N]=mt(3,3,ye-3,ce-3,2.4,1);Q(q(p),it(v,y,g,N,0,e0));const[I,L]=mt(0,0,ye,ce,3,1.4);Q(q(p),it(v,y,I,L,e0,Ur));const H=$e+F0,W=ye-$e-F0,P=[H+(W-H)/3,H+2*(W-H)/3],j=(A,m)=>tt(A.map(C=>v(C.u,m,C.v)));_("path",{class:"nf lo",d:Array.from({length:Ss},(A,m)=>{const C=Cs+m*Ns+qs/2;return j(rt(H-.8,C+W0-.8,W+.8,C+Ns-qs-X0+1.4,.8,2),ce)}).join("")},p);const F=Array.from({length:Ss},(A,m)=>{const C=Cs+m*Ns+qs/2,w=C+Ns-qs,E=_("g",{},p),$=[0,1,2,3].map(()=>_("path",{class:"lo"},E));return $.push(_("path",{class:"nf sil"},E)),{z0:C,z1:w,parts:$,front:q(E),pull:q(E),drawn:NaN}}),X=A=>rt($e,A.z0,ye-$e,A.z1,1.6,4),z=A=>rt($e+1,A.z0+1,ye-$e-1,A.z1-1,1,4),D=(A,m,C,w,E,$,G)=>w-C<.05?"":it(v,y,rt(A,C,m,w,G,3),null,E,$).sil;function k(A,m){if(m===A.drawn)return;A.drawn=m;const C=A.z0+W0,w=A.z1-X0,E=ce+m,$=E+ta,[G,J,B,R,Y]=A.parts;G.setAttribute("d",D(H,W,ce,E,C,C+Vn,.6)),J.setAttribute("d",D(H,H+Vn,ce,E,C+Vn,w,.5)),B.setAttribute("d",P.map(et=>D(et-.5,et+.5,ce,E,C+Vn,w-Vl,.4)).join("")),R.setAttribute("d",D(W-Vn,W,ce,E,C+Vn,w,.5)),Y.setAttribute("d",D(H,W,ce,E,C,w,.8)),Q(A.front,ql(v,X(A),z(A),E,$));const Z=(A.z0+A.z1)/2,V=ye/2,[K,O]=mt(V-9,$,V+9,$+2.6,1.3,.6);Q(A.pull,it(v,y,K,O,Z-1.3,Z+1.3))}const b=F.map(()=>Ft(0)),T=kt(t,(A,m)=>{let C=!1;return F.forEach((w,E)=>{k(w,Wt(b[E],m)),Jt(b[E],m)||(C=!0)}),C});o.add(T.unregister);let n=u,a=-2;function l(A,m){if(A===a)return;a=A;const C=A<0?1:A;b.forEach((w,E)=>oe(w,E===C?A<0?n*lo:n:0,m,0)),F.forEach((w,E)=>w.front.sil.classList.toggle("hi",E===C)),s.textContent=A<0?"rest":`drawer ${Ss-A} · 0`,T.wake()}b[1]=Ft(n*lo),l(-1,-1e9),F.forEach((A,m)=>k(A,Wt(b[m],0)));const d=Math.cos(r.az),f=Math.sin(r.az),x=Math.sqrt(1-r.k*r.k),M=(A,m)=>{const C=(A[0]-r.ox)/(r.S*d)+m*f/d;return[C,((C*f+m*d)*r.k-(A[1]-r.oy)/r.S)/x]};function S(A){for(let C=Ss-1;C>=0;C--){const[w,E]=M(A,ce+ta+(C===1?n*lo:0)),$=F[C];if(w>=$e&&w<=ye-$e&&E>=$.z0&&E<=$.z1)return C}const m=M(A,ce+ta)[1];return F.reduce((C,w,E)=>Math.abs(m-(w.z0+w.z1)/2)<Math.abs(m-(F[C].z0+F[C].z1)/2)?E:C,0)}return o.add(Et(t,{move:A=>l(S(A),performance.now()),leave:()=>l(-1,performance.now())})),o.add(()=>e.replaceChildren()),{set:A=>{n=A;const m=a;a=-2,l(m,performance.now())},destroy:o.dispose}},G0=32,Zt=34,$n=36,_n=25,Cn=2.5,uo=4,je=3*$n+_n+7,Ie=[5,7,28,27],Re=16.5,Fn=[-8,11,-2,23],Y0=17,Vr=2,e1=ge([[-16,-2],[33,-2],[33,-56],[76,-56],[76,38],[-16,38]],[3,2,4,6,6,6]),n1=ge([[33,-56],[72,-56],[72,-6],[43,-6],[43,34],[33,34]],[4,4,4,3,3,3]),Wn=(Fn[0]+Fn[2])/2,En=(Re-Wn)/2,Ye=[Wn+En,Zt/2,je+3+En+2],Z0=1.5*$n-4,r1=["ground","floor 1","floor 2","floor 3"],s1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.3);Ct(c,[[-16,-56,-8],[76,38,-8],[76,-56,-8],[-16,38,-8],[Ye[0],Ye[1],Ye[2]+En]],200,166);const r=Mt(c),i=Bt(c),h=_("g",{},e),v=(w,E,$,G,J)=>{const[B,R]=mt(...w,E,$);Q(q(h),it(r,i,B,R,G,J))},y=w=>_("path",{class:w},h),p=(w,E,$)=>{const G=w.length,J=w.map((K,O)=>{const et=w[(O+1)%G];return et[1]-K[1]-(et[0]-K[0])>0}),B=K=>{const O=J.findIndex((nt,ct)=>nt===K&&J[(ct+G-1)%G]!==K),et=[];for(let nt=O;J[nt%G]===K;nt++)et.push(w[nt%G]);return et.concat([w[(O+et.length)%G]])},R=(K,O)=>K.map(et=>r(et[0],et[1],O)),Y=B(!1),Z=B(!0),V=_("path",{class:"sil",d:tt(R(Y,$).concat(R(Z,E)))},h);return _("path",{class:"nf lo",d:jt(R(Z,$))},h),V};p(e1,-8,-Cn),v([-14-Vr,-Vr,-14,Zt],1,.5,-Cn,je),v([-14,-Vr,G0,0],1,.5,-Cn,je),v([Re-1.3,3,Re+1.3,5.4],.8,.5,-Cn,je);const[g,N]=mt(...Fn,1.6,.8),I=q(h),L=y("nf lo"),H=y("nf"),[W,P]=mt(...Ie,2.4,1.1),j=q(h),F=y("nf"),X=y("nf lo"),[z,D]=mt(Re-1.7,5.4,Re+1.7,28.6,.8,.5),k=q(h),b=y("nf");v([Re-1.3,28.6,Re+1.3,31],.8,.5,-Cn,je),v([-14-Vr,-Vr,G0+1,Zt+1],4,1.4,je,je+3),v([Wn+2,4,Re-2,Zt/2-3],2,1,je+3,Ye[2]+4),_("path",{class:"nf",d:ft(r(Re,Zt/2,je+3),r(Re,Zt/2,Ye[2]))+ft(r(Wn,Zt/2,je+3),r(Wn,Zt/2,Ye[2]))},h);const T=(w,E)=>ht(E,28).map($=>r(Ye[0]+$.u,w,Ye[2]+$.v));Q(q(h),{sil:tt(Pt(T(Zt/2-1.8,En).concat(T(Zt/2+1.8,En)))),crease:tt(T(Zt/2+1.8,En-1.4))});const n=y("nf lo");_("path",{class:"nf lo",d:tt(T(Zt/2+1.8,2.6))},h);const a=[];for(let w=0;w<uo;w++){const E=w*$n,$=p(n1,E-Cn,E);if(w<uo-1)for(const J of[-53,-15])v([62,J,68,J+6],1.5,.8,E,E+$n-Cn);const G=[];for(let J=0;J<=w;J++){const B=en(h,c,.8,"dot off");Qt(B,r(37,Ie[1]-3-J*3,E)),G.push(B)}a.push({sil:$,dots:G})}const l=yt(Z0,{k:u,c:1.8*Math.sqrt(u)});let d=NaN,f=null;function x(w){const E=3*$n-w+6,$=(Ie[1]+Ie[3])/2;Q(I,it(r,i,g,N,E,E+Y0)),L.setAttribute("d",[5,9,13].map(R=>ft(r(Fn[0]+.6,Fn[3],E+R),r(Fn[2]-.6,Fn[3],E+R))).join("")),H.setAttribute("d",ft(r(Wn,Zt/2,E+Y0),r(Wn,Zt/2,je))),Q(j,it(r,i,W,P,w,w+_n)),F.setAttribute("d",tt(rt(Ie[1]+3.5,w+1.2,Ie[3]-3.5,w+_n-4,1.2,4).map(R=>r(Ie[2],R.u,R.v)))),X.setAttribute("d",ft(r(Ie[2],$,w+1.2),r(Ie[2],$,w+_n-4))),Q(k,it(r,i,z,D,w+_n,w+_n+2.4)),b.setAttribute("d",ft(r(Re,Zt/2,w+_n+2.4),r(Re,Zt/2,je)));const G=w/En,J=Zt/2+1.8,B=(R,Y)=>r(Ye[0]+Math.cos(R)*Y,J,Ye[2]+Math.sin(R)*Y);n.setAttribute("d",[0,1,2,3,4,5].map(R=>ft(B(G+R*Math.PI/3,2.6),B(G+R*Math.PI/3,En-1.4))).join(""))}const M=kt(t,w=>{const E=wt(l,w);return l.x!==d&&(d=l.x,x(l.x)),E});o.add(M.unregister);const S=r(Ie[2],Zt/2,0)[1],A=S-r(Ie[2],Zt/2,1)[1],m=w=>lt(Math.floor(((S-w[1])/A+8)/$n),0,uo-1);function C(w){w!==f&&(f=w,l.t=w<0?Z0:w*$n,j.sil.classList.toggle("hi",w<0),a.forEach((E,$)=>{E.sil.classList.toggle("hi",$===w),E.dots.forEach(G=>G.setAttribute("class",$===w?"dot m":"dot off"))}),s.textContent=w<0?"rest":r1[w],M.wake())}return C(-1),o.add(Et(t,{move:w=>C(m(w)),leave:()=>C(-1)})),o.add(()=>e.replaceChildren()),{set:w=>{l.k=w,l.c=1.8*Math.sqrt(w),M.wake()},destroy:o.dispose}},Jr=[{name:"surface",r:[0,0,132,96],rad:7,segs:[[[1.5,12],[130.5,12]]],dots:[[7,6],[13,6],[19,6]]},{name:"sidebar",r:[5,17,38,91],rad:4,segs:[[[10,25],[28,25]],[[10,33],[32,33]],[[10,41],[24,41]],[[10,49],[30,49]],[[10,83],[22,83]]]},{name:"card",r:[48,22,120,62],rad:5,segs:[[[54,30],[92,30]],[[54,38],[112,38]],[[54,46],[104,46]],[[54,54],[80,54]]]},{name:"popover",r:[80,50,126,86],rad:4,segs:[[[86,58],[118,58]],[[86,74],[116,74]],[[86,80],[108,80]]],sel:[83,62,123,70]}],ea=.18,Qr=2.4;function a1(t,e){let s=!1;for(let u=0,o=e.length-1;u<e.length;o=u++){const[c,r]=e[u],[i,h]=e[o];r>t[1]!=h>t[1]&&t[0]<(i-c)*(t[1]-r)/(h-r)+c&&(s=!s)}return s}var o1=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=-1,i=null;const h=yt(ea,{eps:.002}),v=At(45,.5,1.42);Ct(v,[[0,0,0],[132,96,0],[132,0,0],[0,96,0],[0,0,102+Qr],[132,0,102+Qr]],180,166);const y=Mt(v),p=Bt(v),g=_("g",{},e),N=Jr.map((P,j)=>{const[F,X]=mt(...P.r,P.rad,1.3),z=d0(y,F),D=j>0?_("path",{class:"nf dash"},g):null,k=q(g),b=_("path",{class:"nf"},k.g),T=P.sel?rt(...P.sel,2):null,n=P.sel?_("path",{class:"nf sil"},k.g):null,a=P.dots?P.dots.map(()=>en(k.g,v,1.6,"nf")):null;return{ring:F,inner:X,ext:z,guide:D,el:k,marks:b,selRing:T,selEl:n,dotEls:a}}),I=([P,j,F,X],z)=>[y(P,j,z),y(F,j,z),y(F,X,z),y(P,X,z)];function L(P){if(!P)return-1;for(let j=Jr.length-1;j>=0;j--)if(a1(P,I(Jr[j].r,j*c*h.t+Qr)))return j;return-1}function H(P){P!==r&&(r=P,N.forEach((j,F)=>j.el.sil.classList.toggle("hi",F===P)),W.wake())}const W=kt(t,P=>{const j=wt(h,P),F=X=>X*c*h.x;return Jr.forEach((X,z)=>{const D=N[z],k=F(z),b=k+Qr;if(Q(D.el,it(y,p,D.ring,D.inner,k,b)),D.marks.setAttribute("d",X.segs.map(([T,n])=>ft(y(T[0],T[1],b),y(n[0],n[1],b))).join("")),D.selEl&&D.selRing&&D.selEl.setAttribute("d",tt(pt(y,D.selRing,b))),D.dotEls&&X.dots&&X.dots.forEach(([T,n],a)=>Qt(D.dotEls[a],y(T,n,b))),D.guide){const T=F(z-1)+Qr;D.guide.setAttribute("d",D.ext.map(n=>ft(y(n.u,n.v,k),y(n.u,n.v,T))).join(""))}}),s.textContent=r>=0?`0${r+1} · ${Jr[r].name} · z ${F(r).toFixed(1)}`:`gap ${(c*h.x).toFixed(1)}`,j});return o.add(W.unregister),o.add(Et(t,{move:P=>{i=P,h.t=ea+(1-ea)*lt((P[0]-60)/280,0,1),H(L(P)),W.wake()},leave:()=>{i=null,h.t=ea,H(-1),W.wake()}})),o.add(()=>e.replaceChildren()),{set:P=>{c=P,i&&H(L(i)),W.wake()},destroy:o.dispose}};function We(t,e,s,u,o,c){return{sil:tt(Pt(pt(t,s,c).concat(pt(t,s,o))))+jt(pt(t,Kt(s,e),c)),crease:u?tt(pt(t,u,c)):""}}function Be(t,e,s,u=1){const o=Math.cos(t.az),c=Math.sin(t.az),r=t.k,i=s+u,h=[],v=(g,N,I,L)=>{const H=o*I+r*c*L,W=r*o*L-c*I,P=Math.hypot(H,W);h.push({u:g*o+N/r*c,v:N/r*o-g*c,nu:H/P,nv:W/P})},y=e.map(g=>{const N=g.nu*o-g.nv*c,I=(g.nu*c+g.nv*o)/r,L=Math.hypot(N,I);return[g.u*o-g.v*c,(g.u*c+g.v*o)*r,N/L,I/L]}),p=y.map(([g,N,I,L])=>[g-i*I,N-i*L,I,L]).filter(([g,N])=>y.every(([I,L,H,W])=>(g-I)*H+(N-L)*W<1e-6-i));return p.forEach(([g,N,I,L],H)=>{const[W,P,j,F]=p[(H+1)%p.length],X=Math.atan2(I*F-L*j,I*j+L*F);if(v(g+u*I,N+u*L,I,L),Math.abs(X)<.1)return;const z=g*I+N*L,D=W*j+P*F,k=I*F-L*j,b=(z*F-D*L)/k,T=(I*D-j*z)/k;for(let n=0,a=Math.ceil(Math.abs(X)/.2);n<=a;n++){const l=Math.atan2(L,I)+X*n/a,d=Math.cos(l),f=Math.sin(l);v(b+u*d,T+u*f,d,f)}}),h}var Ba=(t,e,s,u,o,c)=>[rt(t,e,s,u,o,8),rt(t+c,e+c,s-c,u-c,Math.max(.3,o-c),8)],n0=12,r0=5.5,c1=2.4,fo=8,i1=13,K0=55,l1=80,ho=14,na=-9,qr=118,ts=-8,Jn=9*n0+r0+8,Ii=[[0,56,.3,-8,-2,0],[1,40,.75,8,-1.9,0],[1,58,.3,-8,-.8,0],[2,74,1,-8,-1.9,0],[2,48,1,8,1.3,0],[1,34,.3,8,2,0],[1,66,1,-8,-2,0],[2,52,1,-8,-.8,0],[1,30,.45,8,2,0],[0,22,1,-8,1.6,0]],U0=Ii.length;function u1(t,e,s,u,o,c){const r=Math.sin(vt(u)),i=Math.cos(vt(u));return t.map(h=>({u:e+(h.u-e)*i-(h.v-s)*r+o,v:s+(h.u-e)*r+(h.v-s)*i+c,nu:h.nu*i-h.nv*r,nv:h.nu*r+h.nv*i}))}var f1=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u/ho;const r=At(45,.5,1.9);Ct(r,[[na,ts,-5],[qr,ts,-5],[na,Jn,-5],[qr,Jn,-5],[qr,Jn,9]],200,168);const i=Mt(r),h=Bt(r),v=_("g",{},e),[y,p]=Ba(na,ts,qr,Jn,8,2.2);Q(q(v),We(i,h,y,p,-5,0)),_("path",{d:`M${i(fo-4,ts+5,0).join(" ")}L${i(fo-4,Jn-5,0).join(" ")}`,class:"dash"},v);const g=Ii.map(([P,j,F,X,z,D],k)=>{const b=fo+P*i1,T=k*n0,n=q(v);return{r:k,yaw:F,dx:X,dy:z,dz:D,px:b,py:T+r0/2,drawn:NaN,ring:rt(b,T,b+j,T+r0,2.2,6),sp:yt(1,{k:100,c:14,eps:.003}),tgt:1,due:-1,el:n,lit:!1,wantLit:!1,litDue:-1}});function N(P){const j=P.sp.x;if(j!==P.drawn){P.drawn=j;const F=j*c,X=P.yaw*ho*F,z=Math.max(0,j)*P.dz*c;Q(P.el,We(i,h,u1(P.ring,P.px,P.py,X,P.dx*F,P.dy*F),null,z,z+c1))}}let I=-1;const L=kt(t,(P,j)=>{let F=!1;for(const X of g)X.due>=0&&(j>=X.due?(X.sp.t=X.tgt,X.due=-1):F=!0),wt(X.sp,P)&&(F=!0),X.litDue>=0&&(j>=X.litDue?(X.litDue=-1,X.lit!==X.wantLit&&(X.lit=X.wantLit,X.el.sil.classList.toggle("hi",X.lit))):F=!0),N(X);return F});o.add(L.unregister);function H(P){if(P===I)return;const j=performance.now(),F=I,X=Le();I=P;for(const z of g){const D=z.r<=P?0:1;if(D!==z.tgt){z.tgt=D;const b=D===1;z.sp.k=b?22:100,z.sp.c=b?9.4:14,z.due=j+(X?0:b?(U0-1-z.r)*l1:(z.r-(F+1))*K0)}const k=z.r===P?1:0;z.wantLit=!!k,z.litDue=j+(k&&!X?Math.max(0,z.r-(F+1))*K0:0)}s.textContent=P<0?"rest":`ln ${P+1}`,L.wake()}const W=P=>{const[j,F]=le(r,P[0],P[1],0);return j<na||j>qr||F<ts||F>Jn?-1:lt(Math.floor(F/n0),-1,U0-1)};return o.add(Et(t,{move:P=>H(W(P)),leave:()=>H(-1)})),o.add(()=>e.replaceChildren()),g.forEach(P=>N(P)),{set:P=>{c=P/ho,g.forEach(j=>{j.drawn=NaN}),L.wake()},destroy:o.dispose}},hn=52,sn=10,ra=3,fe=18,es=8,V0=[1,.5,.2,.06,0],d1=70,J0=40,Q0={k:70,c:14},h1={k:40,c:12.4},q0={k:120,c:21,eps:.002},p1={k:36,c:11.6,eps:.002},Qn=[[2,-2],[-2,1.5],[1.5,2.5],[-2.5,-1],[2,1.5],[-1.5,2],[2.5,-1.5],[-2,-2.5]],tc=[[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1],[-1,0]],v1=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r=At(45,.5,1.76),i=3*hn/2-4,h=[[-i,-i,0],[i,-i,0],[i,i,0],[-i,i,0]];tc.forEach(([n,a],l)=>h.push([n*hn+Qn[l][0]-sn,a*hn+Qn[l][1]-sn,24*1.15+ra],[n*hn+Qn[l][0]+sn,a*hn+Qn[l][1]+sn,24*1.15+ra])),Ct(r,h,200,166);const v=Mt(r),y=Bt(r),p=_("g",{},e);let g="";for(let n=-i;n<=i+1;n+=hn/2)g+=ft(v(n,-i,0),v(n,i,0))+ft(v(-i,n,0),v(i,n,0));_("path",{d:g,class:"nf lo"},p);const N=tc.map(([n,a],l)=>{const d=n*hn+Qn[l][0],f=a*hn+Qn[l][1];return{k:l,x:d,y:f,sp:yt(0,{...Q0}),lk:yt(0,{...q0,eps:.002}),hw:Ft(0,220),drawn:NaN,due:0,tgt:0,pend:!1,on:!1}});N.slice().sort((n,a)=>Math.atan2(n.y,n.x)-Math.atan2(a.y,a.x)).forEach((n,a)=>{n.n=a}),N.forEach(n=>{const a=Math.max(Math.abs(n.x),Math.abs(n.y));n.a=fe/a,n.b=1-sn/a;const l=Pt([[-fe,-fe],[fe,-fe],[fe,fe],[-fe,fe]].flatMap(([A,m])=>[v(A,m,0),v(A,m,es)])),d=A=>{let m=0;for(let C=0;C<l.length;C++){const w=l[C],E=l[(C+1)%l.length],$=(E[0]-w[0])*(A[1]-w[1])-(E[1]-w[1])*(A[0]-w[0]);if($*m<0)return!1;$&&(m=$)}return!0};let f=n.a;for(;f<n.b-.05&&d(v(n.x*f,n.y*f,0));)f+=.005;n.a=Math.min(f+.01,n.b-.1);const x=Math.hypot(n.x,n.y)*(n.b-n.a),M=Math.max(2,Math.round(x/6));let S="";for(let A=0;A<M;A++){const m=n.a+(n.b-n.a)*(A+.15)/M,C=n.a+(n.b-n.a)*(A+.65)/M;S+=ft(v(n.x*m,n.y*m,0),v(n.x*C,n.y*C,0))}_("path",{d:S,class:"nf"},p)}),N.forEach(n=>{n.slot=_("path",{class:"nf lo"},p),n.line=_("path",{class:"nf hi"},p)});let L;const H=[...N,null].sort((n,a)=>(n?n.x+n.y:0)-(a?a.x+a.y:0));for(const n of H){if(!n){const a=rt(-fe,-fe,fe,fe,7,8),l=Be(r,a,1.3),d=Be(r,a,2.8),f=rt(-7,-7,7,7,2,8);Q(q(p),We(v,y,a,l,0,es)),_("path",{d:jt(pt(v,d.concat(d.slice(0,1)),es)),class:"nf lo"},p);const x=jt(pt(v,f.concat(f.slice(0,1)),es));L=_("path",{d:x,class:"nf hi"},p);continue}n.ring=rt(n.x-sn,n.y-sn,n.x+sn,n.y+sn,4,8),n.inner=Be(r,n.ring,1.1),n.el=q(p)}const W=Ft(1,240);let P=!0;function j(n,a){const l=Math.max(0,n.sp.x),d=lt(n.lk.x,0,1),f=Wt(n.hw,a);l!==n.drawn&&(n.drawn=l,Q(n.el,We(v,y,n.ring,n.inner,l,l+ra)),n.slot.setAttribute("d",l>.4?tt(pt(v,n.ring,0)):"")),f>.5!==n.on&&(n.on=f>.5,n.el.sil.classList.toggle("hi",n.on));const x=n.a+(n.b-n.a)*d;n.line.setAttribute("d",d>.002?ft(v(n.x*n.a,n.y*n.a,0),v(n.x*x,n.y*x,0)):"")}const F=kt(t,(n,a)=>{let l=!1;for(const f of N)f.pend&&(a>=f.due?(f.pend=!1,Object.assign(f.sp,f.tgt>f.sp.t?Q0:h1),f.sp.t=f.tgt):l=!0),wt(f.sp,n)&&(l=!0),wt(f.lk,n)&&(l=!0),Jt(f.hw,a)||(l=!0),j(f,a);const d=Wt(W,a)>.5;return d!==P&&(P=d,L.setAttribute("class",d?"nf hi":"nf lo")),Jt(W,a)||(l=!0),l});o.add(F.unregister);const X=N.map(n=>v(n.x,n.y,ra)),z=v(0,0,es);let D=-1;function k([n,a]){if(Math.hypot(n-z[0],a-z[1])<30)return-1;let l=-1,d=J0;if(X.forEach((f,x)=>{const M=Math.hypot(n-f[0],a-f[1]);M<d&&(d=M,l=x)}),l!==D&&D>=0){const f=Math.hypot(n-X[D][0],a-X[D][1]);if(f<J0&&d>.8*f)return D}return l}const b=(n,a)=>Math.min((n.n-a+8)%8,(a-n.n+8)%8);function T(n){if(n===D)return;const a=performance.now(),l=n>=0?N[n].n:N[D].n;D=n,N.forEach(d=>{const f=b(d,l),x=n<0?0:c*V0[f],M=x>d.tgt,S=Le()?0:M?f*d1:n<0?(4-f)*25:f===0?60:0;d.tgt=x,d.due=a+S,d.pend=!0;const A=d.k===n;Object.assign(d.lk,A?q0:p1),d.lk.t=A?1:0,d.hw.dur=A?220:260,oe(d.hw,A?1:0,a,A?60:0)}),W.dur=n<0?280:200,oe(W,n<0?1:0,a,n<0?180:0),s.textContent=n<0?"rest":"tile "+(n+1),F.wake()}return o.add(Et(t,{move:n=>T(k(n)),leave:()=>T(-1)})),o.add(()=>e.replaceChildren()),{set:n=>{if(c=n,D>=0){const a=N[D].n;N.forEach(l=>{l.tgt=l.sp.t=c*V0[b(l,a)],l.pend=!1}),F.wake()}},destroy:o.dispose}},Yt=14,qn=.8,ec=1.8,m1=1,g1=8,ee=6,tr=15,ns=[12.6,11.3,10.4,11,11.8],sa=t=>t.split(" ").map(e=>[1,"key "+e]),nc=[[[1,"esc"],...sa("1 2 3 4 5 6 7 8 9 0 - ="),[2,"bksp"]],[[1.5,"tab"],...sa("q w e r t y u i o p [ ]"),[1.5,"key \\"]],[[1.75,"caps"],...sa("a s d f g h j k l ; '"),[2.25,"enter"]],[[2.25,"shift l"],...sa("z x c v b n m , . /"),[2.75,"shift r"]],[[1.5,"ctrl l"],[1,"super"],[1.5,"alt l"],[7,"space"],[1.5,"alt r"],[1,"fn"],[1.5,"ctrl r"]]],x1=["key f","key j"],b1=t=>lt(1-t,0,1),y1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.42);Ct(c,[[-ee,-ee,-8],[tr*Yt+ee,5*Yt+ee,-8],[tr*Yt+ee,-ee,-8],[-ee,5*Yt+ee,-8],[0,0,ns[0]]],200,166);const r=Mt(c),i=Bt(c);let h=u,v=null,y=null;const p=_("g",{},e),[g,N]=mt(-ee,-ee,tr*Yt+ee,5*Yt+ee,9,2.2);Q(q(p),it(r,i,g,N,-8,0));const I=[];nc.forEach((k,b)=>{let T=0;for(const[n,a]of k){const l=T*Yt,d=(T+n)*Yt,f=b*Yt,x=(b+1)*Yt,M=qn+ec,S=q(p);I.push({r:b,name:a,x0:l,x1:d,y0:f,y1:x,h:ns[b],foot:rt(l+qn,f+qn,d-qn,x-qn,2.6,4),top:rt(l+M,f+M,d-M,x-M,2,4),inner:rt(l+M+.9,f+M+.9,d-M-.9,x-M-.9,1.2,4),el:S,sp:yt(ns[b],{eps:.02}),drawn:NaN,bump:x1.includes(a)?_("path",{class:"lo nf"},S.g):null}),T+=n}});const L=I.find(k=>k.name==="enter");function H(k,b,T,n){for(const a of I){const l=Math.max(a.x0-k[0],0,k[0]-a.x1),d=Math.max(a.y0-k[1],0,k[1]-a.y1),f=a===b?1:b1(Math.hypot(l,d)/(T*Yt));a.sp.t=a.h-g1*n*f}}const W=[(L.x0+L.x1)/2,(L.y0+L.y1)/2];H(W,L,1.6,.6);for(const k of I)k.sp.x=k.sp.t;function P(k){const b=k.sp.x;if(b!==k.drawn&&(k.drawn=b,Q(k.el,{sil:tt(Pt(pt(r,k.foot,m1).concat(pt(r,k.top,b)))),crease:jt(pt(r,Kt(k.inner,i),b))}),k.bump)){const T=(k.x0+k.x1)/2,n=k.y1-qn-ec-2.4;k.bump.setAttribute("d",ft(r(T-2.2,n,b),r(T+2.2,n,b)))}}function j(k){k!==y&&(y?.el.sil.classList.remove("hi"),y=k,k.el.sil.classList.add("hi"))}const F=kt(t,k=>{let b=!1;for(const T of I)wt(T.sp,k)&&(b=!0),P(T);return b});o.add(F.unregister);const X=(k,b)=>I.find(T=>T.r===k&&b>=T.x0&&b<T.x1);function z(k){for(let n=nc.length-1;n>=0;n--){const a=le(c,k[0],k[1],ns[n]);if(!(a[1]<n*Yt||a[1]>=(n+1)*Yt||a[0]<0||a[0]>=tr*Yt))return{at:a,key:X(n,a[0])}}const b=le(c,k[0],k[1],ns[2]);if(b[0]<-ee||b[0]>tr*Yt+ee||b[1]<-ee||b[1]>5*Yt+ee)return null;const T=[lt(b[0],0,tr*Yt-.01),lt(b[1],0,5*Yt-.01)];return{at:T,key:X(Math.floor(T[1]/Yt),T[0])}}function D(){v?(H(v.at,v.key,h,1),j(v.key),s.textContent=v.key.name):(H(W,L,1.6,.6),j(L),s.textContent="rest"),F.wake()}return j(L),o.add(Et(t,{move:k=>{v=z(k),D()},leave:()=>{v=null,D()}})),o.add(()=>e.replaceChildren()),{set:k=>{h=k,v&&D()},destroy:o.dispose}},ne=150,_e=106,s0=4,wn=2.4,_i=s0+wn/2,rc=7,sc=1.1,po=15,aa=100,er=4.2,oa=7.5,Ot=8.6,a0=6,ac=t=>{const e=Math.cos(vt(t)),s=Math.sin(vt(t));return(u,o,c)=>[u,o*e-c*s,_i+o*s+c*e]};function M1(){const t=[],e=(ne-14.5*Ot)/2,s=(i,h,v)=>{let y=e;for(const p of v)t.push([y,i,y+p*Ot,i+h]),y+=p*Ot},u=i=>Array(i).fill(1);s(a0,Ot*.6,Array(14).fill(14.5/14));let o=a0+Ot*.6;for(const i of[[...u(13),1.5],[1.5,...u(13)],[1.75,...u(11),1.75],[2.25,...u(10),2.25]])s(o,Ot,i),o+=Ot;s(o,Ot,[1,1,1,1.25,5,1.25,1]);const c=e+11.5*Ot,r=Ot/2;return t.push([c,o+r,c+Ot,o+Ot],[c+Ot,o,c+2*Ot,o+r],[c+Ot,o+r,c+2*Ot,o+Ot],[c+2*Ot,o+r,c+3*Ot,o+Ot]),{out:t,y1:o+Ot,x0:e}}var w1=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=null;const i=At(45,.5,1.3),h=[[0,0,0],[ne,0,0],[0,_e,0],[ne,_e,0]];for(const O of[po,90,aa,125])for(const et of[0,ne])for(const nt of[0,_e])for(const ct of[-wn/2,wn/2])h.push(ac(O)(et,nt,ct));Ct(i,h,200,166);const v=Mt(i),y=Bt(i),p=v(0,0,0),g=v(1,0,0),N=v(0,1,0),I=v(0,0,1),L=[g[0]-p[0],N[0]-p[0],I[0]-p[0]],H=[g[1]-p[1],N[1]-p[1],I[1]-p[1]];let W=[L[1]*H[2]-L[2]*H[1],L[2]*H[0]-L[0]*H[2],L[0]*H[1]-L[1]*H[0]];W[2]<0&&(W=W.map(O=>-O));const P=(O,et)=>O[0]*et[0]+O[1]*et[1]+O[2]*et[2],j=_("g",{},e),[F,X]=mt(0,0,ne,_e,rc,sc);Q(q(j),it(v,y,F,X,0,s0));const z=O=>tt(O.map(et=>v(et.u,et.v,s0))),D=M1();_("path",{class:"nf lo",d:D.out.map(([O,et,nt,ct])=>z(rt(O+.5,et+.5,nt-.5,ct-.5,1.1,2))).join("")},j),_("path",{class:"nf",d:z(rt(D.x0-1.6,a0-1.6,ne-D.x0+1.6,D.y1+1.6,3,4))},j),_("path",{class:"nf",d:z(rt(ne/2-35,_e-45,ne/2+35,_e-5,3.2,4))},j);const k=_("g",{},j),b=q(k),T=_("g",{},k);b.sil.classList.add("hi");const[n,a]=mt(0,0,ne,_e,rc,sc),l=_("path",{class:"nf"},T),d=_("path",{class:"nf lo"},T),f=_("path",{class:"nf lo"},T),x=_("path",{},T),M=_("path",{class:"nf lo"},T),S=_("circle",{r:.8,class:"dot off"},T),A=[0,1,2].map(()=>_("circle",{r:.8,class:"dot off"},T)),m=_e-er,C=30,w=104,E=oa+16,$=m-12;let G=null,J=NaN;function B(O){if(O===J)return;J=O;const et=ac(O),nt=Math.cos(vt(O)),ct=Math.sin(vt(O)),_t=(dt,gt,Rt)=>v(...et(dt,gt,Rt)),ot=(dt,gt)=>_t(dt,gt,-wn/2),zt=(dt,gt)=>dt.map(Rt=>_t(Rt.u,Rt.v,gt)),Lt=P([0,ct,-nt],W)>0,It=Lt?-wn/2:wn/2,Xt=dt=>P([dt.nu,dt.nv*nt,dt.nv*ct],W)>0;Q(b,{sil:tt(Pt(zt(n,-wn/2).concat(zt(n,wn/2)))),crease:jt(zt(Kt(a,Xt),It))}),Lt!==G&&(G=Lt,Lt?b.g.after(T):b.g.before(T));const at=dt=>tt(dt.map(gt=>ot(gt.u,gt.v)));l.setAttribute("d",at(rt(er,oa,ne-er,m,3,4))),d.setAttribute("d",ft(ot(er+1.5,m-4),ot(ne-er-1.5,m-4))),f.setAttribute("d",at(rt(ne/2-28,oa+2.5,ne/2+28,oa+8.5,2.2,4))),x.setAttribute("d",at(rt(C,E,w,$,2.6,4))),M.setAttribute("d",ft(ot(C,$-6),ot(w,$-6))+ft(ot(C+20,E),ot(C+20,$-6))),Qt(S,ot(ne/2,_e-er/2)),A.forEach((dt,gt)=>Qt(dt,ot(C+4+gt*3.4,$-3)))}const R=yt(aa,{eps:.05}),Y=kt(t,O=>{const et=wt(R,O);return B(R.x),et});o.add(Y.unregister),B(aa);const Z=v(ne/2,0,_i+_e)[1]+12,V=v(ne/2,_e,0)[1]-12;function K(){r===null?(R.t=Math.min(aa,c),s.textContent="rest"):(R.t=bt(c,po,lt((r-Z)/(V-Z),0,1)),s.textContent=R.t<=po+.5?"shut":R.t>=c-.5?"open":`lid ${Math.round(R.t)}°`),Y.wake()}return o.add(Et(t,{move:O=>{r=O[1],K()},leave:()=>{r=null,K()}})),o.add(()=>e.replaceChildren()),{set:O=>{c=O,K()},destroy:o.dispose}},js=6,Rs=2,Wa=24,Xa=38,Ga=1.2,Qe=3,ze=6,Ut=26,jn=1.4,oc=23,nr=js*Wa+2*Qe,rs=Rs*Xa+2*Qe,Fe=Wa-2*Ga,nn=Xa-2*Ga,vo=5,cc=22,ic=120,ca=rt(0,0,Fe,nn,1.8,4),lc=[0,1,2].map(t=>rt(4,nn-6.6-t*3.2,Fe-4,nn-5.2-t*3.2,.7,2)),k1=rt(Fe/2-4.5,nn-19,Fe/2+4.5,nn-15,1,3),A1=rt(Fe-5.6,nn/2-7,Fe-2.8,nn/2+2,1.2,3),E1=rt(2.6,2.6,Fe-2.6,nn-2.6,1.4,3),uc=t=>t.reduce((e,s,u)=>{const o=t[(u+1)%t.length];return e+s[0]*o[1]-o[0]*s[1]},0),T1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.6),r=[Math.cos(vt(ic))*Fe,Math.sin(vt(ic))*Fe];Ct(c,[[-4,-4,0],[nr+4,Ut+4,0],[nr+4,-4,0],[-4,Ut+4,0],[0,0,ze+rs],[nr,0,ze+rs],[Qe+r[0],Ut+r[1],ze+Qe],[Qe+r[0],Ut+r[1],ze+rs-Qe]],200,166);const i=Mt(c),h=Bt(c);let v=u,y=-1;function p(k,b){const T=i(0,b,0),n=i(1,b,0),a=i(0,b,1),l=[n[0]-T[0],n[1]-T[1]],d=[a[0]-T[0],a[1]-T[1]],f=l[0]*d[1]-l[1]*d[0],x=k[0]-T[0],M=k[1]-T[1];return[(x*d[1]-M*d[0])/f,(l[0]*M-l[1]*x)/f]}function g(k,b,T){const n=i(...k),a=i(...b),l=p(n,Ut),d=p(a,Ut),f=.9;let x=0,M=1;const S=[[l[0]-d[0],l[0]-(T.x0+f)],[d[0]-l[0],T.x0+Fe-f-l[0]],[l[1]-d[1],l[1]-(T.z0+f)],[d[1]-l[1],T.z0+nn-f-l[1]]];for(const[m,C]of S){if(m===0){if(C<0)return"";continue}const w=C/m;m<0?x=Math.max(x,w):M=Math.min(M,w)}if(M-x<.01)return"";const A=m=>[n[0]+(a[0]-n[0])*m,n[1]+(a[1]-n[1])*m];return ft(A(x),A(M))}const N=_("g",{},e),[I,L]=mt(-4,-4,nr+4,Ut+4,5,1.6);Q(q(N),it(i,h,I,L,0,ze));const[H,W]=mt(0,0,nr,Ut,3,1.4);Q(q(N),it(i,h,H,W,ze,ze+rs));const P=[];for(let k=0;k<js;k++)for(let b=0;b<Rs;b++){const T=Qe+k*Wa+Ga,n=ze+Qe+b*Xa+Ga,a=_("g",{},N);_("path",{d:tt(ca.map(M=>i(T+M.u,Ut,n+M.v))),class:""},a);const l={c:k,r:b,n:(Rs-1-b)*js+k+1,x0:T,z0:n,drawn:NaN,sign0:0,tw:Ft(0)},d=l.z0+nn-9.5,f=l.x0+Fe,x=[g([l.x0,Ut,l.z0],[l.x0,Ut-oc,l.z0],l),g([l.x0,Ut-1.6,d],[f,Ut-1.6,d],l),g([l.x0,Ut-1.6,d],[l.x0,Ut-oc,d],l)].join("");_("path",{d:x,class:"nf lo"},a),l.plate=_("path",{class:"lo"},a),l.face=_("path",{class:"sil"},a),l.marks=_("path",{class:"nf lo"},a),l.cup=_("path",{class:"nf"},a),P.push(l)}const j=k=>P.find(b=>b.n===k);function F(k,b){if(b===k.drawn)return;k.drawn=b;const T=Math.cos(vt(b)),n=Math.sin(vt(b)),a=S=>A=>i(k.x0+A.u*T-S*n,Ut+jn/2+A.u*n+S*T,k.z0+A.v),l=ca.map(a(jn/2)),d=ca.map(a(-jn/2)),f=uc(l)*k.sign0>0,x=f?jn/2:-jn/2;k.plate.setAttribute("d",tt(Pt(l.concat(d)))),k.face.setAttribute("d",tt(f?l:d));const M=f?[...lc,k1]:[...lc,E1];k.marks.setAttribute("d",M.map(S=>tt(S.map(a(x)))).join("")),k.cup.setAttribute("d",f?tt(A1.map(a(x))):"")}for(const k of P)k.sign0=Math.sign(uc(ca.map(b=>i(k.x0+b.u,Ut+jn,k.z0+b.v))));const X=kt(t,(k,b)=>{let T=!1;for(const n of P)F(n,Wt(n.tw,b)),Jt(n.tw,b)||(T=!0);return T});o.add(X.unregister);function z(k){const[b,T]=p(k,Ut+jn);if(b<0||b>nr||T<ze||T>ze+rs)return-1;const n=lt(Math.floor((b-Qe)/Wa),0,js-1),a=lt(Math.floor((T-ze-Qe)/Xa),0,Rs-1);return(Rs-1-a)*js+n+1}function D(k,b){if(k===y&&!b)return;y=k;const T=performance.now(),n=k>0?k:vo;for(const a of P)oe(a.tw,a.n===k?v:k<=0&&a.n===vo?cc:0,T,0),a.face.classList.toggle("hi",a.n===n),a.cup.classList.toggle("hi",a.n===n);s.textContent=k>0?"locker "+String(k).padStart(2,"0"):"rest",X.wake()}return j(vo).tw=Ft(cc),D(0,!0),o.add(Et(t,{move:k=>D(Math.max(0,z(k))),leave:()=>D(0)})),o.add(()=>e.replaceChildren()),{set:k=>{v=k,y>0&&D(y,!0)},destroy:o.dispose}},Rn=124,ss=92,mo=7,ia=13,fc=11,Ps=26,dc=12,Bs=27,go=20,S1=1.2,xo=Bs-1.4,N1=[45,165,285],hc=35,C1=1.8,rr=[Ps+9,46],j1=2.1,R1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,j1),r=go+S1,i=N1.map(m=>[Math.cos(m*Math.PI/180),Math.sin(m*Math.PI/180)]),[h,v]=le(c,...Mt(c)(0,0,0),r),y=[[0,0,-2.4],[Rn,0,-2.4],[0,ss,-2.4],[Rn,ss,-2.4]];for(const m of ht(Bs,16))y.push([rr[0]+h+m.u,rr[1]+v+m.v,r]);Ct(c,y,200,166);const p=Mt(c),g=Bt(c),N=_("g",{},e),[I,L]=mt(0,0,Rn,ss,6,1.4);Q(q(N),it(p,g,I,L,-2.4,0));const H=m=>ia+m*fc,W=[[[Ps,ia-7],[Ps,H(mo-1)+7]],...Array.from({length:mo},(m,C)=>[[Ps,H(C)],[Rn-dc,H(C)]])];_("path",{class:"nf lo",d:W.map(([m,C])=>ft(p(m[0],m[1],0),p(C[0],C[1],0))).join("")},N);const P=_("path",{class:"nf"},N),j=q(N),F=_("path",{class:"nf lo"},N),X=_("path",{class:"nf sil"},N),z=ht(xo*.72,64).slice(26,36),D=ht(Bs,64),k=ht(xo,64),b=rt(0,0,Rn,ss,6,12),T=ht(C1,12),n=(m,C)=>m>=0&&m<=Rn&&C>=0&&C<=ss?0:-2.4,a=yt(rr[0]),l=yt(rr[1]),d=yt(u);let f=NaN,x=NaN,M=NaN;function S(){if(a.x===f&&l.x===x&&d.x===M)return;const m=a.x!==f||l.x!==x;f=a.x,x=l.x,M=d.x;const C=f+h,w=x+v;if(m){const J=(B,R)=>p(C+B.u,w+B.v,R);P.setAttribute("d",i.map(([B,R])=>{const Y=C+B*hc,Z=w+R*hc,V=n(Y,Z);return ft(p(Y,Z,V),p(C+B*(Bs-1),w+R*(Bs-1),go))+tt(T.map(K=>p(Y+K.u,Z+K.v,V)))}).join("")),Q(j,{sil:tt(Pt(D.map(B=>J(B,go)).concat(D.map(B=>J(B,r))))),crease:tt(k.map(B=>J(B,r)))}),F.setAttribute("d",jt(z.map(B=>J(B,r))))}const E=xo-1,$=(J,B)=>{const R=(J[0]-f)*M,Y=(J[1]-x)*M,Z=(B[0]-J[0])*M,V=(B[1]-J[1])*M,K=Z*Z+V*V,O=R*Z+Y*V,et=O*O-K*(R*R+Y*Y-E*E);if(et<=0)return"";const nt=Math.max(0,(-O-Math.sqrt(et))/K),ct=Math.min(1,(-O+Math.sqrt(et))/K);return ct>nt?ft(p(C+R+Z*nt,w+Y+V*nt,r),p(C+R+Z*ct,w+Y+V*ct,r)):""};let G=b.map((J,B)=>$([J.u,J.v],[b[(B+1)%b.length].u,b[(B+1)%b.length].v])).join("");for(const[J,B]of W)G+=$(J,B);X.setAttribute("d",G)}const A=kt(t,m=>{const C=wt(a,m),w=wt(l,m),E=wt(d,m);return S(),C||w||E});return o.add(A.unregister),j.sil.classList.add("hi"),s.textContent="rest",S(),o.add(Et(t,{move:m=>{const[C,w]=le(c,m[0],m[1],0);a.t=lt(C,Ps,Rn-dc),l.t=lt(w,ia,H(mo-1)),s.textContent=`row ${Math.round((l.t-ia)/fc)+1} · 0`,A.wake()},leave:()=>{a.t=rr[0],l.t=rr[1],s.textContent="rest",A.wake()}})),o.add(()=>e.replaceChildren()),{set:m=>{d.t=m,A.wake()},destroy:o.dispose}},pn=56,zn=20,Me=44,we=1.6,bo=4.2,la=30,yo=13,pc=zn/2,P1=13,vc=7,mc=11,as=.42,B1=26,L1=56,gc=200,xc=2.75,I1=100,_1=Math.SQRT1_2*Math.sqrt(3),bc=t=>t*t*(3-2*t);function z1(t){return t.map((e,s)=>{const u=t[(s+t.length-1)%t.length],o=t[(s+1)%t.length],c=o[0]-u[0],r=o[1]-u[1],i=Math.hypot(c,r)||1;return{u:e[0],v:e[1],nu:r/i,nv:-c/i}})}function H1(t,e,s,u){const o=e[0]-t[0],c=e[1]-t[1],r=u[0]-s[0],i=u[1]-s[1],h=s[0]-t[0],v=s[1]-t[1],y=o*i-c*r;if(!y)return null;const p=(h*i-v*r)/y,g=(h*c-v*o)/y;return p>0&&p<1&&g>0&&g<1?[t[0]+p*o,t[1]+p*c]:null}function yc(t){for(let e=0;e<t.length-3;e++)for(let s=t.length-2;s>e+1;s--){const u=H1(t[e],t[e+1],t[s],t[s+1]);if(u){t.splice(e+1,s-e,u);break}}return t}function D1(t,e){const s=t.length,u=[],o=[];for(let r=0;r<s;r++){const i=t[Math.max(r-1,0)],h=t[r],v=t[Math.min(r+1,s-1)],y=[h[0]-i[0],h[1]-i[1]],p=[v[0]-h[0],v[1]-h[1]],g=Math.hypot(y[0],y[1])||1,N=Math.hypot(p[0],p[1])||1;let I=y[0]/g+p[0]/N,L=y[1]/g+p[1]/N;const H=Math.hypot(I,L)||1;I/=H,L/=H,u.push([h[0]-L*e,h[1]+I*e]),o.push([h[0]+L*e,h[1]-I*e])}const c=r=>{const i=[];for(let h=7;h>=1;h--){const v=Math.PI*h/8;i.push([r[0]+e*Math.cos(v),r[1]+e*.5*Math.sin(v)])}return i};return tt([...yc(u),...c(t[s-1]),...yc(o).reverse(),...c(t[0])])}var O1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=yt(u);let r=!1;const i=(S,A,m)=>{const C=[Math.cos(vt(m)),-Math.sin(vt(m))],w=Me+P1+A,E=la/2,$=(J,B)=>S(yo+C[0]*J,pc+C[1]*J,B),G=[$(la,Math.max(Me-vc+A,Me)),$(la,w)];for(let J=1;J<28;J++){const B=Math.PI*J/28;G.push($(E+E*Math.cos(B),w+E*Math.sin(B)))}return G.push($(0,w),$(0,Me)),G},h=At(45,.5,xc),v=(S,A,m)=>[S,A,m],y=[[0,0,0],[pn,0,0],[0,zn,0],[pn,zn,0],[0,0,Me]];for(const S of[0,40,80,I1])for(const A of i(v,mc,S))y.push([A[0],A[1],A[2]+bo]);Ct(h,y,200,170);const p=Mt(h),g=bo*xc,N=ge([[0,0],[pn,0],[pn,Me],[0,Me]],[14,14,7,7],12),I=z1(ge([[we,we],[pn-we,we],[pn-we,Me-we],[we,Me-we]],[14-we,14-we,7-we,7-we],12)),L=_("g",{},e);Q(q(L),{sil:tt(Pt(N.map(S=>p(S[0],0,S[1])).concat(N.map(S=>p(S[0],zn,S[1]))))),crease:jt(Kt(I,S=>S.nu*_1+S.nv>0).map(S=>p(S.u,zn,S.v)))});const H=pn/2,W=Me*.56,P=4.4,j=1.8,F=W-12,X=Math.asin(j/P),z=[];for(let S=0;S<=20;S++){const A=-Math.PI/2+X+(2*Math.PI-2*X)*S/20;z.push([H+P*Math.cos(A),W+P*Math.sin(A)])}for(let S=0;S<=6;S++){const A=Math.PI+Math.PI*S/6;z.push([H+j*Math.cos(A),F+j*Math.sin(A)])}_("path",{d:tt(z.map(S=>p(S[0],zn,S[1]))),class:"nf"},L);const D=ht(bo+1.3,20);for(const S of[yo,yo+la])_("path",{d:tt(D.map(A=>p(S+A.u,pc+A.v,Me))),class:"nf lo"},L);const k=_("path",{class:"sil"},L),b=(S,A)=>[mc*bc(lt(S/as,0,1)),A*bc(lt((S-as)/(1-as),0,1))],T=()=>as+(1-as)*(.5-Math.sin(Math.asin(1-2*B1/c.t)/3)),n=yt(T(),{eps:.002});let a=NaN,l=NaN;function d(){if(n.x===a&&c.x===l)return;a=n.x,l=c.x;const[S,A]=b(n.x,c.x);k.setAttribute("d",D1(i(p,S,A),g))}const f=kt(t,S=>{const A=wt(n,S),m=wt(c,S);return d(),A||m});o.add(f.unregister);const x=p(pn/2,zn/2,Me/2);function M(){const[S,A]=b(n.t,c.t),m=r&&S<vc;s.textContent=r?m?"locked":A<1?"open":Math.round(A)+"°":"rest",k.classList.toggle("hi",!m),f.wake()}return M(),o.add(Et(t,{move:S=>{r=!0,n.t=lt((gc-Math.hypot(S[0]-x[0],S[1]-x[1]))/(gc-L1),0,1),M()},leave:()=>{r=!1,n.t=T(),M()}})),o.add(()=>e.replaceChildren()),{set:S=>{c.t=S,r||(n.t=T()),M()},destroy:o.dispose}},La=12,Ia=15,zi=8,Ls=15,$1=5,sr=44,Hn=Ls+$1,vn=2*Hn+La*Ia+zi,os=30,cs=12.5,Pn=5,re=4.2,ua=1.9,Mo=1.7,F1=2.4,fa=4.3,ar=3.5,W1=4,X1=5,G1=1.8,Y1=6,wo=10,is=7,ko=9,Z1=[2,10,18],da=7,Ao=2.5,K1=t=>[t*7%5-2,t*11%7-3],U1=(t,e)=>t===0?0:lt(1-(t-1)/e,0,1);function V1(t,e){const s=t.length,u=[],o=[],c=[];for(let i=0;i<s;i++){const h=t[Math.max(0,i-1)],v=t[Math.min(s-1,i+1)],y=Math.hypot(v[0]-h[0],v[1]-h[1])||1,p=[(v[0]-h[0])/y,(v[1]-h[1])/y];c.push(p),u.push([t[i][0]-p[1]*e,t[i][1]+p[0]*e]),o.push([t[i][0]+p[1]*e,t[i][1]-p[0]*e])}const r=(i,h,v)=>{const y=[];for(let p=1;p<6;p++){const g=p/6*Math.PI,N=Math.cos(g),I=Math.sin(g);y.push([i[0]+v*e*(-h[1]*N+h[0]*I),i[1]+v*e*(h[0]*N+h[1]*I)])}return y};return tt([...u,...r(t[s-1],c[s-1],1),...o.reverse(),...r(t[0],c[0],-1)])}var J1=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=1.5,r=At(45,.5,c),i=os+27+ko+is,h=cs-26-is;Ct(r,[[0,-18,sr],[vn,-18,sr],[0,0,0],[vn,0,0],[Hn,34,i],[vn-Hn,34,h],[Hn,34,h]],200,166);const v=Mt(r),y=Bt(r);let p=u,g=-1,N=null;const I=(B,R,Y,Z)=>B.map(V=>v(R+V.u,Y,Z+V.v)),L=B=>.612*B.nu+.5*B.nv>0,H=(B,R,Y,Z,V,K)=>({sil:tt(Pt(I(B,Y,V,Z).concat(I(B,Y,K,Z)))),crease:jt(I(Kt(R,L),Y,K,Z))}),W=_("g",{},e),[P,j]=mt(Ls+2,-18,vn-Ls-2,-2.6,3,1.6);Q(q(W),it(v,y,P,j,3,sr-3)),Q(q(W),H(rt(0,0,vn,sr,3,4),rt(.7,.7,vn-.7,sr-.7,2.3,4),0,0,-2.6,0));const F=B=>B.map(R=>[R.u,R.v]),X=(B,R)=>_("path",{d:tt(B.map(([Y,Z])=>v(Y,0,Z))),class:R},W);for(const B of[Ls/2+1,vn-Ls/2-1])for(const R of[8,sr-8])X(F(rt(B-3.4,R-1.5,B+3.4,R+1.5,1.5,3)),"nf");const z=[];for(let B=0;B<2*La;B++){const R=B<La?0:1,Y=B%La;z.push({p:B,r:R,c:Y,cx:Hn+(Y+.5)*Ia+(Y>=6?zi:0),cz:R?cs:os,full:!Z1.includes(B)})}for(const B of[0,6]){const R=z[B].cx-Ia/2+1,Y=z[B+5].cx+Ia/2-1;X(F(rt(R,cs-re-3,Y,os+re+Mo+2.6,2.4,4)),"lo nf")}const D=ge([[-Pn,-re],[Pn,-re],[Pn,re],[ua,re],[ua,re+Mo],[-ua,re+Mo],[-ua,re],[-Pn,re]],[1,1,1,.4,.5,.5,.4,1]);for(const B of z){const{cx:R,cz:Y}=B,Z=F1;B.jack=X(D.map(([V,K])=>[R+V,Y+K]),"nf"),_("path",{d:jt([[-Pn+Z,re],[-Pn+Z,-re+.816*Z],[Pn,-re+.816*Z]].map(([V,K])=>v(R+V,0,Y+K))),class:"lo nf"},W)}const k=_("g",{},W),b=_("g",{},W),T=rt(-fa,-ar,fa,ar,1.2,3),n=rt(-fa+.7,-ar+.7,fa-.7,ar-.7,.6,3),a=rt(-3.7,-3,3.7,3,1.6,3),l=rt(-2.4,-2.4,2.4,2.4,2.3,3),d=z.slice().sort((B,R)=>B.c-R.c||B.r-R.r);for(const B of d)B.pull=yt(0,{eps:.002}),B.lx=yt(0,{eps:.01}),B.lz=yt(0,{eps:.01}),B.full&&(B.plug=q(k),B.latch=_("path",{class:"lo nf"},B.plug.g),B.boot=q(k),B.cable=_("path",{class:"sil"},b),B.drawn="");function f(B){const R=B.pull.x,Y=B.lx.x,Z=B.lz.x,V=[R,Y,Z].map(qt=>qt.toFixed(3)).join();if(V===B.drawn)return;B.drawn=V;const{cx:K,cz:O,r:et,p:nt}=B,ct=W1+Y1*R,_t=ct+X1,ot=et?-1:1,[zt,Lt]=K1(nt);Q(B.plug,H(T,n,K,O,0,ct)),B.latch.setAttribute("d",ft(v(K,.6,O+ar),v(K,ct-.8,O+ar))),Q(B.boot,{sil:tt(Pt(I(a,K,ct,O).concat(I(l,K,_t,O)))),crease:""});const It=et?6:2,Xt=et?2:3,at=[K,_t-1.5,O],dt=et?[K+.5,_t+It+4*R,O]:[K,_t+1+2*R,O+6],gt=[K+Xt+zt+Y,_t+It+1+ko*R,O+ot*(24+Lt)+Z+ko*R],Rt=[gt[0]-.6,gt[1]-1,gt[2]-ot*12],Gt=[];for(let qt=0;qt<=16;qt++){const xt=qt/16,xe=(1-xt)**3,un=3*(1-xt)**2*xt,Hr=3*(1-xt)*xt*xt,Ki=xt**3;Gt.push(v(...[0,1,2].map(Xs=>xe*at[Xs]+un*dt[Xs]+Hr*Rt[Xs]+Ki*gt[Xs])))}B.cable.setAttribute("d",V1(Gt,G1*c))}function x(B,R,Y){const Z=z[B];for(const V of z){const K=V.c-Z.c,O=V.r-Z.r,et=Math.hypot(K,O),nt=U1(et,R)*Y;V.pull.t=V===Z?Y:0,V.lx.t=et?lt(K/et*nt*wo,-wo,wo):0,V.lz.t=et?lt(-O/et*nt*is,-is,is):0}}function M(B){if(B===N)return;const R=(Y,Z)=>(Y.full?[Y.plug.sil,Y.boot.sil,Y.cable]:[Y.jack]).forEach(V=>V.classList.toggle("hi",Z));N&&R(N,!1),N=B,R(B,!0)}x(da,1.6,.55);for(const B of z)for(const R of[B.pull,B.lx,B.lz])R.x=R.t;M(z[da]),s.textContent="rest";const S=kt(t,B=>{let R=!1;for(const Y of z){for(const Z of[Y.pull,Y.lx,Y.lz])wt(Z,B)&&(R=!0);Y.full&&f(Y)}return R});o.add(S.unregister);const A=v(0,Ao,0),m=v(1,Ao,0),C=v(0,Ao,1),w=[m[0]-A[0],m[1]-A[1]],E=[C[0]-A[0],C[1]-A[1]],$=w[0]*E[1]-w[1]*E[0];function G([B,R]){const Y=B-A[0],Z=R-A[1],V=(Y*E[1]-Z*E[0])/$,K=(w[0]*Z-w[1]*Y)/$;if(V<Hn-2||V>vn-Hn+2||K<cs-re-6||K>os+re+8)return-1;let O=-1,et=1/0;for(const nt of z){const ct=Math.abs(nt.cx-V)+(Math.abs(nt.cz-K)>(os-cs)/2?1e3:0);ct<et&&(et=ct,O=nt.p)}return O}function J(){g>=0?(x(g,p,1),M(z[g]),s.textContent="port "+String(g+1).padStart(2,"0")):(x(da,1.6,.55),M(z[da]),s.textContent="rest"),S.wake()}return o.add(Et(t,{move:B=>{const R=G(B);R!==g&&(g=R,J())},leave:()=>{g=-1,J()}})),o.add(()=>e.replaceChildren()),{set:B=>{p=B,g>=0&&J()},destroy:o.dispose}},Ht=68,ut=140,Eo=11,Q1=40,Pr=2,Br=1.6,Hi=1.8,Va=7,Os=6,p0=2.2,Ya=.9,q1=Pr+Br+Hi+Va+Os+p0+Ya,tu=["glass","board","battery","shell"],eu=[.36,.3,1.2],nu=.08,Mc=1,Di=[[4,ut-44],[Ht-4,ut-44],[Ht-4,ut-5],[36,ut-5],[36,ut-30],[4,ut-30]],cn=[9,12,Ht-9,ut-48],ru=[[10,ut-41,26,ut-34,1.4],[45,ut-40,54,ut-35,1.2],[57,ut-42,62,ut-36,1.2],[42,ut-27,56,ut-13,1.8]],wc=[[0,0],[Ht,0],[Ht,ut],[0,ut]],su=[wc,Di,[[cn[0],cn[1]],[cn[2],cn[1]],[cn[2],cn[3]],[cn[0],cn[3]]],wc],kc=[Pr,Br,Va,Os];function Ac(t){const e=[0],s=[Pr,Br+Hi,Va];for(let o=0;o<3;o++)e.push(e[o]+s[o]+t[o]);const u=(e[3]+Os+p0+Ya)/2;return e.map(o=>o-u)}function au(t,e){let s=!1;for(let u=0,o=e.length-1;u<e.length;o=u++){const[c,r]=e[u],[i,h]=e[o];r>t[1]!=h>t[1]&&t[0]<(i-c)*(t[1]-r)/(h-r)+c&&(s=!s)}return s}var ls=(t,e,s)=>t.map(u=>({...u,u:u.u+e,v:u.v+s})),ou=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=null,i=Mc,h=null;const v=At(45,.5,1.5),y=(q1+3*Q1)/2;Ct(v,[[0,0,-y],[Ht+2.2,ut,-y],[Ht+2.2,0,-y],[0,ut,-y],[0,0,y],[Ht+2.2,0,y],[0,ut,y]],200,166);const p=Mt(v),g=Bt(v),N=(at,dt)=>tt(at.map(([gt,Rt])=>p(gt,Rt,dt))),I=_("g",{},e),L=rt(0,0,Ht,ut,Eo,8),H=d0(p,L).slice(0,2),W=_("path",{class:"nf dash"},I),P=_("g",{},I),j=q(P),F=rt(1.2,1.2,Ht-1.2,ut-1.2,Eo-1.2,8),X=ge([[4,4],[Ht-4,4],[Ht-4,ut-4],[Ht/2+12,ut-4],[Ht/2+12,ut-10],[Ht/2-12,ut-10],[Ht/2-12,ut-4],[4,ut-4]],[7.5,7.5,7.5,2,3.5,3.5,2,7.5]),z=_("path",{class:"nf"},P),D=_("path",{class:"nf"},P),k=_("path",{class:"nf lo"},P),b=ls(ht(1.5,16),Ht/2+6,ut-7),T=_("g",{},I),n=ge(Di,[4,4,4,4,3,4]),a=_("path",{class:"lo"},T),l=_("path",{class:"sil"},T),d=ru.map(([at,dt,gt,Rt,Gt])=>{const[qt,xt]=mt(at,dt,gt,Rt,1.5,.7);return{ring:qt,inner:xt,h:Gt,el:q(T)}}),f=_("g",{},I),x=q(f),[M,S]=mt(...cn,6,1.6),A=ge([[41,ut-48],[52,ut-48],[52,ut-31],[41,ut-31]],[.5,.5,2,2]),m=_("path",{class:"lo"},f),C=_("path",{},f),w=q(f),[E,$]=mt(42,ut-38,51,ut-32,1.5,.7),G=_("g",{},I),J=q(G),B=rt(1.8,1.8,Ht-1.8,ut-1.8,Eo-1.8,8),R=[[ut-68,ut-58],[ut-54,ut-44]].map(([at,dt])=>{const[gt,Rt]=mt(Ht-.5,at,Ht+2.2,dt,1.2,.5);return{ring:gt,inner:Rt,el:q(G)}}),Y=q(G),Z=rt(7,ut-33,33,ut-7,7,6),V=rt(8,ut-32,32,ut-8,6,6),K=[[14.5,ut-25.5],[25.5,ut-14.5]].map(([at,dt])=>{const gt=q(G);return{ring:ls(ht(4.6,24),at,dt),inner:ls(ht(3.6,24),at,dt),eye:ls(ht(1.9,16),at,dt),el:gt,glass:_("path",{class:"nf lo"},gt.g)}}),O=_("path",{class:"nf"},G),et=ls(ht(1.7,16),25.5,ut-25.5),nt=[at=>{Q(j,it(p,g,L,F,at,at+Pr));const dt=at+Pr;z.setAttribute("d",N(X,dt)),D.setAttribute("d",tt(pt(p,b,dt))),k.setAttribute("d",ft(p(Ht/2-6,ut-7,dt),p(Ht/2+1.5,ut-7,dt)))},at=>{a.setAttribute("d",N(n,at)),l.setAttribute("d",N(n,at+Br));for(const dt of d)Q(dt.el,it(p,g,dt.ring,dt.inner,at+Br,at+Br+dt.h))},at=>{Q(x,it(p,g,M,S,at,at+Va)),m.setAttribute("d",N(A,at+.8)),C.setAttribute("d",N(A,at+1.4)),Q(w,it(p,g,E,$,at+1.4,at+2.6))},at=>{Q(J,it(p,g,L,B,at,at+Os));for(const Rt of R)Q(Rt.el,it(p,g,Rt.ring,Rt.inner,at+1.6,at+4.4));const dt=at+Os,gt=dt+p0;Q(Y,it(p,g,Z,V,dt,gt));for(const Rt of K)Q(Rt.el,it(p,g,Rt.ring,Rt.inner,gt,gt+Ya)),Rt.glass.setAttribute("d",tt(pt(p,Rt.eye,gt+Ya)));O.setAttribute("d",tt(pt(p,et,gt)))}],ct=[j.sil,l,x.sil,J.sil],_t=()=>[0,1,2].map(at=>c*(r===null?eu[at]:r)),ot=_t().map(at=>yt(at,{eps:.01})),zt=[NaN,NaN,NaN,NaN],Lt=kt(t,at=>{const dt=_t(),gt=[0,1,2].sort((xt,xe)=>Math.abs(xt+.5-i)-Math.abs(xe+.5-i));let Rt=!1;for(const xt of gt){const xe=xt+.5-i,un=xe>0?xt-1:xt+1;ot[xt].t=Math.abs(xe)<1?dt[xt]:dt[xt]+ot[un].x-dt[un],wt(ot[xt],at)&&(Rt=!0)}const Gt=Ac(ot.map(xt=>xt.x));let qt=!1;return Gt.forEach((xt,xe)=>{xt!==zt[xe]&&(zt[xe]=xt,nt[xe](xt),qt=!0)}),qt&&W.setAttribute("d",H.map(xt=>ft(p(xt.u,xt.v,Gt[3]),p(xt.u,xt.v,Gt[0]+Pr))).join("")),Rt});o.add(Lt.unregister);function It(at){const dt=Ac(_t());for(let Gt=3;Gt>=0;Gt--){const qt=su[Gt],xt=qt.map(([un,Hr])=>p(un,Hr,dt[Gt]+kc[Gt])),xe=Gt===1?xt:Pt(xt.concat(qt.map(([un,Hr])=>p(un,Hr,dt[Gt]))));if(au(at,xe))return Gt}let gt=0,Rt=1/0;return dt.forEach((Gt,qt)=>{const xt=Math.abs(p(Ht/2,ut/2,Gt+kc[qt])[1]-at[1]);xt<Rt&&(Rt=xt,gt=qt)}),gt}function Xt(at){at>=0&&(i=at);const dt=at>=0?at:Mc;ct.forEach((gt,Rt)=>gt.classList.toggle("hi",Rt===dt)),s.textContent=at>=0?tu[at]:"rest",Lt.wake()}return Xt(-1),o.add(Et(t,{move:at=>{h=at,r=bt(nu,1,lt((at[0]-60)/280,0,1)),Xt(It(at))},leave:()=>{h=null,r=null,Xt(-1)}})),o.add(()=>e.replaceChildren()),{set:at=>{c=at,h&&Xt(It(h)),Lt.wake()},destroy:o.dispose}},Dt=7,Is=10,_s=8,Ze=_s*2+Is*(Dt-1),us=5,cu=2.5,iu=4,ke=7,o0=[[0,0,0,8,0,0,0],[0,0,8,20,8,0,0],[0,28,34,34,34,28,0],[28,34,65,65,65,34,28],[65,0,0,0,0,0,65],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[64,0,0,0,0,0,0],[32,64,0,0,0,0,0],[16,32,64,0,0,0,0],[8,16,32,64,0,0,0],[4,8,16,32,64,0,0],[2,4,8,16,32,64,0],[1,2,4,8,16,32,64],[0,1,2,4,8,16,32],[0,0,1,2,4,8,16],[0,0,0,1,2,4,8],[0,0,0,0,1,2,4],[0,0,0,0,0,1,2],[0,0,0,0,0,0,1],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],lu=110,uu=1200,fu=400,du=[[0,0,1],[1,0,.45],[-1,0,.45],[0,1,.45],[0,-1,.45]],Ec=(t,e,s)=>o0[t][e]>>Dt-1-s&1,hu=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=0,i=-1,h=-1e9,v=!1,y=null;const p=At(45,.5,2.12),g=-15-iu;Ct(p,[[-ke,-ke,g],[Ze+ke,Ze+ke,g-6],[Ze+ke,-ke,g],[-ke,Ze+ke,g],[0,0,us]],200,160);const N=Mt(p),I=Bt(p),L=_("g",{},e),[H,W]=mt(-ke,-ke,Ze+ke,Ze+ke,11,1.8);Ri(e,L,N,I,H,g,12),Q(q(L),it(N,I,H,W,g,-15));const[P,j]=mt(0,0,Ze,Ze,7,1.3);_("path",{d:d0(N,P).map(k=>ft(N(k.u,k.v,0),N(k.u,k.v,-15))).join(""),class:"nf dash"},L),Q(q(L),it(N,I,P,j,0,us)),_("path",{d:tt(pt(N,rt(3.5,3.5,Ze-3.5,Ze-3.5,4.5,5),us)),class:"nf lo"},L);const F=new Float32Array(Dt*Dt),X=[];for(let k=0;k<Dt;k++)for(let b=0;b<Dt;b++){const T=en(L,p,cu,"dot");Qt(T,N(_s+b*Is,_s+k*Is,us)),X.push(T)}function z(k,b,T){const n=Math.round((k-_s)/Is),a=Math.round((b-_s)/Is);for(const[l,d,f]of du){const x=a+l,M=n+d;x<0||x>=Dt||M<0||M>=Dt||(F[x*Dt+M]=Math.max(F[x*Dt+M],T*f))}}const D=kt(t,(k,b)=>{if(Le()&&!v)for(let T=0;T<Dt*Dt;T++)F[T]=Math.max(F[T]*Math.exp(-k*1e3/c),Ec(3,Math.floor(T/Dt),T%Dt)*.8);else{const T=Math.exp(-k*1e3/c);for(let a=0;a<Dt*Dt;a++)F[a]*=T;const n=v?0:lt((b-h-uu)/fu,0,1);if(n>0){r+=k*1e3;const a=Math.floor(r/lu)%o0.length;if(a!==i){i=a;for(let l=0;l<Dt;l++)for(let d=0;d<Dt;d++)Ec(a,l,d)&&(F[l*Dt+d]=Math.max(F[l*Dt+d],n))}s.textContent=`loop · ${String(a+1).padStart(2,"0")}/${o0.length}`}else s.textContent=v?"paint":"afterglow"}for(let T=0;T<Dt*Dt;T++)X[T].setAttribute("opacity",(.14+.86*lt(F[T],0,1)).toFixed(3));return!0});return o.add(D.unregister),o.add(Et(t,{move:k=>{v=!0;const b=le(p,k[0],k[1],us);if(y){const T=Math.ceil(Math.hypot(b[0]-y[0],b[1]-y[1])/3);for(let n=1;n<=T;n++)z(bt(y[0],b[0],n/T),bt(y[1],b[1],n/T),1)}else z(b[0],b[1],1);y=b,D.wake()},leave:()=>{v=!1,y=null,h=performance.now(),r=0,i=-1,D.wake()}})),o.add(()=>e.replaceChildren()),{set:k=>{c=k},destroy:o.dispose}},Oi=7,c0=13,i0=10,Tc=5,Sc=6,Nc=11,pu=1,Xn=2*c0+(Oi-1)*i0,To=16,or=2,So=2,Tr=34,Cc=4,fs=7,vu=4,jc=2.2,No=4,mu=3.2,gu={k:40,c:11,eps:.02},xu=16.4,bu=t=>1/(1+.5*t*t),l0=5,yu=ge([[Xn-2,0],[Xn-2,Tr],[2,Tr],[2,0]],[.6,4,4,.6],l0),Mu=[l0,3*(l0+1)],wu=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=zr.plot[2],r=At(45,.5,mu);Ct(r,[[0,0,-3.6],[Xn,0,-3.6],[0,To,-3.6],[Xn,To,-3.6],[0,or,Tr],[Xn,or,Tr]],200,166);const i=Mt(r),h=Bt(r),v=_("g",{},e),[y,p]=mt(0,0,Xn,To,6,1.6);Q(q(v),it(i,h,y,p,-3.6,0));const g=b=>yu.map(([T,n])=>i(T,b,n));Q(q(v),{sil:tt(Pt(g(or).concat(g(or+So)))),crease:jt(g(or+So).slice(...Mu))});const N=(b,T)=>i(b,or+So,T),I=Array.from({length:Cc},(b,T)=>Tr*(T+1)/(Cc+1));_("path",{class:"nf lo",d:I.map(b=>ft(N(fs,b),N(Xn-7,b))).join("")},v),_("path",{class:"nf",d:ft(N(fs,0),N(fs,Tr-4))+I.map(b=>ft(N(fs-vu,b),N(fs,b))).join("")},v);const L=Array.from({length:Oi},(b,T)=>{const n=c0+T*i0;return{ring:mt(n-Tc/2,Sc,n+Tc/2,Nc,1.2,.4),el:q(v)}}),H=L.map((b,T)=>yt(T===No?jc:0,gu)),W=L.map(()=>NaN);function P(){L.forEach((b,T)=>{const n=lt(H[T].x,0,c);n!==W[T]&&(W[T]=n,Q(b.el,it(i,h,b.ring[0],b.ring[1],0,pu+n)))})}const j=kt(t,b=>{let T=!1;for(const n of H)T=wt(n,b)||T;return P(),T});o.add(j.unregister);const F=L.map((b,T)=>i(c0+T*i0,(Sc+Nc)/2,0)[0]);let X=u,z=-2;function D(b){H.forEach((T,n)=>{const a=X*bu(Math.abs(n-b))-T.x;a>0&&(T.v=Math.max(T.v,xu*a))}),j.wake()}function k(b){b!==z&&(z=b,H.forEach((T,n)=>{T.t=b<0&&n===No?jc:0}),b>=0&&D(b),L.forEach((T,n)=>T.el.sil.classList.toggle("hi",n===(b<0?No:b))),s.textContent=b<0?"rest":`bar ${b+1} · 0`,j.wake())}return k(-1),P(),o.add(Et(t,{move:b=>k(F.reduce((T,n,a)=>Math.abs(b[0]-n)<Math.abs(b[0]-F[T])?a:T,0)),leave:()=>k(-1)})),o.add(()=>e.replaceChildren()),{set:b=>{X=b,z>=0&&D(z)},destroy:o.dispose}},Ae=21,De=30,Rc=7,ds=1.4,ku=2.6,ha=8,Au=13,pa=11,zs=6.5,Eu=4.5,Pc=2,_a=11,va=7,Tu=4.6,Su=3,ma=1.8,Za=[48,8],Nu=100,Cu=.7,Bc=2.8,ju=398,Ru=t=>t*t*(3-2*t);function Lc(t){for(let e=0;e<t.length-3;e++)for(let s=t.length-2;s>e+1;s--){const u=t[e],o=t[e+1],c=t[s],r=t[s+1],i=o[0]-u[0],h=o[1]-u[1],v=r[0]-c[0],y=r[1]-c[1],p=c[0]-u[0],g=c[1]-u[1],N=i*y-h*v;if(!N)continue;const I=(p*y-g*v)/N,L=(p*h-g*i)/N;if(I>0&&I<1&&L>0&&L<1){t.splice(e+1,s-e,[u[0]+I*i,u[1]+I*h]);break}}return t}function Ic(t,e){const s=t.findIndex(r=>r[0]>e);if(s<1)return s<0?t:[];const u=t[s-1],o=t[s],c=(e-u[0])/(o[0]-u[0]);return[...t.slice(0,s),[e,u[1]+(o[1]-u[1])*c]]}function Pu(t,e,s){const u=t.length,o=[],c=[];for(let i=0;i<u;i++){const h=t[Math.max(i-1,0)],v=t[i],y=t[Math.min(i+1,u-1)];let p=y[0]-h[0],g=y[1]-h[1];const N=Math.hypot(p,g)||1;p/=N,g/=N,o.push([v[0]-g*e,v[1]+p*e]),c.push([v[0]+g*e,v[1]-p*e])}const r=i=>{const h=[];for(let v=7;v>=1;v--){const y=Math.PI*v/8;h.push([i[0]+e*Math.cos(y),i[1]+e*.5*Math.sin(y)])}return h};return jt([...Ic(Lc(c),s).reverse(),...r(t[0]),...Ic(Lc(o),s)])}function ga(t){const e=vt(bt(Nu,180,Ru(lt(t/Cu,0,1))));return{c:[bt(Za[0],_a,t),bt(Za[1],0,t),bt(zs,De,Math.sin(t*Math.PI/2))],w:[Math.cos(e),Math.sin(e),0],u:[-Math.sin(e),Math.cos(e),0]}}var Bu=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,Bc),r=Math.sqrt(1-c.k*c.k),i=[Math.sin(c.az)*r,Math.cos(c.az)*r,c.k],h=(R,Y)=>R[0]*Y[0]+R[1]*Y[1]+R[2]*Y[2],v=(R,Y,Z,V)=>[R.c[0]+Y*R.u[0]+V*R.w[0],R.c[1]+Y*R.u[1]+V*R.w[1],R.c[2]+Z],y=[];for(const R of[0,-3])for(const Y of[-Ae,Ae])for(const Z of[De-Ae,De+Ae])y.push([R,Y,Z]);for(const R of[0,1]){const Y=ga(R);for(const Z of[-pa,pa])for(const V of[-zs,zs])for(const K of[_a,-18-va])y.push(v(Y,Z,V,K))}Ct(c,y,200,166);const p=Mt(c),g=R=>p(R[0],R[1],R[2]),N=_("g",{},e),I=rt(-Ae,De-Ae,Ae,De+Ae,Rc,6),L=rt(-Ae+ds,De-Ae+ds,Ae-ds,De+Ae-ds,Rc-ds,6);Q(q(N),{sil:tt(Pt(I.map(R=>p(0,R.u,R.v)).concat(I.map(R=>p(-3,R.u,R.v))))),crease:jt(Kt(L,R=>R.nu*i[1]+R.nv*i[2]>0).map(R=>p(0,R.u,R.v)))}),_("path",{class:"nf lo",d:tt(ht(Au,48).map(R=>p(0,R.u,De+R.v)))},N),_("path",{class:"nf",d:[-ha,ha].map(R=>tt(ht(ku,16).map(Y=>p(0,R+Y.u,De+Y.v)))).join("")},N);const H=_("g",{},e),W=_("path",{class:"sil"},H),P=_("path",{class:"sil"},H),j=q(H),F=_("path",{class:"sil hi"},H),X=ht(Tu,16),z=ht(Su,16),D=(R,Y,Z,V)=>[0,30,60,90].map(K=>[R(Y*(1-Math.sin(vt(K)))),Z+V*Y*(1-Math.cos(vt(K)))]),k=R=>rt(-pa+R,-zs+R,pa-R,zs-R,Eu-R),b=R=>ht(Pc-R,12),T=k(2),n=[...D(k,2,0,-1),...D(k,2,-18,1)],a=[[b(0),0],...D(b,Pc*.8,_a,-1)],l=(R,Y,Z=0)=>tt(Pt(Y.flatMap(([V,K])=>V.map(O=>g(v(R,Z+O.u,O.v,K)))))),d=[...le(c,440,150,ma),ma],f=[Za[0]+18,Za[1]-52,ma];let x=!0,M=NaN;const S=yt(0,{eps:.002});function A(){if(S.x===M)return;M=S.x;const R=ga(S.x),Y=h(R.w,i)>0,Z=h(R.u,i);Y!==x&&(x=Y,H.append(...x?[W,P,j.g,F]:[F,j.g,W,P]));const V=x?0:-18;Q(j,{sil:l(R,n),crease:jt(Kt(T,nt=>nt.nu*Z+nt.nv*i[2]>0).map(nt=>g(v(R,nt.u,nt.v,V))))}),F.setAttribute("d",[-ha,ha].map(nt=>l(R,a,nt)).join("")),P.setAttribute("d",l(R,[[X,-18],[z,-18-va]]));const K=v(R,0,0,-18-va+2),O=v(R,0,0,-18-va-26),et=[];for(let nt=0;nt<=40;nt++){const ct=nt/40,_t=(1-ct)**3,ot=3*(1-ct)**2*ct,zt=3*(1-ct)*ct*ct,Lt=ct**3;et.push(p(_t*K[0]+ot*O[0]+zt*f[0]+Lt*d[0],_t*K[1]+ot*O[1]+zt*f[1]+Lt*d[1],_t*K[2]+ot*O[2]+zt*f[2]+Lt*d[2]))}W.setAttribute("d",Pu(et,ma*Bc,ju))}const m=kt(t,R=>{const Y=wt(S,R);return A(),Y});o.add(m.unregister);const C=g(ga(0).c),w=p(0,0,De),E=[w[0]-C[0],w[1]-C[1]],$=E[0]*E[0]+E[1]*E[1];let G=u,J=-1;function B(){S.t=J<0?0:Math.min(J,G);const R=ga(S.t),Y=v(R,0,0,_a);s.textContent=J<0?"rest":`gap ${Math.round(Math.hypot(Y[0],Y[1],Y[2]-De))} · 0 V`,m.wake()}return B(),A(),o.add(Et(t,{move:R=>{J=lt(((R[0]-C[0])*E[0]+(R[1]-C[1])*E[1])/$,0,1),B()},leave:()=>{J=-1,B()}})),o.add(()=>e.replaceChildren()),{set:R=>{G=R,B()},destroy:o.dispose}},cr=27,_c=6,Lu=1.6,Co=4.3,zc=16,Iu=66,Hc=200,Dc=-35,Oc=38,_u=29,jo=6,zu=.2,$c=4,Hu=-45,Du=36,Ou=150,xa=2.6,Fc=[-Math.SQRT1_2,-Math.SQRT1_2],$u=.4,Wc=(()=>{const t=[];for(let r=0;r<=30;r++){const i=vt(Hc+(Dc-Hc)*r/30);t.push([zc*Math.cos(i),Iu+zc*Math.sin(i)])}const e=t[t.length-1],s=vt(Dc),u=[Math.sin(s),-Math.cos(s)],o=[e[0]+u[0]*10,e[1]+u[1]*10],c=[0,Oc+10];for(let r=1;r<=20;r++){const i=r/20,h=1-i;t.push([h*h*h*e[0]+3*h*h*i*o[0]+3*h*i*i*c[0],h*h*h*e[1]+3*h*h*i*o[1]+3*h*i*i*c[1]+i*i*i*Oc])}return t.push([0,_u]),t})(),Ro=[2,28];function Fu(t,e,s){const u=t[Math.max(e-1,0)],o=t[Math.min(e+1,t.length-1)],c=Math.hypot(o[0]-u[0],o[1]-u[1])||1,r=-(o[1]-u[1])/c,i=(o[0]-u[0])/c,h=s*(r*Fc[0]+i*Fc[1]);return[t[e][0]+r*h,t[e][1]+i*h]}function Wu(t,e,s,u){const o=e[0]-t[0],c=e[1]-t[1],r=u[0]-s[0],i=u[1]-s[1],h=s[0]-t[0],v=s[1]-t[1],y=o*i-c*r;if(!y)return null;const p=(h*i-v*r)/y,g=(h*c-v*o)/y;return p>0&&p<1&&g>0&&g<1?[t[0]+p*o,t[1]+p*c]:null}function Xc(t){for(let e=0;e<t.length-3;e++)for(let s=t.length-2;s>e+1;s--){const u=Wu(t[e],t[e+1],t[s],t[s+1]);if(u){t.splice(e+1,s-e,u);break}}return t}function Xu(t,e){const s=t.length,u=[],o=[],c=[];for(let h=0;h<s;h++){const v=t[Math.max(h-1,0)],y=t[h],p=t[Math.min(h+1,s-1)],g=Math.hypot(y[0]-v[0],y[1]-v[1])||1,N=Math.hypot(p[0]-y[0],p[1]-y[1])||1;let I=(y[0]-v[0])/g+(p[0]-y[0])/N,L=(y[1]-v[1])/g+(p[1]-y[1])/N;const H=Math.hypot(I,L)||1;I/=H,L/=H,c.push([I,L]),u.push([y[0]-L*e,y[1]+I*e]),o.push([y[0]+L*e,y[1]-I*e])}const r=(h,v)=>Array.from({length:9},(y,p)=>{const g=Math.PI*(p+1)/10,N=-Math.cos(g),I=-Math.sin(g);return[h[0]+e*(-v[1]*N+v[0]*I),h[1]+e*(v[0]*N+v[1]*I)]}),i=h=>Array.from({length:7},(v,y)=>{const p=Math.PI*(7-y)/8;return[h[0]+e*Math.cos(p),h[1]+e*.5*Math.sin(p)]});return tt([...Xc(u),...i(t[s-1]),...Xc(o).reverse(),...r(t[0],c[0])])}var Gu=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=zr.query[2];let r=u,i=!1;const h=f=>{const x=vt(Hu-f),M=Math.cos(x),S=Math.sin(x);return(A,m)=>[A*M,A*S,m]},v=(f,x)=>h(x)(lt(f*zu,-$c,$c),_c+jo),y=At(45,.5,xa),p=[[-cr,0,0],[cr,0,0],[0,-cr,0],[0,cr,0]];for(const f of[-c,-c/2,0,c/2,c])for(const x of Wc){const M=h(f)(x[0],x[1]);p.push([M[0],M[1],M[2]+Co],[M[0],M[1],M[2]-Co])}Ct(y,p,200,166),y.ox+=200-Mt(y)(0,0,0)[0];const g=Mt(y),N=Bt(y),I=Co*xa,L=_("g",{},e);Q(q(L),it(g,N,ht(cr,72),ht(cr-Lu,72),0,_c));const H=q(L),W=ht(jo*xa,40),P=ht(jo*xa*.62,40).slice(23,31),j=_("path",{class:"sil"},L),F=_("path",{class:"nf lo"},L),X=()=>-Math.min(Du,.9*r),z=yt(X()),D=yt(X(),{k:36,c:7});let k=NaN,b=NaN;function T(){if(z.x!==k){k=z.x;const x=h(z.x),M=Wc.map(S=>g(...x(S[0],S[1])));j.setAttribute("d",Xu(M,I)),F.setAttribute("d",jt(M.slice(Ro[0],Ro[1]).map((S,A)=>Fu(M,Ro[0]+A,$u*I))))}const f=z.x-D.x;if(f!==b){b=f;const x=g(...v(f,D.x));Q(H,{sil:tt(W.map(M=>[x[0]+M.u,x[1]+M.v])),crease:jt(P.map(M=>[x[0]+M.u,x[1]+M.v]))})}}const n=kt(t,f=>{D.t=z.x;const x=wt(z,f),M=wt(D,f);return T(),x||M});o.add(n.unregister);const a=g(0,0,0)[0];let l=a;function d(){z.t=i?r*lt((l-a)/Ou,-1,1):X(),s.textContent=i?`turn ${Math.abs(Math.round(z.t))}° · 0`:"rest",H.sil.classList.toggle("hi",!i),j.classList.toggle("hi",i),n.wake()}return d(),o.add(Et(t,{move:f=>{i=!0,l=f[0],d()},leave:()=>{i=!1,d()}})),o.add(()=>e.replaceChildren()),{set:f=>{r=f,d()},destroy:o.dispose}},an=132,Ke=92,Ee=4.4,mn=34,hs=2,Yu=7,Gc=21,Yc=15,Po=1.8,Zu=22,ba=[4,-7,2,13,-3,6,-9],Ku=3,Uu=1.9,Zc=ge([[0,9],[25,21],[25,25],[-25,25],[-25,21]],[4,2,2,2,2],5),Vu=ge([[0,14],[15,21.5],[-15,21.5]],[2,1.2,1.2],4),Ju=[[0,9],[0,5],...Array.from({length:10},(t,e)=>{const s=vt(120-e*20);return[Math.sin(s)*3.4,-Math.cos(s)*3.4]})],Qu=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,Uu),r=[[0,-mn/2,0],[an,-mn/2,0],[0,mn/2,0],[an,mn/2,0],[0,0,Ke+6],[an,0,Ke+6],[0,-30,Ke-30],[an,30,Ke-30]];Ct(c,r,200,166);const i=Mt(c),h=Bt(c),v=_("g",{},e),y=(z,D,k,b,T,n,a)=>{const[l,d]=mt(z,D,k,b,T,.7);Q(q(v),it(i,h,l,d,n,a))};y(-Ee/2-1,-mn/2,Ee/2+1,mn/2,2.2,0,3),y(-Ee/2,-Ee/2,Ee/2,Ee/2,1.4,3,Ke+4);const p=Array.from({length:Yu},()=>q(v));y(0,-hs,an,hs,hs,Ke-hs,Ke+hs);const g=p.map(()=>_("path",{class:"nf"},v));y(an-Ee/2-1,-mn/2,an+Ee/2+1,mn/2,2.2,0,3),y(an-Ee/2,-Ee/2,an+Ee/2,Ee/2,1.4,3,Ke+4);const N=ba.map(z=>yt(z,{k:60,c:6,eps:.02})),I=ba.map(()=>NaN);function L(){N.forEach((z,D)=>{if(z.x===I[D])return;I[D]=z.x;const k=Math.cos(vt(z.x)),b=Math.sin(vt(z.x)),T=Gc+D*Yc,n=(a,l)=>i(T+l,a[0]*k+a[1]*b,Ke-(a[1]*k-a[0]*b));Q(p[D],{sil:tt(Pt(Zc.map(a=>n(a,0)).concat(Zc.map(a=>n(a,Po))))),crease:tt(Vu.map(a=>n(a,Po)))}),g[D].setAttribute("d",jt(Ju.map(a=>n(a,Po/2))))})}const H=kt(t,z=>{let D=!1;for(const k of N)D=wt(k,z)||D;return L(),D});o.add(H.unregister);const W=ba.map((z,D)=>i(Gc+D*Yc,0,Ke-17)[0]);let P=u,j=-2,F=1;function X(z){j=z,N.forEach((D,k)=>{const b=z<0?0:lt(1-Math.abs(k-z)/(P+.5),0,1);D.t=ba[k]-Zu*b*b*(k===z?F:Math.sign(k-z))}),p.forEach((D,k)=>D.sil.classList.toggle("hi",k===(z<0?Ku:z))),s.textContent=z<0?"rest":`hanger ${z+1} · 0`,H.wake()}return X(-1),L(),o.add(Et(t,{move:z=>{const D=W.reduce((k,b,T)=>Math.abs(z[0]-b)<Math.abs(z[0]-W[k])?T:k,0);F=z[0]<W[D]?1:-1,X(D)},leave:()=>X(-1)})),o.add(()=>e.replaceChildren()),{set:z=>{P=z,X(j<0?-1:j)},destroy:o.dispose}},qu=3,Kc=5,Uc=12,tf=18,ef=.7,nf=24,Vc=125,rf=90,Jc=700,sf=1350,af=420,of=70,Bo=.45,cf=400,v0=[{p:-1,l:0,d:0,s:-9},{p:0,l:1,d:60,s:-54},{p:0,l:1,d:60,s:36},{p:1,l:2,d:120,s:-72},{p:1,l:2,d:120,s:-36},{p:2,l:2,d:120,s:0},{p:2,l:2,d:120,s:36},{p:2,l:2,d:120,s:72}],ps=(t,e)=>{const s=r=>{const i=[];for(;r>=0;r=v0[r].p)i.push(r);return i},u=s(t),o=s(e),c=u.find(r=>o.includes(r));return u.indexOf(c)+o.indexOf(c)},Qc=(t,e)=>{for(let s=e;s>=0;s=v0[s].p)if(s===t)return!0;return!1},lf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=-1,i=null;const h=v0.map(n=>({...n})),v=n=>n.l?Uc:tf,y=n=>n.l?qu:Kc,p=n=>n.l?4.6:7;h.forEach((n,a)=>{n.i=a,n.x=n.d+n.s,n.y=n.d-n.s,n.h=v(n),n.tw=Ft(0),n.drawn=NaN,n.want=!n.i,n.at=void 0});const g=At(45,.5,1.5),N=[];for(const n of h)N.push([n.x-n.h,n.y-n.h,0],[n.x+n.h,n.y+n.h,0],[n.x,n.y,20+Kc]);Ct(g,N,200,166);const I=Mt(g),L=Bt(g),H=_("g",{},e),W=[];for(const n of h){if(n.p<0)continue;const a=h[n.p],l=n.x-a.x,d=n.y-a.y,f=Math.hypot(l,d),x=E=>E/Math.max(Math.abs(l),Math.abs(d))*f+2.5,M=x(a.h)/f,S=1-x(n.h)/f,A=I(a.x+l*M,a.y+d*M,0),m=I(a.x+l*S,a.y+d*S,0),C=Math.max(2,Math.round(Math.hypot(m[0]-A[0],m[1]-A[1])/9)),w={n,pt:Ft(0,af),on:!1,dashes:[]};W.push(w);for(let E=0;E<C;E++)w.dashes.push({u:(E+.35)/C,d:ft([bt(A[0],m[0],(E+.1)/C),bt(A[1],m[1],(E+.1)/C)],[bt(A[0],m[0],(E+.6)/C),bt(A[1],m[1],(E+.6)/C)]),full:ft([bt(A[0],m[0],E/C),bt(A[1],m[1],E/C)],[bt(A[0],m[0],(E+1)/C),bt(A[1],m[1],(E+1)/C)]),lit:0})}for(const n of W)for(const a of n.dashes)a.el=_("path",{d:a.d,class:"nf"},H);for(const n of h){const a=rt(n.x-n.h,n.y-n.h,n.x+n.h,n.y+n.h,p(n),8);n.ring=a,_("path",{d:tt(pt(I,a,0)),class:"nf lo"},H)}const P=h.slice().sort((n,a)=>n.x+n.y-(a.x+a.y));for(const n of P){const a=rt(n.x-n.h,n.y-n.h,n.x+n.h,n.y+n.h,p(n),8);n.ring=a,n.inner=Be(g,a,n.l?1.1:1.3),n.el=q(H),n.l||(n.rec=Be(g,a,2.8),n.recEl=_("path",{class:"nf lo"},n.el.g))}const j=(n,a)=>{Q(n.el,We(I,L,n.ring,n.inner,a,a+y(n))),n.rec&&n.recEl.setAttribute("d",tt(pt(I,n.rec,a+y(n))))},F=kt(t,(n,a)=>{let l=!1;for(const d of h){const f=Wt(d.tw,a);Jt(d.tw,a)||(l=!0),f!==d.drawn&&(d.drawn=f,j(d,f))}i!==null&&(a>=i?(i=null,T(-1)):l=!0);for(const d of h)d.at!==void 0&&(a>=d.at?(d.el.sil.classList.toggle("hi",d.want),d.at=void 0):l=!0);for(const d of W){if(!d.on)continue;const f=Jt(d.pt,a);l=!0;const x=Wt(d.pt,a);let M=0,S=1;for(let m=0;m<14;m++){const C=(M+S)/2;h0(C)<x?M=C:S=C}const A=f?9:bt(M,x,.3)*(1+Bo);for(const m of d.dashes){const C=A-m.u,w=C<0||C>=Bo?0:C<Bo*.4?2:1;w!==m.lit&&(m.lit=w,m.el.classList.toggle("sil",w>0),m.el.setAttribute("d",w===2?m.full:m.d))}f&&(d.on=!1,d.pt.from=d.pt.to=0,d.pt.t0=-1e9)}return l});o.add(F.unregister);const X=(n,a)=>n>=0&&Qc(n,a.i)?c*ef**ps(n,a.i):0,z=(n,a)=>{const l=a.map((d,f)=>{const x=a[(f+1)%a.length];return(x[0]-d[0])*(n[1]-d[1])-(x[1]-d[1])*(n[0]-d[0])});return l.every(d=>d>=0)||l.every(d=>d<=0)};function D(n){for(let d=P.length-1;d>=0;d--){const f=P[d],x=X(r,f);if(z(n,Pt(pt(I,f.ring,0).concat(pt(I,f.ring,x+y(f))))))return f.i}const[a,l]=le(g,n[0],n[1],0);return h.some(d=>Math.hypot(a-d.x,l-d.y)<d.h+nf-Uc)?r:-1}const k=n=>n<0?"rest":n===0?"root":`pkg ${h[n].l}·${h.filter(a=>a.l===h[n].l&&a.i<=n).length}`,b=(n,a,l,d)=>{if(n.tw.to===a)return;const f=a>n.tw.to;oe(n.tw,a,l,d),n.tw.dur=f?Jc:sf};function T(n){if(n===r)return;const a=performance.now(),l=r,d=h.map(x=>X(n,x));r=n;let f=0;h.forEach((x,M)=>{d[M]<x.tw.to&&l>=0&&(f=Math.max(f,ps(l,x.i)))}),h.forEach((x,M)=>b(x,d[M],a,d[M]<x.tw.to?(f-ps(l,x.i))*rf:n>=0?ps(n,x.i)*Vc:0));for(const x of W){x.pt.from=x.pt.to=0,x.pt.t0=-1e9,x.on=!1;for(const M of x.dashes)M.lit=0,M.el.classList.remove("sil"),M.el.setAttribute("d",M.d);n>=0&&Qc(n,x.n.i)&&x.n.i!==n&&(x.on=!0,oe(x.pt,1,a,ps(n,x.n.p)*Vc+20))}for(const x of h){const M=x.i===(n<0?0:n);M!==x.want&&(x.want=M,x.at=M?a+of:a)}s.textContent=k(n),F.wake()}h[0].el.sil.classList.add("hi"),s.textContent="rest";for(const n of h)j(n,0);return o.add(Et(t,{move:n=>{const a=D(n);if(a<0&&r>=0&&!Le()){i===null&&(i=performance.now()+cf,F.wake());return}i=null,T(a)},leave:()=>{i=null,T(-1)}})),o.add(()=>e.replaceChildren()),{set:n=>{c=n;const a=performance.now();for(const l of h)l.tw.to!==X(r,l)&&(oe(l.tw,X(r,l),a,0),l.tw.dur=Jc);F.wake()},destroy:o.dispose}},Lo=3,Io=7,_o=9,ir=9,de=17,uf=[{d:[-1,0],a:50,b:84,side:[-1,1]},{d:[0,-1],a:50,b:76,side:[1]},{d:[1,0],a:50,b:84,side:[-1,1]},{d:[0,1],a:50,b:76,side:[-1]}],ff=31;function df(){const t=[];return uf.forEach((e,s)=>{const u=(c,r)=>[e.d[0]*c-e.d[1]*r,e.d[1]*c+e.d[0]*r],o=t.length;t.push({c:u(e.a,0),par:-1,dep:1}),t.push({c:u(e.b,0),par:o,dep:2}),e.side.forEach((c,r)=>t.push({c:u(e.b,c*ff),par:o+1,dep:3,tag:"leaf "+(s+1)+"·"+(r+1)}))}),t}var hf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r=df(),i=r.filter(f=>f.tag),h=At(45,.5,1.9),v=[[-de,-de,0],[de,de,0],[-de,de,0],[de,-de,0]];for(const f of r)for(const[x,M]of[[-1,-1],[1,-1],[-1,1],[1,1]])v.push([f.c[0]+x*ir,f.c[1]+M*ir,Lo+_o]);Ct(h,v,200,166);const y=Mt(h),p=Bt(h),g=_("g",{},e);for(const f of r){const x=f.par<0?[0,0]:r[f.par].c,M=f.c[0]-x[0],S=f.c[1]-x[1],A=Math.hypot(M,S),m=f.par<0?de:0,C=0;f.a=y(x[0]+M/A*m,x[1]+S/A*m,0),f.b=y(f.c[0]-M/A*C,f.c[1]-S/A*C,0);let w="";const E=Math.hypot(f.b[0]-f.a[0],f.b[1]-f.a[1]),$=Math.max(2,Math.round(E/9));for(let G=0;G<$;G++)w+=ft([bt(f.a[0],f.b[0],(G+.1)/$),bt(f.a[1],f.b[1],(G+.1)/$)],[bt(f.a[0],f.b[0],(G+.6)/$),bt(f.a[1],f.b[1],(G+.6)/$)]);_("path",{d:w,class:"nf"},g)}for(const f of r)f.link=_("path",{class:"nf sil"},g),f.l=Ft(0),f.z=Ft(0),f.h=Ft(0),f.ld=NaN,f.zd=NaN,f.hd=!1;const N=q(g),I=rt(-de,-de,de,de,7,8);Q(N,We(y,p,I,Be(h,I,1.3),0,Io));const L=_("path",{d:tt(pt(y,Be(h,I,2.8),Io)),class:"nf hi"},g),H=Ft(1);let W=!0;_("path",{d:tt(pt(y,Be(h,I,3.8),Io)),class:"nf lo"},g);for(const f of r.slice().sort((x,M)=>x.c[0]+x.c[1]-M.c[0]-M.c[1]))f.ring=rt(f.c[0]-ir,f.c[1]-ir,f.c[0]+ir,f.c[1]+ir,3.6,8),f.inner=Be(h,f.ring,1),f.el=q(g);const P=kt(t,(f,x)=>{let M=!1;for(const A of r){const m=Wt(A.l,x),C=Wt(A.z,x);if(m!==A.ld&&(A.ld=m,A.link.setAttribute("d",m>.002?ft(A.a,[bt(A.a[0],A.b[0],m),bt(A.a[1],A.b[1],m)]):"")),C!==A.zd&&(A.zd=C,Q(A.el,We(y,p,A.ring,A.inner,C*_o,C*_o+Lo))),A.tag){const w=Wt(A.h,x)>.5;w!==A.hd&&(A.hd=w,A.el.sil.classList.toggle("hi",w))}(!Jt(A.l,x)||!Jt(A.z,x)||!Jt(A.h,x))&&(M=!0)}const S=Wt(H,x)>.5;return S!==W&&(W=S,L.classList.toggle("hi",S)),Jt(H,x)||(M=!0),M});o.add(P.unregister);const j=i.map(f=>y(f.c[0],f.c[1],Lo)),F=78,X=18,z=(f,[x,M])=>Math.hypot(j[f][0]-x,j[f][1]-M);function D(f){let x=-1,M=F;return j.forEach((S,A)=>{const m=z(A,f);m<M&&(M=m,x=A)}),l>=0&&x!==l&&z(l,f)<F&&z(l,f)-M<X?l:x}const k=700,b=1500,T=(f,x,M,S,A)=>{f.to!==x&&(oe(f,x,M,S),f.dur=A)},n=new Set,a=f=>f.par<0?null:r[f.par];let l=-1;function d(f){if(f===l)return;const x=performance.now(),M=new Set,S=c*1.5;for(let w=f<0?null:i[f];w;w=a(w))M.add(w);const A=[...n].filter(w=>!M.has(w)),m=A.reduce((w,E)=>Math.max(w,E.dep),0),C=A.length?(A.length-1)*S*.65+c*.5:0;for(const w of r){const E=M.has(w),$=n.has(w);E!==$&&(E?(T(w.l,1,x,C+(w.dep-1)*c,k),T(w.z,1,x,C+w.dep*c,k)):(T(w.z,0,x,(m-w.dep)*S,b),T(w.l,0,x,(m-w.dep)*S+S*.5,b)),w.tag&&(E?T(w.h,1,x,C+w.dep*c,40):T(w.h,0,x,f<0?0:Math.max(0,C+3*c-60),40)))}n.clear(),M.forEach(w=>n.add(w)),T(H,f<0?1:0,x,f<0?(A.length-1)*S*.5+120:0,40),l=f,s.textContent=f<0?"rest":i[f].tag,P.wake()}return o.add(Et(t,{move:f=>d(D(f)),leave:()=>d(-1)})),o.add(()=>e.replaceChildren()),{set:f=>{c=f},destroy:o.dispose}},tn=8,Gn=84,Vt=54,m0=13,u0=22,$s=7,pf=[6,31,56],qc=1.4,ya=-12,vf=-24,mf=20,$i=16,Lr=-5,Ir=Gn+5,Sr=-9,Fs=(tn-1)*m0+9,Ma=20,ti=6,vs=2.4;function gf(){const t=At(45,.5,1.62);return Ct(t,[[Lr,Sr,0],[Ir,Fs,-8],[Ir,Sr,0],[Lr,Fs,0],[Lr,Sr,Vt+$s],[Ir,Sr,Vt+$s+$i]],200,166),t}var xf=()=>({outer:rt(Lr,Sr,Ir,Fs,ti,6),inner:rt(Lr+vs,Sr+vs,Ir-vs,Fs-vs,ti-vs,6)}),zo=t=>t[0][0]<=t[t.length-1][0]?t:t.slice().reverse();function bf(t,e,s,u){const o=[[tt(Pt(pt(t,s,0).concat(pt(t,s,Ma)))),"sil"],[tt(pt(t,u,Ma)),"nf"],[jt(pt(t,Kt(u,p=>!e(p)),2.5)),"nf lo"]],c=zo(pt(t,Kt(u,e),Ma)),r=zo(pt(t,Kt(s,e),Ma)),i=zo(pt(t,Kt(s,e),0)),h=(Lr+Ir)/2,v=p=>p.map(g=>t(g.u,Fs,g.v)),y=[[tt([...c,r[r.length-1],...i.slice().reverse(),r[0]]),"fo"],[jt(r),"nf lo"],[jt(c),"nf"],[jt([r[0],...i,r[r.length-1]]),"nf sil"],[tt(v(rt(h-11,6.5,h+11,12.5,3,5))),"nf"],[tt(v(rt(h-9.4,8,h+9.4,11,1.5,5))),"nf lo"]];return{far:o,near:y}}function yf(t){const e=tn-t,s=pf[(tn-1-t)%3],u=ge([[0,0],[Gn,0],[Gn,Vt],[s+u0,Vt],[s+u0,Vt+$s],[s,Vt+$s],[s,Vt],[0,Vt]],[1,1,3.2,1.8,2.4,2.4,1.8,3.2]);return{n:e,t0:s,shape:u}}function Mf(t,e,s,u,o,c){const r=e*m0,i=Math.sin(vt(o)),h=Math.cos(vt(o)),v=(g,N)=>t(g,r+N*i,N*h+c),y=(g,N)=>t(g,r+N*i-qc*h,N*h+qc*i+c),p=[];for(let g=0;g<8;g++)p.push(v(s+u0/2+(g%4-1.5)*3.6,Vt+$s/2+(.5-Math.floor(g/4))*2.8));return{back:tt(u.map(g=>y(g[0],g[1]))),face:tt(u.map(g=>v(g[0],g[1]))),head:ft(v(6,Vt-11),v(Gn-6,Vt-11)),rules:[Vt-18,Vt-25,Vt-32,Vt-39].map(g=>ft(v(6,g),v(Gn-6,g))).join(""),punch:p}}function wf(){const t=gf();return{C:t,P:Mt(t),front:Bt(t),...xf()}}var kf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const{P:r,front:i,outer:h,inner:v}=wf(),y=bf(r,i,h,v),p=_("g",{},e);Ri(e,p,r,i,h,0,14);for(const[a,l]of y.far)_("path",{d:a,class:l},p);const g=[];for(let a=0;a<tn;a++){const{n:l,t0:d,shape:f}=yf(a),x=_("g",{},p),M=_("path",{class:"lo"},x),S=_("path",{class:"sil"},x),A=_("path",{class:"nf"},x),m=_("path",{class:"nf lo"},x),C=[];for(let w=0;w<8;w++)C.push(_("circle",{r:1.05,class:"dot "+(w===l-1?"m":"off")},x));g.push({n:l,t0:d,shape:f,back:M,face:S,head:A,rules:m,punch:C,a:Ft(ya),z:Ft(0)})}for(const[a,l]of y.near)_("path",{d:a,class:l},p);const N=a=>r(Gn/2,a*m0+Vt*Math.sin(vt(ya)),Vt*Math.cos(vt(ya))),I=N(0),L=N(1),H=[L[0]-I[0],L[1]-I[1]],W=r(0,0,0),P=r(1,0,0),j=[P[0]-W[0],P[1]-W[1]],F=Gn/2+6,X=H[0]*j[1]-H[1]*j[0];function z([a,l]){const d=a-I[0],f=l-I[1],x=(d*j[1]-f*j[0])/X,M=(H[0]*f-H[1]*d)/X;return Math.abs(M)>F||x<-.5||x>tn+1?-1:lt(Math.round(x),0,tn-1)}function D(a,l,d){const f=g[a],x=Mf(r,a,f.t0,f.shape,l,d);f.back.setAttribute("d",x.back),f.face.setAttribute("d",x.face),f.head.setAttribute("d",x.head),f.rules.setAttribute("d",x.rules),f.punch.forEach((M,S)=>Qt(M,x.punch[S]))}const k=kt(t,(a,l)=>{let d=!1;return g.forEach((f,x)=>{D(x,Wt(f.a,l),Wt(f.z,l)),(!Jt(f.a,l)||!Jt(f.z,l))&&(d=!0)}),d});o.add(k.unregister);let b=-1;const T=a=>a<0?"rest":String(tn-a).padStart(2,"0");function n(a){if(a===b)return;const l=performance.now(),d=a>=0?a:b;b=a,g.forEach((f,x)=>{const M=Math.abs(x-d)*c,S=a<0?ya:x<a?vf:x>a?mf:0;oe(f.a,S,l,M),oe(f.z,a===x?$i:0,l,M),f.face.classList.toggle("hi",x===a),f.head.classList.toggle("hi",x===a),f.punch[f.n-1].classList.toggle("m",x!==a)}),s.textContent=T(a),k.wake()}return o.add(Et(t,{move:a=>n(z(a)),leave:()=>n(-1)})),o.on(t,"keydown",a=>{a.key==="ArrowLeft"||a.key==="ArrowDown"?(n(b<0?tn-1:Math.min(tn-1,b+1)),a.preventDefault()):a.key==="ArrowRight"||a.key==="ArrowUp"?(n(b<0?tn-1:Math.max(0,b-1)),a.preventDefault()):a.key==="Escape"&&b>=0&&(n(-1),a.preventDefault())}),o.on(t,"blur",()=>n(-1)),o.add(()=>e.replaceChildren()),{set:a=>{c=a},destroy:o.dispose}},ms=124,lr=58,kn=14,He=3,Ho=13,f0=[18,48,78,108],Fi=11,Wi=5,ei=4.6,gs=56,ni=3.3,za=2.1,ri=.21,Af=za+1,wa=44,si=[-9,3,-4,32],ai=3,Ka=[Math.SQRT1_2,-Math.SQRT1_2],Ef=(t,e)=>lt(1-t/e,.1,1),xs=(t,e,s)=>{const u=Math.sin(vt(e)),o=Math.cos(vt(e));return[f0[t]+Ka[0]*u*s,Fi+Ka[1]*u*s,kn+Wi-1+o*s]},Tf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=null,i=null;const h=At(45,.5,1.78),v=[[0,0,0],[ms,lr,0],[ms,0,0],[0,lr,0]];f0.forEach((l,d)=>{for(const f of[-wa,0,wa])v.push(xs(d,f,gs+za))}),Ct(h,v,200,166);const y=Mt(h),p=Bt(h),g=l=>y(l[0],l[1],l[2]),N=y(0,0,0),I=y(Ka[0],Ka[1],0),L=y(0,0,1),H=Math.hypot(I[0]-N[0],I[1]-N[1]),W=N[1]-L[1],P=_("g",{},e),j=rt(0,0,ms,lr,Ho,6),F=rt(He,He,ms-He,lr-He,Ho-He,6),X=rt(He+1.6,He+1.6,ms-He-1.6,lr-He-1.6,Ho-He-1.6,6);Q(q(P),{sil:tt(Pt(pt(y,j,0).concat(pt(y,F,kn)))),crease:jt(pt(y,Kt(X,p),kn))});for(let l=0;l<6;l++){const d=kn*.56,f=lr-He*(d/kn)+.1;Qt(_("circle",{r:1.05,class:l===0?"dot m":"dot off"},P),y(34+l*9,f,d))}for(let l=0;l<3;l++)for(let d=0;d<13-l%2;d++)Qt(en(P,h,.5,"dot off"),y(26+l%2*3+d*6,29+l*5.5,kn));const z=f0.map((l,d)=>{const f=q(P),x=M=>M.map(S=>({...S,u:S.u+l,v:S.v+Fi}));return Q(f,it(y,p,x(ht(ei,16)),x(ht(ei-1.1,16)),kn,kn+Wi)),{i:d,el:q(P),sp:yt(si[d],{eps:.05}),drawn:NaN,piv:g(xs(d,0,0))}}),D=Math.abs(z[1].piv[0]-z[0].piv[0])/H,k=(l,d)=>Array.from({length:20},(f,x)=>[l[0]+d*H*Math.cos(x*Math.PI/10),l[1]+d*H*Math.sin(x*Math.PI/10)]);function b(l){const d=l.sp.x;if(d===l.drawn)return;l.drawn=d;const f=g(xs(l.i,d,0)),x=g(xs(l.i,d,gs)),M=g(xs(l.i,d,gs*ri)),S=Math.hypot(x[0]-f[0],x[1]-f[1]),A=[-(x[1]-f[1])/S,(x[0]-f[0])/S],m=bt(ni,za,ri)*H-1.1;Q(l.el,{sil:tt(Pt(k(f,ni).concat(k(x,za)))),crease:ft([M[0]+A[0]*m,M[1]+A[1]*m],[M[0]-A[0]*m,M[1]-A[1]*m])})}function T(l){l!==i&&(i?.el.sil.classList.remove("hi"),i=l,l.el.sil.classList.add("hi"))}const n=kt(t,l=>{let d=!1;for(const f of z)wt(f.sp,l)&&(d=!0),b(f);return d});o.add(n.unregister);function a(){if(!r)z.forEach((l,d)=>{l.sp.t=si[d]}),T(z[ai]),s.textContent="rest";else{const l=r,d=z.map(M=>(l[0]-M.piv[0])/H),f=Math.min(...d.map(Math.abs)),x=z[d.findIndex(M=>Math.abs(M)===f)];z.forEach((M,S)=>{const A=Math.sign(d[S])*Math.max(Math.abs(d[S])-Af,0),m=Math.max((M.piv[1]-l[1])/W,Math.sqrt(Math.max(gs*gs-A*A,0)),0),C=Math.atan2(A,m)*180/Math.PI;M.sp.t=lt(C,-wa,wa)*Ef((Math.abs(d[S])-f)/D,c)}),T(x),s.textContent=`antenna ${x.i+1} · ${Math.round(Math.abs(x.sp.t))}°`}n.wake()}return T(z[ai]),o.add(Et(t,{move:l=>{r=l,a()},leave:()=>{r=null,a()}})),o.add(()=>e.replaceChildren()),{set:l=>{c=l,r&&a()},destroy:o.dispose}},Sf=3.2,ka=9,bs=17,Do=6.5,ys=22,oi=0,ur=86,fr=[[50,0,-1,51,-19,14,0],[88,0,0,93,23,-22,0],[50,34,0,58,50,26,0],[0,50,-1,-21,59,-16,0],[0,88,3,20,84,28,0],[-34,50,3,-59,64,-20,0],[-50,0,-1,-67,-20,-12,0],[-88,0,6,-91,26,20,0],[-50,-34,6,-47,-57,-28,0],[0,-50,-1,22,-46,18,0],[0,-88,9,-15,-95,-14,0],[34,-50,9,62,-60,22,0]];function Nf(t,e,s,u,o){const c=Math.cos(vt(o)),r=Math.sin(vt(o));return rt(-s,-s,s,s,u,8).map(i=>({u:t+i.u*c-i.v*r,v:e+i.u*r+i.v*c,nu:i.nu*c-i.nv*r,nv:i.nu*r+i.nv*c}))}var Cf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=0;const i=At(45,.5,1.9),h=[[0,0,Do],[ur,0,0],[-ur,0,0],[0,ur,0],[0,-ur,0]];for(const n of fr)for(const[a,l]of[[n[0],n[1]],[n[3],n[4]]])h.push([a-11,l-11,0],[a+11,l+11,0],[a+11,l-11,0],[a-11,l+11,0]);Ct(i,h,200,166);const v=Mt(i),y=Bt(i),p=_("g",{},e);let g="";for(let n=-oi;n<=oi;n++){const a=Math.sqrt(ur*ur-(n*ys)**2);g+=ft(v(n*ys,-a,0),v(n*ys,a,0))+ft(v(-a,n*ys,0),v(a,n*ys,0))}const N=fr.map((n,a)=>{const l=n[2]<0?[0,0]:[fr[n[2]][0],fr[n[2]][1]],d=[n[0],n[1]],f=Math.hypot(d[0]-l[0],d[1]-l[1]),x=[(d[0]-l[0])/f,(d[1]-l[1])/f],M=n[2]<0?bs:ka,S=[l[0]+x[0]*(M+2),l[1]+x[1]*(M+2)],A=[d[0]-x[0]*(ka+2),d[1]-x[1]*(ka+2)];return{i:a,from:S,to:A,tw:Ft(0),p:I(a),el:_("path",{class:"nf"},p),drawn:NaN}});function I(n){return fr[n][2]}const L=_("g",{},p),H=rt(-bs,-bs,bs,bs,7,8),W=q(L);Q(W,We(v,y,H,Be(i,H,1.3),0,Do)),W.sil.classList.add("hi"),_("path",{d:tt(pt(v,Be(i,H,2.8),Do)),class:"nf lo"},L);const P=fr.map((n,a)=>({i:a,t:n,el:q(_("g",{},p)),th:[.05,.3,.4][a%3],sp:yt(0,{k:a%3===0?120:90-a%3*8,c:a%3===0?14:12,eps:.002}),key:"",ord:0,k:0,rise:{k:a%3===0?120:90-a%3*8,c:a%3===0?14:12},fall:{k:[38,44,50][a%3],c:2*Math.sqrt([38,44,50][a%3])},lag:[.3,.2,.12][a%3]*1e3,want:0,wait:0,falling:!1}));function j(n){const a=n.sp.x,[l,d,,f,x,M,S]=n.t,A=lt(a,0,1),m=6.5*A*(1-A)*4/4,C=bt(f,l,a),w=bt(x,d,a),E=bt(M,0,a),$=Math.max(0,bt(S,0,A)+m);return{x:C,y:w,a:E,z:$}}function F(n){const a=j(n),l=[a.x,a.y,a.a,a.z].map(f=>f.toFixed(2)).join();if(n.k=a.x+a.y+6*a.z,l===n.key)return;n.key=l;const d=Nf(a.x,a.y,ka,3.6,a.a);Q(n.el,We(v,y,d,Be(i,d,1),a.z,a.z+Sf))}let X="";function z(){const n=P.slice().sort((x,M)=>x.k-M.k),a=n.findIndex(x=>x.k>0),l=n.slice(),d=a<0?l.map(x=>x.el.g).concat(L):l.slice(0,a).map(x=>x.el.g).concat(L,l.slice(a).map(x=>x.el.g)),f=d.map(x=>x===L?"h":P.findIndex(M=>M.el.g===x)).join();if(f!==X){X=f;for(const x of d)p.appendChild(x)}}function D(n,a){const l=n.p<0?null:P[n.p],d=P[n.i],f=l?l.sp.x:1,x=d.sp.x,M=Math.min(f,x)>.96&&d.want>=1&&(!l||l.want>=1)?1:0;n.tw.to!==M&&(oe(n.tw,M,a,0),n.tw.dur=M?700:900);const S=Wt(n.tw,a);if(S===n.drawn)return;n.drawn=S;const A=v(n.from[0],n.from[1],0),m=v(n.to[0],n.to[1],0),C=Math.max(2,Math.round(Math.hypot(m[0]-A[0],m[1]-A[1])/9));let w="";for(let E=0;E<C;E++){const $=(E+.1)/C,G=Math.min((E+.6)/C,S);G>$&&(w+=ft([bt(A[0],m[0],$),bt(A[1],m[1],$)],[bt(A[0],m[0],G),bt(A[1],m[1],G)]))}n.el.setAttribute("d",w)}const k=kt(t,(n,a)=>{let l=!1;for(const d of P)d.wait>0&&(d.wait-=n*1e3,l=!0,d.wait<=0&&(d.sp.t=d.want)),wt(d.sp,n)&&(l=!0),F(d);for(const d of N)D(d,a),Jt(d.tw,a)||(l=!0);return z(),l});o.add(k.unregister);function b(){let n=0;for(const a of P){const l=lt((r-a.th)/.22,0,1);l>a.want?(a.falling=!1,a.wait=0,a.want=l,Object.assign(a.sp,a.rise),a.sp.t=l):l<a.want&&(a.falling||(a.falling=!0,a.wait=Le()?0:a.lag,Object.assign(a.sp,a.fall)),a.want=l,a.wait<=0&&(a.sp.t=l)),l>.5&&n++}s.textContent=r<=0?"rest":`map ${n}·${P.length}`,k.wake()}const T=n=>{const a=lt((c-n)/(c-18),0,1);return a*a*(3-2*a)};o.add(Et(t,{move:n=>{const[a,l]=le(i,n[0],n[1],0);r=T(Math.hypot(a,l)),b()},leave:()=>{r=0,b()}})),o.add(()=>e.replaceChildren());for(const n of P)F(n);return z(),s.textContent="rest",{set:n=>{c=n},destroy:o.dispose}},Ms=3,he=36,gn=11,dr=8,Aa=2.6,Ha=2,jf=1.6,Rf=[-22,-11,0,11,22],Pf=40,Bf=2.35,Xi=.8,Gi=.6,ci=(t,e,s)=>{const u=t<0?1:t;return e===u?t<0?s*Xi:s:t>=0&&e===u+1?s*Gi:Ha},Lf=({stage:t,svg:e,read:s},u)=>{const o=Tt(),[,c,r]=zr.sieve,i=At(45,.5,Bf),h=dr+Ms*gn+Ha+r*(1+Gi),v=dr+Ms*gn+2*Ha+c*Xi,y=[];for(const[m,C]of[[-he,0],[he,0],[0,-he],[0,he]])y.push([m,C,v-h],[m,C,h]);Ct(i,y,200,166);const p=Mt(i),g=p(0,0,0)[1],N=m=>p(0,0,m)[1]-g,I=ht(he,72),L=ht(he-Aa,72),H=_("g",{},e),W=(m,C)=>Pt(I.map(w=>p(w.u,w.v,m)).concat(I.map(w=>p(w.u,w.v,C))));Q(q(H),{sil:tt(W(0,dr)),crease:tt(L.map(m=>p(m.u,m.v,dr)))});const P=Array.from({length:Ms},()=>({s:q(H),mesh:_("path",{class:"nf lo"},H)})),j=(m,C,w)=>{const E=[[]];for(const[$,G]of m){const J=p($,G,C),B=le(i,J[0],J[1],w);Math.hypot($,G)<he-Aa&&Math.hypot(B[0],B[1])<he-Aa?E[E.length-1].push(J):E[E.length-1].length&&E.push([])}return E.filter($=>$.length>1)},F=(m,C)=>Array.from({length:29},(w,E)=>[m[0]+(C[0]-m[0])*E/28,m[1]+(C[1]-m[1])*E/28]),X=Rf.flatMap(m=>[F([m,-he],[m,he]),F([-he,m],[he,m])]);X.push(Array.from({length:73},(m,C)=>{const w=Math.PI/4+C/72*Math.PI*2,E=he-Aa-.05;return[E*Math.cos(w),E*Math.sin(w)]}));const z=W(0,gn),D=L.map(m=>p(m.u,m.v,gn)),k=X.flatMap(m=>j(m,jf,gn)),b=(m,C)=>m.map(w=>[w[0],w[1]+C]),T=Array.from({length:Ms},()=>Ft(Ha)),n=T.map(()=>NaN);let a=-2,l=u;function d(m){let C=dr;T.forEach((w,E)=>{if(C+=Wt(w,m),C!==n[E]){n[E]=C;const $=N(C);Q(P[E].s,{sil:tt(b(z,$)),crease:tt(b(D,$))}),P[E].mesh.setAttribute("d",k.map(G=>jt(b(G,$))).join(""))}C+=gn})}const f=kt(t,(m,C)=>(d(C),T.some(w=>!Jt(w,C))));o.add(f.unregister);function x(m,C){if(m===a)return;a=m;const w=m<0?1:m;T.forEach((E,$)=>oe(E,ci(m,$,l),C,Math.abs($-w)*Pf)),P.forEach((E,$)=>E.s.sil.classList.toggle("hi",$===w)),s.textContent=m<0?"rest":`sieve ${Ms-m} · 0`,f.wake()}x(-1,-1e9),d(0);const M=()=>{let m=dr;return T.map((C,w)=>{m+=ci(-1,w,l);const E=p(0,0,m+gn/2)[1];return m+=gn,E})};let S=M();const A=m=>S.reduce((C,w,E)=>Math.abs(m[1]-w)<Math.abs(m[1]-S[C])?E:C,0);return o.add(Et(t,{move:m=>x(A(m),performance.now()),leave:()=>x(-1,performance.now())})),o.add(()=>e.replaceChildren()),{set:m=>{l=m,S=M();const C=a;a=-2,x(C,performance.now())},destroy:o.dispose}},ln=210,pe=26,ws=5,If=15,Ar=6,ii=1/9,Dn=ln*.62,hr=38,_f=t=>{const e=lt(Math.min(t,1-t)/.08,0,1);return e*e*(3-2*e)},Yi=ln/Ar/2,zf=Yi/2,Hf=t=>{const e=t-Dn,s=e<0?Yi:zf;return Math.abs(e)>=s?0:Math.cos(Math.PI/2*(Math.abs(e)/s))**2},Df=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u,r=null,i=2.4;const h=yt(1,{eps:.002}),v=At(45,.5,1.8);Ct(v,[[0,0,0],[ln,pe,0],[ln,0,0],[0,pe,0],[0,0,hr],[Dn,-8,hr]],200,168);const y=Mt(v),p=Bt(v),g=_("g",{},e),[N,I]=mt(0,0,ln,pe,5,1.3);Q(q(g),it(y,p,N,I,0,ws));const L=_("path",{class:"nf lo"},g),H=_("g",{},g),W=[];for(let k=0;k<Ar;k++){const b={...q(H),dots:[]};for(let T=0;T<9;T++)b.dots.push(en(b.g,v,1,"dot off"));W.push(b)}const P=[[-8,-3,0,hr-4,Dn-5.5],[pe+3,pe+8,0,hr-4,Dn+pe+5.5],[-8,pe+8,hr-4,hr,Dn+pe+8.5]].map(([k,b,T,n,a])=>{const l=q(H),[d,f]=mt(Dn-1.6,k,Dn+1.6,b,1.4,.6);return Q(l,it(y,p,d,f,T,n)),l.sil.style.transition="none",{el:l,key:a}}),j=Array.from({length:Ar},()=>yt(0,{eps:.03}));let F=-1,X="",z=0;const D=kt(t,k=>{let b=wt(h,k);const T=Le()?0:1;r||(h.t=T),i+=k*h.x;const n=[];for(let m=0;m<Ar;m++){const C=m/Ar+i*ii,w=C-Math.floor(C),E=Math.floor(C);n.push({j:m,x:w*ln,s:_f(w),serial:141+E*Ar+m})}let a=-1;if(r){let m=34;for(const C of n)C.s>.6&&Math.abs(C.x-r[0])<m&&(m=Math.abs(C.x-r[0]),a=C.j)}F=a,j.forEach((m,C)=>{m.t=C===F?11:0,wt(m,k)&&(b=!0)}),n.sort((m,C)=>m.x-C.x);let l=0,d=0;const f=P.map((m,C)=>({id:"g"+C,key:m.key,g:m.el.g}));n.forEach((m,C)=>{const w=W[C],E=If*m.s,$=m.x-E/2,G=m.x+E/2,J=pe/2-E/2,B=pe/2+E/2,R=ws+j[m.j].x,Y=R+E;if(f.push({id:C,key:m.x+pe/2,g:w.g}),E<.3){w.g.setAttribute("visibility","hidden");return}w.g.removeAttribute("visibility");const[Z,V]=mt($,J,G,B,2.6*m.s,.9*m.s);Q(w,it(y,p,Z,V,R,Y));const K=m.j===F;w.sil.classList.toggle("hi",K);const O=E*.2,et=$t(.55*m.s*v.S);w.dots.forEach((nt,ct)=>{Qt(nt,y(m.x+(ct%3-1)*O,pe/2+(Math.floor(ct/3)-1)*O,Y)),nt.setAttribute("rx",String(et)),nt.setAttribute("ry",String($t(et*v.k))),nt.setAttribute("class",m.serial>>ct&1?K?"dot":"dot m":"dot off")}),K&&(d=m.serial),l=Math.max(l,Hf(m.x)*m.s)}),f.sort((m,C)=>m.key-C.key);const x=f.map(m=>m.id).join();x!==X&&(X=x,f.forEach(m=>H.appendChild(m.g)));const M=Math.round(l*100);if(M!==z){z=M;const m=M?`color-mix(in srgb, var(--hl-hi) ${M}%, var(--hl-edge))`:"";P.forEach(C=>{C.el.sil.style.stroke=m})}const S=(i*ii*ln%21+21)%21,A=[];for(let m=S;m<ln;m+=21)m>5&&m<ln-5&&A.push(ft(y(m,4,ws),y(m,pe-4,ws)));return L.setAttribute("d",A.join("")),s.textContent=`rate ${h.x.toFixed(2)}×`+(F>=0?` · #${String(d).padStart(4,"0")}`:""),Le()&&!r&&h.x===0?b:!0});return o.add(D.unregister),o.add(Et(t,{move:k=>{r=le(v,k[0],k[1],ws),h.t=c,D.wake()},leave:()=>{r=null,D.wake()}})),o.add(()=>e.replaceChildren()),{set:k=>{c=k,r&&(h.t=k),D.wake()},destroy:o.dispose}},on=5,Oo=4,$o=9,Fo=7,pr=56,Of=55,Te=[-8,-8,64,64],li=4,$f=700,Ff=1250,Wf=45,ui=.42,Xf=230,fi=5,Ea=[[-1.5,1],[1.5,-1.2],[-.5,-1.8],[2,1.2],[0,0]],Gf=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r=(a,l)=>a<=l?0:c*(.4+.6*(a-l)/(on-1-l)),i=At(45,.5,2.2),h=Fo+(on-1)*$o+Oo;Ct(i,[[Te[0],Te[1],0],[Te[2],Te[3],0],[Te[0],Te[1],h+46],[Te[2],Te[3],h+46]],200,166);const v=Mt(i),y=Bt(i),p=_("g",{},e),[g,N]=Ba(Te[0],Te[1],Te[2],Te[3],7,2);Q(q(p),We(v,y,g,N,0,li));const[I]=mt(4,4,52,52,4,1);_("path",{d:tt(pt(v,I,li)),class:"nf lo"},p);const L=[];for(let a=0;a<on;a++){const l=0+Ea[a][0],d=0+Ea[a][1],[f]=Ba(l,d,l+pr,d+pr,5,1.1),x=q(p),[M]=Ba(l+4,d+4,l+pr-4,d+pr-4,2.5,.6);L.push({j:a,ring:f,el:x,rim:M,tw:Ft(0),sp:yt(0,{k:90,c:10,eps:.005}),kick:1/0,drawn:NaN})}function H(a,l){const d=Fo+a.j*$o+l;Q(a.el,We(v,y,a.ring,a.rim,d,d+Oo))}const W=kt(t,(a,l)=>{let d=!1;for(const f of L){l>=f.kick&&(f.kick=1/0,f.sp.v=ui*f.sp.v0);const x=f.sp.x!==0||f.sp.v!==0?(wt(f.sp,a),f.sp.x):0,M=Wt(f.tw,l)+x;(!Jt(f.tw,l)||f.kick!==1/0||f.sp.x!==0||f.sp.v!==0)&&(d=!0),M!==f.drawn&&(f.drawn=M,H(f,M))}return d});o.add(W.unregister);const P=L.map(a=>v(pr/2+Ea[a.j][0],pr-9+Ea[a.j][1],Fo+a.j*$o+Oo)[1]),j=pt(v,g,0).map(a=>a[0]),F=Math.max(...pt(v,g,0).map(a=>a[1])),X=Math.min(...j)+4,z=Math.max(...j)-4,D=P[on-1]-150;function k([a,l]){if(a<X||a>z||l>F||l<D)return-1;if(b>=0){const f=b<on-1?(P[b]+P[b+1])/2:-1e9,x=b>0?(P[b-1]+P[b])/2:1e9;if(l>=f-fi&&l<=x+fi)return b}let d=0;for(;d<on-1&&l<(P[d]+P[d+1])/2;)d++;return d}let b=-1;function T(a,l){const d=performance.now(),f=a<0?on-1:a;L.forEach(x=>{const M=a<0?0:r(x.j,a),S=Wt(x.tw,d);if(M!==x.tw.to){const A=M<S;oe(x.tw,M,d,A?a<0?x.j*Wf:Math.abs(x.j-l)*30:Math.abs(x.j-l)*Of),x.tw.dur=A?Ff:$f,A||(x.kick=x.tw.t0+Xf,x.sp.v0=Math.max(6,M-S)*.5,x.sp.v0/=ui)}x.el.sil.classList.toggle("hi",x.j===f)}),W.wake()}T(-1,on-1),s.textContent="rest";function n(a){if(a===b)return;const l=a<0?b:a;b=a,s.textContent=a<0?"rest":"fr "+(a+1),T(a,l)}return o.add(Et(t,{move:a=>n(k(a)),leave:()=>n(-1)})),o.add(()=>e.replaceChildren()),{set:a=>{c=a,T(b,b<0?on-1:b)},destroy:o.dispose}},Da=24,Nr=7,Oa=11,Ue=2.1,di=1.8,Wo=3.9,hi=5.5,Ve=3.4,xn=150,Yf=17,Zi=17,vr=11,Se=2.5,Zf=37,On=Zi,qe=Zi+Nr*Oa,bn=qe+Yf,pi=4,Kf=["0 5 12","2 7 3 9","2 14","4 6 10","4 18","2 3","0 2","0 2 6 8","0 26","0 20","0 11 4","2 9 12","2 5 3 7","4 16","4 8 8","2 4","0 3 14","0 24","0 30","0 17","2 6 11","2 13","0 9 5","0 4 7"],vi=Da-Nr-2.6,Uf=18,Vf=2,Jf=(t,e)=>lt(1-t/e,0,1),mi=t=>t*t*(3-2*t),mr=t=>.612*t.nu+.5*t.nv>0,gi=t=>t.map(e=>({...e,v:lt(e.v,On,qe)})),Qf=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.62),r=(M,S,A)=>[M,A,S];Ct(c,[r(0,0,-3),r(xn,0,-3),r(0,bn,-3),r(xn,bn,-3),r(xn,0,Ve+2.8),r(0,bn,Ve+1.3),r(vr,qe-4,hi+di)],200,166);const i=Mt(c),h=(M,S,A)=>i(M,A,S);let v=u,y=null,p=[];const g=_("g",{},e),[N,I]=mt(0,0,xn,bn,9,2);Q(q(g),it(h,mr,N,I,-3,0));const L=Kf.map((M,S)=>{const[A,...m]=M.split(" ").map(Number),C=[];let w=A;for(const E of m){const $=vr+w*Wo;C.push({x0:$,x1:$+E*Wo-1.4,el:q(g)}),w+=E+1}return{j:S,segs:C,sp:yt(0,{eps:.01}),drawn:""}}),[H,W]=mt(Se,Se,xn-Se,On,6,1.4);Q(q(g),it(h,mr,H,W,0,Ve));const P=(Se+On)/2,j=ge([[0,6.2],[8.5,0],[0,-6.2],[0,-3.1],[4.25,0],[0,3.1]],[.9,1.1,.9,.5,.6,.5]),F=_("path",{d:tt(j.map(([M,S])=>h(vr+M,P+S,Ve))),class:"nf"},g),[X,z]=mt(vr+13,P-5.2,vr+13+Wo*1.5,P+5.2,1.2,.8),D=q(g);Q(D,it(h,mr,X,z,Ve,Ve+2.8));const[k,b]=mt(Se,qe,xn-Se,bn-Se,6,1.4);Q(q(g),it(h,mr,k,b,0,Ve));for(let M=0;M<3;M++){const S=vr+M*8.5,A=(qe+bn-Se)/2,[m,C]=mt(S-2.8,A-2.8,S+2.8,A+2.8,2.8,.8);Q(q(g),it(h,mr,m,C,Ve,Ve+1.3))}function T(M,S){const A=S+"|"+M.sp.x;if(A===M.drawn)return;M.drawn=A;const m=qe-(M.j-S+.5)*Oa,C=Math.max(m-Ue,On),w=Math.min(m+Ue,qe),E=mi(lt((qe-m-Ue)/pi,0,1))*mi(lt((m-Ue-On)/pi,0,1)),$=M.sp.x*E;for(const G of M.segs){if(w-C<.05){Q(G.el,{sil:"",crease:""});continue}const J=gi(rt(G.x0,m-Ue,G.x1,m+Ue,Ue,4)),B=gi(rt(G.x0+.7,m-Ue+.7,G.x1-.7,m+Ue-.7,Ue-.7,4));Q(G.el,it(h,mr,J,B,$,$+di))}}function n(M){for(const S of p)S.classList.remove("hi");p=M;for(const S of p)S.classList.add("hi")}const a=yt(vi,{eps:.002}),l=kt(t,M=>{let S=wt(a,M);for(const A of L)wt(A.sp,M)&&(S=!0),T(A,a.x);return S});o.add(l.unregister);function d([M,S],A){const m=h(0,0,A),C=h(1,0,A),w=h(0,1,A),E=C[0]-m[0],$=C[1]-m[1],G=w[0]-m[0],J=w[1]-m[1],B=E*J-$*G;return[((M-m[0])*J-(S-m[1])*G)/B,(E*(S-m[1])-$*(M-m[0]))/B]}function f(M){const S=d(M,Ve),A=C=>C[0]>Se&&C[0]<xn-Se;if(A(S)&&S[1]>Se&&S[1]<On)return"prompt";if(A(S)&&S[1]>qe&&S[1]<bn-Se)return 0;const m=d(M,0);return m[0]<0||m[0]>xn||m[1]<0||m[1]>bn?null:m[1]<=On?"prompt":lt((qe-Oa/2-m[1])/((Nr-1)*Oa),0,1)}function x(){let M,S,A=v;y===null?(M=vi,S=Uf,A=Vf,s.textContent="rest"):y==="prompt"?(M=Da-Nr,S=-1,s.textContent="prompt"):(M=y*(Da-Nr),S=lt(Math.round(y*(Da-1)),Math.ceil(M),Math.floor(M+Nr-1)),s.textContent="line "+(Zf+S)),a.t=M;for(const m of L)m.sp.t=S<0?0:hi*Jf(Math.abs(m.j-S),A);n(S<0?[D.sil,F]:L[S].segs.map(m=>m.el.sil)),l.wake()}x();for(const M of L)M.sp.x=M.sp.t;return o.add(Et(t,{move:M=>{y=f(M),x()},leave:()=>{y=null,x()}})),o.add(()=>e.replaceChildren()),{set:M=>{v=M,y!==null&&x()},destroy:o.dispose}},An=9,me=14,Ta=11,Xo=58,gr=An*me,qf=t=>t<=0?1:t<=.417?1-t/.417*.6875:t<=1?.3125-(t-.417)/.583*.2185:.094,td=({stage:t,svg:e,read:s},u)=>{const o=Tt(),c=At(45,.5,1.58);Ct(c,[[-6,-6,-5],[gr+6,gr+6,-5],[gr+6,-6,-5],[-6,gr+6,-5],[0,0,Xo*.75]],200,166);const r=Mt(c),i=Bt(c);let h=u*me,v=null;const y=_("g",{},e),p=[],[g,N]=mt(-6,-6,gr+6,gr+6,9,2.2);Q(q(y),it(r,i,g,N,-5,0));for(let k=0;k<=2*(An-1);k++)for(let b=0;b<An;b++){const T=k-b;if(T<0||T>=An)continue;const n=b/(An-1),a=T/(An-1),l=4+25*Math.exp(-((n-.22)**2+(a-.74)**2)/.07)+12*Math.exp(-((n-.8)**2+(a-.26)**2)/.035),d=b*me+(me-Ta)/2,f=T*me+(me-Ta)/2,[x,M]=mt(d,f,d+Ta,f+Ta,2.6,.9);p.push({i:b,j:T,h0:l,ring:x,inner:M,sp:yt(l,{eps:.04}),el:q(y),drawn:NaN})}const I=_("g",{},y),L=[];for(let k=0;k<9;k++)L.push(en(I,c,.55,k===4?"dot":"dot m"));const H=p.reduce((k,b)=>b.h0>k.h0?b:k),W=new Map;p.forEach(k=>W.set(k.i+","+k.j,k));let P=null,j=H;function F(){j!==P&&(P=j,P.el.g.after(I));const k=(P.i+.5)*me,b=(P.j+.5)*me,T=Math.max(.6,P.sp.x);L.forEach((n,a)=>Qt(n,r(k+(a%3-1)*2.5,b+(Math.floor(a/3)-1)*2.5,T)))}function X(k){const b=Math.max(.6,k.sp.x);b!==k.drawn&&(k.drawn=b,Q(k.el,it(r,i,k.ring,k.inner,0,b)),k.el.sil.classList.toggle("hi",b>Xo*.5))}const z=kt(t,k=>{let b=!1;for(const T of p)wt(T.sp,k)&&(b=!0),X(T);return F(),b});o.add(z.unregister);function D(){for(const k of p){if(!v){k.sp.t=k.h0;continue}const b=(k.i+.5)*me-v[0],T=(k.j+.5)*me-v[1];k.sp.t=Xo*qf(Math.hypot(b,T)/h)}if(v){const k=lt(Math.floor(v[0]/me),0,An-1),b=lt(Math.floor(v[1]/me),0,An-1);j=W.get(k+","+b),s.textContent=`cell ${k}·${b}`}else j=H,s.textContent="rest";z.wake()}return o.add(Et(t,{move:k=>{v=le(c,k[0],k[1],0),D()},leave:()=>{v=null,D()}})),o.add(()=>e.replaceChildren()),{set:k=>{h=k*me,v&&D()},destroy:o.dispose}},Go=[[-42,-42,0,-12,-12,14,0],[-36,-36,14,-18,-18,34,0],[0,-46,0,16,-6,10,1],[24,-32,0,40,-16,44,2],[-44,4,0,-4,18,22,3],[8,6,0,40,38,8,4],[16,14,8,28,26,20,4],[-30,28,0,-16,42,12,5]],Ds=45,xi=90,bi=t=>Ds+xi*Math.round((t-Ds)/xi),Ua=(t,e,s)=>(t[0]+t[3])*e+(t[1]+t[4])*s+(t[2]+t[5])*.01;function ed(t,e,s,u){return t[6]===e[6]?t[2]<e[2]:t[3]<=e[0]?s>0:e[3]<=t[0]?s<0:t[4]<=e[1]?u>0:e[4]<=t[1]?u<0:Ua(t,s,u)<Ua(e,s,u)}function nd(t,e,s,u){const o=Math.sqrt(1-u*u);let c=1e9,r=-1e9,i=1e9,h=-1e9;for(const v of[t[0],t[3]])for(const y of[t[1],t[4]])for(const p of[t[2],t[5]]){const g=v*s-y*e,N=(v*e+y*s)*u-p*o;c=Math.min(c,g),r=Math.max(r,g),i=Math.min(i,N),h=Math.max(h,N)}return[c,i,r,h]}function rd(t,e,s,u){const o=t.length,c=t.map(p=>nd(p,e,s,u)),r=t.map(()=>[]),i=t.map(()=>0);for(let p=0;p<o;p++)for(let g=0;g<o;g++){const N=c[p],I=c[g];p===g||N[2]<=I[0]||I[2]<=N[0]||N[3]<=I[1]||I[3]<=N[1]||ed(t[p],t[g],e,s)&&(r[p].push(g),i[g]++)}const h=[],v=t.map(()=>!1);let y=0;for(;h.length<o;){let p=-1,g=0;for(;g<2&&p<0;g++)for(let N=0;N<o;N++)!v[N]&&(g||!i[N])&&(p<0||Ua(t[N],e,s)<Ua(t[p],e,s))&&(p=N);g===2&&y++,v[p]=!0,h.push(p);for(const N of r[p])i[N]--}return{order:h,forced:y}}var sd=(t,e,s,u)=>rd(t,e,s,u).order,Bn=70,yi=4,Mi=540,ad=14,od=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r={a:Ds,w:0,mode:"rest",tgt:Ds},i=yt(.5,{eps:5e-4});let h=null,v=0,y=-1e9;function p(d,f){if(r.mode==="rest")return!1;const x=Math.max(1,Math.ceil(d*240)),M=d/x;for(let S=0;S<x;S++)r.mode==="coast"?(r.w*=Math.exp(-M*1e3/c),r.a+=r.w*M,Math.abs(r.w)<45&&f-y>90&&(r.mode="settle",r.tgt=bi(r.a+r.w*.2))):(r.w+=(-90*(r.a-r.tgt)-16*r.w)*M,r.a+=r.w*M);return r.mode==="settle"&&Math.abs(r.a-r.tgt)<.02&&Math.abs(r.w)<.3&&(r.a=r.tgt,r.w=0,r.mode="rest"),r.mode!=="rest"}const g=At(Ds,.5,1.85);g.ox=200,g.oy=184;const N=ht(Bn),I=ht(Bn-1.5),L=Go.map(d=>{const[f,x]=mt(d[0],d[1],d[3],d[4],3,1.1);return{b:d,ring:f,inner:x}}),H=L.find(d=>d.b[5]>=40),W={};L.forEach(d=>{(!W[d.b[6]]||d.b[5]>W[d.b[6]].b[5])&&(W[d.b[6]]=d)});const P={};L.forEach(d=>{d.b[2]===0&&(P[d.b[6]]=[(d.b[0]+d.b[3])/2,(d.b[1]+d.b[4])/2])});const j=_("g",{},e),F=q(j),X=_("path",{class:"nf lo"},j),z=_("path",{class:"nf"},j),D=en(j,g,1.7,"dot m"),k=_("path",{class:"nf"},j),b=Go.map(()=>q(j)),T=_("g",{},j),n=[];for(let d=0;d<16;d++){const f=Math.floor(d/4),x=d%4,M=f%3===0,S=x%3===0;M&&S||n.push({r:f,q:x,el:en(T,g,.6,M||S?"dot m":"dot")})}let a=null;const l=kt(t,(d,f)=>{let x=p(d,f);wt(i,d)&&(x=!0),g.az=vt(r.a),g.k=i.x;const M=Mt(g),S=Bt(g),A=Math.cos(g.az),m=Math.sin(g.az);Q(F,it(M,S,N,I,-yi,0));const C=[],w=[];for(let O=0;O<360;O+=15){const et=vt(O),nt=O%90===0,ct=nt?Bn-12:Bn-8;(nt?w:C).push(ft(M(Math.cos(et)*ct,Math.sin(et)*ct,0),M(Math.cos(et)*(Bn-4.5),Math.sin(et)*(Bn-4.5),0)))}X.setAttribute("d",C.join("")),z.setAttribute("d",w.join("")),Qt(D,M(0,-53,0)),D.setAttribute("ry",String($t(1.7*g.S*g.k)));const E=g.oy+Bn*g.S*g.k+yi*g.S*Math.sqrt(1-g.k*g.k);k.setAttribute("d",`M${g.ox-4} ${$t(E+10)}L${g.ox} ${$t(E+4)}L${g.ox+4} ${$t(E+10)}`);let $=-1,G=ad;if(h!==null||r.mode!=="rest")for(const O in P){const[et,nt]=P[O],ct=Math.abs(Math.atan2(et*A-nt*m,et*m+nt*A))*180/Math.PI;ct<G&&(G=ct,$=+O)}sd(Go,m,A,g.k).forEach((O,et)=>{const nt=L[O];Q(b[et],it(M,S,nt.ring,nt.inner,nt.b[2],nt.b[5])),b[et].sil.classList.toggle("hi",nt===W[$]),nt===H&&a!==b[et]&&(a=b[et],a.g.after(T))});const[J,B,,R,Y,Z]=H.b,V=(J+R)/2,K=(B+Y)/2;return n.forEach(({r:O,q:et,el:nt})=>{Qt(nt,M(V+(et-1.5)*2.6,K+(O-1.5)*2.6,Z)),nt.setAttribute("ry",String($t(.6*g.S*g.k)))}),s.textContent=`az ${String(Math.round((r.a%360+360)%360)).padStart(3,"0")}° · el ${Math.round(Math.asin(i.x)*180/Math.PI)}°`,x});return o.add(l.unregister),o.add(Et(t,{move:d=>{const f=performance.now();if(i.t=bt(Math.sin(vt(40)),Math.sin(vt(20)),lt(d[1]/320,0,1)),h!==null){const x=d[0]-h;if(Le())r.a-=x*.9;else{const M=x/Math.max(.008,(f-v)/1e3);r.w=lt(bt(r.w,-M*.9,.35),-Mi,Mi),r.mode="coast"}Math.abs(x)>.5&&(y=f)}h=d[0],v=f,l.wake()},leave:()=>{h=null,i.t=.5,Le()&&(r.a=bi(r.a)),l.wake()}})),o.add(()=>e.replaceChildren()),{set:d=>{c=d,l.wake()},destroy:o.dispose}},ae=40,se=14,Ne=64,Ln=17,Sa=4,wi=6,cd=6,In=10,Na=11,Ca=12,Yo=10,ki=3.6,Zo=-ae-8,Ai=4.6,xr=-70,br=70,yr=130,Ei=40,Ko=30,id=50,Ti=150,Uo=[72,26,-20],ld=[Math.SQRT1_2*Math.sqrt(.75),Math.SQRT1_2*Math.sqrt(.75),.5],Vo=t=>[Math.cos(t*Math.PI/180),0,Math.sin(t*Math.PI/180)],Jo=t=>((t+50)%100+100)%100-50;function yn(t,e,s,u,o,c,r,i,h){const v=(p,g)=>t(e[0]+s[0]*g+u[0]*p.u+o[0]*p.v,e[1]+s[1]*g+u[1]*p.u+o[1]*p.v,e[2]+s[2]*g+u[2]*p.u+o[2]*p.v),y=p=>[0,1,2].reduce((g,N)=>g+(u[N]*p.nu+o[N]*p.nv)*ld[N],0)>0;return{sil:tt(Pt(c.map(p=>v(p,i)).concat(c.map(p=>v(p,h))))),crease:jt(Kt(r,y).map(p=>v(p,h)))}}var ud=({stage:t,svg:e,read:s},u)=>{const o=Tt();let c=u;const r=[0,1,0],i=[1,0,0],h=[0,0,1],v=[0,0,Ne],y=At(45,.5,1.5);Ct(y,[[xr,-14,0],[br,-14,0],[xr,-14,yr],[br,-14,yr],[xr,Yo,0],[br,0,0],[xr,0,yr],[br,0,yr]],200,166);const p=Mt(y),g=_("g",{},e);Q(q(g),yn(p,[0,0,0],r,i,h,rt(xr,0,br,yr,9,6),rt(xr+2,2,br-2,yr-2,7,6),-14,0)),Q(q(g),yn(p,[Zo,se*.55,0],h,i,r,ht(Ai,28),ht(Ai-1,28),Ne-26,Ne+26));for(const B of[-15,15])Q(q(g),yn(p,[0,0,Ne+B],r,i,h,rt(Zo,-4,-ae+6,4,3,4),rt(Zo+1,-3,-ae+5,3,2,4),1,se*.8));Q(q(g),yn(p,v,r,i,h,ht(ae,72),ht(ae-2.4,72),0,se)),_("path",{class:"nf lo",d:tt(ht(ae-8,64).map(B=>p(B.u,se,Ne+B.v)))},g),_("path",{class:"nf",d:ft(p(0,se,Ne+Ln+1.8),p(0,se,Ne+Ln+6.5))},g);const N=q(g);Q(N,yn(p,v,r,i,h,ht(Ln,56),ht(Ln-1.4,56),se,se+Sa));const I=_("path",{class:"nf lo"},g),L=_("path",{class:"nf"},g),H=_("path",{class:"nf"},g);Q(q(g),yn(p,v,r,i,h,ht(wi,32),ht(wi-1,32),se+Sa,se+Sa+cd));const W=Uo.map(B=>{const R=Vo(B),Y=Vo(B+90),Z=q(g),V=q(g);Q(V,yn(p,v,r,R,Y,rt(ae+In,-Ca/2,ae+In+Na,Ca/2,3,4),rt(ae+In+1.4,-Ca/2+1.4,ae+In+Na-1.4,Ca/2-1.4,1.8,4),0,Yo));for(const K of[-3.4,3.4]){const O=ae+In+Na/2+K;Qt(_("circle",{r:.9,class:"dot off"},V.g),p(R[0]*O,Yo,Ne+R[2]*O))}return{th:B,e:R,t:Y,el:Z,tw:Ft(0),drawn:NaN}}),P=(B,R)=>{const Y=bt(ae+In+4.5,ae+1.2,R);Y!==B.drawn&&(B.drawn=Y,Q(B.el,yn(p,[0,se/2,Ne],B.e,B.t,r,ht(ki,24),ht(ki-.9,24),ae-.2,Y)))},j={a:Ko,w:0,mode:"rest",tgt:Ko};let F=Ko,X="",z=null,D=0,k=-1e9,b=!1,T=!1,n=1,a=null,l=NaN;function d(){if(j.a===l)return;l=j.a;const B=[],R=[],Y=se+Sa;for(let Z=0;Z<100;Z+=5){const V=90+(Z-j.a)*3.6,K=Vo(V),O=Z%10?Ln-4:Ln-6.5,et=Ln-1.8,nt=ft(p(K[0]*O,Y,Ne+K[2]*O),p(K[0]*et,Y,Ne+K[2]*et));Z===Ei?H.setAttribute("d",nt):(Z%10?B:R).push(nt)}I.setAttribute("d",B.join("")),L.setAttribute("d",R.join(""))}function f(){const B=T?"bolts":b?"dial":"combo";B!==a&&(a=B,W.forEach(R=>R.el.sil.classList.toggle("hi",B==="bolts")),N.sil.classList.toggle("hi",B==="dial"),H.classList.toggle("hi",B==="combo"))}function x(B,R){T=B,W.forEach((Y,Z)=>oe(Y.tw,B?1:0,R,Math.abs(Z-n)*id)),f()}function M(B,R){if(j.mode==="rest")return!1;const Y=Math.max(1,Math.ceil(B*240)),Z=B/Y;for(let V=0;V<Y;V++)j.mode==="coast"?(j.w=j.w*Math.exp(-Z*1e3/c)-40*Math.sin(j.a/10*2*Math.PI)*Z,j.a+=j.w*Z,Math.abs(j.w)<12&&R-k>90&&(j.mode="settle",j.tgt=Math.round((j.a+j.w*.15)/10)*10)):(j.w+=(-90*(j.a-j.tgt)-16*j.w)*Z,j.a+=j.w*Z);return j.mode==="settle"&&Math.abs(j.a-j.tgt)<.01&&Math.abs(j.w)<.2&&(j.a=j.tgt=(j.tgt%100+100)%100,j.w=0,j.mode="rest"),j.mode!=="rest"}const S=kt(t,(B,R)=>{let Y=M(B,R);const Z=Math.abs(Jo(j.a-Ei));!T&&Z<.8&&Math.abs(j.w)<6?x(!0,R):T&&Z>2.5&&x(!1,R),d(),W.forEach(O=>{P(O,Wt(O.tw,R)),Jt(O.tw,R)||(Y=!0)});const V=String((Math.round(j.a)%100+100)%100).padStart(2,"0"),K=b||j.mode!=="rest"?`dial ${V}`+(T?" · open":""):"rest";return K!==X&&(s.textContent=X=K),Y});o.add(S.unregister);const A=p(0,se,0),m=p(1,se,0),C=p(0,se,1),w=[m[0]-A[0],m[1]-A[1]],E=[C[0]-A[0],C[1]-A[1]],$=w[0]*E[1]-w[1]*E[0];function G([B,R]){const Y=B-A[0],Z=R-A[1];return[(Y*E[1]-Z*E[0])/$,(w[0]*Z-w[1]*Y)/$-Ne]}function J(){b=!1,z=null,Le()&&(F=j.a=(Math.round(j.a/10)*10%100+100)%100,j.w=0,j.mode="rest"),f(),S.wake()}return o.add(Et(t,{move:B=>{const[R,Y]=G(B),Z=Math.hypot(R,Y);if(Z>ae+In+Na+10)return J();const V=performance.now(),K=Math.atan2(Y,R)*180/Math.PI;if(b=!0,n=Uo.reduce((O,et,nt)=>Math.abs(Jo((K-et)/3.6))<Math.abs(Jo((K-Uo[O])/3.6))?nt:O,0),z!==null){const O=-((K-z+540)%360-180)/3.6*lt(Z/22,0,1);Le()?(F+=O,j.a=Math.round(F/10)*10,j.mode="rest"):(j.w=lt(bt(j.w,O/Math.max(.008,(V-D)/1e3),.35),-Ti,Ti),j.mode="coast",F=j.a),Math.abs(O)>.05&&(k=V)}z=K,D=V,f(),S.wake()},leave:J})),f(),o.add(()=>e.replaceChildren()),{set:B=>{c=B,S.wake()},destroy:o.dispose}};function fd(t,e){return St({id:"riffle",label:"A tray of eight cards. Hover or use the arrow keys to pull a card.",rest:"rest",engine:kf,focusable:!0},t,e)}function dd(t,e){return St({id:"terrain",label:"Eighty-one pillars on a plinth that rise around the pointer and rest as a dune with two rises.",rest:"rest",engine:td},t,e)}function hd(t,e){return St({id:"exploded",label:"An app window taken apart into four layers. Moving across opens the gap; moving down picks a layer.",rest:"",engine:o1},t,e)}function pd(t,e){return St({id:"phosphor",label:"A seven by seven dot matrix on a floating tile that plays a loop, and fades like phosphor where you paint it.",rest:"loop",engine:hu},t,e)}function vd(t,e){return St({id:"slow",label:"Crates riding a belt through a gate. Hovering slows the clock without stopping it.",rest:"rate 1.00×",engine:Df},t,e)}function md(t,e){return St({id:"turntable",label:"Blocks on a turntable. Flick across it to spin it; it settles on the nearest quarter turn.",rest:"az 045° · el 30°",engine:od},t,e)}function gd(t,e){return St({id:"keyboard",label:"A sixty-key board. The key under the pointer sinks, and its neighbours follow it down, less the further away.",rest:"rest",engine:y1},t,e)}function xd(t,e){return St({id:"elevator",label:"Four floors beside an open shaft. The pointer's height picks a floor, and the car travels there through the ones between.",rest:"rest",engine:s1},t,e)}function bd(t,e){return St({id:"phone",label:"A phone in layers: glass, board, battery, shell. Moving across opens the gap; moving down picks a layer.",rest:"rest",engine:ou},t,e)}function yd(t,e){return St({id:"laptop",label:"A thin laptop: the pointer's height sets how far the lid stands open, and the lid follows it on a spring.",rest:"rest",engine:w1},t,e)}function Md(t,e){return St({id:"terminal",label:"A terminal window: the pointer's height scrolls back through its history, and the line under it lifts off the screen.",rest:"rest",engine:Qf},t,e)}function wd(t,e){return St({id:"cabinet",label:"A rack of twelve blades: the pointer's height pulls the nearest ones out on their rails, the farther the less.",rest:"rest",engine:Gl},t,e)}function kd(t,e){return St({id:"branches",label:"A commit graph on a board: the commit under the pointer rises, and its history rises after it, the farther back the less.",rest:"rest",engine:Fl},t,e)}function Ad(t,e){return St({id:"vault",label:"A vault door: circling the pointer turns its dial, which coasts and catches every ten; on forty its three bolts draw back.",rest:"rest",engine:ud},t,e)}function Ed(t,e){return St({id:"lockers",label:"A bank of twelve lockers, one ajar at rest: the locker under the pointer opens, and the one open before it swings shut.",rest:"rest",engine:T1},t,e)}function Td(t,e){return St({id:"loupe",label:"A stand loupe over a blank ruled sheet: the pointer drags it across, and the rules pass enlarged under the glass with nothing between them.",rest:"rest",engine:R1},t,e)}function Sd(t,e){return St({id:"padlock",label:"A padlock: as the pointer nears, the shackle springs up out of the body and swings open about its long leg.",rest:"rest",engine:O1},t,e)}function Nd(t,e){return St({id:"patch",label:"A patch panel of twenty-four ports: the cable under the pointer lifts, and its neighbours lean away, less the further away.",rest:"rest",engine:J1},t,e)}function Cd(t,e){return St({id:"dish",label:"A parabolic dish on a two-axis gimbal: the pointer aims it, and it follows on a spring.",rest:"rest",engine:Ul},t,e)}function jd(t,e){return St({id:"router",label:"A wifi router whose antennas lean toward the pointer, the nearest the most and the others less the further away.",rest:"rest",engine:Tf},t,e)}function Rd(t,e){return St({id:"sieve",label:"Three test sieves stacked over a pan: the pointer's height picks one, it rises clear of the stack, and every mesh is bare.",rest:"rest",engine:Lf},t,e)}function Pd(t,e){return St({id:"rail",label:"A garment rail with seven bare hangers: the pointer brushes them, and each rocks away from it, the nearest most, and settles.",rest:"rest",engine:Qu},t,e)}function Bd(t,e){return St({id:"plug",label:"A wall socket and a plug lying on the floor at the end of its cord: the pointer draws the plug up toward the socket, and it stops short of it.",rest:"rest",engine:Bu},t,e)}function Ld(t,e){return St({id:"query",label:"A question mark built as a solid on a plinth, its dot a loose ball: the hook turns about its stem toward the pointer, and the ball rolls after it.",rest:"rest",engine:Gu},t,e)}function Id(t,e){return St({id:"drawer",label:"A filing cabinet of three drawers: the pointer's height picks one, it slides out, and inside are two dividers and nothing between them.",rest:"rest",engine:t1},t,e)}function _d(t,e){return St({id:"basket",label:"An empty wire shopping basket under a bail handle: the pointer tilts it toward itself on a spring, so the bare floor shows, and the handle swings after it, late.",rest:"rest",engine:Hl},t,e)}function zd(t,e){return St({id:"plot",label:"A bar chart with no data: seven flat tabs on its base, before a plate of grid lines. The pointer brushes them, and each lifts a little, the nearest most, and drops back to zero.",rest:"rest",engine:wu},t,e)}function Hd(t,e){return St({id:"hub",label:"A hub and eight tiles on a grid: the tile under the pointer rises and its link turns solid; its neighbours rise less.",rest:"rest",engine:v1,tour:[[205,112],[260,144],[328,179],[263,207],[201,243],[131,209],[76,177],[136,141],null]},t,e)}function Dd(t,e){return St({id:"relay",label:"A hub and four branches of tiles: the path to the leaf under the pointer lights hop by hop, each tile rising in turn.",rest:"rest",engine:hf,tour:[[45,145],[140,253],[271,258],[355,216],[344,151],null]},t,e)}function Od(t,e){return St({id:"settle",label:"Twelve tiles lie crooked round a hub; as the pointer nears it they slide into a tree and the links draw in.",rest:"rest",engine:Cf,tour:[[360,40],[320,120],[203,155],null]},t,e)}function $d(t,e){return St({id:"format",label:"A file of ten crooked lines: the pointer runs the formatter down it, and every line above snaps square to its indent.",rest:"rest",engine:f1,tour:[[290,162],[199,168],[135,200],null]},t,e)}function Fd(t,e){return St({id:"rebuild",label:"A tree of package tiles: the one touched rises, and every package that depends on it rises after it along the links.",rest:"rest",engine:lf,tour:[[47,236],[276,172],[181,106],null]},t,e)}function Wd(t,e){return St({id:"stack",label:"A call stack of five frames: the pointer's height picks one, and the frames above lift away to open it.",rest:"rest",engine:Gf,tour:[[200,250],[200,216],[200,199],null]},t,e)}var Qo=typeof window>"u"?ie.useEffect:ie.useLayoutEffect;function Nt(t,e){const s=ie.forwardRef(function(o,c){const{intensity:r,theme:i,label:h,onRead:v,play:y,style:p,...g}=o,N=h??o["aria-label"],I=ie.useRef(null),L=ie.useRef(null),H=ie.useRef(v),W=ie.useCallback(P=>{I.current=P,typeof c=="function"?c(P):c&&(c.current=P)},[c]);return Qo(()=>{H.current=v}),Qo(()=>{const P=e(I.current,{intensity:r,theme:i,label:N,play:y,onRead:j=>H.current?.(j)});return L.current=P,()=>{P.destroy(),L.current=null}},[]),Qo(()=>{L.current?.update({intensity:r,theme:i,label:N,play:y})},[r,i,N,y]),U.jsx("div",{...g,ref:W,style:{aspectRatio:"5 / 4",...p}})});return s.displayName=t,s}Nt("Riffle",fd);Nt("Terrain",dd);Nt("Exploded",hd);Nt("Phosphor",pd);Nt("Slow",vd);Nt("Turntable",md);Nt("Keyboard",gd);Nt("Elevator",xd);Nt("Phone",bd);Nt("Laptop",yd);Nt("Terminal",Md);Nt("Cabinet",wd);Nt("Branches",kd);Nt("Vault",Ad);Nt("Lockers",Ed);Nt("Loupe",Td);Nt("Padlock",Sd);Nt("Patch",Nd);Nt("Dish",Cd);Nt("Router",jd);Nt("Sieve",Rd);Nt("Rail",Pd);Nt("Plug",Bd);Nt("Query",Ld);Nt("Drawer",Id);Nt("Basket",_d);Nt("Plot",zd);var Xd=Nt("Hub",Hd);Nt("Relay",Dd);Nt("Settle",Od);Nt("Format",$d);Nt("Rebuild",Fd);Nt("Stack",Wd);function Si(t){if(t.pointerType==="touch"||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=t.currentTarget,s=e.getBoundingClientRect();e.style.setProperty("--tt-plan-pointer-x",`${t.clientX-s.left}px`),e.style.setProperty("--tt-plan-pointer-y",`${t.clientY-s.top}px`)}function Ni({items:t}){return U.jsx("ul",{className:"space-y-4 py-7 text-sm leading-6",children:t.map(e=>U.jsxs("li",{className:"flex items-start gap-3",children:[U.jsx(dl,{size:16,className:"mt-1 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),U.jsx("span",{children:e})]},e))})}function th(){const t=Ui(),e=Vi(),{state:s}=Ji();return U.jsx(Gd,{catalogState:t,accountState:e,initialSelection:s?.cloudPlanSelection,restoreFocus:s?.cloudPlanRestoreFocus})}function Gd({catalogState:t,accountState:e,initialSelection:s,selection:u,restoreFocus:o=!1}){const c=ie.useRef(null),r=ie.useRef(null),i=ie.useRef(!1);ie.useLayoutEffect(()=>{const O=c.current?.parentElement;O&&(O.scrollTop=0)},[]);const h=Qi(),{openLoginModal:v}=qi(),{catalog:y,loading:p,error:g,refresh:N}=t,{account:I,auth:L,loading:H,error:W,refresh:P}=e,[j,F]=ie.useState(s?.billingMode==="fixed"?"fixed":"recurring"),[X,z]=ie.useState(s?.termMonths===1?1:12),D=u?.billingMode||j,k=u?.termMonths||X,b=I?.membership,T=b?.has_gift===!0||b?.access_source==="gift"||I?.gifts?.some(O=>["active","pending"].includes(O.state)),n=I?.subscriptions?.some(O=>["active","trialing","past_due","paused"].includes(O.status)&&!O.cancel_at_period_end),a=b?.status==="active"&&!n&&!T,l=a?"fixed":D,d=y?.prices?.find(O=>O.billing_mode===l&&O.term_months===k),f=typeof d?.sku=="string"&&!!d.sku.trim(),x=y?.prices?.find(O=>O.billing_mode===l&&O.term_months===1),M=y?.prices?.find(O=>O.billing_mode===l&&O.term_months===12),S=d?.currency||"USD",A=tl(x,M),m=el(y),C=y?.providers?.waffo,w=[...I?.conflict_orders||[],...I?.pending_orders||[]].some(O=>O.retry_payment_conflict_at),E=b&&["active","trial","transition","legacy_free"].includes(b.status),$=b?.trial_available===!1,G=!L?.signedIn||b?.trial_available===!0,J=!!(L?.loading||L?.signedIn&&(H||W||!b)),B=n||T,R=!E&&!n&&!T&&!$,Y=b?.status==="transition"?b.transition_ends_at:b?.status==="trial"?b.trial_ends_at:a?b.expires_at:null,Z=st(a?"cloud.action.renew":l==="fixed"?"cloud.action.buy_pro":"cloud.action.subscribe"),V=!f||!m||p||g||J||!C||w;ie.useLayoutEffect(()=>{if(!o||i.current||p||J)return;const O=r.current?.querySelector("button:not([disabled]), a[href]");O&&(O.focus(),i.current=!0)},[o,p,J]);const K=(O=!1)=>{if(!f)return;const et=il({trial:O,sku:d?.sku,userId:L?.signedIn?L.user?.id:null});if(!L?.signedIn){v({nextPath:et,subtitle:st(O?"cloud.login.trial_context":"cloud.login.purchase_context")});return}h(et)};return y?.policy?.hosting_mode==="self_hosted"||b?.status==="self_hosted"?U.jsx(nl,{}):U.jsx("div",{ref:c,className:"tt-cloud-theme flex flex-1 flex-col font-oai text-oai-black dark:text-oai-white",children:U.jsxs("main",{className:"tt-cloud-layout relative isolate mx-auto w-full max-w-5xl px-4 py-8 sm:px-6 sm:py-10",children:[U.jsx("div",{className:"tt-cloud-art","aria-hidden":"true",children:U.jsx(Xd,{className:"tt-cloud-figure pointer-events-auto w-full translate-x-8",intensity:.4,play:!0,tabIndex:-1})}),U.jsxs("header",{className:"relative z-10 mb-9 max-w-xl",children:[U.jsx("h1",{className:"text-balance text-3xl font-semibold tracking-tight sm:text-4xl",children:st("cloud.page.title")}),U.jsx("p",{className:"mt-3 text-base leading-7 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.page.subtitle")})]}),w?U.jsx("div",{className:"mb-6",children:U.jsx(rl,{})}):null,U.jsxs("div",{className:"tt-plan-grid relative z-10",children:[U.jsxs(x0,{className:"tt-plan-card",bodyClassName:"tt-plan-body",onPointerMove:Si,children:[U.jsxs("div",{children:[U.jsxs("div",{className:"flex min-h-11 items-center gap-2.5",children:[U.jsx(sl,{size:19,className:"text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),U.jsx("h2",{className:"text-lg font-semibold",children:st("cloud.free.title")})]}),U.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.free.subtitle")})]}),U.jsxs("div",{className:"border-b border-oai-gray-200 pb-6 pt-7 dark:border-oai-gray-800",children:[U.jsx("p",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:st("cloud.free.price")}),U.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.free.forever")})]}),U.jsx(Ni,{items:[st("cloud.free.tracking"),st("cloud.free.limits"),st("cloud.free.desktop"),st("cloud.free.exports"),st("cloud.plan.local_community")]}),U.jsx("div",{className:"flex items-center border-t border-oai-gray-200 py-4 dark:border-oai-gray-800",children:U.jsx("p",{className:"text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.free.installations")})}),U.jsx(Dr,{as:Gs,to:L?.signedIn?"/dashboard":"/landing#download",variant:"secondary",className:"w-full no-underline",children:st(L?.signedIn?"cloud.action.open_dashboard":"cloud.free.cta")}),U.jsx("div",{"aria-hidden":!0})]}),U.jsxs(x0,{className:"tt-plan-card border-oai-gray-300 dark:border-oai-gray-600",bodyClassName:"tt-plan-body",onPointerMove:Si,children:[U.jsxs("div",{children:[U.jsxs("div",{className:"flex min-h-11 flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[U.jsxs("h2",{className:"flex items-center gap-2.5 text-lg font-semibold",children:[U.jsx(al,{size:19,className:"text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),st("cloud.plan.title")]}),U.jsx("div",{role:"group","aria-label":st("cloud.selector.term"),className:"tt-pro-period-control shrink-0",children:U.jsx(ll,{options:[{value:1,label:st("cloud.term.monthly")},{value:12,label:st("cloud.term.yearly")}],value:k,onChange:z})})]}),U.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.plan.subtitle")})]}),U.jsxs("div",{className:"border-b border-oai-gray-200 pb-6 pt-7 dark:border-oai-gray-800","aria-live":"polite",children:[U.jsxs("p",{className:"flex flex-wrap items-baseline gap-2",children:[U.jsx("span",{className:"text-3xl font-semibold tracking-tight tabular-nums sm:text-4xl",children:d?Ja(d.amount_cents,S):st("cloud.price.pending")}),U.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:st(k===12?"cloud.price.per_year":"cloud.price.per_month")})]}),U.jsxs("p",{className:"mt-3 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400",children:[U.jsx("span",{children:d?k===12?st("cloud.plan.monthly_equivalent",{equivalent:Ja(Math.round(d.amount_cents/12),S)}):st(l==="fixed"?"cloud.price.fixed_monthly_total":"cloud.price.monthly_total",{total:Ja(d.amount_cents,S)}):st("cloud.price.waiting")}),k===12&&d&&A!==0?U.jsxs("span",{children:[" · ",st("cloud.price.savings",{percent:A})]}):null]})]}),U.jsx(Ni,{items:[st("cloud.plan.anywhere"),st("cloud.plan.sync",{minutes:y?.limits?.sync_minutes||15}),st("cloud.plan.retained_history",{days:y?.limits?.hourly_history_days||90,months:y?.limits?.daily_history_months||24}),st("cloud.plan.identity")]}),U.jsxs("div",{className:"border-t border-oai-gray-200 py-4 dark:border-oai-gray-800",children:[R?U.jsx("p",{className:"flex min-h-11 items-center text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.plan.trial_setup_hint")}):null,!R&&a?U.jsxs("p",{className:"flex min-h-11 items-center text-sm font-medium",children:[st("cloud.billing_mode.fixed"),U.jsx("span",{className:"ml-2 text-xs font-normal text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.plan.renewal_off")})]}):null,B?U.jsx("p",{className:"flex min-h-11 items-center text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:g0(b?.status)}):null,!R&&!a&&!B?U.jsxs("div",{className:"flex items-center justify-between gap-3",children:[U.jsxs("label",{htmlFor:"pro-renewal-toggle",className:"cursor-pointer text-sm font-medium",children:[st("cloud.billing_mode.recurring"),U.jsx("span",{className:"ml-2 text-xs font-normal text-oai-gray-500 dark:text-oai-gray-400",children:st(D==="recurring"?"cloud.plan.renewal_hint":"cloud.plan.renewal_off")})]}),U.jsx("button",{id:"pro-renewal-toggle",type:"button",role:"switch","aria-checked":D==="recurring","aria-label":st("cloud.billing_mode.recurring"),onClick:()=>F(O=>O==="recurring"?"fixed":"recurring"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-md",children:U.jsx("span",{"aria-hidden":!0,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${D==="recurring"?"bg-oai-gray-900 dark:bg-oai-gray-100":"bg-oai-gray-300 dark:bg-oai-gray-700"}`,children:U.jsx("span",{className:`h-3.5 w-3.5 rounded-full transition-transform motion-reduce:transition-none ${D==="recurring"?"translate-x-[19px] bg-white dark:bg-oai-gray-900":"translate-x-[3px] bg-white"}`})})})]}):null]}),U.jsxs("div",{ref:r,children:[B?U.jsx(Dr,{as:Gs,to:"/settings?section=cloud",className:"w-full no-underline",children:st("cloud.action.manage_membership")}):null,!B&&R?U.jsxs(Dr,{type:"button",onClick:()=>K(!0),disabled:!f||!m||p||g||J||!G||w,className:"w-full",children:[st("cloud.action.try",{days:y?.limits?.trial_days||7}),U.jsx(Qa,{size:16,className:"ml-2","aria-hidden":!0})]}):null,!B&&!R?U.jsxs(Dr,{type:"button",onClick:()=>K(),disabled:V,className:"w-full",children:[Z,U.jsx(Qa,{size:16,className:"ml-2","aria-hidden":!0})]}):null]}),U.jsxs("div",{className:`text-center text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400 ${!B&&(E||$)||T?"pt-3":""}`,children:[!B&&!E&&$?U.jsx("p",{children:st("cloud.trial.used_hint")}):null,E&&!B?U.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[U.jsx("span",{children:g0(b?.status)}),Y?U.jsxs("span",{children:["· ",st("cloud.membership.expires",{date:ol(Y)})]}):null,U.jsx(Gs,{to:"/settings?section=cloud",className:"inline-flex min-h-8 items-center underline underline-offset-4",children:st("cloud.action.manage_membership")})]}):null,T?U.jsx("p",{children:st("cloud.gift.error_active")}):null]})]})]}),U.jsxs("div",{className:"mt-5 space-y-3",children:[W?U.jsx(Yn,{error:W,context:"account",onRetry:P}):null,g?U.jsx(Yn,{error:g,onRetry:N}):null,!g&&p?U.jsx(Yn,{children:st("cloud.catalog.loading")}):null,!g&&!p&&!m?U.jsx(Yn,{children:st("cloud.catalog.preview")}):null,!g&&!p&&m&&!C?U.jsx(Yn,{children:st("cloud.catalog.provider_unavailable")}):null,!g&&!p&&m&&y?.environment==="sandbox"?U.jsx(Yn,{children:st("cloud.catalog.sandbox")}):null]}),U.jsxs("section",{className:"mt-8 rounded-xl border border-oai-gray-200 bg-white p-6 dark:border-oai-gray-800 dark:bg-oai-gray-900 md:p-7",children:[U.jsx("h2",{className:"mb-3 text-lg font-semibold",children:st("cloud.plan.faq_title")}),U.jsxs("div",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:[U.jsxs("details",{className:"group",children:[U.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-4 py-4 text-sm font-medium [&::-webkit-details-marker]:hidden",children:[st("cloud.plan.details_title"),U.jsx(b0,{size:16,className:"shrink-0 text-oai-gray-500 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":!0})]}),U.jsxs("div",{className:"max-w-2xl pb-5",children:[U.jsx(cl,{limits:y?.limits}),U.jsx("p",{className:"mt-4 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.feature.pro_identity")})]})]}),[[st("cloud.faq.local_title"),st("cloud.faq.local_body")],[st("cloud.faq.cost_title"),st("cloud.faq.cost_body")],[st("cloud.faq.expiry_title"),st("cloud.faq.expiry_body")],[st("cloud.faq.platform_title"),st("cloud.faq.platform_body")],[st("cloud.faq.existing_title"),st("cloud.faq.existing_body")]].map(([O,et])=>U.jsxs("details",{className:"group",children:[U.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-4 py-4 text-sm font-medium [&::-webkit-details-marker]:hidden",children:[O,U.jsx(b0,{size:16,className:"shrink-0 text-oai-gray-500 transition-transform group-open:rotate-180 motion-reduce:transition-none","aria-hidden":!0})]}),U.jsx("p",{className:"max-w-2xl pb-5 text-sm leading-7 text-oai-gray-500 dark:text-oai-gray-400",children:et})]},O))]})]}),U.jsxs("section",{className:"mt-6 flex flex-col gap-4 rounded-xl border border-oai-gray-200 bg-oai-gray-50 p-6 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:flex-row sm:items-center sm:justify-between md:p-7",children:[U.jsxs("div",{className:"max-w-xl",children:[U.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold",children:[U.jsx(ul,{size:16,"aria-hidden":!0}),st("cloud.self_host.title")]}),U.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400",children:st("cloud.plan.self_host_summary")})]}),U.jsxs(Dr,{as:Gs,to:"/self-host",variant:"secondary",className:"shrink-0 self-start no-underline sm:self-auto",children:[st("cloud.self_host.cta"),U.jsx(Qa,{size:16,className:"ml-2","aria-hidden":!0})]})]}),U.jsxs("footer",{className:"mt-7 flex items-start justify-center gap-2 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:[U.jsx(fl,{size:15,className:"mt-0.5 shrink-0","aria-hidden":!0}),st("cloud.feature.privacy_detail")]})]})})}export{th as CloudPage,Gd as CloudPlanView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,J as a}from"./__vite-browser-external-DWN9Fb-H.js";import{u as p}from"./DialogTitle-B9NNSz5p.js";import{u as c}from"./composite-Cq0CmNAv.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,i=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-DWN9Fb-H.js","assets/__vite-browser-external-LpFw4zXh.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as W,j as e,c as a,y as B,a as mt,r as l,cm as gt,cn as pt,co as ht,cp as ft,a7 as X,cq as we,bu as xt,cr as bt,bt as Ne,cs as de,aP as $e,ct as yt,cu as vt,ag as ze,u as Fe,V as fe,x as jt,B as R,a8 as G,cv as kt,a9 as z,ax as wt,cw as ue,a5 as Y,aB as Nt,a1 as _t,af as St,at as se,R as be,cx as Ct,L as ne,aM as Et,au as Pt,al as Ot,am as ye,ac as At,d as He,aa as xe,ab as Be,cy as _e,cz as Se,cA as Ce,cB as Lt,cC as Tt,ao as It,Z as Ve,l as me,cD as Ee,k as Pe,cE as Rt,cF as Dt,cG as Gt,z as Ut,cH as Mt,cI as $t,cJ as zt,cK as Ft,cL as Ht,cM as Bt,cN as Vt,v as Ke,cO as Kt,cP as qt,bc as Oe,_ as Wt,e as Yt,cQ as Zt,cR as Jt,bw as Qt}from"./__vite-browser-external-DWN9Fb-H.js";import{a as Xt,b as Ae,s as ea,K as ta,P as aa,D as sa,c as na,S as ia,v as ra,u as oa,C as la}from"./sortable.esm-BCn2Ms6R.js";import{a as ca}from"./modifiers.esm-CYLYBECB.js";import{d as Le,l as Te,u as da,b as Ie}from"./use-limits-display-prefs-BOk5f-HM.js";import{P as ua}from"./ProviderIcon-ClHXNkQ0.js";import{a as E,S as q,b as V,T as D}from"./Controls-BmT6-x_L.js";import{m as qe}from"./react-CCNSVHEA.js";import{P as ma,C as We,a as ga,u as pa,b as ha}from"./CloudUsageExport-jXdoiD0e.js";import{C as fa}from"./check-CSZvcC3X.js";import{C as xa,i as ba}from"./host-mode-xzpMLcwP.js";import{A as Ye}from"./index-DX7nYrHb.js";import{r as ya,C as ge,o as va}from"./cloud-checkout-z_eDVwm6.js";import{G as Re}from"./gift-CCp4Hh50.js";import{C as ja}from"./chevron-down-CsiGcG0G.js";import{C as pe}from"./Card-C9FjyAwh.js";import{E as De}from"./external-link-B8E8tbB3.js";import{a as ka,P as wa}from"./play-CUrMOLtq.js";import{I as Ze}from"./info-B3NKYwWG.js";import{a as Na,b as _a,c as Sa,d as Ca,e as Ea}from"./TooltipPopup-DMliWhoK.js";import{L as Pa}from"./loader-circle-Cm5Nsgp-.js";import{u as Oa}from"./useCurrency-CbCnjf-N.js";import{u as Aa}from"./useTokenFormat-Bq-rwuKa.js";import{S as ve}from"./Select-BHEXdYHu.js";import{u as ie}from"./use-native-settings-B2gc_m9W.js";import{C as La}from"./ConfirmModal-DRhgBoGE.js";import{A as Ta}from"./arrow-up-right-DxY0neJ4.js";import{D as Ia}from"./download-DqLpubIF.js";import"./DialogTitle-B9NNSz5p.js";import"./composite-Cq0CmNAv.js";import"./store-B22kwLs0.js";import"./SelectItemText-aaQK_QIt.js";import"./usePositioner-MepYlL0A.js";import"./safePolygon-DsolkMUX.js";import"./DialogClose-DjnC3P4V.js";import"./DateRangePopover-DuqNLatr.js";import"./calendar-days-bzh7-lab.js";import"./PopoverPopup-BzfELnIC.js";import"./DialogDescription-yy_QHg7O.js";const Je={name:"credit-card",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}],["path",{d:"M6 14h2",key:"mk7k0u"}]]};Je.node;const Ra=W(Je);const Qe={name:"flask-conical",size:24,node:[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]};Qe.node;const Da=W(Qe);const Xe={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};Xe.node;const Ga=W(Xe);const et={name:"languages",size:24,node:[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]};et.node;const Ua=W(et);const tt={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};tt.node;const Ma=W(tt);const at={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};at.node;const $a=W(at);const st={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};st.node;const za=W(st),Fa="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Ha({checked:t,onChange:s,ariaLabel:n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":n,onClick:s,className:B("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:e.jsx("span",{className:B("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function Ba({id:t,visible:s,onToggle:n}){const{attributes:i,listeners:r,setNodeRef:c,transform:g,transition:o,isDragging:d}=oa({id:t}),y={transform:la.Transform.toString(g)||void 0,transition:o,zIndex:d?20:void 0};return e.jsxs("div",{ref:c,style:y,className:B("flex items-center gap-3 py-2 rounded-md select-none touch-none","cursor-grab active:cursor-grabbing","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",d&&"relative bg-oai-gray-100 dark:bg-oai-gray-800"),...i,...r,children:[e.jsx(Ga,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),Le(t)?e.jsx(ua,{provider:Le(t),size:18,className:B("pointer-events-none",Fa)}):null,e.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:Te(t)}),e.jsx("div",{onPointerDown:p=>p.stopPropagation(),children:e.jsx(Ha,{checked:s,onChange:n,ariaLabel:`${a("limits.settings.toggle_visible")}: ${Te(t)}`})})]})}function Va({prefs:t}){const{order:s,visibility:n,toggle:i,setAllVisible:r,moveToward:c}=t,g=s.every(u=>n[u]!==!1),o=s.every(u=>n[u]===!1),d=s.filter(u=>n[u]!==!1).length,y=Xt(Ae(aa,{activationConstraint:{distance:6}}),Ae(ta,{coordinateGetter:ea})),p=({active:u,over:x})=>{x&&u.id!==x.id&&c(u.id,x.id)};return e.jsxs(e.Fragment,{children:[e.jsx(E,{label:a("limits.settings.bulk_visibility"),hint:a("limits.settings.enabled_count",{enabled:d,total:s.length}),control:e.jsx(q,{options:[{value:"enabled",label:a("limits.settings.enable_all")},{value:"disabled",label:a("limits.settings.disable_all")}],value:g?"enabled":o?"disabled":null,onChange:u=>r(u==="enabled")})}),e.jsx(sa,{sensors:y,collisionDetection:na,modifiers:[ca],onDragEnd:p,children:e.jsx(ia,{items:s,strategy:ra,children:e.jsx("div",{className:"flex flex-col",children:s.map(u=>e.jsx(Ba,{id:u,visible:n[u]!==!1,onToggle:()=>i(u)},u))})})})]})}function Ka(t){if(!t||typeof t!="object")return"";const s=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},i=s.full_name||s.name||n.name||s.user_name||s.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof t.email=="string"&&t.email.includes("@")?t.email.split("@")[0].trim()||t.email.trim():typeof t.email=="string"?t.email.trim():""}function qa(t){return!t||typeof t!="object"?"":typeof t.email=="string"?t.email.trim():""}function Wa(t){const s=typeof t=="string"?t.trim():"";if(!s)return null;const n=s.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=s.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),r=n?.[1]||i?.[1];return r?`https://github.com/${r}`:null}function je(t,s){console.warn(`[tokentracker] settings ${t}:`,s)}function Ya(t,s,n,i){const[r,c]=l.useState(()=>X()),g=s&&n&&ze(),o=l.useMemo(()=>({active:!0,busy:!1}),[t,s,n,i]),d=l.useRef(o);d.current=o;const[y,p]=l.useState(null),u=y?.scope===o?y:null;l.useEffect(()=>{o.active=!0;const j=()=>{const m=X();c(m),m||p(k=>k?.scope===o?{...k,error:null}:k)},h=()=>{p(m=>m?.scope===o?{...m,error:null}:m),de(i,"cloud-sync")};return j(),window.addEventListener("tt.cloudSyncChanged",j),window.addEventListener("storage",j),window.addEventListener(we,h),()=>{o.active=!1,window.removeEventListener("tt.cloudSyncChanged",j),window.removeEventListener("storage",j),window.removeEventListener(we,h)}},[o,i]);const x=l.useCallback(async()=>{if(!g||!X()||o.busy||!o.active||d.current!==o)return;o.busy=!0,p({scope:o,pending:!0,error:null});const j=()=>o.active&&d.current===o&&X();try{await xt(()=>t())}catch(h){if(!j())return;["cloud_membership_required","cloud_read_only_expired","cloud_history_window_exceeded","cloud_machine_limit","machine_limit_exceeded","cloud_machine_paused"].includes(h?.code)?bt(i,h.code,h.membership,"cloud-sync"):p({scope:o,pending:!0,error:{code:"billing_network_error"}}),je("cloud sync",h)}finally{o.busy=!1,o.active&&d.current===o&&p(h=>h?.scope===o?{...h,pending:!1}:h)}},[g,o,t,i]),v=l.useCallback(async()=>{if(!g||o.busy||!o.active||d.current!==o)return;const j=!X();p({scope:o,pending:!1,error:null}),Ne(j),c(j),j?await x():de(i,"cloud-sync")},[g,o,x,i]),N=l.useCallback(()=>{!g||!o.active||d.current!==o||(Ne(!1),c(!1),p(j=>j?.scope===o?{...j,error:null}:j),de(i,"cloud-sync"))},[g,o,i]);return{cloudSyncOn:r,cloudSyncPending:!!u?.pending,cloudSyncError:u?.error,handleCloudSyncToggle:v,handleCloudSyncRetry:x,handleCloudSyncDisable:N,showLocalCloudSync:g}}function Za(t){const[s,n]=l.useState(!1),[i,r]=l.useState(!1),[c,g]=l.useState(!1),[o,d]=l.useState(!1),[y,p]=l.useState(null),[u,x]=l.useState(!1),[v,N]=l.useState(""),[j,h]=l.useState(!1),[m,k]=l.useState(""),[C,f]=l.useState(""),[S,_]=l.useState(!1),[w,A]=l.useState(null),T=l.useMemo(()=>Ka(t),[t]),b=l.useMemo(()=>qa(t),[t]),P=l.useMemo(()=>typeof t?.id=="string"?t.id.trim():"",[t]),U=l.useMemo(()=>({setAnonymousOn:r,setCustomDisplayName:p,setGithubUrl:k,setProfileLoading:g,setPublicProfileOn:n,setShowGithubOn:h}),[]);return{anonymousOn:i,customDisplayName:y,displayName:T,editingGithub:S,editingName:u,email:b,githubError:w,githubInput:C,githubUrl:m,loadSetters:U,nameInput:v,profileLoading:c,profileSaving:o,publicProfileOn:s,setAnonymousOn:r,setCustomDisplayName:p,setEditingGithub:_,setEditingName:x,setGithubError:A,setGithubInput:f,setGithubUrl:k,setNameInput:N,setProfileLoading:g,setProfileSaving:d,setPublicProfileOn:n,setShowGithubOn:h,showGithubOn:j,userId:P}}function Ja(t,s,n){l.useEffect(()=>{if(!s)return;let i=!0;return n.setProfileLoading(!0),(async()=>{try{const r=await $e({getAccessToken:t});if(!i||!r)return;const c=await yt({accessToken:r});if(!i)return;n.setPublicProfileOn(!!c?.enabled),n.setAnonymousOn(!!c?.anonymous),c?.display_name&&n.setCustomDisplayName(c.display_name),n.setShowGithubOn(!!c?.show_github_url),n.setGithubUrl(c?.github_url||"")}catch(r){je("load public profile",r)}finally{i&&n.setProfileLoading(!1)}})(),()=>{i=!1}},[t,s,n])}function Qa(t,s,n){return l.useCallback(async(i,{label:r,onError:c,onSuccess:g}={})=>{if(!n||s.profileSaving)return!1;s.setProfileSaving(!0);try{const o=await $e({getAccessToken:t});if(!o)return!1;const d=await vt({accessToken:o,...i});return g?.(d),!0}catch(o){return c?c(o):je(r||"mutate profile",o),!1}finally{s.setProfileSaving(!1)}},[t,s,n])}function Xa(t,s){return{anonymousOn:t.anonymousOn,customDisplayName:t.customDisplayName,displayName:t.displayName,editingName:t.editingName,handleAnonymousToggle:s.handleAnonymousToggle,handleSaveName:s.handleSaveName,nameInput:t.nameInput,profileLoading:t.profileLoading,profileSaving:t.profileSaving,setEditingName:t.setEditingName,setNameInput:t.setNameInput,startEditingName:s.startEditingName}}function es(t,s){return{editingGithub:t.editingGithub,githubError:t.githubError,githubInput:t.githubInput,githubUrl:t.githubUrl,handleSaveGithub:s.handleSaveGithub,handleShowGithubToggle:s.handleShowGithubToggle,profileLoading:t.profileLoading,profileSaving:t.profileSaving,setEditingGithub:t.setEditingGithub,setGithubError:t.setGithubError,setGithubInput:t.setGithubInput,showGithubOn:t.showGithubOn,startEditingGithub:s.startEditingGithub}}function ts(t,s){const n=l.useCallback(async()=>{const r=!t.publicProfileOn;await s({enabled:r},{label:"toggle public profile",onSuccess:()=>t.setPublicProfileOn(r)})},[s,t]);return{handleAnonymousToggle:l.useCallback(async()=>{const r=!t.anonymousOn;await s({anonymous:r},{label:"toggle anonymous",onSuccess:()=>t.setAnonymousOn(r)})},[s,t]),handlePublicProfileToggle:n}}function as(t,s,n){const i=l.useCallback(async()=>{const c=t.nameInput.trim().slice(0,50);c&&await s({display_name:c},{label:"save display name",onSuccess:()=>{t.setCustomDisplayName(c),t.setEditingName(!1),n?.()}})},[s,t,n]),r=l.useCallback(()=>{t.setNameInput(t.customDisplayName||t.displayName),t.setEditingName(!0)},[t]);return{handleSaveName:i,startEditingName:r}}function ss(t,s){const n=l.useCallback(async()=>{if(!t.showGithubOn&&!t.githubUrl){t.setEditingGithub(!0),t.setGithubInput(""),t.setGithubError(null);return}const c=!t.showGithubOn;await s({show_github_url:c},{label:"toggle GitHub profile",onSuccess:()=>t.setShowGithubOn(c)})},[s,t]),i=l.useCallback(async()=>{const c=Wa(t.githubInput);if(t.githubInput.trim()&&!c){t.setGithubError(a("settings.account.githubUrlInvalid"));return}t.setGithubError(null),await s({github_url:c,show_github_url:!!c},{label:"save GitHub profile",onError:g=>t.setGithubError(g?.message||a("settings.account.githubUrlInvalid")),onSuccess:g=>{t.setGithubUrl(g?.github_url||c||""),t.setShowGithubOn(!!c),t.setEditingGithub(!1)}})},[s,t]),r=l.useCallback(()=>{t.setGithubInput(t.githubUrl),t.setGithubError(null),t.setEditingGithub(!0)},[t]);return{handleSaveGithub:i,handleShowGithubToggle:n,startEditingGithub:r}}function ke(){const t=mt();l.useSyncExternalStore(gt,pt,()=>0);const s=ht(t.user?.id),i=!(s.membership?.status==="self_hosted"||s.catalog?.policy?.hosting_mode==="self_hosted")&&(ft()||s.membership?.hosting_mode==="hosted"),r=Za(t.user),c=Ya(t.getAccessToken,t.enabled,t.signedIn,t.user?.id);Ja(t.getAccessToken,t.signedIn&&i,r.loadSetters);const g=Qa(t.getAccessToken,r,i),o=ts(r,g),d=as(r,g,t.refreshDisplayName),y=ss(r,g);return{...t,...c,email:r.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:r.userId,name:Xa(r,{...o,...d}),github:es(r,y),profileLoading:r.profileLoading,profileSaving:r.profileSaving,publicProfileOn:i&&r.publicProfileOn,publicProfileAvailable:i}}function nt({disabled:t,onCancel:s,onSave:n,saveLabel:i=a("settings.account.save")}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:n,disabled:t,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function ns({nameInput:t,setEditingName:s,setNameInput:n,profileSaving:i,handleSaveName:r}){return e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("input",{type:"text",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>{c.key==="Enter"&&r(),c.key==="Escape"&&s(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),e.jsx(nt,{disabled:i||!t.trim(),onCancel:()=>s(!1),onSave:r,saveLabel:i?a("settings.account.saving"):void 0})]})}function is({githubError:t,githubInput:s,handleSaveGithub:n,profileSaving:i,setEditingGithub:r,setGithubError:c,setGithubInput:g}){return e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:s,onChange:o=>{g(o.target.value),t&&c(null)},onKeyDown:o=>{o.key==="Enter"&&n(),o.key==="Escape"&&(r(!1),c(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),e.jsx(nt,{disabled:i,onCancel:()=>{r(!1),c(null)},onSave:n,saveLabel:i?a("settings.account.saving"):void 0})]}),t?e.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:t}):null]})}function it({disabled:t=!1,label:s,onClick:n,title:i}){return e.jsxs("button",{type:"button",onClick:n,disabled:t,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),s]})}function rt({actions:t,editing:s,editor:n,hint:i,label:r}){return e.jsx("div",{className:"py-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:r}),s?n:e.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),s?null:t]})})}function rs({name:t}){const s=t.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(it,{disabled:t.anonymousOn,label:a("settings.account.edit"),onClick:t.startEditingName,title:s}),e.jsx(D,{checked:!t.anonymousOn,onChange:t.handleAnonymousToggle,disabled:t.profileLoading||t.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function os({name:t}){const{anonymousOn:s,customDisplayName:n,displayName:i,editingName:r,handleAnonymousToggle:c,handleSaveName:g,nameInput:o,profileLoading:d,profileSaving:y,setEditingName:p,setNameInput:u,startEditingName:x}=t,v=s?a("settings.account.displayNameAnonymousHint"):n||i;return e.jsx(rt,{label:a("settings.account.displayName"),editing:r,hint:v,editor:e.jsx(ns,{nameInput:o,setEditingName:p,setNameInput:u,profileSaving:y,handleSaveName:g}),actions:e.jsx(rs,{name:t})})}function ls({github:t}){const{editingGithub:s,githubError:n,githubInput:i,githubUrl:r,handleSaveGithub:c,handleShowGithubToggle:g,profileLoading:o,profileSaving:d,setEditingGithub:y,setGithubError:p,setGithubInput:u,showGithubOn:x,startEditingGithub:v}=t;return e.jsx(e.Fragment,{children:e.jsx(rt,{label:a("settings.account.githubUrl"),editing:s,hint:r||a("settings.account.githubUrlHint"),editor:e.jsx(is,{githubError:n,githubInput:i,handleSaveGithub:c,profileSaving:d,setEditingGithub:y,setGithubError:p,setGithubInput:u}),actions:e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(it,{label:a("settings.account.edit"),onClick:v}),e.jsx(D,{checked:x,onChange:g,disabled:o||d,ariaLabel:a("settings.account.githubUrl")})]})})})}function cs(){const{openLoginModal:t}=Fe();return e.jsx(V,{title:a("settings.section.account"),children:e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),e.jsx("button",{type:"button",onClick:t,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function ds({name:t,github:s}){return e.jsxs(e.Fragment,{children:[e.jsx(os,{name:t}),e.jsx(ls,{github:s})]})}function us({settings:t}={}){return t?e.jsx(ot,{settings:t}):e.jsx(ms,{})}function ms(){const t=ke();return e.jsx(ot,{settings:t})}function ot({settings:t}){return t.enabled?t.signedIn?e.jsxs(V,{title:a("settings.section.account"),subtitle:t.email||t.name.customDisplayName||t.name.displayName,action:e.jsx(ps,{onSignOut:t.signOut}),children:[e.jsx(gs,{userId:t.userId}),e.jsx(hs,{checked:t.publicProfileOn,disabled:t.profileLoading||t.profileSaving||t.publicProfileAvailable===!1,onChange:t.handlePublicProfileToggle,unavailable:t.publicProfileAvailable===!1}),e.jsx(fs,{visible:t.publicProfileOn,name:t.name,github:t.github})]}):e.jsx(cs,{}):null}function gs({userId:t}){const[s,n]=fe.useState(!1);if(!t)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(t),n(!0),globalThis.setTimeout(()=>n(!1),1200)}catch{n(!1)}};return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t})]}),e.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[s?e.jsx(fa,{className:"h-3.5 w-3.5","aria-hidden":!0}):e.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0}),s?a("settings.account.copied"):a("settings.account.copy")]})]})}function ps({onSignOut:t}){return e.jsxs("button",{type:"button",onClick:()=>t(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[e.jsx(Ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function hs({checked:t,disabled:s,onChange:n,unavailable:i}){return e.jsx(E,{label:a("settings.account.publicProfile"),hint:a(i?"cloud.self_host.public_profile_disabled":"settings.account.publicProfileHint"),control:e.jsx(D,{checked:t,onChange:n,disabled:s,ariaLabel:a("settings.account.publicProfile")})})}function fs({visible:t,name:s,github:n}){return e.jsx(Ye,{initial:!1,children:t?e.jsx(qe.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:e.jsx(ds,{name:s,github:n})},"public-profile-fields"):null})}function ae(t){return t.replace(/[\t\n\r\f\v -]/g,"").toUpperCase()}function xs({account:t,auth:s,refresh:n,compact:i=!1,panelContainer:r=null,layout:c="default",dialogOpen:g,onDialogOpenChange:o}){const d=c==="settings-row",[y,p]=l.useState(!1),u=d&&typeof g=="boolean"?g:y,[x,v]=l.useState(""),[N,j]=l.useState(!1),[h,m]=l.useState(null),[k,C]=l.useState(null),[f,S]=l.useState(!1),_=l.useId(),w=l.useRef(null),A=l.useRef(null),T=l.useRef(!1),b=l.useRef(!1),P=l.useRef(0),U=`${jt()}.${t?.environment||"unknown"}.${s?.signedIn?s.user?.id:""}`,F=l.useRef(U);F.current=U,l.useEffect(()=>(b.current=!0,P.current+=1,A.current=null,T.current=!1,p(!1),v(""),j(!1),m(null),C(null),S(!1),()=>{b.current=!1,P.current+=1}),[U]);const K=t?.membership?.status==="self_hosted"||t?.membership?.hosting_mode==="self_hosted",$=t?.gift_redemption_available===!0,Z=d?t?.gifts||[]:[];if(!s?.signedIn||K||!$&&!Z.length)return null;const J=t.redemption_restriction,re=O=>{!O&&T.current||(typeof g!="boolean"&&p(O),o?.(O))},L=async(O,oe)=>{const le=await n();oe()&&S(!!le?.gifts?.some(H=>H.id===O?.id))},ee=async O=>{if(T.current||O&&(!$||!x.trim()))return;if(O&&J){m(new ue(J));return}T.current=!0;const oe=++P.current,le=U,H=()=>b.current&&P.current===oe&&F.current===le;j(!0),m(null);try{if(O){const te=x.trim();(!A.current||ae(A.current.code)!==ae(te))&&(A.current={code:te,request_id:crypto.randomUUID()});const ce=await Y("redeem-gift",{auth:async()=>{const ut=await Nt(s.getAccessToken);if(!H())throw new ue("authentication_required",401);return ut},body:A.current});if(!H())return;if(!ce?.gift?.id)throw new ue("billing_operation_failed");C(ce),S(!1),v(""),A.current=null,await L(ce.gift,H)}else await L(k?.gift,H)}catch(te){H()&&m(te)}finally{H()&&(T.current=!1,j(!1))}};let Q=null;return(d||u)&&(Q=e.jsxs("div",{id:`${_}-panel`,className:d?"space-y-3":i?"w-full space-y-3 rounded-lg bg-oai-gray-50 p-4 dark:bg-oai-gray-950/50":"mt-3 space-y-3",children:[$?e.jsxs(e.Fragment,{children:[e.jsx("p",{id:`${_}-detail`,className:d?"sr-only":"text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:a("cloud.gift.detail")}),k?e.jsxs("div",{role:"status",className:"space-y-2 text-sm leading-6",children:[e.jsx("p",{children:a(f?k.already_redeemed?"cloud.gift.already_redeemed":"cloud.gift.redeemed":"cloud.gift.refresh_needed")}),k.gift?e.jsx("p",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:a("cloud.gift.term",{days:k.gift.duration_days,start:G(k.gift.starts_at),end:G(k.gift.ends_at)})}):null,f?e.jsx(R,{type:"button",variant:"ghost",onClick:()=>{C(null),S(!1)},children:a("cloud.gift.redeem_another")}):e.jsx(R,{type:"button",variant:"secondary",disabled:N,onClick:()=>{ee(!1)},children:a("cloud.action.refresh_membership")})]}):e.jsxs("form",{onSubmit:O=>{O.preventDefault(),ee(!0)},"aria-busy":N,children:[e.jsx("label",{htmlFor:_,className:d?"sr-only":"text-sm font-medium",children:a("cloud.gift.code_label")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{id:_,ref:w,value:x,disabled:N,maxLength:128,autoComplete:"off",spellCheck:!1,autoCapitalize:"characters","data-ph-no-capture":"true","aria-describedby":`${_}-detail${h?` ${_}-error`:""}`,"aria-invalid":!!h,onChange:O=>{ae(O.target.value)!==ae(x)&&(A.current=null),v(O.target.value),m(null)},className:"min-h-10 min-w-0 flex-1 rounded-md border border-oai-gray-300 bg-transparent px-3 font-mono text-sm outline-none focus:border-oai-brand focus:ring-2 focus:ring-inset focus:ring-oai-brand/30 dark:border-oai-gray-700"}),e.jsx(R,{type:"submit",variant:"secondary",disabled:N||!x.trim(),children:a(N?"cloud.gift.redeeming":"cloud.gift.confirm")})]})]}),h?e.jsx("div",{id:`${_}-error`,children:["gift_checkout_pending","gift_requires_renewal_cancel"].includes(h.code)?e.jsx("p",{role:"alert",className:"text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:kt(h,"gift")}):e.jsx(z,{error:h,context:"gift"})}):null]}):null,Z.length?e.jsx("ul",{"aria-label":a("cloud.gift.history_title"),className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:Z.map(O=>e.jsxs("li",{className:"py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[e.jsx("span",{children:a("cloud.gift.duration",{days:O.duration_days})}),e.jsx("span",{children:a(["active","pending","expired","revoked"].includes(O.state)?`cloud.gift.state_${O.state}`:"cloud.status.unknown")})]}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:a("cloud.history.term",{start:G(O.starts_at),end:G(O.ends_at)})})]},O.id))}):null]})),d?e.jsx(We,{open:u,onOpenChange:re,title:a($?"cloud.gift.redeem_action":"cloud.gift.history_title"),icon:Re,preventClose:N,initialFocus:$&&!k?w:void 0,children:Q}):e.jsxs("div",{className:d?void 0:i?"contents":"mt-4",children:[e.jsxs(R,{type:"button",variant:"ghost",size:i||d?"sm":"md",className:d?"!h-11 !w-full !justify-start !px-0 !text-oai-black dark:!text-oai-white hover:!bg-oai-gray-100 dark:hover:!bg-oai-gray-800 active:!scale-100":i?"!h-10 !px-0":void 0,"aria-expanded":u,"aria-controls":d||u?`${_}-panel`:void 0,onClick:()=>p(O=>!O),disabled:N,children:[i||d?e.jsx(Re,{size:16,className:`${d?"mr-3":"mr-2"} shrink-0`,"aria-hidden":!0}):null,a($?"cloud.gift.redeem_action":"cloud.gift.history_title"),d?e.jsx(ja,{size:16,className:`ml-auto shrink-0 transition-transform motion-reduce:transition-none ${u?"rotate-180":""}`,"aria-hidden":!0}):null]}),!d&&r&&Q?wt.createPortal(Q,r):Q]})}function bs({text:t,label:s}){const[n,i]=l.useState(!1);return e.jsxs(Na,{open:n,onOpenChange:i,children:[e.jsx(_a,{delay:0,closeOnClick:!1,"aria-label":s,onClick:()=>i(!0),className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",children:e.jsx(Ze,{size:14,"aria-hidden":!0})}),e.jsx(Sa,{children:e.jsx(Ca,{side:"bottom",sideOffset:6,className:"z-[110]",children:e.jsx(Ea,{role:"tooltip",className:"max-w-[min(320px,calc(100vw-2rem))] rounded-lg border border-oai-gray-200 bg-white px-3 py-2 text-xs leading-5 text-oai-gray-600 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-300",children:t})})})]})}function ys(t){return typeof t!="string"||!t.trim()?a("cloud.devices.platform_unknown"):/^(mac|darwin)/i.test(t)?a("leaderboard.community.modal.platform.darwin"):/^win/i.test(t)?a("leaderboard.community.modal.platform.win32"):/^linux/i.test(t)?a("leaderboard.community.modal.platform.linux"):t}function vs(t,s){if(!t)return null;const n=t.status==="active"&&t.access_source==="gift";if(s&&Number.isFinite(Date.parse(s))){const i=t.status==="transition"?"cloud.membership.transition_until":t.status==="trial"?"cloud.membership.trial_until":t.status==="active"?n?"cloud.membership.gift_until":"cloud.membership.active_until":t.status==="expired"&&Date.parse(s)<=Date.now()?"cloud.membership.expired_on":null;if(i)return a(i,{date:G(s)})}return n?a("cloud.gift.membership_label"):Pt(t.status)}function js({auth:t,machineLimit:s,accountRevision:n,selfHosted:i=!1}){const[r,c]=l.useState(null),[g,o]=l.useState(null),[d,y]=l.useState(null),[p,u]=l.useState(!1),[x,v]=l.useState(null),N=l.useRef(!1),j=l.useRef(0),h=l.useRef(!0),m=t?.user?.id,k=t?.getAccessToken,C=l.useCallback(async()=>{const b=++j.current;try{let P;if(ze())try{const F=await Ot(),K=await fetch("/functions/tokentracker-machine-id",{headers:F});K.ok&&(P=(await K.json())?.machineId)}catch{}const U=await Y("devices",{auth:k,params:P?{current_machine_id:P}:{}});b===j.current&&(c(U),o(null))}catch(P){b===j.current&&o({...P,code:"billing_devices_unavailable"})}},[k,m]);l.useEffect(()=>(h.current=!0,C(),()=>{h.current=!1,j.current+=1}),[C,n]);const f=async b=>{if(!N.current){N.current=!0,u(!0),o(null),v(null);try{if(await Y("remove-device",{auth:k,body:{machine_id:b}}),!h.current)return;r?.machines?.find(P=>P.machine_id===b)?.is_current&&Se(),y(null),await C()}catch(P){h.current&&o(P)}finally{N.current=!1,u(!1)}}},S=async b=>{if(!N.current){N.current=!0,u(!0),o(null),v(null);try{if(await Y("resume-device",{auth:k,body:{machine_id:b.machine_id}}),!h.current)return;b.is_current&&Se(),v(a("cloud.devices.resumed")),await C()}catch(P){h.current&&o(P)}finally{N.current=!1,u(!1)}}},_=r?.machines||[],w=r?.machine_count??_.filter(b=>b.status!=="paused").length,A=r?.machine_limit??s,T=A==null||w<A;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:a("cloud.devices.title")}),e.jsx(bs,{label:a("cloud.devices.detail"),text:a("cloud.devices.detail")})]}),e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:r?A==null?a(i?"cloud.devices.unlimited_self_hosted":"cloud.devices.unlimited",{count:w}):a("cloud.devices.count",{count:w,limit:A}):g?a("cloud.devices.count_unknown"):a("cloud.catalog.loading")})]}),r?.over_machine_limit||A!=null&&A<w?e.jsx("div",{className:"mb-4",children:e.jsx(z,{children:a("cloud.devices.over_limit")})}):null,g?e.jsx(z,{error:g,onRetry:C,context:"account"}):null,x?e.jsx("div",{className:"mb-3",children:e.jsx(z,{children:x})}):null,!g&&r&&_.length===0?e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.devices.empty")}):null,_.length!==0?e.jsx("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:_.map(b=>e.jsxs("li",{className:"py-1.5",children:[e.jsxs("div",{className:"grid grid-cols-[17px_minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1",children:[e.jsx(ye,{size:17,className:"col-start-1 row-start-1 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{title:b.name||a("cloud.devices.unnamed"),className:"col-start-2 row-start-1 min-w-0 truncate text-sm font-medium",children:b.name||a("cloud.devices.unnamed")}),e.jsxs("div",{className:"col-span-2 col-start-2 row-start-2 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 sm:col-span-1 sm:col-start-2",children:[e.jsx("span",{children:ys(b.platform)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:b.last_seen_at?a("cloud.devices.last_seen",{date:At(b.last_seen_at)}):a("cloud.devices.last_seen_unknown")}),b.is_current?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:a("cloud.devices.current")})]}):null,b.status==="paused"?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:a("cloud.devices.paused")})]}):null]}),b.status==="paused"&&!T?e.jsx("p",{className:"col-start-2 row-start-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.devices.no_slot")}):null,e.jsxs(R,{variant:"ghost",size:"sm",className:"col-start-3 row-start-1 !min-h-10 !px-2 sm:row-span-2","aria-expanded":b.status!=="paused"?d===b.machine_id:void 0,"aria-controls":d===b.machine_id?`cloud-machine-confirm-${b.machine_id}`:void 0,onClick:()=>b.status==="paused"?S(b):y(P=>P===b.machine_id?null:b.machine_id),disabled:p||b.status==="paused"&&!T,children:[b.status==="paused"?e.jsx(ka,{size:14,className:"mr-1.5 shrink-0","aria-hidden":!0}):e.jsx(wa,{size:14,className:"mr-1.5 shrink-0","aria-hidden":!0}),b.status==="paused"?a("cloud.devices.resume"):a("cloud.devices.remove")]})]}),d===b.machine_id?e.jsxs("div",{id:`cloud-machine-confirm-${b.machine_id}`,className:"mt-3 rounded-lg bg-oai-gray-50 p-3 dark:bg-oai-gray-800",children:[e.jsx("p",{className:"text-xs leading-5",children:a("cloud.devices.remove_detail")}),e.jsxs("div",{className:"mt-3 flex gap-2",children:[e.jsx(R,{variant:"secondary",onClick:()=>f(b.machine_id),disabled:p,children:a("cloud.devices.confirm_remove")}),e.jsx(R,{variant:"ghost",onClick:()=>y(null),disabled:p,children:a("cloud.action.keep")})]})]}):null]},b.machine_id))}):null]})}function ks({recent:t,pendingOrders:s,conflictOrders:n,userId:i,payments:r=[],footerActions:c}){const g=He(),[o,d]=l.useState(t?.order_id&&ge.test(t.order_id)?t.order_id:""),[y,p]=l.useState(!1),[u,x]=l.useState(!1),v=l.useId(),N=l.useRef(null);l.useEffect(()=>{u&&N.current?.focus()},[u]);const j=new Set([...r.map(m=>m.order_id).filter(m=>typeof m=="string"),...(s||[]).filter(m=>m.status==="paid"||["paid","partially_refunded","refunded"].includes(m.payment_state)).map(m=>m.id)].map(m=>m.toLowerCase())),h=[...n||[],...(s||[]).filter(m=>m.retry_payment_conflict_at||!j.has(m.id.toLowerCase()))].filter((m,k,C)=>C.findIndex(f=>f.id===m.id)===k);return e.jsxs("div",{className:"mt-2 space-y-3",children:[t?.request_id&&!t.order_id?e.jsx(ne,{to:`/billing/checkout?sku=${encodeURIComponent(t.sku)}`,className:"mt-3 inline-flex min-h-10 items-center text-sm text-oai-brand underline underline-offset-4",children:a("cloud.action.resume_purchase")}):null,h.length||r.length?e.jsxs("div",{className:"sm:grid sm:grid-cols-[minmax(0,1fr)_auto_minmax(7rem,auto)] sm:gap-x-4",children:[e.jsxs("div",{"aria-hidden":!0,className:"hidden gap-x-4 pb-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 sm:col-span-3 sm:grid sm:grid-cols-subgrid",children:[e.jsx("span",{children:a("cloud.history.date")}),e.jsx("span",{className:"text-right",children:a("cloud.history.amount")}),e.jsx("span",{className:"text-right",children:a("cloud.history.status")})]}),e.jsxs("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800 sm:col-span-3 sm:grid sm:grid-cols-subgrid",children:[h.map(m=>{const k=typeof m.created_at=="string"&&Number.isFinite(Date.parse(m.created_at))?G(m.created_at):null;let C=null;Number.isInteger(m.amount_cents)&&m.amount_cents>=0&&["USD","CNY"].includes(m.currency)&&(C=xe(m.amount_cents,m.currency));const f=a(m.retry_payment_conflict_at?"cloud.action.review_duplicate_payment":"cloud.history.pending");return e.jsxs("li",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-1 py-3 sm:col-span-3 sm:grid-cols-subgrid",children:[e.jsx("p",{className:"col-start-1 row-start-1 text-sm tabular-nums",children:k||f}),e.jsx("p",{className:"col-start-2 row-start-1 text-right text-sm font-medium tabular-nums",children:C}),m.provider||k?e.jsxs("div",{className:"col-start-1 row-start-2 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[m.provider?e.jsx("span",{children:Be(m.provider)}):null,k?e.jsxs(e.Fragment,{children:[m.provider?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,e.jsx("span",{children:f})]}):null]}):null,e.jsx(ne,{to:`/billing/checkout?order=${encodeURIComponent(m.id)}`,onClick:S=>{m.retry_payment_conflict_at||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey||!ge.test(m.id)||(S.preventDefault(),g(_e({orderId:m.id,userId:i})))},className:"col-start-2 row-start-2 inline-flex min-h-10 items-center justify-end rounded-sm text-right text-sm underline-offset-4 hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 sm:col-start-3 sm:row-span-2 sm:row-start-1 sm:self-start sm:items-start",children:e.jsx("span",{children:m.retry_payment_conflict_at?a("cloud.action.review_duplicate_payment"):a("cloud.action.resume_order")})})]},m.id)}),e.jsx(ws,{payments:r})]})]}):e.jsx(e.Fragment,{children:(!t?.request_id||t.order_id)&&e.jsx("p",{className:"py-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.history.empty")})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1",children:[e.jsx(R,{variant:"ghost",size:"sm",className:"!h-10 !px-0","aria-expanded":u,"aria-controls":`${v}-panel`,onClick:()=>x(m=>!m),children:a("cloud.restore.title")}),c]}),u?e.jsxs("div",{id:`${v}-panel`,className:"mt-2",children:[e.jsx("p",{className:"text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.restore.detail")}),e.jsxs("form",{className:"mt-4",onSubmit:m=>{if(m.preventDefault(),!ge.test(o.trim())){p(!0);return}const k=o.trim(),C=h.some(f=>f.id.toLowerCase()===k.toLowerCase()&&f.retry_payment_conflict_at);g(C?`/billing/checkout?order=${encodeURIComponent(k)}`:_e({orderId:k,userId:i}))},children:[e.jsx("label",{htmlFor:`${v}-input`,className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.checkout.order_id")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{id:`${v}-input`,ref:N,value:o,onChange:m=>{d(m.target.value),p(!1)},placeholder:a("cloud.restore.placeholder"),className:"min-h-10 min-w-0 flex-1 rounded-md border border-oai-gray-300 bg-transparent px-3 text-sm outline-none focus:border-oai-brand focus:ring-2 focus:ring-inset focus:ring-oai-brand/30 dark:border-oai-gray-700","aria-invalid":y,"aria-describedby":y?`${v}-error`:void 0}),e.jsx(R,{type:"submit",variant:"secondary",children:a("cloud.action.restore")})]}),y?e.jsx("p",{id:`${v}-error`,role:"alert",className:"mt-2 text-xs text-red-600 dark:text-red-400",children:a("cloud.restore.invalid")}):null]})]}):null]})]})}function ws({payments:t}){return e.jsx(e.Fragment,{children:t.map(s=>e.jsxs("li",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-1 py-3 sm:col-span-3 sm:grid-cols-subgrid",children:[e.jsx("p",{className:"col-start-1 row-start-1 text-sm tabular-nums",children:G(s.paid_at)}),e.jsx("p",{className:"col-start-2 row-start-1 text-right text-sm font-medium tabular-nums",children:xe(s.amount_cents,s.currency)}),e.jsxs("div",{className:"col-start-1 row-start-2 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:Be(s.provider)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:a("cloud.history.term",{start:G(s.starts_at),end:G(s.ends_at)})})]}),e.jsx("p",{className:`col-start-2 row-start-2 text-right text-sm font-medium sm:col-start-3 sm:row-span-1 sm:row-start-1 sm:self-start ${s.refunded_cents>0?"text-amber-700 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-300"}`,children:s.refunded_cents>0?a("cloud.history.refunded",{amount:xe(s.refunded_cents,s.currency)}):a("cloud.history.paid")})]},s.id))})}function Ns({showTitle:t=!0,heading:s,syncControl:n,active:i=!0}){const r=_t();return e.jsx(_s,{showTitle:t,heading:s,syncControl:n,active:i,...r},r.auth?.signedIn?r.auth.user?.id:"signed-out")}function _s({account:t,auth:s,loading:n,error:i,refresh:r,showTitle:c,heading:g,syncControl:o,active:d=!0}){const{openLoginModal:y}=Fe(),[p,u]=l.useState(null),[x,v]=l.useState(null),[N,j]=l.useState(!1),[h,m]=l.useState(null),k=l.useRef(!1),C=l.useRef(!0);l.useEffect(()=>{d||u(null)},[d]),l.useEffect(()=>(C.current=!0,()=>{C.current=!1}),[]);const f=t?.membership,S=f?.status==="self_hosted"||f?.hosting_mode==="self_hosted",_=[...t?.conflict_orders||[],...t?.pending_orders||[]].some(L=>L.retry_payment_conflict_at),w=!S&&t?.subscriptions?.find(L=>["active","trialing","past_due","paused","canceling"].includes(L.status)),A=!S&&(w?w.provider==="waffo":t?.payments?.some(L=>L.provider==="waffo")),T=w&&!w.cancel_at_period_end&&w.status!=="canceling",b=T&&w.status!=="paused",P=w?.next_billed_at,U=P&&Number.isFinite(Date.parse(P));l.useEffect(()=>{h&&t&&!T&&(m(null),v(null))},[t,h,T]);const F=S?null:f?.status==="trial"?f.trial_ends_at:f?.status==="transition"?f.transition_ends_at:f?.expires_at,K=async L=>{if(!k.current){k.current=!0,j(!0),v(null);try{await L()}catch(ee){C.current&&v(ee)}finally{k.current=!1,j(!1)}}},$=()=>K(async()=>{const L=await Y("portal",{auth:s.getAccessToken,body:w?{subscription_id:w.provider_subscription_id}:{}});C.current&&await va(L.url||L.portal_url)}),Z=()=>K(async()=>{await Y("cancel",{auth:s.getAccessToken,body:{subscription_id:h}}),C.current&&(m(null),await r())}),J=vs(f,F),re=A&&!w||f?.can_read_cloud||!S&&t?.gift_redemption_available===!0;return s?.signedIn?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("section",{"aria-label":a("cloud.membership.title"),className:"tt-cloud-theme space-y-3",children:[t?.environment==="sandbox"?e.jsx(z,{children:a("cloud.catalog.sandbox")}):null,_?e.jsx(St,{showBillingLink:!1}):null,e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-2",children:[g?e.jsx("h2",{className:"shrink-0 !text-2xl font-semibold",children:g}):null,!g&&c?e.jsxs("h2",{className:"inline-flex items-center gap-2 text-base font-semibold",children:[e.jsx(se,{size:18,className:"text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),a("cloud.membership.title")]}):null,J?e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:J}):null]}),e.jsx(R,{onClick:r,variant:"ghost",size:"sm",className:"!size-10 shrink-0 !p-0",disabled:n,"aria-label":a("cloud.action.refresh_membership"),children:e.jsx(be,{size:15,className:n?"motion-safe:animate-spin":void 0,"aria-hidden":!0})})]}),f?.status==="expired"?e.jsx("p",{className:"mt-3 max-w-2xl text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:f.can_read_cloud?a("cloud.membership.read_only",{date:G(f.read_only_until)}):a("cloud.membership.expired_detail")}):null,f?e.jsx(Ct,{userId:s.user?.id,membership:f,subscriptions:t?.subscriptions,className:"mt-3"}):null,!f&&n?e.jsx("p",{role:"status",className:"mt-3 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("cloud.catalog.loading")}):null,w?e.jsx("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:w?e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx("p",{className:"text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:w.status==="paused"?a("cloud.membership.renewal_paused"):w.status==="past_due"?a("cloud.membership.payment_due"):b?U?a("cloud.membership.renews",{date:G(P)}):a("cloud.membership.renewal_unknown"):a("cloud.membership.renewal_off")}),T?e.jsx(R,{"aria-expanded":!!h,"aria-controls":h?"cloud-cancel-confirm":void 0,onClick:()=>m(L=>L===w.provider_subscription_id?null:w.provider_subscription_id),variant:"ghost",size:"sm",className:"!h-10 !px-2",disabled:N,children:a("cloud.action.cancel_renewal")}):null]}):null}):null,h?e.jsxs("div",{id:"cloud-cancel-confirm",className:"mt-4 rounded-lg border border-oai-gray-200 p-4 dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm leading-6",children:F?a("cloud.cancel.detail",{date:G(F)}):a("cloud.cancel.no_term")}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(R,{onClick:Z,variant:"secondary",disabled:N,children:a("cloud.cancel.confirm")}),e.jsx(R,{onClick:()=>m(null),variant:"ghost",disabled:N,children:a("cloud.action.keep")})]})]}):null,i?e.jsx("div",{className:"mt-4",children:e.jsx(z,{error:i,onRetry:r,context:"account"})}):null,x&&p!=="billing"?e.jsx("div",{className:"mt-4",children:e.jsx(z,{error:x,context:"account"})}):null]})]}),f?e.jsx(pe,{className:"tt-cloud-theme !rounded-lg",bodyClassName:"!py-3",children:e.jsx(js,{auth:s,machineLimit:f.machine_limit,accountRevision:t,selfHosted:S})}):null,re||t&&!S||o?e.jsx(pe,{className:"tt-cloud-theme !rounded-lg",bodyClassName:"!py-2",children:e.jsxs("section",{"aria-label":a("cloud.membership.tools_title"),className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:[S?null:w?e.jsxs("button",{type:"button",onClick:$,disabled:N,className:"inline-flex h-11 w-full items-center gap-3 rounded-md border-0 bg-transparent p-0 text-left text-sm font-medium text-oai-black transition-colors hover:bg-oai-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-oai-gray-500 disabled:opacity-50 dark:text-oai-white dark:hover:bg-oai-gray-800",children:[e.jsx(se,{size:16,className:"shrink-0","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1",children:a("cloud.action.manage_subscription")}),e.jsx(De,{size:16,className:"shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}):e.jsxs(ne,{to:"/cloud",className:"inline-flex h-11 w-full items-center gap-3 rounded-md border-0 bg-transparent p-0 text-left text-sm font-medium text-oai-black transition-colors hover:bg-oai-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-oai-gray-500 dark:text-oai-white dark:hover:bg-oai-gray-800",children:[e.jsx(se,{size:16,className:"shrink-0","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1",children:a("cloud.action.subscribe")}),e.jsx(Et,{size:16,className:"shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),t&&!S?e.jsxs(We,{open:p==="billing",onOpenChange:L=>u(L?"billing":null),title:a("cloud.billing.title"),icon:Ra,wide:!0,children:[x?e.jsx("div",{className:"mb-3",children:e.jsx(z,{error:x,context:"account"})}):null,e.jsx(ks,{userId:s.user?.id,recent:ya(s.user?.id),pendingOrders:t?.pending_orders,conflictOrders:t?.conflict_orders,payments:t.payments,footerActions:A&&!w?e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsxs(R,{onClick:$,variant:"ghost",size:"sm",className:"!h-10 !px-0",disabled:N,children:[a("cloud.action.view_bills"),e.jsx(De,{size:14,className:"ml-2","aria-hidden":!0})]})}):null})]}):null,f?.can_read_cloud?e.jsx(ga,{auth:s,layout:"settings-row",dialogOpen:p==="export",onDialogOpenChange:L=>u(L?"export":null)}):null,e.jsx(xs,{account:t,auth:s,refresh:r,layout:"settings-row",dialogOpen:p==="redeem",onDialogOpenChange:L=>u(L?"redeem":null)}),o?e.jsx("section",{children:o}):null]})}):null]}):e.jsxs("div",{className:"space-y-4",children:[g?e.jsx("h2",{className:"shrink-0 !text-2xl font-semibold",children:g}):null,e.jsxs(pe,{className:"tt-cloud-theme",children:[!g&&c?e.jsx("h2",{className:"text-base font-semibold",children:a("cloud.membership.title")}):null,e.jsx("p",{className:`${!g&&c?"mt-2 ":""}text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400`,children:a("cloud.membership.signed_out")}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:e.jsx(R,{onClick:()=>y({subtitle:a("cloud.membership.signed_out")}),children:a("cloud.action.sign_in_continue")})})]})]})}function Ss({settings:t,active:s=!0}={}){return t?e.jsx(lt,{settings:t,active:s}):e.jsx(Cs,{active:s})}function Cs({active:t}){const s=ke();return e.jsx(lt,{settings:s,active:t})}function lt({settings:t,active:s}){return e.jsx(Ns,{showTitle:!1,heading:a("settings.section.cloud"),active:s,syncControl:t.showLocalCloudSync?e.jsx(Es,{settings:t}):null})}function Es({settings:t}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-3 text-sm font-medium",children:[e.jsx(be,{size:16,className:"shrink-0","aria-hidden":!0}),a("settings.account.cloudSync")]}),e.jsx("span",{className:"tt-cloud-theme tt-cloud-sync-control inline-flex","aria-busy":t.cloudSyncPending||void 0,children:e.jsx(D,{checked:t.cloudSyncOn,disabled:t.cloudSyncPending,onChange:()=>(t.cloudSyncOn?Ce(t.userId):Lt(t.userId,"sync"),t.handleCloudSyncToggle()),ariaLabel:a("settings.account.cloudSync")})})]}),t.cloudSyncOn&&t.cloudSyncPending?e.jsxs("p",{role:"status",className:"flex items-center gap-2 py-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(Pa,{size:14,className:"motion-safe:animate-spin","aria-hidden":!0}),a("settings.account.cloudSyncPending")]}):null,t.cloudSyncOn&&t.cloudSyncError&&!t.cloudSyncPending?e.jsx("div",{className:"tt-cloud-theme py-3",children:e.jsx(z,{role:"alert",onRetry:t.handleCloudSyncRetry,children:a("settings.account.cloudSyncError")})}):null,e.jsx(Tt,{userId:t.userId,panel:"sync",localHost:!0,className:"py-3",onContinueLocal:()=>{Ce(t.userId),t.cloudSyncOn&&t.handleCloudSyncDisable()}})]})}function Ps(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:Rt},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:Dt},{value:"system",label:a("settings.appearance.theme.system"),Icon:ye}]}function Os(){return[{value:Mt,label:a("settings.appearance.language.system")},{value:$t,label:a("settings.appearance.language.english")},{value:zt,label:a("settings.appearance.language.chinese")},{value:Ft,label:a("settings.appearance.language.traditional_chinese")},{value:Ht,label:a("settings.appearance.language.japanese")},{value:Bt,label:a("settings.appearance.language.korean")},{value:Vt,label:a("settings.appearance.language.german")}]}function As(t){if(!t)return null;try{const s=new Date(t);return Number.isNaN(s.getTime())?null:s.toLocaleString()}catch{return null}}function Ls(t,s){const n=a(`settings.appearance.currency.rate_source.${t}`),i=As(s),r=i?a("settings.appearance.currency.rate_updated",{when:i}):a("settings.appearance.currency.rate_never");return`${n} · ${r}`}function Ts({locale:t,setLocale:s}){const n=Os();return e.jsx(ve,{value:t,onValueChange:s,options:n,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:e.jsx(Ua,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Is({currency:t,setCurrency:s}){const n=Gt().map(i=>({value:i.code,label:a(i.labelKey)}));return e.jsx(ve,{value:t,onValueChange:s,options:n,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Rs({currency:t,rate:s,rateSource:n,rateFetchedAt:i}){if(t===Ut)return e.jsx(e.Fragment,{children:a("settings.appearance.currency.hint")});const r=Ls(n,i);return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:`1 USD = ${s.toFixed(4)} ${t}`}),e.jsx("span",{role:"img","aria-label":r,title:r,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:e.jsx(Ze,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Ds(){const{theme:t,setTheme:s}=It(),{locale:n,setLocale:i}=Ve(),{currency:r,rate:c,rateSource:g,rateFetchedAt:o,setCurrency:d}=Oa(),{mode:y,setMode:p,unitSystem:u,setUnitSystem:x,grouping:v,setGrouping:N}=Aa();return e.jsxs(V,{title:a("settings.section.appearance"),children:[e.jsx(E,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:e.jsx(q,{options:Ps(),value:t,onChange:s})}),e.jsx(E,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:e.jsx(Ts,{locale:n,setLocale:i})}),e.jsx(E,{label:a("settings.appearance.currency.label"),hint:e.jsx(Rs,{currency:r,rate:c,rateSource:g,rateFetchedAt:o}),control:e.jsx(Is,{currency:r,setCurrency:d})}),e.jsx(E,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:e.jsx(q,{options:[{value:me.COMPACT,label:a("settings.appearance.token_format.compact")},{value:me.FULL,label:a("settings.appearance.token_format.full")}],value:y,onChange:p})}),e.jsx(E,{label:a("settings.appearance.token_unit.label"),hint:a("settings.appearance.token_unit.hint"),control:e.jsx(q,{disabled:y!==me.COMPACT,options:[{value:Ee.ENGLISH,label:a("settings.appearance.token_unit.english")},{value:Ee.CHINESE,label:a("settings.appearance.token_unit.chinese")}],value:u,onChange:x})}),e.jsx(E,{label:a("settings.appearance.token_grouping.label"),hint:a("settings.appearance.token_grouping.hint"),control:e.jsx(q,{options:[{value:Pe.THOUSAND,label:a("settings.appearance.token_grouping.thousand")},{value:Pe.WAN,label:a("settings.appearance.token_grouping.wan")}],value:v,onChange:N})})]})}function he({labelKey:t}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:a(t)}),e.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Gs(){const{enabled:t,toggle:s}=pa(),{enabled:n,toggle:i}=ha(),{available:r,settings:c,setSetting:g}=ie(),o=r&&!!c?.dynamicIslandSupported,d=!!c?.dynamicIslandEnabled;return e.jsxs(V,{title:a("settings.section.labs"),children:[o&&e.jsxs(e.Fragment,{children:[e.jsx(E,{label:e.jsx(he,{labelKey:"settings.labs.island.label"}),hint:a("settings.labs.island.hint"),control:e.jsx(D,{checked:d,onChange:()=>g("dynamicIslandEnabled",!d),ariaLabel:a("settings.labs.island.aria")})}),d&&e.jsx(E,{label:a("settings.labs.island_hide_menubar.label"),hint:a("settings.labs.island_hide_menubar.hint"),control:e.jsx(D,{checked:!!c?.hideMenuBarIcon,onChange:()=>g("hideMenuBarIcon",!c?.hideMenuBarIcon),ariaLabel:a("settings.labs.island_hide_menubar.aria")})})]}),e.jsx(E,{label:e.jsx(he,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:e.jsx(D,{checked:t,onChange:s,ariaLabel:a("settings.labs.qpd.aria")})}),e.jsx(E,{label:e.jsx(he,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:e.jsx(D,{checked:n,onChange:i,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Us(){const{available:t,settings:s,setSetting:n,runAction:i}=ie();if(!t)return null;const r=Ke(),c=!!s?.launchAtLogin,g=s?.toastOnReset!==!1,o=s?.confettiOnReset!==!1,d=s?.launchAtLoginSupported!==!1,y=s?.autoUpdateEnabled!==!1,p=s?.updateStatus||null,u=!!s?.updateBusy,x=!!s?.isSyncing;return e.jsxs(V,{title:a("settings.section.menubar"),children:[r?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:e.jsxs(ne,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),e.jsx(Ta,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),e.jsx(E,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:e.jsx(D,{checked:g,onChange:()=>n("toastOnReset",!g),ariaLabel:a("settings.menubar.toastOnReset")})}),e.jsx(E,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:e.jsx(D,{checked:o,onChange:()=>n("confettiOnReset",!o),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),d?e.jsx(E,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:e.jsx(D,{checked:c,onChange:()=>n("launchAtLogin",!c),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,e.jsx(E,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:e.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:x,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(be,{className:B("h-3.5 w-3.5",x&&"animate-spin"),"aria-hidden":!0}),x?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),e.jsx(E,{label:a("settings.menubar.autoUpdate"),hint:a("settings.menubar.autoUpdateHint"),control:e.jsx(D,{checked:y,onChange:()=>n("autoUpdateEnabled",!y),ariaLabel:a("settings.menubar.autoUpdate")})}),e.jsx(E,{label:a("settings.menubar.updates"),hint:p||void 0,control:e.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[e.jsx(Ia,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Ms(t,s){function n(c){return c.replace(/^v/,"").split(".").map(Number)}const i=n(t),r=n(s);for(let c=0;c<Math.max(i.length,r.length);c++){const g=i[c]||0,o=r[c]||0;if(g<o)return!0;if(g>o)return!1}return!1}function $s(){const{available:t,settings:s,runAction:n}=ie(),i=t&&s?.version,r=s?.platform||"macos",[c,g]=fe.useState(!1),[o,d]=fe.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:y}=Ve(),p="1.3.6",u=async()=>{g(!0);try{const h=await fetch("https://api.github.com/repos/xiufengsun/TokenTracker/releases/latest");if(!h.ok)throw new Error("Failed to fetch");const m=await h.json(),k=m.tag_name;Ms(p,k)?d({open:!0,latestVersion:k,htmlUrl:m.html_url}):Oe({title:a("settings.menubar.updates.upToDate")})}catch(h){console.error("Check updates failed:",h),Oe({title:a("settings.menubar.updates.failed")})}finally{g(!1)}},x=a("settings.menubar.updates.modalTitle"),v=a("settings.menubar.updates.modalDescription",{version:o.latestVersion}),N=a("settings.menubar.updates.modalConfirm"),j=a("settings.menubar.updates.modalCancel");return e.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:r==="windows"?a("settings.menubar.updates.footerCore",{version:s.version}):a("settings.menubar.updates.footerCombined",{barVersion:s.version,coreVersion:p})}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:()=>n("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:p})}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("button",{type:"button",onClick:u,disabled:c,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:c?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}),e.jsxs("a",{href:Kt,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[e.jsx(qt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),e.jsx(La,{open:o.open,title:x,description:v,confirmLabel:N,cancelLabel:j,onConfirm:()=>{window.open(o.htmlUrl,"_blank"),d(h=>({...h,open:!1}))},onCancel:()=>d(h=>({...h,open:!1}))})]})}const zs=()=>[{value:"system",label:a("settings.network.mode.system")},{value:"manual",label:a("settings.network.mode.manual")},{value:"off",label:a("settings.network.mode.off")}],Fs=()=>[{value:"http",label:a("settings.network.protocol.http")},{value:"https",label:a("settings.network.protocol.https")},{value:"socks5",label:a("settings.network.protocol.socks5")}],Ge="w-full rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white";function Ue(t){const s={},n=String(t.host||"").trim();(!n||/:\/\//.test(n)||n.includes("/"))&&(s.host=a("settings.network.error.host"));const i=String(t.port??"").trim(),r=Number(i);return(!i||!/^\d+$/.test(i)||!Number.isInteger(r)||r<1||r>65535)&&(s.port=a("settings.network.error.port")),s}function Hs({proxySettings:t}){const{config:s,save:n,testConnection:i}=t,[r,c]=l.useState(()=>({mode:s.mode,protocol:s.protocol||"http",host:s.host||"",port:s.port||""})),[g,o]=l.useState({}),[d,y]=l.useState(!1),[p,u]=l.useState(""),[x,v]=l.useState(null),[N,j]=l.useState(!1),[h,m]=l.useState(null);l.useEffect(()=>{c({mode:s.mode,protocol:s.protocol||"http",host:s.host||"",port:s.port||""})},[s.mode,s.protocol,s.host,s.port]);const k=l.useMemo(()=>s.effective==="manual"?a("settings.network.effective.manual"):s.effective==="env"?a("settings.network.effective.env"):s.effective==="system"?a("settings.network.effective.system"):s.effective==="blocked"?a("settings.network.effective.blocked"):a("settings.network.effective.none"),[s.effective]),C=_=>{c(w=>({...w,..._})),o({}),u(""),v(null),m(null)},f=async()=>{if(r.mode==="manual"){const _=Ue(r);if(Object.keys(_).length){o(_);return}}y(!0),u(""),v(null);try{await n(r),u("saved")}catch(_){u("error"),v(_)}finally{y(!1)}},S=async()=>{const _=Ue(r);if(Object.keys(_).length){o(_);return}j(!0),m(null);try{const w=await i(r);m(w)}catch(w){m({ok:!1,error:w?.message||String(w)})}finally{j(!1)}};return e.jsxs(V,{title:a("settings.section.network"),subtitle:k,children:[s.applyError?e.jsx("p",{role:"alert",className:"mb-3 text-xs text-red-600 dark:text-red-400",children:a("settings.network.apply_error",{error:s.applyError})}):null,e.jsx(E,{label:a("settings.network.mode.label"),hint:a("settings.network.mode.hint"),control:e.jsx(q,{options:zs(),value:r.mode,onChange:_=>C({mode:_})})}),e.jsx(Ye,{initial:!1,children:r.mode==="manual"?e.jsxs(qe.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:[e.jsx(E,{label:a("settings.network.protocol.label"),control:e.jsx(ve,{value:r.protocol,onValueChange:_=>C({protocol:_}),options:Fs(),ariaLabel:a("settings.network.protocol.label"),className:"px-2.5 py-1.5 text-xs font-medium"})}),e.jsx(E,{label:a("settings.network.host.label"),hint:g.host,control:e.jsx("input",{type:"text",value:r.host,onChange:_=>C({host:_.target.value}),placeholder:a("settings.network.host.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":g.host?!0:void 0,"aria-label":a("settings.network.host.label"),className:Ge})}),e.jsx(E,{label:a("settings.network.port.label"),hint:g.port,control:e.jsx("input",{type:"text",inputMode:"numeric",value:r.port,onChange:_=>C({port:_.target.value}),placeholder:a("settings.network.port.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":g.port?!0:void 0,"aria-label":a("settings.network.port.label"),className:Ge})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 py-3",children:[e.jsx("button",{type:"button",onClick:S,disabled:N||d,className:"rounded-md border border-oai-gray-200 px-3 py-1.5 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:N?a("settings.network.test.testing"):a("settings.network.test")}),e.jsx("button",{type:"button",onClick:f,disabled:d||N,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:d?a("settings.network.saving"):a("settings.network.save")})]}),h?e.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:h.ok?a("settings.network.test.ok",{status:String(h.status??"")}):a("settings.network.test.fail",{error:h.error||""})}):null]},"manual-proxy-fields"):e.jsx("div",{className:"flex justify-end py-3",children:e.jsx("button",{type:"button",onClick:f,disabled:d,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:d?a("settings.network.saving"):a("settings.network.save")})},"non-manual-save")}),p==="saved"?e.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.network.saved")}):null,p==="error"?e.jsx("p",{role:"alert",className:"py-2 text-xs text-red-600 dark:text-red-400",children:x?.unprotected?a("settings.network.save_error_unprotected",{error:x?.message||String(x||"")}):a("settings.network.save_error",{error:x?.message||String(x||"")})}):null]})}const ct="/functions/tokentracker-proxy-config",Bs="/functions/tokentracker-proxy-test",Vs={mode:"system",protocol:"http",host:"",port:"",effective:"none",applyError:null};function dt(t){return!t||typeof t.mode!="string"?null:{mode:t.mode,protocol:typeof t.protocol=="string"?t.protocol:"http",host:typeof t.host=="string"?t.host:"",port:t.port==null||t.port===0?"":String(t.port),effective:typeof t.effective=="string"?t.effective:"none",applyError:typeof t.applyError=="string"&&t.applyError.trim()?t.applyError:null}}async function Ks(){const t=await fetch(ct,{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!t.ok)return null;const s=await t.json().catch(()=>null);return dt(s)}async function Me(){const{getLocalApiAuthHeaders:t}=await Wt(async()=>{const{getLocalApiAuthHeaders:s}=await import("./__vite-browser-external-DWN9Fb-H.js").then(n=>n.dZ);return{getLocalApiAuthHeaders:s}},__vite__mapDeps([0,1]));return t()}function qs(){const[t,s]=l.useState(!1),[n,i]=l.useState(!0),[r,c]=l.useState(Vs);l.useEffect(()=>{if(!ba()){s(!1),i(!1);return}let d=!1;return(async()=>{try{const y=await Ks();if(d)return;if(!y){s(!1),i(!1);return}c(y),s(!0),i(!1)}catch{d||(s(!1),i(!1))}})(),()=>{d=!0}},[]);const g=l.useCallback(async d=>{const y=await Me(),p=await fetch(ct,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...y},cache:"no-store",body:JSON.stringify({mode:d.mode,protocol:d.protocol,host:d.host,port:d.port===""?0:Number(d.port)})}),u=await p.json().catch(()=>null);if(!p.ok){const v=u&&typeof u.error=="string"?u.error:`HTTP ${p.status}`;throw new Error(v)}const x=dt(u);if(x&&c(x),u&&u.ok===!1){const v=u&&typeof u.applyError=="string"&&u.applyError||u&&typeof u.error=="string"&&u.error||`HTTP ${p.status}`,N=new Error(v);throw u.unprotected===!0&&(N.unprotected=!0),N}return x||u},[]),o=l.useCallback(async d=>{const y=await Me(),p=await fetch(Bs,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...y},cache:"no-store",body:JSON.stringify({protocol:d.protocol,host:d.host,port:d.port===""?0:Number(d.port)})}),u=await p.json().catch(()=>null);if(!u||typeof u.ok!="boolean")throw new Error(u&&typeof u.error=="string"?u.error:`HTTP ${p.status}`);return u},[]);return{available:t,loading:n,config:r,save:g,testConnection:o}}const I={APPEARANCE:"appearance",NATIVE_APP:"native-app",NETWORK:"network",ACCOUNT:"account",CLOUD:"cloud",LIMITS:"limits",LABS:"labs"},M={PERSONAL:"personal",APP:"app",DEVELOPER:"developer"};function Ws({prefs:t}){return e.jsx(q,{options:[{value:Ie.USED,label:a("limits.settings.display_mode_used")},{value:Ie.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:t.displayMode,onChange:t.setDisplayMode})}function In(){const t=ke(),s=da(),{available:n,settings:i,setSetting:r}=ie(),c=qs(),{available:g}=c,o=i?.toastOnReset!==!1,d=i?.confettiOnReset!==!1,y=Ke()||i?.platform==="windows",[p,u]=Yt(),x=He(),v=p.get("section"),j=Object.values(I).includes(v)&&(v!==I.NATIVE_APP||n)&&(v!==I.NETWORK||g)?v:I.APPEARANCE,h=f=>{const S=new URLSearchParams(p);f===I.APPEARANCE?S.delete("section"):S.set("section",f),u(S,{replace:!0})},m=[{id:I.APPEARANCE,label:a("settings.section.appearance"),description:a("settings.section.appearance.description"),group:M.PERSONAL,Icon:$a,content:e.jsx(Ds,{})},...n?[{id:I.NATIVE_APP,label:a("settings.section.menubar"),description:a("settings.section.menubar.description"),group:M.APP,Icon:ye,content:e.jsx(Us,{})}]:[],...g?[{id:I.NETWORK,label:a("settings.section.network"),description:a("settings.section.network.description"),group:M.APP,Icon:Zt,content:e.jsx(Hs,{proxySettings:c})}]:[],{id:I.ACCOUNT,label:a("settings.section.account"),description:a("settings.section.account.description"),group:M.PERSONAL,Icon:za,content:e.jsx(us,{settings:t})},{id:I.CLOUD,label:a("settings.section.cloud"),description:a("settings.section.cloud.description"),group:M.PERSONAL,Icon:se,content:e.jsx(Ss,{settings:t,active:j===I.CLOUD})},{id:I.LIMITS,label:a("settings.section.limits"),description:a("settings.section.limits.description"),group:M.APP,Icon:Jt,content:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(V,{title:a("settings.section.limits"),children:[e.jsx(E,{label:a("limits.settings.display_mode_label"),control:e.jsx(Ws,{prefs:s})}),y?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:e.jsx(D,{checked:o,disabled:!n,onChange:()=>r("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),e.jsx(E,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:e.jsx(D,{checked:d,disabled:!n,onChange:()=>r("confettiOnReset",!d),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),e.jsx(E,{label:a("settings.limits.showSubscriptions"),hint:a("settings.limits.showSubscriptionsHint"),control:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>x("/limits?openSubscriptions=1"),"aria-label":a("limits.page.openSubscriptions"),title:a("limits.page.openSubscriptions"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:e.jsx(Qt,{size:14,"aria-hidden":!0})}),e.jsx(D,{checked:s.showSubscriptions!==!1,onChange:()=>s.setShowSubscriptions(!s.showSubscriptions),ariaLabel:a("settings.limits.showSubscriptions")})]})})]}),e.jsx(V,{title:a("settings.limits.providers"),children:e.jsx(Va,{prefs:s})})]})},{id:I.LABS,label:a("settings.section.labs"),description:a("settings.section.labs.description"),group:M.DEVELOPER,Icon:Da,content:e.jsx(Gs,{})}],k=[{id:M.PERSONAL,label:a("settings.nav.group.personal")},{id:M.APP,label:a("settings.nav.group.app")},{id:M.DEVELOPER,label:a("settings.nav.group.developer")}].map(f=>({...f,sections:m.filter(S=>S.group===f.id)})).filter(f=>f.sections.length>0);let C=m[0];for(const f of m)if(f.id===j){C=f;break}return e.jsx("div",{className:B("flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",j===I.CLOUD&&"tt-cloud-settings"),children:e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-7 max-w-2xl",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("settings.page.subtitle")})]}),e.jsxs("div",{className:"tt-settings-sections grid min-w-0 gap-6 md:grid-cols-[11rem_minmax(0,1fr)] md:gap-8",children:[e.jsx("aside",{className:"min-w-0 rounded-xl border border-oai-gray-200 bg-oai-gray-50/70 p-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 md:border-0 md:bg-transparent md:p-0 md:dark:bg-transparent",children:e.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-4 md:overflow-visible",children:k.map(({id:f,label:S,sections:_})=>e.jsxs("div",{className:"flex shrink-0 gap-1 md:block",children:[e.jsx("div",{className:"hidden px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-oai-gray-400 dark:text-oai-gray-500 md:block",children:S}),e.jsx("div",{className:"flex gap-1 md:flex-col",children:_.map(({id:w,label:A,Icon:T})=>{const b=j===w;return e.jsxs("button",{id:`settings-nav-${w}`,type:"button","aria-current":b?"page":void 0,"aria-controls":`settings-panel-${w}`,onClick:()=>h(w),className:B("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",b?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[e.jsx(T,{className:B("h-4 w-4 shrink-0",b?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),e.jsx("span",{className:"truncate",children:A})]},w)})})]},f))})}),e.jsxs("div",{className:"min-w-0",children:[j!==I.CLOUD?e.jsxs("div",{className:"mb-4 border-b border-oai-gray-200 pb-4 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-xl font-semibold tracking-tight text-oai-black dark:text-white",children:C.label}),e.jsx("p",{className:"mt-1 text-sm leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:C.description})]}):null,m.map(({id:f,label:S,content:_})=>e.jsx("section",{id:`settings-panel-${f}`,"aria-labelledby":`settings-nav-${f}`,"aria-label":S,"data-settings-panel":f,hidden:j!==f,children:_},f)),e.jsx($s,{})]})]})]})})})}export{In as SettingsPage};
|