@uniqbit/mate-core 1.0.0-canary.8 → 1.0.0-canary.9
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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/src/cli/commands/doctor.ts +17 -0
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/create-mate.ts +4 -1
- package/src/lib/mcp-manager/resolve.ts +70 -0
- package/src/lib/mcp-manager/store.ts +109 -0
- package/src/lib/mcp-manager/types.ts +58 -0
- package/src/lib/mcp-manager/validate.ts +246 -0
- package/src/lib/orchestrator/config-store.ts +30 -7
- package/src/lib/orchestrator/engine-floor.ts +16 -4
- package/src/lib/orchestrator/engine-guard.ts +7 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/runtime/workflow/turn.ts +14 -12
- package/src/studio.ts +17 -0
- package/src/tools/setup/capabilities/mcp-manager.ts +74 -0
- package/src/tools/setup/context-services.ts +35 -6
- package/src/tools/setup/dynamic-plugins/audiences.ts +3 -2
- package/src/tools/setup/engine.ts +55 -3
- package/src/tools/setup/plugin.ts +14 -0
- package/src/tools/setup/providers/claude-format.ts +39 -2
- package/src/tools/setup/providers/claude.ts +10 -0
- package/src/tools/setup/providers/opencode-format.ts +13 -3
- package/studio-dist/client/assets/{button-amJ3g5oD.js → button-C9SQW3kI.js} +1 -1
- package/studio-dist/client/assets/{cn-BQPKiwI4.js → cn-DC80MJV0.js} +1 -1
- package/studio-dist/client/assets/{combobox-CJ7aGFid.js → combobox-D7mKYCBb.js} +1 -1
- package/studio-dist/client/assets/{companion-view-C_N237bf.js → companion-view-C1F0_jbt.js} +1 -1
- package/studio-dist/client/assets/{fields-BAiGkJ5N.js → fields-CEep8IFT.js} +1 -1
- package/studio-dist/client/assets/{friction-DqOU59v7.js → friction-D9dBU7WN.js} +1 -1
- package/studio-dist/client/assets/getting-started-BDyGvHhc.js +1 -0
- package/studio-dist/client/assets/{getting-started-djaQeWlu.js → getting-started-BN4aTpsz.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-B9ajbF4o.js +1 -0
- package/studio-dist/client/assets/getting-started.index-CYiBPtb7.js +1 -0
- package/studio-dist/client/assets/{graph-BYaD_5Bq.js → graph-ah7ZXfTa.js} +2 -2
- package/studio-dist/client/assets/{graph-canvas-ySGKMhmk.js → graph-canvas-Be5qgdDt.js} +1 -1
- package/studio-dist/client/assets/guides-CsL0660B.js +1 -0
- package/studio-dist/client/assets/{index-Qx7reRPD.js → index-zmRH87D4.js} +3 -3
- package/studio-dist/client/assets/{markdown-view-jMiaBTSO.js → markdown-view-dku7MGPn.js} +1 -1
- package/studio-dist/client/assets/{panel-C4bf_h2W.js → panel-COgk0vP5.js} +1 -1
- package/studio-dist/client/assets/{plugins._service._view-y6f2FDAB.js → plugins._service._view-Cn3WBHab.js} +1 -1
- package/studio-dist/client/assets/{prepaint-CKsXyJOR.js → prepaint-BkoDSw5X.js} +1 -1
- package/studio-dist/client/assets/{queries-Dfp5deWj.js → queries-CMvC2OkU.js} +1 -1
- package/studio-dist/client/assets/{reports-JFSwSueq.js → reports-C_AqLBYH.js} +1 -1
- package/studio-dist/client/assets/{routes-BdOWSgzK.js → routes-BokQmHtC.js} +1 -1
- package/studio-dist/client/assets/{search-CXosfvYh.js → search-DxidNK2M.js} +1 -1
- package/studio-dist/client/assets/{select-BHYYWPhK.js → select-CYFCbHUd.js} +1 -1
- package/studio-dist/client/assets/{skills-Bo9FLsBd.js → skills-R3vttWHM.js} +1 -1
- package/studio-dist/client/assets/{specs-BrCOjOch.js → specs-Bqd1ajyD.js} +1 -1
- package/studio-dist/client/assets/{specs-view-CdE2rlli.js → specs-view-znqFPx9p.js} +1 -1
- package/studio-dist/client/assets/{steps-CKUno4lh.js → steps-tVDWn7j6.js} +1 -1
- package/studio-dist/client/assets/{store-C3vJq8Wj.js → store-BYnEU33C.js} +1 -1
- package/studio-dist/client/assets/studio-ndtFcS2Y.js +100 -0
- package/studio-dist/client/assets/{studio-queries-BflKt9va.js → studio-queries-CkUSByy7.js} +1 -1
- package/studio-dist/client/assets/{usage-BLsLy0nN.js → usage-Kuhr8dSl.js} +1 -1
- package/studio-dist/client/assets/{useAnchoredPopupScrollLock-DC7f8GOp.js → useAnchoredPopupScrollLock-dc_kP4Go.js} +1 -1
- package/studio-dist/client/assets/{useMutation-uJUrejsi.js → useMutation-CqtM9COw.js} +1 -1
- package/studio-dist/client/assets/{vault-BB1B_OhR.js → vault-CSP8kwRg.js} +1 -1
- package/studio-dist/client/assets/{warnings-CqOOGlPD.js → warnings-Cnw99ugO.js} +1 -1
- package/studio-dist/client/assets/{workflow-BFzmI-06.js → workflow-BPJAmmZi.js} +1 -1
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-gVfW5vIV.js → __23tanstack-start-server-fn-resolver-CS3QRY4Q.js} +18 -18
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +58 -58
- package/studio-dist/server/assets/{button-D6bvrFmm.js → button-Ct_WeYLc.js} +1 -1
- package/studio-dist/server/assets/{cn-FXJAM0KO.js → cn-DWFJaP_9.js} +1 -1
- package/studio-dist/server/assets/{combobox-D2MbYV1O.js → combobox-17vO5Uz8.js} +6 -6
- package/studio-dist/server/assets/{companion-view-Mf1ANbMb.js → companion-view-JkxnGLlp.js} +2 -2
- package/studio-dist/server/assets/{companions-Dr6IpNAb.js → companions-YNLsbnch.js} +1 -1
- package/studio-dist/server/assets/{fields-B4mAPETz.js → fields-VytPpqBq.js} +2 -2
- package/studio-dist/server/assets/{friction-9a5S1m7U.js → friction-B6osqFSm.js} +8 -8
- package/studio-dist/server/assets/{friction-CWOTjpCV.js → friction-BW86PCPM.js} +2 -2
- package/studio-dist/server/assets/{getting-started-RU6tYU2Q.js → getting-started-CFHSeX5h.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-C02HGrC6.js → getting-started._topic-BK2eU6AS.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-EzLRosbb.js → getting-started.index-DZLuXnNO.js} +2 -2
- package/studio-dist/server/assets/{graph-CZ2H9Fzr.js → graph-BJVZBevL.js} +8 -8
- package/studio-dist/server/assets/{graph-B11ITte0.js → graph-DGZHV-Ek.js} +1 -1
- package/studio-dist/server/assets/{graph-canvas-rP5TT14Z.js → graph-canvas-lrNT6jbl.js} +2 -2
- package/studio-dist/server/assets/{guides-B8HdeK_C.js → guides-CEwLOZb9.js} +1 -1
- package/studio-dist/server/assets/{guides-BGftp4wf.js → guides-_G8Vucsk.js} +1 -1
- package/studio-dist/server/assets/{guides.server-DqFQAStf.js → guides.server-ZWFKX2XJ.js} +1 -1
- package/studio-dist/server/assets/{markdown-view-CArpV-CS.js → markdown-view-Bmjghg_Z.js} +1 -1
- package/studio-dist/server/assets/{panel-DR0iq46J.js → panel-DvRjyil3.js} +4 -4
- package/studio-dist/server/assets/{plugins._service._view-n7u2k5dF.js → plugins._service._view-B32LzraG.js} +4 -4
- package/studio-dist/server/assets/{prepaint-B28ClcPN.js → prepaint-BEHwKl51.js} +1 -1
- package/studio-dist/server/assets/{queries-D-yVP9i0.js → queries-D6Vq0AuZ.js} +1 -1
- package/studio-dist/server/assets/{reports-B9k98oE6.js → reports-DDaH5k0H.js} +1 -1
- package/studio-dist/server/assets/{reports-C2SmTgqh.js → reports-Dn92pLap.js} +7 -7
- package/studio-dist/server/assets/{router-CPt0TAk_.js → router-Bjf4S9tO.js} +25 -25
- package/studio-dist/server/assets/{routes-CwH8LEy2.js → routes-B4sNiE0X.js} +8 -8
- package/studio-dist/server/assets/{search-b-yQesv3.js → search-DKeJRvg8.js} +1 -1
- package/studio-dist/server/assets/{select-C3i6TTX-.js → select-CVHYL7oR.js} +5 -5
- package/studio-dist/server/assets/{shell-CagqZZMZ.js → shell-BxbYYaAk.js} +2 -2
- package/studio-dist/server/assets/{skills-C21Mg_8-.js → skills-B4-0qpqN.js} +8 -8
- package/studio-dist/server/assets/{skills-DGg0mWDM.js → skills-Bj8eOgzR.js} +1 -1
- package/studio-dist/server/assets/{specs-DetoMiaB.js → specs-rfMug6qW.js} +4 -4
- package/studio-dist/server/assets/{specs-view-CmbfLDwN.js → specs-view-qi1SE1Sl.js} +10 -10
- package/studio-dist/server/assets/{steps-D1tYAyWZ.js → steps-rger6HJc.js} +1 -1
- package/studio-dist/server/assets/{store-aC-I6f6o.js → store-Dg9T7oWs.js} +1 -1
- package/studio-dist/server/assets/{studio-qRvQjRpz.js → studio-D79JzDLc.js} +1347 -0
- package/studio-dist/server/assets/{studio-queries-Dqf-3nzj.js → studio-queries-CeFfmIuM.js} +3 -3
- package/studio-dist/server/assets/{usage-CS4CBK9D.js → usage-BJgYWRCX.js} +9 -9
- package/studio-dist/server/assets/{usage-Cwle9-xY.js → usage-Dw_UQFX-.js} +1 -1
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-BjMNgXv9.js → useAnchoredPopupScrollLock-ciS_sEq3.js} +2 -2
- package/studio-dist/server/assets/{useMutation-DpBIuWXt.js → useMutation-DnWK0PhO.js} +2 -2
- package/studio-dist/server/assets/{vault-CEBBRLMb.js → vault-BzarssiL.js} +1 -1
- package/studio-dist/server/assets/{vault-DVQidlId.js → vault-CvlrLd2H.js} +6 -6
- package/studio-dist/server/assets/{views-UgO0Qz_g.js → views-CAxwKHMK.js} +2 -2
- package/studio-dist/server/assets/{warnings-C7hgXpdk.js → warnings-BpVCugHm.js} +2 -2
- package/studio-dist/server/assets/{workflow-6dZZ1ofw.js → workflow-BdrzcCt8.js} +9 -9
- package/studio-dist/server/server.js +2 -2
- package/studio-dist/client/assets/getting-started-yp42dj5S.js +0 -1
- package/studio-dist/client/assets/getting-started._topic-C9zVXz_m.js +0 -1
- package/studio-dist/client/assets/getting-started.index-DWbDKICP.js +0 -1
- package/studio-dist/client/assets/guides-D6T6W_jV.js +0 -1
- package/studio-dist/client/assets/studio-0ueISxwP.js +0 -100
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./useMutation-uJUrejsi.js";import{Lr as t,Rr as n,dt as r,ft as i,o as a,r as o,t as s,ut as c}from"./button-amJ3g5oD.js";import{m as l,n as u,t as d}from"./cn-BQPKiwI4.js";import{O as f,at as p,et as m,ut as h}from"./studio-queries-BflKt9va.js";import{a as g,i as _,n as v,r as y,t as b}from"./jsx-runtime-MZURdZre.js";import{t as x}from"./fields-BAiGkJ5N.js";import{a as S,i as C,n as w,o as T,r as E,t as D}from"./combobox-CJ7aGFid.js";import{a as O,c as k,l as A,o as j,s as M}from"./select-BHYYWPhK.js";import{S as N,m as ee,o as te}from"./index-Qx7reRPD.js";import"./studio-0ueISxwP.js";var P=g(v(),1),ne=m({method:`GET`}).handler(h(`5e73090d9c6425d4df9cce1d826a9c73a3d311894aa464b4ec5b9264b275b9b8`)),re=(e,t)=>f({queryKey:[e,`usage`,t],queryFn:()=>ne({data:{companion:e,days:t}}),staleTime:1/0,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1}),ie={claude:`Claude Code`,opencode:`OpenCode`,tokensave:`TokenSave`,rtk:`RTK`},ae=(e,t=!1)=>e===null?`—`:new Intl.NumberFormat(`en`,t?{notation:`compact`,maximumFractionDigits:1}:{}).format(e),oe=e=>e.amount===null||!e.currency?`—`:new Intl.NumberFormat(`en`,{style:`currency`,currency:e.currency,maximumFractionDigits:2}).format(e.amount),se=(e,t=!1)=>new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,...t?{year:`numeric`}:{},timeZone:`UTC`}).format(new Date(e));function ce(e){return e.totalTokens===null&&e.savings.estimatedTokens===null?`Unavailable`:e.coverage.tokens!==`complete`||e.coverage.cost!==`complete`?`Partial`:`Complete`}function le(e,t){let n=e.repositories.find(e=>e.id===t);return n?{metrics:n.metrics,daily:n.daily,sources:n.sources,repositories:[n],repositoryId:n.id}:{metrics:e.totals,daily:e.daily,sources:e.sources,repositories:e.repositories,repositoryId:void 0}}var F=b();function ue({repository:e}){let t=e.metrics,n=e.breakdowns.filter(e=>e.runtime===`claude`||e.runtime===`opencode`);return(0,F.jsxs)(`div`,{className:`bg-surface px-4 py-4`,children:[(0,F.jsx)(`dl`,{className:`mb-4 grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[[`Input`,t.inputTokens],[`Output (including reasoning)`,t.outputTokens],[`Cache read`,t.cacheReadTokens],[`Cache write`,t.cacheWriteTokens],[`Estimated tokens saved`,t.savings.estimatedTokens],[`Savings calls`,t.savings.calls]].map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`dt`,{className:`text-xs text-muted`,children:e}),(0,F.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:ae(t)})]},String(e)))}),(0,F.jsx)(`div`,{className:`overflow-x-auto`,role:`region`,tabIndex:0,"aria-label":`Model breakdown for ${e.label}`,children:(0,F.jsxs)(`table`,{className:`usage-table min-w-[560px] w-full text-xs`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Runtime and model token breakdown`}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Runtime / model`}),(0,F.jsx)(`th`,{children:`Input`}),(0,F.jsx)(`th`,{children:`Output`}),(0,F.jsx)(`th`,{children:`Cache read`}),(0,F.jsx)(`th`,{children:`Cache write`}),(0,F.jsx)(`th`,{children:`Cost`})]})}),(0,F.jsx)(`tbody`,{children:n.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsxs)(`th`,{scope:`row`,className:`break-all`,children:[(0,F.jsx)(`span`,{className:`block text-muted`,children:ie[e.runtime]}),e.model]}),(0,F.jsx)(`td`,{children:ae(e.metrics.inputTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.outputTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.cacheReadTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.cacheWriteTokens)}),(0,F.jsx)(`td`,{children:oe(e.metrics.cost)})]},`${e.runtime}:${e.model}`))})]})}),n.length===0&&(0,F.jsx)(`p`,{className:`text-xs text-muted`,children:`No model records available in this period.`})]})}var de=50;function fe({repositories:e}){let t=N(`(max-width: 639px)`),[n,r]=(0,P.useState)(()=>new Set),[i,a]=(0,P.useState)(0),c=Math.ceil(e.length/de),l=Math.min(i,Math.max(0,c-1)),u=e.slice(l*de,(l+1)*de);return(0,F.jsxs)(`section`,{"aria-labelledby":`usage-ledger-title`,className:`border-b border-rule py-5`,children:[(0,F.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{id:`usage-ledger-title`,className:`text-base font-semibold`,children:`By repository`}),(0,F.jsx)(`span`,{className:`text-xs text-muted`,children:`Expand a row for models and cache usage`})]}),(0,F.jsxs)(`table`,{className:`usage-table usage-ledger w-full table-fixed text-sm`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Usage for the companion and linked Working Repositories`}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{className:`w-[40%] max-sm:w-[48%]`,children:`Repository`}),(0,F.jsx)(`th`,{children:`Tokens`}),(0,F.jsx)(`th`,{children:`Cost`}),(0,F.jsx)(`th`,{className:`max-sm:hidden`,children:`Est. saved`}),(0,F.jsx)(`th`,{className:`max-sm:hidden`,children:`Coverage`})]})}),(0,F.jsx)(`tbody`,{children:u.map(e=>{let i=ce(e.metrics);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{scope:`row`,children:(0,F.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 py-1 text-left hover:text-accent`,"aria-expanded":n.has(e.id),"aria-controls":`usage-detail-${e.id}`,onClick:()=>r(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:[(0,F.jsx)(o,{name:n.has(e.id)?`chevron`:`right`}),(0,F.jsxs)(`span`,{className:`min-w-0 break-words`,children:[e.label,(0,F.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-muted sm:hidden`,children:i})]})]})}),(0,F.jsx)(`td`,{"aria-label":`${ae(e.metrics.totalTokens)} tokens`,children:ae(e.metrics.totalTokens,!0)}),(0,F.jsx)(`td`,{children:oe(e.metrics.cost)}),(0,F.jsx)(`td`,{className:`max-sm:hidden`,children:ae(e.metrics.savings.estimatedTokens,!0)}),(0,F.jsx)(`td`,{className:`!font-sans max-sm:hidden`,children:(0,F.jsx)(`span`,{className:i===`Partial`?`text-warn`:`text-muted`,children:i})})]}),(0,F.jsx)(`tr`,{hidden:!n.has(e.id),children:(0,F.jsx)(`td`,{colSpan:t?3:5,className:`!p-0 !text-left !font-sans`,children:(0,F.jsx)(`div`,{id:`usage-detail-${e.id}`,children:n.has(e.id)&&(0,F.jsx)(ue,{repository:e})})})})]},e.id)})})]}),c>1&&(0,F.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-3 text-xs text-muted`,children:[(0,F.jsxs)(`span`,{children:[`Page `,l+1,` of `,c,` · totals include every repository`]}),(0,F.jsx)(s,{size:`sm`,disabled:l===0,onClick:()=>a(l-1),children:`Previous`}),(0,F.jsx)(s,{size:`sm`,disabled:l+1>=c,onClick:()=>a(l+1),children:`Next`})]})]})}function pe(){return(0,F.jsx)(c,{title:`Collecting usage…`,detail:`Reading local usage for this companion and its linked repositories.`})}var me={ok:`Available`,empty:`No activity`,disabled:`Not enabled`,unavailable:`Unavailable`,unsupported:`Unsupported schema`,error:`Read failed`,timeout:`Timed out`},he=e=>e.status===`ok`||e.status===`empty`,ge={claude:`Tokens · API cost`,opencode:`Tokens · reported cost`,tokensave:`Estimated token savings`,rtk:`Estimated token savings`};function _e(e,t,n){let r=e.every(t=>t.status===e[0].status);return t&&n?`Partial`:r?me[e[0].status]:t?`Available`:`Unavailable`}function ve(e,t){return e.status===`disabled`?`Capability not enabled for this companion.`:e.status===`empty`?`No measured activity in this period.`:t?`Some usage records are incomplete. Expand for repository details.`:`Local usage metadata is readable.`}function ye(e){let t=e.filter(he).length,n=e.some(e=>e.partial)||t>0&&t<e.length,r=_e(e,t,n),i=e.find(e=>!he(e)&&e.status!==`disabled`)??e.find(e=>e.partial)??e[0];return{available:t,label:r,detail:i.detail??ve(i,n),warning:n||e.some(e=>!he(e)&&e.status!==`disabled`)}}function be({sources:e,repositories:t}){return(0,F.jsxs)(`section`,{id:`usage-sources`,tabIndex:-1,className:`py-5`,"aria-labelledby":`usage-sources-title`,children:[(0,F.jsx)(`h2`,{id:`usage-sources-title`,className:`text-base font-semibold`,children:`Sources and coverage`}),(0,F.jsx)(`p`,{className:`mt-1 mb-3 text-xs text-muted`,children:`One row per tool. Expand for repository status and source notes.`}),(0,F.jsx)(`div`,{className:`divide-y divide-rule-soft`,children:Object.entries(ie).map(([n,r])=>{let i=e.filter(e=>e.name===n);if(!i.length)return null;let a=ye(i);return(0,F.jsxs)(`details`,{className:`group/source py-3`,children:[(0,F.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2 rounded-control text-sm [&::-webkit-details-marker]:hidden`,children:[(0,F.jsx)(o,{name:`right`,className:`mt-0.5 size-3.5 text-muted transition-transform group-open/source:rotate-90 motion-reduce:transition-none`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:r}),(0,F.jsx)(`span`,{className:`text-xs ${a.warning?`text-warn`:`text-muted`}`,children:a.label})]}),(0,F.jsxs)(`span`,{className:`mt-1 block text-2xs text-muted`,children:[ge[i[0].name],a.available>0&&(0,F.jsxs)(F.Fragment,{children:[` `,`· `,a.available,`/`,i.length,` repositories readable`]})]}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted`,children:a.detail})]})]}),(0,F.jsx)(`div`,{className:`mt-3 ml-5 border-l border-rule-soft pl-3 text-xs`,children:(0,F.jsx)(`ul`,{className:`grid gap-2`,"aria-label":`${r} repository status`,children:i.map(e=>(0,F.jsxs)(`li`,{className:`flex min-w-0 items-baseline justify-between gap-4`,children:[(0,F.jsxs)(`span`,{className:`min-w-0 break-words`,children:[t.find(t=>t.id===e.repositoryId)?.label??`Repository`,e.detail&&e.detail!==a.detail&&(0,F.jsx)(`span`,{className:`mt-1 block leading-relaxed text-muted`,children:e.detail})]}),(0,F.jsxs)(`span`,{className:`shrink-0 text-muted`,children:[me[e.status],e.partial?` · partial`:``]})]},e.repositoryId))})})]},n)})}),(0,F.jsx)(`p`,{className:`mt-4 max-w-[70ch] text-xs leading-relaxed text-muted`,children:`Repository activity, not subscription billing. Shared repositories can appear in several companions. Savings are estimates, not bill deductions. An em dash means unknown; today is still in progress.`})]})}var xe=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Se(e){return typeof e==`string`&&xe.includes(e)}var Ce=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function we(e){return typeof e==`string`&&Ce.has(e)}function Te(e){return typeof e==`string`&&e.startsWith(`data-`)}function Ee(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(we(n)||Te(n))&&(t[n]=e[n]);return t}function De(e){if(e==null)return null;if((0,P.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Ee(t)}return typeof e==`object`&&!Array.isArray(e)?Ee(e):null}function Oe(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(we(n)||Te(n)||Se(n))&&(t[n]=e[n]);return t}var ke=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ae.apply(null,arguments)}function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Me(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Ne=(0,P.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,d=je(e,ke),f=a||{width:r,height:i,x:0,y:0},p=u(`recharts-surface`,o);return P.createElement(`svg`,Ae({},Oe(d),{className:p,width:r,height:i,style:s,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:t}),P.createElement(`title`,null,c),P.createElement(`desc`,null,l),n)}),Pe=[`children`,`className`];function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(null,arguments)}function Ie(e,t){if(e==null)return{};var n,r,i=Le(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Le(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Re=P.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Ie(e,Pe),a=u(`recharts-layer`,r);return P.createElement(`g`,Fe({className:a},Oe(i),{ref:t}),n)});function ze(e){return e===`__proto__`}function Be(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function Ve(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function He(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(He).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function Ue(e){if(Array.isArray(e))return e.map(Ve);if(typeof e==`symbol`)return[e];e=He(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let s=e[r];if(a)s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s;else if(o)s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s;else if(s===`[`)o=!0,i&&=(t.push(i),``);else if(s===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=s;r++}return i&&t.push(i),t}function We(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(ze(t))return n;let r=e[t];return r===void 0?Be(t)&&!Object.hasOwn(e,t)?We(e,Ue(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=Ve(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return Ge(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),ze(t))return n;let r=e[t];return r===void 0?n:r}}}function Ge(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||ze(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var Ke=4;function qe(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ke),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function Je(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+qe(i)+n},``)}var Ye=e=>e===0?0:e>0?1:-1,Xe=e=>typeof e==`number`&&e!=+e,Ze=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,I=e=>(typeof e==`number`||e instanceof Number)&&!Xe(e),Qe=e=>I(e)||typeof e==`string`,$e=0,et=e=>{var t=++$e;return`${e||``}${t}`},tt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!I(e)&&typeof e!=`string`)return n;var i;if(Ze(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Xe(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},nt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function rt(e,t,n){return I(e)&&I(t)?qe(e+n*(t-e)):t}function it(e,t,n){if(e&&e.length)return e.find(e=>e&&(typeof t==`function`?t(e):We(e,t))===n)}var L=e=>e==null,at=e=>L(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ot(e){return e!=null}function st(){}function ct(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lt(Object(n),!0).forEach(function(t){dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function dt(e,t,n){return(t=ft(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ft(e){var t=pt(e,`string`);return typeof t==`symbol`?t:t+``}function pt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var mt=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=ct(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?ut({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?ut({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?ut({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?ut({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?ut({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?ut({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?ut({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?ut({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(I(n.x)||Ze(n.x))&&(I(n.y)||Ze(n.y))?ut({x:c+tt(n.x,g),y:l+tt(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):ut({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ht=[`top`,`left`,`right`,`bottom`];function gt(e){return e==null?!1:typeof e==`object`||ht.includes(e)}var _t=(0,P.createContext)(null),vt=Math.PI,yt=2*vt,bt=1e-6,xt=yt-bt;function St(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ct(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return St;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}function wt(e,t,n,r){return e===n&&t===r}function Tt(e){let t=Math.floor(e);if(!(t<=15))return wt;let n=10**t,r=function(e){return Math.round(e*n)};return function(e,t,n,i){return r(e)===r(n)&&r(t)===r(i)}}var Et=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?St:Ct(e),this._equal=e==null?wt:Tt(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>bt){if(!(Math.abs(u*s-c*l)>bt)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((vt-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>bt&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>bt||Math.abs(this._y1-l)>bt)&&this._append`L${c},${l}`,n){if(d<0&&(d=d%yt+yt),d>xt)this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`;else if(d>bt){let a=e+n*Math.cos(i),o=t+n*Math.sin(i);if(d>=vt&&this._equal(c,l,a,o)){d/=2;let i=r+d;this._append`A${n},${n},0,${+(d>=vt)},${u},${e+n*Math.cos(i)},${t+n*Math.sin(i)}`}this._append`A${n},${n},0,${+(d>=vt)},${u},${this._x1=a},${this._y1=o}`}}}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Et.prototype;function R(e){return function(){return e}}var Dt=Math.cos,Ot=Math.sin,kt=Math.sqrt,At=1e-12,jt=Math.PI;jt/2;var Mt=2*jt;function Nt(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Et(t)}Array.prototype.slice;function Pt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Ft(e){this._context=e}Ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function It(e){return new Ft(e)}function Lt(e){return e[0]}function Rt(e){return e[1]}function zt(e,t){var n=R(!0),r=null,i=It,a=null,o=Nt(s);e=typeof e==`function`?e:e===void 0?Lt:R(e),t=typeof t==`function`?t:t===void 0?Rt:R(t);function s(s){var c,l=(s=Pt(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:R(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function Bt(e,t,n){var r=null,i=R(!0),a=null,o=It,s=null,c=Nt(l);e=typeof e==`function`?e:e===void 0?Lt:R(+e),t=typeof t==`function`?t:R(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Rt:R(+n);function l(l){var u,d,f,p=(l=Pt(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return zt().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:R(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:R(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:R(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}Ht(It);function Vt(e){this._curve=e}Vt.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};function Ht(e){function t(t){return new Vt(e(t))}return t._curve=e,t}var Ut=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Wt(e){return new Ut(e,!0)}function Gt(e){return new Ut(e,!1)}kt(3),kt(1/3)*2;var Kt=Ot(jt/10)/Ot(7*jt/10);Ot(Mt/10)*Kt,-Dt(Mt/10)*Kt,kt(3),kt(3),kt(3)/2,(1/kt(12)/2+1)*3;function qt(){}function Jt(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Yt(e){this._context=e}Yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Jt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Xt(e){return new Yt(e)}function Zt(e){this._context=e}Zt.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qt(e){return new Zt(e)}function $t(e){this._context=e}$t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function en(e){return new $t(e)}function tn(e,t){this._basis=new Yt(e),this._beta=t}tn.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},(function e(t){function n(e){return t===1?new Yt(e):new tn(e,t)}return n.beta=function(t){return e(+t)},n})(.85);function nn(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function rn(e,t){this._context=e,this._k=(1-t)/6}rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:nn(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new rn(e,t)}return n.tension=function(t){return e(+t)},n})(0);function an(e,t){this._context=e,this._k=(1-t)/6}an.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new an(e,t)}return n.tension=function(t){return e(+t)},n})(0);function on(e,t){this._context=e,this._k=(1-t)/6}on.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new on(e,t)}return n.tension=function(t){return e(+t)},n})(0);function sn(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>At){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>At){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function cn(e,t){this._context=e,this._alpha=t}cn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new cn(e,t):new rn(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function ln(e,t){this._context=e,this._alpha=t}ln.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new ln(e,t):new an(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function un(e,t){this._context=e,this._alpha=t}un.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new un(e,t):new on(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function dn(e){this._context=e}dn.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function fn(e){return new dn(e)}function pn(e){return e<0?-1:1}function mn(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(pn(a)+pn(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function hn(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function gn(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function _n(e){this._context=e}_n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:gn(this,this._t0,hn(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,gn(this,hn(this,n=mn(this,e,t)),n);break;default:gn(this,this._t0,n=mn(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function vn(e){this._context=new yn(e)}(vn.prototype=Object.create(_n.prototype)).point=function(e,t){_n.prototype.point.call(this,t,e)};function yn(e){this._context=e}yn.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function bn(e){return new _n(e)}function xn(e){return new vn(e)}function Sn(e){this._context=e}Sn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Cn(e),i=Cn(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Cn(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function wn(e){return new Sn(e)}function Tn(e,t){this._context=e,this._t=t}Tn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function En(e){return new Tn(e,.5)}function Dn(e){return new Tn(e,0)}function On(e){return new Tn(e,1)}function kn(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function An(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function jn(e,t){return e[t]}function Mn(e){let t=[];return t.key=e,t}function Nn(){var e=R([]),t=An,n=kn,r=jn;function i(i){var a=Array.from(e.apply(this,arguments),Mn),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Pt(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:R(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:R(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?An:typeof e==`function`?e:R(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??kn,i):n},i}function Pn(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}kn(e,t)}}function Fn(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}kn(e,t)}}function In(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,kn(e,t)}}var Ln=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Rn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,P.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Se(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},zn=(e,t,n)=>r=>(e(t,n,r),null),Bn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Se(i)&&typeof a==`function`&&(r||={},r[i]=zn(a,t,n))}),r};function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vn(Object(n),!0).forEach(function(t){Un(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Un(e,t,n){return(t=Wn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(e){var t=Gn(e,`string`);return typeof t==`symbol`?t:t+``}function Gn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Kn(e,t){var n=Hn({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function qn(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function Jn(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function Yn(e){return e}function Xn(e){return function(t){return We(t,e)}}function Zn(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Qn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $n(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function er(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var tr=`[object RegExp]`,nr=`[object String]`,rr=`[object Number]`,ir=`[object Boolean]`,ar=`[object Arguments]`,or=`[object Symbol]`,sr=`[object Date]`,cr=`[object Map]`,lr=`[object Set]`,ur=`[object Array]`,dr=`[object Function]`,fr=`[object ArrayBuffer]`,pr=`[object Object]`,mr=`[object Error]`,hr=`[object DataView]`,gr=`[object Uint8Array]`,_r=`[object Uint8ClampedArray]`,vr=`[object Uint16Array]`,yr=`[object Uint32Array]`,br=`[object BigUint64Array]`,xr=`[object Int8Array]`,Sr=`[object Int16Array]`,Cr=`[object Int32Array]`,wr=`[object BigInt64Array]`,Tr=`[object Float32Array]`,Er=`[object Float64Array]`,Dr=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function Or(e){return Dr.Buffer!==void 0&&Dr.Buffer.isBuffer(e)}function kr(e,t){return Ar(e,void 0,e,new Map,t)}function Ar(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Zn(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Ar(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,Ar(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(Ar(a,void 0,n,r,i));return t}if(Or(e))return e.subarray();if(Qn(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Ar(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),jr(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),jr(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,jr(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(typeof e==`object`&&Mr(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),jr(t,e,n,r,i),t}return e}function jr(e,t,n=e,r,i){let a=[...Object.keys(t),...$n(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=Ar(t[s],s,n,r,i))}}function Mr(e){switch(er(e)){case ar:case ur:case fr:case hr:case ir:case sr:case Tr:case Er:case xr:case Sr:case Cr:case cr:case rr:case pr:case tr:case lr:case nr:case or:case gr:case _r:case vr:case yr:return!0;default:return!1}}function Nr(e){return Ar(e,void 0,e,new Map,void 0)}function Pr(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function Fr(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Ir(e,t,n){return typeof n==`function`?Lr(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Lr(t,r,e,s,!1):!!c},new Map,!0):Ir(e,t,()=>void 0)}function Lr(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Rr(e,t,n,r);case`function`:return Object.keys(t).length>0?Lr(e,{...t},n,r,i):Pr(e,t);default:return Fr(e)&&i?typeof t!=`string`||t===``:Pr(e,t)}}function Rr(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return Br(e,t,n,r);if(t instanceof Map)return zr(e,t,n,r);if(t instanceof Set)return Vr(e,t,n,r);let i=Object.keys(t);if(e==null||Zn(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!Zn(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function zr(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function Br(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function Vr(e,t,n,r){return t.size===0||e instanceof Set&&Br([...e],[...t],n,r)}function Hr(e,t){return Ir(e,t,()=>void 0)}function Ur(e){return e=Nr(e),t=>Hr(t,e)}function Wr(e,t){return kr(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(er(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),jr(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case rr:case nr:case ir:{let t=new e.constructor(e?.valueOf());return jr(t,e),t}case ar:{let t={};return jr(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Gr(e){return Wr(e)}var Kr=/^(?:0|[1-9]\d*)$/;function qr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Kr.test(e)}}function Jr(e){return typeof e==`object`&&!!e&&er(e)===`[object Arguments]`}function Yr(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Be(t)&&e?.[t]==null?Ue(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=n[e];if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||Jr(r))&&qr(t)&&t<r.length))return!1;r=r[t]}return!0}function Xr(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=Ve(e)}return t=Gr(t),function(n){let r=We(n,e);return r===void 0?Yr(n,e):t===void 0?r===void 0:Hr(r,t)}}function Zr(e){if(e==null)return Yn;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?Xr(e[0],e[1]):Ur(e);case`string`:case`symbol`:case`number`:return Xn(e)}}function Qr(e){return Number.isSafeInteger(e)&&e>=0}function $r(e){return e!=null&&typeof e!=`function`&&Qr(e.length)}function ei(e){return typeof e==`object`&&!!e}function ti(e){return ei(e)&&$r(e)}function ni(e,t=Yn){return ti(e)?qn(Array.from(e),Jn(Zr(t),1)):[]}function ri(e,t,n){return t===!0?ni(e,n):typeof t==`function`?ni(e,t):e}var ii=(0,P.createContext)(null),ai=a(),oi=e=>e,z=()=>{var e=(0,P.useContext)(ii);return e?e.store.dispatch:oi},si=()=>{},ci=()=>si,li=(e,t)=>e===t;function B(e){var t=(0,P.useContext)(ii),n=(0,P.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:si,[t,e]);return(0,ai.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:ci,t?t.store.getState:si,t?t.store.getState:si,n,li)}function ui(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function di(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var fi=e=>Array.isArray(e)?e:[e];function pi(e){let t=Array.isArray(e[0])?e[0]:e;return di(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function mi(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var hi=class{constructor(e){this.value=e}deref(){return this.value}},gi=typeof WeakRef>`u`?hi:WeakRef,_i=0,vi=1;function yi(){return{s:_i,v:void 0,o:null,p:null}}function bi(e){return e instanceof gi?e.deref():e}function xi(e,t={}){let n=yi(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=yi(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=yi(),e.set(n,t)):t=r}}let s=t,c;if(t.s===vi)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=bi(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new gi(c):c}return s.s=vi,s.v=c,c}return o.clearCache=()=>{n=yi(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Si(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),ui(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=xi,argsMemoizeOptions:u=[]}={...n,...a},d=fi(c),f=fi(u),p=pi(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=mi(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var V=Si(xi);function Ci(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function wi(e,t,n){return Fr(n)&&(typeof t==`number`&&$r(n)&&qr(t)&&t<n.length||typeof t==`string`&&t in n)?Pr(n[t],e):!1}function Ti(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var Ei=(e,t,n)=>{if(e!==t){let r=Ti(e),i=Ti(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0};function Di(e){return typeof e==`symbol`||e instanceof Symbol}var Oi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ki=/^\w*$/;function Ai(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||Di(e)?!0:typeof e==`string`&&(ki.test(e)||!Oi.test(e))||t!=null&&Object.hasOwn(t,e)}function ji(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e;for(let e=0;e<t.length&&n!=null;++e)n=n[t[e]];return n},a=(e,t)=>t==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):typeof t==`object`?t[e]:t,o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Ai(e)?e:{key:e,path:Ue(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=Ei(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function Mi(e,...t){let n=t.length;return n>1&&wi(e,t[0],t[1])?t=[]:n>2&&wi(t[0],t[1],t[2])&&(t=[t[0]]),ji(e,Ci(t),[`asc`])}var Ni=e=>e.legend.settings,Pi=e=>e.legend.size;V([e=>e.legend.payload,Ni],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Mi(r,n):r});function Fi(e,t){return Bi(e)||zi(e,t)||Li(e,t)||Ii()}function Ii(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1
|
+
import{t as e}from"./useMutation-CqtM9COw.js";import{Lr as t,Rr as n,dt as r,ft as i,o as a,r as o,t as s,ut as c}from"./button-C9SQW3kI.js";import{m as l,n as u,t as d}from"./cn-DC80MJV0.js";import{O as f,at as p,et as m,ut as h}from"./studio-queries-CkUSByy7.js";import{a as g,i as _,n as v,r as y,t as b}from"./jsx-runtime-MZURdZre.js";import{t as x}from"./fields-CEep8IFT.js";import{a as S,i as C,n as w,o as T,r as E,t as D}from"./combobox-D7mKYCBb.js";import{a as O,c as k,l as A,o as j,s as M}from"./select-CYFCbHUd.js";import{S as N,m as ee,o as te}from"./index-zmRH87D4.js";import"./studio-ndtFcS2Y.js";var P=g(v(),1),ne=m({method:`GET`}).handler(h(`5e73090d9c6425d4df9cce1d826a9c73a3d311894aa464b4ec5b9264b275b9b8`)),re=(e,t)=>f({queryKey:[e,`usage`,t],queryFn:()=>ne({data:{companion:e,days:t}}),staleTime:1/0,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1}),ie={claude:`Claude Code`,opencode:`OpenCode`,tokensave:`TokenSave`,rtk:`RTK`},ae=(e,t=!1)=>e===null?`—`:new Intl.NumberFormat(`en`,t?{notation:`compact`,maximumFractionDigits:1}:{}).format(e),oe=e=>e.amount===null||!e.currency?`—`:new Intl.NumberFormat(`en`,{style:`currency`,currency:e.currency,maximumFractionDigits:2}).format(e.amount),se=(e,t=!1)=>new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,...t?{year:`numeric`}:{},timeZone:`UTC`}).format(new Date(e));function ce(e){return e.totalTokens===null&&e.savings.estimatedTokens===null?`Unavailable`:e.coverage.tokens!==`complete`||e.coverage.cost!==`complete`?`Partial`:`Complete`}function le(e,t){let n=e.repositories.find(e=>e.id===t);return n?{metrics:n.metrics,daily:n.daily,sources:n.sources,repositories:[n],repositoryId:n.id}:{metrics:e.totals,daily:e.daily,sources:e.sources,repositories:e.repositories,repositoryId:void 0}}var F=b();function ue({repository:e}){let t=e.metrics,n=e.breakdowns.filter(e=>e.runtime===`claude`||e.runtime===`opencode`);return(0,F.jsxs)(`div`,{className:`bg-surface px-4 py-4`,children:[(0,F.jsx)(`dl`,{className:`mb-4 grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-4`,children:[[`Input`,t.inputTokens],[`Output (including reasoning)`,t.outputTokens],[`Cache read`,t.cacheReadTokens],[`Cache write`,t.cacheWriteTokens],[`Estimated tokens saved`,t.savings.estimatedTokens],[`Savings calls`,t.savings.calls]].map(([e,t])=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`dt`,{className:`text-xs text-muted`,children:e}),(0,F.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:ae(t)})]},String(e)))}),(0,F.jsx)(`div`,{className:`overflow-x-auto`,role:`region`,tabIndex:0,"aria-label":`Model breakdown for ${e.label}`,children:(0,F.jsxs)(`table`,{className:`usage-table min-w-[560px] w-full text-xs`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Runtime and model token breakdown`}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{children:`Runtime / model`}),(0,F.jsx)(`th`,{children:`Input`}),(0,F.jsx)(`th`,{children:`Output`}),(0,F.jsx)(`th`,{children:`Cache read`}),(0,F.jsx)(`th`,{children:`Cache write`}),(0,F.jsx)(`th`,{children:`Cost`})]})}),(0,F.jsx)(`tbody`,{children:n.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsxs)(`th`,{scope:`row`,className:`break-all`,children:[(0,F.jsx)(`span`,{className:`block text-muted`,children:ie[e.runtime]}),e.model]}),(0,F.jsx)(`td`,{children:ae(e.metrics.inputTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.outputTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.cacheReadTokens)}),(0,F.jsx)(`td`,{children:ae(e.metrics.cacheWriteTokens)}),(0,F.jsx)(`td`,{children:oe(e.metrics.cost)})]},`${e.runtime}:${e.model}`))})]})}),n.length===0&&(0,F.jsx)(`p`,{className:`text-xs text-muted`,children:`No model records available in this period.`})]})}var de=50;function fe({repositories:e}){let t=N(`(max-width: 639px)`),[n,r]=(0,P.useState)(()=>new Set),[i,a]=(0,P.useState)(0),c=Math.ceil(e.length/de),l=Math.min(i,Math.max(0,c-1)),u=e.slice(l*de,(l+1)*de);return(0,F.jsxs)(`section`,{"aria-labelledby":`usage-ledger-title`,className:`border-b border-rule py-5`,children:[(0,F.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,F.jsx)(`h2`,{id:`usage-ledger-title`,className:`text-base font-semibold`,children:`By repository`}),(0,F.jsx)(`span`,{className:`text-xs text-muted`,children:`Expand a row for models and cache usage`})]}),(0,F.jsxs)(`table`,{className:`usage-table usage-ledger w-full table-fixed text-sm`,children:[(0,F.jsx)(`caption`,{className:`sr-only`,children:`Usage for the companion and linked Working Repositories`}),(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{className:`w-[40%] max-sm:w-[48%]`,children:`Repository`}),(0,F.jsx)(`th`,{children:`Tokens`}),(0,F.jsx)(`th`,{children:`Cost`}),(0,F.jsx)(`th`,{className:`max-sm:hidden`,children:`Est. saved`}),(0,F.jsx)(`th`,{className:`max-sm:hidden`,children:`Coverage`})]})}),(0,F.jsx)(`tbody`,{children:u.map(e=>{let i=ce(e.metrics);return(0,F.jsxs)(P.Fragment,{children:[(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{scope:`row`,children:(0,F.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 py-1 text-left hover:text-accent`,"aria-expanded":n.has(e.id),"aria-controls":`usage-detail-${e.id}`,onClick:()=>r(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),children:[(0,F.jsx)(o,{name:n.has(e.id)?`chevron`:`right`}),(0,F.jsxs)(`span`,{className:`min-w-0 break-words`,children:[e.label,(0,F.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-muted sm:hidden`,children:i})]})]})}),(0,F.jsx)(`td`,{"aria-label":`${ae(e.metrics.totalTokens)} tokens`,children:ae(e.metrics.totalTokens,!0)}),(0,F.jsx)(`td`,{children:oe(e.metrics.cost)}),(0,F.jsx)(`td`,{className:`max-sm:hidden`,children:ae(e.metrics.savings.estimatedTokens,!0)}),(0,F.jsx)(`td`,{className:`!font-sans max-sm:hidden`,children:(0,F.jsx)(`span`,{className:i===`Partial`?`text-warn`:`text-muted`,children:i})})]}),(0,F.jsx)(`tr`,{hidden:!n.has(e.id),children:(0,F.jsx)(`td`,{colSpan:t?3:5,className:`!p-0 !text-left !font-sans`,children:(0,F.jsx)(`div`,{id:`usage-detail-${e.id}`,children:n.has(e.id)&&(0,F.jsx)(ue,{repository:e})})})})]},e.id)})})]}),c>1&&(0,F.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-3 text-xs text-muted`,children:[(0,F.jsxs)(`span`,{children:[`Page `,l+1,` of `,c,` · totals include every repository`]}),(0,F.jsx)(s,{size:`sm`,disabled:l===0,onClick:()=>a(l-1),children:`Previous`}),(0,F.jsx)(s,{size:`sm`,disabled:l+1>=c,onClick:()=>a(l+1),children:`Next`})]})]})}function pe(){return(0,F.jsx)(c,{title:`Collecting usage…`,detail:`Reading local usage for this companion and its linked repositories.`})}var me={ok:`Available`,empty:`No activity`,disabled:`Not enabled`,unavailable:`Unavailable`,unsupported:`Unsupported schema`,error:`Read failed`,timeout:`Timed out`},he=e=>e.status===`ok`||e.status===`empty`,ge={claude:`Tokens · API cost`,opencode:`Tokens · reported cost`,tokensave:`Estimated token savings`,rtk:`Estimated token savings`};function _e(e,t,n){let r=e.every(t=>t.status===e[0].status);return t&&n?`Partial`:r?me[e[0].status]:t?`Available`:`Unavailable`}function ve(e,t){return e.status===`disabled`?`Capability not enabled for this companion.`:e.status===`empty`?`No measured activity in this period.`:t?`Some usage records are incomplete. Expand for repository details.`:`Local usage metadata is readable.`}function ye(e){let t=e.filter(he).length,n=e.some(e=>e.partial)||t>0&&t<e.length,r=_e(e,t,n),i=e.find(e=>!he(e)&&e.status!==`disabled`)??e.find(e=>e.partial)??e[0];return{available:t,label:r,detail:i.detail??ve(i,n),warning:n||e.some(e=>!he(e)&&e.status!==`disabled`)}}function be({sources:e,repositories:t}){return(0,F.jsxs)(`section`,{id:`usage-sources`,tabIndex:-1,className:`py-5`,"aria-labelledby":`usage-sources-title`,children:[(0,F.jsx)(`h2`,{id:`usage-sources-title`,className:`text-base font-semibold`,children:`Sources and coverage`}),(0,F.jsx)(`p`,{className:`mt-1 mb-3 text-xs text-muted`,children:`One row per tool. Expand for repository status and source notes.`}),(0,F.jsx)(`div`,{className:`divide-y divide-rule-soft`,children:Object.entries(ie).map(([n,r])=>{let i=e.filter(e=>e.name===n);if(!i.length)return null;let a=ye(i);return(0,F.jsxs)(`details`,{className:`group/source py-3`,children:[(0,F.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-2 rounded-control text-sm [&::-webkit-details-marker]:hidden`,children:[(0,F.jsx)(o,{name:`right`,className:`mt-0.5 size-3.5 text-muted transition-transform group-open/source:rotate-90 motion-reduce:transition-none`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,F.jsx)(`span`,{className:`font-medium`,children:r}),(0,F.jsx)(`span`,{className:`text-xs ${a.warning?`text-warn`:`text-muted`}`,children:a.label})]}),(0,F.jsxs)(`span`,{className:`mt-1 block text-2xs text-muted`,children:[ge[i[0].name],a.available>0&&(0,F.jsxs)(F.Fragment,{children:[` `,`· `,a.available,`/`,i.length,` repositories readable`]})]}),(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted`,children:a.detail})]})]}),(0,F.jsx)(`div`,{className:`mt-3 ml-5 border-l border-rule-soft pl-3 text-xs`,children:(0,F.jsx)(`ul`,{className:`grid gap-2`,"aria-label":`${r} repository status`,children:i.map(e=>(0,F.jsxs)(`li`,{className:`flex min-w-0 items-baseline justify-between gap-4`,children:[(0,F.jsxs)(`span`,{className:`min-w-0 break-words`,children:[t.find(t=>t.id===e.repositoryId)?.label??`Repository`,e.detail&&e.detail!==a.detail&&(0,F.jsx)(`span`,{className:`mt-1 block leading-relaxed text-muted`,children:e.detail})]}),(0,F.jsxs)(`span`,{className:`shrink-0 text-muted`,children:[me[e.status],e.partial?` · partial`:``]})]},e.repositoryId))})})]},n)})}),(0,F.jsx)(`p`,{className:`mt-4 max-w-[70ch] text-xs leading-relaxed text-muted`,children:`Repository activity, not subscription billing. Shared repositories can appear in several companions. Savings are estimates, not bill deductions. An em dash means unknown; today is still in progress.`})]})}var xe=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Se(e){return typeof e==`string`&&xe.includes(e)}var Ce=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function we(e){return typeof e==`string`&&Ce.has(e)}function Te(e){return typeof e==`string`&&e.startsWith(`data-`)}function Ee(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(we(n)||Te(n))&&(t[n]=e[n]);return t}function De(e){if(e==null)return null;if((0,P.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Ee(t)}return typeof e==`object`&&!Array.isArray(e)?Ee(e):null}function Oe(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(we(n)||Te(n)||Se(n))&&(t[n]=e[n]);return t}var ke=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ae.apply(null,arguments)}function je(e,t){if(e==null)return{};var n,r,i=Me(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Me(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Ne=(0,P.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,d=je(e,ke),f=a||{width:r,height:i,x:0,y:0},p=u(`recharts-surface`,o);return P.createElement(`svg`,Ae({},Oe(d),{className:p,width:r,height:i,style:s,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:t}),P.createElement(`title`,null,c),P.createElement(`desc`,null,l),n)}),Pe=[`children`,`className`];function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(null,arguments)}function Ie(e,t){if(e==null)return{};var n,r,i=Le(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Le(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Re=P.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Ie(e,Pe),a=u(`recharts-layer`,r);return P.createElement(`g`,Fe({className:a},Oe(i),{ref:t}),n)});function ze(e){return e===`__proto__`}function Be(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function Ve(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function He(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(He).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function Ue(e){if(Array.isArray(e))return e.map(Ve);if(typeof e==`symbol`)return[e];e=He(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let s=e[r];if(a)s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s;else if(o)s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s;else if(s===`[`)o=!0,i&&=(t.push(i),``);else if(s===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=s;r++}return i&&t.push(i),t}function We(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(ze(t))return n;let r=e[t];return r===void 0?Be(t)&&!Object.hasOwn(e,t)?We(e,Ue(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=Ve(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return Ge(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),ze(t))return n;let r=e[t];return r===void 0?n:r}}}function Ge(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||ze(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var Ke=4;function qe(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ke),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function Je(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+qe(i)+n},``)}var Ye=e=>e===0?0:e>0?1:-1,Xe=e=>typeof e==`number`&&e!=+e,Ze=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,I=e=>(typeof e==`number`||e instanceof Number)&&!Xe(e),Qe=e=>I(e)||typeof e==`string`,$e=0,et=e=>{var t=++$e;return`${e||``}${t}`},tt=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!I(e)&&typeof e!=`string`)return n;var i;if(Ze(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Xe(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},nt=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function rt(e,t,n){return I(e)&&I(t)?qe(e+n*(t-e)):t}function it(e,t,n){if(e&&e.length)return e.find(e=>e&&(typeof t==`function`?t(e):We(e,t))===n)}var L=e=>e==null,at=e=>L(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function ot(e){return e!=null}function st(){}function ct(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?lt(Object(n),!0).forEach(function(t){dt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function dt(e,t,n){return(t=ft(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ft(e){var t=pt(e,`string`);return typeof t==`symbol`?t:t+``}function pt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var mt=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=ct(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?ut({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?ut({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?ut({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?ut({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?ut({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?ut({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?ut({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?ut({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(I(n.x)||Ze(n.x))&&(I(n.y)||Ze(n.y))?ut({x:c+tt(n.x,g),y:l+tt(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):ut({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ht=[`top`,`left`,`right`,`bottom`];function gt(e){return e==null?!1:typeof e==`object`||ht.includes(e)}var _t=(0,P.createContext)(null),vt=Math.PI,yt=2*vt,bt=1e-6,xt=yt-bt;function St(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ct(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return St;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}function wt(e,t,n,r){return e===n&&t===r}function Tt(e){let t=Math.floor(e);if(!(t<=15))return wt;let n=10**t,r=function(e){return Math.round(e*n)};return function(e,t,n,i){return r(e)===r(n)&&r(t)===r(i)}}var Et=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?St:Ct(e),this._equal=e==null?wt:Tt(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>bt){if(!(Math.abs(u*s-c*l)>bt)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((vt-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>bt&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>bt||Math.abs(this._y1-l)>bt)&&this._append`L${c},${l}`,n){if(d<0&&(d=d%yt+yt),d>xt)this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`;else if(d>bt){let a=e+n*Math.cos(i),o=t+n*Math.sin(i);if(d>=vt&&this._equal(c,l,a,o)){d/=2;let i=r+d;this._append`A${n},${n},0,${+(d>=vt)},${u},${e+n*Math.cos(i)},${t+n*Math.sin(i)}`}this._append`A${n},${n},0,${+(d>=vt)},${u},${this._x1=a},${this._y1=o}`}}}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Et.prototype;function R(e){return function(){return e}}var Dt=Math.cos,Ot=Math.sin,kt=Math.sqrt,At=1e-12,jt=Math.PI;jt/2;var Mt=2*jt;function Nt(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Et(t)}Array.prototype.slice;function Pt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Ft(e){this._context=e}Ft.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function It(e){return new Ft(e)}function Lt(e){return e[0]}function Rt(e){return e[1]}function zt(e,t){var n=R(!0),r=null,i=It,a=null,o=Nt(s);e=typeof e==`function`?e:e===void 0?Lt:R(e),t=typeof t==`function`?t:t===void 0?Rt:R(t);function s(s){var c,l=(s=Pt(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:R(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function Bt(e,t,n){var r=null,i=R(!0),a=null,o=It,s=null,c=Nt(l);e=typeof e==`function`?e:e===void 0?Lt:R(+e),t=typeof t==`function`?t:R(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Rt:R(+n);function l(l){var u,d,f,p=(l=Pt(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return zt().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:R(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:R(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:R(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}Ht(It);function Vt(e){this._curve=e}Vt.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};function Ht(e){function t(t){return new Vt(e(t))}return t._curve=e,t}var Ut=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Wt(e){return new Ut(e,!0)}function Gt(e){return new Ut(e,!1)}kt(3),kt(1/3)*2;var Kt=Ot(jt/10)/Ot(7*jt/10);Ot(Mt/10)*Kt,-Dt(Mt/10)*Kt,kt(3),kt(3),kt(3)/2,(1/kt(12)/2+1)*3;function qt(){}function Jt(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Yt(e){this._context=e}Yt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Jt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Xt(e){return new Yt(e)}function Zt(e){this._context=e}Zt.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Qt(e){return new Zt(e)}function $t(e){this._context=e}$t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Jt(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function en(e){return new $t(e)}function tn(e,t){this._basis=new Yt(e),this._beta=t}tn.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,o=t[n]-i,s=-1,c;++s<=n;)c=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(r+c*a),this._beta*t[s]+(1-this._beta)*(i+c*o));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}},(function e(t){function n(e){return t===1?new Yt(e):new tn(e,t)}return n.beta=function(t){return e(+t)},n})(.85);function nn(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function rn(e,t){this._context=e,this._k=(1-t)/6}rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:nn(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new rn(e,t)}return n.tension=function(t){return e(+t)},n})(0);function an(e,t){this._context=e,this._k=(1-t)/6}an.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new an(e,t)}return n.tension=function(t){return e(+t)},n})(0);function on(e,t){this._context=e,this._k=(1-t)/6}on.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:nn(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new on(e,t)}return n.tension=function(t){return e(+t)},n})(0);function sn(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>At){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>At){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function cn(e,t){this._context=e,this._alpha=t}cn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new cn(e,t):new rn(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function ln(e,t){this._context=e,this._alpha=t}ln.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new ln(e,t):new an(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function un(e,t){this._context=e,this._alpha=t}un.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:sn(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return t?new un(e,t):new on(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function dn(e){this._context=e}dn.prototype={areaStart:qt,areaEnd:qt,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function fn(e){return new dn(e)}function pn(e){return e<0?-1:1}function mn(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(pn(a)+pn(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function hn(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function gn(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function _n(e){this._context=e}_n.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:gn(this,this._t0,hn(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,gn(this,hn(this,n=mn(this,e,t)),n);break;default:gn(this,this._t0,n=mn(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function vn(e){this._context=new yn(e)}(vn.prototype=Object.create(_n.prototype)).point=function(e,t){_n.prototype.point.call(this,t,e)};function yn(e){this._context=e}yn.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function bn(e){return new _n(e)}function xn(e){return new vn(e)}function Sn(e){this._context=e}Sn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Cn(e),i=Cn(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Cn(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function wn(e){return new Sn(e)}function Tn(e,t){this._context=e,this._t=t}Tn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function En(e){return new Tn(e,.5)}function Dn(e){return new Tn(e,0)}function On(e){return new Tn(e,1)}function kn(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function An(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function jn(e,t){return e[t]}function Mn(e){let t=[];return t.key=e,t}function Nn(){var e=R([]),t=An,n=kn,r=jn;function i(i){var a=Array.from(e.apply(this,arguments),Mn),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Pt(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:R(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:R(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?An:typeof e==`function`?e:R(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??kn,i):n},i}function Pn(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}kn(e,t)}}function Fn(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}kn(e,t)}}function In(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,kn(e,t)}}var Ln=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Rn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,P.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Se(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},zn=(e,t,n)=>r=>(e(t,n,r),null),Bn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Se(i)&&typeof a==`function`&&(r||={},r[i]=zn(a,t,n))}),r};function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vn(Object(n),!0).forEach(function(t){Un(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Un(e,t,n){return(t=Wn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(e){var t=Gn(e,`string`);return typeof t==`symbol`?t:t+``}function Gn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Kn(e,t){var n=Hn({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function qn(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function Jn(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function Yn(e){return e}function Xn(e){return function(t){return We(t,e)}}function Zn(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Qn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $n(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function er(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var tr=`[object RegExp]`,nr=`[object String]`,rr=`[object Number]`,ir=`[object Boolean]`,ar=`[object Arguments]`,or=`[object Symbol]`,sr=`[object Date]`,cr=`[object Map]`,lr=`[object Set]`,ur=`[object Array]`,dr=`[object Function]`,fr=`[object ArrayBuffer]`,pr=`[object Object]`,mr=`[object Error]`,hr=`[object DataView]`,gr=`[object Uint8Array]`,_r=`[object Uint8ClampedArray]`,vr=`[object Uint16Array]`,yr=`[object Uint32Array]`,br=`[object BigUint64Array]`,xr=`[object Int8Array]`,Sr=`[object Int16Array]`,Cr=`[object Int32Array]`,wr=`[object BigInt64Array]`,Tr=`[object Float32Array]`,Er=`[object Float64Array]`,Dr=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function Or(e){return Dr.Buffer!==void 0&&Dr.Buffer.isBuffer(e)}function kr(e,t){return Ar(e,void 0,e,new Map,t)}function Ar(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Zn(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Ar(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,Ar(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(Ar(a,void 0,n,r,i));return t}if(Or(e))return e.subarray();if(Qn(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Ar(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),jr(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),jr(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,jr(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),jr(t,e,n,r,i),t}if(typeof e==`object`&&Mr(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),jr(t,e,n,r,i),t}return e}function jr(e,t,n=e,r,i){let a=[...Object.keys(t),...$n(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=Ar(t[s],s,n,r,i))}}function Mr(e){switch(er(e)){case ar:case ur:case fr:case hr:case ir:case sr:case Tr:case Er:case xr:case Sr:case Cr:case cr:case rr:case pr:case tr:case lr:case nr:case or:case gr:case _r:case vr:case yr:return!0;default:return!1}}function Nr(e){return Ar(e,void 0,e,new Map,void 0)}function Pr(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function Fr(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Ir(e,t,n){return typeof n==`function`?Lr(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Lr(t,r,e,s,!1):!!c},new Map,!0):Ir(e,t,()=>void 0)}function Lr(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Rr(e,t,n,r);case`function`:return Object.keys(t).length>0?Lr(e,{...t},n,r,i):Pr(e,t);default:return Fr(e)&&i?typeof t!=`string`||t===``:Pr(e,t)}}function Rr(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return Br(e,t,n,r);if(t instanceof Map)return zr(e,t,n,r);if(t instanceof Set)return Vr(e,t,n,r);let i=Object.keys(t);if(e==null||Zn(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!Zn(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function zr(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function Br(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function Vr(e,t,n,r){return t.size===0||e instanceof Set&&Br([...e],[...t],n,r)}function Hr(e,t){return Ir(e,t,()=>void 0)}function Ur(e){return e=Nr(e),t=>Hr(t,e)}function Wr(e,t){return kr(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(er(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),jr(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case rr:case nr:case ir:{let t=new e.constructor(e?.valueOf());return jr(t,e),t}case ar:{let t={};return jr(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Gr(e){return Wr(e)}var Kr=/^(?:0|[1-9]\d*)$/;function qr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Kr.test(e)}}function Jr(e){return typeof e==`object`&&!!e&&er(e)===`[object Arguments]`}function Yr(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&Be(t)&&e?.[t]==null?Ue(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=n[e];if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||Jr(r))&&qr(t)&&t<r.length))return!1;r=r[t]}return!0}function Xr(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=Ve(e)}return t=Gr(t),function(n){let r=We(n,e);return r===void 0?Yr(n,e):t===void 0?r===void 0:Hr(r,t)}}function Zr(e){if(e==null)return Yn;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?Xr(e[0],e[1]):Ur(e);case`string`:case`symbol`:case`number`:return Xn(e)}}function Qr(e){return Number.isSafeInteger(e)&&e>=0}function $r(e){return e!=null&&typeof e!=`function`&&Qr(e.length)}function ei(e){return typeof e==`object`&&!!e}function ti(e){return ei(e)&&$r(e)}function ni(e,t=Yn){return ti(e)?qn(Array.from(e),Jn(Zr(t),1)):[]}function ri(e,t,n){return t===!0?ni(e,n):typeof t==`function`?ni(e,t):e}var ii=(0,P.createContext)(null),ai=a(),oi=e=>e,z=()=>{var e=(0,P.useContext)(ii);return e?e.store.dispatch:oi},si=()=>{},ci=()=>si,li=(e,t)=>e===t;function B(e){var t=(0,P.useContext)(ii),n=(0,P.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:si,[t,e]);return(0,ai.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:ci,t?t.store.getState:si,t?t.store.getState:si,n,li)}function ui(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function di(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var fi=e=>Array.isArray(e)?e:[e];function pi(e){let t=Array.isArray(e[0])?e[0]:e;return di(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function mi(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var hi=class{constructor(e){this.value=e}deref(){return this.value}},gi=typeof WeakRef>`u`?hi:WeakRef,_i=0,vi=1;function yi(){return{s:_i,v:void 0,o:null,p:null}}function bi(e){return e instanceof gi?e.deref():e}function xi(e,t={}){let n=yi(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=yi(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=yi(),e.set(n,t)):t=r}}let s=t,c;if(t.s===vi)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=bi(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new gi(c):c}return s.s=vi,s.v=c,c}return o.clearCache=()=>{n=yi(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Si(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),ui(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=xi,argsMemoizeOptions:u=[]}={...n,...a},d=fi(c),f=fi(u),p=pi(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=mi(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var V=Si(xi);function Ci(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function wi(e,t,n){return Fr(n)&&(typeof t==`number`&&$r(n)&&qr(t)&&t<n.length||typeof t==`string`&&t in n)?Pr(n[t],e):!1}function Ti(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var Ei=(e,t,n)=>{if(e!==t){let r=Ti(e),i=Ti(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0};function Di(e){return typeof e==`symbol`||e instanceof Symbol}var Oi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ki=/^\w*$/;function Ai(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||Di(e)?!0:typeof e==`string`&&(ki.test(e)||!Oi.test(e))||t!=null&&Object.hasOwn(t,e)}function ji(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e;for(let e=0;e<t.length&&n!=null;++e)n=n[t[e]];return n},a=(e,t)=>t==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):typeof t==`object`?t[e]:t,o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Ai(e)?e:{key:e,path:Ue(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=Ei(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function Mi(e,...t){let n=t.length;return n>1&&wi(e,t[0],t[1])?t=[]:n>2&&wi(t[0],t[1],t[2])&&(t=[t[0]]),ji(e,Ci(t),[`asc`])}var Ni=e=>e.legend.settings,Pi=e=>e.legend.size;V([e=>e.legend.payload,Ni],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Mi(r,n):r});function Fi(e,t){return Bi(e)||zi(e,t)||Li(e,t)||Ii()}function Ii(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Li(e,t){if(e){if(typeof e==`string`)return Ri(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ri(e,t):void 0}}function Ri(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zi(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Bi(e){if(Array.isArray(e))return e}var Vi=1;function Hi(e,t){return Math.abs(e.height-t.height)>Vi||Math.abs(e.left-t.left)>Vi||Math.abs(e.top-t.top)>Vi||Math.abs(e.width-t.width)>Vi}function Ui(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Wi(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=Fi((0,P.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,P.useRef)(null),a=(0,P.useRef)(n);a.current=n;var o=(0,P.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=Ui(e);if(Hi(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=Ui(e);Hi(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,P.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Gi(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ki=typeof Symbol==`function`&&Symbol.observable||`@@observable`,qi=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Ji={INIT:`@@redux/INIT${qi()}`,REPLACE:`@@redux/REPLACE${qi()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qi()}`};function Yi(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Xi(e,t,n){if(typeof e!=`function`)throw Error(Gi(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(Gi(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(Gi(1));return n(Xi)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(Gi(3));return i}function d(e){if(typeof e!=`function`)throw Error(Gi(4));if(c)throw Error(Gi(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(Gi(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!Yi(e))throw Error(Gi(7));if(e.type===void 0)throw Error(Gi(8));if(typeof e.type!=`string`)throw Error(Gi(17));if(c)throw Error(Gi(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(Gi(10));r=e,f({type:Ji.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(Gi(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Ki](){return this}}}return f({type:Ji.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[Ki]:m}}function Zi(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Ji.INIT})===void 0)throw Error(Gi(12));if(n(void 0,{type:Ji.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(Gi(13))})}function Qi(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{Zi(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(Gi(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function $i(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ea(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(Gi(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=$i(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function ta(e){return Yi(e)&&`type`in e&&typeof e.type==`string`}var na=Symbol.for(`immer-nothing`),ra=Symbol.for(`immer-draftable`),ia=Symbol.for(`immer-state`);function aa(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var oa=Object,sa=oa.getPrototypeOf,ca=`constructor`,la=`prototype`,ua=`configurable`,da=`enumerable`,fa=`writable`,pa=`value`,ma=e=>!!e&&!!e[ia];function ha(e){return e?va(e)||Ta(e)||!!e[ra]||!!e[ca]?.[ra]||Ea(e)||Da(e):!1}var ga=oa[la][ca].toString(),_a=new WeakMap;function va(e){if(!e||!Oa(e))return!1;let t=sa(e);if(t===null||t===oa[la])return!0;let n=oa.hasOwnProperty.call(t,ca)&&t[ca];if(n===Object)return!0;if(!ka(n))return!1;let r=_a.get(n);return r===void 0&&(r=Function.toString.call(n),_a.set(n,r)),r===ga}function ya(e,t,n=!0){ba(e)===0?(n?Reflect.ownKeys(e):oa.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ba(e){let t=e[ia];return t?t.type_:Ta(e)?1:Ea(e)?2:Da(e)?3:0}var xa=(e,t,n=ba(e))=>n===2?e.has(t):oa[la].hasOwnProperty.call(e,t),Sa=(e,t,n=ba(e))=>n===2?e.get(t):e[t],Ca=(e,t,n,r=ba(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wa(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Ta=Array.isArray,Ea=e=>e instanceof Map,Da=e=>e instanceof Set,Oa=e=>typeof e==`object`,ka=e=>typeof e==`function`,Aa=e=>typeof e==`boolean`;function ja(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Ma=e=>e.copy_||e.base_,Na=e=>e.modified_?e.copy_:e.base_;function Pa(e,t){if(Ea(e))return new Map(e);if(Da(e))return new Set(e);if(Ta(e))return Array[la].slice.call(e);let n=va(e);if(t===!0||t===`class_only`&&!n){let t=oa.getOwnPropertyDescriptors(e);delete t[ia];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[fa]===!1&&(a[fa]=!0,a[ua]=!0),(a.get||a.set)&&(t[i]={[ua]:!0,[fa]:!0,[da]:a[da],[pa]:e[i]})}return oa.create(sa(e),t)}{let t=sa(e);if(t!==null&&n)return{...e};let r=oa.create(t);return oa.assign(r,e)}}function Fa(e,t=!1){return Ra(e)||ma(e)||!ha(e)||(ba(e)>1&&oa.defineProperties(e,{set:La,add:La,clear:La,delete:La}),oa.freeze(e),t&&ya(e,(e,t)=>{Fa(t,!0)},!1)),e}function Ia(){aa(2)}var La={[pa]:Ia};function Ra(e){return e===null||!Oa(e)||oa.isFrozen(e)}var za=`MapSet`,Ba=`Patches`,Va=`ArrayMethods`,Ha={};function Ua(e){let t=Ha[e];return t||aa(0,e),t}var Wa=e=>!!Ha[e],Ga,Ka=()=>Ga,qa=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Wa(za)?Ua(za):void 0,arrayMethodsPlugin_:Wa(Va)?Ua(Va):void 0});function Ja(e,t){t&&(e.patchPlugin_=Ua(Ba),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ya(e){Xa(e),e.drafts_.forEach(Qa),e.drafts_=null}function Xa(e){e===Ga&&(Ga=e.parent_)}var Za=e=>Ga=qa(Ga,e);function Qa(e){let t=e[ia];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $a(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ia].modified_&&(Ya(t),aa(4)),ha(e)&&(e=eo(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ia].base_,e,t)}else e=eo(t,n);return to(t,e,!0),Ya(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===na?void 0:e}function eo(e,t){if(Ra(t))return t;let n=t[ia];if(!n)return lo(t,e.handledSet_,e);if(!ro(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);so(n,e)}return n.copy_}function to(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fa(t,n)}function no(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var ro=(e,t)=>e.scope_===t,io=[];function ao(e,t,n,r){let i=Ma(e),a=e.type_;if(r!==void 0&&Sa(i,r,a)===t){Ca(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;ya(i,(e,n)=>{if(ma(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??io;for(let e of o)Ca(i,e,n,a)}function oo(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!ro(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Na(i);ao(e,i.draft_??i,a,n),so(i,r)})}function so(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}no(e)}}function co(e,t,n){let{scope_:r}=e;if(ma(n)){let i=n[ia];ro(i,r)&&i.callbacks_.push(function(){yo(e),ao(e,n,Na(i),t)})}else ha(n)&&e.callbacks_.push(function(){let i=Ma(e);e.type_===3?i.has(n)&&lo(n,r.handledSet_,r):Sa(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&lo(Sa(e.copy_,t,e.type_),r.handledSet_,r)})}function lo(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ma(e)||t.has(e)||!ha(e)||Ra(e)||(t.add(e),ya(e,(r,i)=>{if(ma(i)){let t=i[ia];ro(t,n)&&(Ca(e,r,Na(t),e.type_),no(t))}else ha(i)&&lo(i,t,n)})),e}function uo(e,t){let n=Ta(e),r={type_:+!!n,scope_:t?t.scope_:Ka(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=fo;n&&(i=[r],a=po);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var fo={get(e,t){if(t===ia)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Ma(e);if(!xa(i,t,e.type_))return go(e,i,t);let a=i[t];if(e.finalized_||!ha(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&ja(t))return a;if(a===mo(e.base_,t)||ho(e,t,a)){yo(e);let n=e.type_===1?+t:t,r=xo(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Ma(e)},ownKeys(e){return Reflect.ownKeys(Ma(e))},set(e,t,n){let r=_o(Ma(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=mo(Ma(e),t),i=r?.[ia];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(wa(n,r)&&(n!==void 0||xa(e.base_,t,e.type_)))return!0;yo(e),vo(e)}return e.copy_[t]===n&&(n!==void 0||xa(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),co(e,t,n)),!0},deleteProperty(e,t){return yo(e),mo(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),vo(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Ma(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[fa]:!0,[ua]:e.type_!==1||t!==`length`,[da]:r[da],[pa]:n[t]}},defineProperty(){aa(11)},getPrototypeOf(e){return sa(e.base_)},setPrototypeOf(){aa(12)}},po={};for(let e in fo){let t=fo[e];po[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}po.deleteProperty=function(e,t){return po.set.call(this,e,t,void 0)},po.set=function(e,t,n){return fo.set.call(this,e[0],t,n,e[0])};function mo(e,t){let n=e[ia];return(n?Ma(n):e)[t]}function ho(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!ha(n)||n[ia]?!1:e.baseRefs_.has(n)}function go(e,t,n){let r=_o(t,n);return r?pa in r?r[pa]:r.get?.call(e.draft_):void 0}function _o(e,t){if(!(t in e))return;let n=sa(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=sa(n)}}function vo(e){e.modified_||(e.modified_=!0,e.parent_&&vo(e.parent_))}function yo(e){e.copy_||=(e.assigned_=new Map,Pa(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var bo=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(ka(e)&&!ka(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}ka(t)||aa(6),n!==void 0&&!ka(n)&&aa(7);let r;if(ha(e)){let i=Za(this),a=xo(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Ya(i):Xa(i)}return Ja(i,n),$a(r,i)}if(!e||!Oa(e)){if(r=t(e),r===void 0&&(r=e),r===na&&(r=void 0),this.autoFreeze_&&Fa(r,!0),n){let t=[],i=[];Ua(Ba).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}aa(1,e)},this.produceWithPatches=(e,t)=>{if(ka(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Aa(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Aa(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Aa(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ha(e)||aa(8),ma(e)&&(e=So(e));let t=Za(this),n=xo(t,e,void 0);return n[ia].isManual_=!0,Xa(t),n}finishDraft(e,t){let n=e&&e[ia];n&&n.isManual_||aa(9);let{scope_:r}=n;return Ja(r,t),$a(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Ua(Ba).applyPatches_;return ma(e)?r(e,t):this.produce(e,e=>r(e,t))}};function xo(e,t,n,r){let[i,a]=Ea(t)?Ua(za).proxyMap_(t,n):Da(t)?Ua(za).proxySet_(t,n):uo(t,n);return(n?.scope_??Ka()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?oo(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function So(e){return ma(e)||aa(10,e),Co(e)}function Co(e){if(!ha(e)||Ra(e))return e;let t=e[ia],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Pa(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Pa(e,!0);let i=n;return Da(n)&&(n=new Set),ya(i,(e,t)=>{Ca(n,e,Co(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var wo=new bo().produce,H=e=>e;function To(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var Eo=To(),Do=To,Oo=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?$i:$i.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function ko(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(Ls(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t!=null&&t.type===e&&ta(t),n}var Ao=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function jo(e){return ha(e)?wo(e,()=>{}):e}function Mo(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function No(e){return typeof e==`boolean`}var Po=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new Ao;return t&&(No(t)?a.push(Eo):a.push(Do(t.extraArgument))),a},Fo=`RTK_autoBatch`,U=()=>e=>({payload:e,meta:{[Fo]:!0}}),Io=e=>t=>{setTimeout(t,e)},Lo=(e,t,n)=>r=>{let i=!1,a,o,s=()=>{i||(i=!0,t?.(a),clearTimeout(o),r())};a=e(s),o=setTimeout(s,n)},Ro=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?Lo(window.requestAnimationFrame,window.cancelAnimationFrame,100):Io(10):e.type===`callback`?e.queueNotification:Io(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[Fo],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},zo=e=>function(t){let{autoBatch:n=!0}=t??{},r=new Ao(e);return n&&r.push(Ro(typeof n==`object`?n:void 0)),r};function Bo(e){let t=Po(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(Yi(n))c=Qi(n);else throw Error(Ls(1));let l;l=typeof r==`function`?r(t):t();let u=$i;i&&(u=Oo({trace:!1,...typeof i==`object`&&i}));let d=zo(ea(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return Xi(c,o,p)}function Vo(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(Ls(28));if(r in t)throw Error(Ls(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function Ho(e){return typeof e==`function`}function Uo(e,t){let[n,r,i]=Vo(t),a;if(Ho(e))a=()=>jo(e());else{let t=jo(e);a=()=>t}function o(e,t,n){if(ma(e)){let r=t(e,n);return r===void 0?e:r}if(ha(e))return wo(e,e=>t(e,n));{let r=t(e,n);if(r===void 0){if(e===null)return e;throw Error(Ls(9))}return r}}function s(e=a(),t){let s=n[t.type],c;for(let{matcher:e,reducer:n}of r)e(t)&&n&&(c??=[]).push(n);if(!s&&!c)return i?o(e,i,t):e;if(s&&(e=o(e,s,t)),c)for(let n of c)e=o(e,n,t);return e}return s.getInitialState=a,s}var Wo=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,Go=(e=21)=>{let t=``,n=e;for(;n--;)t+=Wo[Math.random()*64|0];return t},Ko=Symbol.for(`rtk-slice-createasyncthunk`);function qo(e,t){return`${e}/${t}`}function Jo({creators:e}={}){let t=e?.asyncThunk?.[Ko];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(Ls(11));let i=(typeof e.reducers==`function`?e.reducers(Zo()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(Ls(12));if(n in o.sliceCaseReducersByType)throw Error(Ls(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:qo(n,r),createNotation:typeof e.reducers==`function`};$o(a)?ts(o,a,s,t):Qo(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?Vo(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return Uo(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=Mo(d,r,m)),i}function i(t=l){return Mo(Mo(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=Yo(a,t,()=>Mo(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function Yo(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var Xo=Jo();function Zo(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function Qo({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!es(r))throw Error(Ls(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ko(e,o):ko(e))}function $o(e){return e._reducerDefinitionType===`asyncThunk`}function es(e){return e._reducerDefinitionType===`reducerWithPrepare`}function ts({type:e,reducerName:t},n,r,i){if(!i)throw Error(Ls(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||ns,pending:s||ns,rejected:c||ns,settled:l||ns})}function ns(){}var rs=`task`,is=`listener`,as=`completed`,os=`cancelled`,ss=`task-${os}`,cs=`task-${as}`,ls=`${is}-${os}`,us=`${is}-${as}`,ds=class{code;name=`TaskAbortError`;message;constructor(e){this.code=e,this.message=`${rs} ${os} (reason: ${e})`}},fs=(e,t)=>{if(typeof e!=`function`)throw TypeError(Ls(32))},ps=()=>{},ms=(e,t=ps)=>(e.catch(t),e),hs=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),gs=e=>{if(e.aborted)throw new ds(e.reason)};function _s(e,t){let n=ps;return new Promise((r,i)=>{let a=()=>i(new ds(e.reason));e.aborted?a():(n=hs(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=ps})}var vs=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof ds?`cancelled`:`rejected`,error:e}}finally{t?.()}},ys=e=>t=>ms(_s(e,t).then(t=>(gs(e),t))),bs=e=>{let t=ys(e);return e=>{let n;return ms(t(new Promise(t=>{n=setTimeout(t,e)})).finally(()=>clearTimeout(n)))}},{assign:xs}=Object,Ss={},Cs=`listenerMiddleware`,ws=(e,t)=>{let n=t=>hs(e,()=>t.abort(e.reason));return(r,i)=>{fs(r,`taskExecutor`);let a=new AbortController;n(a);let o=vs(async()=>{gs(e),gs(a.signal);let t=await r({pause:ys(a.signal),delay:bs(a.signal),signal:a.signal});return gs(a.signal),t},()=>a.abort(cs));return i?.autoJoin&&t.push(o.catch(ps)),{result:ys(e)(o),cancel(){a.abort(ss)}}}},Ts=(e,t)=>{let n=async(n,r)=>{gs(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})],o;r!=null&&a.push(new Promise(e=>{o=setTimeout(e,r,null)}));try{let e=await _s(t,Promise.race(a));return gs(t),e}finally{clearTimeout(o),i()}};return((e,t)=>ms(n(e,t)))},Es=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=ko(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(Ls(21));return fs(a,`options.listener`),{predicate:i,type:t,effect:a}},Ds=xs(e=>{let{type:t,predicate:n,effect:r}=Es(e);return{id:Go(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(Ls(22))}}},{withTypes:()=>Ds}),Os=(e,t)=>{let{type:n,effect:r,predicate:i}=Es(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},ks=e=>{e.pending.forEach(e=>{e.abort(ls)})},As=(e,t)=>()=>{for(let e of t.keys())ks(e);e.clear()},js=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},Ms=xs(ko(`${Cs}/add`),{withTypes:()=>Ms}),Ns=ko(`${Cs}/removeAll`),Ps=xs(ko(`${Cs}/remove`),{withTypes:()=>Ps}),Fs=(...e)=>{console.error(`${Cs}/error`,...e)},Is=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=Fs}=e;fs(o,`onError`);let s,c=()=>{if(!s){let e=Array.from(t.values()),n=new Set,r=!1;for(let t of e)typeof t.type==`string`?n.add(t.type):r=!0;s={entries:e,types:n,anyType:r}}return s},l=e=>{t.has(e.id)||(t.set(e.id,e),s=void 0)},u=e=>(e.unsubscribe=()=>{t.delete(e.id)&&(s=void 0)},l(e),t=>{e.unsubscribe(),t?.cancelActive&&ks(e)}),d=(e=>{let n=Os(t,e)??Ds(e);return u(n)});xs(d,{withTypes:()=>d});let f=e=>{let n=Os(t,e);return n&&(n.unsubscribe(),e.cancelActive&&ks(n)),!!n};xs(f,{withTypes:()=>f});let p=async(e,t,n,s)=>{let c=new AbortController,u=Ts(d,c.signal),f=[];try{e.pending.add(c),r(e),await Promise.resolve(e.effect(t,xs({},n,{getOriginalState:s,condition:(e,t)=>u(e,t).then(Boolean),take:u,delay:bs(c.signal),pause:ys(c.signal),extra:a,signal:c.signal,fork:ws(c.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{l(e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==c&&(e.abort(ls),n.delete(e))})},cancel:()=>{c.abort(ls),e.pending.delete(c)},throwIfCancelled:()=>{gs(c.signal)}})))}catch(e){e instanceof ds||js(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),c.abort(us),i(e),e.pending.delete(c)}},m=As(t,n),h=()=>{m(),s=void 0};return{middleware:e=>t=>n=>{if(!ta(n))return t(n);if(Ms.match(n))return d(n.payload);if(Ns.match(n)){h();return}if(Ps.match(n))return f(n.payload);let r=e.getState(),i=()=>{if(r===Ss)throw Error(Ls(23));return r},a;try{a=t(n);let{entries:s,types:l,anyType:u}=c();if(u||l.has(n.type)){let t=e.getState();for(let a of s){if(typeof a.type==`string`&&a.type!==n.type)continue;let s=!1;try{s=a.predicate(n,t,r)}catch(e){s=!1,js(o,e,{raisedBy:`predicate`})}s&&p(a,n,e,i)}}}finally{r=Ss}return a},startListening:d,stopListening:f,clearListeners:h}};function Ls(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Rs=Xo({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),zs=Rs.actions,Bs=zs.setMargin,Vs=zs.setLayout,Hs=zs.setChartSize,Us=zs.setScale,Ws=Rs.reducer;function Gs(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function W(e){return Number.isFinite(e)}function Ks(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function qs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Js(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qs(Object(n),!0).forEach(function(t){Ys(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ys(e,t,n){return(t=Xs(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xs(e){var t=Zs(e,`string`);return typeof t==`symbol`?t:t+``}function Zs(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Qs(e,t,n){return L(e)||L(t)?n:Qe(t)?We(e,t,n):typeof t==`function`?t(e):n}var $s=(e,t,n)=>{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(gt(c)){if(c===`top`&&I(e.top))return Js(Js({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&I(e.bottom))return Js(Js({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&I(e.left))return Js(Js({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&I(e.right))return Js(Js({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&I(e[a]))return Js(Js({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&I(e[o]))return Js(Js({},e),{},{[o]:e[o]+(i||0)})}return e},ec=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,tc=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},nc=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Ye(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return W(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(ot):c&&l?l.map((e,t)=>{var n=o.map(e);return W(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ot):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return W(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(ot):o.domain().map((e,t)=>{var n=o.map(e);return W(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(ot)},rc=(e,t)=>{if(!t||t.length!==2||!I(t[0])||!I(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!I(e[0])||e[0]<n)&&(i[0]=n),(!I(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},ic={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=Xe(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:Pn,none:kn,silhouette:Fn,wiggle:In,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=Xe(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},ac=(e,t,n)=>{var r=ic[n]??kn,i=Nn().keys(t).value((e,t)=>Number(Qs(e,t,0))).order(An).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=Qs(e[i],t[r],0);Array.isArray(a)&&a.length===2&&I(a[0])&&I(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function oc(e){return e==null?void 0:String(e)}var sc=e=>{var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=Qs(a,t.dataKey,t.scale.domain()[o]);if(L(s))return null;var c=t.scale.map(s);return I(c)?c-i/2+r:null},cc=e=>{var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},lc=e=>{var t=e.flat(2).filter(I);return[Math.min(...t),Math.max(...t)]},uc=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],dc=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return uc(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=lc(Gs(r,t,n));return!W(i[0])||!W(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},fc=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,pc=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mc=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Mi(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;s<c;s++){var l=(i[s]?.coordinate||0)-(i[s-1]?.coordinate||0);a.push(l),o=Math.max(l,o)}var u=o*1e-4,d=1/0;for(var f of a)f>u&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function hc(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return Js(Js({},t),{},{dataKey:n,payload:r,value:i,name:a})}function gc(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var _c=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},vc=(e,t)=>t===`centric`?e.angle:e.radius,yc=e=>e.layout.width,bc=e=>e.layout.height,xc=e=>e.layout.scale,Sc=e=>e.layout.margin,Cc=V(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),wc=V(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Tc=`data-recharts-item-index`;function Ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ec(Object(n),!0).forEach(function(t){Oc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ec(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Oc(e,t,n){return(t=kc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kc(e){var t=Ac(e,`string`);return typeof t==`symbol`?t:t+``}function Ac(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var jc=e=>e.brush.height;function Mc(e){return wc(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Nc(e){return wc(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Pc(e){return Cc(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Fc(e){return Cc(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Ic=V([yc,bc,Sc,jc,Mc,Nc,Pc,Fc,Ni,Pi],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Dc(Dc({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=$s(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Dc(Dc({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Lc=V(Ic,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Rc=V(yc,bc,(e,t)=>({x:0,y:0,width:e,height:t})),zc=(0,P.createContext)(null),Bc=()=>(0,P.useContext)(zc)!=null,Vc=e=>e.brush,Hc=V([Vc,Ic,Sc],(e,t,n)=>({height:e.height,x:I(e.x)?e.x:t.left,y:I(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:I(e.width)?e.width:t.width}));function Uc(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Wc(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=Uc(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Gc(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Wc(e,t,{leading:r,maxWait:t,trailing:i})}var Kc=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},qc={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},Jc=(e,t,n)=>{var r=n.width,i=r===void 0?qc.width:r,a=n.height,o=a===void 0?qc.height:a,s=n.aspect,c=n.maxHeight,l=Ze(i)?e:Number(i),u=Ze(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},Yc={width:0,height:0,overflow:`visible`},Xc={width:0,overflowX:`visible`},Zc={height:0,overflowY:`visible`},Qc={},$c=e=>{var t=e.width,n=e.height,r=Ze(t),i=Ze(n);return r&&i?Yc:r?Xc:i?Zc:Qc};function el(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=qc.width,a=qc.height):i===void 0?i=r&&r>0?void 0:qc.width:a===void 0&&(a=r&&r>0?void 0:qc.height),{width:i,height:a}}var tl=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function nl(){return nl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nl.apply(null,arguments)}function rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?rl(Object(n),!0).forEach(function(t){al(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function al(e,t,n){return(t=ol(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ol(e){var t=sl(e,`string`);return typeof t==`symbol`?t:t+``}function sl(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function cl(e,t){return pl(e)||fl(e,t)||ul(e,t)||ll()}function ll(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ul(e,t){if(e){if(typeof e==`string`)return dl(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dl(e,t):void 0}}function dl(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fl(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function pl(e){if(Array.isArray(e))return e}function ml(e,t){if(e==null)return{};var n,r,i=hl(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function hl(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var gl=(0,P.createContext)(qc.initialDimension);function _l(e){return Ks(e.width)&&Ks(e.height)}function vl(e){var t=e.children,n=e.width,r=e.height,i=(0,P.useMemo)(()=>({width:n,height:r}),[n,r]);return _l(i)?P.createElement(gl.Provider,{value:i},t):null}var yl=()=>(0,P.useContext)(gl),bl=(0,P.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?qc.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?qc.minWidth:s,l=e.minHeight,d=e.maxHeight,f=e.children,p=e.debounce,m=p===void 0?qc.debounce:p,h=e.id,g=e.className,_=e.onResize,v=e.style,y=v===void 0?{}:v,b=ml(e,tl),x=(0,P.useRef)(null),S=(0,P.useRef)();S.current=_,(0,P.useImperativeHandle)(t,()=>x.current);var C=cl((0,P.useState)({containerWidth:i.width,containerHeight:i.height}),2),w=C[0],T=C[1],E=(0,P.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,P.useEffect)(()=>{if(x.current==null||typeof ResizeObserver>`u`)return st;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=S.current)==null||t.call(S,i,a)}};m>0&&(e=Gc(e,m,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=x.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(x.current),()=>{t.disconnect()}},[E,m]);var D=w.containerWidth,O=w.containerHeight;Kc(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=Jc(D,O,{width:a,height:o,aspect:n,maxHeight:d}),A=k.calculatedWidth,j=k.calculatedHeight;return Kc(D<0||O<0||A!=null&&A>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
|
4
4
|
please check the style of container, or the props width(%s) and height(%s),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{A as r,Cn as i,En as a,Et as o,Fr as s,G as c,Kn as l,Nr as u,Ot as d,Qn as f,Qt as p,Sn as m,Tn as h,Tt as ee,W as te,Xt as ne,Y as re,Yt as g,Zt as ie,an as ae,bn as _,c as v,er as y,i as b,in as oe,ir as se,j as ce,jn as x,kn as S,kr as C,or as w,sr as T,tn as le,vr as E,wt as ue,xn as D,yn as O,yr as de,zn as fe}from"./button-amJ3g5oD.js";import{i as pe,s as me,y as he}from"./fields-BAiGkJ5N.js";var k=e(t(),1);function ge(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=f}=t,u=e.context.dataRef,d=k.useRef(void 0),p=te(),m=re(),h=k.useMemo(()=>{function t(t,n,r,i){let a=y(l,n,r);t&&i===`touch`&&c>0?m.start(c,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=u.current.openEvent,o=e.select(`domReferenceElement`)!==n;return t&&o||!t||!i?!0:a&&(typeof s==`function`?s():s)?!r(a.type):!1}return{onPointerDown(e){d.current=g(e.pointerType,!0)&&ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let s=d.current,c=i.nativeEvent,l=e.select(`open`);if(i.button!==0||r===`click`||g(s,!0)&&o)return;let u=n(l,i.currentTarget,e=>e===`click`||e===`mousedown`),f=a(c),m=ae(f);if(m||s===`virtual`){t(u,c,m?f:i.currentTarget,s);return}let h=i.currentTarget;p.request(()=>{t(u,c,h,s)})},onClick(i){if(r===`mousedown-only`)return;let a=d.current;r===`mousedown`&&a?d.current=void 0:g(a,!0)&&o||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,a)},onKeyDown(){d.current=void 0}}},[u,r,o,l,e,s,i,p,m,c]);return k.useMemo(()=>n?{reference:h}:C,[n,h])}function _e(e){let{open:t=!1,onOpenChange:n,elements:i={}}=e,a=s(),o=r()!=null,c=u(()=>new b({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:new v,floatingId:a,syncOnly:!1,nested:o})).current;return w(()=>{let e={open:t,floatingId:a};i.reference!==void 0&&(e.referenceElement=i.reference,e.domReferenceElement=E(i.reference)?i.reference:null),i.floating!==void 0&&(e.floatingElement=i.floating),c.update(e)},[t,a,i.reference,i.floating,c]),c.context.onOpenChange=n,c.context.nested=o,c}function ve(e){return S&&e.movementX===0&&e.movementY===0}function A(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function j(e,t){return A(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function ye(e,t,n){return A(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function be(e,t,n){return A(t,n?e===_:e===D,e===O)}function xe(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:A(t,n?e===D:e===_,e===m)}function M(e,t){let{listRef:n,activeIndex:s,onNavigate:u=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:re=!1,loopFocus:g=!1,nested:_=!1,rtl:v=!1,virtual:b=!1,focusItemOnOpen:x=`auto`,focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:E=void 0,orientation:D=`vertical`,triggerOrientation:O=D,parentOrientation:pe,id:me,resetOnPointerLeave:ge=!0,externalTree:_e,nestedReturnFocusRef:A,grid:M}=t,Se=M!=null,N=e.useState(`open`),P=e.useState(`floatingElement`),F=e.useState(`domReferenceElement`),Ce=e.context.dataRef,I=le(P),L=oe(F),R=c(I),z=r(),B=ce(_e),V=k.useRef(x),H=k.useRef(m??-1),U=k.useRef(null),W=k.useRef(!0),G=T(e=>{u(H.current===-1?null:H.current,e)}),K=k.useRef(!!P),we=k.useRef(N),q=k.useRef(!1),J=k.useRef(!1),Y=k.useRef(null),Te=c(E),X=c(N),Z=c(m),Ee=c(ge),De=te(),Oe=te(),ke=T(()=>{De.cancel();function e(e){b||(Y.current=he(e,{sync:q.current,preventScroll:!0}))}let t=n.current[H.current],r=J.current;t&&e(t),(q.current?e=>e():e=>De.request(e))(()=>{let i=n.current[H.current]||t;i&&(t||e(i),Ne&&(r||!W.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});w(()=>{Ce.current.orientation=D},[Ce,D]),w(()=>{N||(U.current=null),N&&x===`auto`||(V.current=x)},[N,x]),w(()=>{f&&(N&&P?(H.current=m??-1,V.current&&m!=null&&(J.current=!0,G())):K.current&&(H.current=-1,G()))},[f,N,P,m,G]),w(()=>{if(f){if(!N)q.current=!1;else if(P){if(s==null){if(q.current=!1,Z.current!=null)return;if(K.current&&(H.current=-1,ke()),(!we.current||!K.current)&&V.current&&(U.current!=null||V.current===!0&&U.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>Oe.request(e):queueMicrotask)(t),e+=1):(H.current=U.current==null||ye(U.current,O,v)||_?ee(n):ue(n),U.current=null,G())};t()}}else d(n.current,s)||(H.current=s,ke(),J.current=!1)}}},[f,N,P,s,Z,_,n,O,v,G,ke,Oe]),w(()=>{if(!f||P||!B||b||!K.current)return;let e=B.nodesRef.current,t=e.find(e=>e.id===z)?.context?.elements.floating,n=i(se(F??t??null)),r=e.some(e=>e.context&&h(e.context.elements.floating,n));t&&!r&&W.current&&t.focus({preventScroll:!0})},[f,P,F,B,z,b]),w(()=>{we.current=N,K.current=!!P});let Ae=s!=null,je=T(e=>{if(!X.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(H.current!==t||s!==t)&&(H.current=t,G(e))}),Q=T(()=>pe??B?.nodesRef.current.find(e=>e.id===z)?.context?.dataRef?.current.orientation),Me=T(()=>ee(n,Te.current)),$=T(t=>{if(W.current=!1,q.current=!0,t.which===229||!X.current&&t.currentTarget===R.current)return;if(_&&xe(t.key,D,v,Se)){j(t.key,Q())||p(t),e.setOpen(!1,y(l,t.nativeEvent));let n=A?.current??F;de(n)&&n.focus();return}s!=null&&s!==H.current&&!d(n.current,s)&&(H.current=s);let r=H.current,a=ee(n,E),c=ue(n,E);if(L||(t.key===`Home`&&(p(t),H.current=a,G(t)),t.key===`End`&&(p(t),H.current=c,G(t))),M!=null){let e=M(t,H.current,n,D,g,v,E,a,c);if(e!=null&&e!==H.current&&(H.current=e,G(t)),D===`both`)return}if(j(t.key,D)){p(t);let e=i(t.currentTarget.ownerDocument);if(N&&!b&&h(t.currentTarget,e)&&!n.current.some(t=>t!=null&&h(t,e))){H.current=ye(t.key,D,v)?a:c,G(t),s===H.current&&ke();return}let{index:l,wrapped:u}=o(n.current,r,{decrement:!ye(t.key,D,v),loopFocus:g,allowEscape:re,disabledIndices:E,minIndex:a,maxIndex:c});u&&(q.current=!1),H.current=l,G(t)}}),Ne=k.useMemo(()=>({onFocus(e){q.current=!0,je(e)},onClick({currentTarget:e}){b||e.focus({preventScroll:!0})},onMouseMove(e){ve(e)||(q.current=!0,J.current=!1,S&&je(e))},onPointerLeave(e){if(!X.current||!W.current||e.pointerType===`touch`)return;q.current=!0;let t=e.relatedTarget;if(S&&!n.current.includes(t)&&Ee.current&&(Y.current?.(),Y.current=null,H.current=-1,G(e),!b)){let e=R.current,t=i(se(e));e&&h(e,t)&&e.focus({preventScroll:!0})}}}),[je,X,R,S,n,G,Ee,b]),Pe=k.useMemo(()=>b&&N&&Ae&&{"aria-activedescendant":`${me}-${s}`},[b,N,Ae,me,s]),Fe=k.useMemo(()=>({...L?{}:Pe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&N&&!b){let n=a(t.nativeEvent);if(n&&!h(R.current,n))return;p(t);let r=y(fe,t.nativeEvent);e.setOpen(!1,r);let i=A?.current??F;!r.isCanceled&&de(i)&&i.focus()}else $(t)},onPointerMove(e){ve(e)||(W.current=!0)}}),[Pe,$,R,L,e,N,b,F,A]),Ie=k.useMemo(()=>{function t(t){e.setOpen(!0,y(l,t.nativeEvent,t.currentTarget))}function n(e){x===`auto`&&ne(e.nativeEvent)&&(V.current=!b)}function r(e){V.current=x,x===`auto`&&ie(e.nativeEvent)&&(V.current=!0)}return{onKeyDown(n){let r=e.select(`open`);W.current=!1;let i=n.key.startsWith(`Arrow`),a=be(n.key,Q(),v),o=j(n.key,r?D:O),s=(_?a:o)||n.key===`Enter`||n.key.trim()===``;if(b&&r&&(!_||ae(n.currentTarget)))return $(n);if(r||C||!i){if(s){let e=j(n.key,Q());U.current=_&&e?null:n.key}_?a&&(p(n),r?(H.current=Me(),G(n),b&&R.current?.focus()):t(n)):o&&(Z.current!=null&&(H.current=Z.current),p(n),!r&&C?t(n):$(n),r&&G(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!b&&(H.current=-1,G(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[$,x,Me,_,G,e,C,D,O,Q,v,Z,b,R]),Le=k.useMemo(()=>({...Pe,...Ie}),[Pe,Ie]);return k.useMemo(()=>f?{reference:Le,floating:Fe,item:Ne,trigger:Ie}:{},[f,Le,Fe,Ie,Ne])}function Se(e){let t=k.useRef(!0);t.current&&(t.current=!1,e())}function N(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var P=(e,t)=>Object.is(e,t);function F(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ce(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!N(e,t,(e,t)=>F(e,t,n)):e!==t}function I(e,t,n){return e?e.some(e=>e!==void 0&&F(t,e,n)):!1}function L(e,t,n){return e?e.findIndex(e=>e!==void 0&&F(e,t,n)):-1}function R(e,t){if(t!==P)return n=>I(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function z(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(R(t,n)):L(e,t,n);return i===-1?null:i}function B(e,t,n,r,i,a){return I(r,t,i)?a!=null&&e>a&&I(r,n[a],i)?a:e:e===a?z(n,r,i,!0):a}function V(e,t,n){return e.filter(e=>!F(t,e,n))}function H(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var U=n();function W(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function G(e){return W(e?.[0])}function K(e){return G(e)?e.flatMap(e=>e.items):e}function we(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(G(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function q(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return H(e)}function J(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?H(e.value):H(e)}function Y(e,t,n){function r(){return q(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=K(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Te(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,U.jsx)(k.Fragment,{children:Y(r,t,n)},i)),e),[])}function X(e){let t=k.useRef(``),n=k.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:k.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Z(e,t){let{onClick:n,onPointerDown:r}=X(T((n,r)=>{(typeof e==`function`?e():e)||t(r||(x?`touch`:``))}));return k.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ee(e){let[t,n]=k.useState(null),r=Z(e,n);return me(e,t=>{t&&!e&&n(null)}),k.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var De=20;function Oe(e,t,n,r){let[i,a]=k.useState(!1);w(()=>{if(!e||!t||n==null){a(!1);return}let r=se(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-De)},[e,t,n]),pe(e&&(!t||i),r)}export{ge as S,B as _,we as a,M as b,Y as c,F as d,P as f,V as g,Ce as h,K as i,q as l,z as m,Ee as n,G as o,L as p,Z as r,Te as s,Oe as t,J as u,I as v,_e as x,Se as y};
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{A as r,Cn as i,En as a,Et as o,Fr as s,G as c,Kn as l,Nr as u,Ot as d,Qn as f,Qt as p,Sn as m,Tn as h,Tt as ee,W as te,Xt as ne,Y as re,Yt as g,Zt as ie,an as ae,bn as _,c as v,er as y,i as b,in as oe,ir as se,j as ce,jn as x,kn as S,kr as C,or as w,sr as T,tn as le,vr as E,wt as ue,xn as D,yn as O,yr as de,zn as fe}from"./button-C9SQW3kI.js";import{i as pe,s as me,y as he}from"./fields-CEep8IFT.js";var k=e(t(),1);function ge(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=f}=t,u=e.context.dataRef,d=k.useRef(void 0),p=te(),m=re(),h=k.useMemo(()=>{function t(t,n,r,i){let a=y(l,n,r);t&&i===`touch`&&c>0?m.start(c,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=u.current.openEvent,o=e.select(`domReferenceElement`)!==n;return t&&o||!t||!i?!0:a&&(typeof s==`function`?s():s)?!r(a.type):!1}return{onPointerDown(e){d.current=g(e.pointerType,!0)&&ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let s=d.current,c=i.nativeEvent,l=e.select(`open`);if(i.button!==0||r===`click`||g(s,!0)&&o)return;let u=n(l,i.currentTarget,e=>e===`click`||e===`mousedown`),f=a(c),m=ae(f);if(m||s===`virtual`){t(u,c,m?f:i.currentTarget,s);return}let h=i.currentTarget;p.request(()=>{t(u,c,h,s)})},onClick(i){if(r===`mousedown-only`)return;let a=d.current;r===`mousedown`&&a?d.current=void 0:g(a,!0)&&o||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,a)},onKeyDown(){d.current=void 0}}},[u,r,o,l,e,s,i,p,m,c]);return k.useMemo(()=>n?{reference:h}:C,[n,h])}function _e(e){let{open:t=!1,onOpenChange:n,elements:i={}}=e,a=s(),o=r()!=null,c=u(()=>new b({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:new v,floatingId:a,syncOnly:!1,nested:o})).current;return w(()=>{let e={open:t,floatingId:a};i.reference!==void 0&&(e.referenceElement=i.reference,e.domReferenceElement=E(i.reference)?i.reference:null),i.floating!==void 0&&(e.floatingElement=i.floating),c.update(e)},[t,a,i.reference,i.floating,c]),c.context.onOpenChange=n,c.context.nested=o,c}function ve(e){return S&&e.movementX===0&&e.movementY===0}function A(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function j(e,t){return A(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function ye(e,t,n){return A(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function be(e,t,n){return A(t,n?e===_:e===D,e===O)}function xe(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:A(t,n?e===D:e===_,e===m)}function M(e,t){let{listRef:n,activeIndex:s,onNavigate:u=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:re=!1,loopFocus:g=!1,nested:_=!1,rtl:v=!1,virtual:b=!1,focusItemOnOpen:x=`auto`,focusItemOnHover:S=!0,openOnArrowKeyDown:C=!0,disabledIndices:E=void 0,orientation:D=`vertical`,triggerOrientation:O=D,parentOrientation:pe,id:me,resetOnPointerLeave:ge=!0,externalTree:_e,nestedReturnFocusRef:A,grid:M}=t,Se=M!=null,N=e.useState(`open`),P=e.useState(`floatingElement`),F=e.useState(`domReferenceElement`),Ce=e.context.dataRef,I=le(P),L=oe(F),R=c(I),z=r(),B=ce(_e),V=k.useRef(x),H=k.useRef(m??-1),U=k.useRef(null),W=k.useRef(!0),G=T(e=>{u(H.current===-1?null:H.current,e)}),K=k.useRef(!!P),we=k.useRef(N),q=k.useRef(!1),J=k.useRef(!1),Y=k.useRef(null),Te=c(E),X=c(N),Z=c(m),Ee=c(ge),De=te(),Oe=te(),ke=T(()=>{De.cancel();function e(e){b||(Y.current=he(e,{sync:q.current,preventScroll:!0}))}let t=n.current[H.current],r=J.current;t&&e(t),(q.current?e=>e():e=>De.request(e))(()=>{let i=n.current[H.current]||t;i&&(t||e(i),Ne&&(r||!W.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});w(()=>{Ce.current.orientation=D},[Ce,D]),w(()=>{N||(U.current=null),N&&x===`auto`||(V.current=x)},[N,x]),w(()=>{f&&(N&&P?(H.current=m??-1,V.current&&m!=null&&(J.current=!0,G())):K.current&&(H.current=-1,G()))},[f,N,P,m,G]),w(()=>{if(f){if(!N)q.current=!1;else if(P){if(s==null){if(q.current=!1,Z.current!=null)return;if(K.current&&(H.current=-1,ke()),(!we.current||!K.current)&&V.current&&(U.current!=null||V.current===!0&&U.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>Oe.request(e):queueMicrotask)(t),e+=1):(H.current=U.current==null||ye(U.current,O,v)||_?ee(n):ue(n),U.current=null,G())};t()}}else d(n.current,s)||(H.current=s,ke(),J.current=!1)}}},[f,N,P,s,Z,_,n,O,v,G,ke,Oe]),w(()=>{if(!f||P||!B||b||!K.current)return;let e=B.nodesRef.current,t=e.find(e=>e.id===z)?.context?.elements.floating,n=i(se(F??t??null)),r=e.some(e=>e.context&&h(e.context.elements.floating,n));t&&!r&&W.current&&t.focus({preventScroll:!0})},[f,P,F,B,z,b]),w(()=>{we.current=N,K.current=!!P});let Ae=s!=null,je=T(e=>{if(!X.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(H.current!==t||s!==t)&&(H.current=t,G(e))}),Q=T(()=>pe??B?.nodesRef.current.find(e=>e.id===z)?.context?.dataRef?.current.orientation),Me=T(()=>ee(n,Te.current)),$=T(t=>{if(W.current=!1,q.current=!0,t.which===229||!X.current&&t.currentTarget===R.current)return;if(_&&xe(t.key,D,v,Se)){j(t.key,Q())||p(t),e.setOpen(!1,y(l,t.nativeEvent));let n=A?.current??F;de(n)&&n.focus();return}s!=null&&s!==H.current&&!d(n.current,s)&&(H.current=s);let r=H.current,a=ee(n,E),c=ue(n,E);if(L||(t.key===`Home`&&(p(t),H.current=a,G(t)),t.key===`End`&&(p(t),H.current=c,G(t))),M!=null){let e=M(t,H.current,n,D,g,v,E,a,c);if(e!=null&&e!==H.current&&(H.current=e,G(t)),D===`both`)return}if(j(t.key,D)){p(t);let e=i(t.currentTarget.ownerDocument);if(N&&!b&&h(t.currentTarget,e)&&!n.current.some(t=>t!=null&&h(t,e))){H.current=ye(t.key,D,v)?a:c,G(t),s===H.current&&ke();return}let{index:l,wrapped:u}=o(n.current,r,{decrement:!ye(t.key,D,v),loopFocus:g,allowEscape:re,disabledIndices:E,minIndex:a,maxIndex:c});u&&(q.current=!1),H.current=l,G(t)}}),Ne=k.useMemo(()=>({onFocus(e){q.current=!0,je(e)},onClick({currentTarget:e}){b||e.focus({preventScroll:!0})},onMouseMove(e){ve(e)||(q.current=!0,J.current=!1,S&&je(e))},onPointerLeave(e){if(!X.current||!W.current||e.pointerType===`touch`)return;q.current=!0;let t=e.relatedTarget;if(S&&!n.current.includes(t)&&Ee.current&&(Y.current?.(),Y.current=null,H.current=-1,G(e),!b)){let e=R.current,t=i(se(e));e&&h(e,t)&&e.focus({preventScroll:!0})}}}),[je,X,R,S,n,G,Ee,b]),Pe=k.useMemo(()=>b&&N&&Ae&&{"aria-activedescendant":`${me}-${s}`},[b,N,Ae,me,s]),Fe=k.useMemo(()=>({...L?{}:Pe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&N&&!b){let n=a(t.nativeEvent);if(n&&!h(R.current,n))return;p(t);let r=y(fe,t.nativeEvent);e.setOpen(!1,r);let i=A?.current??F;!r.isCanceled&&de(i)&&i.focus()}else $(t)},onPointerMove(e){ve(e)||(W.current=!0)}}),[Pe,$,R,L,e,N,b,F,A]),Ie=k.useMemo(()=>{function t(t){e.setOpen(!0,y(l,t.nativeEvent,t.currentTarget))}function n(e){x===`auto`&&ne(e.nativeEvent)&&(V.current=!b)}function r(e){V.current=x,x===`auto`&&ie(e.nativeEvent)&&(V.current=!0)}return{onKeyDown(n){let r=e.select(`open`);W.current=!1;let i=n.key.startsWith(`Arrow`),a=be(n.key,Q(),v),o=j(n.key,r?D:O),s=(_?a:o)||n.key===`Enter`||n.key.trim()===``;if(b&&r&&(!_||ae(n.currentTarget)))return $(n);if(r||C||!i){if(s){let e=j(n.key,Q());U.current=_&&e?null:n.key}_?a&&(p(n),r?(H.current=Me(),G(n),b&&R.current?.focus()):t(n)):o&&(Z.current!=null&&(H.current=Z.current),p(n),!r&&C?t(n):$(n),r&&G(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!b&&(H.current=-1,G(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[$,x,Me,_,G,e,C,D,O,Q,v,Z,b,R]),Le=k.useMemo(()=>({...Pe,...Ie}),[Pe,Ie]);return k.useMemo(()=>f?{reference:Le,floating:Fe,item:Ne,trigger:Ie}:{},[f,Le,Fe,Ie,Ne])}function Se(e){let t=k.useRef(!0);t.current&&(t.current=!1,e())}function N(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var P=(e,t)=>Object.is(e,t);function F(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ce(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!N(e,t,(e,t)=>F(e,t,n)):e!==t}function I(e,t,n){return e?e.some(e=>e!==void 0&&F(t,e,n)):!1}function L(e,t,n){return e?e.findIndex(e=>e!==void 0&&F(e,t,n)):-1}function R(e,t){if(t!==P)return n=>I(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function z(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(R(t,n)):L(e,t,n);return i===-1?null:i}function B(e,t,n,r,i,a){return I(r,t,i)?a!=null&&e>a&&I(r,n[a],i)?a:e:e===a?z(n,r,i,!0):a}function V(e,t,n){return e.filter(e=>!F(t,e,n))}function H(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var U=n();function W(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function G(e){return W(e?.[0])}function K(e){return G(e)?e.flatMap(e=>e.items):e}function we(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(G(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function q(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return H(e)}function J(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?H(e.value):H(e)}function Y(e,t,n){function r(){return q(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=K(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Te(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,U.jsx)(k.Fragment,{children:Y(r,t,n)},i)),e),[])}function X(e){let t=k.useRef(``),n=k.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:k.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function Z(e,t){let{onClick:n,onPointerDown:r}=X(T((n,r)=>{(typeof e==`function`?e():e)||t(r||(x?`touch`:``))}));return k.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Ee(e){let[t,n]=k.useState(null),r=Z(e,n);return me(e,t=>{t&&!e&&n(null)}),k.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var De=20;function Oe(e,t,n,r){let[i,a]=k.useState(!1);w(()=>{if(!e||!t||n==null){a(!1);return}let r=se(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-De)},[e,t,n]),pe(e&&(!t||i),r)}export{ge as S,B as _,we as a,M as b,Y as c,F as d,P as f,V as g,Ce as h,K as i,q as l,z as m,Ee as n,G as o,L as p,Z as r,Te as s,Oe as t,J as u,I as v,_e as x,Se as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,f as t,m as n,s as r,u as i}from"./cn-
|
|
1
|
+
import{c as e,f as t,m as n,s as r,u as i}from"./cn-DC80MJV0.js";import{a,n as o}from"./jsx-runtime-MZURdZre.js";import{F as s,H as c,J as l,q as u}from"./studio-queries-CkUSByy7.js";var d=class extends r{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||f(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(t){let n=()=>{this.#i({type:`continue`})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#r=e({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),a=this.state.status===`pending`,o=!i.canStart();try{if(a)n();else{this.#i({type:`pending`,variables:t,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(t,this,r);let e=await this.options.onMutate?.(t,r);e!==this.state.context&&this.#i({type:`pending`,context:e,variables:t,isPaused:o})}this.state.isPaused&&i.canStart()&&n();let e=await i.start();return await this.#n.config.onSuccess?.(e,t,this.state.context,this,r),await this.options.onSuccess?.(e,t,this.state.context,r),await this.#n.config.onSettled?.(e,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(e,null,t,this.state.context,r),this.#i({type:`success`,data:e}),e}catch(e){try{await this.#n.config.onError?.(e,t,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onError?.(e,t,this.state.context,r)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,r)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,r)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:e}),e}finally{this.#r===i&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),i.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var p=class extends t{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),u(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&s(t.mutationKey)!==s(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??f();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){i.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},m=a(o(),1);function h(e,t){let r=n(t),[a]=m.useState(()=>new p(r,e));m.useEffect(()=>{a.setOptions(e)},[a,e]);let o=m.useSyncExternalStore(m.useCallback(e=>a.subscribe(i.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=m.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(c)},[a]);if(o.error&&l(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}export{d as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e,a as t,it as n,lt as r,p as i,tt as a}from"./index-Qx7reRPD.js";import{_ as o,at as s,f as c,g as l,h as u,i as d,it as f,m as p,p as m,r as h,u as g}from"./studio-queries-BflKt9va.js";import{t as _}from"./useMutation-uJUrejsi.js";import{Lr as v,ct as y,n as b,r as x,rt as S,t as C}from"./button-amJ3g5oD.js";import{m as w,t as T}from"./cn-BQPKiwI4.js";import{a as E,n as D,t as O}from"./jsx-runtime-MZURdZre.js";import{a as k}from"./useSelector-AYcH7lB0.js";import{t as A}from"./markdown-view-jMiaBTSO.js";var j=E(D(),1);function M(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function N(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=M(e,t),o=k(),{history:s}=o,[c,l]=j.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return j.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}var P=O(),ee=(e,t)=>`/api/vault/events?${new URLSearchParams({companion:e,path:t})}`;function F(e,t,n){let r=(0,j.useRef)(n);(0,j.useEffect)(()=>{r.current=n}),(0,j.useEffect)(()=>{if(typeof EventSource>`u`)return;let n=new EventSource(ee(e,t));return n.addEventListener(`message`,e=>{try{r.current(JSON.parse(e.data))}catch{}}),()=>n.close()},[e,t])}function I({crumbs:e,children:t}){return(0,P.jsxs)(`div`,{className:`vault-bar sticky top-0 z-2 flex min-h-[52px] items-center gap-2 border-b border-rule-soft bg-[color-mix(in_srgb,var(--bg)_88%,transparent)] px-6 py-2 backdrop-blur-md max-sm:px-3`,children:[(0,P.jsx)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1`,children:e}),t]})}var L=`vault-prose prose mx-auto w-full max-w-[68ch] px-10 pt-10 pb-28 max-sm:px-4`,R=b({variant:`default`,size:`sm`});function z({path:e}){return(0,P.jsxs)(`button`,{type:`button`,className:b({variant:`ghost`,size:`sm`}),"data-copy":e,"data-copy-label":`path`,"aria-label":`Copy path`,children:[(0,P.jsx)(x,{name:`copy`,className:`size-3.5`}),(0,P.jsx)(`span`,{className:`@max-[1000px]:hidden`,children:`Copy path`})]})}function B({companion:e,data:t,writable:n,search:r,crumbs:i}){let a=t.open;return a?n&&r.mode===`edit`?(0,P.jsx)(ne,{companion:e,data:t,crumbs:i},`${a.path}:edit`):(0,P.jsx)(H,{companion:e,data:t,writable:n,crumbs:i},`${a.path}:read`):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:i}),(0,P.jsxs)(`div`,{className:L,children:[(0,P.jsx)(`h1`,{className:`text-xl`,children:t.refusal?`File refused`:`Open a markdown file`}),(0,P.jsx)(`p`,{className:t.refusal?`vault-warning text-warn`:`empty text-muted`,children:t.refusal??`Choose a file from the tree to begin.`})]})]})}var V=e=>e.split(`/`).at(-1)??e;function H({companion:e,data:t,writable:n,crumbs:r}){let i=t.open,a=w(),[o,s]=(0,j.useState)(``);return F(e,i.path,t=>{t.kind===`removed`?s(`this file no longer exists on disk`):h(a,e)}),(0,P.jsxs)(`div`,{"data-vault-root":!0,"data-vault-mode":`read`,"data-vault-path":i.path,children:[(0,P.jsxs)(I,{crumbs:r,children:[(0,P.jsx)(z,{path:i.path}),n?(0,P.jsxs)(f,{className:R,id:`vault-mode-edit`,to:`/vault`,search:e=>({...e,mode:`edit`}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`pencil`,className:`size-3.5`}),`Edit`]}):(0,P.jsx)(`span`,{className:`text-xs text-muted`,title:`Start Studio with --writable to edit.`,children:`Read only`})]}),(0,P.jsxs)(`article`,{className:L,"aria-label":V(i.path),children:[(0,P.jsx)(A,{nodes:i.markdown}),(0,P.jsx)(`p`,{id:`vault-status`,className:`text-sm text-warn`,"aria-live":`polite`,children:o})]})]})}function te({companion:t,open:n,text:r}){let[i,a]=(0,j.useState)(r);(0,j.useEffect)(()=>{let e=setTimeout(()=>a(r),250);return()=>clearTimeout(e)},[r]);let o=e(`(min-width: 64rem)`),s=i===n.content,c=v({queryKey:[`vault-preview`,t,n.path,i],queryFn:()=>l({data:{companion:t,path:n.path,content:i}}),placeholderData:e=>e,enabled:o&&!s,gcTime:0}),u=s?n.markdown:c.data;return(0,P.jsxs)(`div`,{className:`vault-preview min-h-0 overflow-auto max-lg:hidden`,"aria-label":`Preview`,role:`region`,"data-vault-preview":!0,children:[(0,P.jsx)(`p`,{className:`m-0 px-7 pt-3 text-xs font-semibold text-muted`,children:`Preview`}),(0,P.jsx)(`div`,{className:`prose px-7 pt-2 pb-16 text-sm`,children:u?(0,P.jsx)(A,{nodes:u}):null})]})}function ne({companion:e,data:t,crumbs:n}){let r=t.open,i=w(),c=s(),[l,u]=(0,j.useState)(r.content),[d,p]=(0,j.useState)(r.content),[m,g]=(0,j.useState)(r.token),[v,y]=(0,j.useState)(``),[b,S]=(0,j.useState)(null),E=l!==d,D=(0,j.useRef)(E);(0,j.useEffect)(()=>{D.current=E},[E]);let O=a(e=>e.setDirty);(0,j.useEffect)(()=>O(E),[E,O]),(0,j.useEffect)(()=>()=>O(!1),[O]),N({shouldBlockFn:()=>D.current&&!window.confirm(`Discard unsaved changes?`),enableBeforeUnload:()=>D.current}),F(e,r.path,e=>{if(e.kind===`removed`){y(`this file no longer exists on disk`);return}let t={content:e.content??``,token:e.token??``};e.kind===`overwritten`?(S(t),y(`a version was overwritten; its content is available below`)):E?(S(t),y(`the file changed on disk; unsaved content is still in the editor`)):(u(t.content),p(t.content),g(t.token),y(`updated from disk`))});let k=_({mutationFn:()=>o({data:{companion:e,path:r.path,content:l,token:m}}),onSuccess:t=>{t.kind===`conflict`?(S({content:t.content,token:t.token}),y(t.reason||`save refused`)):(g(t.token),p(l),D.current=!1,O(!1),y(`saved`),h(i,e),c({to:`/vault`,search:e=>({...e,mode:void 0}),resetScroll:!1}))},onError:e=>y(e.message||`save failed`)});return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-vault-root":!0,"data-vault-mode":`edit`,"data-vault-path":r.path,children:[(0,P.jsxs)(I,{crumbs:n,children:[E?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-warn`,children:[(0,P.jsx)(`span`,{className:`size-[7px] rounded-full bg-current`,"aria-hidden":`true`}),`Unsaved`]}):null,(0,P.jsxs)(f,{className:R,id:`vault-mode-read`,to:`/vault`,search:e=>({...e,mode:void 0}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`eye`,className:`size-3.5`}),`Read`]}),(0,P.jsx)(C,{variant:`primary`,size:`sm`,id:`vault-save`,onClick:()=>k.mutate(),disabled:k.isPending,children:`Save`})]}),(0,P.jsxs)(`div`,{className:v||b?`grid gap-2 border-b border-rule-soft px-6 py-2.5 text-sm`:`sr-only`,children:[(0,P.jsx)(`p`,{id:`vault-status`,className:`m-0 text-warn`,"aria-live":`polite`,children:v}),b?(0,P.jsxs)(`div`,{id:`vault-incoming`,className:`grid gap-2`,children:[(0,P.jsx)(`strong`,{id:`vault-incoming-title`,className:`text-sm`,children:`Incoming version`}),(0,P.jsx)(`pre`,{id:`vault-incoming-content`,className:`m-0 max-h-40 overflow-auto rounded-control border border-rule bg-surface p-3 font-mono text-xs whitespace-pre-wrap`,children:b.content}),(0,P.jsx)(C,{size:`sm`,id:`vault-recover`,className:`justify-self-start`,onClick:()=>{u(b.content),p(b.content),b.token&&g(b.token),S(null),y(`incoming version loaded into the editor`)},children:`Put incoming content back`})]}):null]}),(0,P.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-2 max-lg:grid-cols-1`,children:[(0,P.jsx)(`textarea`,{id:`vault-editor`,"data-vault-editor":!0,"data-vault-path":r.path,"aria-label":`Markdown source of ${V(r.path)}`,spellCheck:!1,value:l,onChange:e=>u(e.target.value),className:T(`min-h-[60vh] resize-none border-0 border-r border-rule-soft bg-transparent px-6 pt-4 pb-10 font-mono text-[0.86rem] leading-[1.75] text-text outline-none focus-visible:outline-none max-lg:border-r-0`)}),(0,P.jsx)(te,{companion:e,open:r,text:l})]})]})}var U=e=>e.split(`/`).filter(Boolean),W=`flex w-full min-w-0 items-center gap-2 rounded-[6px] border-0 bg-transparent px-2.5 py-1.5 text-left text-sm text-text no-underline hover:bg-surface aria-[current=page]:bg-accent-soft aria-[current=page]:font-semibold`;function G({entry:e,current:t,label:n}){return(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:T(W,`vault-file`),"data-vault-entry":e.path,"aria-current":t?`page`:void 0,children:[(0,P.jsx)(x,{name:`doc`,className:T(`size-3.5`,t?`text-accent`:`text-muted`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n??e.name})]})}function K({dir:e,className:t,children:n}){return(0,P.jsx)(f,{to:`/vault`,search:t=>({...t,path:void 0,dir:e??void 0,mode:void 0}),className:t,children:n})}function q({entry:e,companion:t,search:n}){return e.kind===`file`?(0,P.jsx)(G,{entry:e,current:n.path===e.path}):(0,P.jsx)(re,{entry:e,companion:t,search:n})}function re({entry:e,companion:t,search:n}){let[r,i]=(0,j.useState)(e.children!==void 0),a=v({...c(t,e.path),enabled:r&&e.children===void 0}),o=e.children??a.data?.entries;return(0,P.jsxs)(`details`,{className:`vault-directory group/dir`,open:r,"data-vault-dir":e.path,onToggle:e=>i(e.currentTarget.open),children:[(0,P.jsxs)(`summary`,{className:T(W,`cursor-pointer list-none font-semibold [&::-webkit-details-marker]:hidden`),"aria-current":n.dir===e.path?`page`:void 0,children:[(0,P.jsx)(x,{name:`right`,className:`size-3 text-muted transition-transform group-open/dir:rotate-90`}),(0,P.jsx)(x,{name:`folder`,className:`size-3.5 text-muted`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,P.jsxs)(`div`,{className:`vault-children grid gap-px pl-3.5`,children:[r&&o?o.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path)):null,a.error?(0,P.jsx)(`p`,{className:`vault-warning m-0 px-2.5 py-1 text-xs text-warn`,children:a.error.message}):null]})]})}var J=`m-0 px-2.5 py-1.5 text-sm text-muted`,Y=`vault-warning m-0 px-2.5 py-1.5 text-xs text-warn`;function ie({data:e,companion:t,search:n}){return e.failure?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,children:(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]})}):e.tree===null?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,"aria-busy":`true`,children:(0,P.jsx)(`p`,{className:T(J,`empty`),children:`Listing files…`})}):(0,P.jsxs)(`div`,{"data-vault-slot":`tree`,"data-vault-generation":e.generation??void 0,children:[(0,P.jsx)(ae,{data:e}),e.tree.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(`nav`,{className:`vault-tree grid gap-px`,"aria-label":`Markdown files`,children:e.tree.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path))})]})}function ae({data:e}){return e.warning?(0,P.jsxs)(`p`,{className:Y,children:[e.warning,`. The tree may be out of date.`]}):e.watching?null:(0,P.jsx)(`p`,{className:Y,children:`The tree may be out of date.`})}function oe({companion:e,query:t,search:n}){let[r,i]=(0,j.useState)(t);(0,j.useEffect)(()=>{let e=setTimeout(()=>i(t),150);return()=>clearTimeout(e)},[t]);let a=v({...m(e,r),enabled:r.trim().length>0});if(!a.data)return null;let{shown:o,total:s}=a.data,c=s-o.length;return(0,P.jsxs)(`div`,{"data-vault-filter-results":!0,children:[o.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`No files match.`}):(0,P.jsx)(`nav`,{className:`vault-tree vault-results grid gap-px`,"aria-label":`Matching files`,children:o.map(e=>(0,P.jsx)(G,{entry:e,current:n.path===e.path,label:e.path},e.path))}),c>0?(0,P.jsxs)(`p`,{className:J,"data-vault-more":!0,children:[c,` more match`,c===1?``:`es`,`; refine the filter.`]}):null]})}var X=`vault-crumb rounded-[6px] px-1.5 py-0.5 text-sm text-muted no-underline hover:bg-surface hover:text-text`;function se({rootName:e,search:t}){let n=U(t.path??t.dir??``);return(0,P.jsx)(`nav`,{className:`vault-breadcrumb min-w-0`,"aria-label":`Breadcrumb`,"data-vault-crumb":!0,children:(0,P.jsxs)(`ol`,{className:`m-0 flex min-w-0 list-none items-center gap-0.5 overflow-hidden p-0 text-sm text-muted`,children:[(0,P.jsx)(`li`,{className:`flex-none`,children:n.length===0?(0,P.jsx)(`span`,{"aria-current":`page`,className:`px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:null,className:X,children:e})}),n.map((e,t)=>{let r=n.slice(0,t+1).join(`/`),i=t===n.length-1;return(0,P.jsxs)(`li`,{className:T(`flex items-center gap-0.5`,i?`min-w-0`:`flex-none max-md:hidden`),children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i?(0,P.jsx)(`span`,{"aria-current":`page`,className:`truncate px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:r,className:X,children:e})]},r)})]})})}function ce(e,t){let n=e;for(let e of U(t)){let t=n?.find(t=>t.kind===`directory`&&t.name===e);if(!t)return null;n=t.children}return n??null}function le({data:e,rootName:t}){let n=e.failure?(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]}):e.tree===null?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`Listing files…`}):null,r=e.dir?U(e.dir):[],i=r.at(-1)??t;if(n)return(0,P.jsx)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto w-full max-w-[820px] px-10 py-8`,"aria-busy":e.tree===null,children:n});let a=(e.dir?ce(e.tree,e.dir):null)??e.tree;return(0,P.jsxs)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto grid w-full max-w-[820px] gap-4 px-10 py-8 max-sm:px-4`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-xl font-semibold`,children:i}),e.dirMissing?(0,P.jsx)(`p`,{className:Y,children:`That folder is not in the tree; showing the root.`}):null,a.length===0&&r.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(S,{title:`In this folder`,count:a.length,children:(0,P.jsxs)(`ul`,{className:`vault-rows m-0 list-none p-0`,"aria-label":`Folder contents`,children:[r.length>0?(0,P.jsx)(`li`,{children:(0,P.jsxs)(K,{dir:r.length>1?r.slice(0,-1).join(`/`):null,className:T(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`left`,className:`text-muted`}),(0,P.jsx)(`span`,{children:`..`})]})}):null,a.map(e=>(0,P.jsx)(`li`,{children:e.kind===`directory`?(0,P.jsxs)(K,{dir:e.path,className:T(y,`vault-row py-1.5 font-semibold`),children:[(0,P.jsx)(x,{name:`folder`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}):(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:T(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`doc`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.path))]})})]})}function Z(e){return typeof e==`string`?e:(e.c??[]).map(Z).join(``)}function ue(e){return(e??[]).filter(e=>typeof e!=`string`&&e.t===`h2`).map((e,t)=>({index:t,text:Z(e)}))}var Q=e=>[...e?.querySelectorAll(`article .markdown-body h2`)??[]];function de(e,t,n){let[r,i]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!t)return;let n=e.current,r=Q(n);if(r.length===0||typeof IntersectionObserver>`u`)return;let a=new IntersectionObserver(e=>{let t=e.find(e=>e.isIntersecting);t&&i(r.indexOf(t.target))},{root:n,rootMargin:`-60px 0px -70% 0px`});for(let e of r)a.observe(e);return()=>a.disconnect()},[e,t]),{current:r!==null&&r<n?r:0,go:t=>{Q(e.current)[t]?.scrollIntoView({behavior:`smooth`,block:`start`}),i(t)}}}function fe({headings:e,current:t,go:n}){return(0,P.jsxs)(`nav`,{className:`vault-outline min-h-0 overflow-auto border-l border-rule-soft px-5 pt-[72px] pb-6 @max-[1080px]:hidden`,"aria-label":`Outline`,children:[(0,P.jsx)(`h2`,{className:`m-0 mb-2 text-xs font-semibold text-muted`,children:`On this page`}),(0,P.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:T(`block w-full truncate rounded-r-[8px] border-0 bg-transparent px-2.5 py-1 text-left text-sm text-text hover:bg-surface`,t===e.index&&`font-semibold text-accent shadow-[inset_2px_0_0_var(--accent)]`),"aria-current":t===e.index?`location`:void 0,onClick:()=>n(e.index),children:e.text})},e.index))})]})}var pe=[],$=(e,t)=>[e?`272px`:null,`minmax(0,1fr)`,t?`232px`:null].filter(Boolean).join(` `);function me({data:e,companion:t,search:r,stale:i,refresh:a,filter:o,setFilter:s,hidden:c}){return(0,P.jsxs)(`aside`,{hidden:c,className:`vault-tree-panel flex min-h-0 flex-col border-r border-rule @max-[720px]:max-h-[40vh] @max-[720px]:border-r-0 @max-[720px]:border-b`,id:`vault-tree-panel`,"aria-label":`Files`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between pt-3 pr-2.5 pb-2 pl-5`,children:[(0,P.jsx)(`strong`,{className:`text-sm`,children:`Files`}),(0,P.jsx)(n,{label:`Refresh tree`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":a.isPending?`Refreshing…`:`Refresh tree`,onClick:()=>a.mutate(),disabled:a.isPending,children:(0,P.jsx)(x,{name:`refresh`,className:a.isPending?`animate-spin`:void 0})})})]}),(0,P.jsx)(`p`,{id:`vault-stale`,className:Y+` mx-2.5`,role:`status`,hidden:!i,children:`Files changed — refresh tree.`}),a.error?(0,P.jsx)(`p`,{className:Y+` mx-2.5`,role:`status`,children:a.error.message}):null,(0,P.jsxs)(`label`,{className:`mx-3.5 mb-2 flex h-[34px] items-center gap-2 rounded-control border border-rule bg-surface pr-2 pl-2.5 text-muted focus-within:border-accent`,children:[(0,P.jsx)(x,{name:`search`,className:`size-3.5`}),(0,P.jsx)(`input`,{type:`search`,id:`vault-filter`,className:`vault-filter min-w-0 flex-1 border-0 bg-transparent text-sm text-text outline-none placeholder:text-muted`,placeholder:`Go to file`,"aria-label":`Go to file`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&s(``)}})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2.5 pb-6`,children:o.trim()?(0,P.jsx)(oe,{companion:t,query:o,search:r}):(0,P.jsx)(ie,{data:e,companion:t,search:r})})]})}function he({companion:e,rootName:t,writable:r,search:o}){let s=w(),c=v(p(e,o)),l=v({...p(e,o,!0),enabled:!(!c.data||c.data.tree!==null||c.data.failure)}).data??c.data,[f,m]=(0,j.useState)(``),h=a(e=>e.latestGeneration),g=a(e=>e.treeHidden),y=a(e=>e.toggleTree),b=a(e=>e.hydrate);(0,j.useEffect)(b,[b]);let S=_({mutationFn:()=>u({data:{companion:e,path:o.path,dir:o.dir,refresh:!0,wait:!0}}),onSuccess:t=>void d(s,e,o,t)}),T=(0,j.useRef)(null),E=!!l?.open&&o.mode!==`edit`,D=E?ue(l?.open?.markdown):pe,O=de(T,E?l?.open?.markdown:void 0,D.length);if(!l)return(0,P.jsx)(i,{});let k=h!==null&&l.generation!==null&&h>l.generation,A=D.length>0,M=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(n,{label:g?`Show files`:`Hide files`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,id:`vault-tree-toggle`,"aria-controls":`vault-tree-panel`,"aria-expanded":!g,"aria-label":g?`Show files`:`Hide files`,onClick:y,children:(0,P.jsx)(x,{name:`sidebar`})})}),(0,P.jsx)(se,{rootName:t,search:o})]});return(0,P.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,P.jsxs)(`section`,{className:`vault-layout grid min-h-0 flex-1 border-t border-rule @max-[720px]:grid-cols-1!`,style:{"--vault-wide":$(!0,A),"--vault-wide-bare":$(!1,A),"--vault-narrow":$(!0,!1),"--vault-narrow-bare":$(!1,!1)},"data-vault-layout":!0,children:[(0,P.jsx)(me,{data:l,companion:e,search:o,stale:k,refresh:S,filter:f,setFilter:m,hidden:g}),(0,P.jsx)(`div`,{ref:T,className:`vault-main min-h-0 min-w-0 overflow-auto scroll-smooth`,"data-vault-main":!0,"data-vault-pane":!0,children:o.path||l.open||l.refusal?(0,P.jsx)(B,{companion:e,data:l,writable:r,search:o,crumbs:M}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:M}),(0,P.jsx)(le,{data:l,rootName:t})]})}),A?(0,P.jsx)(fe,{headings:D,...O}):null]})})}function ge(){let e=t.useSearch(),{data:n}=r(g({companion:e.companion,studioMode:e.studioMode}));if(!e.companion||!n.selected)return null;let i=n.selected.path.split(/[\\/]/).findLast(Boolean)??`companion`;return(0,P.jsx)(he,{companion:e.companion,rootName:i,writable:n.writable,search:{path:e.path,dir:e.dir,mode:e.mode}})}export{ge as component};
|
|
1
|
+
import{S as e,a as t,it as n,lt as r,p as i,tt as a}from"./index-zmRH87D4.js";import{_ as o,at as s,f as c,g as l,h as u,i as d,it as f,m as p,p as m,r as h,u as g}from"./studio-queries-CkUSByy7.js";import{t as _}from"./useMutation-CqtM9COw.js";import{Lr as v,ct as y,n as b,r as x,rt as S,t as C}from"./button-C9SQW3kI.js";import{m as w,t as T}from"./cn-DC80MJV0.js";import{a as E,n as D,t as O}from"./jsx-runtime-MZURdZre.js";import{a as k}from"./useSelector-AYcH7lB0.js";import{t as A}from"./markdown-view-dku7MGPn.js";var j=E(D(),1);function M(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function N(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=M(e,t),o=k(),{history:s}=o,[c,l]=j.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return j.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}var P=O(),ee=(e,t)=>`/api/vault/events?${new URLSearchParams({companion:e,path:t})}`;function F(e,t,n){let r=(0,j.useRef)(n);(0,j.useEffect)(()=>{r.current=n}),(0,j.useEffect)(()=>{if(typeof EventSource>`u`)return;let n=new EventSource(ee(e,t));return n.addEventListener(`message`,e=>{try{r.current(JSON.parse(e.data))}catch{}}),()=>n.close()},[e,t])}function I({crumbs:e,children:t}){return(0,P.jsxs)(`div`,{className:`vault-bar sticky top-0 z-2 flex min-h-[52px] items-center gap-2 border-b border-rule-soft bg-[color-mix(in_srgb,var(--bg)_88%,transparent)] px-6 py-2 backdrop-blur-md max-sm:px-3`,children:[(0,P.jsx)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1`,children:e}),t]})}var L=`vault-prose prose mx-auto w-full max-w-[68ch] px-10 pt-10 pb-28 max-sm:px-4`,R=b({variant:`default`,size:`sm`});function z({path:e}){return(0,P.jsxs)(`button`,{type:`button`,className:b({variant:`ghost`,size:`sm`}),"data-copy":e,"data-copy-label":`path`,"aria-label":`Copy path`,children:[(0,P.jsx)(x,{name:`copy`,className:`size-3.5`}),(0,P.jsx)(`span`,{className:`@max-[1000px]:hidden`,children:`Copy path`})]})}function B({companion:e,data:t,writable:n,search:r,crumbs:i}){let a=t.open;return a?n&&r.mode===`edit`?(0,P.jsx)(ne,{companion:e,data:t,crumbs:i},`${a.path}:edit`):(0,P.jsx)(H,{companion:e,data:t,writable:n,crumbs:i},`${a.path}:read`):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:i}),(0,P.jsxs)(`div`,{className:L,children:[(0,P.jsx)(`h1`,{className:`text-xl`,children:t.refusal?`File refused`:`Open a markdown file`}),(0,P.jsx)(`p`,{className:t.refusal?`vault-warning text-warn`:`empty text-muted`,children:t.refusal??`Choose a file from the tree to begin.`})]})]})}var V=e=>e.split(`/`).at(-1)??e;function H({companion:e,data:t,writable:n,crumbs:r}){let i=t.open,a=w(),[o,s]=(0,j.useState)(``);return F(e,i.path,t=>{t.kind===`removed`?s(`this file no longer exists on disk`):h(a,e)}),(0,P.jsxs)(`div`,{"data-vault-root":!0,"data-vault-mode":`read`,"data-vault-path":i.path,children:[(0,P.jsxs)(I,{crumbs:r,children:[(0,P.jsx)(z,{path:i.path}),n?(0,P.jsxs)(f,{className:R,id:`vault-mode-edit`,to:`/vault`,search:e=>({...e,mode:`edit`}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`pencil`,className:`size-3.5`}),`Edit`]}):(0,P.jsx)(`span`,{className:`text-xs text-muted`,title:`Start Studio with --writable to edit.`,children:`Read only`})]}),(0,P.jsxs)(`article`,{className:L,"aria-label":V(i.path),children:[(0,P.jsx)(A,{nodes:i.markdown}),(0,P.jsx)(`p`,{id:`vault-status`,className:`text-sm text-warn`,"aria-live":`polite`,children:o})]})]})}function te({companion:t,open:n,text:r}){let[i,a]=(0,j.useState)(r);(0,j.useEffect)(()=>{let e=setTimeout(()=>a(r),250);return()=>clearTimeout(e)},[r]);let o=e(`(min-width: 64rem)`),s=i===n.content,c=v({queryKey:[`vault-preview`,t,n.path,i],queryFn:()=>l({data:{companion:t,path:n.path,content:i}}),placeholderData:e=>e,enabled:o&&!s,gcTime:0}),u=s?n.markdown:c.data;return(0,P.jsxs)(`div`,{className:`vault-preview min-h-0 overflow-auto max-lg:hidden`,"aria-label":`Preview`,role:`region`,"data-vault-preview":!0,children:[(0,P.jsx)(`p`,{className:`m-0 px-7 pt-3 text-xs font-semibold text-muted`,children:`Preview`}),(0,P.jsx)(`div`,{className:`prose px-7 pt-2 pb-16 text-sm`,children:u?(0,P.jsx)(A,{nodes:u}):null})]})}function ne({companion:e,data:t,crumbs:n}){let r=t.open,i=w(),c=s(),[l,u]=(0,j.useState)(r.content),[d,p]=(0,j.useState)(r.content),[m,g]=(0,j.useState)(r.token),[v,y]=(0,j.useState)(``),[b,S]=(0,j.useState)(null),E=l!==d,D=(0,j.useRef)(E);(0,j.useEffect)(()=>{D.current=E},[E]);let O=a(e=>e.setDirty);(0,j.useEffect)(()=>O(E),[E,O]),(0,j.useEffect)(()=>()=>O(!1),[O]),N({shouldBlockFn:()=>D.current&&!window.confirm(`Discard unsaved changes?`),enableBeforeUnload:()=>D.current}),F(e,r.path,e=>{if(e.kind===`removed`){y(`this file no longer exists on disk`);return}let t={content:e.content??``,token:e.token??``};e.kind===`overwritten`?(S(t),y(`a version was overwritten; its content is available below`)):E?(S(t),y(`the file changed on disk; unsaved content is still in the editor`)):(u(t.content),p(t.content),g(t.token),y(`updated from disk`))});let k=_({mutationFn:()=>o({data:{companion:e,path:r.path,content:l,token:m}}),onSuccess:t=>{t.kind===`conflict`?(S({content:t.content,token:t.token}),y(t.reason||`save refused`)):(g(t.token),p(l),D.current=!1,O(!1),y(`saved`),h(i,e),c({to:`/vault`,search:e=>({...e,mode:void 0}),resetScroll:!1}))},onError:e=>y(e.message||`save failed`)});return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-vault-root":!0,"data-vault-mode":`edit`,"data-vault-path":r.path,children:[(0,P.jsxs)(I,{crumbs:n,children:[E?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-warn`,children:[(0,P.jsx)(`span`,{className:`size-[7px] rounded-full bg-current`,"aria-hidden":`true`}),`Unsaved`]}):null,(0,P.jsxs)(f,{className:R,id:`vault-mode-read`,to:`/vault`,search:e=>({...e,mode:void 0}),"data-vault-mode-link":!0,children:[(0,P.jsx)(x,{name:`eye`,className:`size-3.5`}),`Read`]}),(0,P.jsx)(C,{variant:`primary`,size:`sm`,id:`vault-save`,onClick:()=>k.mutate(),disabled:k.isPending,children:`Save`})]}),(0,P.jsxs)(`div`,{className:v||b?`grid gap-2 border-b border-rule-soft px-6 py-2.5 text-sm`:`sr-only`,children:[(0,P.jsx)(`p`,{id:`vault-status`,className:`m-0 text-warn`,"aria-live":`polite`,children:v}),b?(0,P.jsxs)(`div`,{id:`vault-incoming`,className:`grid gap-2`,children:[(0,P.jsx)(`strong`,{id:`vault-incoming-title`,className:`text-sm`,children:`Incoming version`}),(0,P.jsx)(`pre`,{id:`vault-incoming-content`,className:`m-0 max-h-40 overflow-auto rounded-control border border-rule bg-surface p-3 font-mono text-xs whitespace-pre-wrap`,children:b.content}),(0,P.jsx)(C,{size:`sm`,id:`vault-recover`,className:`justify-self-start`,onClick:()=>{u(b.content),p(b.content),b.token&&g(b.token),S(null),y(`incoming version loaded into the editor`)},children:`Put incoming content back`})]}):null]}),(0,P.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-2 max-lg:grid-cols-1`,children:[(0,P.jsx)(`textarea`,{id:`vault-editor`,"data-vault-editor":!0,"data-vault-path":r.path,"aria-label":`Markdown source of ${V(r.path)}`,spellCheck:!1,value:l,onChange:e=>u(e.target.value),className:T(`min-h-[60vh] resize-none border-0 border-r border-rule-soft bg-transparent px-6 pt-4 pb-10 font-mono text-[0.86rem] leading-[1.75] text-text outline-none focus-visible:outline-none max-lg:border-r-0`)}),(0,P.jsx)(te,{companion:e,open:r,text:l})]})]})}var U=e=>e.split(`/`).filter(Boolean),W=`flex w-full min-w-0 items-center gap-2 rounded-[6px] border-0 bg-transparent px-2.5 py-1.5 text-left text-sm text-text no-underline hover:bg-surface aria-[current=page]:bg-accent-soft aria-[current=page]:font-semibold`;function G({entry:e,current:t,label:n}){return(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:T(W,`vault-file`),"data-vault-entry":e.path,"aria-current":t?`page`:void 0,children:[(0,P.jsx)(x,{name:`doc`,className:T(`size-3.5`,t?`text-accent`:`text-muted`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n??e.name})]})}function K({dir:e,className:t,children:n}){return(0,P.jsx)(f,{to:`/vault`,search:t=>({...t,path:void 0,dir:e??void 0,mode:void 0}),className:t,children:n})}function q({entry:e,companion:t,search:n}){return e.kind===`file`?(0,P.jsx)(G,{entry:e,current:n.path===e.path}):(0,P.jsx)(re,{entry:e,companion:t,search:n})}function re({entry:e,companion:t,search:n}){let[r,i]=(0,j.useState)(e.children!==void 0),a=v({...c(t,e.path),enabled:r&&e.children===void 0}),o=e.children??a.data?.entries;return(0,P.jsxs)(`details`,{className:`vault-directory group/dir`,open:r,"data-vault-dir":e.path,onToggle:e=>i(e.currentTarget.open),children:[(0,P.jsxs)(`summary`,{className:T(W,`cursor-pointer list-none font-semibold [&::-webkit-details-marker]:hidden`),"aria-current":n.dir===e.path?`page`:void 0,children:[(0,P.jsx)(x,{name:`right`,className:`size-3 text-muted transition-transform group-open/dir:rotate-90`}),(0,P.jsx)(x,{name:`folder`,className:`size-3.5 text-muted`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,P.jsxs)(`div`,{className:`vault-children grid gap-px pl-3.5`,children:[r&&o?o.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path)):null,a.error?(0,P.jsx)(`p`,{className:`vault-warning m-0 px-2.5 py-1 text-xs text-warn`,children:a.error.message}):null]})]})}var J=`m-0 px-2.5 py-1.5 text-sm text-muted`,Y=`vault-warning m-0 px-2.5 py-1.5 text-xs text-warn`;function ie({data:e,companion:t,search:n}){return e.failure?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,children:(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]})}):e.tree===null?(0,P.jsx)(`div`,{"data-vault-slot":`tree`,"aria-busy":`true`,children:(0,P.jsx)(`p`,{className:T(J,`empty`),children:`Listing files…`})}):(0,P.jsxs)(`div`,{"data-vault-slot":`tree`,"data-vault-generation":e.generation??void 0,children:[(0,P.jsx)(ae,{data:e}),e.tree.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(`nav`,{className:`vault-tree grid gap-px`,"aria-label":`Markdown files`,children:e.tree.map(e=>(0,P.jsx)(q,{entry:e,companion:t,search:n},e.path))})]})}function ae({data:e}){return e.warning?(0,P.jsxs)(`p`,{className:Y,children:[e.warning,`. The tree may be out of date.`]}):e.watching?null:(0,P.jsx)(`p`,{className:Y,children:`The tree may be out of date.`})}function oe({companion:e,query:t,search:n}){let[r,i]=(0,j.useState)(t);(0,j.useEffect)(()=>{let e=setTimeout(()=>i(t),150);return()=>clearTimeout(e)},[t]);let a=v({...m(e,r),enabled:r.trim().length>0});if(!a.data)return null;let{shown:o,total:s}=a.data,c=s-o.length;return(0,P.jsxs)(`div`,{"data-vault-filter-results":!0,children:[o.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`No files match.`}):(0,P.jsx)(`nav`,{className:`vault-tree vault-results grid gap-px`,"aria-label":`Matching files`,children:o.map(e=>(0,P.jsx)(G,{entry:e,current:n.path===e.path,label:e.path},e.path))}),c>0?(0,P.jsxs)(`p`,{className:J,"data-vault-more":!0,children:[c,` more match`,c===1?``:`es`,`; refine the filter.`]}):null]})}var X=`vault-crumb rounded-[6px] px-1.5 py-0.5 text-sm text-muted no-underline hover:bg-surface hover:text-text`;function se({rootName:e,search:t}){let n=U(t.path??t.dir??``);return(0,P.jsx)(`nav`,{className:`vault-breadcrumb min-w-0`,"aria-label":`Breadcrumb`,"data-vault-crumb":!0,children:(0,P.jsxs)(`ol`,{className:`m-0 flex min-w-0 list-none items-center gap-0.5 overflow-hidden p-0 text-sm text-muted`,children:[(0,P.jsx)(`li`,{className:`flex-none`,children:n.length===0?(0,P.jsx)(`span`,{"aria-current":`page`,className:`px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:null,className:X,children:e})}),n.map((e,t)=>{let r=n.slice(0,t+1).join(`/`),i=t===n.length-1;return(0,P.jsxs)(`li`,{className:T(`flex items-center gap-0.5`,i?`min-w-0`:`flex-none max-md:hidden`),children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i?(0,P.jsx)(`span`,{"aria-current":`page`,className:`truncate px-1.5 font-semibold text-text`,children:e}):(0,P.jsx)(K,{dir:r,className:X,children:e})]},r)})]})})}function ce(e,t){let n=e;for(let e of U(t)){let t=n?.find(t=>t.kind===`directory`&&t.name===e);if(!t)return null;n=t.children}return n??null}function le({data:e,rootName:t}){let n=e.failure?(0,P.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]}):e.tree===null?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`Listing files…`}):null,r=e.dir?U(e.dir):[],i=r.at(-1)??t;if(n)return(0,P.jsx)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto w-full max-w-[820px] px-10 py-8`,"aria-busy":e.tree===null,children:n});let a=(e.dir?ce(e.tree,e.dir):null)??e.tree;return(0,P.jsxs)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto grid w-full max-w-[820px] gap-4 px-10 py-8 max-sm:px-4`,children:[(0,P.jsx)(`h1`,{className:`m-0 text-xl font-semibold`,children:i}),e.dirMissing?(0,P.jsx)(`p`,{className:Y,children:`That folder is not in the tree; showing the root.`}):null,a.length===0&&r.length===0?(0,P.jsx)(`p`,{className:T(J,`empty`),children:`This companion has no markdown files.`}):(0,P.jsx)(S,{title:`In this folder`,count:a.length,children:(0,P.jsxs)(`ul`,{className:`vault-rows m-0 list-none p-0`,"aria-label":`Folder contents`,children:[r.length>0?(0,P.jsx)(`li`,{children:(0,P.jsxs)(K,{dir:r.length>1?r.slice(0,-1).join(`/`):null,className:T(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`left`,className:`text-muted`}),(0,P.jsx)(`span`,{children:`..`})]})}):null,a.map(e=>(0,P.jsx)(`li`,{children:e.kind===`directory`?(0,P.jsxs)(K,{dir:e.path,className:T(y,`vault-row py-1.5 font-semibold`),children:[(0,P.jsx)(x,{name:`folder`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]}):(0,P.jsxs)(f,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:T(y,`vault-row py-1.5`),children:[(0,P.jsx)(x,{name:`doc`,className:`text-muted`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.path))]})})]})}function Z(e){return typeof e==`string`?e:(e.c??[]).map(Z).join(``)}function ue(e){return(e??[]).filter(e=>typeof e!=`string`&&e.t===`h2`).map((e,t)=>({index:t,text:Z(e)}))}var Q=e=>[...e?.querySelectorAll(`article .markdown-body h2`)??[]];function de(e,t,n){let[r,i]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!t)return;let n=e.current,r=Q(n);if(r.length===0||typeof IntersectionObserver>`u`)return;let a=new IntersectionObserver(e=>{let t=e.find(e=>e.isIntersecting);t&&i(r.indexOf(t.target))},{root:n,rootMargin:`-60px 0px -70% 0px`});for(let e of r)a.observe(e);return()=>a.disconnect()},[e,t]),{current:r!==null&&r<n?r:0,go:t=>{Q(e.current)[t]?.scrollIntoView({behavior:`smooth`,block:`start`}),i(t)}}}function fe({headings:e,current:t,go:n}){return(0,P.jsxs)(`nav`,{className:`vault-outline min-h-0 overflow-auto border-l border-rule-soft px-5 pt-[72px] pb-6 @max-[1080px]:hidden`,"aria-label":`Outline`,children:[(0,P.jsx)(`h2`,{className:`m-0 mb-2 text-xs font-semibold text-muted`,children:`On this page`}),(0,P.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:T(`block w-full truncate rounded-r-[8px] border-0 bg-transparent px-2.5 py-1 text-left text-sm text-text hover:bg-surface`,t===e.index&&`font-semibold text-accent shadow-[inset_2px_0_0_var(--accent)]`),"aria-current":t===e.index?`location`:void 0,onClick:()=>n(e.index),children:e.text})},e.index))})]})}var pe=[],$=(e,t)=>[e?`272px`:null,`minmax(0,1fr)`,t?`232px`:null].filter(Boolean).join(` `);function me({data:e,companion:t,search:r,stale:i,refresh:a,filter:o,setFilter:s,hidden:c}){return(0,P.jsxs)(`aside`,{hidden:c,className:`vault-tree-panel flex min-h-0 flex-col border-r border-rule @max-[720px]:max-h-[40vh] @max-[720px]:border-r-0 @max-[720px]:border-b`,id:`vault-tree-panel`,"aria-label":`Files`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between pt-3 pr-2.5 pb-2 pl-5`,children:[(0,P.jsx)(`strong`,{className:`text-sm`,children:`Files`}),(0,P.jsx)(n,{label:`Refresh tree`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":a.isPending?`Refreshing…`:`Refresh tree`,onClick:()=>a.mutate(),disabled:a.isPending,children:(0,P.jsx)(x,{name:`refresh`,className:a.isPending?`animate-spin`:void 0})})})]}),(0,P.jsx)(`p`,{id:`vault-stale`,className:Y+` mx-2.5`,role:`status`,hidden:!i,children:`Files changed — refresh tree.`}),a.error?(0,P.jsx)(`p`,{className:Y+` mx-2.5`,role:`status`,children:a.error.message}):null,(0,P.jsxs)(`label`,{className:`mx-3.5 mb-2 flex h-[34px] items-center gap-2 rounded-control border border-rule bg-surface pr-2 pl-2.5 text-muted focus-within:border-accent`,children:[(0,P.jsx)(x,{name:`search`,className:`size-3.5`}),(0,P.jsx)(`input`,{type:`search`,id:`vault-filter`,className:`vault-filter min-w-0 flex-1 border-0 bg-transparent text-sm text-text outline-none placeholder:text-muted`,placeholder:`Go to file`,"aria-label":`Go to file`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&s(``)}})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2.5 pb-6`,children:o.trim()?(0,P.jsx)(oe,{companion:t,query:o,search:r}):(0,P.jsx)(ie,{data:e,companion:t,search:r})})]})}function he({companion:e,rootName:t,writable:r,search:o}){let s=w(),c=v(p(e,o)),l=v({...p(e,o,!0),enabled:!(!c.data||c.data.tree!==null||c.data.failure)}).data??c.data,[f,m]=(0,j.useState)(``),h=a(e=>e.latestGeneration),g=a(e=>e.treeHidden),y=a(e=>e.toggleTree),b=a(e=>e.hydrate);(0,j.useEffect)(b,[b]);let S=_({mutationFn:()=>u({data:{companion:e,path:o.path,dir:o.dir,refresh:!0,wait:!0}}),onSuccess:t=>void d(s,e,o,t)}),T=(0,j.useRef)(null),E=!!l?.open&&o.mode!==`edit`,D=E?ue(l?.open?.markdown):pe,O=de(T,E?l?.open?.markdown:void 0,D.length);if(!l)return(0,P.jsx)(i,{});let k=h!==null&&l.generation!==null&&h>l.generation,A=D.length>0,M=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(n,{label:g?`Show files`:`Hide files`,side:`bottom`,children:(0,P.jsx)(C,{size:`icon-sm`,variant:`ghost`,id:`vault-tree-toggle`,"aria-controls":`vault-tree-panel`,"aria-expanded":!g,"aria-label":g?`Show files`:`Hide files`,onClick:y,children:(0,P.jsx)(x,{name:`sidebar`})})}),(0,P.jsx)(se,{rootName:t,search:o})]});return(0,P.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,P.jsxs)(`section`,{className:`vault-layout grid min-h-0 flex-1 border-t border-rule @max-[720px]:grid-cols-1!`,style:{"--vault-wide":$(!0,A),"--vault-wide-bare":$(!1,A),"--vault-narrow":$(!0,!1),"--vault-narrow-bare":$(!1,!1)},"data-vault-layout":!0,children:[(0,P.jsx)(me,{data:l,companion:e,search:o,stale:k,refresh:S,filter:f,setFilter:m,hidden:g}),(0,P.jsx)(`div`,{ref:T,className:`vault-main min-h-0 min-w-0 overflow-auto scroll-smooth`,"data-vault-main":!0,"data-vault-pane":!0,children:o.path||l.open||l.refusal?(0,P.jsx)(B,{companion:e,data:l,writable:r,search:o,crumbs:M}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(I,{crumbs:M}),(0,P.jsx)(le,{data:l,rootName:t})]})}),A?(0,P.jsx)(fe,{headings:D,...O}):null]})})}function ge(){let e=t.useSearch(),{data:n}=r(g({companion:e.companion,studioMode:e.studioMode}));if(!e.companion||!n.selected)return null;let i=n.selected.path.split(/[\\/]/).findLast(Boolean)??`companion`;return(0,P.jsx)(he,{companion:e.companion,rootName:i,writable:n.writable,search:{path:e.path,dir:e.dir,mode:e.mode}})}export{ge as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-
|
|
1
|
+
import{t as e}from"./cn-DC80MJV0.js";import{it as t}from"./button-C9SQW3kI.js";import{t as n}from"./jsx-runtime-MZURdZre.js";var r=n();function i({warnings:n}){return n.length===0?null:(0,r.jsx)(`section`,{className:e(t,`pb-4`),"aria-label":`Warnings`,children:(0,r.jsxs)(`div`,{className:`warnings grid gap-1.5 rounded-card border border-[color-mix(in_srgb,var(--warn)_35%,var(--border))] bg-warn-soft px-4 py-3 text-sm`,children:[(0,r.jsx)(`h2`,{className:`m-0 text-sm font-semibold text-warn`,children:`Some data could not be read`}),(0,r.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,r.jsx)(`li`,{children:e},e))})]})})}export{i as t};
|