@open-mercato/cezar 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-origin.d.ts +6 -0
- package/dist/api-origin.js +32 -0
- package/dist/api-origin.js.map +1 -0
- package/dist/automations/schedule-runner.d.ts +1 -0
- package/dist/automations/schedule-runner.js +2 -2
- package/dist/automations/schedule-runner.js.map +1 -1
- package/dist/core/agent-errors.d.ts +5 -0
- package/dist/core/agent-errors.js +49 -0
- package/dist/core/agent-errors.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +3 -0
- package/dist/core/claude-cli-runner.js +20 -4
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-ui-mapper.js +4 -1
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +1 -1
- package/dist/core/copilot-acp-runner.js +26 -5
- package/dist/core/copilot-acp-runner.js.map +1 -1
- package/dist/core/model-presets.d.ts +11 -0
- package/dist/core/model-presets.js +35 -1
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-model-catalog.js +3 -0
- package/dist/core/opencode-model-catalog.js.map +1 -1
- package/dist/core/opencode-server-runner.d.ts +7 -0
- package/dist/core/opencode-server-runner.js +36 -1
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +2 -0
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +6 -0
- package/dist/core/provider-auth.js +59 -13
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/usage-limit.js +8 -2
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/release/bump.d.ts +1 -1
- package/dist/release/bump.js +1 -1
- package/dist/release/stable.d.ts +21 -4
- package/dist/release/stable.js +48 -15
- package/dist/release/stable.js.map +1 -1
- package/dist/runs/agent-error-telemetry.js +4 -2
- package/dist/runs/agent-error-telemetry.js.map +1 -1
- package/dist/runs/store.d.ts +1 -1
- package/dist/runs/store.js +31 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/server/git-changes.d.ts +22 -0
- package/dist/server/git-changes.js +19 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/open-in-app.js +14 -3
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/preview/location-reporter.d.ts +12 -0
- package/dist/server/preview/location-reporter.js +45 -0
- package/dist/server/preview/location-reporter.js.map +1 -0
- package/dist/server/preview/picker-script.d.ts +0 -22
- package/dist/server/preview/picker-script.js +3 -1
- package/dist/server/preview/picker-script.js.map +1 -1
- package/dist/server/provider-telemetry.d.ts +3 -1
- package/dist/server/provider-telemetry.js +4 -2
- package/dist/server/provider-telemetry.js.map +1 -1
- package/dist/server/repo-sync.js +5 -10
- package/dist/server/repo-sync.js.map +1 -1
- package/dist/server/server.d.ts +1854 -1854
- package/dist/server/server.js +7 -2
- package/dist/server/server.js.map +1 -1
- package/dist/server/worktree-lifecycle.d.ts +8 -8
- package/dist/telemetry.js +3 -1
- package/dist/telemetry.js.map +1 -1
- package/dist/workflows/continuation-context.d.ts +3 -1
- package/dist/workflows/continuation-context.js +22 -3
- package/dist/workflows/continuation-context.js.map +1 -1
- package/dist/workflows/run.d.ts +20 -9
- package/dist/workflows/run.js +49 -11
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-copilot-acp.mjs +4 -0
- package/web/dist/assets/{agent-task-pickers-DEW3Vgdv.js → agent-task-pickers-CNuwgeJL.js} +1 -1
- package/web/dist/assets/{automations-route-Cx7mzYhD.js → automations-route-Cs1tsu1W.js} +1 -1
- package/web/dist/assets/{commit-list-xMdmPYbz.js → commit-list-Ti2arrt8.js} +1 -1
- package/web/dist/assets/{compare-variants-B6ja1M4D.js → compare-variants-CdchlJMs.js} +1 -1
- package/web/dist/assets/{dashboard-ClEGBFFq.js → dashboard-wi0EQack.js} +2 -2
- package/web/dist/assets/{file-preview-iucr8WDo.js → file-preview-pS9i9ZDR.js} +1 -1
- package/web/dist/assets/git-tab-loading-BC6WP7W4.js +1 -0
- package/web/dist/assets/{git-toolbar-DU5Ca6RI.js → git-toolbar-Dra1QlHb.js} +1 -1
- package/web/dist/assets/github-DZcdhMzw.js +1 -0
- package/web/dist/assets/{host-usage-DjDYDU0A.js → host-usage-DnkXF0CT.js} +1 -1
- package/web/dist/assets/index-qeFtKZ4e.js +22 -0
- package/web/dist/assets/{layout-cards-Sur4EWtx.js → layout-cards-CXMlrDUf.js} +1 -1
- package/web/dist/assets/{project-router-DZsR9P9C.js → project-router-CZzr7lzN.js} +2 -2
- package/web/dist/assets/queries-Bn7zl9OU.js +1 -0
- package/web/dist/assets/{reference-chip-DnemrSPW.js → reference-chip-CScP5y_O.js} +1 -1
- package/web/dist/assets/repo-git-CV-yXaSx.js +1 -0
- package/web/dist/assets/{run-diff-BPZ85gAE.js → run-diff-GHEaeAio.js} +2 -2
- package/web/dist/assets/{skills-BgCN1gTp.js → skills-DuSNv5op.js} +1 -1
- package/web/dist/assets/{task-commits-W1ZZiEt4.js → task-commits-D_gLpFQo.js} +1 -1
- package/web/dist/assets/{task-graph-DI2fn5M8.js → task-graph-BgHk8Y3v.js} +1 -1
- package/web/dist/assets/{task-notes-lmvd1UM7.js → task-notes-BBp0rdzM.js} +1 -1
- package/web/dist/assets/task-workspace-Cr9AjTxP.js +27 -0
- package/web/dist/assets/{terminal-drawer-DAkquqSe.js → terminal-drawer-CcPOjWwP.js} +2 -2
- package/web/dist/assets/{tracker-Cqdpt9RN.js → tracker-BHwMGsDY.js} +2 -2
- package/web/dist/assets/use-automations-Dh3Wj-79.js +5 -0
- package/web/dist/assets/{use-now-pBdvhv13.js → use-now-BB7W0F--.js} +1 -1
- package/web/dist/assets/{workflow-graph-l7O50dsV.js → workflow-graph-CcOTCItr.js} +3 -3
- package/web/dist/assets/worktree-lifecycle-operation-vTgExKUM.js +18 -0
- package/web/dist/index.html +10 -10
- package/web/dist/assets/git-tab-loading-BfC2ir8N.js +0 -1
- package/web/dist/assets/github-CELdSmld.js +0 -1
- package/web/dist/assets/index-BBND6Sg3.js +0 -22
- package/web/dist/assets/queries-CI0EmEcH.js +0 -1
- package/web/dist/assets/repo-git-Bj0PBOjX.js +0 -1
- package/web/dist/assets/task-workspace-B8Fpho3e.js +0 -27
- package/web/dist/assets/use-automations-v77gHYDG.js +0 -5
- package/web/dist/assets/worktree-lifecycle-operation-DOTiqQFx.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r,t as i}from"./button-Clwd6u4_.js";import{t as a}from"./project-router-DZsR9P9C.js";import{_ as o,f as s,g as c,h as l,m as u,p as d}from"./reference-chip-DnemrSPW.js";import{$ as f,B as p,Dn as m,Et as h,Sn as g,W as _,Y as v,dt as y,mt as b}from"./git-tab-loading-BfC2ir8N.js";import{t as x}from"./check-Dt8U0Zvm.js";import{f as S}from"./tooltip-B628Gs7C.js";import{a as C,c as w,i as T,l as E,n as D,r as O,u as k}from"./icon-tooltip-YXzUubMO.js";import{t as A}from"./save-B8DEQI2V.js";import{t as j}from"./x-DMIsmLBt.js";import{t as M}from"./input-DIWTlsx6.js";var N=e(t(),1),P=n(),F=2,ee=new Map,te=[],ne=[],re=30,I=`text/cez-view`,L=`text/cez-column`;function R({layouts:e,active:t,onSelect:n,onClose:o,saved:s=ne,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,fixedViews:d=[],fixedActive:f=null,onViews:v=te,onSelectFixed:y,notesHref:b,notesActive:x=!1,showLayouts:S=!0,onViewDragStart:C,onViewDragEnd:w,onOpenBeside:A,onColumnDropClose:j,keyHints:M=ee,showKeyHints:R=!1}){let B=b?_(d):[...d],U=e=>e===`notes`?x:f===e,W=(0,N.useRef)(null),[ie,ae]=(0,N.useState)(0),[G,K]=(0,N.useState)(null),oe=`${B.join(`|`)}#${S&&f===null?t:``}`;(0,N.useEffect)(()=>{let e=W.current;if(!e)return;let t=()=>ae(e.clientWidth),n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[]);let[se,ce]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=typeof document>`u`?void 0:document.fonts;if(!e)return;let t=()=>ce(e=>e+1);return e.ready.then(t),e.addEventListener?.(`loadingdone`,t),()=>e.removeEventListener?.(`loadingdone`,t)},[]),(0,N.useLayoutEffect)(()=>K(null),[oe,ie,se]),(0,N.useLayoutEffect)(()=>{let e=W.current;G===null||G===0||!e||e.scrollWidth>e.clientWidth+1&&K(G-1)}),(0,N.useLayoutEffect)(()=>{let e=W.current;if(G!==null||!e)return;let t=[...e.querySelectorAll(`[data-strip-item]`)].map(e=>e.offsetWidth+F),n=[...e.querySelectorAll(`[data-strip-chrome]`)].reduce((e,t)=>e+t.offsetWidth+F,0),r=e.clientWidth-n;if(t.reduce((e,t)=>e+t,0)<=r){K(B.length);return}let i=B.findIndex(U),a=re,o=0;for(let[e,n]of t.entries()){let s=i>e?t[i]??0:0;if(a+n+s>r)break;a+=n,o+=1}K(o)});let q=G??B.length,J=B.slice(0,q),Y=B.findIndex(U);Y>=q&&(J=[...J,B[Y]]);let X=B.filter(e=>!J.includes(e)),[Z,Q]=(0,N.useState)(!1),$=e=>j!==void 0&&e.dataTransfer.types.includes(L);return(0,P.jsxs)(`div`,{ref:W,"data-slot":`layout-cards`,"data-drop-close":Z?``:void 0,className:r(`relative flex min-w-0 flex-1 items-end gap-0.5 overflow-x-clip rounded-md`,Z&&`bg-muted outline-1 outline-dashed outline-border`),onDragOver:e=>{$(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Q(!0))},onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:e=>{if(Q(!1),!$(e))return;let t=e.dataTransfer.getData(L),n=Number(t);t===``||!Number.isInteger(n)||(e.preventDefault(),j?.(n))},children:[J.map(e=>{if(e===`notes`)return(0,P.jsxs)(a,{to:b,"data-strip-item":``,"aria-current":x?`page`:void 0,className:r(`relative -mb-px flex h-9 shrink-0 items-center gap-1.5 border-b-2 px-2.5 text-[13px] font-medium`,x?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(z,{hint:R?M.get(`view:notes`):void 0,children:(0,P.jsx)(g,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),`Notes`]},`notes`);let t=B.indexOf(e)+1,n=p[e],o=U(e),s=v.includes(e),c=h(e),l=M.get(`view:${e}`);return(0,P.jsxs)(i,{type:`button`,variant:`ghost`,"data-slot":`layout-card`,"data-strip-item":``,"data-fixed":e,"data-active":o?`true`:void 0,"data-on":s?``:void 0,"aria-pressed":o||s,draggable:C!==void 0,title:C?`${c}${t<=9?` (${t})`:``} — drag onto the workspace to split, ⌥-click to open beside`:c,onClick:t=>{t.altKey&&A?A(e):y?.(e)},onDragStart:t=>{t.dataTransfer.setData(I,e),t.dataTransfer.effectAllowed=`copyMove`,C?.(e)},onDragEnd:()=>w?.(),className:r(`relative -mb-px h-9 shrink-0 gap-1.5 rounded-none border-b-2 border-transparent px-2.5 text-[13px] font-medium text-muted-foreground hover:bg-transparent hover:text-foreground active:translate-y-0`,(o||s)&&`text-foreground`,o&&`border-foreground`),children:[(0,P.jsx)(z,{hint:R?l:void 0,children:(0,P.jsx)(n,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),c,s&&!o?(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-2 right-1 size-1.5 rounded-full bg-primary`}):null]},e)}),X.length>0?(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsx)(i,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`more-views`,"aria-label":`${X.length} more views`,title:`More views`,className:`mb-1 size-7 shrink-0 text-muted-foreground`,children:(0,P.jsx)(m,{"aria-hidden":`true`})})}),(0,P.jsx)(O,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:X.map(e=>{if(e===`notes`)return(0,P.jsx)(T,{asChild:!0,children:(0,P.jsxs)(a,{to:b,children:[(0,P.jsx)(g,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:`Notes`}),M.get(`view:notes`)?(0,P.jsx)(E,{children:M.get(`view:notes`)}):null]})},`notes`);let t=p[e],n=M.get(`view:${e}`);return(0,P.jsxs)(T,{"data-view":e,onSelect:()=>y?.(e),children:[(0,P.jsx)(t,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:h(e)}),n?(0,P.jsx)(E,{children:n}):null]},e)})})]}):null,Z?(0,P.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 rounded bg-background px-2 py-0.5 text-xs font-medium text-foreground shadow-sm`,children:`Drop to close this column`}):null,S?(0,P.jsx)(`div`,{"data-strip-chrome":``,className:`ml-auto flex shrink-0 items-center pb-1 pl-2`,children:(0,P.jsx)(H,{layouts:e,active:f===null?t:null,saved:s,onSelect:n,onClose:o,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,suggestedName:V(e,f===null?t:null,f)})}):null]})}function z({hint:e,children:t}){let n=`pointer-events-none flex shrink-0 items-center justify-center rounded-[4px] bg-foreground font-mono text-[10px] leading-none font-semibold text-background`;return e?e.length===1?(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`size-3.5`),children:e}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`invisible flex shrink-0`,children:t}),(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`absolute -top-1 right-0 z-10 h-4 px-1`),children:e})]}):t}function B({count:e,className:t}){let n=Math.max(1,Math.min(e,3)),i=2.5,a=1.5,o=(20-i*2-a*(n-1))/n;return(0,P.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 20 14`,className:r(`h-3.5 w-5 shrink-0`,t),fill:`none`,children:[(0,P.jsx)(`rect`,{x:`0.6`,y:`0.6`,width:18.8,height:12.8,rx:`2`,stroke:`currentColor`,strokeWidth:`1.2`}),Array.from({length:n},(e,t)=>(0,P.jsx)(`rect`,{x:i+t*(o+a),y:i,width:o,height:14-i*2,rx:`0.75`,fill:`currentColor`,opacity:.55},t))]})}function V(e,t,n){let r=t===null?void 0:e.find(e=>e.name===t);return r&&r.name!==`Custom`?b(r.name):r?r.columns.map(e=>h(e.view)).join(` + `):n?`${h(n)} layout`:``}function H({layouts:e,active:t,saved:n,onSelect:a,onClose:o,onApplySaved:s,onSaveCurrent:c,onDeleteSaved:l,suggestedName:u}){let d=t===null?void 0:e.find(e=>e.name===t),f=new Set(n.map(e=>e.name)),p=e.filter(e=>!f.has(e.name)),[m,h]=(0,N.useState)(!1),g=(0,N.useRef)(!1),_=(0,N.useRef)(null);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,ref:_,"data-action":`layouts`,"data-active-layout":d?d.name:void 0,"aria-label":d?`Layout: ${b(d.name)}`:`Layouts`,title:`Layouts — open a saved one, or save what is on screen`,className:r(`h-7 max-w-48 shrink-0 gap-1.5 px-2 text-[12.5px]`,d?`text-foreground`:`text-muted-foreground`),children:[(0,P.jsx)(B,{count:d?.columns.length??2}),(0,P.jsx)(`span`,{className:`truncate max-md:hidden`,children:d?b(d.name):`Layout`}),(0,P.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 opacity-60`})]})}),(0,P.jsxs)(O,{align:`end`,className:`max-h-96 w-64 overflow-y-auto`,onCloseAutoFocus:e=>{g.current&&(g.current=!1,e.preventDefault())},children:[(0,P.jsx)(C,{children:`Saved layouts`}),n.length===0?(0,P.jsx)(`p`,{className:`px-2 pb-1.5 text-xs text-muted-foreground`,children:`None yet — arrange the view (drag a tab onto it), then save it here. Saved layouts are offered in every task.`}):null,n.map(e=>(0,P.jsx)(U,{name:e.name,count:e.columns.length,selected:e.name===t,kind:`saved`,onPick:()=>s?.(e),remove:l?{label:`Delete saved layout ${e.name}`,run:()=>l(e.name)}:void 0},`saved:${e.name}`)),p.length>0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsx)(C,{children:`This task`}),p.map(e=>(0,P.jsx)(U,{name:b(e.name),count:e.columns.length,selected:e.name===t,kind:`task`,onPick:()=>a(e.name),remove:{label:`Close layout ${b(e.name)}`,run:()=>o(e.name)}},`task:${e.name}`))]}):null,c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsxs)(T,{"data-action":`save-layout`,onSelect:()=>{g.current=!0,h(!0)},children:[(0,P.jsx)(A,{"aria-hidden":`true`}),`Save current view as layout…`]})]}):null]})]}),(0,P.jsx)(W,{open:m,suggested:u,taken:f,onCommit:e=>{h(!1),c?.(e)},onCancel:()=>h(!1),returnFocus:()=>_.current?.focus()})]})}function U({name:e,count:t,selected:n,kind:r,onPick:i,remove:a}){return(0,P.jsxs)(T,{"data-layout":e,"data-layout-kind":r,"data-active":n?``:void 0,onSelect:i,"aria-keyshortcuts":a?`Delete`:void 0,onKeyDown:e=>{!a||e.key!==`Delete`&&e.key!==`Backspace`||(e.preventDefault(),a.run())},className:`group/layout pr-1`,children:[(0,P.jsx)(B,{count:t}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n?(0,P.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}):null,a?(0,P.jsx)(`button`,{type:`button`,"aria-label":a.label,title:`${a.label} (Delete)`,className:`flex size-5 items-center justify-center rounded-sm text-muted-foreground opacity-0 group-hover/layout:opacity-100 group-focus/layout:opacity-100 hover:bg-background hover:text-foreground`,onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),a.run()},children:(0,P.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function W({open:e,suggested:t,taken:n,onCommit:r,onCancel:a,returnFocus:p}){let[m,h]=(0,N.useState)(``);(0,N.useEffect)(()=>{e&&h(t)},[e,t]);let g=m.trim(),_=g!==``&&y(g);return(0,P.jsx)(s,{open:e,onOpenChange:e=>!e&&a(),children:(0,P.jsx)(d,{className:`sm:max-w-sm`,onCloseAutoFocus:e=>{e.preventDefault(),p()},children:(0,P.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g!==``&&!_&&r(g)},children:[(0,P.jsxs)(c,{children:[(0,P.jsx)(o,{children:`Save layout`}),(0,P.jsx)(u,{children:`Saved layouts are offered in every task, in every project.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{autoFocus:!0,"aria-label":`Layout name`,maxLength:v,value:m,onChange:e=>h(e.target.value),onFocus:e=>e.currentTarget.select()}),_?(0,P.jsx)(`p`,{className:`text-xs text-danger`,children:g===`Custom`?`“${f}” is the task's unsaved arrangement — pick another.`:`That name belongs to a view tab — pick another.`}):n.has(g)?(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replaces the saved layout “`,g,`”.`]}):null]}),(0,P.jsxs)(l,{children:[(0,P.jsx)(i,{type:`button`,variant:`outline`,onClick:a,children:`Cancel`}),(0,P.jsx)(i,{type:`submit`,disabled:g===``||_,children:`Save`})]})]})})})}export{I as n,R as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r,t as i}from"./button-Clwd6u4_.js";import{t as a}from"./project-router-CZzr7lzN.js";import{_ as o,f as s,g as c,h as l,m as u,p as d}from"./reference-chip-CScP5y_O.js";import{$ as f,B as p,Dn as m,Et as h,Sn as g,W as _,Y as v,dt as y,mt as b}from"./git-tab-loading-BC6WP7W4.js";import{t as x}from"./check-Dt8U0Zvm.js";import{f as S}from"./tooltip-B628Gs7C.js";import{a as C,c as w,i as T,l as E,n as D,r as O,u as k}from"./icon-tooltip-YXzUubMO.js";import{t as A}from"./save-B8DEQI2V.js";import{t as j}from"./x-DMIsmLBt.js";import{t as M}from"./input-DIWTlsx6.js";var N=e(t(),1),P=n(),F=2,ee=new Map,te=[],ne=[],re=30,I=`text/cez-view`,L=`text/cez-column`;function R({layouts:e,active:t,onSelect:n,onClose:o,saved:s=ne,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,fixedViews:d=[],fixedActive:f=null,onViews:v=te,onSelectFixed:y,notesHref:b,notesActive:x=!1,showLayouts:S=!0,onViewDragStart:C,onViewDragEnd:w,onOpenBeside:A,onColumnDropClose:j,keyHints:M=ee,showKeyHints:R=!1}){let B=b?_(d):[...d],U=e=>e===`notes`?x:f===e,W=(0,N.useRef)(null),[ie,ae]=(0,N.useState)(0),[G,K]=(0,N.useState)(null),oe=`${B.join(`|`)}#${S&&f===null?t:``}`;(0,N.useEffect)(()=>{let e=W.current;if(!e)return;let t=()=>ae(e.clientWidth),n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[]);let[se,ce]=(0,N.useState)(0);(0,N.useEffect)(()=>{let e=typeof document>`u`?void 0:document.fonts;if(!e)return;let t=()=>ce(e=>e+1);return e.ready.then(t),e.addEventListener?.(`loadingdone`,t),()=>e.removeEventListener?.(`loadingdone`,t)},[]),(0,N.useLayoutEffect)(()=>K(null),[oe,ie,se]),(0,N.useLayoutEffect)(()=>{let e=W.current;G===null||G===0||!e||e.scrollWidth>e.clientWidth+1&&K(G-1)}),(0,N.useLayoutEffect)(()=>{let e=W.current;if(G!==null||!e)return;let t=[...e.querySelectorAll(`[data-strip-item]`)].map(e=>e.offsetWidth+F),n=[...e.querySelectorAll(`[data-strip-chrome]`)].reduce((e,t)=>e+t.offsetWidth+F,0),r=e.clientWidth-n;if(t.reduce((e,t)=>e+t,0)<=r){K(B.length);return}let i=B.findIndex(U),a=re,o=0;for(let[e,n]of t.entries()){let s=i>e?t[i]??0:0;if(a+n+s>r)break;a+=n,o+=1}K(o)});let q=G??B.length,J=B.slice(0,q),Y=B.findIndex(U);Y>=q&&(J=[...J,B[Y]]);let X=B.filter(e=>!J.includes(e)),[Z,Q]=(0,N.useState)(!1),$=e=>j!==void 0&&e.dataTransfer.types.includes(L);return(0,P.jsxs)(`div`,{ref:W,"data-slot":`layout-cards`,"data-drop-close":Z?``:void 0,className:r(`relative flex min-w-0 flex-1 items-end gap-0.5 overflow-x-clip rounded-md`,Z&&`bg-muted outline-1 outline-dashed outline-border`),onDragOver:e=>{$(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Q(!0))},onDragLeave:e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||Q(!1)},onDrop:e=>{if(Q(!1),!$(e))return;let t=e.dataTransfer.getData(L),n=Number(t);t===``||!Number.isInteger(n)||(e.preventDefault(),j?.(n))},children:[J.map(e=>{if(e===`notes`)return(0,P.jsxs)(a,{to:b,"data-strip-item":``,"aria-current":x?`page`:void 0,className:r(`relative -mb-px flex h-9 shrink-0 items-center gap-1.5 border-b-2 px-2.5 text-[13px] font-medium`,x?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(z,{hint:R?M.get(`view:notes`):void 0,children:(0,P.jsx)(g,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),`Notes`]},`notes`);let t=B.indexOf(e)+1,n=p[e],o=U(e),s=v.includes(e),c=h(e),l=M.get(`view:${e}`);return(0,P.jsxs)(i,{type:`button`,variant:`ghost`,"data-slot":`layout-card`,"data-strip-item":``,"data-fixed":e,"data-active":o?`true`:void 0,"data-on":s?``:void 0,"aria-pressed":o||s,draggable:C!==void 0,title:C?`${c}${t<=9?` (${t})`:``} — drag onto the workspace to split, ⌥-click to open beside`:c,onClick:t=>{t.altKey&&A?A(e):y?.(e)},onDragStart:t=>{t.dataTransfer.setData(I,e),t.dataTransfer.effectAllowed=`copyMove`,C?.(e)},onDragEnd:()=>w?.(),className:r(`relative -mb-px h-9 shrink-0 gap-1.5 rounded-none border-b-2 border-transparent px-2.5 text-[13px] font-medium text-muted-foreground hover:bg-transparent hover:text-foreground active:translate-y-0`,(o||s)&&`text-foreground`,o&&`border-foreground`),children:[(0,P.jsx)(z,{hint:R?l:void 0,children:(0,P.jsx)(n,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})}),c,s&&!o?(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-2 right-1 size-1.5 rounded-full bg-primary`}):null]},e)}),X.length>0?(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsx)(i,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-action":`more-views`,"aria-label":`${X.length} more views`,title:`More views`,className:`mb-1 size-7 shrink-0 text-muted-foreground`,children:(0,P.jsx)(m,{"aria-hidden":`true`})})}),(0,P.jsx)(O,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:X.map(e=>{if(e===`notes`)return(0,P.jsx)(T,{asChild:!0,children:(0,P.jsxs)(a,{to:b,children:[(0,P.jsx)(g,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:`Notes`}),M.get(`view:notes`)?(0,P.jsx)(E,{children:M.get(`view:notes`)}):null]})},`notes`);let t=p[e],n=M.get(`view:${e}`);return(0,P.jsxs)(T,{"data-view":e,onSelect:()=>y?.(e),children:[(0,P.jsx)(t,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`truncate`,children:h(e)}),n?(0,P.jsx)(E,{children:n}):null]},e)})})]}):null,Z?(0,P.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 rounded bg-background px-2 py-0.5 text-xs font-medium text-foreground shadow-sm`,children:`Drop to close this column`}):null,S?(0,P.jsx)(`div`,{"data-strip-chrome":``,className:`ml-auto flex shrink-0 items-center pb-1 pl-2`,children:(0,P.jsx)(H,{layouts:e,active:f===null?t:null,saved:s,onSelect:n,onClose:o,onApplySaved:c,onSaveCurrent:l,onDeleteSaved:u,suggestedName:V(e,f===null?t:null,f)})}):null]})}function z({hint:e,children:t}){let n=`pointer-events-none flex shrink-0 items-center justify-center rounded-[4px] bg-foreground font-mono text-[10px] leading-none font-semibold text-background`;return e?e.length===1?(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`size-3.5`),children:e}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`invisible flex shrink-0`,children:t}),(0,P.jsx)(`kbd`,{"data-slot":`tab-key-hint`,"aria-hidden":`true`,className:r(n,`absolute -top-1 right-0 z-10 h-4 px-1`),children:e})]}):t}function B({count:e,className:t}){let n=Math.max(1,Math.min(e,3)),i=2.5,a=1.5,o=(20-i*2-a*(n-1))/n;return(0,P.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 20 14`,className:r(`h-3.5 w-5 shrink-0`,t),fill:`none`,children:[(0,P.jsx)(`rect`,{x:`0.6`,y:`0.6`,width:18.8,height:12.8,rx:`2`,stroke:`currentColor`,strokeWidth:`1.2`}),Array.from({length:n},(e,t)=>(0,P.jsx)(`rect`,{x:i+t*(o+a),y:i,width:o,height:14-i*2,rx:`0.75`,fill:`currentColor`,opacity:.55},t))]})}function V(e,t,n){let r=t===null?void 0:e.find(e=>e.name===t);return r&&r.name!==`Custom`?b(r.name):r?r.columns.map(e=>h(e.view)).join(` + `):n?`${h(n)} layout`:``}function H({layouts:e,active:t,saved:n,onSelect:a,onClose:o,onApplySaved:s,onSaveCurrent:c,onDeleteSaved:l,suggestedName:u}){let d=t===null?void 0:e.find(e=>e.name===t),f=new Set(n.map(e=>e.name)),p=e.filter(e=>!f.has(e.name)),[m,h]=(0,N.useState)(!1),g=(0,N.useRef)(!1),_=(0,N.useRef)(null);return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(D,{children:[(0,P.jsx)(k,{asChild:!0,children:(0,P.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,ref:_,"data-action":`layouts`,"data-active-layout":d?d.name:void 0,"aria-label":d?`Layout: ${b(d.name)}`:`Layouts`,title:`Layouts — open a saved one, or save what is on screen`,className:r(`h-7 max-w-48 shrink-0 gap-1.5 px-2 text-[12.5px]`,d?`text-foreground`:`text-muted-foreground`),children:[(0,P.jsx)(B,{count:d?.columns.length??2}),(0,P.jsx)(`span`,{className:`truncate max-md:hidden`,children:d?b(d.name):`Layout`}),(0,P.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 opacity-60`})]})}),(0,P.jsxs)(O,{align:`end`,className:`max-h-96 w-64 overflow-y-auto`,onCloseAutoFocus:e=>{g.current&&(g.current=!1,e.preventDefault())},children:[(0,P.jsx)(C,{children:`Saved layouts`}),n.length===0?(0,P.jsx)(`p`,{className:`px-2 pb-1.5 text-xs text-muted-foreground`,children:`None yet — arrange the view (drag a tab onto it), then save it here. Saved layouts are offered in every task.`}):null,n.map(e=>(0,P.jsx)(U,{name:e.name,count:e.columns.length,selected:e.name===t,kind:`saved`,onPick:()=>s?.(e),remove:l?{label:`Delete saved layout ${e.name}`,run:()=>l(e.name)}:void 0},`saved:${e.name}`)),p.length>0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsx)(C,{children:`This task`}),p.map(e=>(0,P.jsx)(U,{name:b(e.name),count:e.columns.length,selected:e.name===t,kind:`task`,onPick:()=>a(e.name),remove:{label:`Close layout ${b(e.name)}`,run:()=>o(e.name)}},`task:${e.name}`))]}):null,c?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(w,{}),(0,P.jsxs)(T,{"data-action":`save-layout`,onSelect:()=>{g.current=!0,h(!0)},children:[(0,P.jsx)(A,{"aria-hidden":`true`}),`Save current view as layout…`]})]}):null]})]}),(0,P.jsx)(W,{open:m,suggested:u,taken:f,onCommit:e=>{h(!1),c?.(e)},onCancel:()=>h(!1),returnFocus:()=>_.current?.focus()})]})}function U({name:e,count:t,selected:n,kind:r,onPick:i,remove:a}){return(0,P.jsxs)(T,{"data-layout":e,"data-layout-kind":r,"data-active":n?``:void 0,onSelect:i,"aria-keyshortcuts":a?`Delete`:void 0,onKeyDown:e=>{!a||e.key!==`Delete`&&e.key!==`Backspace`||(e.preventDefault(),a.run())},className:`group/layout pr-1`,children:[(0,P.jsx)(B,{count:t}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n?(0,P.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}):null,a?(0,P.jsx)(`button`,{type:`button`,"aria-label":a.label,title:`${a.label} (Delete)`,className:`flex size-5 items-center justify-center rounded-sm text-muted-foreground opacity-0 group-hover/layout:opacity-100 group-focus/layout:opacity-100 hover:bg-background hover:text-foreground`,onPointerUp:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),a.run()},children:(0,P.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`})}):null]})}function W({open:e,suggested:t,taken:n,onCommit:r,onCancel:a,returnFocus:p}){let[m,h]=(0,N.useState)(``);(0,N.useEffect)(()=>{e&&h(t)},[e,t]);let g=m.trim(),_=g!==``&&y(g);return(0,P.jsx)(s,{open:e,onOpenChange:e=>!e&&a(),children:(0,P.jsx)(d,{className:`sm:max-w-sm`,onCloseAutoFocus:e=>{e.preventDefault(),p()},children:(0,P.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g!==``&&!_&&r(g)},children:[(0,P.jsxs)(c,{children:[(0,P.jsx)(o,{children:`Save layout`}),(0,P.jsx)(u,{children:`Saved layouts are offered in every task, in every project.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{autoFocus:!0,"aria-label":`Layout name`,maxLength:v,value:m,onChange:e=>h(e.target.value),onFocus:e=>e.currentTarget.select()}),_?(0,P.jsx)(`p`,{className:`text-xs text-danger`,children:g===`Custom`?`“${f}” is the task's unsaved arrangement — pick another.`:`That name belongs to a view tab — pick another.`}):n.has(g)?(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replaces the saved layout “`,g,`”.`]}):null]}),(0,P.jsxs)(l,{children:[(0,P.jsx)(i,{type:`button`,variant:`outline`,onClick:a,children:`Cancel`}),(0,P.jsx)(i,{type:`submit`,disabled:g===``||_,children:`Save`})]})]})})})}export{I as n,R as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{_a as r}from"./queries-CI0EmEcH.js";import{r as i}from"./button-Clwd6u4_.js";import{i as a}from"./bundle-mjs-BT31bpU6.js";var o=e(t(),1),s=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,c=/^[\\/]{2}/;function l(e,t){return t+e.replace(/\\/g,`/`)}var u=`popstate`;function d(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function f(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return _(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:v(t)}return b(t,n,null,e)}function p(e,t){if(e===!1||e==null)throw Error(t)}function m(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function h(){return Math.random().toString(36).substring(2,10)}function g(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?y(t):t,state:n,key:t&&t.key||r||h(),mask:i}}function v({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function y(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function b(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=f();l??(l=0,o.replaceState({...o.state,idx:l},``));function f(){return(o.state||{idx:null}).idx}function p(){s=`POP`;let e=f(),t=e==null?null:e-l;l=e,c&&c({action:s,location:y.location,delta:t})}function m(e,t){s=`PUSH`;let r=d(e)?e:_(y.location,e,t);n&&n(r,e),l=f()+1;let u=g(r,l),p=y.createHref(r.mask||r);try{o.pushState(u,``,p)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(p)}a&&c&&c({action:s,location:y.location,delta:1})}function h(e,t){s=`REPLACE`;let r=d(e)?e:_(y.location,e,t);n&&n(r,e),l=f();let i=g(r,l),u=y.createHref(r.mask||r);o.replaceState(i,``,u),a&&c&&c({action:s,location:y.location,delta:0})}function v(e){return x(i,e)}let y={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(u,p),c=e,()=>{i.removeEventListener(u,p),c=null}},createHref(e){return t(i,e)},createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:m,replace:h,go(e){return o.go(e)}};return y}function x(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),p(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:v(t);return i=i.replace(/ $/,`%20`),!n&&c.test(i)&&(i=r+i),new URL(i,r)}function S(e,t,n=`/`){return C(e,t,n,!1)}function C(e,t,n,r,i){let a=O((typeof t==`string`?y(t):t).pathname||`/`,n);if(a==null)return null;let o=i??T(e),s=null,c=me(a);for(let e=0;s==null&&e<o.length;++e)s=de(o[e],c,r);return s}function w(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function T(e){let t=E(e);return te(t),t}function E(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;p(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=A([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(p(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),E(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=pe(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ee(e.path))a(e,t,!0,n)}),t}function ee(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ee(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function te(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ne=/^:[\w-]+$/,re=3,ie=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=ie),n.filter(e=>!ce(e)).reduce((e,t)=>e+(ne.test(t)?re:t===``?ae:oe),r)}function ue(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?fe(u,l,s.matcher,s.compiledParams):D(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=D({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:A([a,d.pathname]),pathnameBase:xe(A([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=A([a,d.pathnameBase]))}return o}function D(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=pe(e.path,e.caseSensitive,e.end);return fe(e,t,n,r)}function fe(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function pe(e,t=!1,n=!0){m(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return m(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function O(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function he(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?y(e):e,a;return n?(n=be(n),a=n.startsWith(`/`)?ge(n.substring(1),`/`):ge(n,t)):a=t,{pathname:a,search:Se(r),hash:Ce(i)}}function ge(e,t){let n=j(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function _e(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ve(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ye(e){let t=ve(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function k(e,t,n,r=!1){let i;typeof e==`string`?i=y(e):(i={...e},p(!i.pathname||!i.pathname.includes(`?`),_e(`?`,`pathname`,`search`,i)),p(!i.pathname||!i.pathname.includes(`#`),_e(`#`,`pathname`,`hash`,i)),p(!i.search||!i.search.includes(`#`),_e(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/[\\/]{2,}/g,`/`),A=e=>be(e.join(`/`)),j=e=>e.replace(/\/+$/,``),xe=e=>j(e).replace(/^\/*/,`/`),Se=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ce=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,we=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ee(e){return A(e.map(e=>e.route.path).filter(Boolean))||`/`}var De=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Oe(e,t){let n=e;if(typeof n!=`string`||!s.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(De)try{let e=new URL(window.location.href),r=c.test(n)?new URL(l(n,e.protocol)):new URL(n),a=O(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{m(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ke=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(ke);var Ae=[`GET`,...ke];new Set(Ae);var je=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Me(e){try{return je.includes(new URL(e).protocol)}catch{return!1}}var M=o.createContext(null);M.displayName=`DataRouter`;var N=o.createContext(null);N.displayName=`DataRouterState`;var Ne=o.createContext(!1);function Pe(){return o.useContext(Ne)}var Fe=o.createContext({isTransitioning:!1});Fe.displayName=`ViewTransition`;var Ie=o.createContext(new Map);Ie.displayName=`Fetchers`;var Le=o.createContext(null);Le.displayName=`Await`;var P=o.createContext(null);P.displayName=`Navigation`;var F=o.createContext(null);F.displayName=`Location`;var I=o.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var Re=o.createContext(null);Re.displayName=`RouteError`;var ze=`REACT_ROUTER_ERROR`,Be=`REDIRECT`,Ve=`ROUTE_ERROR_RESPONSE`;function He(e){if(e.startsWith(`${ze}:${Be}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Ue(e){if(e.startsWith(`${ze}:${Ve}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new we(t.status,t.statusText,t.data)}catch{}}function We(e,{relative:t}={}){p(L(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=o.useContext(P),{hash:i,pathname:a,search:s}=B(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:A([n,a])),r.createHref({pathname:c,search:s,hash:i})}function L(){return o.useContext(F)!=null}function R(){return p(L(),`useLocation() may be used only in the context of a <Router> component.`),o.useContext(F).location}function Ge(){return o.useContext(F).navigationType}var Ke=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function qe(e){o.useContext(P).static||o.useLayoutEffect(e)}function z(){let{isDataRoute:e}=o.useContext(I);return e?gt():Je()}function Je(){p(L(),`useNavigate() may be used only in the context of a <Router> component.`);let e=o.useContext(M),{basename:t,navigator:n}=o.useContext(P),{matches:r}=o.useContext(I),{pathname:i}=R(),a=JSON.stringify(ye(r)),s=o.useRef(!1);return qe(()=>{s.current=!0}),o.useCallback((r,o={})=>{if(m(s.current,Ke),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=k(r,JSON.parse(a),i,o.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:A([t,c.pathname])),(o.replace?n.replace:n.push)(c,o.state,o)},[t,n,a,i,e])}var Ye=o.createContext(null);function Xe(e){let t=o.useContext(I).outlet;return o.useMemo(()=>t&&o.createElement(Ye.Provider,{value:e},t),[t,e])}function Ze(){let{matches:e}=o.useContext(I);return e[e.length-1]?.params??{}}function B(e,{relative:t}={}){let{matches:n}=o.useContext(I),{pathname:r}=R(),i=JSON.stringify(ye(n));return o.useMemo(()=>k(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Qe(e,t){return $e(e,t)}function $e(e,t,n){p(L(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=o.useContext(P),{matches:i}=o.useContext(I),a=i[i.length-1],s=a?a.params:{},c=a?a.pathname:`/`,l=a?a.pathnameBase:`/`,u=a&&a.route;{let e=u&&u.path||``;vt(c,!u||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ga as r}from"./queries-Bn7zl9OU.js";import{r as i}from"./button-Clwd6u4_.js";import{i as a}from"./bundle-mjs-BT31bpU6.js";var o=e(t(),1),s=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,c=/^[\\/]{2}/;function l(e,t){return t+e.replace(/\\/g,`/`)}var u=`popstate`;function d(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function f(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return _(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:v(t)}return b(t,n,null,e)}function p(e,t){if(e===!1||e==null)throw Error(t)}function m(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function h(){return Math.random().toString(36).substring(2,10)}function g(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?y(t):t,state:n,key:t&&t.key||r||h(),mask:i}}function v({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function y(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function b(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=f();l??(l=0,o.replaceState({...o.state,idx:l},``));function f(){return(o.state||{idx:null}).idx}function p(){s=`POP`;let e=f(),t=e==null?null:e-l;l=e,c&&c({action:s,location:y.location,delta:t})}function m(e,t){s=`PUSH`;let r=d(e)?e:_(y.location,e,t);n&&n(r,e),l=f()+1;let u=g(r,l),p=y.createHref(r.mask||r);try{o.pushState(u,``,p)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(p)}a&&c&&c({action:s,location:y.location,delta:1})}function h(e,t){s=`REPLACE`;let r=d(e)?e:_(y.location,e,t);n&&n(r,e),l=f();let i=g(r,l),u=y.createHref(r.mask||r);o.replaceState(i,``,u),a&&c&&c({action:s,location:y.location,delta:0})}function v(e){return x(i,e)}let y={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(u,p),c=e,()=>{i.removeEventListener(u,p),c=null}},createHref(e){return t(i,e)},createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:m,replace:h,go(e){return o.go(e)}};return y}function x(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),p(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:v(t);return i=i.replace(/ $/,`%20`),!n&&c.test(i)&&(i=r+i),new URL(i,r)}function S(e,t,n=`/`){return C(e,t,n,!1)}function C(e,t,n,r,i){let a=O((typeof t==`string`?y(t):t).pathname||`/`,n);if(a==null)return null;let o=i??T(e),s=null,c=me(a);for(let e=0;s==null&&e<o.length;++e)s=de(o[e],c,r);return s}function w(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function T(e){let t=E(e);return te(t),t}function E(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;p(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=A([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(p(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),E(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=pe(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ee(e.path))a(e,t,!0,n)}),t}function ee(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ee(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function te(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ne=/^:[\w-]+$/,re=3,ie=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=ie),n.filter(e=>!ce(e)).reduce((e,t)=>e+(ne.test(t)?re:t===``?ae:oe),r)}function ue(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?fe(u,l,s.matcher,s.compiledParams):D(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=D({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:A([a,d.pathname]),pathnameBase:xe(A([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=A([a,d.pathnameBase]))}return o}function D(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=pe(e.path,e.caseSensitive,e.end);return fe(e,t,n,r)}function fe(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function pe(e,t=!1,n=!0){m(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return m(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function O(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function he(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?y(e):e,a;return n?(n=be(n),a=n.startsWith(`/`)?ge(n.substring(1),`/`):ge(n,t)):a=t,{pathname:a,search:Se(r),hash:Ce(i)}}function ge(e,t){let n=j(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function _e(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ve(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ye(e){let t=ve(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function k(e,t,n,r=!1){let i;typeof e==`string`?i=y(e):(i={...e},p(!i.pathname||!i.pathname.includes(`?`),_e(`?`,`pathname`,`search`,i)),p(!i.pathname||!i.pathname.includes(`#`),_e(`#`,`pathname`,`hash`,i)),p(!i.search||!i.search.includes(`#`),_e(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/[\\/]{2,}/g,`/`),A=e=>be(e.join(`/`)),j=e=>e.replace(/\/+$/,``),xe=e=>j(e).replace(/^\/*/,`/`),Se=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ce=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,we=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Ee(e){return A(e.map(e=>e.route.path).filter(Boolean))||`/`}var De=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Oe(e,t){let n=e;if(typeof n!=`string`||!s.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(De)try{let e=new URL(window.location.href),r=c.test(n)?new URL(l(n,e.protocol)):new URL(n),a=O(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{m(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var ke=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(ke);var Ae=[`GET`,...ke];new Set(Ae);var je=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Me(e){try{return je.includes(new URL(e).protocol)}catch{return!1}}var M=o.createContext(null);M.displayName=`DataRouter`;var N=o.createContext(null);N.displayName=`DataRouterState`;var Ne=o.createContext(!1);function Pe(){return o.useContext(Ne)}var Fe=o.createContext({isTransitioning:!1});Fe.displayName=`ViewTransition`;var Ie=o.createContext(new Map);Ie.displayName=`Fetchers`;var Le=o.createContext(null);Le.displayName=`Await`;var P=o.createContext(null);P.displayName=`Navigation`;var F=o.createContext(null);F.displayName=`Location`;var I=o.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var Re=o.createContext(null);Re.displayName=`RouteError`;var ze=`REACT_ROUTER_ERROR`,Be=`REDIRECT`,Ve=`ROUTE_ERROR_RESPONSE`;function He(e){if(e.startsWith(`${ze}:${Be}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Ue(e){if(e.startsWith(`${ze}:${Ve}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new we(t.status,t.statusText,t.data)}catch{}}function We(e,{relative:t}={}){p(L(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=o.useContext(P),{hash:i,pathname:a,search:s}=B(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:A([n,a])),r.createHref({pathname:c,search:s,hash:i})}function L(){return o.useContext(F)!=null}function R(){return p(L(),`useLocation() may be used only in the context of a <Router> component.`),o.useContext(F).location}function Ge(){return o.useContext(F).navigationType}var Ke=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function qe(e){o.useContext(P).static||o.useLayoutEffect(e)}function z(){let{isDataRoute:e}=o.useContext(I);return e?gt():Je()}function Je(){p(L(),`useNavigate() may be used only in the context of a <Router> component.`);let e=o.useContext(M),{basename:t,navigator:n}=o.useContext(P),{matches:r}=o.useContext(I),{pathname:i}=R(),a=JSON.stringify(ye(r)),s=o.useRef(!1);return qe(()=>{s.current=!0}),o.useCallback((r,o={})=>{if(m(s.current,Ke),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=k(r,JSON.parse(a),i,o.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:A([t,c.pathname])),(o.replace?n.replace:n.push)(c,o.state,o)},[t,n,a,i,e])}var Ye=o.createContext(null);function Xe(e){let t=o.useContext(I).outlet;return o.useMemo(()=>t&&o.createElement(Ye.Provider,{value:e},t),[t,e])}function Ze(){let{matches:e}=o.useContext(I);return e[e.length-1]?.params??{}}function B(e,{relative:t}={}){let{matches:n}=o.useContext(I),{pathname:r}=R(),i=JSON.stringify(ye(n));return o.useMemo(()=>k(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Qe(e,t){return $e(e,t)}function $e(e,t,n){p(L(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=o.useContext(P),{matches:i}=o.useContext(I),a=i[i.length-1],s=a?a.params:{},c=a?a.pathname:`/`,l=a?a.pathnameBase:`/`,u=a&&a.route;{let e=u&&u.path||``;vt(c,!u||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
2
|
|
|
3
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=R(),f;if(t){let e=typeof t==`string`?y(t):t;p(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let h=f.pathname||`/`,g=h;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);g=`/`+h.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):S(e,{pathname:g});m(u||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),m(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=ot(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:A([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:A([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&v?o.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},v):v}function et(){let e=ht(),t=Te(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o.createElement(o.Fragment,null,o.createElement(`p`,null,`💿 Hey developer 👋`),o.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,o.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),o.createElement(o.Fragment,null,o.createElement(`h2`,null,`Unexpected Application Error!`),o.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?o.createElement(`pre`,{style:i},n):null,s)}var tt=o.createElement(et,null),nt=class extends o.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Ue(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o.createElement(I.Provider,{value:this.props.routeContext},o.createElement(Re.Provider,{value:e,children:this.props.component}));return this.context?o.createElement(it,{error:e},t):t}};nt.contextType=Ne;var rt=new WeakMap;function it({children:e,error:t}){let{basename:n}=o.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=He(t.digest);if(e){let r=rt.get(t);if(r)throw r;let i=Oe(e.location,n),a=i.absoluteURL||i.to;if(Me(a))throw Error(`Invalid redirect location`);if(De&&!rt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw rt.set(t,n),n}return o.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function at({routeContext:e,match:t,children:n}){let r=o.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o.createElement(I.Provider,{value:e},n)}function ot(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);p(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:a}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Ee(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;r&&(d=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||tt,s&&(c<0&&l===0?(vt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(at,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?o.createElement(nt,{location:r.location,revalidation:r.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function st(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ct(e){let t=o.useContext(M);return p(t,st(e)),t}function lt(e){let t=o.useContext(N);return p(t,st(e)),t}function ut(e){let t=o.useContext(I);return p(t,st(e)),t}function dt(e){let t=ut(e),n=t.matches[t.matches.length-1];return p(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ft(){return dt(`useRouteId`)}function pt(){let e=lt(`useNavigation`);return o.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function mt(){let{matches:e,loaderData:t}=lt(`useMatches`);return o.useMemo(()=>e.map(e=>w(e,t)),[e,t])}function ht(){let e=o.useContext(Re),t=lt(`useRouteError`),n=dt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function gt(){let{router:e}=ct(`useNavigate`),t=dt(`useNavigate`),n=o.useRef(!1);return qe(()=>{n.current=!0}),o.useCallback(async(r,i={})=>{m(n.current,Ke),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var _t={};function vt(e,t,n){!t&&!_t[e]&&(_t[e]=!0,m(!1,n))}o.memo(yt);function yt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return $e(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function bt({to:e,replace:t,state:n,relative:r}){p(L(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=o.useContext(P);m(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=o.useContext(I),{pathname:s}=R(),c=z(),l=k(e,ye(a),s,r===`path`),u=JSON.stringify(l);return o.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function xt(e){return Xe(e.context)}function St(e){p(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Ct({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:s}){p(!L(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=o.useMemo(()=>({basename:c,navigator:i,static:a,useTransitions:s,future:{}}),[c,i,a,s]);typeof n==`string`&&(n=y(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:h=null,key:g=`default`,mask:_}=n,v=o.useMemo(()=>{let e=O(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:h,key:g,mask:_},navigationType:r}},[c,u,d,f,h,g,r,_]);return m(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:o.createElement(P.Provider,{value:l},o.createElement(F.Provider,{children:t,value:v}))}function wt({children:e,location:t}){return Qe(Tt(e),t)}o.Component;function Tt(e,t=[]){let n=[];return o.Children.forEach(e,(e,r)=>{if(!o.isValidElement(e))return;let i=[...t,r];if(e.type===o.Fragment){n.push.apply(n,Tt(e.props.children,i));return}p(e.type===St,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),p(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Tt(e.props.children,i)),n.push(a)}),n}var V=`get`,H=`application/x-www-form-urlencoded`;function U(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return U(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return U(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return U(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}function jt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Mt(e,t){let n=jt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var W=null;function Nt(){if(W===null)try{new FormData(document.createElement(`form`),0),W=!1}catch{W=!0}return W}var Pt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ft(e){return e!=null&&!Pt.has(e)?(m(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${H}"`),null):e}function It(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?O(o,t):null,n=e.getAttribute(`method`)||V,i=Ft(e.getAttribute(`enctype`))||H,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?O(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||V,i=Ft(e.getAttribute(`formenctype`))||Ft(o.getAttribute(`enctype`))||H,a=new FormData(o,e),!Nt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(U(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=V,r=null,i=H,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Lt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Rt=/[&><\u2028\u2029]/g;function zt(e){return e.replace(Rt,e=>Lt[e])}function Bt(e,t){if(e===!1||e==null)throw Error(t)}function Vt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&O(i.pathname,t)===`/`?i.pathname=`${j(t)}/_root.${r}`:i.pathname=`${j(i.pathname)}.${r}`,i}async function Ht(e,t){if(e.id in t)return t[e.id];try{let n=await a(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ut(e){return e!=null&&typeof e.page==`string`}function Wt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Gt(e,t,n){return Xt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ht(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Wt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Kt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function qt(e,t,{includeHydrateFallback:n}={}){return Jt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Jt(e){return[...new Set(e)]}function Yt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Xt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ut(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Yt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Zt(){let e=o.useContext(M);return Bt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Qt(){let e=o.useContext(N);return Bt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var G=o.createContext(void 0);G.displayName=`FrameworkContext`;function K(){let e=o.useContext(G);return Bt(e,`You must render this element inside a <HydratedRouter> element`),e}function $t(e,t){let n=o.useContext(G),[r,i]=o.useState(!1),[a,s]=o.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=o.useRef(null);o.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),o.useEffect(()=>{if(r){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),s(!1)};return n?e===`intent`?[a,p,{onFocus:q(c,m),onBlur:q(l,h),onMouseEnter:q(u,m),onMouseLeave:q(d,h),onTouchStart:q(f,m)}]:[a,p,{}]:[!1,p,{}]}function q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function en({page:e,...t}){let n=Pe(),{nonce:r}=K(),{router:i}=Zt(),a=o.useMemo(()=>S(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?o.createElement(nn,{page:e,matches:a,...t}):o.createElement(rn,{page:e,matches:a,...t})):null}function tn(e){let{manifest:t,routeModules:n}=K(),[r,i]=o.useState([]);return o.useEffect(()=>{let r=!1;return Gt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function nn({page:e,matches:t,...n}){let r=R(),{future:i}=K(),{basename:a}=Zt(),s=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Vt(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return o.createElement(o.Fragment,null,s.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function rn({page:e,matches:t,...n}){let r=R(),{future:i,manifest:a,routeModules:s}=K(),{basename:c}=Zt(),{loaderData:l,matches:u}=Qt(),d=o.useMemo(()=>Kt(e,t,u,a,r,`data`),[e,t,u,a,r]),f=o.useMemo(()=>Kt(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let u=Vt(e,c,i.v8_trailingSlashAwareDataRequests,`data`);return o&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.v8_trailingSlashAwareDataRequests,l,r,a,d,t,e,s]),m=o.useMemo(()=>qt(f,a),[f,a]),h=tn(f);return o.createElement(o.Fragment,null,p.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>o.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>o.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}o.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.18.1`)}catch{}function sn({basename:e,children:t,useTransitions:n,window:r}){let i=o.useRef();i.current??=f({window:r,v5Compat:!0});let a=i.current,[s,c]=o.useState({action:a.action,location:a.location}),l=o.useCallback(e=>{n===!1?c(e):o.startTransition(()=>c(e))},[n]);return o.useLayoutEffect(()=>a.listen(l),[a,l]),o.createElement(Ct,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a,useTransitions:n})}function cn({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=o.useState({action:n.action,location:n.location}),s=o.useCallback(e=>{r===!1?a(e):o.startTransition(()=>a(e))},[r]);return o.useLayoutEffect(()=>n.listen(s),[n,s]),o.createElement(Ct,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var J=o.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:c,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=o.useContext(P),b=typeof d==`string`&&s.test(d),x=Oe(d,_);d=x.to;let S=We(d,{relative:r}),C=R(),w=null;if(c){let e=k(c,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:A([_,e.pathname])),w=v.createHref(e)}let[T,E,ee]=$t(n,h),te=mn(d,{replace:a,mask:c,state:l,target:u,preventScrollReset:f,relative:r,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let re=!(x.isExternal||i),ie=o.createElement(`a`,{...h,...ee,href:(re?w:void 0)||x.absoluteURL||S,onClick:re?ne:e,ref:an(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?o.createElement(o.Fragment,null,ie,o.createElement(en,{page:S})):ie});J.displayName=`Link`;var ln=o.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:s,children:c,...l},u){let d=B(a,{relative:l.relative}),f=R(),p=o.useContext(N),{navigator:m,basename:h}=o.useContext(P),g=p!=null&&wn(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=O(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return o.createElement(J,{...l,"aria-current":w,className:T,ref:u,style:E,to:a,viewTransition:s},typeof c==`function`?c(C):c)});ln.displayName=`NavLink`;var un=o.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:c=V,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=o.useContext(P),v=vn(),y=yn(l,{relative:d}),b=c.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&s.test(l);return o.createElement(`form`,{ref:g,method:b,action:y,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||c,l=()=>v(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?o.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});un.displayName=`Form`;function dn({getKey:e,storageKey:t,...n}){let r=o.useContext(G),{basename:i}=o.useContext(P),a=R(),s=mt();Sn({getKey:e,storageKey:t});let c=o.useMemo(()=>{if(!r||!e)return null;let t=xn(a,s,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),o.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${zt(JSON.stringify(t||bn))}, ${zt(JSON.stringify(c))})`}})}dn.displayName=`ScrollRestoration`;function fn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Y(e){let t=o.useContext(M);return p(t,fn(e)),t}function pn(e){let t=o.useContext(N);return p(t,fn(e)),t}function mn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=z(),f=R(),p=B(e,{relative:s});return o.useCallback(m=>{if(At(m,t)){m.preventDefault();let t=n===void 0?v(f)===v(p):n,h=()=>d(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?o.startTransition(()=>h()):h()}},[f,d,p,n,r,i,t,e,a,s,c,l,u])}function hn(e){m(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=o.useRef(jt(e)),n=o.useRef(!1),r=R(),i=o.useMemo(()=>Mt(r.search,n.current?null:t.current),[r.search]),a=z();return[i,o.useCallback((e,t)=>{let r=jt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var gn=0,_n=()=>`__${String(++gn)}__`;function vn(){let{router:e}=Y(`useSubmit`),{basename:t}=o.useContext(P),n=ft(),r=e.fetch,i=e.navigate;return o.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=It(e,t);if(a.navigate===!1){let e=a.fetcherKey||_n();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function yn(e,{relative:t}={}){let{basename:n}=o.useContext(P),r=o.useContext(I);p(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...B(e||`.`,{relative:t})},s=R();if(e==null){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:A([n,a.pathname])),v(a)}var bn=`react-router-scroll-positions`,X={};function xn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:O(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Sn({getKey:e,storageKey:t}={}){let{router:n}=Y(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=pn(`useScrollRestoration`),{basename:a}=o.useContext(P),s=R(),c=mt(),l=pt();o.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Cn(o.useCallback(()=>{if(l.state===`idle`){let t=xn(s,c,a,e);X[t]=window.scrollY}try{sessionStorage.setItem(t||bn,JSON.stringify(X))}catch(e){m(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,s,c,t])),typeof document<`u`&&(o.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||bn);e&&(X=JSON.parse(e))}catch{}},[t]),o.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(X,()=>window.scrollY,e?(t,n)=>xn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),o.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{m(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[s,r,i]))}function Cn(e,t){let{capture:n}=t||{};o.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function wn(e,{relative:t}={}){let n=o.useContext(Fe);p(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Y(`useViewTransitionState`),i=B(e,{relative:t});if(!n.isTransitioning)return!1;let a=O(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=O(n.nextLocation.pathname,r)||n.nextLocation.pathname;return D(i.pathname,s)!=null||D(i.pathname,a)!=null}var Z=n(),Tn=5e3,En=200,Q=[],Dn=1,On=new Set,kn=new Set;function An(e){Q=e;for(let e of On)e()}function jn(e){return On.add(e),()=>On.delete(e)}var Mn=new Set;function Nn(e){return Mn.add(e),()=>Mn.delete(e)}function Pn(e,t){let n=setTimeout(()=>{kn.delete(n),e()},t);kn.add(n)}function Fn(e,t={}){let n={id:Dn++,message:e,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},r=t.durationMs??Tn;if(An([...Q,n]),n.tone===`danger`&&!t.reported)for(let t of Mn)try{t(e)}catch{}Pn(()=>{An(Q.map(e=>e.id===n.id?{...e,exiting:!0}:e)),Pn(()=>An(Q.filter(e=>e.id!==n.id)),En)},r)}function In(){let e=(0,o.useSyncExternalStore)(jn,()=>Q);return e.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed top-[calc(61px+env(safe-area-inset-top))] right-[calc(16px+env(safe-area-inset-right))] z-[60] flex flex-col items-end gap-2 md:top-[calc(16px+env(safe-area-inset-top))]`,children:e.map(e=>(0,Z.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:i(`pointer-events-auto max-w-[min(360px,calc(100vw-32px))] rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-200`,`motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:slide-out-to-right-4`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:[e.message,e.action?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`a`,{"data-slot":`toast-action`,href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,className:`font-semibold underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:e.action.label})]}):null]},e.id))})}var Ln=/^\/p\/([^/]+)(?=\/|$)/;function Rn(e){let t=Ln.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function zn(e){let t=Ln.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function Bn(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function Vn(e,t){return e===null?t:typeof t==`string`?Bn(e,t):t.pathname===void 0?t:{...t,pathname:Bn(e,t.pathname)}}function Hn(){let{projectId:e}=r(),{pathname:t}=R();return e??Rn(t)}function $(){let e=Hn();return(0,o.useCallback)(t=>Vn(e,t),[e])}function Un(e){let{pathname:t}=R();return(0,o.useMemo)(()=>D(e,zn(t)),[e,t])}function Wn({to:e,...t}){let n=$();return(0,Z.jsx)(J,{...t,to:n(e)})}function Gn({to:e,...t}){let n=$();return(0,Z.jsx)(ln,{...t,to:n(e)})}function Kn({to:e,...t}){let n=$();return(0,Z.jsx)(bt,{...t,to:n(e)})}function qn(){let e=z(),t=$();return(0,o.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{Ge as C,z as S,hn as T,xt as _,Vn as a,D as b,qn as c,Nn as d,Fn as f,bt as g,ln as h,Rn as i,Un as l,J as m,Gn as n,zn as o,sn as p,Kn as r,Hn as s,Wn as t,In as u,St as v,Ze as w,R as x,wt as y};
|
|
3
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let d=R(),f;if(t){let e=typeof t==`string`?y(t):t;p(l===`/`||e.pathname?.startsWith(l),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${e.pathname}" was given in the \`location\` prop.`),f=e}else f=d;let h=f.pathname||`/`,g=h;if(l!==`/`){let e=l.replace(/^\//,``).split(`/`);g=`/`+h.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let _=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):S(e,{pathname:g});m(u||_!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),m(_==null||_[_.length-1].route.element!==void 0||_[_.length-1].route.Component!==void 0||_[_.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=ot(_&&_.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:A([l,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?l:A([l,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&v?o.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...f},navigationType:`POP`}},v):v}function et(){let e=ht(),t=Te(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o.createElement(o.Fragment,null,o.createElement(`p`,null,`💿 Hey developer 👋`),o.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,o.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),o.createElement(o.Fragment,null,o.createElement(`h2`,null,`Unexpected Application Error!`),o.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?o.createElement(`pre`,{style:i},n):null,s)}var tt=o.createElement(et,null),nt=class extends o.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Ue(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o.createElement(I.Provider,{value:this.props.routeContext},o.createElement(Re.Provider,{value:e,children:this.props.component}));return this.context?o.createElement(it,{error:e},t):t}};nt.contextType=Ne;var rt=new WeakMap;function it({children:e,error:t}){let{basename:n}=o.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=He(t.digest);if(e){let r=rt.get(t);if(r)throw r;let i=Oe(e.location,n),a=i.absoluteURL||i.to;if(Me(a))throw Error(`Invalid redirect location`);if(De&&!rt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw rt.set(t,n),n}return o.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function at({routeContext:e,match:t,children:n}){let r=o.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o.createElement(I.Provider,{value:e},n)}function ot(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);p(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,c=-1;if(n&&r){s=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:a}=r,o=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||o){n.isStatic&&(s=!0),i=c>=0?i.slice(0,c+1):[i[0]];break}}}}let l=n?.onError,u=r&&l?(e,t)=>{l(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Ee(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,l)=>{let d,f=!1,p=null,m=null;r&&(d=a&&n.route.id?a[n.route.id]:void 0,p=n.route.errorElement||tt,s&&(c<0&&l===0?(vt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):c===l&&(f=!0,m=n.route.hydrateFallbackElement||null)));let h=t.concat(i.slice(0,l+1)),g=()=>{let t;return t=d?p:f?m:n.route.Component?o.createElement(n.route.Component,null):n.route.element?n.route.element:e,o.createElement(at,{match:n,routeContext:{outlet:e,matches:h,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||l===0)?o.createElement(nt,{location:r.location,revalidation:r.revalidation,component:p,error:d,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):g()},null)}function st(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ct(e){let t=o.useContext(M);return p(t,st(e)),t}function lt(e){let t=o.useContext(N);return p(t,st(e)),t}function ut(e){let t=o.useContext(I);return p(t,st(e)),t}function dt(e){let t=ut(e),n=t.matches[t.matches.length-1];return p(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ft(){return dt(`useRouteId`)}function pt(){let e=lt(`useNavigation`);return o.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function mt(){let{matches:e,loaderData:t}=lt(`useMatches`);return o.useMemo(()=>e.map(e=>w(e,t)),[e,t])}function ht(){let e=o.useContext(Re),t=lt(`useRouteError`),n=dt(`useRouteError`);return e===void 0?t.errors?.[n]:e}function gt(){let{router:e}=ct(`useNavigate`),t=dt(`useNavigate`),n=o.useRef(!1);return qe(()=>{n.current=!0}),o.useCallback(async(r,i={})=>{m(n.current,Ke),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var _t={};function vt(e,t,n){!t&&!_t[e]&&(_t[e]=!0,m(!1,n))}o.memo(yt);function yt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return $e(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function bt({to:e,replace:t,state:n,relative:r}){p(L(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=o.useContext(P);m(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=o.useContext(I),{pathname:s}=R(),c=z(),l=k(e,ye(a),s,r===`path`),u=JSON.stringify(l);return o.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function xt(e){return Xe(e.context)}function St(e){p(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Ct({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:s}){p(!L(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=o.useMemo(()=>({basename:c,navigator:i,static:a,useTransitions:s,future:{}}),[c,i,a,s]);typeof n==`string`&&(n=y(n));let{pathname:u=`/`,search:d=``,hash:f=``,state:h=null,key:g=`default`,mask:_}=n,v=o.useMemo(()=>{let e=O(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:h,key:g,mask:_},navigationType:r}},[c,u,d,f,h,g,r,_]);return m(v!=null,`<Router basename="${c}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:o.createElement(P.Provider,{value:l},o.createElement(F.Provider,{children:t,value:v}))}function wt({children:e,location:t}){return Qe(Tt(e),t)}o.Component;function Tt(e,t=[]){let n=[];return o.Children.forEach(e,(e,r)=>{if(!o.isValidElement(e))return;let i=[...t,r];if(e.type===o.Fragment){n.push.apply(n,Tt(e.props.children,i));return}p(e.type===St,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),p(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Tt(e.props.children,i)),n.push(a)}),n}var V=`get`,H=`application/x-www-form-urlencoded`;function U(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return U(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return U(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return U(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}function jt(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Mt(e,t){let n=jt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var W=null;function Nt(){if(W===null)try{new FormData(document.createElement(`form`),0),W=!1}catch{W=!0}return W}var Pt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ft(e){return e!=null&&!Pt.has(e)?(m(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${H}"`),null):e}function It(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?O(o,t):null,n=e.getAttribute(`method`)||V,i=Ft(e.getAttribute(`enctype`))||H,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?O(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||V,i=Ft(e.getAttribute(`formenctype`))||Ft(o.getAttribute(`enctype`))||H,a=new FormData(o,e),!Nt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(U(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=V,r=null,i=H,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Lt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Rt=/[&><\u2028\u2029]/g;function zt(e){return e.replace(Rt,e=>Lt[e])}function Bt(e,t){if(e===!1||e==null)throw Error(t)}function Vt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&O(i.pathname,t)===`/`?i.pathname=`${j(t)}/_root.${r}`:i.pathname=`${j(i.pathname)}.${r}`,i}async function Ht(e,t){if(e.id in t)return t[e.id];try{let n=await a(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ut(e){return e!=null&&typeof e.page==`string`}function Wt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Gt(e,t,n){return Xt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ht(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Wt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Kt(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function qt(e,t,{includeHydrateFallback:n}={}){return Jt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Jt(e){return[...new Set(e)]}function Yt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Xt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ut(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Yt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Zt(){let e=o.useContext(M);return Bt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Qt(){let e=o.useContext(N);return Bt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var G=o.createContext(void 0);G.displayName=`FrameworkContext`;function K(){let e=o.useContext(G);return Bt(e,`You must render this element inside a <HydratedRouter> element`),e}function $t(e,t){let n=o.useContext(G),[r,i]=o.useState(!1),[a,s]=o.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=o.useRef(null);o.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),o.useEffect(()=>{if(r){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),s(!1)};return n?e===`intent`?[a,p,{onFocus:q(c,m),onBlur:q(l,h),onMouseEnter:q(u,m),onMouseLeave:q(d,h),onTouchStart:q(f,m)}]:[a,p,{}]:[!1,p,{}]}function q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function en({page:e,...t}){let n=Pe(),{nonce:r}=K(),{router:i}=Zt(),a=o.useMemo(()=>S(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?o.createElement(nn,{page:e,matches:a,...t}):o.createElement(rn,{page:e,matches:a,...t})):null}function tn(e){let{manifest:t,routeModules:n}=K(),[r,i]=o.useState([]);return o.useEffect(()=>{let r=!1;return Gt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function nn({page:e,matches:t,...n}){let r=R(),{future:i}=K(),{basename:a}=Zt(),s=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Vt(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return o.createElement(o.Fragment,null,s.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function rn({page:e,matches:t,...n}){let r=R(),{future:i,manifest:a,routeModules:s}=K(),{basename:c}=Zt(),{loaderData:l,matches:u}=Qt(),d=o.useMemo(()=>Kt(e,t,u,a,r,`data`),[e,t,u,a,r]),f=o.useMemo(()=>Kt(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let u=Vt(e,c,i.v8_trailingSlashAwareDataRequests,`data`);return o&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.v8_trailingSlashAwareDataRequests,l,r,a,d,t,e,s]),m=o.useMemo(()=>qt(f,a),[f,a]),h=tn(f);return o.createElement(o.Fragment,null,p.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>o.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>o.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}o.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.18.1`)}catch{}function sn({basename:e,children:t,useTransitions:n,window:r}){let i=o.useRef();i.current??=f({window:r,v5Compat:!0});let a=i.current,[s,c]=o.useState({action:a.action,location:a.location}),l=o.useCallback(e=>{n===!1?c(e):o.startTransition(()=>c(e))},[n]);return o.useLayoutEffect(()=>a.listen(l),[a,l]),o.createElement(Ct,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a,useTransitions:n})}function cn({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=o.useState({action:n.action,location:n.location}),s=o.useCallback(e=>{r===!1?a(e):o.startTransition(()=>a(e))},[r]);return o.useLayoutEffect(()=>n.listen(s),[n,s]),o.createElement(Ct,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var J=o.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:c,state:l,target:u,to:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g){let{basename:_,navigator:v,useTransitions:y}=o.useContext(P),b=typeof d==`string`&&s.test(d),x=Oe(d,_);d=x.to;let S=We(d,{relative:r}),C=R(),w=null;if(c){let e=k(c,[],C.mask?C.mask.pathname:`/`,!0);_!==`/`&&(e.pathname=e.pathname===`/`?_:A([_,e.pathname])),w=v.createHref(e)}let[T,E,ee]=$t(n,h),te=mn(d,{replace:a,mask:c,state:l,target:u,preventScrollReset:f,relative:r,viewTransition:p,defaultShouldRevalidate:m,useTransitions:y});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let re=!(x.isExternal||i),ie=o.createElement(`a`,{...h,...ee,href:(re?w:void 0)||x.absoluteURL||S,onClick:re?ne:e,ref:an(g,E),target:u,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?o.createElement(o.Fragment,null,ie,o.createElement(en,{page:S})):ie});J.displayName=`Link`;var ln=o.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:s,children:c,...l},u){let d=B(a,{relative:l.relative}),f=R(),p=o.useContext(N),{navigator:m,basename:h}=o.useContext(P),g=p!=null&&wn(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=O(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return o.createElement(J,{...l,"aria-current":w,className:T,ref:u,style:E,to:a,viewTransition:s},typeof c==`function`?c(C):c)});ln.displayName=`NavLink`;var un=o.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:c=V,action:l,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m,...h},g)=>{let{useTransitions:_}=o.useContext(P),v=vn(),y=yn(l,{relative:d}),b=c.toLowerCase()===`get`?`get`:`post`,x=typeof l==`string`&&s.test(l);return o.createElement(`form`,{ref:g,method:b,action:y,onSubmit:r?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||c,l=()=>v(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:d,preventScrollReset:f,viewTransition:p,defaultShouldRevalidate:m});_&&n!==!1?o.startTransition(()=>l()):l()},...h,"data-discover":!x&&e===`render`?`true`:void 0})});un.displayName=`Form`;function dn({getKey:e,storageKey:t,...n}){let r=o.useContext(G),{basename:i}=o.useContext(P),a=R(),s=mt();Sn({getKey:e,storageKey:t});let c=o.useMemo(()=>{if(!r||!e)return null;let t=xn(a,s,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),o.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${zt(JSON.stringify(t||bn))}, ${zt(JSON.stringify(c))})`}})}dn.displayName=`ScrollRestoration`;function fn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Y(e){let t=o.useContext(M);return p(t,fn(e)),t}function pn(e){let t=o.useContext(N);return p(t,fn(e)),t}function mn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l,useTransitions:u}={}){let d=z(),f=R(),p=B(e,{relative:s});return o.useCallback(m=>{if(At(m,t)){m.preventDefault();let t=n===void 0?v(f)===v(p):n,h=()=>d(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:s,viewTransition:c,defaultShouldRevalidate:l});u?o.startTransition(()=>h()):h()}},[f,d,p,n,r,i,t,e,a,s,c,l,u])}function hn(e){m(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=o.useRef(jt(e)),n=o.useRef(!1),r=R(),i=o.useMemo(()=>Mt(r.search,n.current?null:t.current),[r.search]),a=z();return[i,o.useCallback((e,t)=>{let r=jt(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var gn=0,_n=()=>`__${String(++gn)}__`;function vn(){let{router:e}=Y(`useSubmit`),{basename:t}=o.useContext(P),n=ft(),r=e.fetch,i=e.navigate;return o.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=It(e,t);if(a.navigate===!1){let e=a.fetcherKey||_n();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function yn(e,{relative:t}={}){let{basename:n}=o.useContext(P),r=o.useContext(I);p(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...B(e||`.`,{relative:t})},s=R();if(e==null){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:A([n,a.pathname])),v(a)}var bn=`react-router-scroll-positions`,X={};function xn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:O(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Sn({getKey:e,storageKey:t}={}){let{router:n}=Y(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=pn(`useScrollRestoration`),{basename:a}=o.useContext(P),s=R(),c=mt(),l=pt();o.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Cn(o.useCallback(()=>{if(l.state===`idle`){let t=xn(s,c,a,e);X[t]=window.scrollY}try{sessionStorage.setItem(t||bn,JSON.stringify(X))}catch(e){m(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,s,c,t])),typeof document<`u`&&(o.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||bn);e&&(X=JSON.parse(e))}catch{}},[t]),o.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(X,()=>window.scrollY,e?(t,n)=>xn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),o.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{m(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[s,r,i]))}function Cn(e,t){let{capture:n}=t||{};o.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function wn(e,{relative:t}={}){let n=o.useContext(Fe);p(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Y(`useViewTransitionState`),i=B(e,{relative:t});if(!n.isTransitioning)return!1;let a=O(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=O(n.nextLocation.pathname,r)||n.nextLocation.pathname;return D(i.pathname,s)!=null||D(i.pathname,a)!=null}var Z=n(),Tn=5e3,En=200,Q=[],Dn=1,On=new Set,kn=new Set;function An(e){Q=e;for(let e of On)e()}function jn(e){return On.add(e),()=>On.delete(e)}var Mn=new Set;function Nn(e){return Mn.add(e),()=>Mn.delete(e)}function Pn(e,t){let n=setTimeout(()=>{kn.delete(n),e()},t);kn.add(n)}function Fn(e,t={}){let n={id:Dn++,message:e,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},r=t.durationMs??Tn;if(An([...Q,n]),n.tone===`danger`&&!t.reported&&!t.expected)for(let t of Mn)try{t(e)}catch{}Pn(()=>{An(Q.map(e=>e.id===n.id?{...e,exiting:!0}:e)),Pn(()=>An(Q.filter(e=>e.id!==n.id)),En)},r)}function In(){let e=(0,o.useSyncExternalStore)(jn,()=>Q);return e.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`toaster`,className:`pointer-events-none fixed top-[calc(61px+env(safe-area-inset-top))] right-[calc(16px+env(safe-area-inset-right))] z-[60] flex flex-col items-end gap-2 md:top-[calc(16px+env(safe-area-inset-top))]`,children:e.map(e=>(0,Z.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:i(`pointer-events-auto max-w-[min(360px,calc(100vw-32px))] rounded-md px-3.5 py-2.5 text-[13px] font-medium shadow-modal`,`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-200`,`motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:slide-out-to-right-4`,e.tone===`danger`?`bg-danger text-danger-foreground`:`bg-contrast text-contrast-foreground`),children:[e.message,e.action?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`a`,{"data-slot":`toast-action`,href:e.action.href,target:`_blank`,rel:`noopener noreferrer`,className:`font-semibold underline underline-offset-2 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:e.action.label})]}):null]},e.id))})}var Ln=/^\/p\/([^/]+)(?=\/|$)/;function Rn(e){let t=Ln.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function zn(e){let t=Ln.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function Bn(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function Vn(e,t){return e===null?t:typeof t==`string`?Bn(e,t):t.pathname===void 0?t:{...t,pathname:Bn(e,t.pathname)}}function Hn(){let{projectId:e}=r(),{pathname:t}=R();return e??Rn(t)}function $(){let e=Hn();return(0,o.useCallback)(t=>Vn(e,t),[e])}function Un(e){let{pathname:t}=R();return(0,o.useMemo)(()=>D(e,zn(t)),[e,t])}function Wn({to:e,...t}){let n=$();return(0,Z.jsx)(J,{...t,to:n(e)})}function Gn({to:e,...t}){let n=$();return(0,Z.jsx)(ln,{...t,to:n(e)})}function Kn({to:e,...t}){let n=$();return(0,Z.jsx)(bt,{...t,to:n(e)})}function qn(){let e=z(),t=$();return(0,o.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{Ge as C,z as S,hn as T,xt as _,Vn as a,D as b,qn as c,Nn as d,Fn as f,bt as g,ln as h,Rn as i,Un as l,J as m,Gn as n,zn as o,sn as p,Kn as r,Hn as s,Wn as t,In as u,St as v,Ze as w,R as x,wt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{B as r,Ft as i,Gt as a,I as o,It as s,L as c,R as l,Rt as u,Tt as d,U as f,V as p,Wt as m,bt as h,xt as g,yt as _,z as v}from"./button-Clwd6u4_.js";var ee=/^[\w!#$%&'*.^`|~+-]+$/,te=(e,t,n={})=>{if(!ee.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},y=(e,t,n)=>(t=encodeURIComponent(t),te(e,t,n)),ne=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),re=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},ie=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},ae=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},oe=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function se(e,t){if(!b(e)&&!b(t))return t;let n={...e};for(let e in t){let r=t[e];b(n[e])&&b(r)?n[e]=se(n[e],r):n[e]=r}return n}var ce=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return ce(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),le=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(y(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=oe(a),a=re(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},ue=(e,t)=>ce(function n(r){let i=t?.buildSearchParams??ie,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=ne(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=re(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=oe(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ae(r.args[0]&&r.args[0].param?re(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new le(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=se(t,e);return l.fetch(r.args[0],a)}return l},[]);function de(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return ue(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var x=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fe=new class extends x{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},pe={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},S=new class{#e=pe;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function me(e){setTimeout(e,0)}var he=typeof window>`u`||`Deno`in globalThis;function C(){}function ge(e,t){return typeof e==`function`?e(t):e}function _e(e){return typeof e==`number`&&e>=0&&e!==1/0}function ve(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function T(e,t){return typeof e==`function`?e(t):e}function ye(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==xe(o,t.options))return!1}else if(!Se(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function be(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(E(t.options.mutationKey)!==E(a))return!1}else if(!Se(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xe(e,t){return(t?.queryKeyHashFn||E)(e)}function E(e){return JSON.stringify(e,(e,t)=>Ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Se(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Se(e[n],t[n])):!1}var Ce=Object.prototype.hasOwnProperty;function we(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Te(e)&&Te(t);if(!r&&!(Ee(e)&&Ee(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ce.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=we(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function D(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ee(e){if(!De(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!De(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function De(e){return Object.prototype.toString.call(e)===`[object Object]`}function Oe(e){return new Promise(t=>{S.setTimeout(t,e)})}function ke(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:we(e,t)}function Ae(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function je(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Me=Symbol();function Ne(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Me?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pe(e,t){return typeof e==`function`?e(...t):!!e}function Fe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var O=(()=>{let e=()=>he;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ie(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Le=me;function Re(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Le,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var k=Re(),ze=new class extends x{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Be(e){return Math.min(1e3*2**e,3e4)}function Ve(e){return(e??`online`)!==`online`||ze.isOnline()}var He=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ue(e){let t=!1,n=0,r,i=Ie(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new He(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>fe.isFocused()&&(e.networkMode===`always`||ze.isOnline())&&e.canRun(),u=()=>Ve(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(O.isServer()?0:3),o=e.retryDelay??Be,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Oe(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var We=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_e(this.gcTime)&&(this.#e=S.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(O.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(S.clearTimeout(this.#e),this.#e=void 0)}};function Ge(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Fe(e,()=>t.signal,()=>n=!0)},u=Ne(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?je:Ae;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?qe:Ke,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ke(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Ke(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function qe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Je(e,t){return t?Ke(e,t)!=null:!1}function Ye(e,t){return!t||!e.getPreviousPageParam?!1:qe(e,t)!=null}var Xe=class extends We{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=$e(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=$e(this.options);e.data!==void 0&&(this.setState(Qe(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ke(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(C).catch(C):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>T(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Me||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ve(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ne(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ge(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Ue({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof He&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof He){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ze(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Qe(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),k.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ze(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Qe(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function $e(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var et=class extends x{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ie(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),nt(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof T(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!D(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&it(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||T(this.options.enabled,this.#t)!==T(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||T(this.options.enabled,this.#t)!==T(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ot(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(C)),t}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(O.isServer()||this.#r.isStale||!_e(e))return;let t=ve(this.#r.dataUpdatedAt,e)+1;this.#d=S.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(O.isServer()||T(this.options.enabled,this.#t)===!1||!_e(this.#p)||this.#p===0)&&(this.#f=S.setInterval(()=>{(this.options.refetchIntervalInBackground||fe.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(S.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(S.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&nt(e,t),o=i&&it(e,n,t,r);(a||o)&&(l={...l,...Ze(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ke(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ke(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,ee=_&&g,te=d!==void 0,y={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:ee,isLoading:ee,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!te,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&te,isStale:at(e,t),refetch:this.refetch,promise:this.#o,isEnabled:T(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=y.data!==void 0,r=y.status===`error`&&!t,i=e=>{r?e.reject(y.error):t&&e.resolve(y.data)},a=()=>{let e=this.#o=y.promise=Ie();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||y.data!==o.value)&&a();break;case`rejected`:(!r||y.error!==o.reason)&&a();break}}return y}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!D(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){k.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function tt(e,t){return T(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&T(t.retryOnMount,e)===!1)}function nt(e,t){return tt(e,t)||e.state.data!==void 0&&rt(e,t,t.refetchOnMount)}function rt(e,t,n){if(T(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&at(e,t)}return!1}function it(e,t,n,r){return(e!==t||T(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&at(e,n)}function at(e,t){return T(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}function ot(e,t){return!D(e.getCurrentResult(),t)}var st=class extends et{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Je(t,n.data),hasPreviousPage:Ye(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},ct=class extends We{#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||lt(),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.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ue({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{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),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function lt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ut=class extends x{#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),D(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&E(t.mutationKey)!==E(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}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??lt();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){k.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function dt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ft(e,t,n){let r=e.slice(0);return r[t]=n,r}var pt=class extends x{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!D(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(dt(e,n).forEach(e=>{e.destroy()}),dt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=we(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new et(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ft(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},A=e(t(),1),mt=n(),ht=A.createContext(void 0),j=e=>{let t=A.useContext(ht);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},gt=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,mt.jsx)(ht.Provider,{value:e,children:t})),_t=A.createContext(!1),vt=()=>A.useContext(_t);_t.Provider;function yt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bt=A.createContext(yt()),xt=()=>A.useContext(bt),St=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Pe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ct=e=>{A.useEffect(()=>{e.clearReset()},[e])},wt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Pe(n,[e.error,r])),Tt=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Et=(e,t)=>e.isLoading&&e.isFetching&&!t,Dt=(e,t)=>e?.suspense&&t.isPending,Ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function kt({queries:e,...t},n){let r=j(n),i=vt(),a=xt(),o=A.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Tt(e);let t=r.getQueryCache().get(e.queryHash);St(e,a,t)}),Ct(a);let[s]=A.useState(()=>new pt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;A.useSyncExternalStore(A.useCallback(e=>d?s.subscribe(k.batchCalls(e)):C,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),A.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Dt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Dt(n,e)?Ot(n,new et(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&wt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function At(e,t,n){let r=vt(),i=xt(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Tt(o),St(o,i,s),Ct(i);let l=!a.getQueryCache().get(o.queryHash),[u]=A.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=f?u.subscribe(k.batchCalls(e)):C;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(o)},[o,u]),Dt(o,d))throw Ot(o,u,i);if(wt({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!O.isServer()&&Et(d,r)&&(l?Ot(o,u,i):s?.promise)?.catch(C).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return At(e,et,t)}function N(e,t){let n=j(t),[r]=A.useState(()=>new ut(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((e,t)=>{r.mutate(e,t).catch(C)},[r]);if(i.error&&Pe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function jt(e,t){return At(e,st,t)}var Mt={projectId:null,apiBase:o},Nt=(0,A.createContext)(Mt);function Pt(){return(0,A.useContext)(Nt)}function Ft({projectId:e,children:t}){v()!==e&&f(e),(0,A.useLayoutEffect)(()=>{f(e)},[e]),(0,A.useLayoutEffect)(()=>()=>f(null),[]);let n=(0,A.useMemo)(()=>e===null?Mt:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`},[e]);return(0,mt.jsx)(Nt.Provider,{value:n,children:t})}var P=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],It=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Lt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Rt(e,t){if(!Lt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!P.includes(n)||typeof r!=`string`||!It.has(r)||t&&typeof i!=`boolean`||!t&&i!==void 0&&typeof i!=`boolean`||a!==void 0&&typeof a!=`string`||o!==void 0&&(typeof o!=`string`||o.length<1||o.length>128||r!==`disconnected`)?null:{provider:n,status:r,...typeof i==`boolean`?{enabled:i}:{},...a===void 0?{}:{hint:a},...o===void 0?{}:{authFailureId:o}}}function zt(e){return Rt(e,!1)}function Bt(e,t){if(!Lt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Rt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function F(e){let t=Bt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return P.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function I(e){let t=F(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Vt(e,t){let n=F(e);if(n!==null)return{providers:n.map(e=>e.provider===t.provider?{provider:t.provider,status:t.status,enabled:t.enabled??e.enabled,...t.hint===void 0?{}:{hint:t.hint},...t.authFailureId===void 0?{}:{authFailureId:t.authFailureId}}:e)}}function Ht(e,t,n,r){let i=F(e),a=F(t),o=F(n);if(o===null||a===null)return n;if(i===null)return{providers:a};let s=new Map(i.map(e=>[e.provider,e])),c=new Map(a.map(e=>[e.provider,e]));return{providers:o.map(e=>{let t=s.get(e.provider),n=c.get(e.provider);if(t===void 0||n===void 0)return n??e;let i=r!==void 0&&n.authFailureId===r&&e.authFailureId===void 0;return r!==void 0&&n.authFailureId!==void 0&&n.authFailureId!==r&&e.authFailureId===void 0?n:Ut(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Ut(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function Wt(e){let t=F(e);if(t===null)return[];let n=new Set(t.filter(e=>e.enabled&&(e.status===`connected`||e.provider===`junie`&&e.status===`unknown`)).map(e=>e.provider));return P.filter(e=>n.has(e))}function Gt(e,t){return F(e)?.find(e=>e.provider===t)}var Kt=`cezar:sid`,qt;function Jt(e=Date.now()){let t=crypto.getRandomValues(new Uint8Array(16));for(let n=0;n<6;n++)t[n]=Math.floor(e/2**(8*(5-n)))&255;t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Yt(){try{let e=localStorage.getItem(Kt);if(e)return e;let t=Jt();return localStorage.setItem(Kt,t),t}catch{return qt??=Jt()}}var Xt=`x-cezar-sid`;function Zt(){qt=void 0;try{localStorage.removeItem(Kt)}catch{}}function Qt(e){if(typeof e!=`object`||!e)return;let{name:t,message:n}=e;return{name:typeof t==`string`?t:`unknown`,message:typeof n==`string`?n:``}}var $t=/\/(?:providers|agent-profiles)(?:\/|$)/;function en(e,t){if(!$t.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&_.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return _.safeParse(e).success?e:void 0}catch{return}}var L=null;function tn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=en(a,r),s=Qt(i);L={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function nn(e=3e3,t=Date.now()){return L&&t-L.at<=e?L:null}var R=class extends Error{status;manual;command;exists;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`ApiError`,this.status=e,this.manual=n.manual,this.command=n.command,this.exists=n.exists}};function z(e){try{return JSON.parse(e)}catch{return}}function rn(e){return typeof e==`string`?e:void 0}function B(e,t,n){let r=z(n),i=r&&typeof r==`object`?r:{};return new R(e,rn(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:rn(i.manual),command:rn(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var V=de({fetch:(e,t)=>ln(an(String(e)),t)});function an(e){let t=sn(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${l()}${t}`:t}var on=`${o}/p/default`;function sn(e){if(v()!==null||!e.startsWith(on))return e;let t=e.slice(on.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${o}${t}`:e}var H=e=>({init:{signal:e?.signal}});async function U(e,t){let n=await e.text();if(!e.ok)throw B(e.status,e.statusText,n);let r=z(n);if(r===void 0)throw new R(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function cn(e,t,n){let r=e.status,i=await U(e,t),a=n.safeParse(i);if(!a.success)throw new R(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function ln(e,t){try{let n=new Headers(t?.headers);n.set(Xt,Yt());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||tn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(tn(e,t?.method,0,t?.body,n),new R(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function W(e,t){return ln(c(e),t)}async function un(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await W(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw B(r.status,r.statusText,i);return i}var G=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function dn(e){return U(await V.api.v1.health.$get({},H(e)),`/health`)}async function fn(e){return U(await V.api.v1[`star-count`].$get({},H(e)),`/star-count`)}async function pn(e){return U(await V.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function mn(e){return U(await V.api.v1.telemetry.consent.$get({},H(e)),`/telemetry/consent`)}async function hn(e){return U(await V.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function gn(e,t){return U(await V.api.v1.models.$get({query:{runner:e}},H(t)),`/models`)}async function _n(e=!1,t){return I(await U(await V.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},H(t)),`/providers/status`))}async function vn(e){return U(await V.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:r()}},H(e)),`/launch-key`)}async function yn(e){return U(await V.api.v1.projects.$get({},H(e)),`/projects`)}async function bn(e,t){return U(await V.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},H(t)),`/fs/browse`)}async function xn(e){return U(await V.api.v1.p[`:projectId`].runs.$get({param:{projectId:r()}},H(e)),`/runs`)}async function Sn(e,t){return U(await V.api.v1.p[`:projectId`].runs.$get({param:{projectId:e}},H(t)),`/runs`)}async function Cn(e){return U(await V.api.v1.workspace[`runs-index`].$get({},H(e)),`/workspace/runs-index`)}async function wn(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e))}async function Tn(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},H(n)),G(t))}async function En(e,t,n){return cn(await V.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},H(n)),`${G(e)}/history`,a)}async function Dn(e,t){return cn(await V.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),`${G(e)}/history-context`,m)}async function On(e){return U(await V.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:r()}},H(e)),`/ui-state`)}async function kn(e){return U(await V.api.v1.p[`:projectId`].workflows.$get({param:{projectId:r()}},H(e)),`/workflows`)}async function An(e){return U(await V.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{}},H(e)),`/skills`)}async function jn(e){return U(await V.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{wait:`1`}},H(e)),`/skills`)}async function Mn(){return U(await V.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:r()}}),`/skills/refresh`)}async function Nn(e){return U(await V.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{}},H(e)),`/skills/importable`)}async function Pn(e){return U(await V.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{wait:`1`}},H(e)),`/skills/importable`)}async function Fn(e){return U(await V.api.v1.p[`:projectId`].todos.$get({param:{projectId:r()}},H(e)),`/todos`)}async function In(e){return U(await V.api.v1.p[`:projectId`].repo.$get({param:{projectId:r()}},H(e)),`/repo`)}async function Ln(e){return U(await V.api.v1.p[`:projectId`].config.$get({param:{projectId:r()}},H(e)),`/config`)}async function Rn(e={}){return U(await V.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:r()}},H(e)),`/agent-config`)}async function zn(e,t={}){return U(await V.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),`/agent-config/${encodeURIComponent(e)}`)}async function Bn(e,t){return U(await V.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Vn(e){return U(await V.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:r()}},H(e)),`/repo/changes`)}async function Hn(e){return U(await V.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:r()}},H(e)),`/repo/tree`)}async function Un(e,t){return U(await V.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:r()},query:{path:e}},H(t)),`/repo/files`)}function Wn(e){return c(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function Gn(e,t){return U(await V.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:r(),sha:encodeURIComponent(e)},query:{structured:`1`}},H(t)),`/repo/commit/:sha`)}async function Kn(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e,`/tree`))}async function qn(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e,`/commits`))}async function Jn(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:r(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},H(n)),G(e,`/commit/${encodeURIComponent(t)}`))}async function Yn(e={},t){return U(await V.api.v1.p[`:projectId`].github.$get({param:{projectId:r()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor}},H(t)),`/github`)}async function Xn(e={},t){return U(await V.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:r()},query:e},H(t)),`/tracker/automation-options`)}async function Zn(e){return U(await V.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:r()}},H(e)),`/tracker/connection`)}async function Qn(e){return U(await V.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:r()},json:e}),`/tracker/connection`)}async function $n(){return U(await V.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:r()}}),`/tracker/connection`)}async function er(e){return U(await V.api.v1.p[`:projectId`].secrets.$get({param:{projectId:r()}},H(e)),`/secrets`)}async function tr(e){return U(await V.api.v1.workspace.secrets.$get({},H(e)),`/workspace/secrets`)}async function nr(e){if(!e.ok)throw B(e.status,e.statusText,await e.text())}async function rr(e,t){await nr(await V.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:r(),name:e},json:t}))}async function ir(e){await nr(await V.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:r(),name:e}}))}async function ar(e,t){await nr(await V.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function or(e){await nr(await V.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function sr(e){return U(await V.api.v1.p[`:projectId`].e2e.$get({param:{projectId:r()}},H(e)),`/e2e`)}async function cr(e){return U(await V.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:r()},json:e}),`/e2e/setup`)}async function lr(e){return U(await V.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:r()}},H(e)),`/tracker/association`)}async function ur(e,t={},n){return U(await V.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:r()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},H(n)),`/tracker/candidates`)}async function dr(e){return U(await V.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:r()},json:e}),`/tracker/association`)}async function fr(){return U(await V.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:r()}}),`/tracker/association`)}function pr(e){return{expectedScope:e.association?i(e.association):void 0,cursor:e.cursor,limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,state:e.state,labels:e.labels?.length?JSON.stringify(e.labels):void 0}}async function mr(e={},t){return U(await V.api.v1.p[`:projectId`].tracker.$get({param:{projectId:r()},query:pr(e)},H(t)),`/tracker`)}async function hr(e,t={},n){return U(await V.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:r()},query:{...pr(t),q:e}},H(n)),`/tracker/search`)}async function gr(e,t){return U(await V.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?i(t.association):void 0}},H(t)),`/tracker/${encodeURIComponent(e)}`)}async function _r(e,t){return U(await V.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:r()},query:{prs:e.join(`,`)}},H(t)),`/github/checks`)}async function vr(e,t,n={},i){return U(await V.api.v1.p[`:projectId`].github.search.$get({param:{projectId:r()},query:{kind:e,q:t,limit:n.limit}},H(i)),`/github/search`)}async function yr(e,t,n){return U(await V.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},H(n)),`/github/ref-status`)}async function br(e,t,n={},i){return U(await V.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:r(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},H(i)),`/github/comments/${e}/${t}`)}async function xr(e,t={},n){return U(await V.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},H(n)),`/github/prs/${e}/merge-state`)}async function Sr(e,t){return U(await V.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:r(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Cr(e,t={},n){return U(await V.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},H(n)),`/github/prs/${e}/changes`)}function wr(e,t){return un(G(e,`/diff`),{method:`GET`,signal:t?.signal})}function Tr(e,t){return un(G(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Er(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e,`/changes`))}async function Dr(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{path:t}},H(n)),`/runs/:id/files`)}function Or(e,t){return c(G(e,`/files?path=${encodeURIComponent(t)}&raw=1`))}async function kr(e,t){return U(await V.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:r(),groupId:encodeURIComponent(e)}},H(t)),`/groups/${encodeURIComponent(e)}`)}async function Ar(e,t){return U(await V.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function jr(e){return U(await V.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function Mr(e,t){return I(await U(await V.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function Nr(e,t){return I(await U(await V.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Pr(e){let t=`/projects`,n=await W(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=z(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new R(n.status,`the cezar server answered ${t} without a project`):B(n.status,n.statusText,r)}async function Fr(e){return U(await V.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function Ir(e){return U(await V.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function Lr(e){return cn(await V.api.v1.projects[`github-owners`].$get({},H(e)),`/projects/github-owners`,d)}async function Rr(e){return U(await V.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function zr(e,t){return U(await V.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Br(e){return U(await V.api.v1.p[`:projectId`].runs.$post({param:{projectId:r()},json:e}),`/runs`)}async function Vr(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/cancel`))}async function Hr(e,t=!0,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),G(e,`/archive`))}async function Ur(e,t=!0,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),G(e,`/pin`))}async function Wr(e,t,n=!0,r){return U(await V.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),G(t,`/pin`))}async function Gr(e,t,n=!0,r){return U(await V.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),G(t,`/archive`))}async function Kr(e,t,n){let r=n?`read`:`unread`;return U(await(n?V.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):V.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),G(t,`/${r}`))}async function qr(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/auto-resume`))}async function Jr(){return U(await V.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:r()}}),`/runs/archive-finished`)}async function Yr(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/read`))}async function Xr(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/unread`))}async function Zr(){return U(await V.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:r()}}),`/runs/read-all`)}async function Qr(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/finish`))}async function $r(e,t={}){let n={...t.text===void 0?{}:{text:t.text},...t.images===void 0?{}:{images:t.images},...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.agentProfile===void 0?{}:{agentProfile:t.agentProfile}};return U(await V.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:n}),G(e,`/continue`))}async function ei(e,t,n={}){return U(await V.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile}}}),G(t,`/continue`))}var ti=1e3;async function ni(e,t={}){let n=r(),i=async()=>U(await V.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),G(e,`/pr`));try{return await i()}catch(e){if(!(e instanceof R)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,ti));try{return await i()}catch(t){throw t instanceof R&&t.status===0?e:t}}}async function ri(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/pr/adopt`))}async function ii(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),G(e))}async function ai(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e))}async function oi(e){return U(await V.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function si(e,t={}){let n={...t.runner===void 0?{}:{runner:t.runner},...t.model===void 0?{}:{model:t.model},...t.prompt===void 0?{}:{prompt:t.prompt}};return U(await V.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function ci(e,t){return U(await V.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:r(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function li(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/open-in-cli`))}async function ui(e){return U(await V.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:r()}},H(e)),`/open-targets`)}async function di(e){return U(await V.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:r()},json:{target:e}}),`/open-in`)}async function fi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:t}}),G(e,`/open-in`))}async function pi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),G(e,`/open-in`))}async function mi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{message:t}}),G(e,`/git/commit`))}async function hi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e,`/git/status`))}async function gi(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/git/push`))}async function _i(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{text:t.text??``,images:t.images??[]}}),G(e,`/messages`))}async function vi(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),G(t,`/messages`))}async function yi(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function bi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function xi(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:r(),id:encodeURIComponent(e)}},H(t)),G(e,`/drafts`))}var Si=56*1024;async function Ci(e,t,n,i){let a=i?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=Si;return U(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:a}}),G(e,`/drafts/${t}`))}async function wi(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n}),G(e,`/drafts/${t}/images`))}async function Ti(e){return U(await V.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function Ei(e){return U(await V.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function Di(e,t,n,i){return U(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}},H(i)),G(e,`/drafts/${t}/images/${n}`))}async function Oi(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}}),G(e,`/drafts/${t}/images/${n}`))}async function ki(e){return U(await V.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:r()},json:e}),`/repo/branch`)}async function Ai(e){return U(await V.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:r()}},H(e)),`/repo/sync`)}async function ji(e){let t={param:{projectId:r()}},n=V.api.v1.p[`:projectId`].repo;return U(e===`fetch`?await n.fetch.$post(t):e===`pull`?await n.pull.$post(t):e===`push`?await n.push.$post(t):await n.sync.$post(t),`/repo/${e}`)}async function Mi(e){return U(await V.api.v1.p[`:projectId`].plan.$post({param:{projectId:r()},json:{task:e}}),`/plan`)}async function Ni(e){return U(await V.api.v1.p[`:projectId`].automations.$get({param:{projectId:r()}},H(e)),`/automations`)}async function Pi(e){return U(await V.api.v1.p[`:projectId`].automations.$post({param:{projectId:r()},json:e}),`/automations`)}async function Fi(e,t){return U(await V.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function Ii(e,t){let n={projectId:r(),id:encodeURIComponent(e)},i=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return U(t?await V.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await V.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),i)}async function Li(e,t){return U(await V.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Ri(e,t){return U(await V.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:r()},query:{automationId:e}},H(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function zi(e){return U(await V.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:r(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Bi(e){return U(await V.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/run`)}async function Vi(e){let t=await V.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}});if(!t.ok)throw B(t.status,t.statusText,await t.text())}async function Hi(e,t){return U(await V.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},H(t)),`/workspace/automation-templates`)}async function Ui(e){return U(await V.api.v1.p[`:projectId`].workflows.$post({param:{projectId:r()},json:e}),`/workflows`)}async function Wi(e){return U(await V.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:r()}},H(e)),`/workflows/nodes`)}async function Gi(e){return U(await V.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:r()},json:{graph:e}}),`/workflows/validate`)}async function Ki(e){return U(await V.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:r()},json:e}),`/workflows/graph`)}async function qi(e){return U(await V.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:r()},json:{yaml:e}}),`/workflows/parse`)}async function Ji(e){return U(await V.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:r(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function Yi(e,t=r()){return U(await V.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function Xi(e){return U(await V.api.v1.workspace[`ui-state`].$get({},H(e)),`/workspace/ui-state`)}async function Zi(e,t={}){return U(await V.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function Qi(e){let t=await U(await V.api.v1.workspace.config.$get({},H(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?p(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function $i(e){let t=new FormData;t.set(`file`,e);let n=await W(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await n.text();if(!n.ok)throw B(n.status,n.statusText,r);let i=z(r),a=g.safeParse(i);if(!a.success)throw new R(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?p(a.data.logoUrl):null}async function ea(){let e=await W(`/workspace/branding-logo`,{method:`DELETE`}),t=await e.text();if(!e.ok)throw B(e.status,e.statusText,t);let n=g.safeParse(z(t));if(!n.success)throw new R(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?p(n.data.logoUrl):null}async function ta(e){return U(await V.api.v1.workspace[`host-usage`].$get({},H(e)),`/workspace/host-usage`)}async function na(e){let t=await U(await V.api.v1.workspace[`agent-profiles`].$get({},H(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function ra(e){return U(await V.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function ia(e,t){return U(await V.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},H(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function aa(e,t){return U(await V.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},H(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function oa(e,t){return U(await V.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function sa(e){return U(await V.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function ca(e,t){return U(await V.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function la(e){return U(await V.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function ua(e,t){return U(await V.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},H(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function da(e){return U(await V.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function fa(e){return U(await V.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function pa(e){return U(await V.api.v1.workspace[`self-update`].$get({},H(e)),`/workspace/self-update`)}async function ma(){return U(await V.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function ha(e){return U(await V.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},H(e)),`/workspace/self-update/development`)}async function ga(e){return U(await V.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function _a(e){return U(await V.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function va(e){return U(await V.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function ya(){return U(await V.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function ba(e){return U(await V.api.v1.workspace.config.$put({json:e}),`/workspace/config`)}async function xa(e){return U(await V.api.v1.p[`:projectId`].config.$put({param:{projectId:r()},json:e}),`/config`)}async function Sa(e){return U(await V.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:r()}},H(e)),`/worktrees`)}async function Ca(){return U(await V.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:r()},json:{}}),`/worktrees/reclaim`)}async function wa(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/remove-worktree`))}async function Ta(e,t,n){return s.parse(await U(await V.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function Ea(e,t,n,r){return u.parse(await U(await V.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function Da(e,t,n){return u.parse(await U(await V.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}async function Oa(e={limit:50},t){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:r()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},H(t)),`/worktree-lifecycle`)}async function ka(e,t){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:r(),worktreeId:e}},H(t)),`/worktree-lifecycle`)}async function Aa(e,t){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:r(),operationId:e}},H(t)),`/worktree-lifecycle/operations`)}async function ja(e,t=0,n){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:r(),operationId:e},query:{afterSeq:t,limit:100}},H(n)),`/worktree-lifecycle/operations/output`)}async function Ma(e){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:r()},json:e}),`/worktree-lifecycle/operations`)}async function Na(e,t){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:r(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Pa(e){return U(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:r()},json:e}),`/worktree-lifecycle/preview`)}async function Fa(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/terminal`))}async function Ia(e,t){return U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),G(e,`/terminal`))}async function La(e,t,n){return U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),G(e,`/terminal/${t}/output`))}async function Ra(e,t,n){await U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),G(e,`/terminal/${t}/input`))}async function za(e,t,n,i){await U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:i}}),G(e,`/terminal/${t}/resize`))}async function Ba(e,t){await U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),sessionId:t}}),G(e,`/terminal/${t}`))}async function Va(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/terminal/urls`))}async function Ha(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/terminal/commands`))}async function Ua(){return U(await V.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:r()}}),`/start-app`)}async function Wa(e){return U(await V.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:r()},json:e}),`/start-app`)}async function Ga(e){return U(await V.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:r(),id:encodeURIComponent(e)}}),G(e,`/layouts`))}async function Ka(e,t,n){let i=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=Si;return U(await V.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t},{init:{keepalive:i}}),G(e,`/layouts`))}function qa(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Ja(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Ya(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return Ja(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Ja(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ya(e){return Ja(e)&&typeof e.id==`string`&&e.id!==``}function Xa(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=Qa(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,t),a}function Za(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function Qa(e,t){if(!e)return t;let n=e=>e===`user`?2:+(e===`marker`),r=n(e.titleOrigin)>n(t.titleOrigin)?{title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin}:{};return e.usage?{...t,...r,usage:e.usage}:{...t,...r}}var $a=Object.freeze({});function eo(){let e=$a,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var to={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`violet`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`violet`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},no={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function ro(e){return typeof e==`string`&&Object.hasOwn(to,e)}function io(e){return e!==void 0&&ro(e)?to[e]:void 0}var ao={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function oo(e){return!1}function so(e){return!1}function co(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function K(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function lo(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||K(e)}function uo(e){let t=e.worktreeLifecycle;return t?.needsAttention?{bucket:`waiting`,tone:`pending`,pulse:!1,label:t.phase===`setup`?`setup needs attention`:`cleanup needs attention`}:t?.activeOperationId?{bucket:`running`,tone:`pending`,pulse:!0,label:t.phase===`setup`?`preparing worktree`:`cleaning up worktree`}:oo(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:K(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:co(e)?.ceiling===void 0?`needs you`:`budget reached`}:e.status===`review`?{bucket:`waiting`,tone:`violet`,pulse:!0,label:`needs review`}:e.status===`running`&&e.activity===`monitoring`?{bucket:`running`,tone:`violet`,pulse:!0,label:`monitoring`}:e.status===`running`?{bucket:`running`,tone:`violet`,pulse:!0,label:`running`}:so(e)?{bucket:`unseen`,tone:`violet`,pulse:!1,label:`unseen`}:e.status===`queued`?{bucket:`none`,tone:`neutral`,pulse:!1,label:`queued`}:e.status===`done`?{bucket:`none`,tone:`success`,pulse:!1,label:`done`}:{bucket:`none`,tone:`neutral`,pulse:!1,label:`cancelled`}}function fo(e){return ao[uo(e).bucket]<=ao.waiting}var po=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],mo={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},ho=3,go=e=>e.status===`failed`&&e.autoResumeAt!==void 0?ho:K(e)?mo.waiting??0:mo[e.status]??9;function _o(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:lo(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function vo(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function yo(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function bo(e,t){return t!==void 0&&yo(e).ref===t}function xo(e){return e.title.replace(/ \([A-C]\)$/,``)}function So(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}var Co=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function wo(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function To(e){if(e.lastActivityAt!==void 0)return e.lastActivityAt;let t=e.finishedAt??e.startedAt??e.createdAt;for(let n of e.steps??[]){let e=n.finishedAt??n.startedAt;e!==void 0&&wo(e,t)<0&&(t=e)}return t}function Eo(e,t){return t===`created`?e.createdAt:To(e)}function Do(e){return e===`created`?`Created`:`Updated`}function Oo(e,t){if(t===`archived`)return[{key:`rest`,label:null,runs:[...e]}];let n=new Map(e.map(e=>[e.id,e])),r=e=>{let t=new Set;for(let r=e;r&&!t.has(r.id);r=n.get(r.dispatch?.parentRunId??``)){if(r.pinned)return!0;t.add(r.id)}return!1},i=e.filter(r);if(i.length===0)return[{key:`rest`,label:null,runs:[...e]}];let a=e.filter(e=>!r(e));return[{key:`pinned`,label:`Pinned`,runs:i},...a.length>0?[{key:`rest`,label:`All tasks`,runs:a}]:[]]}function ko(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=go(e)-go(n);if(r!==0)return r;if(go(e)===ho&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):wo(To(e),To(n))})}function Ao(e,t,n){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,r)=>{if(t!==`archived`){let t=Number(!!r.pinned)-Number(!!e.pinned);if(t!==0)return t}return wo(Eo(e,n),Eo(r,n))})}function jo(e,t){let n=So(e),r=ko(e,t),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Set;for(let e of r){if(e.groupId){if(o.has(e.groupId))continue;o.add(e.groupId);let n=r.filter(t=>t.groupId===e.groupId).sort((e,t)=>(e.variant??``).localeCompare(t.variant??``));if(n.length>1){a(_o(e,t),{kind:`group`,groupId:e.groupId,title:xo(e),members:n});continue}}a(_o(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return po.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Mo(e,t){let n=[],r=t;for(let t of e){if(t.label===`Pinned`){n.push({label:t.label,rows:[...t.rows]});continue}if(r<=0)continue;let e=t.rows.slice(0,r);r-=e.length,n.push({label:t.label,rows:e})}return n}function No(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,lo(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var Po=new Set([`running`,`waiting`]),Fo=new Set([`done`,`failed`,`review`,`cancelled`]),Io=new Set([`done`,`failed`,`cancelled`]);function Lo(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Ro(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function zo(e,t=new Date){if(e.status!==`failed`||!e.autoResumeAt)return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function Bo(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=e.steps.find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}function Vo(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[vo(e),e.branch??``,e.workflow,Bo(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function Ho(e){return e.filter(e=>!e.archived&&Io.has(e.status)&&!K(e)).length}function Uo(e,t=!1){if(!e)return;let n=e.trim().replace(/\/+$/,``),r=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(n),i=r?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(n),a=r??i;if(!a)return;let[,o,s]=a;if(!s||!o||!t&&o.toLowerCase()!==`github.com`)return;let c=s.replace(/\.git$/i,``).split(`/`).filter(Boolean),l=c[c.length-2],u=c[c.length-1];return l&&u?`https://${o.toLowerCase()}/${l}/${u}`:void 0}function Wo(e){if(e.pullRequestUrl){let t=Number(q(e.pullRequestUrl));return{url:e.pullRequestUrl,...t>0?{number:t}:{}}}let t=e.prRefs?.find(e=>e.origin===`created`||e.origin===`marker`);if(t)return{number:t.number,...t.url?{url:t.url}:{}};let n=e.markerRefs?.pr;return n===void 0?void 0:{number:n}}function Go(e){return Ko(e)[0]?.url??qo(e)[0]}function Ko(e,t){if(!e.prRefs?.length)return qo(e).map(e=>({number:Number(q(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??es(`PR`,e.number,t),origin:e.origin}))}function qo(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Jo(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!Yo(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function Yo(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function Xo(e,t){return e.map((e,t)=>({reference:e,index:t})).sort((e,n)=>{let r=e.reference.kind===`PR`&&t(e.reference)===`closed`,i=n.reference.kind===`PR`&&t(n.reference)===`closed`;return Number(r)-Number(i)||e.index-n.index}).map(({reference:e})=>e)}function Zo(e,t){let n=e.prRefs?.length?Ko(e,t).map(e=>({number:e.number,url:e.url})):qo(e).map(e=>({url:e,number:Number(q(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:$o(e,t)},{kind:`Issue`,url:Jo(e,t)},{kind:`Issue`,number:Qo(e,t)}],a=new Set,o=[];for(let e of i){let n=e.url?Number(q(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??es(e.kind,n,t),i=o.findIndex(t=>t.kind===e.kind&&t.number===n&&(!t.url||!r||t.url===r));if(i>=0){!o[i].url&&r&&(o[i]={...o[i],url:r});continue}let s=`${e.kind}#${n}#${r??``}`;a.has(s)||(a.add(s),o.push({kind:e.kind,number:n,...r?{url:r}:{}}))}return o}function Qo(e,t){let n=e.issueNumber;return n===void 0||!t?n:Yo(e.referencedIssueCandidates,n,t)?void 0:n}function $o(e,t){let n=e.prNumber;return n===void 0||!t?n:Yo(e.referencedPrCandidates,n,t)?void 0:n}function es(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function ts(e,t){return Zo(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function ns(e,t){let n=Po.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Lo(n.rssBytes),kind:`live`}};let r=Lo(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function rs(e,t){let n=e.filter(e=>t===`archived`?e.archived:!e.archived),r=new Map;for(let e of n){if(!e.groupId)continue;let t=r.get(e.groupId);t?t.push(e):r.set(e.groupId,[e])}return[...r.entries()].flatMap(([e,t])=>{let n=t[0];return!n||t.length<2||!t.every(e=>Fo.has(e.status))?[]:[{groupId:e,title:xo(n),count:t.length}]})}function is(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function as(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function os(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}var ss=`/api/v1/ws`,cs=3e3,ls=1e3,us=7e4,ds=0,fs=1;function ps(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},us)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${ss}`,l=e=>{r?.readyState===fs&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===ds||r.readyState===fs))return;let a=new e(c());r=a,a.addEventListener(`open`,()=>{if(a===r){s();for(let e of t.keys())l({type:`subscribe`,topic:e})}}),a.addEventListener(`message`,e=>{if(a!==r)return;s();let i;try{i=JSON.parse(e.data)}catch{return}if(typeof i!=`object`||!i)return;let{type:o,topic:c,data:l}=i;if(typeof c!=`string`)return;if(o===`error`){for(let e of[...n.get(c)??[]])e();return}if(o!==`event`)return;let u=t.get(c);if(u)for(let e of[...u])e(l)}),a.addEventListener(`close`,()=>{a===r&&(r=null,clearTimeout(o),o=void 0,t.size>0&&i===void 0&&(i=setTimeout(()=>{i=void 0,t.size>0&&u()},cs)))}),a.addEventListener(`error`,()=>void 0)};return{subscribe(e,s,c){let d=()=>c?.();c&&(n.has(e)||n.set(e,new Set),n.get(e).add(d));let f=t.get(e);f||(f=new Set,t.set(e,f));let p=f.size===0;f.add(s),clearTimeout(a),a=void 0,r?p&&l({type:`subscribe`,topic:e}):(clearTimeout(i),i=void 0,u());let m=!0;return()=>{m&&(m=!1,n.get(e)?.delete(d),n.get(e)?.size||n.delete(e),f.delete(s),!(f.size>0)&&(t.delete(e),l({type:`unsubscribe`,topic:e}),t.size===0&&a===void 0&&(a=setTimeout(()=>{a=void 0,!(t.size>0)&&(clearTimeout(i),i=void 0,clearTimeout(o),o=void 0,r?.close(),r=null)},ls))))}}}}var ms=null;function hs(e,t,n){return ms??=ps(),ms.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,r()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,r()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,r()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,r(),`association`],candidates:(e,t=``)=>[`tracker`,r(),`candidates`,e,t],connection:()=>[`tracker`,r(),`connection`],items:(e,t)=>[`tracker`,r(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,r(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},list:()=>[r(),`runs`,`list`],detail:e=>[r(),`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],gitStatus:e=>[r(),`runs`,`git-status`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],drafts:e=>[r(),`runs`,`drafts`,e],commits:e=>[r(),`runs`,`commits`,e],tree:e=>[r(),`runs`,`tree`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},groups:{detail:e=>[r(),`groups`,e]},get todos(){return[r(),`todos`]},get workflows(){return[r(),`workflows`]},get workflowNodes(){return[r(),`workflow-nodes`]},get skills(){return[r(),`skills`]},get skillsReady(){return[r(),`skills`,`ready`]},get importableSkills(){return[r(),`skills`,`importable`]},get importableSkillsReady(){return[r(),`skills`,`importable`,`ready`]},get launchKey(){return[r(),`launch-key`]},get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoSync(){return[r(),`repo`,`sync`]},get repoTree(){return[r(),`repo`,`tree`]},repoFile:e=>[r(),`repo`,`file`,e],get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:(e=50)=>[r(),`github`,`pages`,e],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[r(),`github`,`comments`,e,t],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},gs=6e4;function _s(){return M({queryKey:J.secrets.list(),queryFn:({signal:e})=>er({signal:e})})}function vs(){return M({queryKey:Y.secrets,queryFn:({signal:e})=>tr({signal:e})})}function ys(){return M({queryKey:J.e2e.status(),queryFn:({signal:e})=>sr({signal:e})})}function bs(){return M({queryKey:J.tracker.connection(),queryFn:({signal:e})=>Zn({signal:e})})}function xs(){return M({queryKey:J.tracker.association(),queryFn:({signal:e})=>lr({signal:e})})}function Ss(e,t,n){return jt({queryKey:J.tracker.candidates(e,t),staleTime:gs,queryFn:({pageParam:n,signal:r})=>ur(e,{q:t.trim()||void 0,cursor:n,limit:50},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:n})}var Cs=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function ws(e,t,n=!0){let i=t.query.trim(),a=j(),o=e?J.tracker.items(e,{...t,query:i}):[`tracker`,r(),`items`,`unassociated`];return{...jt({queryKey:o,staleTime:1/0,queryFn:({pageParam:n,signal:r})=>i?hr(i,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:r}):mr({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:r}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:o,restart:async()=>{await a.cancelQueries({queryKey:o,exact:!0});try{await a.fetchInfiniteQuery({queryKey:o,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let r={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=i?await hr(i,r,{signal:n}):await mr(r,{signal:n});if(!a.available)throw new Cs(a);return a}})}catch{}}}}function Ts(e,t){return M({staleTime:gs,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,r(),`detail`,`disabled`],queryFn:({signal:n})=>gr(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var Y={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:[`workspace`,`runs-index`],secrets:[`workspace`,`secrets`],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],hostUsage:[`workspace`,`host-usage`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],telemetryConsent:[`workspace`,`telemetry-consent`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t=!0){return M({queryKey:Y.models(e),queryFn:({signal:t})=>h(e)?gn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&h(e)})}function Es(e=!0){let t=X(`claude`,e),n=X(`codex`,e),r=X(`opencode`,e),i=X(`cursor`,e),a=X(`pi`,e);return{claude:t,codex:n,junie:X(`junie`,e),opencode:r,cursor:i,pi:a,copilot:X(`copilot`,e)}}function Ds(){let e=j();return M({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await _n(!1,{signal:t});return Ht(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Os(){let e=j();return N({mutationFn:()=>_n(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Ht(r,e,t))})}function ks(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>Nr(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Ht(r,e,t,n.authFailureId))}})}function As(){return M({queryKey:Y.projects,queryFn:({signal:e})=>yn({signal:e})})}function js(e,t=!1){return M({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>bn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Ms(){let e=j();return N({mutationFn:e=>Pr(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Ns(){let e=j();return N({mutationFn:e=>Rr(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function Ps(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return zr(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Fs(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function Fs(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:os(s);return c.length>0&&(a.tags=c),a}function Is(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function Ls(){return Is(e=>ra(e))}function Rs(){return Is(e=>{let{id:t,...n}=e;return ca(t,n)})}function zs(){return Is(e=>la(e))}function Bs(){return Is(e=>sa(e))}function Vs(e,t){return M({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>aa(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Hs(e,t){return M({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>ia(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Us(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>Ar(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function Ws(){let e=j();return N({mutationFn:e=>ia(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function Gs(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return oa(t,n)},retry:!1})}function Ks(){let e=j();return N({mutationFn:e=>Fr(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function qs(){let e=j();return N({mutationFn:e=>Ir(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function Js(){return M({queryKey:Y.githubOwners,queryFn:({signal:e})=>Lr({signal:e}),staleTime:5*6e4,retry:!1})}function Ys(){let e=j();(0,A.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=hs(`health`,t=>{e.setQueryData(J.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function Xs(){return M({queryKey:J.health,queryFn:({signal:e})=>dn({signal:e})})}function Zs(){let e=Xs().data,t=As().data?.projects,{projectId:n}=Pt(),r=n??e?.bootProject,i=r===void 0?void 0:t?.find(e=>e.id===r);return i?.repoUrl?i.repoUrl:n===null||n===e?.bootProject?Uo(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function Qs(){return M({queryKey:J.openTargets,queryFn:({signal:e})=>ui({signal:e}),staleTime:5*6e4})}function $s(e){return M({queryKey:J.runs.list(),queryFn:({signal:e})=>xn({signal:e}),select:e})}function ec(e=!0,t){return M({queryKey:Y.runsIndex,queryFn:({signal:e})=>Cn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:t}})}function tc(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>Sn(e,{signal:t}),enabled:t,select:r})}function nc(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return tc(i?`default`:r??`default`,!0,i,n)}function rc(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>wn(e,{signal:t})}}function ic(e){return M({...rc(e??``),enabled:!!e})}function ac(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Tn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function oc(e){return M({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>wr(e,{signal:t}),enabled:!!e})}function sc(e,t=!1){return M({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Er(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function cc(e,t,n=!1){return M({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>hi(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function lc(e,t=!0){return M({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>Kn(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function uc(e,t){return M({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Dr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function dc(e){return M({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>kr(e,{signal:t}),enabled:!!e})}function fc(e,t=!1){return M({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>qn(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function pc(e,t){return M({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>Jn(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function mc(e,t=!0){return M({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Tr(e,{signal:t}),enabled:!!e&&t})}function hc(e){return M({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>xi(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function gc(e=!0){return M({queryKey:J.todos,queryFn:({signal:e})=>Fn({signal:e}),enabled:e})}function _c(){return M({queryKey:J.workflowNodes,queryFn:({signal:e})=>Wi({signal:e}),staleTime:1/0})}function vc(e={}){return M({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>kn({signal:e})})}function yc(e=!0){let t=j(),n=J.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>An({signal:e}),enabled:e}),a=M({queryKey:J.skillsReady,queryFn:({signal:e})=>jn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function bc(e=!0){let t=j(),n=J.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Nn({signal:e}),enabled:e}),a=M({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>Pn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function xc(){return M({queryKey:J.launchKey,queryFn:({signal:e})=>vn({signal:e}),staleTime:1/0})}function Sc(){return M({queryKey:J.repo,queryFn:({signal:e})=>In({signal:e})})}function Cc(){return M({queryKey:J.repoSync,queryFn:({signal:e})=>Ai({signal:e}),refetchOnWindowFocus:!0})}function wc(){let e=j();return N({mutationFn:e=>ji(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function Tc(){return M({queryKey:J.repoChanges,queryFn:({signal:e})=>Vn({signal:e}),retry:!1})}function Ec(){return M({queryKey:J.repoTree,queryFn:({signal:e})=>Hn({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Dc(e){return M({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>Un(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Oc(e){return M({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>Gn(e,{signal:t}),enabled:!!e,retry:!1})}function kc(){return M({queryKey:J.config,queryFn:({signal:e})=>Ln({signal:e})})}function Ac(){return M({queryKey:J.worktrees,queryFn:({signal:e})=>Sa({signal:e})})}function jc(){return M({queryKey:J.uiState,queryFn:({signal:e})=>On({signal:e})})}function Mc(){return M({queryKey:J.agentConfig,queryFn:({signal:e})=>Rn({signal:e})})}function Nc(e){return M({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>zn(e,{signal:t}),enabled:e!==null})}function Pc(e){let t=j(),n=J.agentConfig,r=J.agentConfigFile(e);return N({mutationFn:t=>Bn(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function Fc(){return M({queryKey:Y.uiState,queryFn:({signal:e})=>Xi({signal:e})})}function Ic(){return M({queryKey:Y.config,queryFn:({signal:e})=>Qi({signal:e})})}function Lc(){return M({queryKey:Y.agentProfiles,queryFn:({signal:e})=>na({signal:e})})}var Rc=1e4;function zc(e=!0){return M({queryKey:Y.starCount,queryFn:({signal:e})=>fn({signal:e}),enabled:e,staleTime:Rc,refetchInterval:Rc,retry:!1,refetchOnMount:!1})}function Bc(){return M({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>mn({signal:e}),staleTime:1/0,retry:!1})}function Vc(e,t=!0){return M({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>ua(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return t===void 0||t===`idle`||t===`checking`||t===`updating`?6e4:!1}})}function Hc(e=!0){return M({queryKey:Y.selfUpdate,queryFn:({signal:e})=>pa({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function Uc(e=!0){return M({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>ha({signal:e}),enabled:e,staleTime:3e4})}function Wc(){let e=j();return N({mutationFn:()=>ha({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function Gc(){let e=j();return N({mutationFn:()=>ma(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Kc(){let e=j();return N({mutationFn:e=>ga(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function qc(){let e=j();return N({mutationFn:e=>_a(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Jc(){let e=j();return N({mutationFn:e=>va(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Yc(){let e=j();return N({mutationFn:()=>ya(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Xc(e){let t=j();return N({mutationFn:t=>ii(e,t),onSuccess:e=>{Zc(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function Zc(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?Qa(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?Qa(e,t):t),Qc(e)}function Qc(e){e.invalidateQueries({queryKey:Y.runsIndex})}function $c(){let e=j();return N({mutationFn:e=>Yr(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(J.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Qc(e)}})}function el(){let e=j();return N({mutationFn:e=>Xr(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?tl(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&tl(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?tl(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Qc(e)}})}function tl(e){let{seenAt:t,...n}=e;return n}function nl(e,t,n){let r=j();return N({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?Ur(n,r,i??e):Wr(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function rl(e,t,n){let r=j();return N({mutationFn:({id:n,archived:r})=>t===void 0?Hr(n,r,e):Gr(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function il(e,t){let n=j();return N({mutationFn:n=>t===void 0?_i(e,n):vi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof R&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function al(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?$r(e,n):ei(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function ol(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>yi(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function sl(e){let t=j();return N({mutationFn:t=>bi(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function cl(e={},t=!0){return M({queryKey:J.github(e),queryFn:({signal:t})=>Yn({limit:e.limit},{signal:t}),enabled:t})}function ll(e=50,t=!0){return jt({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>Yn({limit:e,issuesCursor:t.issuesCursor,prsCursor:t.prsCursor},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n}:void 0},enabled:t,staleTime:6e4})}function ul(e,t=!0){return M({queryKey:J.githubChecks(e),queryFn:({signal:t})=>_r(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function dl(e,t,n=!0){return M({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>vr(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var fl=100;function pl(e){return[...e].sort((e,t)=>t-e).slice(0,fl).sort((e,t)=>e-t)}var Z=new Map(yl()),ml=1e3;function hl(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>ml;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Sl()}}var Q=new Set(bl());function gl(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>ml;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Sl()}}var _l=`cez.reference-statuses.v1`,vl=`cez.reference-conflicts.v1`;function yl(){try{let e=globalThis.sessionStorage?.getItem(_l);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&ro(e[1])):[]}catch{return[]}}function bl(){try{let e=globalThis.sessionStorage?.getItem(vl);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var xl;function Sl(){xl===void 0&&(xl=setTimeout(()=>{xl=void 0;try{globalThis.sessionStorage?.setItem(_l,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(vl,JSON.stringify([...Q]))}catch{}},250))}function Cl(){let e=Pt(),t=Xs();return e.projectId??t.data?.bootProject}function wl(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))hl($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))hl($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Tl=5*6e4;function El(e){return e?e.recheckAfterMs:Tl}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Dl(e,t=!0){let n=(0,A.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:pl(t.prs),issues:pl(t.issues)}))},[e.map($).sort().join(`|`)]),r=kt({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>yr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>El(e.state.data)??1/0,refetchInterval:e=>El(e.state.data)??!1,refetchOnWindowFocus:!0}))}),i=(0,A.useMemo)(()=>{let e=new Map;return r.forEach((t,r)=>{let i=n[r];if(!i)return;let a=[...i.prs.map(e=>({projectId:i.projectId,kind:`PR`,number:e})),...i.issues.map(e=>({projectId:i.projectId,kind:`Issue`,number:e}))],o=t.data;for(let n of a){let r=$(n),i=Z.get(r),a=Q.has(r)?!0:void 0;if(o?.available){let t=o.prs[n.number]??o.issues[n.number];if(t){let i=o.conflicts?o.conflicts.includes(n.number):void 0;hl(r,t),i!==void 0&&gl(r,i),e.set(r,{state:`ready`,status:t,...i??a?{conflicting:!0}:{}})}else e.set(r,{state:`unknown`,...i?{status:i}:{}})}else o?e.set(r,{state:`unavailable`,reason:o.reason,...i?{status:i}:{},...a?{conflicting:!0}:{}}):t.isError?e.set(r,{state:`unavailable`,reason:t.error instanceof Error?t.error.message:void 0,...i?{status:i}:{},...a?{conflicting:!0}:{}}):e.set(r,{state:`loading`,...i?{status:i}:{},...a?{conflicting:!0}:{}})}}),e},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,A.useCallback)(e=>{let t=$(e),n=i.get(t);if(n)return n;let r=Z.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[i])}function Ol(e,t,n=!0){return M({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>br(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function kl(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Cr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Wc as $,U as $i,Jr as $n,Xi as $r,Zc as $t,dc as A,ye as Aa,wa as Ai,Ao as An,br as Ar,Uc as At,nl as B,dr as Bi,fo as Bn,En as Br,bs as Bt,cl as C,Xe as Ca,Zi as Ci,xo as Cn,Qr as Cr,X as Ct,Js as D,E as Da,Mn as Di,bo as Dn,Ni as Dr,Jc as Dt,ll as E,ge as Ea,Ca as Ei,So as En,Hi as Er,ec as Et,$c as F,fe as Fa,za as Fi,ao as Fn,Aa as Fr,zc as Ft,As as G,Kr as Gi,Xa as Gn,Va as Gr,Ps as Gt,ac as H,Ki as Hi,io as Hn,Ga as Hr,ws as Ht,el as I,x as Ia,zi as Ii,co as In,ja as Ir,Bc as It,Ws as J,Ti as Ji,qa as Jn,Ua as Jr,Ic as Jt,Ds as K,Mr as Ki,eo as Kn,pa as Kr,_c as Kt,Gs as L,Bi as Li,uo as Ln,Di as Lr,gc as Lt,Ys as M,Se as Ma,$n as Mi,Eo as Mn,xr as Mr,Kc as Mt,bc as N,w as Na,or as Ni,yo as Nn,dn as Nr,yc as Nt,kl as O,xe as Oa,Da as Oi,vo as On,Ln as Or,Bs as Ot,xc as P,Me as Pa,Wn as Pi,Oo as Pn,vn as Pr,Vc as Pt,Gc as Q,Ba as Qi,fa as Qn,ta as Qr,Y as Qt,Qs as R,Or as Ri,K as Rn,xi as Rr,xs as Rt,js as S,ct as Sa,ba as Si,jo as Sn,ea as Sr,Es as St,Ol as T,k as Ta,Ea as Ti,No as Tn,Ri as Tr,nc as Tt,tc as U,ar as Ui,$a as Un,Fa as Ur,jc as Ut,Zs as V,Qn as Vi,no as Vn,Dn as Vr,Ts as Vt,_s as W,Ii as Wi,Za as Wn,Ha as Wr,Rs as Wt,Dl as X,Ma as Xi,Na as Xn,gr as Xr,Fc as Xt,Cl as Y,cr as Yi,R as Yn,Xn as Yr,vs as Yt,Os as Z,si as Zi,ri as Zn,mr as Zr,Ac as Zt,al as _,jt as _a,xa as _i,ns as _n,Vi as _r,hc as _t,rc as a,nn as aa,di as ai,Vo as an,Li as ar,Tc as at,ys as b,gt as ba,hn as bi,Mo as bn,Ei as br,mc as bt,Mc as c,Yt as ca,li as ci,Lo as cn,mi as cr,Cc as ct,qc as d,zt as da,ii as di,Xo as dn,Pi as dr,ks as dt,Fi as ea,Oa as ei,hs as en,Gr as er,Ms as et,rl as f,I as fa,ci as fi,zo as fn,ki as fr,ic as ft,Us as g,Pt as ga,gi,Zo as gn,Ui as gr,oc as gt,kc as h,Ft as ha,Pa as hi,ts as hn,Ia as hr,fc as ht,wl as i,Ra as ia,pn as ii,rs as in,V as ir,Sc as it,Xs as j,C as ja,oi as ji,Do as jn,Cr as jr,il as jt,dl as k,be as ka,ir as ki,ko as kn,Yn as kr,Hc as kt,Nc as l,P as la,Ta as li,Wo as ln,Ar as lr,wc as lt,Ks as m,Wt as ma,wi as mi,Go as mn,ni as mr,pc as mt,Cs as n,$i as na,Zr as ni,as as nn,qr as nr,Ns as nt,Vs as o,Xt as oa,pi as oi,Ho as on,da as or,Oc as ot,Yc as p,Gt as pa,Mi as pi,Jo as pn,Br as pr,sc as pt,Pc as q,Wa as qi,Qa as qn,ua as qr,vc as qt,J as r,Gi as ra,Sr as ri,Fo as rn,Vr as rr,sl as rt,Hs as s,Zt as sa,fi as si,Ro as sn,fr as sr,Dc as st,gs as t,jr as ta,ka as ti,is as tn,Hr as tr,zs as tt,Lc as u,Vt as ua,qi as ui,q as un,$r as ur,Ec as ut,Ls as v,N as va,Ci as vi,Bo as vn,ai as vr,uc as vt,ul as w,ze as wa,La as wi,To as wn,ia as wr,$s as wt,ol as x,j as xa,Yi as xi,wo as xn,Ji as xr,lc as xt,qs as y,M as ya,Ka as yi,Co as yn,Oi as yr,cc as yt,Xc as z,rr as zi,lo as zn,Dr as zr,Ss as zt};
|