@open-mercato/cezar 0.18.0 → 0.19.0-pr1815.4229
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/automation-cli.js +12 -6
- package/dist/automations/automation-cli.js.map +1 -1
- package/dist/automations/prompts.js +3 -1
- package/dist/automations/prompts.js.map +1 -1
- package/dist/automations/schedule-runner.js +18 -4
- package/dist/automations/schedule-runner.js.map +1 -1
- package/dist/automations/store.js +9 -2
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/templates.js +1 -0
- package/dist/automations/templates.js.map +1 -1
- package/dist/automations/types.d.ts +28 -0
- package/dist/automations/types.js +6 -2
- package/dist/automations/types.js.map +1 -1
- package/dist/contract/automation-schedule.d.ts +28 -0
- package/dist/contract/automations.d.ts +126 -0
- package/dist/contract/github.d.ts +56 -0
- package/dist/contract/index.js +63 -0
- package/dist/contract/workspace.d.ts +18 -0
- package/dist/server/forge/github-issue-metadata.d.ts +6 -0
- package/dist/server/forge/github-issue-metadata.js +66 -0
- package/dist/server/forge/github-issue-metadata.js.map +1 -0
- package/dist/server/forge/github.d.ts +1 -1
- package/dist/server/forge/github.js +38 -4
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -17
- package/dist/server/server.d.ts +320 -36
- package/dist/server/server.js +21 -20
- package/dist/server/server.js.map +1 -1
- package/dist/workflows/run.js +7 -0
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-task-pickers-DbNIzx20.js → agent-task-pickers-_i7QNEVz.js} +1 -1
- package/web/dist/assets/{alert-dialog-4Kna6Hd7.js → alert-dialog-BZU09BVw.js} +1 -1
- package/web/dist/assets/arrow-down-BQxdXW9w.js +1 -0
- package/web/dist/assets/arrow-left-CvmEanh8.js +1 -0
- package/web/dist/assets/automation-format-CEBKDGz8.js +1 -0
- package/web/dist/assets/automations-route-Cg1sWvtN.js +1 -0
- package/web/dist/assets/button-BvYDiOkd.js +100 -0
- package/web/dist/assets/{centered-state-D-wDs7Y1.js → centered-state-Bpq40Y_t.js} +1 -1
- package/web/dist/assets/check-DC3eAaS2.js +1 -0
- package/web/dist/assets/chevron-left-BW4WDtiS.js +1 -0
- package/web/dist/assets/chevron-right-DuM1UAhq.js +1 -0
- package/web/dist/assets/circle-check-DiPv45P_.js +1 -0
- package/web/dist/assets/{clipboard-DQGL_gUp.js → clipboard-7kWKIj7k.js} +1 -1
- package/web/dist/assets/{collapsible-D7qsttC5.js → collapsible-OE3rGS50.js} +1 -1
- package/web/dist/assets/{commit-list-DTMGEn0-.js → commit-list-DalU6p3i.js} +1 -1
- package/web/dist/assets/{compare-variants-DqlkpLFs.js → compare-variants-CuCfgtyG.js} +1 -1
- package/web/dist/assets/dashboard-BYBop-ZJ.js +44 -0
- package/web/dist/assets/{diff-DY-_mmb0.js → diff-DfTKq2z2.js} +2 -2
- package/web/dist/assets/{diff-view-oTEcZZ_O.js → diff-view-Du2463vL.js} +1 -1
- package/web/dist/assets/{download-BBtWFvsh.js → download-_KH0gJo8.js} +1 -1
- package/web/dist/assets/facet-filter-BSS2vFA8.js +5 -0
- package/web/dist/assets/{file-CbWEaOku.js → file-d2ABwdSR.js} +1 -1
- package/web/dist/assets/file-preview-BURiO97x.js +2 -0
- package/web/dist/assets/{git-pull-request-draft-Dwhm6Vhn.js → git-pull-request-draft-DIdbQZ0O.js} +1 -1
- package/web/dist/assets/git-tab-loading-8Y0ID8J2.js +1 -0
- package/web/dist/assets/{git-toolbar-C3vpZJaZ.js → git-toolbar-CSrf6Ux9.js} +1 -1
- package/web/dist/assets/github-DQ8J0EYw.js +1 -0
- package/web/dist/assets/{host-usage-CI_ZlJQu.js → host-usage-EK6T4fAW.js} +1 -1
- package/web/dist/assets/{icon-tooltip-CgAWLDxo.js → icon-tooltip-nRvCJxOH.js} +1 -1
- package/web/dist/assets/index-BVPhzJ3k.js +31 -0
- package/web/dist/assets/index-HmrjUHlJ.css +2 -0
- package/web/dist/assets/{input-Br4NQpZK.js → input-90eli0Uk.js} +1 -1
- package/web/dist/assets/{layout-cards-fdJa2H62.js → layout-cards-n-2Pwe6c.js} +1 -1
- package/web/dist/assets/{lib-w_5wfsBF.js → lib-C4vuyY62.js} +1 -1
- package/web/dist/assets/loader-circle-DAforPX2.js +1 -0
- package/web/dist/assets/{markdown-G3dvGJao.js → markdown-BBnagS_c.js} +1 -1
- package/web/dist/assets/{markdown-BfZORc0a.js → markdown-DLB6o6YD.js} +1 -1
- package/web/dist/assets/{message-square-Dl-ol3uz.js → message-square-WCEmfkiD.js} +1 -1
- package/web/dist/assets/plus-BJEPAJjW.js +1 -0
- package/web/dist/assets/{project-router-DgQSavhI.js → project-router-7DKoABD3.js} +1 -1
- package/web/dist/assets/queries-DsfjHsrp.js +1 -0
- package/web/dist/assets/{reference-chip-BxUGeHDa.js → reference-chip-frnxjI-K.js} +1 -1
- package/web/dist/assets/repo-git-DVREyQYa.js +1 -0
- package/web/dist/assets/{run-diff-CqXLVaDj.js → run-diff-CmqQmGTJ.js} +1 -1
- package/web/dist/assets/{save-ByUa-aAl.js → save-CCb1fwTJ.js} +1 -1
- package/web/dist/assets/{scroll-within-Dexi68h1.js → scroll-within-CNcaqKGp.js} +1 -1
- package/web/dist/assets/{search-x-CLuL49ms.js → search-x-Cm22V3TC.js} +1 -1
- package/web/dist/assets/{settings-2-BvalJGW-.js → settings-2-CWK1otJs.js} +1 -1
- package/web/dist/assets/skills-B0OolFqS.js +1 -0
- package/web/dist/assets/{square-FwRsgrg-.js → square-B-gfdc5r.js} +1 -1
- package/web/dist/assets/{tabs-nC1VLjcX.js → tabs-D3hCl7A6.js} +1 -1
- package/web/dist/assets/{tag-CteJEZQp.js → tag-C5TeSwBA.js} +1 -1
- package/web/dist/assets/{task-commits-CYcqwz-f.js → task-commits-DIrIWA6g.js} +1 -1
- package/web/dist/assets/{task-graph-CJfTnzUp.js → task-graph-Diq4xAP_.js} +1 -1
- package/web/dist/assets/{task-notes-DxH2q3Hr.js → task-notes-DnIcoZgS.js} +1 -1
- package/web/dist/assets/task-workspace-DhUBQLGl.js +29 -0
- package/web/dist/assets/{terminal-aoRx5eKS.js → terminal-BIKtPgmL.js} +1 -1
- package/web/dist/assets/{terminal-drawer-CuGVJS-l.js → terminal-drawer-f0Tw3yHw.js} +2 -2
- package/web/dist/assets/{textarea-X_NVmVlZ.js → textarea-D6BGJB7j.js} +1 -1
- package/web/dist/assets/{token-metrics-CdH7TbLP.js → token-metrics-CMdTXREP.js} +1 -1
- package/web/dist/assets/{tooltip-C2bzSwbQ.js → tooltip-Bb7ddw0_.js} +1 -1
- package/web/dist/assets/{tracker-BYs-vq6-.js → tracker-BDiIqG2R.js} +2 -2
- package/web/dist/assets/{triangle-alert-BdMPm9Jb.js → triangle-alert-BhQYv6Is.js} +1 -1
- package/web/dist/assets/{upload-DrvICo_K.js → upload-Crivm77f.js} +1 -1
- package/web/dist/assets/{use-now-Byfm730u.js → use-now-BW1HO2p_.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-B41NLqM4.js → use-submit-shortcut-oBvmLiAo.js} +1 -1
- package/web/dist/assets/{workflow-graph-ppdi5xyK.js → workflow-graph-DJLPSGD3.js} +3 -3
- package/web/dist/assets/{worktree-lifecycle-operation-CvU6xu3u.js → worktree-lifecycle-operation-DL-RTic4.js} +2 -2
- package/web/dist/index.html +39 -39
- package/dist/telemetry-service.json +0 -1
- package/web/dist/assets/arrow-left-B1Ed0tpu.js +0 -1
- package/web/dist/assets/automation-format-CXffJGqm.js +0 -1
- package/web/dist/assets/automations-route-ruFF7d59.js +0 -1
- package/web/dist/assets/button-wdWSPx_B.js +0 -100
- package/web/dist/assets/check-DvAMBXJe.js +0 -1
- package/web/dist/assets/chevron-left-Dqb1lvgZ.js +0 -1
- package/web/dist/assets/chevron-right-DDQuVTY1.js +0 -1
- package/web/dist/assets/circle-check-BiVc-j8x.js +0 -1
- package/web/dist/assets/dashboard-BX4228zB.js +0 -44
- package/web/dist/assets/facet-filter-B_AsFqFx.js +0 -5
- package/web/dist/assets/file-preview-DEKEA-Hk.js +0 -2
- package/web/dist/assets/git-tab-loading-w5Ne43J6.js +0 -1
- package/web/dist/assets/github-Hshin4wG.js +0 -1
- package/web/dist/assets/index-CQ1cB3qE.css +0 -2
- package/web/dist/assets/index-D-pGbO9R.js +0 -31
- package/web/dist/assets/loader-circle-CwT0JWiv.js +0 -1
- package/web/dist/assets/plus-BwQyZgNP.js +0 -1
- package/web/dist/assets/queries-BTgOLNTK.js +0 -1
- package/web/dist/assets/repo-git-B47L82oV.js +0 -1
- package/web/dist/assets/skills-Bu12y3Zp.js +0 -1
- package/web/dist/assets/task-workspace-7NHIdOyT.js +0 -29
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e}from"./button-wdWSPx_B.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{F as e}from"./button-wdWSPx_B.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
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,Bt as i,Ct as a,G as o,H as s,Ht as c,L as l,Mt as u,Ot as d,R as f,St as p,V as m,W as h,Xt as g,Zt as ee,wt as _,z as te,zt as ne}from"./button-wdWSPx_B.js";var v=/^[\w!#$%&'*.^`|~+-]+$/,re=(e,t,n={})=>{if(!v.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},ie=(e,t,n)=>(t=encodeURIComponent(t),re(e,t,n)),ae=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),oe=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},se=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},ce=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},le=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ue(e,t){if(!y(e)&&!y(t))return t;let n={...e};for(let e in t){let r=t[e];y(n[e])&&y(r)?n[e]=ue(n[e],r):n[e]=r}return n}var de=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return de(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),fe=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(ie(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=le(a),a=oe(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})}},pe=(e,t)=>de(function n(r){let i=t?.buildSearchParams??se,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=ae(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=oe(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=le(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=ce(r.args[0]&&r.args[0].param?oe(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 fe(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=ue(t,e);return l.fetch(r.args[0],a)}return l},[]);function me(e={}){let{baseUrl:t=``,token:n,headers:r,fetch:i}=e;return pe(t,{headers:{...n?{Authorization:`Bearer ${n}`}:{},...r},...i?{fetch:i}:{}})}var b=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(){}},he=new class extends b{#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`}},ge={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=ge;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 _e(e){setTimeout(e,0)}var ve=typeof window>`u`||`Deno`in globalThis;function S(){}function ye(e,t){return typeof e==`function`?e(t):e}function be(e){return typeof e==`number`&&e>=0&&e!==1/0}function xe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function C(e,t){return typeof e==`function`?e(t):e}function w(e,t){return typeof e==`function`?e(t):e}function Se(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==we(o,t.options))return!1}else if(!Te(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 Ce(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!Te(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function we(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>ke(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Te(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Te(e[n],t[n])):!1}var Ee=Object.prototype.hasOwnProperty;function De(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Oe(e)&&Oe(t);if(!r&&!(ke(e)&&ke(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:Ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=De(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function E(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 Oe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ke(e){if(!Ae(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ae(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Ae(e){return Object.prototype.toString.call(e)===`[object Object]`}function je(e){return new Promise(t=>{x.setTimeout(t,e)})}function Me(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:De(e,t)}function Ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Pe(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Fe=Symbol();function Ie(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Fe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Le(e,t){return typeof e==`function`?e(...t):!!e}function Re(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 D=(()=>{let e=()=>ve;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=_e;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 O=Ve(),He=new class extends b{#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=()=>he.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??(D.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),je(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(),be(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(D.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.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=>{Re(e,()=>t.signal,()=>n=!0)},u=Ie(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?Pe:Ne;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=Me(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(S).catch(S):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=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Fe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>C(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:!xe(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=Ie(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),O.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 k=class extends b{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),it(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return at(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return at(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 w(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&&!E(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ot(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||C(this.options.staleTime,this.#t)!==C(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(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 ct(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(S)),t}#g(){this.#b();let e=C(this.options.staleTime,this.#t);if(D.isServer()||this.#r.isStale||!be(e))return;let t=xe(this.#r.dataUpdatedAt,e)+1;this.#d=x.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,!(D.isServer()||w(this.options.enabled,this.#t)===!1||!be(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||he.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.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&&it(e,t),o=i&&ot(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=Me(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=Me(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`,ee=m===`pending`,_=m===`error`,te=ee&&g,ne=d!==void 0,v={status:m,fetchStatus:l.fetchStatus,isPending:ee,isSuccess:m===`success`,isError:_,isInitialLoading:te,isLoading:te,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&&!ee,isLoadingError:_&&!ne,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:_&&ne,isStale:st(e,t),refetch:this.refetch,promise:this.#o,isEnabled:w(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=v.data!==void 0,r=v.status===`error`&&!t,i=e=>{r?e.reject(v.error):t&&e.resolve(v.data)},a=()=>{let e=this.#o=v.promise=ze();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||v.data!==o.value)&&a();break;case`rejected`:(!r||v.error!==o.reason)&&a();break}}return v}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),!E(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){O.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function rt(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&w(t.retryOnMount,e)===!1)}function it(e,t){return rt(e,t)||e.state.data!==void 0&&at(e,t,t.refetchOnMount)}function at(e,t,n){if(w(t.enabled,e)!==!1&&C(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&st(e,t)}return!1}function ot(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&st(e,n)}function st(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(C(t.staleTime,e))}function ct(e,t){return!E(e.getCurrentResult(),t)}var lt=class extends k{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}}},ut=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||dt(),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),O.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function dt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ft=class extends b{#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),E(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&T(t.mutationKey)!==T(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??dt();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){O.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 pt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function mt(e,t,n){let r=e.slice(0);return r[t]=n,r}var ht=class extends b{#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,O.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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(pt(e,n).forEach(e=>{e.destroy()}),pt(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=De(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 k(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=mt(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)&&O.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},A=e(t(),1),gt=n(),_t=A.createContext(void 0),j=e=>{let t=A.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})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,gt.jsx)(_t.Provider,{value:e,children:t})),yt=A.createContext(!1),bt=()=>A.useContext(yt);yt.Provider;function xt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var St=A.createContext(xt()),Ct=()=>A.useContext(St),wt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Le(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Tt=e=>{A.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||Le(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=j(n),i=bt(),a=Ct(),o=A.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]=A.useState(()=>new ht(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;A.useSyncExternalStore(A.useCallback(e=>d?s.subscribe(O.batchCalls(e)):S,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),A.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 k(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=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Dt(o),wt(o,i,s),Tt(i);let l=!a.getQueryCache().get(o.queryHash),[u]=A.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(A.useSyncExternalStore(A.useCallback(e=>{let t=f?u.subscribe(O.batchCalls(e)):S;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.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&&!D.isServer()&&Ot(d,r)&&(l?At(o,u,i):s?.promise)?.catch(S).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function M(e,t){return Mt(e,k,t)}function N(e,t){let n=j(t),[r]=A.useState(()=>new ft(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((e,t)=>{r.mutate(e,t).catch(S)},[r]);if(i.error&&Le(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function P(e,t){return Mt(e,lt,t)}var Nt={projectId:null,apiBase:l},Pt=(0,A.createContext)(Nt);function Ft(){return(0,A.useContext)(Pt)}function It({projectId:e,children:t}){r()!==e&&h(e),(0,A.useLayoutEffect)(()=>{h(e)},[e]),(0,A.useLayoutEffect)(()=>()=>h(null),[]);let n=(0,A.useMemo)(()=>e===null?Nt:{projectId:e,apiBase:`${l}/p/${encodeURIComponent(e)}`},[e]);return(0,gt.jsx)(Pt.Provider,{value:n,children:t})}var F=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],Lt=new Set([`connected`,`disconnected`,`not-installed`,`unknown`]);function Rt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zt(e,t){if(!Rt(e))return null;let{provider:n,status:r,enabled:i,hint:a,authFailureId:o}=e;return typeof n!=`string`||!F.includes(n)||typeof r!=`string`||!Lt.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 Bt(e){return zt(e,!1)}function Vt(e,t){if(!Rt(e)||!Array.isArray(e.providers))return null;let n=[],r=new Set;for(let i of e.providers){let e=zt(i,t);if(e===null||r.has(e.provider))return null;r.add(e.provider),n.push(e)}return n}function I(e){let t=Vt(e,!0);if(t===null||t.length===0)return null;let n=new Map(t.map(e=>[e.provider,e]));return F.flatMap(e=>{let t=n.get(e);return t?[t]:[]})}function L(e){let t=I(e);if(t===null)throw Error(`Invalid provider status response`);return{providers:t}}function Ht(e,t){let n=I(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 Ut(e,t,n,r){let i=I(e),a=I(t),o=I(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:Wt(t,n)?e:i?{...e,enabled:n.enabled}:n})}}function Wt(e,t){return e.provider===t.provider&&e.status===t.status&&e.enabled===t.enabled&&e.hint===t.hint&&e.authFailureId===t.authFailureId}function Gt(e){let t=I(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 F.filter(e=>n.has(e))}function Kt(e,t){return I(e)?.find(e=>e.provider===t)}var qt=`cezar:sid`,Jt;function Yt(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 Xt(){try{let e=localStorage.getItem(qt);if(e)return e;let t=Yt();return localStorage.setItem(qt,t),t}catch{return Jt??=Yt()}}var Zt=`x-cezar-sid`;function Qt(){Jt=void 0;try{localStorage.removeItem(qt)}catch{}}function $t(e){if(typeof e!=`object`||!e)return;let{name:t,message:n}=e;return{name:typeof t==`string`?t:`unknown`,message:typeof n==`string`?n:``}}var en=/\/(?:providers|agent-profiles)(?:\/|$)/;function tn(e,t){if(!en.test(e))return;let n=e.split(`/`),r=n[n.indexOf(`providers`)+1];if(n.includes(`providers`)&&p.safeParse(r).success)return r;if(typeof t==`string`)try{let e=JSON.parse(t).provider;return p.safeParse(e).success?e:void 0}catch{return}}var nn=null;function rn(e,t,n,r,i){try{let a=new URL(e,window.location.origin).pathname,o=tn(a,r),s=$t(i);nn={method:(t??`GET`).toUpperCase(),path:a,status:n,at:Date.now(),...o?{provider:o}:{},...s?{cause:s}:{}}}catch{}}function an(e=3e3,t=Date.now()){return nn&&t-nn.at<=e?nn:null}var R=class extends Error{status;manual;command;runIds;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,this.runIds=n.runIds}};function z(e){try{return JSON.parse(e)}catch{return}}function on(e){return typeof e==`string`?e:void 0}var sn=`the request was too large for the server, or for a proxy in front of it — attach fewer or smaller files, or raise the proxy body limit (nginx: client_max_body_size 32m)`;function B(e,t,n){let r=z(n),i=r&&typeof r==`object`?r:{},a=on(i.error)??(e===413?sn:`${e} ${t||`request failed`}`.trim()),s=e===409?o.safeParse(r):void 0;return new R(e,a,{...s?.success?{runIds:s.data.runIds}:{},manual:on(i.manual),command:on(i.command),exists:typeof i.exists==`boolean`?i.exists:void 0})}var V=me({fetch:(e,t)=>fn(cn(String(e)),t)});function cn(e){let t=un(e.endsWith(`?`)?e.slice(0,-1):e);return t.startsWith(`/`)?`${te()}${t}`:t}var ln=`${l}/p/default`;function un(e){if(r()!==null||!e.startsWith(ln))return e;let t=e.slice(ln.length);return t===``||t.startsWith(`/`)||t.startsWith(`?`)?`${l}${t}`:e}var H=e=>({init:{signal:e?.signal}});async function U(e){try{return await e.text()}catch(t){throw t instanceof DOMException&&t.name===`AbortError`?t:(rn(e.url,void 0,0,void 0,t),new R(0,`cannot reach the cezar server (${e.url})`,{cause:t}))}}async function W(e,t){let n=await U(e);if(!e.ok)throw B(e.status,e.statusText,n);let r=z(n);if(r===void 0)throw new R(e.status,`the cezar server answered ${t} with a non-JSON body`);return r}async function dn(e,t,n){let r=e.status,i=await W(e,t),a=n.safeParse(i);if(!a.success)throw new R(r,`the cezar server answered ${t} with an unexpected body`);return a.data}async function fn(e,t){try{let n=new Headers(t?.headers);n.set(Zt,Xt());let r=await fetch(e,{...t,headers:n,credentials:`include`});return r.ok||rn(e,t?.method,r.status,t?.body),r}catch(n){throw n instanceof DOMException&&n.name===`AbortError`?n:(rn(e,t?.method,0,t?.body,n),new R(0,`cannot reach the cezar server (${e})`,{cause:n}))}}async function pn(e,t){return fn(f(e),t)}async function mn(e,t={}){let n=new Headers(t.headers);n.set(`accept`,`text/plain`);let r=await pn(e,{...t,headers:n}),i=await U(r);if(!r.ok)throw B(r.status,r.statusText,i);return i}var G=(e,t=``)=>`/runs/${encodeURIComponent(e)}${t}`;async function hn(e){return W(await V.api.v1.health.$get({},H(e)),`/health`)}async function gn(e){return W(await V.api.v1[`star-count`].$get({},H(e)),`/star-count`)}async function _n(e){return W(await V.api.v1.preview[`design-proxy`].$post({json:e}),`/preview/design-proxy`)}async function vn(e){return W(await V.api.v1.telemetry.consent.$get({},H(e)),`/telemetry/consent`)}async function yn(e){return W(await V.api.v1.telemetry.consent.$put({json:e}),`/telemetry/consent`)}async function bn(e,t){return W(await V.api.v1.models.$get({query:{runner:e}},H(t)),`/models`)}async function xn(e=!1,t){return L(await W(await V.api.v1.providers.status.$get({query:e?{refresh:`1`}:{}},H(t)),`/providers/status`))}async function Sn(e){return W(await V.api.v1.p[`:projectId`][`launch-key`].$get({param:{projectId:m()}},H(e)),`/launch-key`)}async function Cn(e){return W(await V.api.v1.projects.$get({},H(e)),`/projects`)}async function wn(e,t){return W(await V.api.v1.fs.browse.$get({query:{path:e===``?void 0:e,...t?.showHidden?{showHidden:`1`}:{}}},H(t)),`/fs/browse`)}async function Tn(e){return W(await V.api.v1.fs.repos.$get({},H(e)),`/fs/repos`)}async function En(e){return W(await V.api.v1.projects[`:projectId`][`git-init`].$post({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}/git-init`)}async function Dn(e,t){return W(await V.api.v1.projects[`:projectId`][`publish-github`].$post({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}/publish-github`)}async function On(){return W(await V.api.v1.github.login.$post(),`/github/login`)}async function kn(e){return W(await V.api.v1.github.login.$get({},H(e)),`/github/login`)}async function An(){return W(await V.api.v1.github.login.$delete(),`/github/login`)}async function jn(e){return W(await V.api.v1.p[`:projectId`].runs.$get({param:{projectId:m()},query:{}},H(e)),`/runs`)}async function Mn(e,t){return W(await V.api.v1.p[`:projectId`].runs.$get({param:{projectId:e},query:{}},H(t)),`/runs`)}async function Nn(e){return W(await V.api.v1.workspace[`runs-index`].$get({},H(e)),`/workspace/runs-index`)}async function Pn(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e))}async function Fn(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].$get({param:{projectId:e,id:encodeURIComponent(t)}},H(n)),G(t))}async function In(e,t,n){return dn(await V.api.v1.p[`:projectId`].runs[`:id`].history.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{...t===void 0?{}:{cursor:t}}},H(n)),`${G(e)}/history`,ee)}async function Ln(e,t){return dn(await V.api.v1.p[`:projectId`].runs[`:id`][`history-context`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),`${G(e)}/history-context`,g)}async function Rn(e){return W(await V.api.v1.p[`:projectId`][`ui-state`].$get({param:{projectId:m()}},H(e)),`/ui-state`)}async function zn(e){return W(await V.api.v1.p[`:projectId`].workflows.$get({param:{projectId:m()}},H(e)),`/workflows`)}async function Bn(e){return W(await V.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{}},H(e)),`/skills`)}async function Vn(e){return W(await V.api.v1.p[`:projectId`].skills.$get({param:{projectId:m()},query:{wait:`1`}},H(e)),`/skills`)}async function Hn(){return W(await V.api.v1.p[`:projectId`].skills.refresh.$post({param:{projectId:m()}}),`/skills/refresh`)}async function Un(e){return W(await V.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{}},H(e)),`/skills/importable`)}async function Wn(e){return W(await V.api.v1.p[`:projectId`].skills.importable.$get({param:{projectId:m()},query:{wait:`1`}},H(e)),`/skills/importable`)}async function Gn(e){return W(await V.api.v1.p[`:projectId`].todos.$get({param:{projectId:m()}},H(e)),`/todos`)}async function Kn(e){return W(await V.api.v1.p[`:projectId`].repo.$get({param:{projectId:m()}},H(e)),`/repo`)}async function qn(e){return W(await V.api.v1.p[`:projectId`].config.$get({param:{projectId:m()}},H(e)),`/config`)}async function Jn(e={}){return W(await V.api.v1.p[`:projectId`][`agent-config`].$get({param:{projectId:m()}},H(e)),`/agent-config`)}async function Yn(e,t={}){return W(await V.api.v1.p[`:projectId`][`agent-config`][`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),`/agent-config/${encodeURIComponent(e)}`)}async function Xn(e,t){return W(await V.api.v1.p[`:projectId`][`agent-config`][`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/agent-config/${encodeURIComponent(e)}`)}async function Zn(e){return W(await V.api.v1.p[`:projectId`].repo.changes.$get({param:{projectId:m()}},H(e)),`/repo/changes`)}async function Qn(e){return W(await V.api.v1.p[`:projectId`].repo.tree.$get({param:{projectId:m()}},H(e)),`/repo/tree`)}async function $n(e,t){return W(await V.api.v1.p[`:projectId`].repo.files.$get({param:{projectId:m()},query:{path:e}},H(t)),`/repo/files`)}function er(e){return f(`/repo/files?path=${encodeURIComponent(e)}&raw=1`)}async function tr(e,t){return W(await V.api.v1.p[`:projectId`].repo.commit[`:sha`].$get({param:{projectId:m(),sha:encodeURIComponent(e)},query:{structured:`1`}},H(t)),`/repo/commit/:sha`)}async function nr(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].tree.$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e,`/tree`))}async function rr(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].commits.$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e,`/commits`))}async function ir(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].commit[`:sha`].$get({param:{projectId:m(),id:encodeURIComponent(e),sha:encodeURIComponent(t)}},H(n)),G(e,`/commit/${encodeURIComponent(t)}`))}async function ar(e={},t){return W(await V.api.v1.p[`:projectId`].github.$get({param:{projectId:m()},query:{limit:e.limit===void 0?void 0:String(e.limit),refresh:e.refresh?`1`:void 0,issuesCursor:e.issuesCursor,prsCursor:e.prsCursor,issuesDone:e.issuesDone?`1`:void 0,prsDone:e.prsDone?`1`:void 0}},H(t)),`/github`)}async function or(e={},t){return W(await V.api.v1.p[`:projectId`].tracker[`automation-options`].$get({param:{projectId:m()},query:e},H(t)),`/tracker/automation-options`)}async function sr(e){return W(await V.api.v1.p[`:projectId`].tracker.connection.$get({param:{projectId:m()}},H(e)),`/tracker/connection`)}async function cr(e){return W(await V.api.v1.p[`:projectId`].tracker.connection.$put({param:{projectId:m()},json:e}),`/tracker/connection`)}async function lr(){return W(await V.api.v1.p[`:projectId`].tracker.connection.$delete({param:{projectId:m()}}),`/tracker/connection`)}async function ur(e){return W(await V.api.v1.p[`:projectId`].secrets.$get({param:{projectId:m()}},H(e)),`/secrets`)}async function dr(e){return W(await V.api.v1.workspace.secrets.$get({},H(e)),`/workspace/secrets`)}async function fr(e){if(!e.ok)throw B(e.status,e.statusText,await U(e))}async function pr(e,t){await fr(await V.api.v1.p[`:projectId`].secrets[`:name`].$put({param:{projectId:m(),name:e},json:t}))}async function mr(e){await fr(await V.api.v1.p[`:projectId`].secrets[`:name`].$delete({param:{projectId:m(),name:e}}))}async function hr(e,t){await fr(await V.api.v1.workspace.secrets[`:name`].$put({param:{name:e},json:t}))}async function gr(e){await fr(await V.api.v1.workspace.secrets[`:name`].$delete({param:{name:e}}))}async function _r(e){return W(await V.api.v1.p[`:projectId`].e2e.$get({param:{projectId:m()}},H(e)),`/e2e`)}async function vr(e){return W(await V.api.v1.p[`:projectId`].e2e.setup.$post({param:{projectId:m()},json:e}),`/e2e/setup`)}async function yr(e){return W(await V.api.v1.p[`:projectId`].tracker.association.$get({param:{projectId:m()}},H(e)),`/tracker/association`)}async function br(e,t={},n){return W(await V.api.v1.p[`:projectId`].tracker.candidates.$get({param:{projectId:m()},query:{kind:e,q:t.q,cursor:t.cursor,limit:t.limit===void 0?void 0:String(t.limit)}},H(n)),`/tracker/candidates`)}async function xr(e){return W(await V.api.v1.p[`:projectId`].tracker.association.$put({param:{projectId:m()},json:e}),`/tracker/association`)}async function Sr(){return W(await V.api.v1.p[`:projectId`].tracker.association.$delete({param:{projectId:m()}}),`/tracker/association`)}function Cr(e){return{expectedScope:e.association?ne(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 wr(e={},t){return W(await V.api.v1.p[`:projectId`].tracker.$get({param:{projectId:m()},query:Cr(e)},H(t)),`/tracker`)}async function Tr(e,t={},n){return W(await V.api.v1.p[`:projectId`].tracker.search.$get({param:{projectId:m()},query:{...Cr(t),q:e}},H(n)),`/tracker/search`)}async function Er(e,t){return W(await V.api.v1.p[`:projectId`].tracker[`:id`].$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{expectedScope:t?.association?ne(t.association):void 0}},H(t)),`/tracker/${encodeURIComponent(e)}`)}async function Dr(e,t){return W(await V.api.v1.p[`:projectId`].github.checks.$get({param:{projectId:m()},query:{prs:e.join(`,`)}},H(t)),`/github/checks`)}async function Or(e,t,n={},r){return W(await V.api.v1.p[`:projectId`].github.search.$get({param:{projectId:m()},query:{kind:e,q:t,limit:n.limit}},H(r)),`/github/search`)}async function kr(e,t,n){return W(await V.api.v1.p[`:projectId`].github[`ref-status`].$get({param:{projectId:e},query:{...t.prs?.length?{prs:t.prs.join(`,`)}:{},...t.issues?.length?{issues:t.issues.join(`,`)}:{}}},H(n)),`/github/ref-status`)}async function Ar(e,t,n={},r){return W(await V.api.v1.p[`:projectId`].github.comments[`:kind`][`:number`].$get({param:{projectId:m(),kind:e,number:String(t)},query:{refresh:n.refresh?`1`:void 0}},H(r)),`/github/comments/${e}/${t}`)}async function jr(e,t={},n){return W(await V.api.v1.p[`:projectId`].github.prs[`:number`][`merge-state`].$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},H(n)),`/github/prs/${e}/merge-state`)}async function Mr(e,t){return W(await V.api.v1.p[`:projectId`].github.prs[`:number`].merge.$post({param:{projectId:m(),number:String(e)},json:t}),`/github/prs/:number/merge`)}async function Nr(e,t={},n){return W(await V.api.v1.p[`:projectId`].github.prs[`:number`].changes.$get({param:{projectId:m(),number:String(e)},query:{refresh:t.refresh?`1`:void 0}},H(n)),`/github/prs/${e}/changes`)}function Pr(e,t){return mn(G(e,`/diff`),{method:`GET`,signal:t?.signal})}function Fr(e,t){return mn(G(e,`/handoff`),{method:`GET`,signal:t?.signal})}async function Ir(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].changes.$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e,`/changes`))}async function Lr(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].files.$get({param:{projectId:m(),id:encodeURIComponent(e)},query:{path:t}},H(n)),`/runs/:id/files`)}function Rr(e,t,n){let r=n?`&rev=${encodeURIComponent(n)}`:``;return f(G(e,`/files?path=${encodeURIComponent(t)}&raw=1${r}`))}async function zr(e,t){return W(await V.api.v1.p[`:projectId`].groups[`:groupId`].$get({param:{projectId:m(),groupId:encodeURIComponent(e)}},H(t)),`/groups/${encodeURIComponent(e)}`)}async function Br(e,t){return W(await V.api.v1.providers.connect.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/connect`)}async function Vr(e){return W(await V.api.v1.providers[`:provider`].update.$post({param:{provider:e}}),`/providers/${encodeURIComponent(e)}/update`)}async function Hr(e,t){return L(await W(await V.api.v1.providers[`:provider`].enabled.$put({param:{provider:e},json:{enabled:t}}),`/providers/${encodeURIComponent(e)}/enabled`))}async function Ur(e,t){return L(await W(await V.api.v1.providers[`:provider`].retry.$post({param:{provider:e},json:{authFailureId:t}}),`/providers/${encodeURIComponent(e)}/retry`))}async function Wr(e){let t=`/projects`,n=await pn(t,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({root:e})}),r=await U(n),i=z(r),a=i?.project;if((n.ok||n.status===409)&&a!=null)return i;throw n.ok?new R(n.status,`the cezar server answered ${t} without a project`):B(n.status,n.statusText,r)}async function Gr(e){return W(await V.api.v1.projects.checkout.$post({json:e}),`/projects/checkout`)}async function Kr(e){return W(await V.api.v1.projects.create.$post({json:e}),`/projects/create`)}async function qr(e){return dn(await V.api.v1.projects[`github-owners`].$get({},H(e)),`/projects/github-owners`,d)}async function Jr(e){return W(await V.api.v1.projects[`:projectId`].$delete({param:{projectId:encodeURIComponent(e)}}),`/projects/${encodeURIComponent(e)}`)}async function Yr(e,t){return W(await V.api.v1.projects[`:projectId`].$patch({param:{projectId:encodeURIComponent(e)},json:t}),`/projects/${encodeURIComponent(e)}`)}async function Xr(e){return W(await V.api.v1.p[`:projectId`].runs.$post({param:{projectId:m()},json:e}),`/runs`)}async function Zr(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].cancel.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/cancel`))}async function Qr(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`start-now`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/start-now`))}async function $r(e,t=!0,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{archived:t,...n?{surface:n}:{}}}),G(e,`/archive`))}async function ei(e,t=!0,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{pinned:t,...n?{surface:n}:{}}}),G(e,`/pin`))}async function ti(e,t,n=!0,r){return W(await V.api.v1.p[`:projectId`].runs[`:id`].pin.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{pinned:n,...r?{surface:r}:{}}}),G(t,`/pin`))}async function ni(e,t,n=!0,r){return W(await V.api.v1.p[`:projectId`].runs[`:id`].archive.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{archived:n,...r?{surface:r}:{}}}),G(t,`/archive`))}async function ri(e,t,n){let r=n?`read`:`unread`;return W(await(n?V.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:e,id:encodeURIComponent(t)}}):V.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:e,id:encodeURIComponent(t)}})),G(t,`/${r}`))}async function ii(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`auto-resume`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/auto-resume`))}async function ai(){return W(await V.api.v1.p[`:projectId`].runs[`archive-finished`].$post({param:{projectId:m()}}),`/runs/archive-finished`)}async function oi(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].read.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/read`))}async function si(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].unread.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/unread`))}async function ci(){return W(await V.api.v1.p[`:projectId`].runs[`read-all`].$post({param:{projectId:m()}}),`/runs/read-all`)}async function li(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].land.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/land`))}async function ui(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].finish.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/finish`))}async function di(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},...t.idempotencyKey===void 0?{}:{idempotencyKey:t.idempotencyKey}};return W(await V.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:n}),G(e,`/continue`))}async function fi(e,t,n={}){return W(await V.api.v1.p[`:projectId`].runs[`:id`].continue.$post({param:{projectId:e,id:encodeURIComponent(t)},json:{...n.text===void 0?{}:{text:n.text},...n.images===void 0?{}:{images:n.images},...n.runner===void 0?{}:{runner:n.runner},...n.model===void 0?{}:{model:n.model},...n.agentProfile===void 0?{}:{agentProfile:n.agentProfile},...n.idempotencyKey===void 0?{}:{idempotencyKey:n.idempotencyKey}}}),G(t,`/continue`))}var pi=1e3;async function mi(e,t={}){let n=m(),r=async()=>W(await V.api.v1.p[`:projectId`].runs[`:id`].pr.$post({param:{projectId:n,id:encodeURIComponent(e)},json:t}),G(e,`/pr`));try{return await r()}catch(e){if(!(e instanceof R)||e.status!==0)throw e;await new Promise(e=>setTimeout(e,pi));try{return await r()}catch(t){throw t instanceof R&&t.status===0?e:t}}}async function hi(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].pr.adopt.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/pr/adopt`))}async function gi(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].$patch({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),G(e))}async function _i(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e))}async function vi(e){return W(await V.api.v1.p[`:projectId`].todos[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)}}),`/todos/${encodeURIComponent(e)}`)}async function yi(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 W(await V.api.v1.p[`:projectId`].todos[`:id`].start.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:Object.keys(n).length>0?n:void 0}),`/todos/${encodeURIComponent(e)}/start`)}async function bi(e,t){return W(await V.api.v1.p[`:projectId`].groups[`:groupId`].pick.$post({param:{projectId:m(),groupId:encodeURIComponent(e)},json:{runId:t}}),`/groups/${encodeURIComponent(e)}/pick`)}async function xi(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in-cli`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/open-in-cli`))}async function Si(e){return W(await V.api.v1.p[`:projectId`][`open-targets`].$get({param:{projectId:m()}},H(e)),`/open-targets`)}async function Ci(e){return W(await V.api.v1.p[`:projectId`][`open-in`].$post({param:{projectId:m()},json:{target:e}}),`/open-in`)}async function wi(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:t}}),G(e,`/open-in`))}async function Ti(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`open-in`].$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{target:`default`,path:t}}),G(e,`/open-in`))}async function Ei(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].git.commit.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{message:t}}),G(e,`/git/commit`))}async function Di(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].git.status.$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e,`/git/status`))}async function Oi(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].git.push.$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/git/push`))}var ki=[250,750,1500],Ai=e=>new Promise(t=>setTimeout(t,e));async function ji(e,t,n=Ai){let r={text:t.text??``,images:t.images??[],idempotencyKey:t.idempotencyKey??Yt()};for(let t=0;;t+=1)try{return await e(r)}catch(e){let r=ki[t];if(!(e instanceof R)||e.status!==0||r===void 0)throw e;await n(r)}}async function Mi(e,t){return ji(async t=>W(await V.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),G(e,`/messages`)),t)}async function Ni(e,t,n){return ji(async n=>W(await V.api.v1.p[`:projectId`].runs[`:id`].messages.$post({param:{projectId:e,id:encodeURIComponent(t)},json:n}),G(t,`/messages`)),n)}async function Pi(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$patch({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)},json:n}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function Fi(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`queued-messages`][`:msgId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),msgId:encodeURIComponent(t)}}),G(e,`/queued-messages/${encodeURIComponent(t)}`))}async function Ii(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].drafts.$get({param:{projectId:m(),id:encodeURIComponent(e)}},H(t)),G(e,`/drafts`))}var Li=56*1024;async function Ri(e,t,n,r){let i=r?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(n)).length<=Li;return W(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].$put({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n},{init:{keepalive:i}}),G(e,`/drafts/${t}`))}async function zi(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images.$post({param:{projectId:m(),id:encodeURIComponent(e),surface:t},json:n}),G(e,`/drafts/${t}/images`))}async function Bi(e){return W(await V.api.v1.workspace.uploads.$post({json:e}),`/workspace/uploads`)}async function Vi(e){return W(await V.api.v1.workspace.uploads[`:uploadId`].$delete({param:{uploadId:e}}),`/workspace/uploads/${e}`)}async function Hi(e,t,n,r){return W(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$get({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}},H(r)),G(e,`/drafts/${t}/images/${n}`))}async function Ui(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].drafts[`:surface`].images[`:imageId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),surface:t,imageId:n}}),G(e,`/drafts/${t}/images/${n}`))}async function Wi(e){return W(await V.api.v1.p[`:projectId`].repo.branch.$post({param:{projectId:m()},json:e}),`/repo/branch`)}async function Gi(e){return W(await V.api.v1.p[`:projectId`].repo.sync.$get({param:{projectId:m()}},H(e)),`/repo/sync`)}async function Ki(e){let t={param:{projectId:m()}},n=V.api.v1.p[`:projectId`].repo;return W(e===`fetch`?await n.fetch.$post(t):e===`pull`?await n.pull.$post(t):e===`push`?await n.push.$post(t):await n.sync.$post(t),`/repo/${e}`)}async function qi(e){return W(await V.api.v1.p[`:projectId`].plan.$post({param:{projectId:m()},json:{task:e}}),`/plan`)}async function Ji(e){return W(await V.api.v1.p[`:projectId`].automations.$get({param:{projectId:m()}},H(e)),`/automations`)}async function Yi(e){return W(await V.api.v1.p[`:projectId`].automations.$post({param:{projectId:m()},json:e}),`/automations`)}async function Xi(e,t){return W(await V.api.v1.p[`:projectId`].automations[`:id`].$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),`/automations/${encodeURIComponent(e)}`)}async function Zi(e,t){let n={projectId:m(),id:encodeURIComponent(e)},r=`/automations/${encodeURIComponent(e)}/${t?`enable`:`pause`}`;return W(t?await V.api.v1.p[`:projectId`].automations[`:id`].enable.$post({param:n}):await V.api.v1.p[`:projectId`].automations[`:id`].pause.$post({param:n}),r)}async function Qi(e,t){return W(await V.api.v1.p[`:projectId`].automations[`:id`].check.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:{mode:t}}),`/automations/${encodeURIComponent(e)}/check`)}async function $i(e,t){return W(await V.api.v1.p[`:projectId`][`automation-log`].$get({param:{projectId:m()},query:{automationId:e}},H(t)),`/automation-log?automationId=${encodeURIComponent(e)}`)}async function ea(e){return W(await V.api.v1.p[`:projectId`][`automation-log`][`:receiptId`].retry.$post({param:{projectId:m(),receiptId:encodeURIComponent(e)}}),`/automation-log/${encodeURIComponent(e)}/retry`)}async function ta(e,t){return W(await V.api.v1.p[`:projectId`].automations[`:id`].run.$post({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}}),`/automations/${encodeURIComponent(e)}/run`)}async function na(e,t){let n=await V.api.v1.p[`:projectId`].automations[`:id`].$delete({param:{projectId:m(),id:encodeURIComponent(e)},query:t?{expectedRevision:String(t)}:{}});if(!n.ok)throw B(n.status,n.statusText,await U(n))}async function ra(e,t){return W(await V.api.v1.workspace[`automation-templates`].$get({query:e?{exclude:e}:{}},H(t)),`/workspace/automation-templates`)}async function ia(e){return W(await V.api.v1.p[`:projectId`].workflows.$post({param:{projectId:m()},json:e}),`/workflows`)}async function aa(e){return W(await V.api.v1.p[`:projectId`].workflows.nodes.$get({param:{projectId:m()}},H(e)),`/workflows/nodes`)}async function oa(e){return W(await V.api.v1.p[`:projectId`].workflows.validate.$post({param:{projectId:m()},json:{graph:e}}),`/workflows/validate`)}async function sa(e){return W(await V.api.v1.p[`:projectId`].workflows.graph.$post({param:{projectId:m()},json:e}),`/workflows/graph`)}async function ca(e){return W(await V.api.v1.p[`:projectId`].workflows.parse.$post({param:{projectId:m()},json:{yaml:e}}),`/workflows/parse`)}async function la(e){return W(await V.api.v1.p[`:projectId`].workflows[`:name`].$delete({param:{projectId:m(),name:encodeURIComponent(e)}}),`/workflows/${encodeURIComponent(e)}`)}async function ua(e,t=m()){return W(await V.api.v1.p[`:projectId`][`ui-state`].$put({param:{projectId:t},json:e}),`/ui-state`)}async function da(e){return W(await V.api.v1.workspace[`ui-state`].$get({},H(e)),`/workspace/ui-state`)}async function fa(e,t={}){return W(await V.api.v1.workspace[`ui-state`].$put({json:e},{init:{keepalive:t.keepalive}}),`/workspace/ui-state`)}async function pa(e){let t=await W(await V.api.v1.workspace.config.$get({},H(e)),`/workspace/config`);return{...t,branding:t.branding?{...t.branding,logoUrl:t.branding.logoUrl?s(t.branding.logoUrl):null}:{name:`cezar`,logoUrl:null},agentDefaults:t.agentDefaults??{},orgSkillsRepos:t.orgSkillsRepos??[],resources:{...t.resources,idleTimeoutMinutes:t.resources.idleTimeoutMinutes===void 0?15:t.resources.idleTimeoutMinutes}}}async function ma(e){let t=new FormData;t.set(`file`,e);let n=await pn(`/workspace/branding-logo`,{method:`POST`,body:t}),r=await U(n);if(!n.ok)throw B(n.status,n.statusText,r);let i=z(r),a=_.safeParse(i);if(!a.success)throw new R(n.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return a.data.logoUrl?s(a.data.logoUrl):null}async function ha(){let e=await pn(`/workspace/branding-logo`,{method:`DELETE`}),t=await U(e);if(!e.ok)throw B(e.status,e.statusText,t);let n=_.safeParse(z(t));if(!n.success)throw new R(e.status,`the cezar server answered /workspace/branding-logo with an unexpected body`);return n.data.logoUrl?s(n.data.logoUrl):null}async function ga(e){return W(await V.api.v1.workspace[`host-usage`].$get({},H(e)),`/workspace/host-usage`)}async function _a(e){let t=await W(await V.api.v1.workspace[`agent-profiles`].$get({},H(e)),`/workspace/agent-profiles`);return{...t,profileCapableProviders:t.profileCapableProviders??[],selections:t.selections??{},defaults:t.defaults??{},profiles:(t.profiles??[]).map(e=>({...e,files:e.files??[]}))}}async function va(e){return W(await V.api.v1.workspace[`agent-profiles`].$post({json:e}),`/workspace/agent-profiles`)}async function ya(e,t){return W(await V.api.v1.workspace[`agent-profiles`][`:id`].status.$get({param:{id:encodeURIComponent(e)},query:{...t?.refresh||t?.recheck?{refresh:`1`}:{},...t?.recheck?{recheck:`1`}:{}}},H(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/status`)}async function ba(e,t){return W(await V.api.v1.workspace[`agent-profiles`][`:id`].details.$get({param:{id:encodeURIComponent(e)}},H(t)),`/workspace/agent-profiles/${encodeURIComponent(e)}/details`)}async function xa(e,t){return W(await V.api.v1.workspace[`agent-profiles`][`:id`].open.$post({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}/open`)}async function Sa(e){return W(await V.api.v1.workspace[`agent-profiles`].selection.$put({json:e}),`/workspace/agent-profiles/selection`)}async function Ca(e,t){return W(await V.api.v1.workspace[`agent-profiles`][`:id`].$patch({param:{id:encodeURIComponent(e)},json:t}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function wa(e){return W(await V.api.v1.workspace[`agent-profiles`][`:id`].$delete({param:{id:encodeURIComponent(e)}}),`/workspace/agent-profiles/${encodeURIComponent(e)}`)}async function Ta(e,t){return W(await V.api.v1.workspace[`skills-update`].$get({query:{projectId:e}},H(t)),`/workspace/skills-update?projectId=${encodeURIComponent(e)}`)}async function Ea(e){return W(await V.api.v1.workspace[`skills-update`].check.$post({json:{projectId:e}}),`/workspace/skills-update/check`)}async function Da(e){return W(await V.api.v1.workspace[`skills-update`].apply.$post({json:{projectId:e}}),`/workspace/skills-update/apply`)}async function Oa(e){return W(await V.api.v1.workspace[`self-update`].$get({},H(e)),`/workspace/self-update`)}async function ka(){return W(await V.api.v1.workspace[`self-update`].refresh.$post({}),`/workspace/self-update/refresh`)}async function Aa(e){return W(await V.api.v1.workspace[`self-update`].development.$get({query:e?.refresh?{refresh:`1`}:{}},H(e)),`/workspace/self-update/development`)}async function ja(e){return W(await V.api.v1.workspace[`self-update`].channel.$put({json:{channel:e}}),`/workspace/self-update/channel`)}async function Ma(e){return W(await V.api.v1.workspace[`self-update`].apply.$post({json:{version:e}}),`/workspace/self-update/apply`)}async function Na(e){return W(await V.api.v1.workspace[`self-update`].apply.$post({json:{version:e,whenIdle:!0}}),`/workspace/self-update/apply`)}async function Pa(){return W(await V.api.v1.workspace[`self-update`].scheduled.$delete({}),`/workspace/self-update/scheduled`)}async function Fa(e){let t=await W(await V.api.v1.workspace.config.$put({json:e}),`/workspace/config`);return{...t,orgSkillsRepos:t.orgSkillsRepos??[]}}async function Ia(e){return W(await V.api.v1.p[`:projectId`].config.$put({param:{projectId:m()},json:e}),`/config`)}async function La(e){return W(await V.api.v1.p[`:projectId`].worktrees.$get({param:{projectId:m()}},H(e)),`/worktrees`)}async function Ra(){return W(await V.api.v1.p[`:projectId`].worktrees.reclaim.$post({param:{projectId:m()},json:{}}),`/worktrees/reclaim`)}async function za(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`][`remove-worktree`].$post({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/remove-worktree`))}async function Ba(e,t,n){return i.parse(await W(await V.api.v1.p[`:projectId`].tracker.watch.$post({param:{projectId:e},json:t},{init:{signal:n}}),`/tracker/watch`))}async function Va(e,t,n,r){return c.parse(await W(await V.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$get({param:{projectId:e,watchId:t},query:{after:r===void 0?void 0:String(r)}},{init:{signal:n}}),`/tracker/watch`))}async function Ha(e,t,n){return c.parse(await W(await V.api.v1.p[`:projectId`].tracker.watch[`:watchId`].$post({param:{projectId:e,watchId:t}},{init:{signal:n}}),`/tracker/watch`))}var Ua={list:async(e,t)=>W(await V.api.v1.p[`:projectId`].webhooks.$get({param:{projectId:e}},{init:{signal:t}}),`/webhooks`),create:async(e,t)=>W(await V.api.v1.p[`:projectId`].webhooks.$post({param:{projectId:e},json:t}),`/webhooks`),update:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].$patch({param:{projectId:e,id:t},json:n}),`/webhooks`),remove:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].$delete({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),activate:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].activate.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),pause:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].pause.$post({param:{projectId:e,id:t},json:{expectedRevision:n}}),`/webhooks`),resume:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].resume.$post({param:{projectId:e,id:t},json:{expectedRevision:n,confirmed:!0}}),`/webhooks`),rotate:async(e,t,n,r)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`][`rotate-secret`].$post({param:{projectId:e,id:t},json:{expectedRevision:n,mode:r}}),`/webhooks`),test:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].test.$post({param:{projectId:e,id:t},json:n}),`/webhooks`),retry:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].retry.$post({param:{projectId:e,deliveryId:t},json:n}),`/webhooks`),replay:async(e,t,n)=>W(await V.api.v1.p[`:projectId`].webhooks.deliveries[`:deliveryId`].replay.$post({param:{projectId:e,deliveryId:t},json:{...n,confirmed:!0}}),`/webhooks`),acknowledge:async(e,t)=>W(await V.api.v1.p[`:projectId`].webhooks.notice.acknowledge.$post({param:{projectId:e},json:{expectedChangeSequence:t}}),`/webhooks`),history:async(e,t)=>W(await V.api.v1.p[`:projectId`].webhooks.history.$get({param:{projectId:e},query:{limit:`100`,...t?{cursor:t}:{}}}),`/webhooks/history`),deliveries:async(e,t,n,r)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].deliveries.$get({param:{projectId:e,id:t},query:{limit:`100`,...n?{cursor:n}:{},...r?{taskId:r}:{}}}),`/webhooks/deliveries`),activity:async(e,t)=>W(await V.api.v1.p[`:projectId`].webhooks[`:id`].activity.$get({param:{projectId:e,id:t}}),`/webhooks/activity`)};async function Wa(e={limit:50},t){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].$get({param:{projectId:m()},query:{cursor:e.cursor,limit:e.limit,attentionOnly:e.attentionOnly===void 0?void 0:e.attentionOnly?`true`:`false`}},H(t)),`/worktree-lifecycle`)}async function Ga(e,t){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`][`:worktreeId`].$get({param:{projectId:m(),worktreeId:e}},H(t)),`/worktree-lifecycle`)}async function Ka(e,t){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].$get({param:{projectId:m(),operationId:e}},H(t)),`/worktree-lifecycle/operations`)}async function qa(e,t=0,n){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].output.$get({param:{projectId:m(),operationId:e},query:{afterSeq:t,limit:100}},H(n)),`/worktree-lifecycle/operations/output`)}async function Ja(e){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations.$post({param:{projectId:m()},json:e}),`/worktree-lifecycle/operations`)}async function Ya(e,t){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].operations[`:operationId`].actions.$post({param:{projectId:m(),operationId:e},json:t}),`/worktree-lifecycle/operations/actions`)}async function Xa(e){return W(await V.api.v1.p[`:projectId`][`worktree-lifecycle`].preview.$post({param:{projectId:m()},json:e}),`/worktree-lifecycle/preview`)}async function Za(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/terminal`))}async function Qa(e,t){return W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.$post({param:{projectId:m(),id:encodeURIComponent(e)},json:t}),G(e,`/terminal`))}async function $a(e,t,n){return W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].output.$get({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},query:{cursor:String(n)}}),G(e,`/terminal/${t}/output`))}async function eo(e,t,n){await W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].input.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{data:n}}),G(e,`/terminal/${t}/input`))}async function to(e,t,n,r){await W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].resize.$post({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t},json:{cols:n,rows:r}}),G(e,`/terminal/${t}/resize`))}async function no(e,t){await W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal[`:sessionId`].$delete({param:{projectId:m(),id:encodeURIComponent(e),sessionId:t}}),G(e,`/terminal/${t}`))}async function ro(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.urls.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/terminal/urls`))}async function io(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].terminal.commands.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/terminal/commands`))}async function ao(){return W(await V.api.v1.p[`:projectId`][`start-app`].$get({param:{projectId:m()}}),`/start-app`)}async function oo(e){return W(await V.api.v1.p[`:projectId`][`start-app`].$put({param:{projectId:m()},json:e}),`/start-app`)}async function so(e){return W(await V.api.v1.p[`:projectId`].runs[`:id`].layouts.$get({param:{projectId:m(),id:encodeURIComponent(e)}}),G(e,`/layouts`))}async function co(e,t,n){let r=n?.keepalive===!0&&new TextEncoder().encode(JSON.stringify(t)).length<=Li;return W(await V.api.v1.p[`:projectId`].runs[`:id`].layouts.$put({param:{projectId:m(),id:encodeURIComponent(e)},json:t},{init:{keepalive:r}}),G(e,`/layouts`))}async function lo(e){return W(await V.api.v1.p[`:projectId`][`deferred-start`].preview.$post({param:{projectId:m()},json:e}),`/deferred-start/preview`)}async function uo(e){return W(await V.api.v1.p[`:projectId`][`deferred-start`].$post({param:{projectId:m()},json:e}),`/deferred-start`)}async function fo(e){return W(await V.api.v1.p[`:projectId`][`deferred-start`].options.$post({param:{projectId:m()},json:e}),`/deferred-start/options`)}function po(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!mo(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return ho(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 mo(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function mo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ho(e){return mo(e)&&typeof e.id==`string`&&e.id!==``}function go(e){return typeof e.task==`string`&&Array.isArray(e.steps)}function _o(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id),r=n<0?void 0:e[n];if(r!==void 0){let i=[...e];return i[n]=yo(r,t),i}if(!go(t))return e;let i=t.createdAt??``,a=e.findIndex(e=>(e.createdAt??``).localeCompare(i)<0),o=[...e];return o.splice(a<0?e.length:a,0,t),o}function vo(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function yo(e,t){let n={...t};if(!go(t)){let t=n;for(let n of u)n in e&&(t[n]=e[n])}let r=e=>e===`user`?2:+(e===`marker`);return r(e.titleOrigin)>r(t.titleOrigin)&&(n.title=e.title,n.titleSummary=e.titleSummary,n.titleOrigin=e.titleOrigin),e.usage&&(n.usage=e.usage),n}var bo=Object.freeze({});function xo(){let e=bo,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 So={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`}},Co={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function wo(e){return typeof e==`string`&&Object.hasOwn(So,e)}function To(e){return e!==void 0&&wo(e)?So[e]:void 0}var Eo={permission:0,error:1,waiting:2,running:3,unseen:4,none:5};function Do(e){return!1}function Oo(e){return!1}function ko(e){let t=e.dispatch?.overBudget?e.dispatch.budgetUsd:void 0;if(!(e.status!==`waiting`||t===void 0))return{spent:e.costUsd??0,ceiling:t}}function K(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function Ao(e){return!!e.worktreeLifecycle?.needsAttention||e.status===`waiting`||e.status===`review`||K(e)}function jo(e){let t=e.worktreeLifecycle;return t?.needsAttention?{bucket:`waiting`,tone:`pending`,pulse:!1,label:t.phase===`setup`?`setup needs attention`:`cleanup needs attention`}:t?.activeOperationId?{bucket:`running`,tone:`pending`,pulse:!0,label:t.phase===`setup`?`preparing worktree`:`cleaning up worktree`}:Do(e)?{bucket:`permission`,tone:`violet`,pulse:!0,label:`needs permission`}:e.status===`failed`&&e.autoResumeAt?{bucket:`none`,tone:`pending`,pulse:!1,label:`scheduled`}:K(e)?{bucket:`waiting`,tone:`pending`,pulse:!0,label:`needs you`}:e.status===`failed`?{bucket:`error`,tone:`danger`,pulse:!1,label:`failed`}:e.status===`waiting`?{bucket:`waiting`,tone:`pending`,pulse:!0,label:ko(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`}:Oo(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 Mo(e){return Eo[jo(e).bucket]<=Eo.waiting}var No=[`Pinned`,`Needs you`,`Working`,`Recent`,`Archived`],Po={waiting:0,review:1,running:2,queued:4,done:5,failed:5,cancelled:5},Fo=3,Io=e=>e.status===`failed`&&e.autoResumeAt!==void 0?Fo:K(e)?Po.waiting??0:Po[e.status]??9;function Lo(e,t){return t===`archived`?`Archived`:e.pinned?`Pinned`:Ao(e)?`Needs you`:e.status===`running`||e.status===`queued`||e.status===`failed`&&e.autoResumeAt?`Working`:`Recent`}function Ro(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function zo(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function Bo(e,t){return t!==void 0&&zo(e).ref===t}function Vo(e){return e.title.replace(/ \([A-C]\)$/,``)}function Ho(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}var Uo=[{value:`recent`,label:`Recent`},{value:`created`,label:`Created`}];function Wo(e,t){let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?t.localeCompare(e):r-n}function Go(e){if(e.lastActivityAt!==void 0)return e.lastActivityAt;let t=e.finishedAt??e.startedAt??e.createdAt;for(let n of e.steps??[]){let e=n.finishedAt??n.startedAt;e!==void 0&&Wo(e,t)<0&&(t=e)}return t}function Ko(e,t){return t===`created`?e.createdAt:Go(e)}function qo(e){return e===`created`?`Created`:`Updated`}function Jo(e,t){if(t===`archived`)return[{key:`rest`,label:null,runs:[...e]}];let n=new Map(e.map(e=>[e.id,e])),r=e=>{let t=new Set;for(let r=e;r&&!t.has(r.id);r=n.get(r.dispatch?.parentRunId??``)){if(r.pinned)return!0;t.add(r.id)}return!1},i=e.filter(r);if(i.length===0)return[{key:`rest`,label:null,runs:[...e]}];let a=e.filter(e=>!r(e));return[{key:`pinned`,label:`Pinned`,runs:i},...a.length>0?[{key:`rest`,label:`All tasks`,runs:a}]:[]]}function Yo(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=Io(e)-Io(n);if(r!==0)return r;if(Io(e)===Fo&&e.autoResumeAt&&n.autoResumeAt){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):Wo(Go(e),Go(n))})}function Xo(e,t,n){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,r)=>{if(t!==`archived`){let t=Number(!!r.pinned)-Number(!!e.pinned);if(t!==0)return t}return Wo(Ko(e,n),Ko(r,n))})}function Zo(e,t){let n=Ho(e),r=Yo(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(Lo(e,t),{kind:`group`,groupId:e.groupId,title:Vo(e),members:n});continue}}a(Lo(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null})}return No.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Qo(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 $o(e){let t=0,n=0,r=0;for(let i of e){if(i.archived){n+=1;continue}t+=1,Ao(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}var es=new Set([`running`,`waiting`]),ts=new Set([`done`,`failed`,`review`,`cancelled`]),ns=new Set([`done`,`failed`,`cancelled`]);function rs(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 is(e){return e?`$${e>=10?e.toFixed(0):e.toFixed(2)}`:``}function as(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 os(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 ss(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[Ro(e),e.branch??``,e.workflow,os(e)].some(e=>e.toLowerCase().includes(n))):[...e]}function cs(e){return e.filter(e=>!e.archived&&ns.has(e.status)&&!K(e)).length}function ls(e,t=!1){if(!e)return;let n=e.trim().replace(/\/+$/,``),r=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(n),i=r?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(n),a=r??i;if(!a)return;let[,o,s]=a;if(!s||!o||!t&&o.toLowerCase()!==`github.com`)return;let c=s.replace(/\.git$/i,``).split(`/`).filter(Boolean),l=c[c.length-2],u=c[c.length-1];return l&&u?`https://${o.toLowerCase()}/${l}/${u}`:void 0}function us(e){if(e.pullRequestUrl){let t=Number(q(e.pullRequestUrl));return{url:e.pullRequestUrl,...t>0?{number:t}:{}}}let t=e.prRefs?.find(e=>e.origin===`created`||e.origin===`marker`);if(t)return{number:t.number,...t.url?{url:t.url}:{}};let n=e.markerRefs?.pr;return n===void 0?void 0:{number:n}}function ds(e){return fs(e)[0]?.url??ps(e)[0]}function fs(e,t){if(!e.prRefs?.length)return ps(e).map(e=>({number:Number(q(e)),url:e,origin:`legacy`})).filter(e=>Number.isInteger(e.number)&&e.number>0);let n={created:0,marker:1,legacy:2,derived:3};return[...e.prRefs].sort((e,t)=>n[e.origin]-n[t.origin]).map(e=>({number:e.number,url:e.url??bs(`PR`,e.number,t),origin:e.origin}))}function ps(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 ms(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.markerRefs?.issue??e.issueNumber;if(!(!n||!t)&&!hs(e.referencedIssueCandidates,n,t))return`${t}/issues/${n}`}function hs(e,t,n){let r=`${n.toLowerCase()}/`;return(e??[]).some(e=>e.endsWith(`/${t}`)&&!e.toLowerCase().startsWith(r))}function gs(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 _s(e,t){let n=e.prRefs?.length?fs(e,t).map(e=>({number:e.number,url:e.url})):ps(e).map(e=>({url:e,number:Number(q(e))||void 0})),r=e.markerRefs?.pr,i=[...r===void 0||n.some(e=>e.number===r)?[]:[{kind:`PR`,number:r}],...n.map(e=>({kind:`PR`,url:e.url,number:e.number})),{kind:`PR`,number:ys(e,t)},{kind:`Issue`,url:ms(e,t)},{kind:`Issue`,number:vs(e,t)}],a=new Set,o=[];for(let e of i){let n=e.url?Number(q(e.url)):e.number;if(!n||!Number.isInteger(n))continue;let r=e.url??bs(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 vs(e,t){let n=e.issueNumber;return n===void 0||!t?n:hs(e.referencedIssueCandidates,n,t)?void 0:n}function ys(e,t){let n=e.prNumber;return n===void 0||!t?n:hs(e.referencedPrCandidates,n,t)?void 0:n}function bs(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function xs(e,t){return _s(e,t)[0]}function q(e){let t=e.split(`/`).pop()??``;return/^\d+$/.test(t)?t:null}function Ss(e,t){let n=es.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:rs(n.rssBytes),kind:`live`}};let r=rs(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 Cs(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=>ts.has(e.status))?[]:[{groupId:e,title:Vo(n),count:t.length}]})}function ws(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 Ts(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 Es(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 Ds=`/api/v1/ws`,Os=3e3,ks=1e3,As=7e4,js=0,Ms=1;function Ns(e){let t=new Map,n=new Map,r=null,i,a,o,s=()=>{clearTimeout(o),o=setTimeout(()=>{o=void 0,r?.close()},As)},c=()=>e??`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${Ds}`,l=e=>{r?.readyState===Ms&&r.send(JSON.stringify(e))},u=()=>{let e=globalThis.WebSocket;if(typeof e!=`function`||r&&(r.readyState===js||r.readyState===Ms))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()},Os)))}),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)},ks))))}}}}var Ps=null;function Fs(e,t,n){return Ps??=Ns(),Ps.subscribe(e,t,n)}var J={secrets:{allFor:e=>[`secrets`,e],list:()=>[`secrets`,m()]},e2e:{allFor:e=>[`e2e`,e],status:()=>[`e2e`,m()]},tracker:{allFor:e=>[`tracker`,e],all:()=>[`tracker`,m()],associationFor:e=>[`tracker`,e,`association`],association:()=>[`tracker`,m(),`association`],candidates:(e,t=``)=>[`tracker`,m(),`candidates`,e,t],connection:()=>[`tracker`,m(),`connection`],items:(e,t)=>[`tracker`,m(),`items`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t.state,[...t.labels],t.query??``],detail:(e,t)=>[`tracker`,m(),`detail`,e.kind,e.source.id,e.source.webUrl,e.externalId,e.connectionId??null,t]},get health(){return[m(),`health`]},runs:{get all(){return[m(),`runs`]},list:()=>[m(),`runs`,`list`],detail:e=>[m(),`runs`,`detail`,e],diff:e=>[m(),`runs`,`diff`,e],changes:e=>[m(),`runs`,`changes`,e],gitStatus:e=>[m(),`runs`,`git-status`,e],file:(e,t)=>[m(),`runs`,`files`,e,t],handoff:e=>[m(),`runs`,`handoff`,e],drafts:e=>[m(),`runs`,`drafts`,e],commits:e=>[m(),`runs`,`commits`,e],tree:e=>[m(),`runs`,`tree`,e],commit:(e,t)=>[m(),`runs`,`commit`,e,t]},groups:{detail:e=>[m(),`groups`,e]},get todos(){return[m(),`todos`]},get workflows(){return[m(),`workflows`]},get workflowNodes(){return[m(),`workflow-nodes`]},get skills(){return[m(),`skills`]},get skillsReady(){return[m(),`skills`,`ready`]},get importableSkills(){return[m(),`skills`,`importable`]},get importableSkillsReady(){return[m(),`skills`,`importable`,`ready`]},get launchKey(){return[m(),`launch-key`]},get repo(){return[m(),`repo`]},get repoChanges(){return[m(),`repo`,`changes`]},repoCommit:e=>[m(),`repo`,`commit`,e],get repoSync(){return[m(),`repo`,`sync`]},get repoTree(){return[m(),`repo`,`tree`]},repoFile:e=>[m(),`repo`,`file`,e],get uiState(){return[m(),`ui-state`]},get config(){return[m(),`config`]},get agentConfig(){return[m(),`agent-config`]},agentConfigFile:e=>[m(),`agent-config`,`file`,e],get worktrees(){return[m(),`worktrees`]},github:(e={})=>[m(),`github`,e.limit??null],githubPages:(e=50)=>[m(),`github`,`pages`,e],githubChecks:e=>[m(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[m(),`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)=>[m(),`github`,`comments`,e,t],githubMergeState:e=>[m(),`github`,`merge-state`,e],get openTargets(){return[m(),`open-targets`]}},Is=6e4;function Ls(){return M({queryKey:J.secrets.list(),queryFn:({signal:e})=>ur({signal:e})})}function Rs(){return M({queryKey:Y.secrets,queryFn:({signal:e})=>dr({signal:e})})}function zs(){return M({queryKey:J.e2e.status(),queryFn:({signal:e})=>_r({signal:e})})}function Bs(){return M({queryKey:J.tracker.connection(),queryFn:({signal:e})=>sr({signal:e})})}function Vs(){return M({queryKey:J.tracker.association(),queryFn:({signal:e})=>yr({signal:e})})}function Hs(e,t,n){return P({queryKey:J.tracker.candidates(e,t),staleTime:Is,queryFn:({pageParam:n,signal:r})=>br(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 Us=class extends Error{failure;constructor(e){super(e.reason),this.failure=e,this.name=`TrackerRefreshError`}};function Ws(e,t,n=!0){let r=t.query.trim(),i=j(),a=e?J.tracker.items(e,{...t,query:r}):[`tracker`,m(),`items`,`unassociated`];return{...P({queryKey:a,staleTime:1/0,queryFn:({pageParam:n,signal:i})=>r?Tr(r,{association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!0},{signal:i}):wr({association:e??void 0,cursor:n,limit:50,state:t.state,labels:t.labels,refresh:!1},{signal:i}),initialPageParam:void 0,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,enabled:e!=null&&n}),queryKey:a,restart:async()=>{await i.cancelQueries({queryKey:a,exact:!0});try{await i.fetchInfiniteQuery({queryKey:a,initialPageParam:void 0,pages:1,getNextPageParam:e=>e.available&&e.truncated?e.nextCursor:void 0,staleTime:0,retry:!1,queryFn:async({signal:n})=>{let i={association:e??void 0,limit:50,state:t.state,labels:t.labels,refresh:!0},a=r?await Tr(r,i,{signal:n}):await wr(i,{signal:n});if(!a.available)throw new Us(a);return a}})}catch{}}}}function Gs(e,t){return M({staleTime:Is,queryKey:e&&t?J.tracker.detail(e,t):[`tracker`,m(),`detail`,`disabled`],queryFn:({signal:n})=>Er(t,{signal:n,association:e??void 0}),enabled:e!=null&&t!=null&&t!==``})}var Y={dashboard:[`workspace`,`dashboard`],models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],githubLogin:[`workspace`,`github-login`],repoSuggestions:[`workspace`,`repo-suggestions`],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],skillsUpdateAll:[`workspace`,`skills-update`],skillsUpdate:e=>[`workspace`,`skills-update`,e],selfUpdate:[`workspace`,`self-update`],selfUpdateDevelopment:[`workspace`,`self-update`,`development`],starCount:[`workspace`,`star-count`],telemetryConsent:[`workspace`,`telemetry-consent`],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...Y.fsBrowseRoot,e,t]};function X(e,t=!0){return M({queryKey:Y.models(e),queryFn:({signal:t})=>a(e)?bn(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&a(e)})}function Ks(e=!0){let t=X(`claude`,e),n=X(`codex`,e),r=X(`opencode`,e),i=X(`cursor`,e),a=X(`pi`,e);return{claude:t,codex:n,junie:X(`junie`,e),opencode:r,cursor:i,pi:a,copilot:X(`copilot`,e)}}function qs(){let e=j();return M({queryKey:Y.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(Y.providerStatus),r=await xn(!1,{signal:t});return Ut(n,e.getQueryData(Y.providerStatus),r)},staleTime:5*6e4,refetchInterval:!1,refetchOnWindowFocus:!0})}function Js(){let e=j();return N({mutationFn:()=>xn(!0),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>e.setQueryData(Y.providerStatus,e=>Ut(r,e,t))})}function Ys(){let e=j();return N({mutationFn:({provider:e,authFailureId:t})=>Ur(e,t),onMutate:()=>e.getQueryData(Y.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(Y.providerStatus,e=>Ut(r,e,t,n.authFailureId))}})}function Xs(){return M({queryKey:Y.projects,queryFn:({signal:e})=>Cn({signal:e})})}function Zs(e,t=!1){return M({queryKey:Y.fsBrowse(e,t),queryFn:({signal:n})=>wn(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Qs(){let e=j();return N({mutationFn:e=>Wr(e),onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function $s(){let e=j();return N({mutationFn:e=>Jr(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:Y.projects})}})}function ec(){let e=j();return N({mutationFn:e=>{let{id:t,...n}=e;return Yr(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:Y.projects});let r=e.getQueryData(Y.projects);return e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?tc(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(Y.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(Y.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:Y.projects})})}function tc(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?[]:Es(s);return c.length>0&&(a.tags=c),a}function nc(e){let t=j();return N({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:Y.agentProfiles}),t.invalidateQueries({queryKey:Y.projects})])}})}function rc(){return nc(e=>va(e))}function ic(){return nc(e=>{let{id:t,...n}=e;return Ca(t,n)})}function ac(){return nc(e=>wa(e))}function oc(){return nc(e=>Sa(e))}function sc(e,t){return M({queryKey:Y.agentAccountDetails(e),queryFn:({signal:t})=>ba(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function cc(e,t){return M({queryKey:Y.agentAccountStatus(e),queryFn:({signal:t})=>ya(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function lc(){let e=j();return N({mutationFn:({provider:e,profileId:t})=>Br(e,t),retry:!1,onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Y.agentProfiles}),e.invalidateQueries({queryKey:Y.providerStatus})])}})}function uc(){let e=j();return N({mutationFn:e=>ya(e,{recheck:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(Y.agentAccountStatus(n),t),e.invalidateQueries({queryKey:Y.agentProfiles})}})}function dc(){return N({mutationFn:e=>{let{routeId:t,...n}=e;return xa(t,n)},retry:!1})}function fc(){let e=j();return N({mutationFn:e=>Gr(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function pc(){let e=j();return N({mutationFn:e=>Kr(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:Y.projects})})}function mc(e=!0){return M({queryKey:Y.repoSuggestions,queryFn:({signal:e})=>Tn({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function hc(){let e=j();return N({mutationFn:e=>En(e),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function gc(){let e=j();return N({mutationFn:({projectId:e,owner:t,name:n})=>Dn(e,{owner:t,name:n}),retry:!1,onSuccess:()=>Promise.all([e.invalidateQueries({queryKey:Y.projects}),e.invalidateQueries({queryKey:J.repo}),e.invalidateQueries({queryKey:J.health})])})}function _c(e){let t=j(),n=(0,A.useRef)(e);n.current=e;let r=(0,A.useRef)(!1),i=N({mutationFn:On,retry:!1,onMutate:()=>{r.current=!0,t.setQueryData(Y.githubLogin,{status:`starting`})},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),a=N({mutationFn:An,retry:!1,onMutate:()=>{r.current=!1},onSuccess:e=>t.setQueryData(Y.githubLogin,e)}),o=M({queryKey:Y.githubLogin,queryFn:({signal:e})=>kn({signal:e}),enabled:i.isSuccess,refetchInterval:e=>{let t=e.state.data?.status;return t===`pending`||t===`starting`?2e3:!1},staleTime:0,retry:!1}),s=r.current||i.isPending||i.isSuccess?o.data:void 0,c=s?.status,l=s?.status===`done`?s.login:void 0;return(0,A.useEffect)(()=>{c!==`done`||!r.current||(r.current=!1,Promise.all([t.invalidateQueries({queryKey:Y.githubOwners}),t.invalidateQueries({queryKey:Y.projects}),t.invalidateQueries({queryKey:[m(),`github`]}),t.invalidateQueries({queryKey:J.repo}),t.invalidateQueries({queryKey:J.health})]),n.current?.(l))},[c,l,t]),{state:s,start:i,cancel:a}}function vc(){return M({queryKey:Y.githubOwners,queryFn:({signal:e})=>qr({signal:e}),staleTime:5*6e4,retry:!1})}function yc(){let e=j();(0,A.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(J.health)?.capabilities?.localHandoff===!0;n&&t===void 0?t=Fs(`health`,t=>{e.setQueryData(J.health,t)}):!n&&t!==void 0&&(t(),t=void 0)};n();let r=e.getQueryCache().subscribe(n);return()=>{r(),t?.()}},[e])}function bc(){return M({queryKey:J.health,queryFn:({signal:e})=>hn({signal:e}),refetchInterval:e=>Sc(e.state.data)})}var xc=3e4;function Sc(e){return e?.capabilities?.localHandoff===!1&&e.forge!=null&&e.forge.available!==!0&&xc}function Cc(){let e=bc().data,t=Xs().data?.projects,{projectId:n}=Ft(),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?ls(e?.repo?.remote,e?.forge?.kind===`github`):void 0}function wc(){return M({queryKey:J.openTargets,queryFn:({signal:e})=>Si({signal:e}),staleTime:5*6e4})}function Tc(e){return M({queryKey:J.runs.list(),queryFn:({signal:e})=>jn({signal:e}),select:e})}function Ec(e=!0,t){return M({queryKey:Y.runsIndex,queryFn:({signal:e})=>Nn({signal:e}),enabled:e,staleTime:3e4,...t===void 0?{}:{refetchInterval:typeof t==`function`?e=>t(e.state.data):t}})}function Dc(e,t=!0,n=!1,r){return M({queryKey:[n?`default`:e,`runs`,`list`],queryFn:({signal:t})=>Mn(e,{signal:t}),enabled:t,select:r})}function Oc(e,t,n){let r=e==="default"?null:e,i=r===null||t!=null&&r===t;return Dc(i?`default`:r??`default`,!0,i,n)}function kc(e){return{queryKey:J.runs.detail(e),queryFn:({signal:t})=>Pn(e,{signal:t})}}function Ac(e){return M({...kc(e??``),enabled:!!e})}function jc(e,t,n=!0){return M({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Fn(e,t,{signal:n}),enabled:n&&!!e&&!!t})}function Mc(e){return M({queryKey:J.runs.diff(e??``),queryFn:({signal:t})=>Pr(e,{signal:t}),enabled:!!e})}function Nc(e,t=!1){return M({queryKey:J.runs.changes(e??``),queryFn:({signal:t})=>Ir(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?4e3:!1,refetchOnWindowFocus:!0,staleTime:0})}function Pc(e,t,n=!1){return M({queryKey:J.runs.gitStatus(e),queryFn:({signal:t})=>Di(e,{signal:t}),enabled:t,retry:!1,refetchInterval:n?1e4:!1,refetchOnWindowFocus:!0,staleTime:0})}function Fc(e,t=!0){return M({queryKey:J.runs.tree(e??``),queryFn:({signal:t})=>nr(e,{signal:t}),enabled:t&&!!e,retry:!1,staleTime:0})}function Ic(e,t){return M({queryKey:J.runs.file(e??``,t??``),queryFn:({signal:n})=>Lr(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Lc(e){return M({queryKey:J.groups.detail(e??``),queryFn:({signal:t})=>zr(e,{signal:t}),enabled:!!e})}function Rc(e,t=!1){return M({queryKey:J.runs.commits(e??``),queryFn:({signal:t})=>rr(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:t?5e3:!1})}function zc(e,t){return M({queryKey:J.runs.commit(e??``,t??``),queryFn:({signal:n})=>ir(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Bc(e,t=!0){return M({queryKey:J.runs.handoff(e??``),queryFn:({signal:t})=>Fr(e,{signal:t}),enabled:!!e&&t})}function Vc(e){return M({queryKey:J.runs.drafts(e??``),queryFn:({signal:t})=>Ii(e,{signal:t}),enabled:!!e,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Hc(e=!0){return M({queryKey:J.todos,queryFn:({signal:e})=>Gn({signal:e}),enabled:e})}function Uc(){return M({queryKey:J.workflowNodes,queryFn:({signal:e})=>aa({signal:e}),staleTime:1/0})}function Wc(e={}){return M({queryKey:J.workflows,enabled:e.enabled??!0,queryFn:({signal:e})=>zn({signal:e})})}function Gc(e=!0){let t=j(),n=J.skills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Bn({signal:e}),enabled:e}),a=M({queryKey:J.skillsReady,queryFn:({signal:e})=>Vn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function Kc(e=!0){let t=j(),n=J.importableSkills,r=n[0],i=M({queryKey:n,queryFn:({signal:e})=>Un({signal:e}),enabled:e}),a=M({queryKey:J.importableSkillsReady,queryFn:({signal:e})=>Wn({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,A.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function qc(){return M({queryKey:J.launchKey,queryFn:({signal:e})=>Sn({signal:e}),staleTime:1/0})}function Jc(){return M({queryKey:J.repo,queryFn:({signal:e})=>Kn({signal:e})})}function Yc(){return M({queryKey:J.repoSync,queryFn:({signal:e})=>Gi({signal:e}),refetchOnWindowFocus:!0})}function Xc(){let e=j();return N({mutationFn:e=>Ki(e),onSuccess:t=>{e.setQueryData(J.repoSync,t.sync),e.invalidateQueries({queryKey:J.repo,predicate:e=>e.queryKey[2]!==`sync`})}})}function Zc(){return M({queryKey:J.repoChanges,queryFn:({signal:e})=>Zn({signal:e}),retry:!1})}function Qc(){return M({queryKey:J.repoTree,queryFn:({signal:e})=>Qn({signal:e}),retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function $c(e){return M({queryKey:J.repoFile(e??``),queryFn:({signal:t})=>$n(e,{signal:t}),enabled:e!==void 0&&e!==``,retry:!1,refetchOnWindowFocus:!0,staleTime:0})}function el(e){return M({queryKey:J.repoCommit(e??``),queryFn:({signal:t})=>tr(e,{signal:t}),enabled:!!e,retry:!1})}function tl(){return M({queryKey:J.config,queryFn:({signal:e})=>qn({signal:e})})}function nl(){return M({queryKey:J.worktrees,queryFn:({signal:e})=>La({signal:e})})}function rl(){return M({queryKey:J.uiState,queryFn:({signal:e})=>Rn({signal:e})})}function il(){return M({queryKey:J.agentConfig,queryFn:({signal:e})=>Jn({signal:e})})}function al(e){return M({queryKey:J.agentConfigFile(e??``),queryFn:({signal:t})=>Yn(e,{signal:t}),enabled:e!==null})}function ol(e){let t=j(),n=J.agentConfig,r=J.agentConfigFile(e);return N({mutationFn:t=>Xn(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function sl(){return M({queryKey:Y.uiState,queryFn:({signal:e})=>da({signal:e})})}function cl(){return M({queryKey:Y.config,queryFn:({signal:e})=>pa({signal:e})})}function ll(){return M({queryKey:Y.agentProfiles,queryFn:({signal:e})=>_a({signal:e})})}var ul=1e4;function dl(e=!0){return M({queryKey:Y.starCount,queryFn:({signal:e})=>gn({signal:e}),enabled:e,staleTime:ul,refetchInterval:ul,retry:!1,refetchOnMount:!1})}function fl(){return M({queryKey:Y.telemetryConsent,queryFn:({signal:e})=>vn({signal:e}),staleTime:1/0,retry:!1})}var pl=6;function ml(e,t=!0){return M({queryKey:Y.skillsUpdate(e),queryFn:({signal:t})=>Ta(e,{signal:t}),enabled:t,refetchInterval:e=>{let t=e.state.data?.status;return(t===void 0||t===`checking`||t===`updating`||t===`idle`&&e.state.dataUpdateCount<pl)&&6e4}})}function hl(e=!0){return M({queryKey:Y.selfUpdate,queryFn:({signal:e})=>Oa({signal:e}),enabled:e,refetchInterval:e=>e.state.data?.job?.status===`running`?1e3:e.state.data?.scheduled?5e3:!1})}function gl(e=!0){return M({queryKey:Y.selfUpdateDevelopment,queryFn:({signal:e})=>Aa({signal:e}),enabled:e,staleTime:3e4})}function _l(){let e=j();return N({mutationFn:()=>Aa({refresh:!0}),onSuccess:t=>e.setQueryData(Y.selfUpdateDevelopment,t)})}function vl(){let e=j();return N({mutationFn:()=>ka(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function yl(){let e=j();return N({mutationFn:e=>ja(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function bl(){let e=j();return N({mutationFn:e=>Ma(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function xl(){let e=j();return N({mutationFn:e=>Na(e),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Sl(){let e=j();return N({mutationFn:()=>Pa(),onSuccess:t=>e.setQueryData(Y.selfUpdate,t)})}function Cl(e){let t=j();return N({mutationFn:t=>gi(e,t),onSuccess:e=>{wl(t,e),t.invalidateQueries({queryKey:J.runs.all})}})}function wl(e,t){e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t.id?yo(e,t):e)),e.setQueryData(J.runs.detail(t.id),e=>e?yo(e,t):t),Tl(e)}function Tl(e){e.invalidateQueries({queryKey:Y.runsIndex})}function El(){let e=j();return N({mutationFn:e=>oi(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t)),i=new Date().toISOString();return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?{...e,seenAt:i}:e)),e.setQueryData(J.runs.detail(t),e=>e&&{...e,seenAt:i}),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?{...e,seenAt:t.seenAt}:e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tl(e)}})}function Dl(){let e=j();return N({mutationFn:e=>si(e),onMutate:async t=>{await e.cancelQueries({queryKey:J.runs.list()}),await e.cancelQueries({queryKey:J.runs.detail(t)});let n=e.getQueryData(J.runs.list()),r=e.getQueryData(J.runs.detail(t));return e.setQueryData(J.runs.list(),e=>e?.map(e=>e.id===t?Ol(e):e)),e.setQueryData(J.runs.detail(t),e=>e&&Ol(e)),{prevList:n,prevDetail:r,id:t}},onError:(t,n,r)=>{r?.prevList&&e.setQueryData(J.runs.list(),r.prevList),r?.prevDetail&&e.setQueryData(J.runs.detail(n),r.prevDetail)},onSuccess:t=>{let n=e=>e.id===t.id?Ol(e):e;e.setQueryData(J.runs.list(),e=>e?.map(n)),e.setQueryData(J.runs.detail(t.id),e=>e?n(e):t),Tl(e)}})}function Ol(e){let{seenAt:t,...n}=e;return n}function kl(e,t,n){let r=j();return N({mutationFn:({id:n,pinned:r,surface:i})=>t===void 0?ei(n,r,i??e):ti(t,n,r,i??e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function Al(e,t,n){let r=j();return N({mutationFn:({id:n,archived:r})=>t===void 0?$r(n,r,e):ni(t,n,r,e),onSuccess:()=>r.invalidateQueries({queryKey:n===void 0?J.runs.all:[n,`runs`]})})}function jl(e,t){let n=j();return N({mutationFn:n=>t===void 0?Mi(e,n):Ni(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all}),onError:e=>{e instanceof R&&e.status===409&&n.invalidateQueries({queryKey:J.runs.all})}})}function Ml(e,t){let n=j();return N({mutationFn:(n={})=>t===void 0?di(e,n):fi(t,e,n),onSuccess:()=>n.invalidateQueries({queryKey:J.runs.all})})}function Nl(e){let t=j();return N({mutationFn:({msgId:t,message:n})=>Pi(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Pl(e){let t=j();return N({mutationFn:t=>Fi(e,t),onSuccess:()=>t.invalidateQueries({queryKey:J.runs.all})})}function Fl(e={},t=!0){return M({queryKey:J.github(e),queryFn:({signal:t})=>ar({limit:e.limit},{signal:t}),enabled:t})}function Il(e=50,t=!0){return P({queryKey:J.githubPages(e),queryFn:({pageParam:t,signal:n})=>ar({limit:e,...t},{signal:n}),initialPageParam:{issuesCursor:void 0,prsCursor:void 0,issuesDone:!1,prsDone:!1},getNextPageParam:e=>{let t=e.issuesNextCursor??void 0,n=e.prsNextCursor??void 0;return t||n?{issuesCursor:t,prsCursor:n,issuesDone:!t,prsDone:!n}:void 0},enabled:t,staleTime:6e4})}function Ll(e,t=!0){return M({queryKey:J.githubChecks(e),queryFn:({signal:t})=>Dr(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Rl(e,t,n=!0){return M({queryKey:J.githubSearch(e,t),queryFn:({signal:n})=>Or(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var zl=100;function Bl(e){return[...e].sort((e,t)=>t-e).slice(0,zl).sort((e,t)=>e-t)}var Z=new Map(Kl()),Vl=1e3;function Hl(e,t){if(Z.get(e)!==t){for(Z.delete(e),Z.set(e,t);Z.size>Vl;){let e=Z.keys().next().value;if(e===void 0)break;Z.delete(e)}Yl()}}var Q=new Set(ql());function Ul(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Vl;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);Yl()}}var Wl=`cez.reference-statuses.v1`,Gl=`cez.reference-conflicts.v1`;function Kl(){try{let e=globalThis.sessionStorage?.getItem(Wl);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`&&wo(e[1])):[]}catch{return[]}}function ql(){try{let e=globalThis.sessionStorage?.getItem(Gl);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Jl;function Yl(){Jl===void 0&&(Jl=setTimeout(()=>{Jl=void 0;try{globalThis.sessionStorage?.setItem(Wl,JSON.stringify([...Z])),globalThis.sessionStorage?.setItem(Gl,JSON.stringify([...Q]))}catch{}},250))}function Xl(){let e=Ft(),t=bc();return e.projectId??t.data?.bootProject}function Zl(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Hl($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Hl($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var Ql=5*6e4;function $l(e){return e?e.recheckAfterMs:Ql}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function eu(e,t=!0){let n=(0,A.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Bl(t.prs),issues:Bl(t.issues)}))},[e.map($).sort().join(`|`)]),r=jt({queries:n.map(e=>({queryKey:J.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>kr(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>$l(e.state.data)??1/0,refetchInterval:e=>$l(e.state.data)??!1,refetchOnWindowFocus:!0}))}),{byRef:i,learned:a}=(0,A.useMemo)(()=>{let e=new Map,t=[];return r.forEach((r,i)=>{let a=n[i];if(!a)return;let o=[...a.prs.map(e=>({projectId:a.projectId,kind:`PR`,number:e})),...a.issues.map(e=>({projectId:a.projectId,kind:`Issue`,number:e}))],s=r.data;for(let n of o){let i=$(n),a=Z.get(i),o=Q.has(i)?!0:void 0;if(s?.available){let r=s.prs[n.number]??s.issues[n.number];if(r){let a=s.conflicts?s.conflicts.includes(n.number):void 0;t.push({key:i,status:r,conflicting:a}),e.set(i,{state:`ready`,status:r,...a??o?{conflicting:!0}:{}})}else e.set(i,{state:`unknown`,...a?{status:a}:{}})}else s?e.set(i,{state:`unavailable`,reason:s.reason,...a?{status:a}:{},...o?{conflicting:!0}:{}}):r.isError?e.set(i,{state:`unavailable`,reason:r.error instanceof Error?r.error.message:void 0,...a?{status:a}:{},...o?{conflicting:!0}:{}}):e.set(i,{state:`loading`,...a?{status:a}:{},...o?{conflicting:!0}:{}})}}),{byRef:e,learned:t}},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,A.useEffect)(()=>{for(let{key:e,status:t,conflicting:n}of a)Hl(e,t),n!==void 0&&Ul(e,n)},[a]),(0,A.useCallback)(e=>{let t=$(e),n=i.get(t);if(n)return n;let r=Z.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[i])}function tu(e,t,n=!0){return M({queryKey:J.githubComments(e,t),queryFn:({signal:n})=>Ar(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function nu(e){return M({queryKey:[`github`,`pr-changes`,e??0],queryFn:({signal:t})=>Nr(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{eu as $,sa as $i,po as $n,io as $r,Rs as $t,Rl as A,Ft as Aa,co as Ai,Ho as An,ui as Ar,Ec as At,wc as B,ye as Ba,mr as Bi,ko as Bn,jr as Br,fl as Bt,Fl as C,F as Ca,qi as Ci,Uo as Cn,ia as Cr,Pc as Ct,_c as D,Kt as Da,Oi as Di,Vo as Dn,Vi as Dr,X as Dt,Il as E,L as Ea,Xa as Ei,Zo as En,Ui as Er,Ks as Et,hc as F,j as Fa,$a as Fi,qo as Fn,qn as Fr,jl as Ft,Dc as G,S as Ga,er as Gi,Co as Gn,Fn as Gr,Gs as Gt,kl as H,we as Ha,vi as Hi,K as Hn,Sn as Hr,Vs as Ht,qc as I,ut as Ia,Va as Ii,Ko as In,fo as Ir,yl as It,qs as J,Fe as Ja,ta as Ji,vo as Jn,Lr as Jr,ic as Jt,Ls as K,Te as Ka,to as Ki,To as Kn,Hi as Kr,Ws as Kt,El as L,$e as La,Ra as Li,zo as Ln,ar as Lr,Gc as Lt,bc as M,N as Ma,ua as Mi,Ro as Mn,$i as Mr,oc as Mt,yc as N,M as Na,Fa as Ni,Yo as Nn,ra as Nr,hl as Nt,vc as O,Gt as Oa,Ia as Oi,Go as On,la as Or,Tc as Ot,Kc as P,vt as Pa,fa as Pi,Xo as Pn,Ji as Pr,gl as Pt,Xl as Q,cr as Qi,yo as Qn,Za as Qr,cl as Qt,Dl as R,He as Ra,Hn as Ri,Jo as Rn,Ar as Rr,ml as Rt,Zs as S,Yt as Sa,bi as Si,os as Sn,Qa as Sr,Ic as St,tu as T,Bt as Ta,lo as Ti,Wo as Tn,_i as Tr,Fc as Tt,Cc as U,Ce as Ua,lr as Ui,Ao as Un,Ka as Ur,Hs as Ut,Cl as V,T as Va,za as Vi,jo as Vn,hn as Vr,Hc as Vt,jc as W,Se as Wa,gr as Wi,Mo as Wn,qa as Wr,Bs as Wt,ol as X,b as Xa,pr as Xi,xo as Xn,Ln as Xr,Uc as Xt,gc as Y,he as Ya,Rr as Yi,_o as Yn,In as Yr,ec as Yt,uc as Z,xr as Zi,go as Zn,so as Zr,Wc as Zt,Ml as _,eo as _a,wi as _i,ms as _n,Yi as _r,Nc as _t,kc as a,Bi as aa,Er as ai,ws as an,ai as ar,$s as at,zs as b,Qt as ba,ca as bi,_s as bn,Xr as br,Mc as bt,il as c,Qr as ca,da as ci,Cs as cn,ii as cr,Zc as ct,bl as d,W as da,li as di,is as dn,Qi as dr,mc as dt,hr as ea,ro as ei,sl as en,R as er,Js as et,Al as f,Xi as fa,ci as fi,rs as fn,Ea as fr,Yc as ft,lc as g,Ua as ga,Ti as gi,as as gn,di as gr,Ac as gt,tl as h,oa as ha,Ci as hi,gs as hn,Br as hr,Ys as ht,Zl as i,oo as ia,or as ii,Fs as in,Da as ir,ac as it,Lc as j,P as ja,yn as ji,Bo as jn,ya as jr,xl as jt,nu as k,It as ka,Ri as ki,$o as kn,ha as kr,Oc as kt,al as l,yi as la,Wa as li,ss as ln,Zr as lr,el as lt,fc as m,ma,_n as mi,q as mn,Ei as mr,Qc as mt,Us as n,ri as na,Ta as ni,Y as nn,Ya as nr,_l as nt,sc as o,vr as oa,wr as oi,Ts as on,ni as or,Pl as ot,Sl as p,Vr as pa,Mr as pi,us as pn,Sr as pr,Xc as pt,Xs as q,C as qa,ea as qi,bo as qn,Ii as qr,rl as qt,J as r,Hr as ra,ao as ri,wl as rn,hi as rr,Qs as rt,cc as s,Ja as sa,ga as si,ts as sn,$r as sr,Jc as st,Is as t,Zi as ta,Oa as ti,nl as tn,ki as tr,vl as tt,ll as u,no as ua,Ga as ui,cs as un,V as ur,$c as ut,rc as v,an as va,xi as vi,ds as vn,uo as vr,zc as vt,Ll as w,Ht as wa,zi as wi,Qo as wn,na as wr,Bc as wt,Nl as x,Xt as xa,gi as xi,Ss as xn,mi as xr,Vc as xt,pc as y,Zt as ya,Ba as yi,xs as yn,Wi as yr,Rc as yt,dc as z,O as za,Ha as zi,Eo as zn,Nr as zr,dl as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Fa as i,Ma as a,Oi as o,ct as s,er as c,ft as l,lt as u,mt as d,pt as f,r as p,st as m,yr as h}from"./queries-BTgOLNTK.js";import{F as g,i as _,r as v,t as y}from"./button-wdWSPx_B.js";import{c as b,f as x,t as S,w as C}from"./project-router-DgQSavhI.js";import{t as w}from"./use-desktop-BNN3U2y9.js";import{a as T,c as ee,d as te,f as E,i as ne,l as re,o as ie,p as ae,r as oe,s as se,t as ce}from"./file-preview-DEKEA-Hk.js";import{t as D}from"./arrow-left-B1Ed0tpu.js";import{n as le,t as O}from"./file-CbWEaOku.js";import{t as ue}from"./check-DvAMBXJe.js";import{t as de}from"./chevron-right-DDQuVTY1.js";import{c as k,d as A,f as j,l as fe,m as M,o as pe,p as me,s as N,t as he}from"./git-toolbar-C3vpZJaZ.js";import{n as P}from"./upload-DrvICo_K.js";import{n as F,t as I}from"./triangle-alert-BdMPm9Jb.js";import{t as L}from"./plus-BwQyZgNP.js";import{t as R}from"./search-x-CLuL49ms.js";import{t as z}from"./input-Br4NQpZK.js";import{n as ge}from"./lib-w_5wfsBF.js";import{t as B}from"./centered-state-D-wDs7Y1.js";import{a as _e}from"./index-D-pGbO9R.js";import{t as ve}from"./markdown-BfZORc0a.js";import{t as V}from"./diff-DY-_mmb0.js";import{t as H}from"./commit-list-DTMGEn0-.js";var U=g(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),W=e(t(),1),G=n();function ye(){let e=l(),t=f();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>x(e.message),onError:e=>x(e.message,{tone:`danger`,expected:e instanceof c&&e.status===409})}),i=t.isPending,a=t.variables;return(0,G.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta`,children:[n.upstream?(0,G.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,title:`Upstream`,children:[`→ `,n.upstream]}):n.branch?(0,G.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,G.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,G.jsx)(q,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,G.jsx)(q,{ahead:n.outgoing.length,behind:null}):null,(0,G.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${xe(n.lastFetchedAt)}`:`never fetched`}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsx)(K,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,G.jsx)(A,{"aria-hidden":`true`,className:v(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,G.jsx)(ae,{"aria-hidden":`true`})}),(0,G.jsx)(K,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,G.jsx)(le,{"aria-hidden":`true`})}),(0,G.jsx)(K,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,G.jsx)(A,{"aria-hidden":`true`,className:v(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,G.jsx)(K,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,G.jsx)(U,{"aria-hidden":`true`})}):null]})]})}function K({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,G.jsxs)(y,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function q({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,G.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,G.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,G.jsxs)(`span`,{"data-sync":`ahead`,title:`${e} to push`,className:`text-primary`,children:[`↑`,e]}):null,t?(0,G.jsxs)(`span`,{"data-sync":`behind`,title:`${t} to pull`,className:`text-warning`,children:[`↓`,t]}):null]})}function be({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,G.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-meta`,children:r?(0,G.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,G.jsx)(q,{ahead:n.ahead,behind:n.behind})})}function xe(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}function Se({repo:e,info:t}){let n=fe(),r=l(),s=i(),c=e=>x(e.message,{tone:`danger`}),u=a({mutationFn:e=>h({name:e}),onSuccess:async e=>{x(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([s.invalidateQueries({queryKey:p.repo}),s.invalidateQueries({queryKey:p.health})]),s.setQueryData(p.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),s.setQueryData(p.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:c}),d=a({mutationFn:e=>o({baseBranch:e}),onSuccess:e=>{x(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),s.invalidateQueries({queryKey:p.repo})},onError:c}),[f,m]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),b=g.trim().toLowerCase(),S=b?e.branches.filter(e=>e.toLowerCase().includes(b)):e.branches;return(0,G.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Branches`}),(0,G.jsx)(z,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:g,onChange:e=>_(e.target.value),className:`mt-2 max-w-xl`}),(0,G.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[S.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,G.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:v(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,G.jsx)(be,{name:n,sync:r.data}),i?(0,G.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:[(0,G.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,G.jsx)(`span`,{"data-slot":`branch-elsewhere`,title:`Checked out in ${a}`,className:`ml-auto shrink-0 text-meta text-soft-foreground`,children:`in another worktree`}):(0,G.jsx)(y,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:u.isPending,onClick:()=>u.mutate(n),children:`Switch`})]},n)}),S.length===0?(0,G.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,g.trim(),`”.`]}):null]}),(0,G.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&&u.mutate(t,{onSuccess:()=>m(``)})},children:[(0,G.jsx)(z,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:f,onChange:e=>m(e.target.value)}),(0,G.jsxs)(y,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!f.trim()||u.isPending,children:[(0,G.jsx)(L,{"aria-hidden":`true`}),`Create`]})]})]}),(0,G.jsxs)(`div`,{className:`max-w-md`,children:[(0,G.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`eyebrow text-soft-foreground`,children:`Agents’ base branch`}),(0,G.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:d.isPending,onChange:e=>d.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,G.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))]}),(0,G.jsx)(`p`,{className:`mt-1 text-meta text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n?.available?(0,G.jsx)(Ce,{}):null]})}function Ce(){let e=r({limit:20});return(0,G.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,G.jsx)(`h2`,{className:`eyebrow text-soft-foreground`,children:`Open pull requests`}),e.isPending?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,G.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,G.jsx)(we,{pr:e},e.number))}):(0,G.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 we({pr:e}){let t=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-meta text-muted-foreground`,children:[`#`,e.number]}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui`,children:e.title}),e.checks?(0,G.jsx)(Te,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,G.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:_(e.url)?(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:v(n,`hover:bg-muted`),children:t}):(0,G.jsx)(`span`,{className:n,children:t})})}function Te({checks:e}){return(0,G.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:v(`shrink-0 text-micro font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function Ee(){let e=s(),t=w(),[n,r]=(0,W.useState)(`unified`),[i,a]=(0,W.useState)(!1),[o,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),f=(0,W.useRef)(null),p=(0,W.useRef)(null),[m,h]=ee(),g=se(m),_=e.isError&&e.error instanceof c&&e.error.status===409,y=e.data?.files??[],b=(0,W.useMemo)(()=>ne(y),[y]),x=(0,W.useMemo)(()=>y.some(ve),[y]),S=t?n:`unified`,C=!t||i;return(0,G.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.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,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,G.jsx)(he,{stat:e.data.stat}):null,(0,G.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,G.jsx)(N,{mode:n,wrap:i,preview:o,onModeChange:r,onWrapChange:a,onPreviewChange:x?l:void 0})})]}),e.isPending?(0,G.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,G.jsx)(B,{icon:_?(0,G.jsx)(M,{}):(0,G.jsx)(I,{}),tone:_?`neutral`:`danger`,heading:`h2`,title:_?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):y.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(M,{}),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,G.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,G.jsx)(`aside`,{ref:p,"data-slot":`changes-tree-pane`,style:g.style,className:v(`hidden w-60 max-w-[60%] shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,g.className),children:(0,G.jsx)(re,{root:b,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,G.jsx)(ie,{paneRef:p,width:m,onWidthChange:h,className:`hidden md:block`}),(0,G.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,G.jsx)(V,{files:y,viewRef:f,mode:S,wrap:C,preview:t&&x&&o,className:`min-w-0 md:py-4`})})]})]})}function De({log:e}){let{sha:t}=C(),n=l().data;if(t)return(0,G.jsx)(Oe,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,G.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,G.jsxs)(`h2`,{className:`px-4 pt-3 text-meta font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,G.jsx)(H,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,G.jsxs)(G.Fragment,{children:[o,(0,G.jsx)(H,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Oe({sha:e}){let t=u(e),n=w(),[r,i]=(0,W.useState)(`unified`),[a,o]=(0,W.useState)(!1),s=t.isError&&t.error instanceof c&&t.error.status===409,l=n?r:`unified`,d=!n||a;return(0,G.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.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,G.jsx)(y,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,G.jsxs)(S,{to:`/git/commits`,children:[(0,G.jsx)(D,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,G.jsx)(ge,{stat:t.data.stat}):null,(0,G.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,G.jsx)(N,{mode:r,wrap:a,onModeChange:i,onWrapChange:o})})]}),t.isPending?(0,G.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,G.jsx)(B,{icon:s?(0,G.jsx)(R,{}):(0,G.jsx)(I,{}),tone:s?`neutral`:`danger`,heading:`h2`,title:s?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-meta text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,G.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,G.jsx)(B,{icon:(0,G.jsx)(P,{}),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,G.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,G.jsx)(V,{files:t.data.files,mode:l,wrap:d,className:`min-w-0`})})]})]})}function J(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 ke(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(!J(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:J(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 Ae=200;function je({selected:e,onSelect:t}){let n=d(),r=n.isError&&n.error instanceof c&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,G.jsx)(Y,{children:(0,G.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,G.jsx)(Y,{children:(0,G.jsx)(B,{icon:r?(0,G.jsx)(E,{}):(0,G.jsx)(I,{}),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,G.jsx)(Y,{children:(0,G.jsx)(B,{icon:(0,G.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,G.jsxs)(Y,{children:[n.data.truncated?(0,G.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,G.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,G.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:v(`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,G.jsx)(Me,{paths:i,selected:e,onSelect:t})}),(0,G.jsxs)(`div`,{className:v(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,G.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,G.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,G.jsx)(ce,{source:{kind:`repo`},path:e})]})]})]})}function Y({children:e}){return(0,G.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function X(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function Z(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(...Z(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 Me({paths:e,selected:t,onSelect:n}){let[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(()=>new Set(X(t))),[s,c]=(0,W.useState)(t),l=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=X(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,W.useMemo)(()=>ke(e,r,Ae),[e,r]),f=(0,W.useMemo)(()=>T(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,W.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):Z(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,G.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,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,G.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,G.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,G.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,G.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,G.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?Q(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-ui`,children:p.map(e=>e.kind===`dir`?(0,G.jsx)(Ne,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,G.jsx)(Pe,{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,G.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 Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function Ne({row:e,focused:t,onToggle:n}){return(0,G.jsxs)(`div`,{id:Q(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:$(e.level,6),children:[(0,G.jsx)(de,{"aria-hidden":`true`,className:v(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,G.jsx)(me,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function Pe({row:e,active:t,focused:n,onSelect:r}){let i=oe(e.path)?te:O;return(0,G.jsxs)(`div`,{id:Q(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:v(`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:$(e.level,24),children:[(0,G.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function Fe({tab:e}){let t=m();if(t.isPending)return(0,G.jsx)(_e,{});if(t.isError)return(0,G.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,G.jsx)(B,{icon:(0,G.jsx)(I,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,G.jsx)(Ie,{repo:t.data,info:n,tab:e}):(0,G.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,G.jsx)(B,{icon:(0,G.jsx)(j,{}),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 Ie({repo:e,info:t,tab:n}){return(0,G.jsxs)(`div`,{"data-route":`repo-git`,className:v(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,G.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,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,G.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,G.jsx)(pe,{branch:t.branch}),t.remote?(0,G.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-meta text-soft-foreground md:inline`,children:t.remote}):null]}),(0,G.jsx)(`div`,{className:`mt-1.5`,children:(0,G.jsx)(ye,{})}),(0,G.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,G.jsx)(k,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,G.jsx)(k,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,G.jsx)(k,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,G.jsx)(k,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,G.jsx)(Ee,{}):n===`commits`?(0,G.jsx)(De,{log:e.log}):n===`files`?(0,G.jsx)(Le,{}):(0,G.jsx)(Se,{repo:e,info:t})]})}function Le(){let e=C(),t=b();return(0,G.jsx)(je,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Re(e)}`,{replace:!0})})}function Re(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{Fe as RepoGitRoute};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Fa as r,Lt as i,Ma as a,Mi as o,P as s,Ri as c,Rt as l,Zt as u,br as d,er as f,fr as p,ir as m,ni as h,nn as g,qt as _,r as v}from"./queries-BTgOLNTK.js";import{r as y,t as b}from"./button-wdWSPx_B.js";import{T as x,c as ee,f as S,s as C,t as w}from"./project-router-DgQSavhI.js";import{_ as T,f as E,g as D,h as O,m as k,p as A}from"./reference-chip-BxUGeHDa.js";import{En as j,F as M,bn as N,hn as P}from"./git-tab-loading-w5Ne43J6.js";import{t as F}from"./arrow-left-B1Ed0tpu.js";import{F as I,G as L,I as R,P as z,R as B}from"./worktree-lifecycle-operation-CvU6xu3u.js";import{t as V}from"./circle-check-BiVc-j8x.js";import{d as H}from"./git-toolbar-C3vpZJaZ.js";import{t as te}from"./triangle-alert-BdMPm9Jb.js";import{t as ne}from"./input-Br4NQpZK.js";import{t as U}from"./centered-state-D-wDs7Y1.js";import{W,l as G,s as re}from"./index-D-pGbO9R.js";var K=e(t(),1),q=n(),J=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function Y({children:e}){return(0,q.jsx)(`span`,{className:`font-mono`,children:e})}function X(){return(0,q.jsx)(q.Fragment,{children:J.map((e,t)=>(0,q.jsxs)(`span`,{children:[t>0?t===J.length-1?`, or `:`, `:``,(0,q.jsx)(Y,{children:e})]},e))})}function ie(){return(0,q.jsxs)(q.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,q.jsx)(X,{}),` (agent mirrors like`,` `,(0,q.jsx)(Y,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,q.jsx)(Y,{children:`name`}),`,`,` `,(0,q.jsx)(Y,{children:`description`}),`. Global (`,(0,q.jsx)(Y,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var ae=2e3,Z=5*6e4;async function oe(e,t,n={}){let{apply:r=m,read:i=h,wait:a=e=>new Promise(t=>setTimeout(t,e)),now:o=Date.now,onDropped:s=N}=n;try{return await r(e)}catch(n){if(!(n instanceof f)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&s(e)},c=o()+Z;for(;;){let s;try{s=await i(e)}catch{throw r(`unreachable`),n}if(s.status!==`updating`){if(s.updatedAt&&s.updatedAt!==t)return r(`recovered`),s;throw r(`not_applied`),n}if(o()>=c)throw r(`timed_out`),n;await a(ae)}}}function Q(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let i=r(),o=ee(),s=(0,K.useRef)(0),[c,l]=(0,K.useState)(!1),u=a({mutationFn:()=>d({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{P(`skills_import`),l(!1),o(M(e))},onError:e=>S(e.message,{tone:`danger`})}),f=(t,n)=>{n.seq===s.current&&(i.setQueryData(g.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:v.skills}),S(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),l(!0)))},m=(e,t)=>{t.seq===s.current&&S(e.message,{tone:`danger`})},h=a({mutationFn:t=>p(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>f(e,t),onError:(e,t)=>m(e,t)}),_=a({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>f(e,t),onError:(e,t)=>m(e,t)}),x=e=>{let n=++s.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):h.mutate({action:e,seq:n})},C=t?.scopes??[],w=C.filter(e=>e.skills.length>0),j=w.length>0,N=t?.status===`error`,F=j&&(t?.available||N),I=_.isPending||t?.status===`updating`,L=C.filter(e=>e.status===`error`||e.status===`unavailable`),R=C.filter(e=>e.updatedAt&&!L.includes(e)),z=`Checking installed Open Mercato skills…`;return n?z=`Update status is unavailable right now.`:t?.status===`available`?z=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?z=`Updating installed Open Mercato skills…`:t?.status===`current`&&!j?z=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`:t?.status===`current`?z=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?z=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(z=`The update did not finish for every installation.`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-ui font-medium text-foreground`,children:z}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,w.length>0?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:w.map(e=>(0,q.jsxs)(`li`,{children:[Q(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,L.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,L.map(e=>Q(e.scope)).join(`, `),R.length?`; updated: `+R.map(e=>Q(e.scope)).join(`, `):``,`.`]}):null]}),F?(0,q.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:I,onClick:()=>x(`apply`),children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3.5`,I&&`motion-safe:animate-spin`)}),I?`Updating…`:N?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,q.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(E,{open:c,onOpenChange:e=>u.isPending?void 0:l(e),children:(0,q.jsxs)(A,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(D,{children:[(0,q.jsx)(T,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(k,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(O,{children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>l(!1),children:`No`}),(0,q.jsx)(b,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function ce(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function le(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function $(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(ue,{})]})}function ue(){let e=C()??``,t=l(e,!!e),n=i(),d=u(),f=s(),[p]=x(),[m,h]=(0,K.useState)(``),[g,ee]=(0,K.useState)(null),T=r(),E=_(),D=f.data??[],O=(0,K.useMemo)(()=>D.map(e=>e.name),[D]),k=(0,K.useMemo)(()=>new Set(O),[O]),A=(0,K.useMemo)(()=>new Set(ce(E.data,O)),[E.data,O]),M=(0,K.useRef)(Promise.resolve()),N=(0,K.useRef)(0),P=(0,K.useCallback)(t=>{let n=v.uiState,r=v.skills,i=T.getQueryData(n),a=ce(i,O),s=a.includes(t)?a.filter(e=>e!==t):[...a,t];T.setQueryData(n,{...i,importedSkills:s});let c=++N.current;M.current=M.current.then(async()=>{try{let t=await o({importedSkills:s},e);if(c!==N.current)return;T.setQueryData(n,t),T.invalidateQueries({queryKey:r})}catch(e){if(c!==N.current)return;S(e instanceof Error?e.message:String(e),{tone:`danger`}),T.invalidateQueries({queryKey:n})}})},[O,e,T]),R=a({mutationFn:()=>c(),onSuccess:e=>{T.setQueryData(v.skills,e),S(`Team skills refreshed.`)},onError:e=>S(e.message,{tone:`danger`})});if(n.isError)return(0,q.jsx)(U,{icon:(0,q.jsx)(te,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let V=B(n.data??[]),W=new Set(V.map(e=>e.name)),G=B([...V.map(e=>({...e,enabled:e.source===`team`&&k.has(e.name)?A.has(e.name):!0})),...D.filter(e=>!W.has(e.name)).map(e=>({...e,enabled:A.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),J=p.get(`skill`),Y=G.find(e=>e.name===J)??(J===null?G.find(e=>e.enabled):null)??null,X=Y?.name??null,ae=Y?le(Y,k,E.isPending,P,f.isError):void 0,Z=I(G),oe=Z.map(e=>e.key),Q=g!==null&&oe.includes(g)?g:null,$=I(z(Q===null?G:G.filter(e=>(e.team?.repo??``)===Q),m)),ue=$.flatMap(e=>e.skills);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,J===null||!Y?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(ne,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:m,onChange:e=>h(e.target.value),className:`h-8 text-ui`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:R.isPending,onClick:()=>R.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3`,R.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),Z.length>1?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsxs)(`select`,{"data-slot":`skills-repo-filter`,"aria-label":`Filter by repository`,value:Q??`__all__`,onChange:e=>ee(e.target.value===`__all__`?null:e.target.value),className:`h-8 w-full rounded-md border border-border bg-card px-2 text-ui text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,q.jsx)(`option`,{value:`__all__`,children:`All repositories`}),Z.map(e=>(0,q.jsxs)(`option`,{value:e.key,children:[e.label,` (`,e.skills.length,`)`]},e.key))]})}):null,e?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,f.isError?(0,q.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,q.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,f.error.message]}),(0,q.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:f.isFetching,onClick:()=>void f.refetch(),children:`Retry`})]}):null,(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-ui text-soft-foreground`,children:`Loading…`}):ue.length>0?$.map(e=>(0,q.jsxs)(`li`,{"data-slot":`skill-group`,"data-group":e.key||`local`,className:`list-none`,children:[Z.length>1?(0,q.jsx)(`h3`,{className:`px-2.5 pt-2 pb-1 eyebrow text-soft-foreground`,children:e.label}):null,(0,q.jsx)(`ul`,{className:`space-y-1`,children:e.skills.map(e=>(0,q.jsx)(de,{skill:e,active:X===e.name,activation:le(e,k,E.isPending,P,f.isError)},e.name))})]},e.key)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:G.length>0?`(no skills match)`:(0,q.jsx)(ie,{})})})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,J===null||!Y?`hidden md:flex`:`flex`),children:(0,q.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:Y?(0,q.jsxs)(q.Fragment,{children:[J===null?null:(0,q.jsxs)(w,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,q.jsx)(F,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,q.jsx)(re,{skill:Y,enabled:Y.enabled,activation:ae,usedBy:L(d.data?.workflows??[],Y.name)})]}):n.isPending?null:(0,q.jsx)(U,{icon:(0,q.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function de({skill:e,active:t,activation:n}){let r=R(e),i=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-ui`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(G,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,q.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,q.jsx)(W,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,q.jsx)(w,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{$ as SkillsRoute};
|