cezarion 0.18.0-dev.8613 → 0.18.0-dev.8634
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/package.json +3 -3
- package/web/dist/assets/accounts-section-D7EK3_7b.js +1 -0
- package/web/dist/assets/activity-motion-2BQBW4lA.js +2 -0
- package/web/dist/assets/activity-route-Ct06t8Y9.js +1 -0
- package/web/dist/assets/agent-config-section-D6Lcc7c5.js +7 -0
- package/web/dist/assets/agent-defaults-section-BnDBbzuG.js +1 -0
- package/web/dist/assets/{appearance-Bcl2amXv.js → appearance-CM6ahUyy.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-Bm8miJjt.js → archive-on-merge-field-C7_Fwy2A.js} +1 -1
- package/web/dist/assets/arrow-up-right-DKGzsMqY.js +1 -0
- package/web/dist/assets/attention-CBCeJN5w.js +1 -0
- package/web/dist/assets/automations-route-7B_DF4O1.js +2 -0
- package/web/dist/assets/automations-route-CzqZXK0W.css +1 -0
- package/web/dist/assets/{commit-list-DtEqtn9o.js → commit-list-O4ugJ12w.js} +1 -1
- package/web/dist/assets/{diff-BK789dS0.js → diff-DKZvZQ2G.js} +2 -2
- package/web/dist/assets/{diff-controls-BFqQNxRu.js → diff-controls-BpTFu29H.js} +1 -1
- package/web/dist/assets/{diff-view-BEgQ7jZV.js → diff-view-D4yXb2w7.js} +1 -1
- package/web/dist/assets/file-preview-CUhut4J9.js +2 -0
- package/web/dist/assets/{folder-browser-BfclRPcX.js → folder-browser-B7IbnF0d.js} +1 -1
- package/web/dist/assets/{git-toolbar-Pugtjt-9.js → git-toolbar-po0QJciG.js} +1 -1
- package/web/dist/assets/github-TgLTixC7.js +1 -0
- package/web/dist/assets/global-activity-route-OHCmn0ZO.js +1 -0
- package/web/dist/assets/html-report-BX3msvci.js +3 -0
- package/web/dist/assets/html-report-frame-uuqkBC0u.js +1 -0
- package/web/dist/assets/{image-preview-Dx2w5oIn.js → image-preview-Sisptm3b.js} +1 -1
- package/web/dist/assets/index-C69_Sk06.css +1 -0
- package/web/dist/assets/index-CvVmG4Yu.js +21 -0
- package/web/dist/assets/{label-DEH7fJN4.js → label-Bt8n7Spq.js} +1 -1
- package/web/dist/assets/live-reads-Crd6fVGH.js +1 -0
- package/web/dist/assets/markdown-jle_P0a2.js +2 -0
- package/web/dist/assets/{nav-row-styles-DqKjMToI.js → nav-row-styles-DKeXbc4N.js} +1 -1
- package/web/dist/assets/{notifications-section-DCiqPl3M.js → notifications-section-Bhqr3yOz.js} +1 -1
- package/web/dist/assets/open-in-menu-BPp88ouw.js +1 -0
- package/web/dist/assets/page-shell-7pLJMOgh.js +1 -0
- package/web/dist/assets/page-shell-DQPYcKyL.css +1 -0
- package/web/dist/assets/{preview-pane-connected-WV9oolnn.js → preview-pane-connected-CBt_nlmX.js} +1 -1
- package/web/dist/assets/project-location-BRxXN249.js +1 -0
- package/web/dist/assets/{project-router-Bii3ofOk.js → project-router-CLJTc7gv.js} +1 -1
- package/web/dist/assets/project-scope-context-Rv6S_BXt.js +4 -0
- package/web/dist/assets/projects-section-DnGSWHZJ.js +1 -0
- package/web/dist/assets/{prompt-templates-section-toLPd5u2.js → prompt-templates-section-8kBTviSw.js} +1 -1
- package/web/dist/assets/queries-qCF-eOqZ.js +1 -0
- package/web/dist/assets/{reference-chip-rylFalfg.js → reference-chip-D0v0keVC.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-N9vtBTIK.js → remote-settings-notice-D7G8cXSx.js} +1 -1
- package/web/dist/assets/repo-git-DqBUjQMh.js +1 -0
- package/web/dist/assets/report-reader-DtSBGt0O.js +1 -0
- package/web/dist/assets/reports-CgbU2SrW.css +1 -0
- package/web/dist/assets/reports-ea3-iuBm.js +1 -0
- package/web/dist/assets/{resources-section-B88h1y0Q.js → resources-section-CpXFFHXl.js} +1 -1
- package/web/dist/assets/run-header-BWTrj0_2.js +2 -0
- package/web/dist/assets/{select-BaydzE-I.js → select-aiSr0uTB.js} +1 -1
- package/web/dist/assets/{session-context-section-BJKRXbss.js → session-context-section-BRaZbxVO.js} +2 -2
- package/web/dist/assets/settings-agent-picker-DMIqQhkC.js +1 -0
- package/web/dist/assets/settings-shell-CqiAPuLq.css +1 -0
- package/web/dist/assets/settings-shell-DwMbZhxp.js +1 -0
- package/web/dist/assets/{sidebar-section-B57HIEgv.js → sidebar-section-ClrORHpO.js} +1 -1
- package/web/dist/assets/skills-B97qjJ7j.js +1 -0
- package/web/dist/assets/{tab-link-B1CULYRs.js → tab-link-Bu1g-ArE.js} +1 -1
- package/web/dist/assets/task-changes-BEfLx9dF.js +1 -0
- package/web/dist/assets/task-commits-6f0GpNF7.js +1 -0
- package/web/dist/assets/task-files-CA2xTRaM.js +1 -0
- package/web/dist/assets/task-github-item-BWapcDJr.js +1 -0
- package/web/dist/assets/{task-groups-BbnYlkYj.js → task-groups-4tzKGROI.js} +1 -1
- package/web/dist/assets/task-thread-0rKVutjQ.js +9 -0
- package/web/dist/assets/{tasks-table-Cx7AM7lZ.js → tasks-table-C5uoZMFs.js} +1 -1
- package/web/dist/assets/{thread-state-R0MTvwlo.js → thread-state-C3eDWXYs.js} +1 -1
- package/web/dist/assets/toaster-BXnLIU3z.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Ch0ok71s.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-DrAmCxn8.js +1 -0
- package/web/dist/assets/workflows-CW-1K6tq.js +7 -0
- package/web/dist/assets/workflows-DsE0ExV6.css +1 -0
- package/web/dist/assets/workspace-tools-BzDQrP3y.js +1 -0
- package/web/dist/assets/{worktrees-section-C07tNayi.js → worktrees-section-ay1jJn_w.js} +4 -4
- package/web/dist/index.html +17 -18
- package/web/dist/assets/accounts-section-COizLyTO.js +0 -1
- package/web/dist/assets/activity-motion-DfI5xoMG.js +0 -2
- package/web/dist/assets/activity-route-BQs2vBeo.js +0 -1
- package/web/dist/assets/agent-config-section-BwBo-HRw.js +0 -7
- package/web/dist/assets/agent-defaults-section-h-Gjb_gh.js +0 -1
- package/web/dist/assets/attention-8bNiiAFt.js +0 -1
- package/web/dist/assets/automations-route-CutF-cGn.css +0 -1
- package/web/dist/assets/automations-route-rSezHxBp.js +0 -2
- package/web/dist/assets/file-preview-CDWTFZ4P.js +0 -2
- package/web/dist/assets/github-CvpaGHe6.js +0 -1
- package/web/dist/assets/global-activity-route-Di_ICsRI.js +0 -1
- package/web/dist/assets/index-CGjknHnV.css +0 -1
- package/web/dist/assets/index-CJFT0IZP.js +0 -21
- package/web/dist/assets/live-reads-BJ9eDISf.js +0 -1
- package/web/dist/assets/live-refetch-VoLPvzhe.js +0 -1
- package/web/dist/assets/markdown-Dv0r75AX.js +0 -4
- package/web/dist/assets/open-in-menu-HM5l7Bwk.js +0 -1
- package/web/dist/assets/project-location-CfJLc6aJ.js +0 -1
- package/web/dist/assets/project-scope-context-BdqKyBHa.js +0 -4
- package/web/dist/assets/projects-section-D2cACaaG.js +0 -1
- package/web/dist/assets/queries-C7VNk-nW.js +0 -1
- package/web/dist/assets/repo-git-DJym0aRY.js +0 -1
- package/web/dist/assets/report-reader-CjskGtxS.js +0 -1
- package/web/dist/assets/reports-B-G9HA48.js +0 -1
- package/web/dist/assets/reports-CNFNb36Z.css +0 -1
- package/web/dist/assets/run-header-B-olCSdg.js +0 -2
- package/web/dist/assets/settings-agent-picker-6xZMIC_D.js +0 -1
- package/web/dist/assets/settings-shell-BkTgs1S9.js +0 -1
- package/web/dist/assets/settings-shell-iSd4xMWS.css +0 -1
- package/web/dist/assets/skills-pBrfwrKF.js +0 -1
- package/web/dist/assets/task-changes-CXldTh93.js +0 -1
- package/web/dist/assets/task-commits-BZ3B_GPB.js +0 -1
- package/web/dist/assets/task-files-BSfmCkJc.js +0 -1
- package/web/dist/assets/task-github-item-v2bygvdO.js +0 -1
- package/web/dist/assets/task-thread-BPWnJ7Qx.js +0 -9
- package/web/dist/assets/toaster-Bo5vCbz-.js +0 -1
- package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +0 -1
- package/web/dist/assets/use-hand-to-agent-state-BckHuhr8.js +0 -1
- package/web/dist/assets/useInfiniteQuery--iQKfpUQ.js +0 -1
- package/web/dist/assets/useQuery-BSyhc3l3.js +0 -1
- package/web/dist/assets/workflows-BBc2PFDB.js +0 -7
- package/web/dist/assets/workflows-C6suai0L.css +0 -1
- package/web/dist/assets/workspace-tools-CiTG-ArW.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,s as i,t as a}from"./utils-DSMR_WLb.js";import{Gr as o,Hn as s,Kr as c,Un as l,Ur as u,Vn as d,Vr as f,Wn as p,Xr as ee,di as m,xr as te,yr as ne}from"./project-scope-context-BdqKyBHa.js";import{B as h,H as g,I as _,N as v,W as y,z as b}from"./live-protocol-DMhTnCmf.js";import{Bt as x,Gt as S,Vt as C,Xt as w,yt as T}from"./queries-C7VNk-nW.js";import{i as E,r as D}from"./cez-idle-CdswdDRd.js";import{a as O}from"./dist-C5mlVBmd.js";var re=class extends EventTarget{readyState=0;release;constructor(e,t){super(),this.release=this.subscribe()}subscribe(){let e=()=>queueMicrotask(()=>{this.readyState===0&&(this.readyState=1,this.dispatchEvent(new Event(`open`)))});return o({kind:`workspace`},{ready:e,reset:()=>{this.readyState!==2&&(this.readyState=0,e())},frame:t=>{if(`data`in t&&t.event===`reconnect`){this.readyState=0,e();return}if(`data`in t&&t.event===`disconnect`){this.readyState===1&&(this.readyState=0,this.dispatchEvent(new Event(`error`)));return}`data`in t&&t.event===`ready`&&c(),`data`in t&&this.dispatchEvent(new MessageEvent(t.event,{data:t.data}))}})}requestReady(){return this.readyState!==2&&u()}close(){this.readyState=2,this.release()}},k=e(t(),1);h({runs:_(`summary`).optional()});var A=y().min(1),j=b().int().positive(),ie=h({project:A,seq:j,run:p,relationships:y().min(1)}),ae=h({project:A,seq:j,id:y().min(1)}),M=h({generation:y().min(1),seq:b().int().nonnegative()}),oe=h({project:A,usage:g(y(),d)});h({runs:v(l),referenceStatuses:s,perProjectLimit:b(),truncated:v(y()),generation:y().min(1),eventSeq:b().int().nonnegative()});function se(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}switch(e){case`run-summary`:{let e=ie.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-summary`,summary:e.data.run,seq:e.data.seq,relationships:e.data.relationships}}:null}case`run-deleted`:{let e=ae.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-deleted`,id:e.data.id,seq:e.data.seq}}:null}case`usage`:{let e=oe.safeParse(n);return e.success?{project:e.data.project,event:{type:`usage`,usage:e.data.usage}}:null}case`ready`:{let e=M.safeParse(n);return e.success?{project:null,event:{type:`ready`,generation:e.data.generation,seq:e.data.seq}}:null}default:return null}}function ce(){let e;return{ready(t){let n=e!==void 0&&t>e;return e=t,n},frame(t){let n=e!==void 0&&t!==e+1;return e=t,n},reset(){e=void 0}}}function N(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=t,r}let r=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),i=[...e];return i.splice(r<0?e.length:r,0,t),i}function P(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}var F=Object.freeze({});function le(){let e=F,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()}}}function I(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function ue(e){let t=new Map,n=t=>e.getQueryCache().find({queryKey:t,exact:!0}),r=t=>{if(!t.owed||t.timer!==void 0)return;let i=n(t.key);if(!i){t.owed=!1;return}if(!i.isActive()){t.owed=!1,e.invalidateQueries({queryKey:t.key,exact:!0,refetchType:`none`});return}if(i.state.fetchStatus!==`idle`)return;let a=t.lastStart+400-Date.now();if(a>0){t.timer=setTimeout(()=>{t.timer=void 0,r(t)},a);return}t.owed=!1,t.lastStart=Date.now(),e.refetchQueries({queryKey:t.key,exact:!0,type:`active`},{cancelRefetch:!1})},i=e.getQueryCache().subscribe(n=>{if(n.type!==`updated`||t.size===0)return;let i=t.get(JSON.stringify(n.query.queryKey));if(i){if(n.action.type===`success`&&!n.action.manual){let t=n.query.promise;t&&i.preEvent.has(t)&&(i.preEvent.delete(t),I(e,i.key),i.owed=!0)}n.query.state.fetchStatus===`idle`&&r(i)}});return{onEvent(i){let a=x.runs.detail(i),o=n(a);if(!o)return;let s=JSON.stringify(a),c=t.get(s);c||(c={key:a,owed:!1,lastStart:0,preEvent:new WeakSet},t.set(s,c)),o.state.fetchStatus!==`idle`&&o.promise&&c.preEvent.add(o.promise),I(e,a),c.owed=!0,r(c)},forget(e){let n=JSON.stringify(x.runs.detail(e));clearTimeout(t.get(n)?.timer),t.delete(n)},cancel(){i();for(let e of t.values())clearTimeout(e.timer);t.clear()}}}function de(e){let t=new Map;return{refresh(n){let r=x.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var L=n(),fe=r(`/workspace/events?runs=summary`),R=2,z=3e3,B=[`run-summary`,`run-deleted`,`usage`,`ping`,`ready`],V=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`project-ready`],H=new Set;function pe(e){return H.add(e),()=>{H.delete(e)}}function U(e){return e[1]===`runs`&&e[2]===`list`}function W(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function G(e){return e.invalidateQueries({predicate:e=>U(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>U(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>W(e,t.queryKey))}var me=1e3,K=new WeakMap;function q(e){let t=x.repoBranches,n=K.get(e);if(n){n.set(JSON.stringify(t),t);return}K.set(e,new Map([[JSON.stringify(t),t]])),setTimeout(()=>{let t=K.get(e);K.delete(e);for(let n of t?.values()??[])e.invalidateQueries({queryKey:n})},me)}function J(e,t,n=!1){if(t?.aborted)return Promise.resolve();let r=[x.runs.all,C.runsIndex,C.projects,x.health,x.worktrees,x.repoBranches,C.providerStatus],i=()=>{for(let t of r)e.cancelQueries({queryKey:t})};return t?.addEventListener(`abort`,i,{once:!0}),E(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>U(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:x.runs.all,...n?{predicate:e=>[`list`,`detail`,`relationships`,`archived`].includes(String(e.queryKey[2]))}:{}}),e.invalidateQueries({predicate:e=>U(e.queryKey)}),S(e).reconcile(),e.invalidateQueries({queryKey:C.projects}),W(e,x.health),e.invalidateQueries({queryKey:x.worktrees}),e.invalidateQueries({queryKey:x.repoBranches}),e.invalidateQueries({queryKey:C.providerStatus}),n?void 0:e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]}).finally(()=>t?.removeEventListener(`abort`,i))}function Y(e){return i()??X(e)}function X(e){let t=e.getQueryData(C.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(x.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function he(e,t){return[w({projectId:e,boot:e===t}).cacheScope,`runs`,`list`]}function ge(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=N(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[he(t,X(e))],r=[t,`runs`,`list`];return(t===Y(e)||e.getQueryState(r))&&n.push(r),t===Y(e)&&n.push(x.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run-summary`&&u.summary.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.summary.id)?.archived)&&u.type===`run-summary`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.summary.id,u.summary)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run-summary`?e.setQueryData(t,e=>N(e,u.summary)):e.setQueryData(t,e=>P(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}var _e=400;function ve(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},_e))};return{onSummary(e,n){let i=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,a=e.delegation?.role===`worker`?e.delegation.supervisorRunId:void 0,o=t.get(e.id);if(t.set(e.id,{shape:n,...i===void 0?{}:{parentRunId:i},...a===void 0?{}:{supervisorRunId:a}}),o?.shape!==n){r(x.runs.relationships(e.id),!0);for(let e of[i,a])e!==void 0&&r(x.runs.relationships(e),!0)}},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:x.runs.relationships(n)}),i?.supervisorRunId!==void 0&&r(x.runs.relationships(i.supervisorRunId),!0),i?.parentRunId===void 0?r([...x.runs.all,`relationships`],!1):r(x.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var Z={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function ye(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(Z)){let i=r.state.data;i&&(i.pages.some(e=>e.runs.some(e=>e.id===t.id))?(e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?t:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)):t.archived&&(n=!0))}n&&e.invalidateQueries(Z)}function be(e,t,n,r,i){switch(n.type){case`run-summary`:{let t=n.summary;if(ye(e,t),i.onSummary(t,n.relationships),r.fetcher.onEvent(t.id),t.delegation?.role===`worker`){let n=t.delegation.parentRunId;I(e,x.runs.detail(n)),r.refreshParent(n)}let a=x.runs.changes(t.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:x.worktrees}),q(e);return}case`run-deleted`:i.onDeleted(n.id),r.fetcher.forget(n.id),e.removeQueries({queryKey:x.runs.detail(n.id)}),e.removeQueries({queryKey:x.runs.diff(n.id)}),e.setQueriesData(Z,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(Z),e.invalidateQueries({queryKey:x.worktrees}),q(e);return;case`usage`:t.set(n.usage);return;case`ping`:case`ready`:return}}function xe(e,t=fe){let n=m();(0,k.useEffect)(()=>{let r=re;if(typeof r!=`function`)return;let i=null,a=S(n);a.setUnknownGenerationHandler(()=>{let e=i?.requestReady;return typeof e==`function`&&e.call(i)});let o=de(n),s=ue(n),c={fetcher:s,refreshParent:o.refresh},l=ce(),u=ge(n),d=ve(n),p=!1,m,h=!1,g=!1,_=!1,v=!1,y=()=>{_=!0,v=!1;let e=C.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(g||!v){_=!1;return}y()})},b=()=>{g||m!==void 0||(m=setTimeout(()=>{m=void 0,g||w()},z))},w=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{p=!0,l.reset(),a.detach(),D(!1),h&&(u.flush(),J(n)),h||(E(()=>G(n)),n.cancelQueries({queryKey:x.health}).then(()=>{g||n.invalidateQueries({queryKey:x.health})}),a.reconcile()),h=!0});for(let t of B)i.addEventListener(t,r=>{let i=se(t,r.data);if(!i)return;if(i.event.type===`ready`){let e=l.ready(i.event.seq);a.ready(i.event.generation,i.event.seq),e&&(u.flush(),J(n));return}let o=(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&l.frame(i.event.seq);i.event.type===`ping`&&p&&(p=!1,E(()=>G(n)),D(!0)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`?a.run(i.project,i.event,o):i.event.type===`usage`&&a.usage(i.project,i.event.usage)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&u.onEvent(i.project,i.event),(i.project===null||i.project===Y(n))&&be(n,e,i.event,c,d),o&&(u.flush(),J(n))});for(let e of V)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}if(e===`project-ready`?a.reconcile({hold:!0}):e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:C.projects}),e===`project-added`){let e=r?.project?.id;typeof e==`string`&&e!==``&&a.restoreProject(e),a.reconcile({hold:!0})}if(e===`project-removed`){let e=r?.id;typeof e==`string`&&e!==``&&a.dropProject(e)}for(let t of[...H])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=ee.safeParse(t);r.success&&(n.cancelQueries({queryKey:x.health}),n.setQueryData(x.health,r.data))}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=te(t);if(!r)return;let i=C.providerStatus,a=ne(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(_){v=!0;return}y()}),i.addEventListener(`error`,()=>{D(!1),a.detach(),i?.readyState===R&&b()})},T=()=>{document.visibilityState===`visible`&&(u.flush(),a.flush(),(!i||i.readyState===R)&&(clearTimeout(m),m=void 0,w()))},O=()=>{clearTimeout(m),m=void 0,u.flush()};document.addEventListener(`visibilitychange`,T),window.addEventListener(`pagehide`,O);let k=f((e,t)=>(u.flush(),J(n,e,t)));return w(),()=>{k(),g=!0,D(!1),clearTimeout(m),u.flush(),u.cancel(),a.stop(),o.cancel(),s.cancel(),a.setUnknownGenerationHandler(void 0),d.cancel(),document.removeEventListener(`visibilitychange`,T),window.removeEventListener(`pagehide`,O),i?.close(),i=null}},[n,e,t])}var Q=(0,k.createContext)(null);function Se({children:e}){let[t]=(0,k.useState)(le);return xe(t),T(),(0,L.jsx)(Q.Provider,{value:t,children:e})}function Ce(e){let t=(0,k.useContext)(Q),n=t?t.get:Te;return(0,k.useSyncExternalStore)(t?t.subscribe:we,()=>e?n()[e]:void 0,()=>void 0)}var we=()=>()=>void 0,Te=()=>F,Ee=`Label`,$=k.forwardRef((e,t)=>(0,L.jsx)(O.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));$.displayName=Ee;var De=$;function Oe({className:e,...t}){return(0,L.jsx)(De,{"data-slot":`label`,className:a(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}export{Ce as i,Se as n,pe as r,Oe as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r,s as i,t as a}from"./utils-DSMR_WLb.js";import{Gr as o,Hn as s,Kr as c,Un as l,Ur as u,Vn as d,Vr as f,Wn as p,Xr as ee,pi as m,xr as te,yr as ne}from"./project-scope-context-Rv6S_BXt.js";import{B as h,H as g,I as _,N as v,W as y,z as b}from"./live-protocol-DMhTnCmf.js";import{Bt as x,Gt as S,Vt as C,Xt as w,yt as T}from"./queries-qCF-eOqZ.js";import{i as E,r as D}from"./cez-idle-CdswdDRd.js";import{a as O}from"./dist-C5mlVBmd.js";var re=class extends EventTarget{readyState=0;release;constructor(e,t){super(),this.release=this.subscribe()}subscribe(){let e=()=>queueMicrotask(()=>{this.readyState===0&&(this.readyState=1,this.dispatchEvent(new Event(`open`)))});return o({kind:`workspace`},{ready:e,reset:()=>{this.readyState!==2&&(this.readyState=0,e())},frame:t=>{if(`data`in t&&t.event===`reconnect`){this.readyState=0,e();return}if(`data`in t&&t.event===`disconnect`){this.readyState===1&&(this.readyState=0,this.dispatchEvent(new Event(`error`)));return}`data`in t&&t.event===`ready`&&c(),`data`in t&&this.dispatchEvent(new MessageEvent(t.event,{data:t.data}))}})}requestReady(){return this.readyState!==2&&u()}close(){this.readyState=2,this.release()}},k=e(t(),1);h({runs:_(`summary`).optional()});var A=y().min(1),j=b().int().positive(),ie=h({project:A,seq:j,run:p,relationships:y().min(1)}),ae=h({project:A,seq:j,id:y().min(1)}),M=h({generation:y().min(1),seq:b().int().nonnegative()}),oe=h({project:A,usage:g(y(),d)});h({runs:v(l),referenceStatuses:s,perProjectLimit:b(),truncated:v(y()),generation:y().min(1),eventSeq:b().int().nonnegative()});function se(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}switch(e){case`run-summary`:{let e=ie.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-summary`,summary:e.data.run,seq:e.data.seq,relationships:e.data.relationships}}:null}case`run-deleted`:{let e=ae.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-deleted`,id:e.data.id,seq:e.data.seq}}:null}case`usage`:{let e=oe.safeParse(n);return e.success?{project:e.data.project,event:{type:`usage`,usage:e.data.usage}}:null}case`ready`:{let e=M.safeParse(n);return e.success?{project:null,event:{type:`ready`,generation:e.data.generation,seq:e.data.seq}}:null}default:return null}}function ce(){let e;return{ready(t){let n=e!==void 0&&t>e;return e=t,n},frame(t){let n=e!==void 0&&t!==e+1;return e=t,n},reset(){e=void 0}}}function N(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=t,r}let r=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),i=[...e];return i.splice(r<0?e.length:r,0,t),i}function P(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}var F=Object.freeze({});function le(){let e=F,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()}}}function I(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function ue(e){let t=new Map,n=t=>e.getQueryCache().find({queryKey:t,exact:!0}),r=t=>{if(!t.owed||t.timer!==void 0)return;let i=n(t.key);if(!i){t.owed=!1;return}if(!i.isActive()){t.owed=!1,e.invalidateQueries({queryKey:t.key,exact:!0,refetchType:`none`});return}if(i.state.fetchStatus!==`idle`)return;let a=t.lastStart+400-Date.now();if(a>0){t.timer=setTimeout(()=>{t.timer=void 0,r(t)},a);return}t.owed=!1,t.lastStart=Date.now(),e.refetchQueries({queryKey:t.key,exact:!0,type:`active`},{cancelRefetch:!1})},i=e.getQueryCache().subscribe(n=>{if(n.type!==`updated`||t.size===0)return;let i=t.get(JSON.stringify(n.query.queryKey));if(i){if(n.action.type===`success`&&!n.action.manual){let t=n.query.promise;t&&i.preEvent.has(t)&&(i.preEvent.delete(t),I(e,i.key),i.owed=!0)}n.query.state.fetchStatus===`idle`&&r(i)}});return{onEvent(i){let a=x.runs.detail(i),o=n(a);if(!o)return;let s=JSON.stringify(a),c=t.get(s);c||(c={key:a,owed:!1,lastStart:0,preEvent:new WeakSet},t.set(s,c)),o.state.fetchStatus!==`idle`&&o.promise&&c.preEvent.add(o.promise),I(e,a),c.owed=!0,r(c)},forget(e){let n=JSON.stringify(x.runs.detail(e));clearTimeout(t.get(n)?.timer),t.delete(n)},cancel(){i();for(let e of t.values())clearTimeout(e.timer);t.clear()}}}function de(e){let t=new Map;return{refresh(n){let r=x.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var L=n(),fe=r(`/workspace/events?runs=summary`),R=2,z=3e3,B=[`run-summary`,`run-deleted`,`usage`,`ping`,`ready`],V=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`project-ready`],H=new Set;function pe(e){return H.add(e),()=>{H.delete(e)}}function U(e){return e[1]===`runs`&&e[2]===`list`}function W(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function G(e){return e.invalidateQueries({predicate:e=>U(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>U(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>W(e,t.queryKey))}var me=1e3,K=new WeakMap;function q(e){let t=x.repoBranches,n=K.get(e);if(n){n.set(JSON.stringify(t),t);return}K.set(e,new Map([[JSON.stringify(t),t]])),setTimeout(()=>{let t=K.get(e);K.delete(e);for(let n of t?.values()??[])e.invalidateQueries({queryKey:n})},me)}function J(e,t,n=!1){if(t?.aborted)return Promise.resolve();let r=[x.runs.all,C.runsIndex,C.projects,x.health,x.worktrees,x.repoBranches,C.providerStatus],i=()=>{for(let t of r)e.cancelQueries({queryKey:t})};return t?.addEventListener(`abort`,i,{once:!0}),E(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>U(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:x.runs.all,...n?{predicate:e=>[`list`,`detail`,`relationships`,`archived`].includes(String(e.queryKey[2]))}:{}}),e.invalidateQueries({predicate:e=>U(e.queryKey)}),S(e).reconcile(),e.invalidateQueries({queryKey:C.projects}),W(e,x.health),e.invalidateQueries({queryKey:x.worktrees}),e.invalidateQueries({queryKey:x.repoBranches}),e.invalidateQueries({queryKey:C.providerStatus}),n?void 0:e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]}).finally(()=>t?.removeEventListener(`abort`,i))}function Y(e){return i()??X(e)}function X(e){let t=e.getQueryData(C.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(x.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function he(e,t){return[w({projectId:e,boot:e===t}).cacheScope,`runs`,`list`]}function ge(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=N(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[he(t,X(e))],r=[t,`runs`,`list`];return(t===Y(e)||e.getQueryState(r))&&n.push(r),t===Y(e)&&n.push(x.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run-summary`&&u.summary.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.summary.id)?.archived)&&u.type===`run-summary`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.summary.id,u.summary)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run-summary`?e.setQueryData(t,e=>N(e,u.summary)):e.setQueryData(t,e=>P(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}var _e=400;function ve(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},_e))};return{onSummary(e,n){let i=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,a=e.delegation?.role===`worker`?e.delegation.supervisorRunId:void 0,o=t.get(e.id);if(t.set(e.id,{shape:n,...i===void 0?{}:{parentRunId:i},...a===void 0?{}:{supervisorRunId:a}}),o?.shape!==n){r(x.runs.relationships(e.id),!0);for(let e of[i,a])e!==void 0&&r(x.runs.relationships(e),!0)}},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:x.runs.relationships(n)}),i?.supervisorRunId!==void 0&&r(x.runs.relationships(i.supervisorRunId),!0),i?.parentRunId===void 0?r([...x.runs.all,`relationships`],!1):r(x.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var Z={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function ye(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(Z)){let i=r.state.data;i&&(i.pages.some(e=>e.runs.some(e=>e.id===t.id))?(e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?t:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)):t.archived&&(n=!0))}n&&e.invalidateQueries(Z)}function be(e,t,n,r,i){switch(n.type){case`run-summary`:{let t=n.summary;if(ye(e,t),i.onSummary(t,n.relationships),r.fetcher.onEvent(t.id),t.delegation?.role===`worker`){let n=t.delegation.parentRunId;I(e,x.runs.detail(n)),r.refreshParent(n)}let a=x.runs.changes(t.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:x.worktrees}),q(e);return}case`run-deleted`:i.onDeleted(n.id),r.fetcher.forget(n.id),e.removeQueries({queryKey:x.runs.detail(n.id)}),e.removeQueries({queryKey:x.runs.diff(n.id)}),e.setQueriesData(Z,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(Z),e.invalidateQueries({queryKey:x.worktrees}),q(e);return;case`usage`:t.set(n.usage);return;case`ping`:case`ready`:return}}function xe(e,t=fe){let n=m();(0,k.useEffect)(()=>{let r=re;if(typeof r!=`function`)return;let i=null,a=S(n);a.setUnknownGenerationHandler(()=>{let e=i?.requestReady;return typeof e==`function`&&e.call(i)});let o=de(n),s=ue(n),c={fetcher:s,refreshParent:o.refresh},l=ce(),u=ge(n),d=ve(n),p=!1,m,h=!1,g=!1,_=!1,v=!1,y=()=>{_=!0,v=!1;let e=C.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(g||!v){_=!1;return}y()})},b=()=>{g||m!==void 0||(m=setTimeout(()=>{m=void 0,g||w()},z))},w=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{p=!0,l.reset(),a.detach(),D(!1),h&&(u.flush(),J(n)),h||(E(()=>G(n)),n.cancelQueries({queryKey:x.health}).then(()=>{g||n.invalidateQueries({queryKey:x.health})}),a.reconcile()),h=!0});for(let t of B)i.addEventListener(t,r=>{let i=se(t,r.data);if(!i)return;if(i.event.type===`ready`){let e=l.ready(i.event.seq);a.ready(i.event.generation,i.event.seq),e&&(u.flush(),J(n));return}let o=(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&l.frame(i.event.seq);i.event.type===`ping`&&p&&(p=!1,E(()=>G(n)),D(!0)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`?a.run(i.project,i.event,o):i.event.type===`usage`&&a.usage(i.project,i.event.usage)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&u.onEvent(i.project,i.event),(i.project===null||i.project===Y(n))&&be(n,e,i.event,c,d),o&&(u.flush(),J(n))});for(let e of V)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}if(e===`project-ready`?a.reconcile({hold:!0}):e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:C.projects}),e===`project-added`){let e=r?.project?.id;typeof e==`string`&&e!==``&&a.restoreProject(e),a.reconcile({hold:!0})}if(e===`project-removed`){let e=r?.id;typeof e==`string`&&e!==``&&a.dropProject(e)}for(let t of[...H])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=ee.safeParse(t);r.success&&(n.cancelQueries({queryKey:x.health}),n.setQueryData(x.health,r.data))}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=te(t);if(!r)return;let i=C.providerStatus,a=ne(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(_){v=!0;return}y()}),i.addEventListener(`error`,()=>{D(!1),a.detach(),i?.readyState===R&&b()})},T=()=>{document.visibilityState===`visible`&&(u.flush(),a.flush(),(!i||i.readyState===R)&&(clearTimeout(m),m=void 0,w()))},O=()=>{clearTimeout(m),m=void 0,u.flush()};document.addEventListener(`visibilitychange`,T),window.addEventListener(`pagehide`,O);let k=f((e,t)=>(u.flush(),J(n,e,t)));return w(),()=>{k(),g=!0,D(!1),clearTimeout(m),u.flush(),u.cancel(),a.stop(),o.cancel(),s.cancel(),a.setUnknownGenerationHandler(void 0),d.cancel(),document.removeEventListener(`visibilitychange`,T),window.removeEventListener(`pagehide`,O),i?.close(),i=null}},[n,e,t])}var Q=(0,k.createContext)(null);function Se({children:e}){let[t]=(0,k.useState)(le);return xe(t),T(),(0,L.jsx)(Q.Provider,{value:t,children:e})}function Ce(e){let t=(0,k.useContext)(Q),n=t?t.get:Te;return(0,k.useSyncExternalStore)(t?t.subscribe:we,()=>e?n()[e]:void 0,()=>void 0)}var we=()=>()=>void 0,Te=()=>F,Ee=`Label`,$=k.forwardRef((e,t)=>(0,L.jsx)(O.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));$.displayName=Ee;var De=$;function Oe({className:e,...t}){return(0,L.jsx)(De,{"data-slot":`label`,className:a(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}export{Ce as i,Se as n,pe as r,Oe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{$r as n,Fn as r,Gr as i,Pn as a,Rn as o,pi as s,ti as c}from"./project-scope-context-Rv6S_BXt.js";import{B as l,I as u,N as d,P as f,W as p,a as m,j as h}from"./live-protocol-DMhTnCmf.js";function g(e,t){return e??t}function _(e,t){let n=g(e,t);return n===`1`||n===`true`}function v(e,t,n){return e?.trim()||g(t,n)||``}var y=h([`own`,`provider-spanning`]),b=l({suggested:d(l({id:p(),label:p(),desc:p()})),retired:d(p())}),x=l({id:h([`settings`,`mcp`,`memory`]),label:p(),note:p().optional(),empty:p().optional(),showsUserMcp:u(!0).optional()}),S=l({label:p(),note:p().optional(),groups:d(x)}),C=l({runners:d(l({id:n,displayName:p(),modelListName:p(),modelIdScope:y,pickerLabel:p(),pickerDescription:p(),icon:p(),installHint:p(),loginCommand:p(),terminalLogin:f().optional(),browserLogin:f().optional(),managedInstall:u(!0).optional(),accountFolderExample:p().optional(),models:b,agentConfig:S}))}),w=[`workspace`,`runners`];async function T(e){return o(await a.api.v1.runners.$get({},r(e)),`/runners`,C)}var E={queryKey:w,queryFn:({signal:e})=>T({signal:e}),staleTime:1/0};function D(){return c(E)}function O(e){return e?.runners??[]}function k(e){return O(e).map(e=>e.id)}function A(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function j(e){let t=D();return{runner:t.isSuccess?A(e,k(t.data))??e:e,ready:!t.isPending}}function M(e,t){return e?.runners.find(e=>e.id===t)}function N(e,t){return M(e,t)?.displayName??t}function P(e,t){return M(e,t)?.pickerLabel??t}function F(e,t){return M(e,t)?.modelListName}function I(){return _(void 0,void 0)}function L(e){return!I()&&e}function R(e,t){return i({kind:`topic`,topic:e},{value:t})}var z=e(t(),1);function B(e,t){if(!m(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),i({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function V(e,t,n,r){let i=s(),a=JSON.stringify(t),o=(0,z.useMemo)(()=>JSON.parse(a),[a]);(0,z.useEffect)(()=>{if(!e||n===!1)return;let t=!0,a=B({path:e,intervalMs:n},(e,n)=>{n||i.cancelQueries({queryKey:o,exact:!0}).then(()=>{t&&i.setQueryData(o,r?r(e,i):e)})});return()=>{t=!1,a()}},[i,e,o,n,r])}export{I as a,O as c,F as d,P as f,v as h,L as i,M as l,D as m,V as n,A as o,j as p,R as r,N as s,B as t,k as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r}from"./utils-DSMR_WLb.js";import{d as i,f as a,p as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{Gt as s,Ht as c,Jt as l,Kt as u,Ut as d,Wt as f,Yt as p,qt as m}from"./index-CvVmG4Yu.js";import{i as h,n as g,s as _}from"./chunk-BO2N2NFS-DQrpGzb-.js";import{i as v,o as y,r as b,t as x}from"./highlighter-DvLzHjjY.js";import{r as S}from"./html-report-BX3msvci.js";var C=e(t(),1),w=n();function T({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,w.jsx)(c,{open:e,onOpenChange:e=>{e||t()},children:(0,w.jsxs)(s,{"data-slot":`link-safety-dialog`,children:[(0,w.jsxs)(l,{children:[(0,w.jsx)(p,{children:`Open this link?`}),(0,w.jsxs)(u,{children:[`It leaves Squawk in a new tab. The words of a link in a transcript are the agent's — the address below is where it actually goes.`,(0,w.jsx)(`span`,{"data-slot":`link-safety-url`,className:`mt-3 block wrap-anywhere rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs text-foreground`,children:r})]})]}),(0,w.jsxs)(m,{children:[(0,w.jsx)(f,{children:`Cancel`}),(0,w.jsx)(d,{onClick:n,children:`Open link`})]})]})})}var E=(0,C.createContext)(null),D=/^[0-9a-f-]{36}$/i,O=/^(\/p\/[^/?#]+\/tasks\/[^/?#]+)\/files\?(artifact=[^&#]*)$/;function k(e){let t=new URLSearchParams(e);return[...t.keys()].length===1&&D.test(t.get(`artifact`)??``)}function A(e,t,n){if(e.startsWith(`${t}?artifact=`))return k(e.slice(t.length+1))?n+e.slice(t.length):null;let r=O.exec(e);return r&&k(r[2])?`${r[1]}/report?${r[2]}`:void 0}var j=/^\/(?:api|p|tasks|new|settings|skills|workflows|git|github|inbox|automations)(?:\/|[?#]|$)/;function M(e,t){let n=/^[a-z]:[\\/]/i.test(e),r=/^file:/i.test(e);if(!n&&/^[a-z][a-z\d+.-]*:/i.test(e)&&!r)return null;let i=r?e:decodeURIComponent(e);if(/[\u0000-\u001f]/.test(i))return null;if(!t||i.startsWith(`/`)||n||r)return i;let a=t.replaceAll(`\\`,`/`);return a.slice(0,a.lastIndexOf(`/`)+1)+i}function N(e,t){if(!e||/[\u0000-\u001f]/.test(e)||e.startsWith(`#`)||e.startsWith(`//`))return null;let n=e.indexOf(`#`),r=n<0?e:e.slice(0,n),i=n<0?``:e.slice(n),a=t.projectId?`/p/${encodeURIComponent(t.projectId)}`:``,o=`/tasks/${encodeURIComponent(t.runId)}/files`,s=`/tasks/${encodeURIComponent(t.runId)}/report`,c=A(r,o,a+s);if(c!==void 0)return c===null?null:c+i;if(j.test(r))return null;let l=M(r,t.basePath);return l===null?null:`${a}${S(l)?s:o}?path=${encodeURIComponent(l)}${i}`}var P=`text-accent-text underline underline-offset-2`;function F({href:e,children:t,internal:n,...r}){let[a,o]=(0,C.useState)(!1),s=i();return e?n?s?(0,w.jsx)(I,{...r,href:e,children:t}):(0,w.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:P,children:t}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`cursor-pointer ${P}`,onClick:e=>{e.preventDefault(),o(!0)},children:t}),(0,w.jsx)(T,{isOpen:a,url:e,onClose:()=>o(!1),onConfirm:()=>{window.open(e,`_blank`,`noreferrer`),o(!1)}})]}):(0,w.jsx)(`span`,{children:t})}function I({href:e,children:t,...n}){let r=o(),i=a();return(0,w.jsx)(`a`,{...n,href:e,"data-streamdown":`link`,className:P,onClick:t=>L(t,r,e,i),children:t})}function L(e,t,n,r){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t(n,{state:{readerFrom:r.pathname+r.search,filesRestoreKey:r.key}}))}var R={code:{name:`shiki`,type:`code-highlighter`,getThemes:()=>[x,x],getSupportedLanguages:()=>y(),supportsLanguage:e=>y().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>v(e,String(t))||(b(e,String(t)).then(e=>n?.(e)),null)}},z=[x,x],B={code:{copy:!0,download:!1},table:!1,mermaid:!1},V=[...Object.values(_),Z];function H(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
|
|
2
|
+
`)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var U=[...Object.values(g),H],W=[`p`,`strong`,`em`,`del`,`code`,`a`],G={p:`span`,a:`span`},K={enabled:!0,renderModal:e=>(0,w.jsx)(T,{...e})},q=`https://refused.invalid/`,J=new WeakSet;function Y(e){let t=e.position?.start.offset,n=e.position?.end.offset;return t===void 0||n===void 0?null:`${t}:${n}`}function X(e){return(t,n)=>{let r=new Set,i=new Map,a=t=>{if((t.type===`link`||t.type===`definition`)&&t.url){let n=N(t.url,e);if(t.type===`definition`&&t.identifier&&!i.has(t.identifier)&&i.set(t.identifier,n!==null),n){t.url=n;let e=Y(t);t.type===`link`&&e!==null&&r.add(e)}}t.children?.forEach(a)};a(t);let o=e=>{let t=Y(e);e.type===`linkReference`&&e.identifier&&i.get(e.identifier)&&t!==null&&r.add(t),e.children?.forEach(o)};o(t),n.data.taskLinks=r}}function Z(){return(e,t)=>{let n=e=>{let r=Y(e);e.tagName===`a`&&r!==null&&t.data.taskLinks instanceof Set&&t.data.taskLinks.has(r)&&J.add(e),e.children?.forEach(n)};n(e)}}var Q=0,$=(0,C.memo)(function({children:e,breaks:t=!1,inline:n=!1,document:i=!1,imageSrc:a}){let o=(0,C.useContext)(E),s=(0,C.useMemo)(()=>{let e={instance:++Q},n=new Set;function r(){let e=t=>{if(t.type===`image`&&t.url&&a){let e=a(t.url);t.url=e?new URL(e,window.location.href).href:q,e&&n.add(t.url)}t.children?.forEach(e)};return e}let s=o?[[X,o]]:[],c=i&&a?[[r,e]]:[];return{key:e.instance,remark:[...t?U:Object.values(g),...s,...c],components:{...o||i?{a:({href:e,children:t,node:n})=>i&&!o&&!/^(?:https?:|mailto:|#)/i.test(e??``)?(0,w.jsx)(`span`,{children:t}):(0,w.jsx)(F,{href:e,internal:n!==void 0&&J.has(n),children:t})}:{},...i?{img:({src:e,alt:t})=>typeof e==`string`&&n.has(e)?(0,w.jsx)(`img`,{src:e,alt:t??``,loading:`lazy`}):(0,w.jsxs)(`span`,{className:`text-muted-foreground`,children:[`[Image: `,t||`embedded image`,`]`]})}:{}}}},[o,t,i,a]);return(0,w.jsx)(h,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:R,shikiTheme:z,...r({rehypePlugins:o?V:void 0,remarkPlugins:o||i&&a?s.remark:t?U:void 0,allowedElements:n?W:void 0,unwrapDisallowed:n||void 0,components:n?G:o||i?s.components:void 0}),linkSafety:K,controls:B,lineNumbers:!1,children:e},s.key)});export{N as i,L as n,E as r,$ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./utils-DSMR_WLb.js";import{t as e}from"./createLucideIcon-BHp8sXmF.js";var t=e(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),n=`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`,r=`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`,i=`flex flex-col gap-[12px]`,a=`flex flex-col gap-px`,o=`flex flex-col gap-px`,s=`truncate px-[10px] pt-[2px] pb-[4px] text-[11px] font-medium text-soft-foreground`,c=`group flex h-[32px] items-center gap-[10px] rounded-[6px] px-[10px] text-[13px] text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,l=`hover:bg-sidebar-row-hover hover:text-foreground`,u=`size-[15px] shrink-0 text-soft-foreground group-aria-[current=page]:text-foreground`,d=`ml-auto text-[11.5px] tabular-nums text-soft-foreground`,f=`
|
|
1
|
+
import"./utils-DSMR_WLb.js";import{t as e}from"./createLucideIcon-BHp8sXmF.js";var t=e(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),n=`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`,r=`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`,i=`flex flex-col gap-[12px]`,a=`flex flex-col gap-px`,o=`flex flex-col gap-px`,s=`truncate px-[10px] pt-[2px] pb-[4px] text-[11px] font-medium text-soft-foreground`,c=`group flex h-[32px] items-center gap-[10px] rounded-[6px] px-[10px] text-[13px] text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,l=`hover:bg-sidebar-row-hover hover:text-foreground`,u=`size-[15px] shrink-0 text-soft-foreground group-aria-[current=page]:text-foreground`,d=`ml-auto text-[11.5px] tabular-nums text-soft-foreground`,f=`mb-[16px] flex flex-col`,p=`px-[10px] pt-[2px] pb-[4px] text-[12px] font-medium text-soft-foreground`,m=`group flex h-[48px] items-center gap-[12px] rounded-[8px] px-[10px] text-[14px] text-foreground focus-visible:outline-2 focus-visible:outline-ring`,h=`size-[18px] shrink-0 text-soft-foreground group-aria-[current=page]:text-foreground`,g=`ml-auto text-[13px] tabular-nums text-soft-foreground`,_=`size-[15px] shrink-0 text-soft-foreground`;export{t as _,p as a,i as c,s as d,u as f,n as g,o as h,f as i,d as l,l as m,_ as n,h as o,c as p,g as r,m as s,r as t,a as u};
|
package/web/dist/assets/{notifications-section-DCiqPl3M.js → notifications-section-Bhqr3yOz.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{on as r,pi as i}from"./project-scope-context-Rv6S_BXt.js";import{n as a}from"./toaster-BXnLIU3z.js";import{It as o,Vt as s}from"./queries-qCF-eOqZ.js";import{r as c}from"./switch-SP8pw5uU.js";import{ct as l,lt as u}from"./index-CvVmG4Yu.js";var d=e(t(),1),f=n();function p(){let e=i(),t=o(),[n,p]=d.useState(!1),[m,h]=d.useState(u),g=t.data;d.useEffect(()=>{g!==void 0&&p(l(g.notifications).enabled)},[g]);let _=d.useCallback(t=>{p(t),r({notifications:{enabled:t}}).then(t=>e.setQueryData(s.uiState,t)).catch(t=>{a(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:s.uiState})})},[e]),v=d.useCallback(e=>{if(!e){_(!1);return}if(u()!=="default"){_(!0);return}_(!0),Notification.requestPermission().then(e=>h(e)).catch(()=>h(u()))},[_]),y=m===`unsupported`;return(0,f.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,f.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,f.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,f.jsx)(c,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:y,onCheckedChange:v})]}),y?null:(0,f.jsxs)(`p`,{"data-slot":`notifications-permission`,"data-permission":m,className:`mt-4 text-[13px] text-muted-foreground`,children:[`Browser permission · `,m===`granted`?`Allowed`:m===`denied`?`Blocked`:`Not requested`]}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Permission is requested only when you enable notifications.`}),y?(0,f.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!y&&n&&m===`denied`?(0,f.jsxs)(`div`,{"data-slot":`notifications-denied`,className:`mt-5 flex flex-col gap-2`,children:[(0,f.jsx)(`h3`,{className:`text-sm`,children:`Allow notifications in your browser`}),(0,f.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This browser is blocking notifications. Your preference is saved. Allow notifications in the browser’s site settings to receive them.`}),(0,f.jsx)(`p`,{className:`settings-readout`,children:`Notifications are blocked for this site.`})]}):null]})})}export{p as NotificationsSection};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{l as t,m as n}from"./live-reads-Crd6fVGH.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{t as i}from"./bot-TkDIw4y-.js";import{t as a}from"./external-link-BE6y205O.js";import{t as o}from"./folder-o-AvL3y3.js";import{n as s,t as c}from"./smartphone-Lr8Ug2z_.js";import{t as l}from"./square-terminal-B6RYYieR.js";import{t as u}from"./button-B7MKxYjT.js";import{i as d,l as f,p,r as m,t as h}from"./dropdown-menu-4e2iKSMT.js";import{t as g}from"./own-lookup-DS54wXvD.js";var _=r(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),v=r(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),y=r(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),b=r(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),x=r(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),S=r(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),C=r(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),w=r(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),T=r(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),E=r(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),D=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),O=r(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),k=r(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),A=r(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),j=r(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),M=e(),N={folder:o,terminal:l,vscode:y,cursor:E,zed:j,windsurf:A,sublime:S,idea:x,pycharm:T,webstorm:s,goland:O,rubymine:C,phpstorm:v,clion:b,rider:_,"android-studio":c,xcode:w,warp:D,bot:i,sparkles:k};function P(e,n){let r=F(e.id);return g(N,r===void 0?e.icon:t(n,r)?.icon)??a}function F(e){let t=e.startsWith(`cli:`)?e.slice(4):``;return t===``?void 0:t}function I({choices:e,onPick:t,label:r=`Open in…`,title:i,triggerVariant:o=`ghost`,disabled:s=!1,leading:c,trailing:l,slot:g,className:_}){let v=n().data;return(0,M.jsxs)(h,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsxs)(u,{variant:o,size:`sm`,title:i,disabled:s,"data-slot":g,className:_,children:[(0,M.jsx)(a,{"aria-hidden":`true`}),r]})}),(0,M.jsxs)(m,{align:`end`,children:[c,c&&e.length>0?(0,M.jsx)(f,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=P(e,v);return(0,M.jsxs)(d,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,M.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),l]})]})}export{F as n,P as r,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{t as n}from"./button-B7MKxYjT.js";var r=e();function i(e,t=3){return e<=0?`empty`:e<=t?`sparse`:`full`}function a({variant:e=`outline`,className:i,...a}){return(0,r.jsx)(n,{variant:e,"data-page-shell-action":``,className:t(`shrink-0`,i),...a})}function o({title:e,scope:n,subtitle:i,status:a,primaryAction:o,secondaryActions:s,headerSlot:c=`page-header`,scopeSlot:l=`page-header-scope`,subtitleSlot:u=`page-header-subtitle`,hideSubtitleOnMobile:d=!1,headerExtra:f,headerRef:p}){let m=!!(a||s||o);return(0,r.jsx)(`header`,{ref:p,"data-slot":`page-shell-header`,"data-header-slot":c,children:(0,r.jsxs)(`div`,{"data-slot":c,className:`flex min-w-0 flex-col`,children:[(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-row`,children:[(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-title-block`,children:[(0,r.jsxs)(`h1`,{"data-slot":`page-shell-header-title`,className:`min-w-0 break-words`,children:[e,n?(0,r.jsxs)(r.Fragment,{children:[` `,(0,r.jsxs)(`span`,{"data-slot":l,className:`font-normal text-muted-foreground`,children:[`· `,n]})]}):null]}),i?(0,r.jsx)(`p`,{"data-slot":u,className:t(`mt-1 text-[13px] text-muted-foreground`,d&&`max-md:hidden`),children:i}):null]}),m?(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-actions`,children:[a?(0,r.jsx)(`div`,{"data-slot":`page-header-status`,className:`flex shrink-0 items-center`,children:a}):null,s?(0,r.jsx)(`div`,{"data-slot":`page-header-secondary`,className:`flex flex-wrap items-center gap-2`,children:s}):null,o?(0,r.jsx)(`div`,{"data-slot":`page-header-primary`,className:`flex shrink-0 items-center`,children:o}):null]}):null]}),f]})})}function s({template:e,route:t,density:n,header:i,headerSpacing:a=`default`,fillHeight:s=!1,flushPadding:c=!1,beforeHeader:l,emptyState:u,sparseFooter:d,rootProps:f,rootRef:p,className:m,bodyClassName:h,children:g}){let _=n===`empty`&&u!==void 0;return(0,r.jsx)(`div`,{ref:p,"data-slot":`page-shell`,"data-route":t,"data-template":e,"data-density":n,"data-header-spacing":a,"data-fill-height":s?`true`:void 0,"data-flush-padding":c?`true`:void 0,className:m,...f,children:(0,r.jsxs)(`div`,{"data-slot":`page-shell-frame`,children:[l,i?(0,r.jsx)(o,{...i}):null,(0,r.jsx)(`div`,{"data-slot":`page-shell-body`,className:h,children:_?(0,r.jsx)(`div`,{"data-slot":`page-shell-empty`,children:u}):(0,r.jsxs)(r.Fragment,{children:[g,n===`sparse`&&d?d:null]})})]})})}function c(e){return(0,r.jsx)(s,{template:`Table`,...e})}function l(e){return(0,r.jsx)(s,{template:`Split`,...e})}function u(e){return(0,r.jsx)(s,{template:`Reading`,...e})}function d(e){return(0,r.jsx)(s,{template:`Form`,...e})}function f(e){return(0,r.jsx)(s,{template:`Board`,...e})}function p({icon:e,title:n,description:i,actions:a,slot:o=`page-shell-empty-state`,className:s}){return(0,r.jsxs)(`section`,{"data-slot":o,"data-page-shell-empty":``,"aria-label":n,className:t(`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-6`,s),children:[(0,r.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e?(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/50 text-muted-foreground [&_svg]:size-4`,children:e}):null,(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:n}),i?(0,r.jsx)(`div`,{className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:i}):null]})]}),a?(0,r.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:a}):null]})}function m({summary:e,actions:n,slot:i=`page-shell-sparse-footer`,className:a}){return(0,r.jsxs)(`aside`,{"data-slot":i,"data-page-shell-sparse":``,className:t(`min-w-0`,a),children:[(0,r.jsx)(`div`,{className:`min-w-0 text-muted-foreground`,children:e}),n?(0,r.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:n}):null]})}function h({list:e,detail:t,className:n}){return(0,r.jsx)(`div`,{"data-slot":`page-shell-split-host`,className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,r.jsxs)(`div`,{"data-slot":`page-shell-split-pane`,"data-has-detail":t?`true`:`false`,className:n,children:[(0,r.jsx)(`div`,{"data-slot":`page-shell-split-list`,className:`flex min-h-0 min-w-0 flex-col`,children:e}),t?(0,r.jsx)(`div`,{"data-slot":`page-shell-split-detail`,className:`flex min-h-0 min-w-0 flex-col`,children:t}):null]})})}export{d as a,u as c,i as d,f as i,l,m as n,s as o,h as r,a as s,p as t,c as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer properties,theme,base;@layer components{[data-slot=page-shell]{padding-block:28px 36px}}@layer utilities;[data-slot=page-shell]{--page-shell-gutter:16px;--page-shell-max-w:none;width:100%;min-width:0;min-height:100%;padding-inline:var(--page-shell-gutter);flex-direction:column;display:flex}[data-slot=page-shell][data-flush-padding=true]{padding-block:0;padding-inline:0}[data-slot=page-shell][data-flush-padding=true]>[data-slot=page-shell-frame]{max-width:none}[data-slot=page-shell][data-fill-height=true]{height:100%;min-height:0}[data-slot=page-shell][data-template=Table]{--page-shell-max-w:84rem}[data-slot=page-shell][data-template=Split]{--page-shell-max-w:none}[data-slot=page-shell][data-template=Reading]{--page-shell-max-w:var(--measure)}[data-slot=page-shell][data-template=Form]{--page-shell-max-w:68rem}[data-slot=page-shell][data-template=Board]{--page-shell-max-w:96rem}@media (width>=768px){[data-slot=page-shell]{--page-shell-gutter:36px}}[data-slot=page-shell-frame]{width:100%;min-width:0;max-width:var(--page-shell-max-w);flex-direction:column;flex:auto;margin-inline:0;display:flex}[data-slot=page-shell][data-fill-height=true]>[data-slot=page-shell-frame]{min-height:0}[data-slot=page-shell-header]{flex-direction:column;flex-shrink:0;margin-block-end:20px;display:flex}[data-slot=page-shell][data-header-spacing=compact] [data-slot=page-shell-header]{margin-block-end:10px}[data-slot=page-shell][data-header-spacing=none] [data-slot=page-shell-header]{margin-block-end:0}[data-slot=page-shell-header-row]{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:12px 16px;display:flex}[data-slot=page-shell-header-title-block]{flex:12rem;min-width:0}[data-slot=page-shell-header-title]{letter-spacing:-.02em;color:var(--foreground);font-size:26px;font-weight:600;line-height:1.2}@media (width>=768px){[data-slot=page-shell-header-title]{font-size:28px}}[data-slot=page-shell-header-actions]{flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;max-width:100%;display:flex}[data-slot=page-shell-header-actions] :is(button,a)[data-slot=button],[data-slot=page-shell-header-actions] :is(button,a)[data-page-shell-action]{border-radius:var(--radius-sm);height:36px;min-height:36px;padding-block:0;padding-inline:12px;font-size:13px;line-height:1}@media (width<48rem),(any-pointer:coarse){[data-slot=page-shell-header-actions] :is(button,a)[data-slot=button],[data-slot=page-shell-header-actions] :is(button,a)[data-page-shell-action],[data-page-shell-sparse] :is(button,a),[data-page-shell-empty] :is(button,a){min-width:44px;height:auto;min-height:44px;padding-block:8px}}[data-slot=page-shell-body]{flex-direction:column;flex:auto;min-width:0;display:flex}[data-slot=page-shell][data-fill-height=true] [data-slot=page-shell-body]{min-height:0}[data-slot=page-shell-sparse-footer]{border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--card);color:var(--muted-foreground);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:8px 16px;margin-block-start:16px;padding:12px 16px;font-size:12.5px;display:flex}[data-slot=page-shell-split-host]{container:page-shell-split/inline-size}[data-slot=page-shell-split-pane]{flex:auto;grid-template-columns:minmax(0,1fr);gap:20px;min-width:0;min-height:0;display:grid}[data-slot=page-shell-split-detail]{display:none}@container page-shell-split (width>=660px){[data-slot=page-shell-split-pane][data-has-detail=true]{grid-template-columns:minmax(280px,380px) minmax(0,1fr);align-items:stretch}[data-slot=page-shell-split-detail]{display:flex}}
|
package/web/dist/assets/{preview-pane-connected-WV9oolnn.js → preview-pane-connected-CBt_nlmX.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Jr as i,Yr as a,fr as o,qr as s}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Jr as i,Yr as a,fr as o,qr as s}from"./project-scope-context-Rv6S_BXt.js";import{n as c}from"./toaster-BXnLIU3z.js";import{t as l}from"./createLucideIcon-BHp8sXmF.js";import{t as u}from"./arrow-right-Dh_Lx3um.js";import{t as d}from"./check-OP-CVgZG.js";import{t as f}from"./chevron-down-CHGyCDBH.js";import{n as p,t as m}from"./circle-x-7nTlobAF.js";import{n as h,t as g}from"./smartphone-Lr8Ug2z_.js";import{t as _}from"./hourglass-CikYdGGQ.js";import{t as v}from"./info-DA1x_4bz.js";import{t as y}from"./loader-circle-CPBhhDbB.js";import{n as ee,t as te}from"./moon-CRE9nU5R.js";import{t as b}from"./play-CmVAj_fu.js";import{d as x,l as S,n as C,u as ne}from"./thread-state-C3eDWXYs.js";import{t as w}from"./square-terminal-B6RYYieR.js";import{t as T}from"./button-B7MKxYjT.js";import{a as E,c as re,i as D,l as O,p as k,r as A,s as ie,t as j}from"./dropdown-menu-4e2iKSMT.js";import{s as ae}from"./project-router-CLJTc7gv.js";import{t as M}from"./status-dot-BRzVlF2X.js";import{An as oe,Dn as se,On as ce,Xn as le,_ as ue,ar as de,c as fe,d as pe,f as N,g as me,kn as he,l as ge,nr as _e,p as ve,qn as ye,rr as P,u as be,v as xe}from"./index-CvVmG4Yu.js";var F=l(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Se=l(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),Ce=l(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),I=l(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),L=l(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),we=l(`folder-x`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),R=l(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),z=l(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Te=l(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ee=l(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),B=l(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),V=l(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),H=l(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),U=l(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),W=l(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),G=l(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),K=l(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),q=l(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),De=l(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),J=e(t(),1),Oe=1e3,ke=[500,1e3,2e3,4e3,8e3],Ae=1;function je(e,t){let n=`/api/v1/p/${encodeURIComponent(e.projectId)}/runs/${encodeURIComponent(e.runId)}/preview/ws`,r=()=>`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${n}`,a=null,c,l=!1,u=!1,d=0,f=0,p=()=>typeof document>`u`||s(),m=()=>{if(l||!p())return;let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(r());n.binaryType=`blob`,a=n,n.addEventListener(`open`,()=>{n===a&&(u=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==a)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=o.safeParse(e);n.success&&t.onMessage(n.data);return}r instanceof Blob&&(f=0,t.onFrame(r))}),n.addEventListener(`error`,()=>void 0),n.addEventListener(`close`,()=>{if(n!==a||l)return;if(a=null,!u){if(d+=1,d>=2){l=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,d),c=setTimeout(m,Oe);return}if(f>=5){l=!0,t.onTransport(`closed`);return}let e=ke[Math.min(f,ke.length-1)];f+=1,t.onTransport(`reconnecting`,f),c=setTimeout(m,e)})},h=i(e=>{if(!l)if(e)a||m();else{clearTimeout(c),c=void 0;let e=a;a=null,e?.close(),t.onTransport(`connecting`)}});return t.onTransport(`connecting`),m(),{send(e){a?.readyState===Ae&&a.send(JSON.stringify(e))},close(){l=!0,h(),clearTimeout(c),c=void 0;let e=a;a=null,e?.close()}}}var Y=n();function Me({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,Y.jsx)(he,{children:(0,Y.jsxs)(se,{children:[(0,Y.jsx)(oe,{asChild:!0,children:(0,Y.jsxs)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex h-7 min-w-7 shrink-0 items-center justify-center gap-0 rounded-full bg-muted px-0 text-xs font-semibold text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none @min-[640px]:gap-1.5 @min-[640px]:px-2.5`,n),children:[(0,Y.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[640px]:inline`,children:`Experimental`})]})}),(0,Y.jsx)(ce,{children:`Experimental`})]})}):e?(0,Y.jsx)(he,{children:(0,Y.jsxs)(se,{children:[(0,Y.jsx)(oe,{asChild:!0,children:(0,Y.jsx)(`span`,{role:`img`,"aria-label":`Experimental`,tabIndex:0,"data-slot":`preview-experimental`,className:r(`inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,Y.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(ce,{children:`Experimental`})]})}):(0,Y.jsxs)(`span`,{"data-slot":`preview-experimental`,className:r(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-muted px-2.5 text-xs font-semibold text-muted-foreground`,n),children:[(0,Y.jsx)(L,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function X({text:e,source:t,onCopy:n,className:i}){let a=e.replace(/\s+$/,``).split(`
|
|
2
2
|
`);return(0,Y.jsxs)(`div`,{"data-slot":`preview-log-tail`,className:r(`min-w-0 rounded-lg bg-muted px-3.5 py-3 font-mono text-xs`,i),children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3 font-sans text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Log tail`}),` last ${a.length} ${a.length===1?`line`:`lines`} · ${t}`]}),(0,Y.jsxs)(`button`,{type:`button`,className:`-m-2 inline-flex min-h-11 items-center gap-1.5 rounded-sm p-2 text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:min-h-0 md:p-0`,onClick:()=>n(e),children:[(0,Y.jsx)(P,{className:`size-3.5`,"aria-hidden":`true`}),`Copy`]})]}),(0,Y.jsx)(`pre`,{className:`max-h-48 overflow-auto break-words whitespace-pre-wrap text-foreground`,children:e.replace(/\s+$/,``)})]})}var Ne=/^([a-z][a-z0-9+.-]*):/i;function Pe(e,t){let n=e.trim();if(n===``)return{kind:`error`,message:`Type a URL or a port.`};if(/^\d{1,5}$/.test(n)){let e=Number(n);return e<1||e>65535?{kind:`error`,message:`A port is a number from 1 to 65535.`}:t.some(t=>t.port===e)?{kind:`server`,port:e}:{kind:`url`,url:`http://localhost:${e}`}}let r=Ne.exec(n)?.[1]?.toLowerCase();return r&&!/^[a-z0-9.-]+:\d/i.test(n)?r!==`http`&&r!==`https`?{kind:`error`,message:`Only http and https addresses open here.`}:Fe(n):Fe(`http://${n}`)}function Fe(e){let t={kind:`error`,message:`That is not a valid address.`};if(/\s/.test(e))return t;try{new URL(e)}catch{return t}return{kind:`url`,url:e}}function Ie(e){return e.replace(/^https?:\/\//i,``)}var Le=`https://github.com/hearsay-tools/squawk#environment-variables`;function Re({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,Y.jsx)(He,{state:e,actions:t});case`downloading`:return(0,Y.jsx)(We,{state:e,actions:t});case`download-failed`:return(0,Y.jsx)(Ge,{state:e,actions:t});case`sandbox-failed`:return(0,Y.jsx)(Ke,{state:e,actions:t});case`browser-exited`:return(0,Y.jsx)(qe,{state:e,actions:t});case`needs-approval`:return(0,Y.jsx)(Xe,{state:e,actions:t});case`port-held`:return(0,Y.jsx)(Ze,{state:e,actions:t});case`server-starting`:return(0,Y.jsx)(Qe,{state:e,actions:t});case`server-stalled`:return(0,Y.jsx)($e,{state:e,actions:t});case`server-exited`:return(0,Y.jsx)(et,{state:e,actions:t});case`server-stopped`:return(0,Y.jsx)(tt,{state:e,actions:t});case`loading`:return(0,Y.jsx)(rt,{step:e.step,url:n});case`worktree-removed`:return(0,Y.jsx)(it,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,Y.jsx)(at,{actions:t});case`taken-over`:return(0,Y.jsx)(st,{state:e,actions:t})}}function Z({icon:e,title:t,children:n,state:r}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":r,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:e}),(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:t}),n]})}var Q=({children:e})=>(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),$=({children:e})=>(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function ze({server:e}){return(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(w,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Runs ${N(e.command)} in this task's worktree, on the host.`})]})}function Be({copy:e,command:t,label:n}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-install-command`,className:`min-w-0 rounded-lg bg-muted px-3.5 py-3`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-3 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:[(0,Y.jsx)(`span`,{children:n}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,className:`-m-2 inline-flex size-11 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:m-0 md:size-6`,onClick:()=>e(t),children:(0,Y.jsx)(P,{className:`size-4`,"aria-hidden":`true`})})]}),(0,Y.jsx)(`code`,{className:`block font-mono text-sm break-words whitespace-pre-wrap text-foreground`,children:t})]})}function Ve({server:e,status:t}){return(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,Y.jsx)(M,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:t})]}),(0,Y.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,Y.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:e.command}),e.cwd?(0,Y.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,Y.jsx)(`span`,{children:`cwd`}),(0,Y.jsx)(`span`,{className:`break-all`,children:e.cwd})]}):null]}),(0,Y.jsx)(`div`,{className:`mt-2.5`,children:(0,Y.jsx)(ze,{server:e})})]})}function He({state:e,actions:t}){return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(I,{}),title:`This host has no browser yet`,children:[(0,Y.jsx)(Q,{children:e.canDownload?`Preview runs Chromium on the machine Squawk runs on. Squawk can download it into ~/.cache/cez/ (about 150 MB). Nothing else on the host changes.`:`Preview runs Chromium on the machine Squawk runs on. Squawk has no download for this platform, so install it with the system package manager.`}),e.canDownload?(0,Y.jsx)($,{children:(0,Y.jsxs)(T,{variant:`contrast`,onClick:t.download,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,Y.jsx)(Be,{command:e.installCommand,copy:t.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function Ue(e){return Math.round(e/1e6)}function We({state:e,actions:t}){let n=(0,J.useRef)(null);n.current??={at:Date.now(),received:e.received};let r=e.total>0?Math.min(100,Math.floor(e.received/e.total*100)):0,i=(Date.now()-n.current.at)/1e3,a=i>=1?(e.received-n.current.received)/i:0,o=a>0?Math.ceil((e.total-e.received)/a):void 0;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(I,{}),title:`Downloading Chromium`,children:[(0,Y.jsx)(Q,{children:`Into ~/.cache/cez/, no root needed. Nothing else on the host changes.`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`div`,{role:`progressbar`,"aria-label":`Chromium download`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-success`,style:{width:`${r}%`}})}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-mono`,children:`${Ue(e.received)} of ${Ue(e.total)} MB · ${r}%`}),o===void 0?null:(0,Y.jsx)(`span`,{children:`about ${o} s left`})]})]}),(0,Y.jsx)($,{children:(0,Y.jsx)(T,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function Ge({state:e,actions:t}){return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(K,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,Y.jsx)(Q,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,Y.jsx)(Be,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,Y.jsxs)($,{children:[(0,Y.jsxs)(T,{variant:`contrast`,onClick:t.download,children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Retry download`]}),(0,Y.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function Ke({state:e,actions:t}){return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(W,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,Y.jsx)(Q,{children:`The host blocks the sandbox Chromium needs. This usually means Squawk runs as root, or inside a container without user namespaces.`}),(0,Y.jsx)(X,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,Y.jsxs)($,{children:[(0,Y.jsxs)(T,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,Y.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Le,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function qe({state:e,actions:t}){let n=e.reason===`timeout`,r=e.signal?` (${e.signal})`:e.exitCode===void 0?``:` (code ${e.exitCode})`,i=e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`,a=n?`Chromium did not start in time`:`Chromium exited${r}`;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(m,{className:`text-danger`}),title:n?`The browser did not start`:`The browser stopped`,children:[(0,Y.jsx)(Q,{children:n?`Chromium did not open its DevTools port in time. ${i}`:`Chromium exited unexpectedly${r}. ${i}`}),(0,Y.jsx)(X,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,Y.jsxs)($,{children:[(0,Y.jsxs)(T,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(T,{variant:`outline`,onClick:()=>t.copy(`${a}\n${e.stderrTail}`),children:[(0,Y.jsx)(P,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Je=2;function Ye(e){let[t,n]=(0,J.useState)(()=>Date.now());return(0,J.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Xe({state:e,actions:t}){let{server:n,wasRunning:r}=e;return(0,Y.jsxs)(Z,{state:e.stage,icon:r?(0,Y.jsx)(q,{className:`text-pending-strong`}):(0,Y.jsx)(b,{}),title:r?`Nothing answers on :${n.port} anymore`:`${n.label} isn't running yet`,children:[(0,Y.jsx)(Q,{children:r?`${n.label} was running when the agent registered it, likely inside the agent's own session, which has ended. Squawk can start it with the registered command.`:`The agent registered this server. Nothing runs until you approve it here.`}),(0,Y.jsx)(Ve,{server:n,status:r?`was running when registered · silent now`:`registered · not started`}),(0,Y.jsx)($,{children:(0,Y.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(b,{"aria-hidden":`true`}),`Run and open`]})})]})}function Ze({state:e,actions:t}){let{server:n,ownerTitle:r}=e;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(K,{className:`text-pending-strong`}),title:`${n.label} :${n.port} is in use by another task`,children:[(0,Y.jsx)(Q,{children:`Task "${r}" is running its own server on :${n.port}. Register a different port for this task, or stop that task's server.`}),(0,Y.jsx)($,{children:(0,Y.jsx)(T,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function Qe({state:e,actions:t}){let{server:n}=e,r=Ye(1e3),i=Math.max(0,Math.floor((r-Date.parse(e.startedAt))/1e3)),[a,o]=(0,J.useState)(()=>Date.now());(0,J.useEffect)(()=>o(Date.now()),[e.attempt]);let s=Math.max(0,Math.ceil(Je-(r-a)/1e3));return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(b,{}),title:`Starting ${n.label}`,children:[(0,Y.jsx)(Q,{children:`Squawk ran ${N(n.command)} in the worktree. The page opens as soon as :${n.port} answers.`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border px-3.5 py-3 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2.5 font-semibold text-foreground`,children:[(0,Y.jsx)(y,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),s>0?`Attempt ${e.attempt} · next try in ${s} s`:`Attempt ${e.attempt}`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${i} s ago`})]}),e.logTail.length>0?(0,Y.jsx)(X,{text:e.logTail.join(`
|
|
3
3
|
`),source:N(n.command),onCopy:t.copy}):null,(0,Y.jsx)($,{children:(0,Y.jsx)(T,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})})]})}function $e({state:e,actions:t}){let{server:n}=e;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(_,{className:`text-pending-strong`}),title:`${n.label} is running, but :${n.port} is silent`,children:[(0,Y.jsx)(Q,{children:`The process has run for 2 min without opening the port. It may be waiting on another service, or listening somewhere else.`}),(0,Y.jsx)(X,{text:e.logTail,source:N(n.command),onCopy:t.copy}),(0,Y.jsxs)($,{children:[(0,Y.jsx)(T,{variant:`contrast`,onClick:()=>t.keepWaiting(n.port),children:`Keep waiting`}),(0,Y.jsx)(T,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})]})]})}function et({state:e,actions:t}){let{server:n}=e;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(m,{className:`text-danger`}),title:e.exitCode===null?`${n.label} was stopped by a signal`:`${n.label} exited with code ${e.exitCode}`,children:[(0,Y.jsx)(Q,{children:`${N(n.command)} stopped.`}),(0,Y.jsx)(X,{text:e.logTail,source:N(n.command),onCopy:t.copy}),(0,Y.jsx)($,{children:(0,Y.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(ze,{server:n})]})}function tt({state:e,actions:t}){let{server:n}=e,r=e.reason===`idle`;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(te,{}),title:r?`Stopped after 15 min idle`:`${n.label} stopped`,children:[(0,Y.jsx)(Q,{children:r?`Nobody had this pane open for 15 min, so Squawk stopped ${n.label} :${n.port} and the browser to free memory. Start again reopens ${Ie(e.lastUrl)}.`:`You stopped ${n.label} :${n.port}. Start again reopens ${Ie(e.lastUrl)}.`}),(0,Y.jsx)($,{children:(0,Y.jsxs)(T,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(x,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(ze,{server:n})]})}var nt=[`browser`,`page`,`frame`];function rt({step:e,url:t}){let n=nt.indexOf(e),i=t?Ie(t):`the page`;return(0,Y.jsx)(`div`,{"data-slot":`preview-state`,"data-state":`loading`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center px-6 py-8`,children:(0,Y.jsx)(`ol`,{"aria-label":`Opening the page`,className:`mx-auto flex flex-col gap-4 text-sm`,children:[{done:`Browser started`,active:`Starting the browser`},{done:`Opened ${i}`,active:`Opening ${i}`},{done:`First frame`,active:`First frame`}].map((e,t)=>{let i=t<n,a=t===n;return(0,Y.jsxs)(`li`,{"aria-current":a?`step`:void 0,className:r(`flex items-center gap-3`,a?`font-semibold text-foreground`:i?`text-foreground`:`text-soft-foreground`),children:[i?(0,Y.jsx)(p,{className:`size-5 text-success`,"aria-hidden":`true`}):a?(0,Y.jsx)(y,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,Y.jsx)(Ce,{className:`size-5 text-border`,"aria-hidden":`true`}),i?e.done:a?e.active:e.done]},t)})})})}function it({state:e,actions:t,worktree:n}){let r=n?/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+/.exec(n)?.[0]:void 0,i=e.server?.label;return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(we,{}),title:`This task's worktree is gone`,children:[(0,Y.jsx)(Q,{children:`${i??`The server`} ran in ${r??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,Y.jsx)(S,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,Y.jsx)($,{children:(0,Y.jsx)(T,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function at({actions:e}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":`proxy-blocked`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(Me,{})}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center rounded-lg bg-muted text-foreground [&_svg]:size-[18px]`,children:(0,Y.jsx)(V,{})}),(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Preview doesn't work behind this proxy yet`}),(0,Y.jsx)(Q,{children:`The proxy in front of Squawk didn't let the preview's WebSocket through. This is a known gap behind Basic Auth. Everything else in Squawk keeps working.`}),(0,Y.jsxs)($,{children:[(0,Y.jsx)(T,{variant:`outline`,onClick:e.close,children:`Close preview`}),(0,Y.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Le,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function ot(e){let t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?`Mac`:/Linux|X11/.test(e)?`Linux`:``,n=/Edg\//.test(e)?`Edge`:/Firefox\/|FxiOS/.test(e)?`Firefox`:/Chrome\/|CriOS/.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n&&t?`${n} on ${t}`:n||t}function st({state:e,actions:t}){let n=ot(e.by);return(0,Y.jsxs)(Z,{state:e.stage,icon:(0,Y.jsx)(B,{}),title:`Preview is open somewhere else`,children:[(0,Y.jsx)(Q,{children:`Another tab took this browser${n?` (${n})`:``}. Only one tab can view and drive it at a time.`}),(0,Y.jsxs)($,{children:[(0,Y.jsxs)(T,{variant:`contrast`,onClick:t.useHere,children:[(0,Y.jsx)(I,{"aria-hidden":`true`}),`Use it here`]}),(0,Y.jsx)(T,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function ct({attempt:e,exhausted:t,onReconnect:n}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-connection-banner`,role:`status`,className:`absolute inset-x-3 top-3 z-10 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-lg border border-border bg-card px-3.5 py-2.5 text-sm shadow-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Y.jsx)(De,{className:`size-4 shrink-0 text-danger`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Lost the connection to the host`}),t?null:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:` · reconnecting (attempt ${e} of 5)`})]})]}),(0,Y.jsx)(T,{variant:`outline`,onClick:n,children:t?`Reconnect`:`Reconnect now`})]})}function lt({servers:e,states:t,onOpen:n,agentLive:r=!1,agentIdle:i=!1,onOpenAgent:a}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":i?`agent-idle`:`empty`,className:`mx-auto flex h-full w-full max-w-[560px] flex-col justify-center gap-4 px-6 py-8`,children:[(0,Y.jsx)(`h2`,{className:`text-xl leading-tight font-semibold text-foreground`,children:`Open a page in this task's browser`}),(0,Y.jsx)(Q,{children:`The browser runs on the host, next to the worktree. Type a URL, a bare port such as 3000, or open a server the agent registered.`}),i?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-start gap-2 text-sm text-foreground`,children:[(0,Y.jsx)(q,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`The agent is not driving the browser now.`})]}):null,r&&a!==void 0?(0,Y.jsxs)(`section`,{"aria-labelledby":`preview-agent`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,Y.jsx)(`h3`,{id:`preview-agent`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Driven by the agent`}),(0,Y.jsxs)(`div`,{"data-slot":`preview-agent-entry`,className:`flex items-center justify-between gap-3 px-3.5 py-2 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,Y.jsx)(M,{tone:`success`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Agent's page`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`The agent drives this page through agent-browser.`})]}),(0,Y.jsx)(T,{variant:`outline`,size:`sm`,className:`max-md:h-11`,"aria-label":`Open the agent's page`,onClick:a,children:`Open`})]})]}):null,e.length>0?(0,Y.jsxs)(`section`,{"aria-labelledby":`preview-registered`,className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,Y.jsx)(`h3`,{id:`preview-registered`,className:`border-b border-border px-3.5 py-2.5 text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Registered in this task`}),(0,Y.jsx)(`ul`,{children:e.map(e=>{let r=be(e,t),i=ve(r);return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3 border-b border-border px-3.5 py-2 text-sm last:border-b-0`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5`,children:[(0,Y.jsx)(M,{tone:i.tone,shape:i.ring?`ring`:`filled`,pulse:i.pulse,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,e.port]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:i.text})]}),(0,Y.jsx)(T,{variant:`outline`,size:`sm`,className:`max-md:h-11`,onClick:()=>n(e.port),children:pe(r)?`Open`:`Review`})]},e.port)})})]}):null,(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(v,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Review opens a server's approval in this pane: its command, cwd and Run and open. Nothing runs from this list. Paste works; copying text out, file pickers and downloads don't yet.`})]})]})}function ut({dialog:e,onResult:t}){let[n,r]=(0,J.useState)(e.defaultPrompt??``),i=e.type===`beforeunload`,a=(0,J.useRef)(null),o=(0,J.useRef)(null);(0,J.useEffect)(()=>{(e.type===`prompt`?o.current:a.current)?.focus()},[e.type]);let s=(0,J.useRef)(t);s.current=t,(0,J.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target instanceof Element?e.target:null;t&&t!==document.body&&!t.closest(`[data-slot="preview-pane-body"], [data-slot="preview-page-dialog"]`)||(e.stopPropagation(),s.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let c=()=>t(e.type===`prompt`?{accept:!0,text:n}:{accept:!0});return(0,Y.jsx)(`div`,{"data-slot":`preview-page-dialog`,className:`absolute inset-0 z-20 flex items-center justify-center bg-foreground/30 p-4`,children:(0,Y.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":`${e.origin} says`,className:`w-full max-w-[380px] rounded-xl border border-border bg-card p-4 shadow-lg`,children:[(0,Y.jsx)(`p`,{className:`mb-3 truncate font-mono text-xs text-muted-foreground`,children:`${e.origin} says`}),(0,Y.jsx)(`p`,{className:`mb-4 text-sm break-words whitespace-pre-wrap text-foreground`,children:e.message||(i?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,Y.jsx)(`input`,{ref:o,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`mb-4 h-11 w-full rounded-md border border-border bg-background px-3 text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.type===`alert`?null:(0,Y.jsx)(T,{variant:`outline`,onClick:()=>t({accept:!1}),children:i?`Stay`:`Cancel`}),(0,Y.jsx)(T,{ref:a,variant:`contrast`,onClick:c,children:i?`Leave`:`OK`})]})]})})}var dt=10,ft=500,pt=500,mt=4,ht=16,gt=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function _t(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function vt(e,t){return{rect:e,scale:t,touches:new Map,multiTouch:!1,click:{at:-1/0,x:0,y:0,button:-1,count:1}}}var yt=[`left`,`middle`,`right`];function bt(e,t,n,r){let i=_t(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:yt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:gt(n),...r}}var xt=e=>e===0?0:-e;function St(e,t,n,r,i){let a=_t(t,n,e.rect,e.scale);return{t:`mouse`,type:`mouseWheel`,x:a.x,y:a.y,button:`none`,buttons:0,deltaX:xt(r/e.scale),deltaY:xt(i/e.scale),modifiers:0}}function Ct(e,t){let{touches:n}=t,r=n.get(e.pointerId),i=()=>{n.delete(e.pointerId),n.size===0&&(t.multiTouch=!1)};switch(e.type){case`pointerdown`:return n.set(e.pointerId,{startX:e.clientX,startY:e.clientY,startAt:e.timeStamp,lastX:e.clientX,lastY:e.clientY,scrolling:!1}),n.size>1&&(t.multiTouch=!0),[];case`pointermove`:{if(!r)return[];if(t.multiTouch)return r.lastX=e.clientX,r.lastY=e.clientY,[];if(!r.scrolling){if(Math.hypot(e.clientX-r.startX,e.clientY-r.startY)<=dt)return[];r.scrolling=!0}let n=e.clientX-r.lastX,i=e.clientY-r.lastY;return r.lastX=e.clientX,r.lastY=e.clientY,n===0&&i===0?[]:[St(t,e.clientX,e.clientY,n,i)]}case`pointerup`:{let n=r!==void 0&&!t.multiTouch&&!r.scrolling&&e.timeStamp-r.startAt<=ft;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[bt(`mouseMoved`,t,a,{button:`none`,buttons:0}),bt(`mousePressed`,t,a,{button:`left`,buttons:1}),bt(`mouseReleased`,t,a,{button:`left`,buttons:0})]}case`pointercancel`:return i(),[]}}function wt(e,t){if(e.pointerType===`touch`)return Ct(e,t);switch(e.type){case`pointerdown`:{let n=t.click,r=n.button===e.button&&e.timeStamp-n.at<=pt&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=mt;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[bt(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[bt(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[bt(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function Tt(e,t,n){let r=_t(e.clientX,e.clientY,t,n),i=e.deltaMode===1?ht:1;return{t:`mouse`,type:`mouseWheel`,x:r.x,y:r.y,button:`none`,buttons:e.buttons??0,deltaX:e.deltaX*i/n,deltaY:e.deltaY*i/n,modifiers:gt(e)}}var Et={a:`selectAll`,c:`copy`,x:`cut`,z:`undo`,y:`redo`};function Dt(e){let t=e.key.toLowerCase(),n=(e.ctrlKey||e.metaKey)&&!e.getModifierState?.(`AltGraph`);if(n&&(t===`v`||t===`k`))return;let r={t:`key`,key:e.key,code:e.code,modifiers:gt(e),vk:e.keyCode};if(e.type===`keyup`)return{...r,type:`keyUp`};let i=n?``:e.key.length===1?e.key:e.key===`Enter`?`\r`:e.key===`Tab`?` `:``,a=n?t===`z`&&e.shiftKey?`redo`:Et[t]:void 0,o={t:`key`,type:i?`keyDown`:`rawKeyDown`,key:e.key,code:e.code,text:i,modifiers:gt(e),vk:e.keyCode};return a?{...o,commands:[a]}:o}function Ot(e){return e?{t:`insertText`,text:e}:void 0}var kt=e=>e,At=e=>e.key===`Escape`&&e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function jt({scale:e,send:t,onLeave:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(vt({left:0,top:0},e)),a=(0,J.useRef)(e);a.current=e;let o=(0,J.useRef)(t);o.current=t;let s=(0,J.useRef)(void 0),c=()=>{let e=r.current;e&&(i.current.rect=e.getBoundingClientRect()),i.current.scale=a.current},l=e=>{c();for(let t of wt(kt(e),i.current))o.current(t)},u=()=>{let e=s.current;e&&(s.current=void 0,cancelAnimationFrame(e.frame),l(e.event))};(0,J.useEffect)(()=>()=>{s.current&&cancelAnimationFrame(s.current.frame)},[]),(0,J.useEffect)(()=>{document.activeElement===document.body&&r.current?.focus({preventScroll:!0})},[]),(0,J.useEffect)(()=>{let e=r.current;if(!e)return;let t=e=>{e.preventDefault(),c(),o.current(Tt(e,i.current.rect,i.current.scale))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]),(0,J.useEffect)(()=>{let e=e=>{if(document.activeElement!==r.current)return;let t=Ot(e.clipboardData?.getData(`text`)??``);t&&(e.preventDefault(),o.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[]);let d=e=>{u(),r.current?.focus({preventScroll:!0});try{r.current?.setPointerCapture(e.pointerId)}catch{}l(e.nativeEvent)},f=e=>{let t=e.nativeEvent;if(t.pointerType===`touch`)return l(t);let n=s.current;if(n){n.event=t;return}s.current={event:t,frame:requestAnimationFrame(()=>{let e=s.current;s.current=void 0,e&&l(e.event)})}},p=e=>{u(),l(e.nativeEvent)},m=e=>{if(At(e)){e.preventDefault(),e.stopPropagation(),e.type===`keydown`&&(n?n():r.current?.blur());return}let i=Dt(e.nativeEvent);i&&(e.preventDefault(),e.stopPropagation(),t(i))};return(0,Y.jsx)(`div`,{ref:r,"data-slot":`preview-input`,role:`application`,"aria-label":`Page preview, interactive`,"aria-description":`Keys go to the page, Tab included. Press Shift+Escape to return to the cockpit.`,tabIndex:0,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onContextMenu:e=>e.preventDefault(),onKeyDown:m,onKeyUp:m,className:`absolute inset-0 touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset`})}async function Mt(e){if(typeof createImageBitmap==`function`){let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,release:()=>t.close()}}let t=URL.createObjectURL(e),n=new Image;return n.src=t,await n.decode(),{source:n,width:n.naturalWidth,height:n.naturalHeight,release:()=>URL.revokeObjectURL(t)}}function Nt({ref:e,viewport:t,dimmed:n=!1,cursor:i,onSize:a,renderInput:o,children:c}){let l=(0,J.useRef)(0),u=(0,J.useRef)(null),d=(0,J.useRef)(null),[f,p]=(0,J.useState)(null),m=(0,J.useRef)(a);m.current=a,(0,J.useImperativeHandle)(e,()=>({async draw(e){let t=++l.current,n=d.current,r=n?.getContext(`2d`);if(!(!n||!r||!s()))try{let i=await Mt(e);try{if(t!==l.current||!s()||d.current!==n)return;n.width!==i.width&&(n.width=i.width),n.height!==i.height&&(n.height=i.height),r.drawImage(i.source,0,0)}finally{i.release()}}catch{}}}),[]),(0,J.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{let t=Math.round(e.clientWidth),n=Math.round(e.clientHeight);t===0||n===0||(p(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n}),m.current?.({w:t,h:n}))};if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=t===`fit`?f:t,g=t===`fit`||!f?1:Math.min(1,(f.w-24)/t.w,(f.h-24)/t.h),_=h?{width:Math.floor(h.w*g),height:Math.floor(h.h*g)}:void 0;return(0,Y.jsxs)(`div`,{ref:u,"data-slot":`preview-stage`,"data-viewport":t===`fit`?`fit`:`${t.w}x${t.h}`,className:r(`relative min-h-0 flex-1 overflow-hidden bg-muted`,t!==`fit`&&`flex items-start justify-center overflow-auto p-3`),children:[h?(0,Y.jsxs)(`div`,{"data-slot":`preview-surface`,"data-scale":g,style:{..._,cursor:i},className:r(`relative shrink-0 bg-card`,t!==`fit`&&`shadow-md`,n&&`opacity-60 saturate-50`),children:[(0,Y.jsx)(`canvas`,{ref:d,"aria-label":`Page preview`,role:`img`,style:_,className:`block touch-none select-none`}),o?.({canvas:d.current,scale:g,viewport:h})]}):null,c]})}var Pt=`cez-preview-quality`,Ft=[{value:`normal`,label:`Normal`,detail:`The default. Lighter on CPU and network.`},{value:`high`,label:`High`,detail:`Sharper text and fine detail. Uses more CPU and network.`},{value:`ultra`,label:`Ultra`,detail:`High at your screen's pixel density, up to 2×. Uses the most CPU and network.`}];function It(e){return Ft.find(t=>t.value===e)?.value??`normal`}var Lt=e=>Ft.find(t=>t.value===e)?.label??`Normal`;function Rt(){try{return It(localStorage.getItem(Pt))}catch{return`normal`}}function zt(e){try{localStorage.setItem(Pt,e)}catch{}}var Bt=[{w:390,h:844,icon:g},{w:820,h:1180,icon:G},{w:1440,h:900,icon:ee}],Vt=`size-8 shrink-0 max-md:size-11`,Ht=e=>e===`fit`?`Fit`:`${e.w} × ${e.h}`;function Ut(e){let[t,n]=(0,J.useState)(()=>Date.now());return(0,J.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Wt=e=>`${e.fps} fps · ${e.kbps} KB/s${e.rttMs===void 0?``:` · ${e.rttMs} ms`}`;function Gt({stats:e,shrunk:t}){let n=Ut(250),r=e.lastFrameAt===void 0||n-e.lastFrameAt>=1e3;return t?(0,Y.jsx)(M,{"data-slot":`preview-stats`,tone:r?`neutral`:`success`,"aria-label":`Preview is live`,role:`img`}):(0,Y.jsxs)(`span`,{"data-slot":`preview-stats`,role:`img`,"aria-label":r?`idle`:Wt(e),className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,Y.jsx)(M,{tone:r?`neutral`:`success`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[640px]:inline-block w-[28ch] overflow-hidden text-ellipsis`,children:r?`idle`:Wt(e)})]})}function Kt({current:e,agentShown:t,...n}){let r=e?e.label:t?`Agent's page`:`Server`;return(0,Y.jsxs)(T,{variant:`outline`,size:`sm`,className:`max-w-[11rem] min-w-0 gap-1.5 max-md:h-11`,"aria-label":e?`Server: ${e.label} :${e.port}`:t?`Server: ${r}`:`Server`,...n,children:[e||t?(0,Y.jsx)(M,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,Y.jsx)(ne,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r}),e?(0,Y.jsxs)(`span`,{className:`font-mono font-normal text-muted-foreground`,children:[`:`,e.port]}):null,(0,Y.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}function qt({shown:e,live:t,onSelect:n}){return(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":e||void 0,onSelect:n,children:[(0,Y.jsx)(M,{tone:t?`success`:`neutral`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Agent's page`}),(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`agent-browser`}),e?(0,Y.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]})}function Jt(e,t){return e?`${e.label} :${e.port}`:t?`Agent's page`:`Preview`}function Yt(e){let t=e.onPickAgent!==void 0,n=e.agentLive===!0&&t,r=e.agentShown===!0;return{agentLive:n,agentShown:r,agentListed:n||r&&t}}function Xt(e){let{compact:t=!1,navEnabled:n,loading:r=!1}=e,i=(0,J.useRef)(null),a=e.urlInputRef??i,o=(0,J.useRef)(!1),[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(!1),f=(0,Y.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Back`,disabled:!n,onClick:e.onBack,children:(0,Y.jsx)(F,{"aria-hidden":`true`})}),p=(0,Y.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Forward`,disabled:!n,onClick:e.onForward,children:(0,Y.jsx)(u,{"aria-hidden":`true`})}),m=(0,Y.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Reload`,"aria-busy":r||void 0,disabled:!n||r,onClick:()=>e.onReload(!1),children:(0,Y.jsx)(U,{"aria-hidden":`true`})}),h=e.onSession?(0,Y.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1 max-md:h-11`,onClick:e.onSession,children:[(0,Y.jsx)(de,{"aria-hidden":`true`}),`Session`]}):null,g=r?(0,Y.jsx)(`div`,{role:`progressbar`,"aria-label":`Loading the page`,className:`absolute inset-x-0 bottom-0 h-0.5 overflow-hidden bg-transparent`,children:(0,Y.jsx)(`div`,{className:`preview-progress h-full w-2/5 bg-success`})}):null,_=(0,Y.jsx)(Qt,{props:e,input:a,draft:s,setDraft:c,focused:l,setFocused:d}),{agentListed:v}=Yt(e),y=e.servers.length+ +!!v>=2,ee=y||e.adopted,te={back:f,forward:p,reload:m,address:_,more:(0,Y.jsx)(rn,{props:e,compact:t,crowded:ee}),session:h,progress:g};return t?(0,Y.jsx)(an,{props:e,elements:te}):(0,Y.jsx)(on,{props:e,elements:te,switcher:y,crowded:ee,input:a,focusUrlAfterMenu:o})}function Zt({props:e,input:t,focusUrlAfterMenu:n}){let{servers:r,current:i}=e,{agentLive:a,agentShown:o,agentListed:s}=Yt(e);return(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsx)(Kt,{current:i,agentShown:o})}),(0,Y.jsxs)(A,{align:`start`,className:`min-w-64`,onCloseAutoFocus:e=>{n.current&&(n.current=!1,e.preventDefault(),t.current?.focus())},children:[s?(0,Y.jsx)(qt,{shown:o,live:a,onSelect:()=>e.onPickAgent?.()}):null,r.map(t=>{let n=ve(be(t,e.serverStates));return(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":i?.port===t.port||void 0,onSelect:()=>e.onPickServer(t.port),children:[(0,Y.jsx)(M,{tone:n.tone,shape:n.ring?`ring`:`filled`,pulse:n.pulse,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-semibold`,children:t.label}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,t.port]}),(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:n.text}),i?.port===t.port?(0,Y.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,Y.jsx)(O,{}),(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{n.current=!0},children:[(0,Y.jsx)(h,{"aria-hidden":`true`}),`Type a URL instead`]})]})]})}function Qt({props:e,input:t,draft:n,setDraft:i,focused:a,setFocused:o}){let{url:s,adopted:c}=e;return(0,Y.jsxs)(`div`,{className:`relative flex min-w-[9rem] flex-1 items-center`,children:[(0,Y.jsx)(h,{className:`pointer-events-none absolute left-2.5 size-4 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{ref:t,type:`text`,"aria-label":`Page address`,placeholder:`Type a URL or a port`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:n??(a?s:Ie(s)),title:s||void 0,className:r(`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-muted pl-8 font-mono text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:bg-background focus-visible:ring-[3px] focus-visible:ring-ring/30 max-md:h-11`,c?`pr-40`:`pr-2.5`),onFocus:e=>{let t=e.currentTarget;o(!0),requestAnimationFrame(()=>{document.activeElement===t&&t.select()})},onBlur:()=>{o(!1),i(null)},onChange:e=>i(e.target.value),onKeyDown:t=>{t.key===`Enter`?(e.onNavigate(n??s),t.currentTarget.blur()):t.key===`Escape`&&t.currentTarget.blur()}}),c&&!a?(0,Y.jsxs)(`span`,{className:`pointer-events-none absolute right-2 inline-flex h-6 items-center gap-1 rounded-full border border-border bg-card px-2 text-xs font-semibold text-muted-foreground`,children:[(0,Y.jsx)(z,{className:`size-3`,"aria-hidden":`true`}),`Not started by Squawk`]}):null]})}function $t({props:e}){let{viewport:t}=e;return(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${Ht(t)}`,children:[t===`fit`?(0,Y.jsx)(Ee,{"aria-hidden":`true`}):(0,Y.jsx)(ee,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:r(`hidden @min-[500px]:inline`,t!==`fit`&&`font-mono font-normal`),children:Ht(t)}),(0,Y.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(A,{align:`start`,className:`min-w-56`,children:[(0,Y.jsxs)(D,{className:`gap-2.5`,"aria-current":t===`fit`||void 0,onSelect:()=>e.onViewport(`fit`),children:[(0,Y.jsx)(Ee,{"aria-hidden":`true`}),`Fit`,(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),t===`fit`?(0,Y.jsx)(d,{className:`size-4`,"aria-hidden":`true`}):null]}),Bt.map(({w:n,h:r,icon:i})=>(0,Y.jsxs)(D,{className:`gap-2.5 font-mono`,"aria-current":t!==`fit`&&t.w===n&&t.h===r||void 0,onSelect:()=>e.onViewport({w:n,h:r}),children:[(0,Y.jsx)(i,{"aria-hidden":`true`}),n,` × `,r,t!==`fit`&&t.w===n&&t.h===r?(0,Y.jsx)(d,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${n}x${r}`))]})]})}function en({quality:e,onQuality:t,compact:n}){return(0,Y.jsx)(ie,{value:e,onValueChange:e=>t(It(e)),children:Ft.map(e=>(0,Y.jsx)(re,{value:e.value,"data-quality":e.value,className:r(`items-start`,n&&`min-h-11`),children:(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:e.detail})]})},e.value))})}function tn({props:e}){let{quality:t}=e;return(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsxs)(T,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Stream quality: ${Lt(t)}`,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[560px]:inline`,children:Lt(t)}),(0,Y.jsx)(f,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(A,{align:`start`,className:`w-64`,children:[(0,Y.jsx)(E,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,Y.jsx)(en,{quality:t,onQuality:e.onQuality,compact:!1})]})]})}function nn({stats:e,status:t,crowded:n}){return e?(0,Y.jsx)(Gt,{stats:e,shrunk:n}):t?(0,Y.jsxs)(`span`,{"data-slot":`preview-status`,className:`flex shrink-0 items-center gap-1.5 font-mono text-xs whitespace-nowrap text-muted-foreground`,children:[(0,Y.jsx)(M,{tone:t.tone,"aria-hidden":`true`}),t.label]}):null}function rn({props:e,compact:t,crowded:n}){let{stats:r,navEnabled:i,url:a,current:o,adopted:s}=e;return(0,Y.jsxs)(j,{children:[(0,Y.jsx)(k,{asChild:!0,children:(0,Y.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`More`,children:(0,Y.jsx)(_e,{"aria-hidden":`true`})})}),(0,Y.jsxs)(A,{align:`end`,className:`min-w-64`,children:[n&&r&&!t?(0,Y.jsx)(E,{className:`font-mono text-xs font-normal text-muted-foreground`,children:Wt(r)}):null,(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!i,onSelect:()=>e.onReload(!0),children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Reload without cache`]}),(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:a===``,onSelect:e.onCopyUrl,children:[(0,Y.jsx)(le,{"aria-hidden":`true`}),`Copy page URL`]}),o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{}),s?(0,Y.jsxs)(D,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,Y.jsx)(Te,{className:`mt-0.5 text-muted-foreground`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Stop server · ${o.label} :${o.port}`}),(0,Y.jsx)(`span`,{className:`text-xs whitespace-normal text-muted-foreground`,children:`Squawk didn't start this server, so it won't stop it. Stop it where it was started.`})]})]}):(0,Y.jsxs)(D,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(o.port),children:[(0,Y.jsx)(Se,{"aria-hidden":`true`}),`Stop server · ${o.label} :${o.port}`]})]}):null,t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{}),(0,Y.jsx)(E,{className:`text-xs font-normal text-muted-foreground`,children:`Stream quality`}),(0,Y.jsx)(en,{quality:e.quality,onQuality:e.onQuality,compact:!0}),(0,Y.jsx)(O,{}),(0,Y.jsxs)(D,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),`Close preview`]})]}):null]})]})}function an({props:e,elements:t}){let{stats:n,current:r,badge:i=!0}=e,{agentShown:a}=Yt(e),{back:o,forward:s,reload:c,address:l,more:u,session:d,progress:f}=t;return(0,Y.jsxs)(`div`,{"data-slot":`preview-toolbar`,"data-compact":``,className:`relative flex shrink-0 flex-col border-b border-border bg-background`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pt-[max(0.25rem,env(safe-area-inset-top))]`,children:[d,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center leading-tight`,children:[(0,Y.jsxs)(`span`,{className:`flex max-w-full items-center gap-1.5 text-sm font-semibold text-foreground`,children:[n?(0,Y.jsx)(M,{tone:`success`,"aria-hidden":`true`}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:Jt(r,a)})]}),i?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Experimental`}):null]}),u]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1`,children:[o,s,c,l]}),f]})}function on({props:e,elements:t,switcher:n,crowded:r,input:i,focusUrlAfterMenu:a}){let{badge:o=!0,stats:s,status:c}=e,{back:l,forward:u,reload:d,address:f,more:p,session:m,progress:h}=t;return(0,Y.jsxs)(`div`,{"data-slot":`preview-toolbar`,className:`@container relative flex shrink-0 items-center gap-1.5 border-b border-border bg-background px-2.5 py-2`,children:[m,l,u,d,n?(0,Y.jsx)(Zt,{props:e,input:i,focusUrlAfterMenu:a}):null,f,(0,Y.jsx)($t,{props:e}),(0,Y.jsx)(tn,{props:e}),(0,Y.jsx)(nn,{stats:s,status:c,crowded:r}),o?(0,Y.jsx)(Me,{iconOnly:r,responsive:!r}):null,(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px shrink-0 bg-border`}),p,(0,Y.jsx)(T,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Close preview`,onClick:e.onClose,children:(0,Y.jsx)(ye,{"aria-hidden":`true`})}),h]})}function sn({transport:e,takenOver:t,empty:n,stage:r,hasFrame:i,lost:a,url:o,worktree:s}){let c=a||e!==`blocked`&&t!==void 0;return e===`blocked`?{content:{kind:`state`,state:{stage:`proxy-blocked`}},dim:c}:t===void 0?n||r?.stage===`agent-idle`?{content:{kind:`empty`,agentIdle:!n&&r?.stage===`agent-idle`},dim:c}:r?.stage===`streaming`||r?.stage===`loading`&&i?{content:{kind:`none`},dim:c}:r?{content:{kind:`state`,state:r,url:o,worktree:s},dim:c}:a?{content:{kind:`none`},dim:c}:{content:{kind:`state`,state:{t:`state`,stage:`loading`,step:`browser`},url:o},dim:c}:{content:{kind:`state`,state:{stage:`taken-over`,by:t}},dim:c}}function cn(e,{servers:t,serverStates:n,agentLive:r,openServer:i,openAgent:a,actions:o}){switch(e.kind){case`none`:return null;case`state`:{let{kind:t,...n}=e;return(0,Y.jsx)(Re,{...n,actions:o})}case`empty`:return(0,Y.jsx)(lt,{servers:t,states:n,onOpen:e=>i(e),agentLive:r===!0,agentIdle:e.agentIdle,onOpenAgent:a})}}function ln(){let e=typeof window>`u`?void 0:window.devicePixelRatio;return typeof e==`number`&&e>0?e:1}function un(){let[e,t]=(0,J.useState)(ln);return(0,J.useEffect)(()=>{let n=window.matchMedia?.(`(resolution: ${e}dppx)`);if(!n)return;let r=()=>t(ln());return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e]),e}var dn=2e3,fn=500,pn=1e3;function mn(e,t){switch(e.stage){case`needs-approval`:case`port-held`:case`server-starting`:case`server-stalled`:case`server-exited`:case`server-stopped`:return e.server.port===t;case`loading`:case`streaming`:return!0;default:return!1}}function hn(e){navigator.clipboard?.writeText(e).then(()=>c(`Copied`),()=>c(`Couldn't copy to the clipboard`,{tone:`danger`}))}var gn=e=>`http://localhost:${e.port}${e.path&&e.path!==`/`?e.path:``}`;function _n(e,t){return e?.port===void 0?e?.agent===!0||e?.url!==void 0:e.restored!==!0||t.some(t=>t.port===e.port)}function vn(e){return`port`in e?{port:e.port}:`agent`in e?{agent:!0}:{url:e.url}}function yn({run:e,servers:t,request:n,onTarget:r,onLive:i,onClose:o}){let l=un(),u=(0,J.useRef)(l);u.current=l;let d=a(),f=(0,J.useRef)(crypto.randomUUID()),p=(0,J.useRef)(!1),m=ae(),h=ue(me,!1),[g,_]=(0,J.useState)(0),[v,y]=(0,J.useState)({state:`connecting`,attempt:0}),[ee,te]=(0,J.useState)(!1),[b,x]=(0,J.useState)(void 0),[S,C]=(0,J.useState)(void 0),[ne,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(void 0),[re,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(void 0),[A,ie]=(0,J.useState)(!1),[j,M]=(0,J.useState)(!1),[oe,se]=(0,J.useState)(void 0),[ce,le]=(0,J.useState)(void 0),[de,fe]=(0,J.useState)(void 0),[pe,N]=(0,J.useState)(`fit`),[he,ge]=(0,J.useState)(Rt),[_e,ve]=(0,J.useState)(null),[ye,P]=(0,J.useState)(void 0),[be,xe]=(0,J.useState)(0),F=(0,J.useRef)(void 0),Se=(0,J.useRef)(null),Ce=(0,J.useRef)(null),I=(0,J.useRef)(void 0),L=(0,J.useRef)(void 0),we=(0,J.useRef)(he);we.current=he;let R=(0,J.useRef)({port:T,stage:S,agent:re});R.current={port:T,stage:S,agent:re};let z=(0,J.useRef)([]),Te=(0,J.useRef)(void 0),Ee=(0,J.useRef)(!1),B=(0,J.useRef)(!1),V=(0,J.useCallback)(e=>{B.current&&F.current?.send(e)},[]),H=(0,J.useRef)([]),U=(0,J.useCallback)(e=>{B.current?F.current?.send(e):H.current.push(e)},[]);(0,J.useEffect)(()=>{let t;return t=je({projectId:m??`default`,runId:e.id},{onFrame(e){if(!s())return;let n=Date.now();z.current.push({at:n,bytes:e.size}),Ee.current||(Ee.current=!0,M(!0)),(Se.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(C(e),(e.stage===`streaming`||e.stage===`loading`)&&xe(e=>e+1),L.current!==void 0&&mn(e,L.current)){let n=L.current;L.current=void 0,(e.stage===`needs-approval`||e.stage===`server-exited`||e.stage===`server-stopped`)&&t?.send({t:`run`,port:n})}return;case`url`:return w(e.url);case`cursor`:return se(e.cursor);case`dialog`:return le(e);case`pong`:Te.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:C(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:x(e.by),B.current=!1,H.current=[],t?.close();return}},onTransport(e,n){if(B.current=e===`open`,y({state:e,attempt:n??0}),(e===`blocked`||e===`closed`)&&(H.current=[]),e===`open`){te(!0),I.current&&(t?.send({t:`open`,target:I.current,viewerId:f.current,resume:p.current,quality:we.current,dpr:u.current}),p.current=!0);for(let e of H.current.splice(0))t?.send(e)}}}),F.current=t,()=>{B.current=!1,H.current=[],t?.close(),F.current===t&&(F.current=void 0)}},[m,e.id,g]);let W=d&&v.state===`open`&&b===void 0,G=h||pe===`fit`?_e:pe;(0,J.useEffect)(()=>{G&&W&&(S?.stage===`streaming`||S?.stage===`loading`)&&V({t:`resize`,w:G.w,h:G.h,...l===1?{}:{dpr:l}})},[G?.w,G?.h,l,W,S?.stage,be,V]),(0,J.useEffect)(()=>{if(!W)return;let e=setInterval(()=>V({t:`ping`,ts:Date.now()}),dn);return()=>clearInterval(e)},[W,V]);let K=W&&S?.stage===`streaming`;(0,J.useEffect)(()=>{if(!K){fe(void 0);return}let e=setInterval(()=>{let e=Date.now();z.current=z.current.filter(t=>e-t.at<=pn);let t={fps:z.current.length,kbps:Math.round(z.current.reduce((e,t)=>e+t.bytes,0)/1024),...Te.current===void 0?{}:{rttMs:Te.current},...z.current.length>0?{lastFrameAt:z.current.at(-1).at}:{}};fe(e=>{let n=t.lastFrameAt??e?.lastFrameAt,r={...t,...n===void 0?{}:{lastFrameAt:n}};return e&&e.fps===r.fps&&e.kbps===r.kbps&&e.rttMs===r.rttMs&&e.lastFrameAt===r.lastFrameAt?e:r})},fn);return()=>clearInterval(e)},[K]),(0,J.useEffect)(()=>(i?.(K),()=>i?.(!1)),[K,i]),(0,J.useEffect)(()=>{O&&r?.(O)},[O,r]);let q=(0,J.useCallback)((e,t,n=!1)=>{I.current=e,L.current=n&&`port`in e?e.port:void 0,ie(!0),C(void 0),x(void 0),P(void 0),w(t),E(`port`in e?e.port:void 0),D(`agent`in e),k(vn(e)),V({t:`open`,target:e,viewerId:f.current,quality:we.current,dpr:u.current}),p.current=B.current},[V]),De=(0,J.useCallback)((e,n=!1)=>{let r=t.find(t=>t.port===e);q({port:e},r?gn(r):`http://localhost:${e}`,n)},[t,q]),Oe=(0,J.useCallback)(()=>q({agent:!0},``),[q]);(0,J.useEffect)(()=>{if(n?.agent){if(R.current.agent&&R.current.stage?.stage===`streaming`)return;Oe();return}if(n?.url!==void 0){let e=Pe(n.url,t);e.kind===`server`?De(e.port):e.kind===`url`&&q({url:e.url},e.url);return}n?.port!==void 0&&(n.restored&&!t.some(e=>e.port===n.port)||R.current.port===n.port&&R.current.stage?.stage===`streaming`&&n.run!==!0||De(n.port,n.run===!0))},[n]);let ke=!A&&!b&&v.state!==`blocked`,Ae=_n(n,t);(0,J.useEffect)(()=>{ke&&!Ae&&Ce.current?.focus()},[ke,Ae]);let Y=e=>{let n=Pe(e,t);if(n.kind===`error`)return P(n.message);if(n.kind===`server`)return De(n.port);if(R.current.stage?.stage===`streaming`&&!R.current.agent)return I.current={url:n.url},L.current=void 0,E(void 0),k({url:n.url}),P(void 0),w(n.url),V({t:`nav`,url:n.url});q({url:n.url},n.url)},Me=(0,J.useCallback)(e=>{we.current=e,ge(e),zt(e),V({t:`quality`,quality:e})},[V]),X=()=>{p.current=!1,x(void 0),y({state:`connecting`,attempt:0}),Ee.current=!1,_(e=>e+1)};return{compact:h,transport:v,everOpened:ee,takenOver:b,stage:S,url:ne,port:T,agent:re,hasFrame:j,cursor:oe,dialog:ce,setDialog:le,stats:de,viewport:pe,setViewport:N,quality:he,chooseQuality:Me,setStageSize:ve,addressError:ye,stageHandle:Se,urlInput:Ce,send:V,connected:W,streaming:K,openServer:De,openAgent:Oe,empty:ke,navigate:Y,reconnect:X,actions:(0,J.useMemo)(()=>({download:()=>U({t:`download`}),cancelDownload:()=>U({t:`cancelDownload`}),retryBrowser:()=>U({t:`retryBrowser`}),run:e=>{B.current?V({t:`run`,port:e}):c(`The preview is reconnecting. Run the server again once it is back.`,{tone:`danger`})},stop:e=>U({t:`stop`,port:e}),keepWaiting:e=>U({t:`keepWaiting`,port:e}),close:o,useHere:X,copy:hn}),[V,U,o])}}function bn(e){return(0,Y.jsx)(xe,{onClose:e.onClose,children:(0,Y.jsx)(Cn,{...e})})}function xn(e,t,n,r){return e.state===`blocked`?{tone:`neutral`,label:`not supported`}:n?{tone:`neutral`,label:`paused`}:t&&(e.state===`reconnecting`||e.state===`closed`)?{tone:`danger`,label:`offline`}:e.state===`open`?r?Sn(r):void 0:{tone:`neutral`,label:`connecting…`}}function Sn(e){switch(e.stage){case`downloading`:return{tone:`pending`,label:`downloading`};case`download-failed`:return{tone:`danger`,label:`download failed`};case`sandbox-failed`:return{tone:`danger`,label:`browser failed`};case`browser-exited`:return{tone:`danger`,label:e.reason===`timeout`?`browser timed out`:`browser exited`};case`needs-approval`:return{tone:`neutral`,label:`not started`};case`port-held`:return{tone:`danger`,label:`port in use`};case`server-starting`:return{tone:`pending`,label:`waiting for :${e.server.port}`};case`server-stalled`:return{tone:`pending`,label:`waiting · 2 min`};case`server-exited`:return{tone:`danger`,label:`server exited`};case`server-stopped`:return{tone:`neutral`,label:`stopped`};case`agent-idle`:return{tone:`neutral`,label:`agent idle`};case`loading`:return{tone:`neutral`,label:`connecting…`};default:return}}function Cn(e){let{run:t,servers:n,serverStates:r,agentLive:i,onSession:a,onClose:o}=e,s=yn(e),{compact:c,transport:l,everOpened:u,takenOver:d,stage:f,url:p,port:m,agent:h,hasFrame:g,stats:_,viewport:v,setViewport:y,quality:ee,chooseQuality:te,addressError:b,urlInput:x,send:S,streaming:C,openServer:ne,openAgent:w,empty:T,navigate:E,actions:re}=s,D=n.find(e=>e.port===m),O=f?.stage===`streaming`&&f.adopted,k=u&&(l.state===`reconnecting`||l.state===`closed`),{content:A,dim:ie}=sn({transport:l.state,takenOver:d,empty:T,stage:f,hasFrame:g,lost:k,url:p,worktree:t.worktreePath}),j=cn(A,{servers:n,serverStates:r,agentLive:i,openServer:ne,openAgent:w,actions:re});return(0,Y.jsxs)(`section`,{"data-slot":`preview-pane-body`,"aria-label":`Live preview`,className:`flex h-full min-h-0 flex-col bg-background text-foreground`,children:[(0,Y.jsx)(Xt,{url:p,servers:n,serverStates:r,badge:l.state!==`blocked`,current:D,agentLive:i===!0,agentShown:h,adopted:O,viewport:c?`fit`:v,quality:ee,compact:c,navEnabled:C,loading:f?.stage===`loading`,stats:C?_??{fps:0,kbps:0}:void 0,status:C?void 0:xn(l,u,d!==void 0,f),urlInputRef:x,onSession:a,onNavigate:E,onBack:()=>S({t:`back`}),onForward:()=>S({t:`forward`}),onReload:e=>S({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>ne(e),onPickAgent:w,onViewport:y,onQuality:te,onCopyUrl:()=>hn(p),onStop:re.stop,onClose:o}),b?(0,Y.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:b}):null,(0,Y.jsx)(wn,{transportState:s,overlay:j,dim:ie,lost:k})]})}function wn({transportState:e,overlay:t,dim:n,lost:r}){let{connected:i,dialog:a,hasFrame:o,stage:s,stageHandle:c,compact:l,viewport:u,cursor:d,setStageSize:f,send:p,urlInput:m,transport:h,reconnect:g,setDialog:_}=e,v=s?.stage,y=i&&t===null&&!a;return(0,Y.jsxs)(Nt,{ref:c,viewport:l?`fit`:u,dimmed:n&&o&&(v===`streaming`||v===`loading`||n),cursor:d,onSize:f,renderInput:e=>y?(0,Y.jsx)(jt,{scale:e.scale,send:p,onLeave:()=>m.current?.focus()}):null,children:[r?(0,Y.jsx)(ct,{attempt:h.attempt,exhausted:h.state===`closed`,onReconnect:g}):null,t?(0,Y.jsx)(`div`,{"data-slot":`preview-overlay`,className:n&&o?`absolute inset-0 overflow-auto bg-background/85`:`absolute inset-0 overflow-auto bg-background`,children:t}):null,a?(0,Y.jsx)(ut,{dialog:a,onResult:e=>{_(void 0),p({t:`dialogResult`,...e})}}):null]})}function Tn(e){let{visibleEvents:t}=ge(e);return(0,J.useMemo)(()=>{let e=new Map;for(let n of C(t,{activeTurn:!1}).turns)for(let t of n.items)t.kind===`preview-server`&&e.set(t.server.port,t);return e},[t])}function En(e){let t=Tn(e.run.id),n=fe(e.run.id);return(0,Y.jsx)(bn,{...e,serverStates:t,agentLive:n})}export{En as ConnectedPreviewPane};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{Mt as t}from"./project-scope-context-Rv6S_BXt.js";import{n}from"./toaster-BXnLIU3z.js";import{Qt as r,W as i,xt as a}from"./queries-qCF-eOqZ.js";import{v as o}from"./design-icons-CzEoMH9c.js";import{n as s,t as c}from"./open-in-menu-BPp88ouw.js";import{s as l}from"./project-router-CLJTc7gv.js";import{n as u}from"./settings-field-DP9sYv5a.js";var d=e();function f(){let e=l(),t=a().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function p(e){navigator.clipboard.writeText(e).then(()=>n(`Project folder copied`)).catch(()=>n(e))}function m(){let e=f();return e===null?null:(0,d.jsx)(u,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,d.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-col gap-3`,children:[(0,d.jsx)(`span`,{"data-slot":`project-location-path`,className:`w-full min-w-0 rounded-md border border-border bg-background p-3 text-[13px] break-all text-foreground`,children:e}),(0,d.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-4`,children:[(0,d.jsxs)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>p(e),className:`inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-card px-3 text-xs text-foreground transition-colors hover:bg-muted`,children:[(0,d.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,d.jsx)(h,{root:e})]})]})})}function h({root:e}){let a=i(),o=r({mutationFn:e=>t(e),onError:e=>n(e.message,{tone:`danger`})}),l=(a.data?.targets??[]).filter(e=>s(e.id)===void 0).map(e=>({target:e}));return l.length===0?null:(0,d.jsx)(c,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:o.isPending,choices:l,onPick:e=>o.mutate(e,{onSuccess:()=>n(`Opening the project folder in ${l.find(t=>t.target.id===e)?.target.label??e}`)})})}export{f as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{r}from"./project-scope-context-Rv6S_BXt.js";import{f as i,i as a,l as o,n as s,p as c,r as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";var u=e(t(),1),d=n(),f=/^\/p\/([^/]+)(?=\/|$)/;function p(e){let t=f.exec(e)?.[1];return t===void 0?null:decodeURIComponent(t)}function m(e){let t=f.exec(e);if(!t)return e;let n=e.slice(t[0].length);return n===``?`/`:n}function h(e,t){return!t.startsWith(`/`)||t===`/p`||t.startsWith(`/p/`)?t:`/p/${encodeURIComponent(e)}${t}`}function g(e,t){return e===null?t:typeof t==`string`?h(e,t):t.pathname===void 0?t:{...t,pathname:h(e,t.pathname)}}function _(){let{projectId:e}=r(),{pathname:t}=i();return e??p(t)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(e){let{pathname:t}=i();return(0,u.useMemo)(()=>o(e,m(t)),[e,t])}function b({to:e,...t}){let n=v();return(0,d.jsx)(s,{...t,to:n(e)})}function x({to:e,...t}){let n=v();return(0,d.jsx)(l,{...t,to:n(e)})}function S({to:e,...t}){let n=v();return(0,d.jsx)(a,{...t,to:n(e)})}function C(){let e=c(),t=v();return(0,u.useMemo)(()=>((n,r)=>typeof n==`number`?e(n):e(t(n),r)),[e,t])}export{g as a,C as c,p as i,y as l,x as n,m as o,S as r,_ as s,b as t};
|