@open-mercato/cezar 0.15.0 → 0.15.1
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/automations/github-poller.d.ts +8 -1
- package/dist/automations/github-poller.js +78 -13
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/pr-head.js +15 -1
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +2 -2
- package/dist/automations/types.d.ts +10 -0
- package/dist/automations/types.js +12 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/automations.d.ts +31 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +161 -17
- package/dist/contract/projects.d.ts +46 -0
- package/dist/contract/runs.d.ts +15 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/telemetry.d.ts +124 -0
- package/dist/contract/workspace.d.ts +3 -0
- package/dist/core/cursor-agent-runner.d.ts +11 -0
- package/dist/core/cursor-agent-runner.js +48 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +10 -0
- package/dist/core/disclaim-spawn.js +105 -8
- package/dist/core/disclaim-spawn.js.map +1 -1
- package/dist/git-diff-base.js +26 -19
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-remotes.d.ts +43 -0
- package/dist/git-remotes.js +127 -0
- package/dist/git-remotes.js.map +1 -0
- package/dist/git-worktree.d.ts +43 -19
- package/dist/git-worktree.js +138 -54
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.d.ts +17 -0
- package/dist/runs/auto-name.js +47 -2
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +10 -2
- package/dist/runs/event-history.js +290 -120
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.js +1 -1
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +16 -3
- package/dist/runs/store.js +89 -10
- package/dist/runs/store.js.map +1 -1
- package/dist/server/checkout.d.ts +4 -0
- package/dist/server/checkout.js +9 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.d.ts +77 -0
- package/dist/server/create-project.js +342 -0
- package/dist/server/create-project.js.map +1 -0
- package/dist/server/forge/github.d.ts +2 -0
- package/dist/server/forge/github.js +32 -10
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +1 -12
- package/dist/server/forge/index.js +7 -29
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -0
- package/dist/server/git-changes.d.ts +15 -0
- package/dist/server/git-changes.js +51 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git.d.ts +3 -2
- package/dist/server/git.js +4 -3
- package/dist/server/git.js.map +1 -1
- package/dist/server/project-context.js +1 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +609 -302
- package/dist/server/server.js +191 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +27 -11
- package/dist/server/star-count.js +57 -28
- package/dist/server/star-count.js.map +1 -1
- package/dist/telemetry-cli.d.ts +10 -0
- package/dist/telemetry-cli.js +54 -0
- package/dist/telemetry-cli.js.map +1 -0
- package/dist/telemetry-service.json +1 -0
- package/dist/telemetry.d.ts +79 -0
- package/dist/telemetry.js +453 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/workflows/run.d.ts +28 -0
- package/dist/workflows/run.js +111 -16
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -0
- package/dist/workspace/config.js +16 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +3 -0
- package/dist/workspace/projects-cli.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +32 -17
- package/scripts/stamp-telemetry-service.mjs +20 -0
- package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
- package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
- package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
- package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
- package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
- package/web/dist/assets/button-BNnH7COh.js +100 -0
- package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
- package/web/dist/assets/check-DA37PQLT.js +1 -0
- package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
- package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
- package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
- package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
- package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
- package/web/dist/assets/composer-DKWLJeo9.js +18 -0
- package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
- package/web/dist/assets/diff-CrLUECGW.js +3 -0
- package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
- package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
- package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
- package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
- package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
- package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
- package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
- package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
- package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
- package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
- package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
- package/web/dist/assets/github-G5fU4gJd.js +1 -0
- package/web/dist/assets/index-BN3w52uE.js +21 -0
- package/web/dist/assets/index-CAvSSpvF.css +2 -0
- package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
- package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
- package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
- package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
- package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
- package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
- package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
- package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
- package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
- package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
- package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
- package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
- package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
- package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
- package/web/dist/assets/skills-SIMzpL0l.js +1 -0
- package/web/dist/assets/square-DsFAQaY9.js +1 -0
- package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
- package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
- package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
- package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
- package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
- package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
- package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
- package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
- package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
- package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
- package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
- package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
- package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
- package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
- package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
- package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
- package/web/dist/assets/upload-bwO_2kok.js +1 -0
- package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
- package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
- package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
- package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
- package/web/dist/assets/x-HaVPcg_B.js +1 -0
- package/web/dist/index.html +28 -31
- package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
- package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
- package/web/dist/assets/automations-route-BsflncpV.js +0 -1
- package/web/dist/assets/button-CjSjKnkd.js +0 -100
- package/web/dist/assets/check-DAAMuI4o.js +0 -1
- package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
- package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
- package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
- package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
- package/web/dist/assets/composer-DZx3cwQW.js +0 -18
- package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
- package/web/dist/assets/diff-LG2cl0PE.js +0 -3
- package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
- package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
- package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
- package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
- package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
- package/web/dist/assets/external-link-DPKRidDg.js +0 -1
- package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
- package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
- package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
- package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
- package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
- package/web/dist/assets/github-C4WaHPni.js +0 -1
- package/web/dist/assets/index-CiQrbvAq.js +0 -21
- package/web/dist/assets/index-WWaEax-B.css +0 -2
- package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
- package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
- package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
- package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
- package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
- package/web/dist/assets/skills-Dea5ynJK.js +0 -1
- package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
- package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
- package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
- package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
- package/web/dist/assets/task-files-MAPO-efK.js +0 -1
- package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
- package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
- package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
- package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
- package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
- package/web/dist/assets/tooltip--PYfu68E.js +0 -1
- package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
- package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
- package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
- package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
- package/web/dist/assets/use-now-CrM50BFB.js +0 -1
- package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
- package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
- package/web/dist/assets/x-BkwTUDpG.js +0 -1
|
@@ -0,0 +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{B as r,Ft as i,I as a,It as o,L as s,Ot as c,R as l,U as u,V as d,_t as f,bt as p,jt as m,kt as h,r as g,vt as _,z as v}from"./button-BNnH7COh.js";import{i as y}from"./bundle-mjs-BT31bpU6.js";var b=/^[\w!#$%&'*.^`|~+-]+$/,x=(e,t,n={})=>{if(!b.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},ee=(e,t,n)=>(t=encodeURIComponent(t),x(e,t,n)),te=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),ne=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},re=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},ie=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},ae=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function oe(e,t){if(!S(e)&&!S(t))return t;let n={...e};for(let e in t){let r=t[e];S(n[e])&&S(r)?n[e]=oe(n[e],r):n[e]=r}return n}var se=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return se(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),ce=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(ee(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=ae(a),a=ne(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})}},le=(e,t)=>se(function n(r){let i=t?.buildSearchParams??re,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=te(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=ne(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=ae(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ie(r.args[0]&&r.args[0].param?ne(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 ce(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=oe(t,e);return l.fetch(r.args[0],a)}return l},[]);function ue(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return le(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var de=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 de{#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)},C=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 w(){}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 T(e,t){return typeof e==`function`?e(t):e}function E(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(!Ce(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(Se(t.options.mutationKey)!==Se(a))return!1}else if(!Ce(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function xe(e,t){return(t?.queryKeyHashFn||Se)(e)}function Se(e){return JSON.stringify(e,(e,t)=>Oe(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ce(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ce(e[n],t[n])):!1}var we=Object.prototype.hasOwnProperty;function Te(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=De(e)&&De(t);if(!r&&!(Oe(e)&&Oe(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:we.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Te(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ee(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 De(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Oe(e){if(!ke(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ke(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ke(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ae(e){return new Promise(t=>{C.setTimeout(t,e)})}function je(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Te(e,t)}function Me(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pe=Symbol();function Fe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Pe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ie(e,t){return typeof e==`function`?e(...t):!!e}function Le(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 Re=(()=>{let e=()=>he;return{isServer(){return e()},setIsServer(t){e=t}}})();function ze(){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 Be=me;function Ve(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Be,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 D=Ve(),He=new class extends de{#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 Ue(e){return Math.min(1e3*2**e,3e4)}function We(e){return(e??`online`)!==`online`||He.isOnline()}var Ge=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ke(e){let t=!1,n=0,r,i=ze(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ge(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>fe.isFocused()&&(e.networkMode===`always`||He.isOnline())&&e.canRun(),u=()=>We(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??(Re.isServer()?0:3),o=e.retryDelay??Ue,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),Ae(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 qe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_e(this.gcTime)&&(this.#e=C.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Re.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(C.clearTimeout(this.#e),this.#e=void 0)}};function Je(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=>{Le(e,()=>t.signal,()=>n=!0)},u=Fe(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?Ne:Me;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Xe:Ye,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:Ye(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 Ye(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 Xe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ze(e,t){return t?Ye(e,t)!=null:!1}function Qe(e,t){return!t||!e.getPreviousPageParam?!1:Xe(e,t)!=null}var $e=class extends qe{#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=nt(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=nt(this.options);e.data!==void 0&&(this.setState(tt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=je(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(w).catch(w):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=>E(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>T(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=Fe(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`?Je(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=Ke({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ge&&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 Ge){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,...et(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...tt(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),D.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function et(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:We(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function tt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function nt(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 rt=class extends de{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=ze(),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),at(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ot(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ot(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 E(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&&!Ee(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&st(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(t.enabled,this.#t)||T(this.options.staleTime,this.#t)!==T(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||E(this.options.enabled,this.#t)!==E(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 lt(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(w)),t}#g(){this.#b();let e=T(this.options.staleTime,this.#t);if(Re.isServer()||this.#r.isStale||!_e(e))return;let t=ve(this.#r.dataUpdatedAt,e)+1;this.#d=C.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,!(Re.isServer()||E(this.options.enabled,this.#t)===!1||!_e(this.#p)||this.#p===0)&&(this.#f=C.setInterval(()=>{(this.options.refetchIntervalInBackground||fe.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(C.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(C.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&&at(e,t),o=i&&st(e,n,t,r);(a||o)&&(l={...l,...et(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=je(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=je(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`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,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&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ct(e,t),refetch:this.refetch,promise:this.#o,isEnabled:E(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=ze();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}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),!Ee(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){D.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function it(e,t){return E(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&E(t.retryOnMount,e)===!1)}function at(e,t){return it(e,t)||e.state.data!==void 0&&ot(e,t,t.refetchOnMount)}function ot(e,t,n){if(E(t.enabled,e)!==!1&&T(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ct(e,t)}return!1}function st(e,t,n,r){return(e!==t||E(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ct(e,n)}function ct(e,t){return E(t.enabled,e)!==!1&&e.isStaleByTime(T(t.staleTime,e))}function lt(e,t){return!Ee(e.getCurrentResult(),t)}var ut=class extends rt{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:Ze(t,n.data),hasPreviousPage:Qe(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},dt=class extends qe{#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||ft(),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=Ke({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),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ft(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var pt=class extends de{#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),Ee(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Se(t.mutationKey)!==Se(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??ft();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){D.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 mt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ht(e,t,n){let r=e.slice(0);return r[t]=n,r}var gt=class extends de{#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,D.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||!Ee(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(mt(e,n).forEach(e=>{e.destroy()}),mt(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=Te(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 rt(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ht(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)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},O=e(t(),1),k=n(),_t=O.createContext(void 0),A=e=>{let t=O.useContext(_t);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},vt=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(_t.Provider,{value:e,children:t})),yt=O.createContext(!1),bt=()=>O.useContext(yt);yt.Provider;function xt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var St=O.createContext(xt()),Ct=()=>O.useContext(St),wt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ie(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Tt=e=>{O.useEffect(()=>{e.clearReset()},[e])},Et=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ie(n,[e.error,r])),Dt=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))}},Ot=(e,t)=>e.isLoading&&e.isFetching&&!t,kt=(e,t)=>e?.suspense&&t.isPending,At=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function jt({queries:e,...t},n){let r=A(n),i=bt(),a=Ct(),o=O.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Dt(e);let t=r.getQueryCache().get(e.queryHash);wt(e,a,t)}),Tt(a);let[s]=O.useState(()=>new gt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;O.useSyncExternalStore(O.useCallback(e=>d?s.subscribe(D.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),O.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>kt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&kt(n,e)?At(n,new rt(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&Et({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 Mt(e,t,n){let r=bt(),i=Ct(),a=A(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,Dt(o),wt(o,i,s),Tt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=O.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(O.useSyncExternalStore(O.useCallback(e=>{let t=f?u.subscribe(D.batchCalls(e)):w;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),O.useEffect(()=>{u.setOptions(o)},[o,u]),kt(o,d))throw At(o,u,i);if(Et({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&&!Re.isServer()&&Ot(d,r)&&(l?At(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function j(e,t){return Mt(e,rt,t)}function M(e,t){let n=A(t),[r]=O.useState(()=>new pt(n,e));O.useEffect(()=>{r.setOptions(e)},[r,e]);let i=O.useSyncExternalStore(O.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=O.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&Ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Nt(e,t){return Mt(e,ut,t)}var Pt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ft=/^[\\/]{2}/;function It(e,t){return t+e.replace(/\\/g,`/`)}var Lt=`popstate`;function Rt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function zt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Ht(``,{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:Ut(t)}return Wt(t,n,null,e)}function N(e,t){if(e===!1||e==null)throw Error(t)}function P(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Bt(){return Math.random().toString(36).substring(2,10)}function Vt(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 Ht(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?F(t):t,state:n,key:t&&t.key||r||Bt(),mask:i}}function Ut({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 F(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 Wt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Rt(e)?e:Ht(h.location,e,t);n&&n(r,e),l=u()+1;let d=Vt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Rt(e)?e:Ht(h.location,e,t);n&&n(r,e),l=u();let i=Vt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Gt(i,e)}let h={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(Lt,d),c=e,()=>{i.removeEventListener(Lt,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Gt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),N(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ut(t);return i=i.replace(/ $/,`%20`),!n&&Ft.test(i)&&(i=r+i),new URL(i,r)}function Kt(e,t,n=`/`){return qt(e,t,n,!1)}function qt(e,t,n,r,i){let a=I((typeof t==`string`?F(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Yt(e),s=null,c=pn(a);for(let e=0;s==null&&e<o.length;++e)s=ln(o[e],c,r);return s}function Jt(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 Yt(e){let t=Xt(e);return Qt(t),t}function Xt(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;N(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=L([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(N(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Xt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:sn(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=fn(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 Zt(e.path))a(e,t,!0,n)}),t}function Zt(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=Zt(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 Qt(e){e.sort((e,t)=>e.score===t.score?cn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var $t=/^:[\w-]+$/,en=3,tn=2,nn=1,rn=10,an=-2,on=e=>e===`*`;function sn(e,t){let n=e.split(`/`),r=n.length;return n.some(on)&&(r+=an),t&&(r+=tn),n.filter(e=>!on(e)).reduce((e,t)=>e+($t.test(t)?en:t===``?nn:rn),r)}function cn(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 ln(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?dn(u,l,s.matcher,s.compiledParams):un(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=un({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:L([a,d.pathname]),pathnameBase:Sn(L([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=L([a,d.pathnameBase]))}return o}function un(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fn(e.path,e.caseSensitive,e.end);return dn(e,t,n,r)}function dn(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 fn(e,t=!1,n=!0){P(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 pn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return P(!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 I(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 mn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?F(e):e,a;return n?(n=bn(n),a=n.startsWith(`/`)?hn(n.substring(1),`/`):hn(n,t)):a=t,{pathname:a,search:Cn(r),hash:wn(i)}}function hn(e,t){let n=xn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function gn(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 _n(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function vn(e){let t=_n(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function yn(e,t,n,r=!1){let i;typeof e==`string`?i=F(e):(i={...e},N(!i.pathname||!i.pathname.includes(`?`),gn(`?`,`pathname`,`search`,i)),N(!i.pathname||!i.pathname.includes(`#`),gn(`#`,`pathname`,`hash`,i)),N(!i.search||!i.search.includes(`#`),gn(`#`,`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=mn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var bn=e=>e.replace(/[\\/]{2,}/g,`/`),L=e=>bn(e.join(`/`)),xn=e=>e.replace(/\/+$/,``),Sn=e=>xn(e).replace(/^\/*/,`/`),Cn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,wn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Tn=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 En(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Dn(e){return L(e.map(e=>e.route.path).filter(Boolean))||`/`}var On=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function kn(e,t){let n=e;if(typeof n!=`string`||!Pt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(On)try{let e=new URL(window.location.href),r=Ft.test(n)?new URL(It(n,e.protocol)):new URL(n),a=I(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{P(!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 An=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(An);var jn=[`GET`,...An];new Set(jn);var Mn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Nn(e){try{return Mn.includes(new URL(e).protocol)}catch{return!1}}var R=O.createContext(null);R.displayName=`DataRouter`;var Pn=O.createContext(null);Pn.displayName=`DataRouterState`;var Fn=O.createContext(!1);function In(){return O.useContext(Fn)}var Ln=O.createContext({isTransitioning:!1});Ln.displayName=`ViewTransition`;var Rn=O.createContext(new Map);Rn.displayName=`Fetchers`;var zn=O.createContext(null);zn.displayName=`Await`;var z=O.createContext(null);z.displayName=`Navigation`;var Bn=O.createContext(null);Bn.displayName=`Location`;var B=O.createContext({outlet:null,matches:[],isDataRoute:!1});B.displayName=`Route`;var Vn=O.createContext(null);Vn.displayName=`RouteError`;var Hn=`REACT_ROUTER_ERROR`,Un=`REDIRECT`,Wn=`ROUTE_ERROR_RESPONSE`;function Gn(e){if(e.startsWith(`${Hn}:${Un}:{`))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 Kn(e){if(e.startsWith(`${Hn}:${Wn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Tn(t.status,t.statusText,t.data)}catch{}}function qn(e,{relative:t}={}){N(Jn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=O.useContext(z),{hash:i,pathname:a,search:o}=nr(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:L([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Jn(){return O.useContext(Bn)!=null}function V(){return N(Jn(),`useLocation() may be used only in the context of a <Router> component.`),O.useContext(Bn).location}var Yn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Xn(e){O.useContext(z).static||O.useLayoutEffect(e)}function Zn(){let{isDataRoute:e}=O.useContext(B);return e?xr():Qn()}function Qn(){N(Jn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=O.useContext(R),{basename:t,navigator:n}=O.useContext(z),{matches:r}=O.useContext(B),{pathname:i}=V(),a=JSON.stringify(vn(r)),o=O.useRef(!1);return Xn(()=>{o.current=!0}),O.useCallback((r,s={})=>{if(P(o.current,Yn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=yn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:L([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var $n=O.createContext(null);function er(e){let t=O.useContext(B).outlet;return O.useMemo(()=>t&&O.createElement($n.Provider,{value:e},t),[t,e])}function tr(){let{matches:e}=O.useContext(B);return e[e.length-1]?.params??{}}function nr(e,{relative:t}={}){let{matches:n}=O.useContext(B),{pathname:r}=V(),i=JSON.stringify(vn(n));return O.useMemo(()=>yn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function rr(e,t){return ir(e,t)}function ir(e,t,n){N(Jn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=O.useContext(z),{matches:i}=O.useContext(B),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Cr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (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
|
+
|
|
3
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=V(),d;if(t){let e=typeof t==`string`?F(t):t;N(c===`/`||e.pathname?.startsWith(c),`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 "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Kt(e,{pathname:p});P(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),P(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.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 h=dr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:L([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:L([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?O.createElement(Bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function ar(){let e=br(),t=En(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},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=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,o)}var or=O.createElement(ar,null),sr=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=Kn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:O.createElement(B.Provider,{value:this.props.routeContext},O.createElement(Vn.Provider,{value:e,children:this.props.component}));return this.context?O.createElement(lr,{error:e},t):t}};sr.contextType=Fn;var cr=new WeakMap;function lr({children:e,error:t}){let{basename:n}=O.useContext(z);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Gn(t.digest);if(e){let r=cr.get(t);if(r)throw r;let i=kn(e.location,n),a=i.absoluteURL||i.to;if(Nn(a))throw Error(`Invalid redirect location`);if(On&&!cr.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 cr.set(t,n),n}return O.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function ur({routeContext:e,match:t,children:n}){let r=O.useContext(R);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(B.Provider,{value:e},n)}function dr(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);N(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 o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Dn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||or,o&&(s<0&&c===0?(Cr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?O.createElement(n.route.Component,null):n.route.element?n.route.element:e,O.createElement(ur,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?O.createElement(sr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function fr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pr(e){let t=O.useContext(R);return N(t,fr(e)),t}function mr(e){let t=O.useContext(Pn);return N(t,fr(e)),t}function hr(e){let t=O.useContext(B);return N(t,fr(e)),t}function gr(e){let t=hr(e),n=t.matches[t.matches.length-1];return N(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function _r(){return gr(`useRouteId`)}function vr(){let e=mr(`useNavigation`);return O.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function yr(){let{matches:e,loaderData:t}=mr(`useMatches`);return O.useMemo(()=>e.map(e=>Jt(e,t)),[e,t])}function br(){let e=O.useContext(Vn),t=mr(`useRouteError`),n=gr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function xr(){let{router:e}=pr(`useNavigate`),t=gr(`useNavigate`),n=O.useRef(!1);return Xn(()=>{n.current=!0}),O.useCallback(async(r,i={})=>{P(n.current,Yn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Sr={};function Cr(e,t,n){!t&&!Sr[e]&&(Sr[e]=!0,P(!1,n))}O.memo(wr);function wr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ir(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Tr({to:e,replace:t,state:n,relative:r}){N(Jn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=O.useContext(z);P(!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(B),{pathname:o}=V(),s=Zn(),c=yn(e,vn(a),o,r===`path`),l=JSON.stringify(c);return O.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Er(e){return er(e.context)}function Dr(e){N(!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 Or({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){N(!Jn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=O.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=F(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=O.useMemo(()=>{let e=I(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return P(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:O.createElement(z.Provider,{value:c},O.createElement(Bn.Provider,{children:t,value:h}))}function kr({children:e,location:t}){return rr(Ar(e),t)}O.Component;function Ar(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,Ar(e.props.children,i));return}N(e.type===Dr,`[${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>`),N(!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=Ar(e.props.children,i)),n.push(a)}),n}var jr=`get`,Mr=`application/x-www-form-urlencoded`;function Nr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Pr(e){return Nr(e)&&e.tagName.toLowerCase()===`button`}function Fr(e){return Nr(e)&&e.tagName.toLowerCase()===`form`}function Ir(e){return Nr(e)&&e.tagName.toLowerCase()===`input`}function Lr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Rr(e,t){return e.button===0&&(!t||t===`_self`)&&!Lr(e)}function zr(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 Br(e,t){let n=zr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Vr=null;function Hr(){if(Vr===null)try{new FormData(document.createElement(`form`),0),Vr=!1}catch{Vr=!0}return Vr}var Ur=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Wr(e){return e!=null&&!Ur.has(e)?(P(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Mr}"`),null):e}function Gr(e,t){let n,r,i,a,o;if(Fr(e)){let o=e.getAttribute(`action`);r=o?I(o,t):null,n=e.getAttribute(`method`)||jr,i=Wr(e.getAttribute(`enctype`))||Mr,a=new FormData(e)}else if(Pr(e)||Ir(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?I(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||jr,i=Wr(e.getAttribute(`formenctype`))||Wr(o.getAttribute(`enctype`))||Mr,a=new FormData(o,e),!Hr()){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(Nr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=jr,r=null,i=Mr,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 Kr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},qr=/[&><\u2028\u2029]/g;function Jr(e){return e.replace(qr,e=>Kr[e])}function Yr(e,t){if(e===!1||e==null)throw Error(t)}function Xr(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&&I(i.pathname,t)===`/`?i.pathname=`${xn(t)}/_root.${r}`:i.pathname=`${xn(i.pathname)}.${r}`,i}async function Zr(e,t){if(e.id in t)return t[e.id];try{let n=await y(()=>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 Qr(e){return e!=null&&typeof e.page==`string`}function $r(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 ei(e,t,n){return ai((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Zr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter($r).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ti(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 ni(e,t,{includeHydrateFallback:n}={}){return ri(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 ri(e){return[...new Set(e)]}function ii(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ai(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Qr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ii(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function oi(){let e=O.useContext(R);return Yr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function si(){let e=O.useContext(Pn);return Yr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var ci=O.createContext(void 0);ci.displayName=`FrameworkContext`;function li(){let e=O.useContext(ci);return Yr(e,`You must render this element inside a <HydratedRouter> element`),e}function ui(e,t){let n=O.useContext(ci),[r,i]=O.useState(!1),[a,o]=O.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=O.useRef(null);O.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),O.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:di(s,p),onBlur:di(c,m),onMouseEnter:di(l,p),onMouseLeave:di(u,m),onTouchStart:di(d,p)}]:[a,f,{}]:[!1,f,{}]}function di(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function fi({page:e,...t}){let n=In(),{nonce:r}=li(),{router:i}=oi(),a=O.useMemo(()=>Kt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?O.createElement(mi,{page:e,matches:a,...t}):O.createElement(hi,{page:e,matches:a,...t})):null}function pi(e){let{manifest:t,routeModules:n}=li(),[r,i]=O.useState([]);return O.useEffect(()=>{let r=!1;return ei(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function mi({page:e,matches:t,...n}){let r=V(),{future:i}=li(),{basename:a}=oi(),o=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Xr(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,o.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function hi({page:e,matches:t,...n}){let r=V(),{future:i,manifest:a,routeModules:o}=li(),{basename:s}=oi(),{loaderData:c,matches:l}=si(),u=O.useMemo(()=>ti(e,t,l,a,r,`data`),[e,t,l,a,r]),d=O.useMemo(()=>ti(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Xr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=O.useMemo(()=>ni(d,a),[d,a]),m=pi(d);return O.createElement(O.Fragment,null,f.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>O.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>O.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function gi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}O.Component;var _i=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{_i&&(window.__reactRouterVersion=`7.18.1`)}catch{}function vi({basename:e,children:t,useTransitions:n,window:r}){let i=O.useRef();i.current??=zt({window:r,v5Compat:!0});let a=i.current,[o,s]=O.useState({action:a.action,location:a.location}),c=O.useCallback(e=>{n===!1?s(e):O.startTransition(()=>s(e))},[n]);return O.useLayoutEffect(()=>a.listen(c),[a,c]),O.createElement(Or,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function yi({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=O.useState({action:n.action,location:n.location}),o=O.useCallback(e=>{r===!1?a(e):O.startTransition(()=>a(e))},[r]);return O.useLayoutEffect(()=>n.listen(o),[n,o]),O.createElement(Or,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}yi.displayName=`unstable_HistoryRouter`;var bi=O.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=O.useContext(z),v=typeof l==`string`&&Pt.test(l),y=kn(l,h);l=y.to;let b=qn(l,{relative:r}),x=V(),ee=null;if(o){let e=yn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:L([h,e.pathname])),ee=g.createHref(e)}let[te,ne,re]=ui(n,p),ie=Di(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ae(t){e&&e(t),t.defaultPrevented||ie(t)}let S=!(y.isExternal||i),oe=O.createElement(`a`,{...p,...re,href:(S?ee:void 0)||y.absoluteURL||b,onClick:S?ae:e,ref:gi(m,ne),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return te&&!v?O.createElement(O.Fragment,null,oe,O.createElement(fi,{page:b})):oe});bi.displayName=`Link`;var xi=O.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=nr(a,{relative:c.relative}),d=V(),f=O.useContext(Pn),{navigator:p,basename:m}=O.useContext(z),h=f!=null&&Ri(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=I(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),ee={isActive:b,isPending:x,isTransitioning:h},te=b?e:void 0,ne;ne=typeof n==`function`?n(ee):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let re=typeof i==`function`?i(ee):i;return O.createElement(bi,{...c,"aria-current":te,className:ne,ref:l,style:re,to:a,viewTransition:o},typeof s==`function`?s(ee):s)});xi.displayName=`NavLink`;var Si=O.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=jr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=O.useContext(z),g=ji(),_=Mi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Pt.test(s);return O.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?O.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Si.displayName=`Form`;function Ci({getKey:e,storageKey:t,...n}){let r=O.useContext(ci),{basename:i}=O.useContext(z),a=V(),o=yr();Ii({getKey:e,storageKey:t});let s=O.useMemo(()=>{if(!r||!e)return null;let t=Fi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((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:`(${c})(${Jr(JSON.stringify(t||Ni))}, ${Jr(JSON.stringify(s))})`}})}Ci.displayName=`ScrollRestoration`;function wi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ti(e){let t=O.useContext(R);return N(t,wi(e)),t}function Ei(e){let t=O.useContext(Pn);return N(t,wi(e)),t}function Di(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Zn(),d=V(),f=nr(e,{relative:o});return O.useCallback(p=>{if(Rr(p,t)){p.preventDefault();let t=n===void 0?Ut(d)===Ut(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?O.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Oi(e){P(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(zr(e)),n=O.useRef(!1),r=V(),i=O.useMemo(()=>Br(r.search,n.current?null:t.current),[r.search]),a=Zn();return[i,O.useCallback((e,t)=>{let r=zr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var ki=0,Ai=()=>`__${String(++ki)}__`;function ji(){let{router:e}=Ti(`useSubmit`),{basename:t}=O.useContext(z),n=_r(),r=e.fetch,i=e.navigate;return O.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Gr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Ai();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 Mi(e,{relative:t}={}){let{basename:n}=O.useContext(z),r=O.useContext(B);N(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...nr(e||`.`,{relative:t})},o=V();if(e==null){a.search=o.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:L([n,a.pathname])),Ut(a)}var Ni=`react-router-scroll-positions`,Pi={};function Fi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:I(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Ii({getKey:e,storageKey:t}={}){let{router:n}=Ti(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Ei(`useScrollRestoration`),{basename:a}=O.useContext(z),o=V(),s=yr(),c=vr();O.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Li(O.useCallback(()=>{if(c.state===`idle`){let t=Fi(o,s,a,e);Pi[t]=window.scrollY}try{sessionStorage.setItem(t||Ni,JSON.stringify(Pi))}catch(e){P(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(O.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Ni);e&&(Pi=JSON.parse(e))}catch{}},[t]),O.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Pi,()=>window.scrollY,e?(t,n)=>Fi(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(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{P(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Li(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 Ri(e,{relative:t}={}){let n=O.useContext(Ln);N(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ti(`useViewTransitionState`),i=nr(e,{relative:t});if(!n.isTransitioning)return!1;let a=I(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=I(n.nextLocation.pathname,r)||n.nextLocation.pathname;return un(i.pathname,o)!=null||un(i.pathname,a)!=null}var zi=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],Bi=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Vi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hi(e,t){if(!Vi(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!zi.includes(n)||typeof r!=`string`||!Bi.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 Ui(e){return Hi(e,!1)}function Wi(e,t){if(!Vi(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=Hi(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function H(e){let t=Wi(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return zi.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function Gi(e){let t=H(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Ki(e,t){let n=H(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 qi(e,t,n,r){let i=H(e),a=H(t),o=H(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:Ji(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Ji(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function Yi(e){let t=H(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 zi.filter(e=>n.has(e))}function Xi(e,t){return H(e)?.find(e=>e.provider===t)}function Zi(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Qi(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return $i(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 Qi(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Qi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $i(e){return Qi(e)&&typeof e.id==`string`&&e.id!==``}function ea(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=na(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 ta(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function na(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 ra=Object.freeze({});function ia(){let e=ra,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 aa=`cezar:sid`,oa;function sa(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 ca(){try{let e=localStorage.getItem(aa);if(e)return e;let t=sa();return localStorage.setItem(aa,t),t}catch{return oa??=sa()}}var la=`x-cezar-sid`;function ua(){oa=void 0;try{localStorage.removeItem(aa)}catch{}}var da=null;function fa(e,t,n){try{let r=new URL(e,window.location.origin).pathname;da={method:(t??`GET`).toUpperCase(),path:r,status:n,at:Date.now()}}catch{}}function pa(e=3e3,t=Date.now()){return da&&t-da.at<=e?da:null}var U=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 ma(e){try{return JSON.parse(e)}catch{return}}function ha(e){return typeof e==`string`?e:void 0}function W(e,t,n){let r=ma(n),i=r&&typeof r==`object`?r:{};return new U(e,ha(i.error)??`${e} ${t||`request failed`}`.trim(),{manual:ha(i.manual),command:ha(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var G=ue({fetch:(e,t)=>ba(ga(String(e)),t)});function ga(e){let t=va(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${l()}${t}`:t}var _a=`${a}/p/default`;function va(e){if(v()!==null||!e.startsWith(_a))return e;let t=e.slice(_a.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${a}${t}`:e}var K=e=>({init:{signal:e?.signal}});async function q(e,t){let n=await e.text();if(!e.ok)throw W(e.status,e.statusText,n);let r=ma(n);if(r===void 0)throw new U(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function ya(e,t,n){let r=e.status,i=await q(e,t),a=n.safeParse(i);if(!a.success)throw new U(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function ba(e,t){try{let n=new Headers(t?.headers);n.set(la,ca());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||fa(e,t?.method,r.status),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(fa(e,t?.method,0),new U(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function xa(e,t){return ba(s(e),t)}async function Sa(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await xa(e,{...t,headers:n}),i=await r.text();if(!r.ok)throw W(r.status,r.statusText,i);return i}var J=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function Ca(e){return q(await G.api.v1.health.$get({},K(e)),`/health`)}async function wa(e){return q(await G.api.v1[`star-count`].$get({},K(e)),`/star-count`)}async function Ta(e){return q(await G.api.v1.telemetry.consent.$get({},K(e)),`/telemetry/consent`)}async function Ea(e){return q(await G.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function Da(e,t){return q(await G.api.v1.models.$get({query:{runner:e}},K(t)),`/models`)}async function Oa(e=!1,t){return Gi(await q(await G.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},K(t)),`/providers/status`))}async function ka(e){return q(await G.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:r()}},K(e)),`/launch-key`)}async function Aa(e){return q(await G.api.v1.projects.$get({},K(e)),`/projects`)}async function ja(e,t){return q(await G.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},K(t)),`/fs/browse`)}async function Ma(e){return q(await G.api.v1.p[`:projectId`].runs.$get({param:{projectId:r()}},K(e)),`/runs`)}async function Na(e,t){return q(await G.api.v1.p[`:projectId`].runs.$get({param:{projectId:e}},K(t)),`/runs`)}async function Pa(e){return q(await G.api.v1.workspace[`runs-index`].$get({},K(e)),`/workspace/runs-index`)}async function Fa(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e))}async function Ia(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},K(n)),J(t))}async function La(e,t,n){return ya(await G.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},K(n)),`${J(e)}/history`,o)}async function Ra(e,t){return ya(await G.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),`${J(e)}/history-context`,i)}async function za(e){return q(await G.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:r()}},K(e)),`/ui-state`)}async function Ba(e){return q(await G.api.v1.p[`:projectId`].workflows.$get({param:{projectId:r()}},K(e)),`/workflows`)}async function Va(e){return q(await G.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{}},K(e)),`/skills`)}async function Ha(e){return q(await G.api.v1.p[`:projectId`].skills.$get({param:{projectId:r()},query:{wait:`1`}},K(e)),`/skills`)}async function Ua(){return q(await G.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:r()}}),`/skills/refresh`)}async function Wa(e){return q(await G.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{}},K(e)),`/skills/importable`)}async function Ga(e){return q(await G.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:r()},query:{wait:`1`}},K(e)),`/skills/importable`)}async function Ka(e){return q(await G.api.v1.p[`:projectId`].todos.$get({param:{projectId:r()}},K(e)),`/todos`)}async function qa(e){return q(await G.api.v1.p[`:projectId`].repo.$get({param:{projectId:r()}},K(e)),`/repo`)}async function Ja(e){return q(await G.api.v1.p[`:projectId`].config.$get({param:{projectId:r()}},K(e)),`/config`)}async function Ya(e={}){return q(await G.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:r()}},K(e)),`/agent-config`)}async function Xa(e,t={}){return q(await G.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),`/agent-config/${encodeURIComponent(e)}`)}async function Za(e,t){return q(await G.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Qa(e){return q(await G.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:r()}},K(e)),`/repo/changes`)}async function $a(e){return q(await G.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:r()}},K(e)),`/repo/tree`)}async function eo(e,t){return q(await G.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:r()},query:{path:e}},K(t)),`/repo/files`)}function to(e){return s(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function no(e,t){return q(await G.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:r(),sha:encodeURIComponent(e)},query:{structured:`1`}},K(t)),`/repo/commit/:sha`)}async function ro(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/commits`))}async function io(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:r(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},K(n)),J(e,`/commit/${encodeURIComponent(t)}`))}async function ao(e={},t){return q(await G.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}},K(t)),`/github`)}async function oo(e={},t){return q(await G.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:r()},query:e},K(t)),`/tracker/automation-options`)}async function so(e){return q(await G.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:r()}},K(e)),`/tracker/connection`)}async function co(e){return q(await G.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:r()},json:e}),`/tracker/connection`)}async function lo(){return q(await G.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:r()}}),`/tracker/connection`)}async function uo(e){return q(await G.api.v1.p[`:projectId`].secrets.$get({param:{projectId:r()}},K(e)),`/secrets`)}async function fo(e){return q(await G.api.v1.workspace.secrets.$get({},K(e)),`/workspace/secrets`)}async function po(e){if(!e.ok)throw W(e.status,e.statusText,await e.text())}async function mo(e,t){await po(await G.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:r(),name:e},json:t}))}async function ho(e){await po(await G.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:r(),name:e}}))}async function go(e,t){await po(await G.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function _o(e){await po(await G.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function vo(e){return q(await G.api.v1.p[`:projectId`].e2e.$get({param:{projectId:r()}},K(e)),`/e2e`)}async function yo(e){return q(await G.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:r()},json:e}),`/e2e/setup`)}async function bo(e){return q(await G.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:r()}},K(e)),`/tracker/association`)}async function xo(e,t={},n){return q(await G.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)}},K(n)),`/tracker/candidates`)}async function So(e){return q(await G.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:r()},json:e}),`/tracker/association`)}async function Co(){return q(await G.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:r()}}),`/tracker/association`)}function wo(e){return{expectedScope:e.association?c(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 To(e={},t){return q(await G.api.v1.p[`:projectId`].tracker.$get({param:{projectId:r()},query:wo(e)},K(t)),`/tracker`)}async function Eo(e,t={},n){return q(await G.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:r()},query:{...wo(t),q:e}},K(n)),`/tracker/search`)}async function Do(e,t){return q(await G.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?c(t.association):void 0}},K(t)),`/tracker/${encodeURIComponent(e)}`)}async function Oo(e,t){return q(await G.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:r()},query:{prs:e.join(`,`)}},K(t)),`/github/checks`)}async function ko(e,t,n={},i){return q(await G.api.v1.p[`:projectId`].github.search.$get({param:{projectId:r()},query:{kind:e,q:t,limit:n.limit}},K(i)),`/github/search`)}async function Ao(e,t,n){return q(await G.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(`,`)}:{}}},K(n)),`/github/ref-status`)}async function jo(e,t,n={},i){return q(await G.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:r(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},K(i)),`/github/comments/${e}/${t}`)}async function Mo(e,t={},n){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},K(n)),`/github/prs/${e}/merge-state`)}async function No(e,t){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:r(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Po(e,t={},n){return q(await G.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:r(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},K(n)),`/github/prs/${e}/changes`)}function Fo(e,t){return Sa(J(e,`/diff`),{method:`GET`,signal:t?.signal})}function Io(e,t){return Sa(J(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Lo(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/changes`))}async function Ro(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:r(),id:encodeURIComponent(e)},query:{path:t}},K(n)),`/runs/:id/files`)}function zo(e,t){return s(J(e,`/files?path=${encodeURIComponent(t)}&raw=1`))}async function Bo(e,t){return q(await G.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:r(),groupId:encodeURIComponent(e)}},K(t)),`/groups/${encodeURIComponent(e)}`)}async function Vo(e,t){return q(await G.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function Ho(e,t){return Gi(await q(await G.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function Uo(e,t){return Gi(await q(await G.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Wo(e){let t=`/projects`,n=await xa(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await n.text(),i=ma(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new U(n.status,`the cezar server answered ${t} without a project`):W(n.status,n.statusText,r)}async function Go(e){return q(await G.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function Ko(e){return q(await G.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function qo(e){return ya(await G.api.v1.projects[`github-owners`].$get({},K(e)),`/projects/github-owners`,p)}async function Jo(e){return q(await G.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Yo(e,t){return q(await G.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Xo(e){return q(await G.api.v1.p[`:projectId`].runs.$post({param:{projectId:r()},json:e}),`/runs`)}async function Zo(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/cancel`))}async function Qo(e,t=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{archived:t}}),J(e,`/archive`))}async function $o(e,t=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{pinned:t}}),J(e,`/pin`))}async function es(e,t,n=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n}}),J(t,`/pin`))}async function ts(e,t,n=!0){return q(await G.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n}}),J(t,`/archive`))}async function ns(e,t,n){let r=n?`read`:`unread`;return q(await(n?G.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):G.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),J(t,`/${r}`))}async function rs(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/auto-resume`))}async function is(){return q(await G.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:r()}}),`/runs/archive-finished`)}async function as(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/read`))}async function os(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/unread`))}async function ss(){return q(await G.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:r()}}),`/runs/read-all`)}async function cs(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/finish`))}async function ls(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 q(await G.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:n}),J(e,`/continue`))}async function us(e,t,n={}){return q(await G.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}}}),J(t,`/continue`))}async function ds(e,t={}){return q(await G.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),J(e,`/pr`))}async function fs(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),J(e))}async function ps(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e))}async function ms(e){return q(await G.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function hs(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 q(await G.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 gs(e,t){return q(await G.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:r(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function _s(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/open-in-cli`))}async function vs(e){return q(await G.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:r()}},K(e)),`/open-targets`)}async function ys(e){return q(await G.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:r()},json:{target:e}}),`/open-in`)}async function bs(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:t}}),J(e,`/open-in`))}async function xs(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),J(e,`/open-in`))}async function Ss(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{message:t}}),J(e,`/git/commit`))}async function Cs(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/git/status`))}async function ws(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/git/push`))}async function Ts(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{text:t.text??``,images:t.images??[]}}),J(e,`/messages`))}async function Es(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{text:n.text??``,images:n.images??[]}}),J(t,`/messages`))}async function Ds(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),J(e,`/queued-messages/${encodeURIComponent(t)}`))}async function Os(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),J(e,`/queued-messages/${encodeURIComponent(t)}`))}async function ks(e,t){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:r(),id:encodeURIComponent(e)}},K(t)),J(e,`/drafts`))}var As=56*1024;async function js(e,t,n,i){let a=i?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=As;return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:a}}),J(e,`/drafts/${t}`))}async function Ms(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:r(),id:encodeURIComponent(e),surface:t},json:n}),J(e,`/drafts/${t}/images`))}async function Ns(e,t,n,i){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}},K(i)),J(e,`/drafts/${t}/images/${n}`))}async function Ps(e,t,n){return q(await G.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:r(),id:encodeURIComponent(e),surface:t,imageId:n}}),J(e,`/drafts/${t}/images/${n}`))}async function Fs(e){return q(await G.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:r()},json:e}),`/repo/branch`)}async function Is(e){return q(await G.api.v1.p[`:projectId`].plan.$post({param:{projectId:r()},json:{task:e}}),`/plan`)}async function Ls(e){return q(await G.api.v1.p[`:projectId`].automations.$get({param:{projectId:r()}},K(e)),`/automations`)}async function Rs(e){return q(await G.api.v1.p[`:projectId`].automations.$post({param:{projectId:r()},json:e}),`/automations`)}async function zs(e,t){return q(await G.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:r(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function Bs(e,t){let n={projectId:r(),id:encodeURIComponent(e)},i=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return q(t?await G.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await G.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),i)}async function Vs(e,t){return q(await G.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:r(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function Hs(e,t){return q(await G.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:r()},query:{automationId:e}},K(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function Us(e){return q(await G.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:r(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function Ws(e){return q(await G.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:r(),id:encodeURIComponent(e)}}),`/automations/${encodeURIComponent(e)}/run`)}async function Gs(e){let t=await G.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:r(),id:encodeURIComponent(e)}});if(!t.ok)throw W(t.status,t.statusText,await t.text())}async function Ks(e,t){return q(await G.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},K(t)),`/workspace/automation-templates`)}async function qs(e){return q(await G.api.v1.p[`:projectId`].workflows.$post({param:{projectId:r()},json:e}),`/workflows`)}async function Js(e){return q(await G.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:r()}},K(e)),`/workflows/nodes`)}async function Ys(e){return q(await G.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:r()},json:{graph:e}}),`/workflows/validate`)}async function Xs(e){return q(await G.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:r()},json:e}),`/workflows/graph`)}async function Zs(e){return q(await G.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:r()},json:{yaml:e}}),`/workflows/parse`)}async function Qs(e){return q(await G.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:r(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function $s(e,t=r()){return q(await G.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function ec(e){return q(await G.api.v1.workspace[`ui-state`].$get({},K(e)),`/workspace/ui-state`)}async function tc(e,t={}){return q(await G.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function nc(e){let t=await q(await G.api.v1.workspace.config.$get({},K(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?d(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 rc(e){let t=new FormData;t.set(`file`,e);let n=await xa(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await n.text();if(!n.ok)throw W(n.status,n.statusText,r);let i=ma(r),a=_.safeParse(i);if(!a.success)throw new U(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?d(a.data.logoUrl):null}async function ic(){let e=await xa(`/workspace/branding-logo`,{method:`DELETE`}),t=await e.text();if(!e.ok)throw W(e.status,e.statusText,t);let n=_.safeParse(ma(t));if(!n.success)throw new U(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?d(n.data.logoUrl):null}async function ac(e){return q(await G.api.v1.workspace[`host-usage`].$get({},K(e)),`/workspace/host-usage`)}async function oc(e){let t=await q(await G.api.v1.workspace[`agent-profiles`].$get({},K(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 sc(e){return q(await G.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function cc(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:t?.refresh?{refresh:`1`}:{}},K(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function lc(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},K(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function uc(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function dc(e){return q(await G.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function fc(e,t){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function pc(e){return q(await G.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function mc(e,t){return q(await G.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},K(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function hc(e){return q(await G.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function gc(e){return q(await G.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function _c(e){return q(await G.api.v1.workspace[`self-update`].$get({},K(e)),`/workspace/self-update`)}async function vc(){return q(await G.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function yc(e){return q(await G.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},K(e)),`/workspace/self-update/development`)}async function bc(e){return q(await G.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function xc(e){return q(await G.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function Sc(e){return q(await G.api.v1.workspace.config.$put({json:e}),`/workspace/config`)}async function Cc(e){return q(await G.api.v1.p[`:projectId`].config.$put({param:{projectId:r()},json:e}),`/config`)}async function wc(e){return q(await G.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:r()}},K(e)),`/worktrees`)}async function Tc(){return q(await G.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:r()},json:{}}),`/worktrees/reclaim`)}async function Ec(e){return q(await G.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:r(),id:encodeURIComponent(e)}}),J(e,`/remove-worktree`))}async function Dc(e,t,n){return h.parse(await q(await G.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function Oc(e,t,n,r){return m.parse(await q(await G.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 kc(e,t,n){return m.parse(await q(await G.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var Ac={projectId:null,apiBase:a},jc=(0,O.createContext)(Ac);function Mc(){return(0,O.useContext)(jc)}function Nc({projectId:e,children:t}){v()!==e&&u(e),(0,O.useLayoutEffect)(()=>{u(e)},[e]),(0,O.useLayoutEffect)(()=>()=>u(null),[]);let n=(0,O.useMemo)(()=>e===null?Ac:{projectId:e,apiBase:`${a}/p/${encodeURIComponent(e)}`},[e]);return(0,k.jsx)(jc.Provider,{value:n,children:t})}var Pc={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`}},Fc={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function Ic(e){return typeof e==`string`&&Object.hasOwn(Pc,e)}function Lc(e){return e!==void 0&&Ic(e)?Pc[e]:void 0}var Rc={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function zc(e){return!1}function Bc(e){return!1}function Vc(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 Hc(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function Uc(e){return e.status===`waiting`||e.status===`review`||Hc(e)}function Wc(e){return zc(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:Hc(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:Vc(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`}:Bc(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 Gc(e){return Rc[Wc(e).bucket]<=Rc.waiting}var Kc=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],qc={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},Jc=3,Yc=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Jc:Hc(e)?qc.waiting??0:qc[e.status]??9;function Xc(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:Uc(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function Zc(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Qc(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 $c(e,t){return t!==void 0&&Qc(e).ref===t}function el(e){return e.title.replace(/ \([A-C]\)$/,``)}function tl(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]))}function nl(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=Yc(e)-Yc(n);if(r!==0)return r;if(Yc(e)===Jc&&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):n.createdAt.localeCompare(e.createdAt)})}function rl(e,t){let n=tl(e),r=nl(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(Xc(e,t),{kind:`group`,groupId:e.groupId,title:el(e),members:n});continue}}a(Xc(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return Kc.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function il(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 al(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,Uc(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var ol=new Set([`running`,`waiting`]),sl=new Set([`done`,`failed`,`review`,`cancelled`]),cl=new Set([`done`,`failed`,`cancelled`]);function ll(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 ul(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function dl(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 fl(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 pl(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[Zc(e),e.branch??``,e.workflow,fl(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function ml(e){return e.filter(e=>!e.archived&&cl.has(e.status)&&!Hc(e)).length}function hl(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function gl(e){if(e.pullRequestUrl){let t=Number(Tl(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 _l(e){return vl(e)[0]?.url??yl(e)[0]}function vl(e,t){if(!e.prRefs?.length)return yl(e).map(e=>({number:Number(Tl(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??Cl(`PR`,e.number,t),origin:e.origin}))}function yl(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 bl(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t))return`${t}/issues/${n}`}function xl(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 Sl(e,t){let n=e.prRefs?.length?vl(e,t).map(e=>({number:e.number,url:e.url})):yl(e).map(e=>({url:e,number:Number(Tl(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:e.prNumber},{kind:`Issue`,url:bl(e,t)},{kind:`Issue`,number:e.issueNumber}],a=new Set,o=[];for(let e of i){let n=e.url?Number(Tl(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??Cl(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 Cl(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function wl(e){return Sl(e)[0]}function Tl(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function El(e,t){let n=ol.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:ll(n.rssBytes),kind:`live`}};let r=ll(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 Dl(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=>sl.has(e.status))?[]:[{groupId:e,title:el(n),count:t.length}]})}function Ol(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 kl(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 Al(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 jl=`/api/v1/ws`,Ml=3e3,Nl=1e3,Pl=7e4,Fl=0,Il=1;function Ll(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},Pl)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${jl}`,l=e=>{r?.readyState===Il&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===Fl||r.readyState===Il))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()},Ml)))}),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)},Nl))))}}}}var Rl=null;function zl(e,t,n){return Rl??=Ll(),Rl.subscribe(e,t,n)}var Y={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],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 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`]}},Bl=6e4;function Vl(){return j({queryKey:Y.secrets.list(),queryFn:({signal:e})=>uo({signal:e})})}function Hl(){return j({queryKey:X.secrets,queryFn:({signal:e})=>fo({signal:e})})}function Ul(){return j({queryKey:Y.e2e.status(),queryFn:({signal:e})=>vo({signal:e})})}function Wl(){return j({queryKey:Y.tracker.connection(),queryFn:({signal:e})=>so({signal:e})})}function Gl(){return j({queryKey:Y.tracker.association(),queryFn:({signal:e})=>bo({signal:e})})}function Kl(e,t,n){return Nt({queryKey:Y.tracker.candidates(e,t),staleTime:Bl,queryFn:({pageParam:n,signal:r})=>xo(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 ql=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Jl(e,t,n=!0){let i=t.query.trim(),a=A(),o=e?Y.tracker.items(e,{...t,query:i}):[`tracker`,r(),`items`,`unassociated`];return{...Nt({queryKey:o,staleTime:1/0,queryFn:({pageParam:n,signal:r})=>i?Eo(i,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:r}):To({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 Eo(i,r,{signal:n}):await To(r,{signal:n});if(!a.available)throw new ql(a);return a}})}catch{}}}}function Yl(e,t){return j({staleTime:Bl,queryKey:e&&t?Y.tracker.detail(e,t):[`tracker`,r(),`detail`,`disabled`],queryFn:({signal:n})=>Do(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var X={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)=>[...X.fsBrowseRoot,e,t]};function Z(e,t=!0){return j({queryKey:X.models(e),queryFn:({signal:t})=>f(e)?Da(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&f(e)})}function Xl(e=!0){let t=Z(`claude`,e),n=Z(`codex`,e),r=Z(`opencode`,e),i=Z(`cursor`,e),a=Z(`pi`,e);return{claude:t,codex:n,junie:Z(`junie`,e),opencode:r,cursor:i,pi:a,copilot:Z(`copilot`,e)}}function Zl(){let e=A();return j({queryKey:X.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(X.providerStatus),r=await Oa(!1,{signal:t});return qi(n,e.getQueryData(X.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Ql(){let e=A();return M({mutationFn:()=>Oa(!0),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(X.providerStatus,e=>qi(r,e,t))})}function $l(){let e=A();return M({mutationFn:({provider:e,authFailureId:t})=>Uo(e,t),onMutate:()=>e.getQueryData(X.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(X.providerStatus,e=>qi(r,e,t,n.authFailureId))}})}function eu(){return j({queryKey:X.projects,queryFn:({signal:e})=>Aa({signal:e})})}function tu(e,t=!1){return j({queryKey:X.fsBrowse(e,t),queryFn:({signal:n})=>ja(e??void 0,{signal:n,showHidden:t}),retry:!1})}function nu(){let e=A();return M({mutationFn:e=>Wo(e),onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function ru(){let e=A();return M({mutationFn:e=>Jo(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:X.projects})}})}function iu(){let e=A();return M({mutationFn:e=>{let{id:t,...n}=e;return Yo(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:X.projects});let r=e.getQueryData(X.projects);return e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?au(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(X.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(X.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:X.projects})})}function au(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?[]:Al(s);return c.length>0&&(a.tags=c),a}function ou(e){let t=A();return M({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:X.agentProfiles}),t.invalidateQueries({queryKey:X.projects})])}})}function su(){return ou(e=>sc(e))}function cu(){return ou(e=>{let{id:t,...n}=e;return fc(t,n)})}function lu(){return ou(e=>pc(e))}function uu(){return ou(e=>dc(e))}function du(e,t){return j({queryKey:X.agentAccountDetails(e),queryFn:({signal:t})=>lc(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function fu(e,t){return j({queryKey:X.agentAccountStatus(e),queryFn:({signal:t})=>cc(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function pu(){let e=A();return M({mutationFn:({provider:e,profileId:t})=>Vo(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:X.agentProfiles}),e.invalidateQueries({queryKey:X.providerStatus})])}})}function mu(){let e=A();return M({mutationFn:e=>cc(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(X.agentAccountStatus(n),t),e.invalidateQueries({queryKey:X.agentProfiles})}})}function hu(){return M({mutationFn:e=>{let{routeId:t,...n}=e;return uc(t,n)},retry:!1})}function gu(){let e=A();return M({mutationFn:e=>Go(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function _u(){let e=A();return M({mutationFn:e=>Ko(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:X.projects})})}function vu(){return j({queryKey:X.githubOwners,queryFn:({signal:e})=>qo({signal:e}),staleTime:5*6e4,retry:!1})}function yu(){let e=A();(0,O.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(Y.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=zl(`health`,t=>{e.setQueryData(Y.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function bu(){return j({queryKey:Y.health,queryFn:({signal:e})=>Ca({signal:e})})}function xu(){let e=bu().data,t=eu().data?.projects,{projectId:n}=Mc(),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?hl(e?.repo?.remote):void 0}function Su(){return j({queryKey:Y.openTargets,queryFn:({signal:e})=>vs({signal:e}),staleTime:5*6e4})}function Cu(e){return j({queryKey:Y.runs.list(),queryFn:({signal:e})=>Ma({signal:e}),select:e})}function wu(e=!0,t){return j({queryKey:X.runsIndex,queryFn:({signal:e})=>Pa({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:t}})}function Tu(e,t=!0,n=!1,r){return j({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>Na(e,{signal:t}),enabled:t,select:r})}function Eu(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return Tu(i?`default`:r??`default`,!0,i,n)}function Du(e){return{queryKey:Y.runs.detail(e),queryFn:({signal:t})=>Fa(e,{signal:t})}}function Ou(e){return j({...Du(e??``),enabled:!!e})}function ku(e,t,n=!0){return j({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ia(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function Au(e){return j({queryKey:Y.runs.diff(e??``),queryFn:({signal:t})=>Fo(e,{signal:t}),enabled:!!e})}function ju(e,t=!1){return j({queryKey:Y.runs.changes(e??``),queryFn:({signal:t})=>Lo(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function Mu(e,t,n=!1){return j({queryKey:Y.runs.gitStatus(e),queryFn:({signal:t})=>Cs(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function Nu(e,t){return j({queryKey:Y.runs.file(e??``,t??``),queryFn:({signal:n})=>Ro(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Pu(e){return j({queryKey:Y.groups.detail(e??``),queryFn:({signal:t})=>Bo(e,{signal:t}),enabled:!!e})}function Fu(e,t=!1){return j({queryKey:Y.runs.commits(e??``),queryFn:({signal:t})=>ro(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function Iu(e,t){return j({queryKey:Y.runs.commit(e??``,t??``),queryFn:({signal:n})=>io(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Lu(e,t=!0){return j({queryKey:Y.runs.handoff(e??``),queryFn:({signal:t})=>Io(e,{signal:t}),enabled:!!e&&t})}function Ru(e){return j({queryKey:Y.runs.drafts(e??``),queryFn:({signal:t})=>ks(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function zu(e=!0){return j({queryKey:Y.todos,queryFn:({signal:e})=>Ka({signal:e}),enabled:e})}function Bu(){return j({queryKey:Y.workflowNodes,queryFn:({signal:e})=>Js({signal:e}),staleTime:1/0})}function Vu(e={}){return j({queryKey:Y.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>Ba({signal:e})})}function Hu(e=!0){let t=A(),n=Y.skills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>Va({signal:e}),enabled:e}),a=j({queryKey:Y.skillsReady,queryFn:({signal:e})=>Ha({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Uu(e=!0){let t=A(),n=Y.importableSkills,r=n[0],i=j({queryKey:n,queryFn:({signal:e})=>Wa({signal:e}),enabled:e}),a=j({queryKey:Y.importableSkillsReady,queryFn:({signal:e})=>Ga({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,O.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function Wu(){return j({queryKey:Y.launchKey,queryFn:({signal:e})=>ka({signal:e}),staleTime:1/0})}function Gu(){return j({queryKey:Y.repo,queryFn:({signal:e})=>qa({signal:e})})}function Ku(){return j({queryKey:Y.repoChanges,queryFn:({signal:e})=>Qa({signal:e}),retry:!1})}function qu(){return j({queryKey:Y.repoTree,queryFn:({signal:e})=>$a({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ju(e){return j({queryKey:Y.repoFile(e??``),queryFn:({signal:t})=>eo(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function Yu(e){return j({queryKey:Y.repoCommit(e??``),queryFn:({signal:t})=>no(e,{signal:t}),enabled:!!e,retry:!1})}function Xu(){return j({queryKey:Y.config,queryFn:({signal:e})=>Ja({signal:e})})}function Zu(){return j({queryKey:Y.worktrees,queryFn:({signal:e})=>wc({signal:e})})}function Qu(){return j({queryKey:Y.uiState,queryFn:({signal:e})=>za({signal:e})})}function $u(){return j({queryKey:Y.agentConfig,queryFn:({signal:e})=>Ya({signal:e})})}function ed(e){return j({queryKey:Y.agentConfigFile(e??``),queryFn:({signal:t})=>Xa(e,{signal:t}),enabled:e!==null})}function td(e){let t=A(),n=Y.agentConfig,r=Y.agentConfigFile(e);return M({mutationFn:t=>Za(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function nd(){return j({queryKey:X.uiState,queryFn:({signal:e})=>ec({signal:e})})}function rd(){return j({queryKey:X.config,queryFn:({signal:e})=>nc({signal:e})})}function id(){return j({queryKey:X.agentProfiles,queryFn:({signal:e})=>oc({signal:e})})}var ad=1e4;function od(e=!0){return j({queryKey:X.starCount,queryFn:({signal:e})=>wa({signal:e}),enabled:e,staleTime:ad,refetchInterval:ad,retry:!1,refetchOnMount:!1})}function sd(){return j({queryKey:X.telemetryConsent,queryFn:({signal:e})=>Ta({signal:e}),staleTime:1/0,retry:!1})}function cd(e,t=!0){return j({queryKey:X.skillsUpdate(e),queryFn:({signal:t})=>mc(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 ld(e=!0){return j({queryKey:X.selfUpdate,queryFn:({signal:e})=>_c({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`&&1e3})}function ud(e=!0){return j({queryKey:X.selfUpdateDevelopment,queryFn:({signal:e})=>yc({signal:e}),enabled:e,staleTime:3e4})}function dd(){let e=A();return M({mutationFn:()=>yc({refresh:!0}),onSuccess:t=>e.setQueryData(X.selfUpdateDevelopment,t)})}function fd(){let e=A();return M({mutationFn:()=>vc(),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function pd(){let e=A();return M({mutationFn:e=>bc(e),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function md(){let e=A();return M({mutationFn:e=>xc(e),onSuccess:t=>e.setQueryData(X.selfUpdate,t)})}function hd(e){let t=A();return M({mutationFn:t=>fs(e,t),onSuccess:e=>{gd(t,e),t.invalidateQueries({queryKey:Y.runs.all})}})}function gd(e,t){e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t.id?na(e,t):e)),e.setQueryData(Y.runs.detail(t.id),e=>e?na(e,t):t),_d(e)}function _d(e){e.invalidateQueries({queryKey:X.runsIndex})}function vd(){let e=A();return M({mutationFn:e=>as(e),onMutate:async t=>{await e.cancelQueries({queryKey:Y.runs.list()}),await e.cancelQueries({queryKey:Y.runs.detail(t)});let n=e.getQueryData(Y.runs.list()),r=e.getQueryData(Y.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(Y.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(Y.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(Y.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(Y.runs.list(),e=>e?.map(n)),e.setQueryData(Y.runs.detail(t.id),e=>e?n(e):t),_d(e)}})}function yd(){let e=A();return M({mutationFn:e=>os(e),onMutate:async t=>{await e.cancelQueries({queryKey:Y.runs.list()}),await e.cancelQueries({queryKey:Y.runs.detail(t)});let n=e.getQueryData(Y.runs.list()),r=e.getQueryData(Y.runs.detail(t));return e.setQueryData(Y.runs.list(),e=>e?.map(e=>e.id===t?bd(e):e)),e.setQueryData(Y.runs.detail(t),e=>e&&bd(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(Y.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(Y.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?bd(e):e;e.setQueryData(Y.runs.list(),e=>e?.map(n)),e.setQueryData(Y.runs.detail(t.id),e=>e?n(e):t),_d(e)}})}function bd(e){let{seenAt:t,...n}=e;return n}function xd(e,t){let n=A();return M({mutationFn:({id:t,pinned:n})=>e===void 0?$o(t,n):es(e,t,n),onSuccess:()=>n.invalidateQueries({queryKey:t===void 0?Y.runs.all:[t,`runs`]})})}function Sd(e,t){let n=A();return M({mutationFn:n=>t===void 0?Ts(e,n):Es(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:Y.runs.all}),onError:e=>{e instanceof U&&e.status===409&&n.invalidateQueries({queryKey:Y.runs.all})}})}function Cd(e,t){let n=A();return M({mutationFn:(n={})=>t===void 0?ls(e,n):us(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:Y.runs.all})})}function wd(e){let t=A();return M({mutationFn:({msgId:t,message:n})=>Ds(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function Td(e){let t=A();return M({mutationFn:t=>Os(e,t),onSuccess:()=>t.invalidateQueries({queryKey:Y.runs.all})})}function Ed(e={},t=!0){return j({queryKey:Y.github(e),queryFn:({signal:t})=>ao({limit:e.limit},{signal:t}),enabled:t})}function Dd(e=50,t=!0){return Nt({queryKey:Y.githubPages(e),queryFn:({pageParam:t,signal:n})=>ao({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 Od(e,t=!0){return j({queryKey:Y.githubChecks(e),queryFn:({signal:t})=>Oo(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function kd(e,t,n=!0){return j({queryKey:Y.githubSearch(e,t),queryFn:({signal:n})=>ko(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Ad=100;function jd(e){return[...e].sort((e,t)=>t-e).slice(0,Ad).sort((e,t)=>e-t)}var Q=new Map(Ld()),Md=1e3;function Nd(e,t){if(Q.get(e)!==t){for(Q.delete(e),Q.set(e,t);Q.size>Md;){let e=Q.keys().next().value;if(e===void 0)break;Q.delete(e)}Bd()}}var $=new Set(Rd());function Pd(e,t){if($.has(e)!==t){if(t)for($.add(e);$.size>Md;){let e=$.values().next().value;if(e===void 0)break;$.delete(e)}else $.delete(e);Bd()}}var Fd=`cez.reference-statuses.v1`,Id=`cez.reference-conflicts.v1`;function Ld(){try{let e=globalThis.sessionStorage?.getItem(Fd);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`&&Ic(e[1])):[]}catch{return[]}}function Rd(){try{let e=globalThis.sessionStorage?.getItem(Id);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var zd;function Bd(){zd===void 0&&(zd=setTimeout(()=>{zd=void 0;try{globalThis.sessionStorage?.setItem(Fd,JSON.stringify([...Q])),globalThis.sessionStorage?.setItem(Id,JSON.stringify([...$]))}catch{}},250))}function Vd(){let e=Mc(),t=bu();return e.projectId??t.data?.bootProject}function Hd(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Nd(Gd({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Nd(Gd({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Ud=5*6e4;function Wd(e){return e?e.recheckAfterMs:Ud}var Gd=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Kd(e,t=!0){let n=(0,O.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:jd(t.prs),issues:jd(t.issues)}))},[e.map(Gd).sort().join(`|`)]),r=jt({queries:n.map(e=>({queryKey:Y.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Ao(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Wd(e.state.data)??1/0,refetchInterval:e=>Wd(e.state.data)??!1,refetchOnWindowFocus:!0}))}),i=(0,O.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=Gd(n),i=Q.get(r),a=$.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;Nd(r,t),i!==void 0&&Pd(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,O.useCallback)(e=>{let t=Gd(e),n=i.get(t);if(n)return n;let r=Q.get(t);return{state:`idle`,...r?{status:r}:{},...$.has(t)?{conflicting:!0}:{}}},[i])}function qd(e,t,n=!0){return j({queryKey:Y.githubComments(e,t),queryFn:({signal:n})=>jo(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Jd(e){return j({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Po(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}var Yd=5e3,Xd=200,Zd=[],Qd=1,$d=new Set,ef=new Set;function tf(e){Zd=e;for(let e of $d)e()}function nf(e){return $d.add(e),()=>$d.delete(e)}var rf=new Set;function af(e){return rf.add(e),()=>rf.delete(e)}function of(e,t){let n=setTimeout(()=>{ef.delete(n),e()},t);ef.add(n)}function sf(e,t={}){let n={id:Qd++,message:e,tone:t.tone??`default`,...t.action?{action:t.action}:{},exiting:!1},r=t.durationMs??Yd;if(tf([...Zd,n]),n.tone===`danger`)for(let t of rf)try{t(e)}catch{}of(()=>{tf(Zd.map(e=>e.id===n.id?{...e,exiting:!0}:e)),of(()=>tf(Zd.filter(e=>e.id!==n.id)),Xd)},r)}function cf(){let e=(0,O.useSyncExternalStore)(nf,()=>Zd);return e.length===0?null:(0,k.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,k.jsxs)(`div`,{role:`status`,"data-slot":`toast`,"data-tone":e.tone,"data-state":e.exiting?`closed`:`open`,className:g(`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,k.jsxs)(k.Fragment,{children:[` `,(0,k.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 lf=/^\/p\/([^/]+)(?=\/|$)/;function uf(e){let t=lf.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function df(e){let t=lf.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function ff(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function pf(e,t){return e===null?t:typeof t==`string`?ff(e,t):t.pathname===void 0?t:{...t,pathname:ff(e,t.pathname)}}function mf(){let{projectId:e}=Mc(),{pathname:t}=V();return e??uf(t)}function hf(){let e=mf();return(0,O.useCallback)(t=>pf(e,t),[e])}function gf(e){let{pathname:t}=V();return(0,O.useMemo)(()=>un(e,df(t)),[e,t])}function _f({to:e,...t}){let n=hf();return(0,k.jsx)(bi,{...t,to:n(e)})}function vf({to:e,...t}){let n=hf();return(0,k.jsx)(xi,{...t,to:n(e)})}function yf({to:e,...t}){let n=hf();return(0,k.jsx)(Tr,{...t,to:n(e)})}function bf(){let e=Zn(),t=hf();return(0,O.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{Tu as $,tr as $i,hc as $n,tc as $r,Vu as $t,Ul as A,ca as Ai,$c as An,oo as Ar,Z as At,Pu as B,Gi as Bi,Fc as Bn,_s as Br,cd as Bt,md as C,q as Ci,El as Cn,ka as Cr,Fu as Ct,Cd as D,pa as Di,el as Dn,La as Dr,Mu as Dt,pu as E,Ys as Ei,rl as En,Ro as Er,Nu as Et,qd as F,na as Fi,Vc as Fn,ss as Fr,ld as Ft,vd as G,xi as Gi,gc as Gn,Is as Gr,Kl as Gt,yu as H,Yi as Hi,Nc as Hn,Zs as Hr,sd as Ht,Dd as I,Zi as Ii,Wc as In,No as Ir,ud as It,Su as J,Dr as Ji,Qo as Jn,Cc as Jr,Jl as Jt,yd as K,Tr as Ki,is as Kn,Ms as Kr,Wl as Kt,vu as L,zi as Li,Hc as Ln,ys as Lr,Sd as Lt,tu as M,ta as Mi,nl as Mn,To as Mr,Eu as Mt,Ed as N,ea as Ni,Qc as Nn,ac as Nr,wu as Nt,su as O,la as Oi,al as On,Ra as Or,Lu as Ot,Od as P,ia as Pi,Rc as Pn,ec as Pr,uu as Pt,ku as Q,Zn as Qi,Vs as Qn,Sc as Qr,Bu as Qt,Jd as R,Ki as Ri,Uc as Rn,xs as Rr,pd as Rt,id as S,hs as Si,Sl as Sn,Ca as Sr,Iu as St,Xu as T,rc as Ti,il as Tn,ks as Tr,Ru as Tt,Uu as U,vi as Ui,Mc as Un,fs as Ur,zu as Ut,bu as V,Xi as Vi,Lc as Vn,Dc as Vr,od as Vt,Wu as W,bi as Wi,U as Wn,gs as Wr,Gl as Wt,xd as X,un as Xi,Zo as Xn,Ea as Xr,cu as Xt,hd as Y,kr as Yi,rs as Yn,js as Yr,Qu as Yt,xu as Z,V as Zi,G as Zn,$s as Zr,iu as Zt,Du as _,T as _a,go as _i,xl as _n,Ls as _r,Ju as _t,pf as a,A as aa,Ec as ai,gd as an,Fs as ar,Vd as at,$u as b,de as ba,Ho as bi,_l as bn,Po as br,Ou as bt,bf as c,He as ca,_o as ci,kl as cn,qs as cr,fd as ct,af as d,Se as da,Ws as di,pl as dn,Ps as dr,lu as dt,Oi as ea,Oc as ei,rd as en,Co as er,Vl as et,sf as f,xe as fa,zo as fi,ml as fn,Qs as fr,ru as ft,Hd as g,Ce as ga,Xs as gi,Tl as gn,Ks as gr,Yu as gt,Y as h,w as ha,co as hi,gl as hn,Hs as hr,Ku as ht,uf as i,vt as ia,ho as ii,X as in,Rs as ir,mu as it,wd as j,ra as ji,Zc as jn,Do as jr,Cu as jt,_u as k,ua as ki,tl as kn,_c as kr,Xl as kt,gf as l,D as la,to as li,sl as ln,Gs as lr,dd as lt,ql as m,ye as ma,So as mi,ll as mn,cs as mr,Gu as mt,vf as n,M as na,Ua as ni,nd as nn,Vo as nr,Zl as nt,df as o,dt as oa,ms as oi,zl as on,Xo as or,Kd as ot,Bl as p,be as pa,mo as pi,ul as pn,ic as pr,Td as pt,hu as q,Er as qi,ts as qn,ws as qr,Yl as qt,yf as r,j as ra,kc as ri,Zu as rn,ls as rr,td as rt,mf as s,$e as sa,lo as si,Ol as sn,ds as sr,Ql as st,_f as t,Nt as ta,Tc as ti,Hl as tn,Ss as tr,eu as tt,cf as u,ge as ua,Us as ui,Dl as un,ps as ur,nu as ut,du as v,Pe as va,Bs as vi,dl as vn,ao as vr,qu as vt,gu as w,zs as wi,fl as wn,Ns as wr,Au as wt,ed as x,yo as xi,wl as xn,Mo as xr,ju as xt,fu as y,fe as ya,ns as yi,bl as yn,jo as yr,$l as yt,kd as z,Ui as zi,Gc as zn,bs as zr,Hu as zt};
|
|
@@ -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{Bn as r,Vn as i,ot as a}from"./project-router-CWMOKp_H.js";import{A as o,C as s,D as c,E as l,F as u,N as d,S as f,T as p,_ as m,a as h,c as g,d as _,g as v,h as y,i as b,l as x,m as S,o as C,r as w,s as T,t as E,u as D,v as ee,x as te,y as ne}from"./button-BNnH7COh.js";import{a as O,c as re,f as ie,l as ae,o as oe,s as se}from"./tooltip-BVqBAGNb.js";import{n as k,t as ce}from"./x-HaVPcg_B.js";import{n as le,r as ue,t as de}from"./triangle-alert-CP3Xp0FU.js";import{i as fe}from"./token-metrics-BcPjL36-.js";var A=u(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),j=u(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),M=u(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),N=u(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),pe=u(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),me=u(`message-square-warning`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),he=u(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),P=e(t(),1),F=n(),I=`Popover`,[L,ge]=l(I,[ae]),R=ae(),[_e,z]=L(I),B=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,c=R(t),l=P.useRef(null),[u,d]=P.useState(!1),[f,p]=s({prop:r,defaultProp:i??!1,onChange:a,caller:I});return(0,F.jsx)(re,{...c,children:(0,F.jsx)(_e,{scope:t,contentId:te(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:P.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:P.useCallback(()=>d(!0),[]),onCustomAnchorRemove:P.useCallback(()=>d(!1),[]),modal:o,children:n})})};B.displayName=I;var V=`PopoverAnchor`,H=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(V,n),a=R(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return P.useEffect(()=>(o(),()=>s()),[o,s]),(0,F.jsx)(O,{...a,...r,ref:t})});H.displayName=V;var U=`PopoverTrigger`,W=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(U,n),a=R(n),o=d(t,i.triggerRef),s=(0,F.jsx)(c.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Z(i.open),...r,ref:o,onClick:p(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(O,{asChild:!0,...a,children:s})});W.displayName=U;var G=`PopoverPortal`,[ve,ye]=L(G,{forceMount:void 0}),K=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=z(G,t);return(0,F.jsx)(ve,{scope:t,forceMount:n,children:(0,F.jsx)(f,{present:n||a.open,children:(0,F.jsx)(m,{asChild:!0,container:i,children:r})})})};K.displayName=G;var q=`PopoverContent`,J=P.forwardRef((e,t)=>{let n=ye(q,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=z(q,e.__scopePopover);return(0,F.jsx)(f,{present:r||a.open,children:a.modal?(0,F.jsx)(xe,{...i,ref:t}):(0,F.jsx)(Se,{...i,ref:t})})});J.displayName=q;var be=o(`PopoverContent.RemoveScroll`),xe=P.forwardRef((e,t)=>{let n=z(q,e.__scopePopover),r=P.useRef(null),i=d(t,r),a=P.useRef(!1);return P.useEffect(()=>{let e=r.current;if(e)return S(e)},[]),(0,F.jsx)(y,{as:be,allowPinchZoom:!0,children:(0,F.jsx)(Y,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:p(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Se=P.forwardRef((e,t)=>{let n=z(q,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(Y,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Y=P.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=z(q,n),p=R(n);return v(),(0,F.jsx)(ee,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(ne,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,F.jsx)(se,{"data-state":Z(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),X=`PopoverClose`,Ce=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(X,n);return(0,F.jsx)(c.button,{type:`button`,...r,ref:t,onClick:p(e.onClick,()=>i.onOpenChange(!1))})});Ce.displayName=X;var we=`PopoverArrow`,Te=P.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=R(n);return(0,F.jsx)(oe,{...i,...r,ref:t})});Te.displayName=we;function Z(e){return e?`open`:`closed`}var Ee=B,De=H,Oe=W,ke=K,Ae=J;function je({...e}){return(0,F.jsx)(h,{"data-slot":`dialog`,...e})}function Me({...e}){return(0,F.jsx)(D,{"data-slot":`dialog-portal`,...e})}function Ne({className:e,...t}){return(0,F.jsx)(x,{"data-slot":`dialog-overlay`,className:w(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Pe({className:e,children:t,showCloseButton:n=!0,...r}){return(0,F.jsxs)(Me,{"data-slot":`dialog-portal`,children:[(0,F.jsx)(Ne,{}),(0,F.jsxs)(T,{"data-slot":`dialog-content`,className:w(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,F.jsxs)(C,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,F.jsx)(ce,{}),(0,F.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Fe({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`dialog-header`,className:w(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Ie({className:e,showCloseButton:t=!1,children:n,...r}){return(0,F.jsxs)(`div`,{"data-slot":`dialog-footer`,className:w(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,F.jsx)(C,{asChild:!0,children:(0,F.jsx)(E,{variant:`outline`,children:`Close`})})]})}function Le({className:e,...t}){return(0,F.jsx)(_,{"data-slot":`dialog-title`,className:w(`text-lg leading-none font-semibold`,e),...t})}function Re({className:e,...t}){return(0,F.jsx)(g,{"data-slot":`dialog-description`,className:w(`text-sm text-muted-foreground`,e),...t})}var ze=(0,P.createContext)(null);function Be({children:e}){let[t,n]=(0,P.useState)(()=>new Map),r=(0,P.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,P.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),o=a((0,P.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,P.useMemo)(()=>({publish:r,retract:i,lookup:o}),[r,i,o]);return(0,F.jsx)(ze.Provider,{value:s,children:e})}var Q=(0,P.createContext)(null);function Ve({projectId:e,requests:t,children:n}){let r=(0,P.useContext)(ze),i=(0,P.useId)(),o=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),s=r?.publish,c=r?.retract;(0,P.useEffect)(()=>{if(!(!s||!c))return s(i,t),()=>c(i)},[s,c,i,o]);let l=a(r?He:t),u=r?.lookup??l,d=(0,P.useMemo)(()=>({lookup:u,projectId:e}),[u,e]);return(0,F.jsx)(Q.Provider,{value:d,children:n})}var He=[];function Ue(e,t,n){let r=(0,P.useContext)(Q),i=n??r?.projectId;return!r||!i||t===void 0?Ge:r.lookup({projectId:i,kind:e,number:t})}function We(){let e=(0,P.useContext)(Q);return{lookup:e?.lookup??(()=>Ge),projectId:e?.projectId}}var Ge=Object.freeze({state:`idle`});function $(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function Ke(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=$(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t($(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function qe(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:$(e)}:{top:0,bottom:0}}function Je(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function Ye(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(qe(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function Xe(){let[e,t]=(0,P.useState)({top:0,bottom:0});return(0,P.useEffect)(()=>Ye(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function Ze(e){let t=(0,P.useRef)(e);t.current=e,(0,P.useEffect)(()=>{let e=document.documentElement;return Ke(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function Qe({...e}){return(0,F.jsx)(Ee,{"data-slot":`popover`,...e})}function $e({...e}){return(0,F.jsx)(Oe,{"data-slot":`popover-trigger`,...e})}function et({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=Xe();return(0,F.jsx)(ke,{children:(0,F.jsx)(Ae,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:Je(a,r),className:w(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function tt({...e}){return(0,F.jsx)(De,{"data-slot":`popover-anchor`,...e})}var nt={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},rt={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},it={draft:ie,"review-required":le,"changes-requested":me,"checks-pending":null,"checks-failing":N,ready:k,merged:ue,closed:pe,open:j,completed:k,"not-planned":M};function at({reference:e,taskTitle:t,status:n,conflicting:a,conflictAction:o,projectId:s,className:c,compact:l=!1}){let{kind:u,number:d,url:f}=e,p=Ue(u,d,s),m=n??p.status,h=i(m),g=u===`PR`&&(a??p.conflicting)===!0,_=g?r:h,v=w(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,nt[_?.tone??`violet`],c),y=dt(p,_,g?h:void 0),x=d?`${!l&&u===`Issue`?`Issue `:``}#${d}`:u,S=u===`PR`?`pull request`:`issue`,C=`Open the ${S} for ${t}${_?` — ${_.label}`:``}`,T=(0,F.jsxs)(F.Fragment,{children:[g?(0,F.jsx)(de,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,F.jsx)(pt,{status:_?m:void 0}),x]}),E=!f||!b(f)?(0,F.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},"aria-label":_?`${S} ${x} — ${_.label}`:void 0,className:v,children:T}):(0,F.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:y?void 0:f,"aria-label":C,className:w(v,rt[_?.tone??`violet`]),children:[T,(0,F.jsx)(A,{className:`size-2.5`,"aria-hidden":`true`})]});if(!y)return E;let D=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,y.headline]}),(0,F.jsx)(`span`,{className:`block`,children:y.detail}),y.also?(0,F.jsx)(`span`,{className:`block opacity-70`,children:y.also}):null,f&&b(f)?(0,F.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,F.jsx)(ut,{chip:E,action:g?o:void 0,state:p.state,children:D})}var ot=(0,P.createContext)(()=>{});function st(){return(0,P.useContext)(ot)}var ct=150,lt=120;function ut({chip:e,action:t,state:n,children:r}){let[i,a]=(0,P.useState)(!1),o=(0,P.useRef)(null),s=(0,P.useRef)(null),c=(0,P.useRef)(void 0),l=(0,P.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,P.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,P.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,F.jsxs)(Qe,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,F.jsx)(tt,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,ct)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,lt)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,F.jsxs)(et,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,lt)},children:[(0,F.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,F.jsx)(ot.Provider,{value:u,children:t}):null]})]})}function dt(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ft(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ft(e){return e.charAt(0).toLowerCase()+e.slice(1)}function pt({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,F.jsx)(fe,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=it[e];return t?(0,F.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}export{A as S,Le as _,et as a,M as b,Ve as c,We as d,je as f,Fe as g,Ie as h,tt as i,Be as l,Re as m,st as n,$e as o,Pe as p,Qe as r,Ze as s,at as t,Ue as u,he as v,j as x,N 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{Ai as r,D as i,Di as a,Lt as o,Oi as s,Q as c,Sn as l,V as u,Vi as d,Wn as f,Zi as p,_n as m,d as h,f as g,jn as _,nt as v,tt as y}from"./project-router-CWMOKp_H.js";import{Ct as ee,F as b,K as te,Pt as ne,St as re,Tt as ie,_t as x,r as S,t as C}from"./button-BNnH7COh.js";import{a as ae,d as oe,n as se,o as ce,r as le,t as ue,v as de}from"./reference-chip-B7lU_Pyh.js";import{i as w,r as fe}from"./textarea-rKUFh5lI.js";import{i as pe,n as me,p as he,r as ge,t as _e}from"./tooltip-BVqBAGNb.js";import{a as ve,c as T,h as ye,n as E,o as be,r as D,s as xe,t as O}from"./dropdown-menu-CxPGHgWX.js";var Se=b(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Ce=b(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),we=b(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Te=b(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),k=b(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ee=b(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),De=b(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),Oe=b(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),A=b(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ke=b(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Ae=b(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),je=b(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),j=b(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Me=b(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Ne=b(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Pe=b(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),M=b(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),N=b(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Fe=b(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),P=b(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),F=n(),I=e(t(),1);function L(e,t){try{fetch(e,{method:`POST`,headers:{"content-type":`application/json`,[s]:r()},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function R(e){L(`/api/v1/telemetry/event`,{event:`message_sent`,label:e})}function Ie(e){L(`/api/v1/telemetry/event`,{event:`diff_comment_added`,label:e})}function Le(e){L(`/api/v1/telemetry/event`,{event:`add_project_opened`,label:e})}function Re(e){return e.startsWith(`/p/`)||e===`/tasks`||e===`/dashboard`||e===`/settings/global`||e.startsWith(`/settings/global/`)}function ze(e){L(`/api/v1/telemetry/page`,{route:e})}var z=new Set(te);function B(e){return`/${e.split(`/`).filter(Boolean).map(e=>z.has(e)?e:`:param`).join(`/`)}`}function Be(e){return/Firefox\//.test(e)?`gecko`:/Chrom(e|ium)\/|Edg\//.test(e)?`chromium`:/AppleWebKit\//.test(e)?`webkit`:`other`}function Ve(e){return/iPhone|iPad|iPod/.test(e)?`ios`:/Android/.test(e)?`android`:/Mac OS X|Macintosh/.test(e)?`macos`:/Windows/.test(e)?`windows`:/Linux/.test(e)?`linux`:`other`}function He(){try{let e=new URL(import.meta.url).pathname.split(`/`).pop()??``;return/^[\w.-]+\.js$/.test(e)?e:null}catch{return null}}var V={route:B(typeof window>`u`?`/`:window.location.pathname),previousRoute:null,routeEnteredAt:0,navigations:0,errors:0,serverVersion:null,latestVersion:null};function Ue(){return`__CEZ_DESKTOP__`in window||document.documentElement.dataset.cezDesktop||`__TAURI_INTERNALS__`in window?`desktop`:`browser`}function We(e={}){let t=navigator.userAgent,n=performance.now();return{...e,"page.route":V.route,"page.previous_route":V.previousRoute,"page.time_on_route_s":Math.round((n-V.routeEnteredAt)/1e3),"session.age_s":Math.round(n/1e3),"session.navigations":V.navigations,"session.errors":V.errors,"client.surface":Ue(),"client.engine":Be(t),"client.os":Ve(t),"client.online":navigator.onLine,"client.visibility":document.visibilityState,"client.viewport_w":window.innerWidth,"build.entry":He(),"build.server_version_at_load":V.serverVersion,"build.update_available":V.latestVersion!==null&&V.latestVersion!==V.serverVersion}}var Ge=[/^ResizeObserver loop (limit exceeded|completed with undelivered notifications)/];function Ke(e){return Ge.some(t=>t.test(e))}function qe(e){return e&&(e.split(/[?#]/)[0]?.split(`/`).pop()??``)||null}var Je=new WeakSet,Ye={error:0,toast:0};function H(e,t,n={}){if(typeof e==`object`&&e){if(Je.has(e))return;Je.add(e)}V.errors+=1;let r=Date.now(),i=t===`toast`?`toast`:`error`;if(r-Ye[i]<1e4)return;Ye[i]=r;let a=e instanceof Error,o=a?e:Error(String(e));L(`/api/v1/telemetry/error`,{type:(n.type??(o.name||`Error`)).slice(0,128),message:(o.message||`unknown error`).slice(0,2048),stack:a?o.stack?.split(window.location.origin).join(``).slice(0,16384):void 0,handler:t,code:n.code,fingerprint:n.fingerprint,context:We(n.context)})}var Xe=new Set(`api.v1.agent-profiles.apply.archive.archive-finished.association.auto-resume.automation-checks.automation-log.automation-options.automation-templates.branch.branding-logo.cancel.candidates.channel.check.checkout.checks.comments.commit.config.connect.connection.consent.continue.details.diff.dispatch.drafts.enable.events.feed.finish.groups.handoff.health.host-usage.images.importable.launch-key.merge-state.messages.models.nodes.open.open-in.open-in-cli.open-targets.parse.pause.pick.pin.plan.pr.providers.push.queued-messages.read.read-all.reclaim.refresh.remove-worktree.repo.report.retry.run.runs.runs-index.search.self-update.setup.skills-update.star-count.status.telemetry.todos.tree.ui-state.unread.validate.watch.workspace.ws`.split(`.`));function Ze(e){let t=e.split(`/`).filter(Boolean);return`/${t.map((e,n)=>t[n-1]===`p`||!(Xe.has(e)||z.has(e))?`:param`:e).join(`/`)}`.slice(0,256)}function Qe(e,t=Date.now()){return e?{type:`ApiError`,context:{"request.method":e.method,"request.route":Ze(e.path),"request.status":e.status,"request.age_ms":t-e.at}}:{type:`ErrorToast`,context:{}}}var $e=[],et=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function tt(e,t=$e){let n=e.replace(/“[^”]*”|‘[^’]*’|"[^"]*"|`[^`]*`|(?<!\w)'[^'\n]+'(?!\w)/g,`<value>`).replace(/[^\s()[\]{}<>,;]+@[^\s()[\]{}<>,;]+\.\w+/g,`<email>`).replace(/[^\s()[\]{}<>,;]*\/[^\s()[\]{}<>,;]*/g,e=>{if(!/^(https?:\/\/[^/\s]+)?\/api\//.test(e))return`<path>`;try{return Ze(new URL(e,`http://localhost`).pathname)}catch{return`<path>`}});for(let e of[...new Set(t)].filter(e=>e.length>=3).sort((e,t)=>t.length-e.length))n=n.replace(RegExp(`(?<![\\w-])${et(e)}(?![\\w-])`,`gi`),`<project>`);return n.replace(/:\s+\S.*$/s,`: <detail>`)}function nt(e){let{type:t,context:n}=Qe(a());H(tt(e),`toast`,{type:t,context:n})}function rt(e,t){return(0,I.lazy)(()=>t().catch(t=>{throw H(t,`lazy-route`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`,context:{"chunk.route":e}}),t}))}var it=!1;function at(){let{pathname:e}=p(),t=u(),n=y();return(0,I.useEffect)(()=>{$e=(n.data?.projects??[]).flatMap(e=>[e.name,e.id])},[n.data]),(0,I.useEffect)(()=>{t.data&&V.serverVersion===null&&(V.serverVersion=t.data.version),V.latestVersion=t.data?.latestVersion??V.latestVersion},[t.data]),(0,I.useEffect)(()=>{it||(it=!0,window.addEventListener(`error`,e=>{Ke(e.message??``)||H(e.error??e.message,`window.error`,{context:{"error.source_file":qe(e.filename),"error.line":e.lineno||null,"error.col":e.colno||null}})}),window.addEventListener(`unhandledrejection`,e=>H(e.reason,`unhandledrejection`)),window.addEventListener(`vite:preloadError`,e=>H(e.payload,`vite:preloadError`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`})),h(nt))},[]),(0,I.useEffect)(()=>{if(!Re(e))return;let t=B(e);(t!==V.route||V.navigations===0)&&(V.navigations>0&&(V.previousRoute=V.route),V.route=t,V.routeEnteredAt=performance.now(),V.navigations+=1,ze(t))},[e]),null}var ot=[`done`,`failed`,`cancelled`],st=[`done`,`failed`];function ct(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function U(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function lt(e){return ot.includes(e)}function W(e){return e.archived||ct(e)||U(e)||!st.includes(e.status)?!1:e.finishedAt!==void 0}function G(e){let t=e.finishedAt;return t===void 0||!W(e)?!1:e.seenAt===void 0||e.seenAt<t}function ut(e){return ct(e)||U(e)?!1:lt(e.status)&&!G(e)}function dt(e){return e.reduce((e,t)=>G(t)?e+1:e,0)}function ft({label:e,side:t=`bottom`,children:n}){return(0,F.jsx)(ge,{delayDuration:300,children:(0,F.jsxs)(_e,{children:[(0,F.jsx)(pe,{asChild:!0,children:n}),(0,F.jsx)(me,{side:t,sideOffset:6,"data-slot":`icon-tooltip`,children:e})]})})}var pt=`text-violet hover:text-violet [&_svg]:fill-violet/25`,mt=`text-violet fill-violet/25`;function ht({pinned:e,onToggle:t,className:n}){return(0,F.jsx)(ft,{label:e?`Unpin from the top of the list`:`Pin to the top of the list`,children:(0,F.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,onClick:n=>{n.stopPropagation(),t(!e)},className:S(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet [&_svg]:fill-violet/25`,n),children:(0,F.jsx)(j,{className:`size-3`,"aria-hidden":`true`})})})}var gt={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`};function _t(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function vt(e){return e.runner??`claude`}function yt(e,t){let n=d(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${gt[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${gt[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function bt(e,t){return yt(_t(e),t)}function xt(e,t){return yt(vt(e),t)}function St(e){let t=v(),n=_t(e);return t.isSuccess&&t.data?bt(e,t.data):{provider:n,usable:!0}}function Ct(e){let t=v(),n=vt(e);return t.isSuccess&&t.data?xt(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var wt={folder:ye,terminal:N,vscode:Te,cursor:je,zed:P,windsurf:Fe,sublime:De,idea:Ee,pycharm:Ae,webstorm:A,goland:Ne,rubymine:Oe,phpstorm:we,clion:k,rider:Ce,"android-studio":Pe,xcode:ke,warp:Me,claude:w,codex:M,junie:w,opencode:w,pi:w,copilot:w};function Tt(e){return e.icon&&wt[e.icon]||fe}var Et=RegExp(`^cli:(${ne.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function Dt(e){let t=Et.exec(e);return t?t[1]:void 0}function Ot({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,F.jsxs)(O,{children:[(0,F.jsx)(T,{asChild:!0,children:(0,F.jsxs)(C,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,F.jsx)(fe,{"aria-hidden":`true`}),n]})}),(0,F.jsxs)(E,{align:`end`,children:[o,o&&e.length>0?(0,F.jsx)(xe,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=Tt(e);return(0,F.jsxs)(D,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,F.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function K(e){return e===`running`||e===`queued`||e===`waiting`}function q(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var kt=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,At={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,junie:`junie --resume`,pi:`pi --session`,copilot:`copilot --resume`};function jt(e,t){if(kt.test(t))return e===`junie`?`${At.junie} --session-id=${t}`:`${At[e??`claude`]} ${t}`}function Mt(e){if(K(e.status))return;let t=q(e);if(t===void 0)return;let n=jt(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function Nt(e,t){let n=Dt(t);return!n||K(e.status)?!1:n===(e.runner??`claude`)&&q(e)!==void 0}function Pt(e){let t=K(e.status),n=q(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&n,terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:W(e)&&!G(e),markRead:W(e)&&G(e),cancel:t,deleteRun:!t}}function Ft(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function It(e){return`The CI checks on ${e?`PR number ${e}`:`this pull request`} are failing. Look at the failing checks (gh pr checks, then gh run view --log-failed), fix the cause, then commit and push`}function Lt(e){let t=e?.replace(/^origin\//,``),n=t&&!/^[0-9a-f]{7,40}$/i.test(t)?`origin/${t}`:`the base branch`;return`Update this branch with the latest ${n}: fetch, merge ${n} into it, resolve any conflicts, make sure it still builds and the tests pass, then commit and push`}function Rt(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function zt(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var Bt=[50,100,200,400,800,1e3,1e3,1e3,1e3],Vt=e=>new Promise(t=>setTimeout(t,e));function Ht(e){return e instanceof f&&e.status===409&&e.message===`run is still active`}async function Ut(e,t=Vt){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Bt[n];if(!Ht(e)||r===void 0)throw e;await t(r)}}function Wt(e){return K(e.status)?`live`:Pt(e).continueRun?`resume`:`unavailable`}function Gt(e,t){let n=o(e.id,t),r=i(e.id,t),a=St(e),s=Ct(e),[c,l]=(0,I.useState)(void 0),[u,d]=(0,I.useState)(!1),p=(0,I.useRef)(!1),m=Wt(e),h=m===`resume`?!s.usable:m===`live`&&!a.usable,g=m===`unavailable`?`no-session`:h?`provider`:void 0,_=g===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:g===`provider`?m===`resume`?s.reason:a.reason:void 0,v=e=>s.usable?r.mutateAsync({text:e}).then(e=>(R(`ask_answer`),e)):Promise.reject(Error(s.reason??`The run provider is unavailable.`));return{mode:m,blockedBy:g,reason:_,isPending:u||n.isPending||r.isPending,error:c,send:async t=>{if(g||p.current)return _;p.current=!0,d(!0),l(void 0);try{if(m===`resume`){await Ut(()=>v(t));return}try{await n.mutateAsync({text:t}),R(`ask_answer`)}catch(n){if(n instanceof f&&n.status===409&&q(e)!==void 0){await Ut(()=>v(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return l(t),t}finally{p.current=!1,d(!1)}}}}function J({run:e,projectId:t,prNumber:n}){let r=Gt(e,t),i=se(),[a,o]=(0,I.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Ft(n));t?g(t,{tone:`danger`}):(g(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(C,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,F.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Kt({projectId:e,runId:t,prNumber:n}){let r=c(e,t);return r.data?(0,F.jsx)(J,{run:r.data,projectId:e,prNumber:n}):(0,F.jsx)(C,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function qt({run:e,reference:t,className:n,compact:r=!1}){let{lookup:i,projectId:a}=oe(),o=t.kind===`PR`?l(e).filter(e=>e.kind===`PR`&&(e.number!==t.number||!!e.url&&!!t.url&&e.url!==t.url)):[];return(0,F.jsx)(F.Fragment,{children:(t.number===void 0?[t,...o]:m([{...t,number:t.number},...o],e=>a?i({projectId:a,kind:e.kind,number:e.number}).status:void 0)).map((t,i)=>(0,F.jsx)(I.Fragment,{children:(0,F.jsx)(ue,{reference:t,taskTitle:_(e),conflictAction:(0,F.jsx)(J,{run:e,prNumber:t.number}),className:n,compact:r})},`${t.kind}-${t.number??`unknown`}-${t.url??i}`))})}var Jt=`quick-task`;function Yt(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var Y=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`junie`,label:`junie`,desc:`JetBrains Junie CLI`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`cursor`,label:`cursor`,desc:`Cursor Agent CLI`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`copilot`,label:`copilot`,desc:`GitHub Copilot CLI (ACP)`}],X={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],junie:[{id:``,label:`auto`,desc:`Use your Junie default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`}],copilot:[{id:``,label:`auto`,desc:`Let Copilot pick the model`}]},Xt={claude:/^claude[-.]/,codex:/^gpt[-.]/},Zt=[`opencode`,`pi`];function Qt(e,t){return!e||X[t].some(t=>t.id===e)||Xt[t]?.test(e)?!1:Object.entries(X).some(([n,r])=>n!==t&&!Zt.includes(n)&&r.some(t=>t.id!==``&&t.id===e))||Object.entries(Xt).some(([n,r])=>n!==t&&r.test(e))}function $t(e,t,n=[]){let r=X[e]??X.claude,i=x(e)?t?.models??[]:[],a=i.length>0?[en(r)]:[...r],o=new Set(a.map(e=>e.id));for(let e of i)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||Qt(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}function en(e){return e.find(e=>e.id===``)??{id:``,label:`auto`,desc:``}}var tn={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,junie:`Junie`,cursor:`Cursor`};function nn(e,t,n=!1){if(!x(e))return;let r=tn[e];if(t?.stale)return`Using cached ${r} model list`;if(n||t?.source===`unavailable`)return`Latest ${r} models unavailable`}function rn(e){let t=Y.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function an(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function on(e,t,n=!1){return!n&&e===t?void 0:e}function sn(e,t,n,r){let i=$t(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function cn(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function ln(e,t,n){return e&&cn(e,t,n)?e:null}function un(e){let{task:t,source:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,agentProfile:c,variants:l,images:u,worktree:d,autonomous:f,generateFollowups:p,todoId:m,dispatch:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,runner:on(a,s,o),agentProfile:c||void 0,variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,worktree:d===!1&&l<=1?!1:void 0,autonomous:f===!0||void 0,generateFollowups:p!==!1&&void 0,todoId:m||void 0,dispatch:h??void 0}}function dn(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var Z=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-55`,Q=(0,F.jsx)(he,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function fn({active:e=!1,skill:t=!1,dashed:n=!1,chevron:r=!1,icon:i,className:a,children:o,type:s=`button`,...c}){return(0,F.jsxs)(`button`,{type:s,"data-slot":`chip`,"data-active":e?`true`:void 0,"data-skill":t?`true`:void 0,className:S(Z,e&&`border-foreground font-semibold text-foreground`,t&&`border-violet font-mono font-semibold text-foreground`,n&&`border-dashed`,a),...c,children:[i,o,r?Q:null]})}function pn({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:s=!1,hint:c,disabledHint:l,status:u,searchPlaceholder:d}){let[f,p]=(0,I.useState)(!1),[m,h]=(0,I.useState)(``),g=(0,I.useRef)(null),_=(0,I.useRef)(null),v=d?i.filter(e=>e.label.toLowerCase().includes(m.trim().toLowerCase())):i;if((0,I.useEffect)(()=>{if(!f||!d)return;let e=window.setTimeout(()=>g.current?.focus());return()=>window.clearTimeout(e)},[f,d]),s)return(0,F.jsx)(`span`,{"data-slot":e,"aria-label":t,title:l??c,className:`${Z} cursor-default hover:bg-card hover:text-muted-foreground`,children:n});let y=(0,F.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?l:c,className:Z,children:[n,Q]});return o?(0,F.jsx)(`span`,{title:l,className:`inline-flex`,children:y}):(0,F.jsxs)(O,{open:f,onOpenChange:e=>{p(e),e||h(``)},children:[(0,F.jsx)(T,{asChild:!0,children:y}),(0,F.jsxs)(E,{ref:_,align:`start`,"data-testid":`${e}-menu`,children:[d?(0,F.jsxs)(`div`,{className:`mb-1 flex h-9 items-center gap-2 border-b border-border px-2`,children:[(0,F.jsx)(de,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,F.jsx)(`input`,{ref:g,type:`search`,"aria-label":d,placeholder:d,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=_.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-full min-w-48 bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}):null,(0,F.jsx)(ve,{value:r,onValueChange:a,children:v.map(e=>(0,F.jsx)(be,{value:e.value,className:`gap-2.5`,children:(0,F.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,F.jsx)(`span`,{className:`text-[12.5px] font-medium`,children:e.label}),e.desc?(0,F.jsx)(`span`,{className:`max-w-[calc(100vw-3rem)] whitespace-normal break-words text-[11.5px] text-muted-foreground md:max-w-96`,children:e.desc}):null]})},e.value))}),d&&v.length===0?(0,F.jsx)(`p`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No branches found.`}):null,u?(0,F.jsx)(D,{disabled:!0,className:`border-t border-border text-[11.5px] text-muted-foreground`,children:u}):null]})]})}var $=(e,t)=>t===null?e:`${e}:${t}`;function mn({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o}){let s=Y.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:$(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:$(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),c=a??o?.[t]??`default`,l=s.some(e=>e.value===$(t,c))?$(t,c):$(t,null);return(0,F.jsx)(pn,{slot:`runner-pill`,ariaLabel:`Runner`,label:s.find(e=>e.value===l)?.label??t,value:l,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:s})}var hn={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function gn(e){return ee(e.type)?e.type:hn[e.name.split(`.`).pop()?.toLowerCase()??``]??null}function _n(e,t){return t?`pasted image`:`pasted.${re(e)}`}async function vn(e,t=`file`){let n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));let i=btoa(r),a=gn(e)??`application/octet-stream`,o=ie(a),s=t===`clipboard`&&o?void 0:e.name;return{mediaType:a,data:i,...o?{preview:`data:${a};base64,${i}`}:{},name:s||_n(a,o),...s?{originalName:s}:{},isImage:o}}function yn({mediaType:e,data:t,originalName:n}){return{mediaType:e,data:t,...n?{name:n}:{}}}function bn(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(gn(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}function xn(e,t){let[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(``),o=(0,I.useRef)(!1),[s,c]=(0,I.useState)(!0),l=e=>{a(e),c(!0)},u=e=>{a(e),c(!1),o.current=!1,r(!0)};return{editing:n,draft:i,setDraft:l,begin:()=>{u(e),c(!0)},beginWith:u,commitOnBlur:s,commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function Sn({editor:e,className:t}){return(0,F.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:()=>{e.commitOnBlur&&e.commit()},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:S(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}var Cn=220;function wn({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=I.useState(!1),o=I.useRef(!1),s=I.useRef(void 0);I.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),Cn))};return(0,F.jsxs)(le,{open:i,onOpenChange:a,children:[(0,F.jsx)(ce,{asChild:!0,children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,F.jsxs)(ae,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,F.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,F.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,F.jsx)(ue,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number??``}#${e.url??``}`))})]})]})}export{Le as $,Nt as A,Ot as B,on as C,Kt as D,J as E,zt as F,mt as G,St as H,Ft as I,ut as J,ft as K,Mt as L,It as M,K as N,qt as O,q as P,rt as Q,Pt as R,ln as S,Jt as T,ht as U,Dt as V,pt as W,dt as X,G as Y,at as Z,Qt as _,vn as a,j as at,sn as b,pn as c,Se as ct,Q as d,Ie as et,Z as f,nn as g,un as h,_n as i,M as it,Rt as j,Gt as k,mn as l,rn as m,Sn as n,P as nt,bn as o,A as ot,Y as p,W as q,xn as r,N as rt,yn as s,k as st,wn as t,R as tt,fn as u,$t as v,dn as w,an as x,Yt as y,Lt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e}from"./button-
|
|
1
|
+
import{F as e}from"./button-BNnH7COh.js";var t=e(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
|
|
@@ -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{$i as r,Jr as i,N as a,V as o,Wn as s,aa as c,ar as l,c as u,f as d,gt as f,h as p,ht as m,mt as h,na as g,t as _,vt as v}from"./project-router-CWMOKp_H.js";import{i as y,r as b,t as x}from"./button-BNnH7COh.js";import{t as S}from"./arrow-left-fsST4JqT.js";import{t as ee}from"./check-DA37PQLT.js";import{t as C}from"./chevron-right-Beu1pd6H.js";import{h as w,m as T}from"./dropdown-menu-CxPGHgWX.js";import{a as E,i as te,r as ne,t as re}from"./file-preview-DxFusXAO.js";import{t as ie}from"./file-DkvcUwxT.js";import{t as D}from"./git-commit-horizontal-BM9_nEW7.js";import{n as O,t as k}from"./triangle-alert-CP3Xp0FU.js";import{t as A}from"./centered-state-sEYB3bgq.js";import{t as ae}from"./search-x-6BavY3mg.js";import{a as j,o as M,t as N}from"./git-toolbar-DXyPCDkQ.js";import{t as oe}from"./diff-stat-SpfygteL.js";import{B as P,H as F,R as se,j as I,s as L}from"./index-BN3w52uE.js";import{t as R}from"./markdown-C5F95Rt-.js";import{t as z}from"./diff-CrLUECGW.js";import{t as B}from"./tab-link-DEUSZU49.js";import{n as V,r as H,t as U}from"./file-tree-BTJZXRkM.js";import{t as W}from"./commit-list-Bps23fvP.js";var G=e(t(),1),K=n();function ce({repo:e,info:t}){let n=o(),r=c(),a=e=>d(e.message,{tone:`danger`}),s=g({mutationFn:e=>l({name:e}),onSuccess:async e=>{d(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([r.invalidateQueries({queryKey:p.repo}),r.invalidateQueries({queryKey:p.health})]),r.setQueryData(p.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),r.setQueryData(p.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),u=g({mutationFn:e=>i({baseBranch:e}),onSuccess:e=>{d(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),r.invalidateQueries({queryKey:p.repo})},onError:a}),[f,m]=(0,G.useState)(``),[h,_]=(0,G.useState)(``),v=h.trim().toLowerCase(),y=v?e.branches.filter(e=>e.toLowerCase().includes(v)):e.branches;return(0,K.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,K.jsx)(I,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`mt-2 max-w-xl`}),(0,K.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[y.map(e=>{let n=e===t.branch;return(0,K.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,K.jsx)(T,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,K.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-xs`,n&&`font-semibold`),children:e}),n?(0,K.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,K.jsx)(ee,{"aria-hidden":`true`,className:`size-3`}),`current`]}):(0,K.jsx)(x,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:s.isPending,onClick:()=>s.mutate(e),children:`Switch`})]},e)}),y.length===0?(0,K.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]}),(0,K.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&s.mutate(t,{onSuccess:()=>m(``)})},children:[(0,K.jsx)(I,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:f,onChange:e=>m(e.target.value)}),(0,K.jsxs)(x,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!f.trim()||s.isPending,children:[(0,K.jsx)(se,{"aria-hidden":`true`}),`Create`]})]})]}),(0,K.jsxs)(`div`,{className:`max-w-md`,children:[(0,K.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,K.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:u.isPending,onChange:e=>u.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,K.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]}),(0,K.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,K.jsx)(le,{}):null]})}function le(){let e=a({limit:20});return(0,K.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,K.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,K.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,K.jsx)(ue,{pr:e},e.number))}):(0,K.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function ue({pr:e}){let t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,K.jsx)(de,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,K.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:y(e.url)?(0,K.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:b(n,`hover:bg-muted`),children:t}):(0,K.jsx)(`span`,{className:n,children:t})})}function de({checks:e}){return(0,K.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:b(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function fe(){let e=m(),t=F(),[n,r]=(0,G.useState)(`unified`),[i,a]=(0,G.useState)(!1),[o,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(null),d=(0,G.useRef)(null),f=e.isError&&e.error instanceof s&&e.error.status===409,p=e.data?.files??[],h=(0,G.useMemo)(()=>U(p),[p]),g=(0,G.useMemo)(()=>p.some(R),[p]),_=t?n:`unified`,v=!t||i;return(0,K.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,K.jsx)(N,{stat:e.data.stat}):null,(0,K.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,K.jsx)(M,{mode:n,wrap:i,preview:o,onModeChange:r,onWrapChange:a,onPreviewChange:g?c:void 0})})]}),e.isPending?(0,K.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,K.jsx)(A,{icon:f?(0,K.jsx)(P,{}):(0,K.jsx)(k,{}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,K.jsx)(A,{icon:(0,K.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,K.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`hidden w-60 shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,children:(0,K.jsx)(H,{root:h,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})}),(0,K.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,K.jsx)(z,{files:p,viewRef:d,mode:_,wrap:v,preview:t&&g&&o,className:`min-w-0 md:py-4`})})]})]})}function pe({log:e}){let{sha:t}=r();return t?(0,K.jsx)(me,{sha:t}):e.length===0?(0,K.jsx)(A,{icon:(0,K.jsx)(D,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,K.jsx)(W,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})}function me({sha:e}){let t=f(e),n=F(),[r,i]=(0,G.useState)(`unified`),[a,o]=(0,G.useState)(!1),c=t.isError&&t.error instanceof s&&t.error.status===409,l=n?r:`unified`,u=!n||a;return(0,K.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,K.jsx)(x,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,K.jsxs)(_,{to:`/git/commits`,children:[(0,K.jsx)(S,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,K.jsx)(oe,{stat:t.data.stat}):null,(0,K.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,K.jsx)(M,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,K.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,K.jsx)(A,{icon:c?(0,K.jsx)(ae,{}):(0,K.jsx)(k,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,K.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,K.jsx)(A,{icon:(0,K.jsx)(D,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,K.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,K.jsx)(z,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function he(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var ge=200;function _e({selected:e,onSelect:t}){let n=v(),r=n.isError&&n.error instanceof s&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,K.jsx)(J,{children:(0,K.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,K.jsx)(J,{children:(0,K.jsx)(A,{icon:r?(0,K.jsx)(E,{}):(0,K.jsx)(k,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,K.jsx)(J,{children:(0,K.jsx)(A,{icon:(0,K.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,K.jsxs)(J,{children:[n.data.truncated?(0,K.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,K.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:b(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,K.jsx)(ve,{paths:i,selected:e,onSelect:t})}),(0,K.jsxs)(`div`,{className:b(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,K.jsx)(S,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,K.jsx)(re,{source:{kind:`repo`},path:e})]})]})]})}function J({children:e}){return(0,K.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function Y(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function X(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...X(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function ve({paths:e,selected:t,onSelect:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(()=>new Set(Y(t))),[s,c]=(0,G.useState)(t),l=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=Y(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,G.useMemo)(()=>he(e,r,ge),[e,r]),f=(0,G.useMemo)(()=>V(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,G.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):X(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,K.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,K.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,K.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,K.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,K.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,K.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Z(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-[13px]`,children:p.map(e=>e.kind===`dir`?(0,K.jsx)($,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,K.jsx)(ye,{row:e,active:e.path===t,focused:e.path===m?.path,onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,K.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Z=e=>`repo-file-row-${e}`,Q=(e,t)=>({paddingLeft:`${t+e*14}px`});function $({row:e,focused:t,onToggle:n}){return(0,K.jsxs)(`div`,{id:Z(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onClick:n,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:Q(e.level,6),children:[(0,K.jsx)(C,{"aria-hidden":`true`,className:b(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,K.jsx)(w,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function ye({row:e,active:t,focused:n,onSelect:r}){let i=ne(e.path)?te:ie;return(0,K.jsxs)(`div`,{id:Z(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onClick:r,className:b(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:Q(e.level,24),children:[(0,K.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function be({tab:e}){let t=h();if(t.isPending)return(0,K.jsx)(L,{});if(t.isError)return(0,K.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,K.jsx)(A,{icon:(0,K.jsx)(k,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,K.jsx)(xe,{repo:t.data,info:n,tab:e}):(0,K.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,K.jsx)(A,{icon:(0,K.jsx)(T,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function xe({repo:e,info:t,tab:n}){return(0,K.jsxs)(`div`,{"data-route":`repo-git`,className:b(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,K.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,K.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,K.jsx)(j,{branch:t.branch}),t.remote?(0,K.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,K.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,K.jsx)(B,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,K.jsx)(B,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,K.jsx)(B,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,K.jsx)(B,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,K.jsx)(fe,{}):n===`commits`?(0,K.jsx)(pe,{log:e.log}):n===`files`?(0,K.jsx)(Se,{}):(0,K.jsx)(ce,{repo:e,info:t})]})}function Se(){let e=r(),t=u();return(0,K.jsx)(_e,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Ce(e)}`,{replace:!0})})}function Ce(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{be as RepoGitRoute};
|
|
@@ -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{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{aa as r,h as i,wt as a}from"./project-router-CWMOKp_H.js";import{r as o,t as s}from"./button-BNnH7COh.js";import{t as c}from"./chevron-right-Beu1pd6H.js";import{n as l,r as u,t as d}from"./collapsible-MuXfYnM8.js";import{i as f,r as p}from"./markdown-BpZ4p95p.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
2
2
|
`)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=r(),n=a(e);(0,m.useEffect)(()=>{t.invalidateQueries({queryKey:i.runs.diff(e)})},[t,e]);let o=(0,m.useMemo)(()=>y(n.data??``),[n.data]),[c,l]=(0,m.useState)(!1);if(n.isPending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(o.length===0)return(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let u=b(o),d=c?o:o.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]})]})]}),d.map(e=>(0,x.jsx)(E,{file:e},`${e.oldPath??``}→${e.path}`)),o.length>d.length?(0,x.jsxs)(s,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,o.length-d.length,` more files`]}):null]})}var T={added:`added`,deleted:`deleted`,renamed:`renamed`};function E({file:e}){let[t,n]=(0,m.useState)(!0),r=T[e.status];return(0,x.jsxs)(d,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,x.jsxs)(u,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(c,{className:o(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(l,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(D,{lines:e.lines})})})]})}function D({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
|
|
3
3
|
`),[a,s]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:f(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{w as t};
|