@wjarka/cezarion 0.18.0-dev.7685 → 0.18.0-dev.7694
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 +2 -2
- package/web/dist/assets/{activity-motion-DjV4Xoms.js → activity-motion-4jefGnf3.js} +1 -1
- package/web/dist/assets/{activity-route-CeDmVBg_.js → activity-route-CrgEEOkP.js} +1 -1
- package/web/dist/assets/attention-CfWn6Sw7.js +1 -0
- package/web/dist/assets/{cez-idle-D1rXzVuh.js → cez-idle-BZ4uUtP5.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-BkPuLrzW.js → commit-diff-panel-BhqIhVpi.js} +1 -1
- package/web/dist/assets/{diff-BBZcIIOt.js → diff-Dtz4yPu-.js} +2 -2
- package/web/dist/assets/{diff-view-DUNXpfvw.js → diff-view-01iQrxA3.js} +1 -1
- package/web/dist/assets/{file-preview-QFfT9j-q.js → file-preview-Bqu0JXBY.js} +1 -1
- package/web/dist/assets/{git-toolbar-Bd54EFZj.js → git-toolbar-zEjeF-_V.js} +1 -1
- package/web/dist/assets/{github-D1ZGYZ6k.js → github-D3a22EyV.js} +1 -1
- package/web/dist/assets/{global-activity-route-BVmBGVep.js → global-activity-route-DXD818_k.js} +1 -1
- package/web/dist/assets/index-DPA7Ibhf.js +14 -0
- package/web/dist/assets/{live-protocol-DKHlCFyG.js → live-protocol-60uiPDg6.js} +1 -1
- package/web/dist/assets/{live-worker-BWdeGzQX.ts → live-worker-DBw-5jVE.ts} +3 -1
- package/web/dist/assets/{markdown-B6DqG9Ie.js → markdown-Dzq31k8-.js} +1 -1
- package/web/dist/assets/{picker-pill-Dbb3GY1a.js → picker-pill-Bmxuo6r5.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-DHH1E04c.js → preview-pane-connected-TaIGMKvt.js} +1 -1
- package/web/dist/assets/{project-router-LT30LjzY.js → project-router-BLLH9tz9.js} +1 -1
- package/web/dist/assets/project-scope-context-CR3cozni.js +4 -0
- package/web/dist/assets/{prompt-template-menu-Dc2ufWt7.js → prompt-template-menu-Fb8KyZ2w.js} +1 -1
- package/web/dist/assets/{queries-DHY6U3e_.js → queries-BCXjp1_j.js} +1 -1
- package/web/dist/assets/{reference-chip-BKeVxG_E.js → reference-chip-1O0efJ0d.js} +1 -1
- package/web/dist/assets/{repo-git-DyuGJJ8w.js → repo-git-BvN7c_-7.js} +1 -1
- package/web/dist/assets/{report-reader-TX7SV7cO.js → report-reader-BEGToSIA.js} +1 -1
- package/web/dist/assets/{reports-DC4T6nCI.js → reports-D61rDO35.js} +1 -1
- package/web/dist/assets/{run-header-CZANvy6Z.js → run-header-gwQQqs03.js} +1 -1
- package/web/dist/assets/runners-D8udSrRd.js +1 -0
- package/web/dist/assets/{skills-DAe4cSA-.js → skills-DB3DAhWt.js} +1 -1
- package/web/dist/assets/{tab-link-C_0J92TF.js → tab-link-DkArCoa9.js} +1 -1
- package/web/dist/assets/{task-changes-Fj_aEo7v.js → task-changes-C4Hp9Bog.js} +1 -1
- package/web/dist/assets/{task-commits-B0Ezfa9a.js → task-commits-IGZ1CJcy.js} +1 -1
- package/web/dist/assets/{task-files-HfwuKxjl.js → task-files-CBrQO4v2.js} +1 -1
- package/web/dist/assets/{task-github-item-B8bv9VSp.js → task-github-item-BJwFCJMl.js} +1 -1
- package/web/dist/assets/{task-thread-Bm755mTM.js → task-thread-Dkn8HN1R.js} +1 -1
- package/web/dist/assets/{thread-state-CJEzn845.js → thread-state-DVfKElYJ.js} +1 -1
- package/web/dist/assets/{use-desktop-EnHXg46f.js → use-desktop-CEB_iBfH.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CUbaxdrd.js → use-hand-to-agent-state-ChF_oDo3.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-CvdGA_PU.js → useInfiniteQuery-Bh_R8jAH.js} +1 -1
- package/web/dist/assets/useQuery-Ct6O0RmO.js +1 -0
- package/web/dist/assets/{workflows-DMaQulmN.js → workflows-BTzKBfs-.js} +1 -1
- package/web/dist/assets/ws-DCvFYEh3.js +1 -0
- package/web/dist/index.html +15 -15
- package/web/dist/live-worker.js +2 -2
- package/web/dist/assets/attention-zJ-ho5os.js +0 -1
- package/web/dist/assets/index-Eo2qZksq.js +0 -14
- package/web/dist/assets/project-scope-context-DMCS5p-N.js +0 -4
- package/web/dist/assets/runners-C-sPUQye.js +0 -1
- package/web/dist/assets/useQuery-BJFZunTR.js +0 -1
- package/web/dist/assets/ws-BxsIvFCG.js +0 -1
|
@@ -61,4 +61,4 @@ var e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInte
|
|
|
61
61
|
|
|
62
62
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=_,s=!u.jitless,c=s&&ce.value,l=t.catchall,d;e._zod.parse=(u,f)=>{d??=r.value;let p=u.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),u=a(u,f),l?Cn([],p,u,f,d,e):u):n(u,f):(u.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),u)}});function En(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!S(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>w(e,r,d())))}),t)}var Dn=s(`$ZodUnion`,(e,t)=>{D.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ne(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>En(t,r,e,i)):En(o,r,e,i)}}),On=s(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Dn.init(e,t);let n=e._zod.parse;m(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ee(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!_(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),kn=s(`$ZodIntersection`,(e,t)=>{D.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>jn(e,t,n)):jn(e,i,a)}});function An(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(v(e)&&v(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=An(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=An(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),S(e))return e;let o=An(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Mn=s(`$ZodRecord`,(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!v(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>w(e,r,d())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...C(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...C(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&ht.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>w(e,r,d())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...C(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...C(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Nn=s(`$ZodEnum`,(e,t)=>{D.init(e,t);let n=f(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ue.has(typeof e)).map(e=>typeof e==`string`?y(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Pn=s(`$ZodLiteral`,(e,t)=>{if(D.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?y(e):e?y(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Fn=s(`$ZodTransform`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new c;return n.value=i,n.fallback=!0,n}});function In(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ln=s(`$ZodOptional`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ne(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>In(e,r)):In(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Rn=s(`$ZodExactOptional`,(e,t)=>{Ln.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),zn=s(`$ZodNullable`,(e,t)=>{D.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ne(e.source)}|null)$`):void 0}),m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Bn=s(`$ZodDefault`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Vn(e,t)):Vn(r,t)}});function Vn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Hn=s(`$ZodPrefault`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Un=s(`$ZodNonOptional`,(e,t)=>{D.init(e,t),m(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Wn(t,e)):Wn(i,e)}});function Wn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Gn=s(`$ZodCatch`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>w(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>w(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Kn=s(`$ZodPipe`,(e,t)=>{D.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>qn(e,t.in,n)):qn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>qn(e,t.out,n)):qn(r,t.out,n)}});function qn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Jn=s(`$ZodPreprocess`,(e,t)=>{Kn.init(e,t)}),Yn=s(`$ZodReadonly`,(e,t)=>{D.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Xn):Xn(r)}});function Xn(e){return e.value=Object.freeze(e.value),e}var Zn=s(`$ZodCustom`,(e,t)=>{E.init(e,t),D.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Qn(t,n,r,e));Qn(i,n,r,e)}});function Qn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(T(e))}}var $n,er=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function tr(){return new er}($n=globalThis).__zod_globalRegistry??($n.__zod_globalRegistry=tr());var k=globalThis.__zod_globalRegistry;function nr(e,t){return new e({type:`string`,...x(t)})}function rr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function ir(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function or(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function sr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function cr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function lr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function ur(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function dr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function fr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function pr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function mr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function hr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function gr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function _r(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function vr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function yr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function br(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function xr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function Sr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function Cr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function wr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function Tr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function Er(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function Dr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function Or(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function kr(e,t){return new e({type:`number`,checks:[],...x(t)})}function Ar(e,t){return new e({type:`number`,coerce:!0,checks:[],...x(t)})}function jr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function Mr(e,t){return new e({type:`boolean`,...x(t)})}function Nr(e,t){return new e({type:`null`,...x(t)})}function Pr(e){return new e({type:`any`})}function Fr(e){return new e({type:`unknown`})}function Ir(e,t){return new e({type:`never`,...x(t)})}function Lr(e,t){return new xt({check:`less_than`,...x(t),value:e,inclusive:!1})}function Rr(e,t){return new xt({check:`less_than`,...x(t),value:e,inclusive:!0})}function zr(e,t){return new St({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Br(e,t){return new St({check:`greater_than`,...x(t),value:e,inclusive:!0})}function Vr(e,t){return new Ct({check:`multiple_of`,...x(t),value:e})}function Hr(e,t){return new Tt({check:`max_length`,...x(t),maximum:e})}function Ur(e,t){return new Et({check:`min_length`,...x(t),minimum:e})}function Wr(e,t){return new Dt({check:`length_equals`,...x(t),length:e})}function Gr(e,t){return new kt({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Kr(e){return new At({check:`string_format`,format:`lowercase`,...x(e)})}function qr(e){return new jt({check:`string_format`,format:`uppercase`,...x(e)})}function Jr(e,t){return new Mt({check:`string_format`,format:`includes`,...x(t),includes:e})}function Yr(e,t){return new Nt({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function Xr(e,t){return new Pt({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function A(e){return new Ft({check:`overwrite`,tx:e})}function Zr(e){return A(t=>t.normalize(e))}function Qr(){return A(e=>e.trim())}function $r(){return A(e=>e.toLowerCase())}function ei(){return A(e=>e.toUpperCase())}function ti(){return A(e=>oe(e))}function ni(e,t,n){return new e({type:`array`,element:t,...x(n)})}function ri(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function ii(e,t){let n=ai(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(T(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(T(r))}},e(t.value,t)),t);return n}function ai(e,t){let n=new E({check:`custom`,...x(t)});return n._zod.check=e,n}function oi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??k,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function j(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,j(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&M(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function si(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ci(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ui(t,`input`,e.processors),output:ui(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return M(r.element,n);if(r.type===`set`)return M(r.valueType,n);if(r.type===`lazy`)return M(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return M(r.innerType,n);if(r.type===`intersection`)return M(r.left,n)||M(r.right,n);if(r.type===`record`||r.type===`map`)return M(r.keyType,n)||M(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M(r.in,n)||M(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M(e,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}var li=(e,t={})=>n=>{let r=oi({...n,processors:t});return j(e,r),si(r,e),ci(r,e)},ui=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=oi({...i??{},target:a,io:t,processors:n});return j(e,o),si(o,e),ci(o,e)},di={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=di[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},pi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},mi=(e,t,n,r)=>{n.type=`boolean`},hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gi=(e,t,n,r)=>{n.not={}},_i=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},yi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=j(a.element,t,{...r,path:[...r.path,`items`]})},Si=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=j(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=j(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ci=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>j(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wi=(e,t,n,r)=>{let i=e._zod.def,a=j(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=j(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=j(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=j(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ei=(e,t,n,r)=>{let i=e._zod.def,a=j(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Di=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Oi=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ki=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ai=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ji=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;j(o,t,r);let s=t.seen.get(e);s.ref=o},Mi=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ni=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Pi=s(`ZodISODateTime`,(e,t)=>{Xt.init(e,t),R.init(e,t)});function N(e){return Tr(Pi,e)}var Fi=s(`ZodISODate`,(e,t)=>{Zt.init(e,t),R.init(e,t)});function Ii(e){return Er(Fi,e)}var Li=s(`ZodISOTime`,(e,t)=>{Qt.init(e,t),R.init(e,t)});function Ri(e){return Dr(Li,e)}var zi=s(`ZodISODuration`,(e,t)=>{$t.init(e,t),R.init(e,t)});function Bi(e){return Or(zi,e)}var P=s(`ZodError`,(e,t)=>{we.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>De(e,t)},flatten:{value:t=>Ee(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Vi=Oe(P),Hi=ke(P),Ui=Ae(P),Wi=Me(P),Gi=Pe(P),Ki=Fe(P),qi=Ie(P),Ji=Le(P),Yi=Re(P),Xi=ze(P),Zi=Be(P),Qi=Ve(P),$i=new WeakMap;function F(e,t,n){let r=Object.getPrototypeOf(e),i=$i.get(r);if(i||(i=new Set,$i.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var I=s(`ZodType`,(e,t)=>(D.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ui(e,`input`),output:ui(e,`output`)}}),e.toJSONSchema=li(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Vi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ui(e,t,n),e.parseAsync=async(t,n)=>Hi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Wi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Gi(e,t,n),e.decode=(t,n)=>Ki(e,t,n),e.encodeAsync=async(t,n)=>qi(e,t,n),e.decodeAsync=async(t,n)=>Ji(e,t,n),e.safeEncode=(t,n)=>Yi(e,t,n),e.safeDecode=(t,n)=>Xi(e,t,n),e.safeEncodeAsync=async(t,n)=>Zi(e,t,n),e.safeDecodeAsync=async(t,n)=>Qi(e,t,n),F(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mo(e,t))},superRefine(e,t){return this.check(ho(e,t))},overwrite(e){return this.check(A(e))},optional(){return Ja(this)},exactOptional(){return Xa(this)},nullable(){return Qa(this)},nullish(){return Ja(Qa(this))},nonoptional(e){return io(this,e)},array(){return W(this)},or(e){return K([this,e])},and(e){return Ba(this,e)},transform(e){return co(this,Ka(e))},default(e){return eo(this,e)},prefault(e){return no(this,e)},catch(e){return oo(this,e)},pipe(e){return co(this,e)},readonly(){return fo(this)},describe(e){let t=this.clone();return k.add(t,{description:e}),t},meta(...e){if(e.length===0)return k.get(this);let t=this.clone();return k.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return k.get(e)?.description},configurable:!0}),e)),ea=s(`_ZodString`,(e,t)=>{Rt.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,F(e,`_ZodString`,{regex(...e){return this.check(Gr(...e))},includes(...e){return this.check(Jr(...e))},startsWith(...e){return this.check(Yr(...e))},endsWith(...e){return this.check(Xr(...e))},min(...e){return this.check(Ur(...e))},max(...e){return this.check(Hr(...e))},length(...e){return this.check(Wr(...e))},nonempty(...e){return this.check(Ur(1,...e))},lowercase(e){return this.check(Kr(e))},uppercase(e){return this.check(qr(e))},trim(){return this.check(Qr())},normalize(...e){return this.check(Zr(...e))},toLowerCase(){return this.check($r())},toUpperCase(){return this.check(ei())},slugify(){return this.check(ti())}})}),ta=s(`ZodString`,(e,t)=>{Rt.init(e,t),ea.init(e,t),e.email=t=>e.check(rr(na,t)),e.url=t=>e.check(lr(ia,t)),e.jwt=t=>e.check(wr(ba,t)),e.emoji=t=>e.check(ur(oa,t)),e.guid=t=>e.check(ir(ra,t)),e.uuid=t=>e.check(ar(z,t)),e.uuidv4=t=>e.check(or(z,t)),e.uuidv6=t=>e.check(sr(z,t)),e.uuidv7=t=>e.check(cr(z,t)),e.nanoid=t=>e.check(dr(sa,t)),e.guid=t=>e.check(ir(ra,t)),e.cuid=t=>e.check(fr(ca,t)),e.cuid2=t=>e.check(pr(la,t)),e.ulid=t=>e.check(mr(ua,t)),e.base64=t=>e.check(xr(_a,t)),e.base64url=t=>e.check(Sr(va,t)),e.xid=t=>e.check(hr(da,t)),e.ksuid=t=>e.check(gr(fa,t)),e.ipv4=t=>e.check(_r(pa,t)),e.ipv6=t=>e.check(vr(ma,t)),e.cidrv4=t=>e.check(yr(ha,t)),e.cidrv6=t=>e.check(br(ga,t)),e.e164=t=>e.check(Cr(ya,t)),e.datetime=t=>e.check(N(t)),e.date=t=>e.check(Ii(t)),e.time=t=>e.check(Ri(t)),e.duration=t=>e.check(Bi(t))});function L(e){return nr(ta,e)}var R=s(`ZodStringFormat`,(e,t)=>{O.init(e,t),ea.init(e,t)}),na=s(`ZodEmail`,(e,t)=>{Vt.init(e,t),R.init(e,t)}),ra=s(`ZodGUID`,(e,t)=>{zt.init(e,t),R.init(e,t)}),z=s(`ZodUUID`,(e,t)=>{Bt.init(e,t),R.init(e,t)});function B(e){return ar(z,e)}var ia=s(`ZodURL`,(e,t)=>{Ht.init(e,t),R.init(e,t)});function aa(e){return lr(ia,e)}var oa=s(`ZodEmoji`,(e,t)=>{Ut.init(e,t),R.init(e,t)}),sa=s(`ZodNanoID`,(e,t)=>{Wt.init(e,t),R.init(e,t)}),ca=s(`ZodCUID`,(e,t)=>{Gt.init(e,t),R.init(e,t)}),la=s(`ZodCUID2`,(e,t)=>{Kt.init(e,t),R.init(e,t)}),ua=s(`ZodULID`,(e,t)=>{qt.init(e,t),R.init(e,t)}),da=s(`ZodXID`,(e,t)=>{Jt.init(e,t),R.init(e,t)}),fa=s(`ZodKSUID`,(e,t)=>{Yt.init(e,t),R.init(e,t)}),pa=s(`ZodIPv4`,(e,t)=>{en.init(e,t),R.init(e,t)}),ma=s(`ZodIPv6`,(e,t)=>{tn.init(e,t),R.init(e,t)}),ha=s(`ZodCIDRv4`,(e,t)=>{nn.init(e,t),R.init(e,t)}),ga=s(`ZodCIDRv6`,(e,t)=>{rn.init(e,t),R.init(e,t)}),_a=s(`ZodBase64`,(e,t)=>{on.init(e,t),R.init(e,t)}),va=s(`ZodBase64URL`,(e,t)=>{cn.init(e,t),R.init(e,t)}),ya=s(`ZodE164`,(e,t)=>{ln.init(e,t),R.init(e,t)}),ba=s(`ZodJWT`,(e,t)=>{dn.init(e,t),R.init(e,t)}),xa=s(`ZodNumber`,(e,t)=>{fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),F(e,`ZodNumber`,{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Br(e,t))},min(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(Rr(e,t))},max(e,t){return this.check(Rr(e,t))},int(e){return this.check(Ca(e))},safe(e){return this.check(Ca(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Br(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(Rr(0,e))},multipleOf(e,t){return this.check(Vr(e,t))},step(e,t){return this.check(Vr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function V(e){return kr(xa,e)}var Sa=s(`ZodNumberFormat`,(e,t)=>{pn.init(e,t),xa.init(e,t)});function Ca(e){return jr(Sa,e)}var wa=s(`ZodBoolean`,(e,t)=>{mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r)});function H(e){return Mr(wa,e)}var Ta=s(`ZodNull`,(e,t)=>{hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function Ea(e){return Nr(Ta,e)}var Da=s(`ZodAny`,(e,t)=>{gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Oa(){return Pr(Da)}var ka=s(`ZodUnknown`,(e,t)=>{_n.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function U(){return Fr(ka)}var Aa=s(`ZodNever`,(e,t)=>{vn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ja(e){return Ir(Aa,e)}var Ma=s(`ZodArray`,(e,t)=>{bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.element=t.element,F(e,`ZodArray`,{min(e,t){return this.check(Ur(e,t))},nonempty(e){return this.check(Ur(1,e))},max(e,t){return this.check(Hr(e,t))},length(e,t){return this.check(Wr(e,t))},unwrap(){return this.element}})});function W(e,t){return ni(Ma,e,t)}var Na=s(`ZodObject`,(e,t)=>{Tn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),m(e,`shape`,()=>t.shape),F(e,`ZodObject`,{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:U()})},loose(){return this.clone({...this._zod.def,catchall:U()})},strict(){return this.clone({...this._zod.def,catchall:ja()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return he(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return pe(this,e)},omit(e){return me(this,e)},partial(...e){return ve(qa,this,e[0])},required(...e){return ye(ro,this,e[0])}})});function G(e,t){return new Na({type:`object`,shape:e??{},...x(t)})}function Pa(e,t){return new Na({type:`object`,shape:e,catchall:ja(),...x(t)})}function Fa(e,t){return new Na({type:`object`,shape:e,catchall:U(),...x(t)})}var Ia=s(`ZodUnion`,(e,t)=>{Dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.options=t.options});function K(e,t){return new Ia({type:`union`,options:e,...x(t)})}var La=s(`ZodDiscriminatedUnion`,(e,t)=>{Ia.init(e,t),On.init(e,t)});function Ra(e,t,n){return new La({type:`union`,options:t,discriminator:e,...x(n)})}var za=s(`ZodIntersection`,(e,t)=>{kn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Ba(e,t){return new za({type:`intersection`,left:e,right:t})}var Va=s(`ZodRecord`,(e,t)=>{Mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ha(e,t,n){return!t||!t._zod?new Va({type:`record`,keyType:L(),valueType:e,...x(t)}):new Va({type:`record`,keyType:e,valueType:t,...x(n)})}var Ua=s(`ZodEnum`,(e,t)=>{Nn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ua({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ua({...t,checks:[],...x(r),entries:i})}});function q(e,t){return new Ua({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var Wa=s(`ZodLiteral`,(e,t)=>{Pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new Wa({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var Ga=s(`ZodTransform`,(e,t)=>{Fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(T(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(T(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ka(e){return new Ga({type:`transform`,transform:e})}var qa=s(`ZodOptional`,(e,t)=>{Ln.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ja(e){return new qa({type:`optional`,innerType:e})}var Ya=s(`ZodExactOptional`,(e,t)=>{Rn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xa(e){return new Ya({type:`optional`,innerType:e})}var Za=s(`ZodNullable`,(e,t)=>{zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qa(e){return new Za({type:`nullable`,innerType:e})}var $a=s(`ZodDefault`,(e,t)=>{Bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function eo(e,t){return new $a({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var to=s(`ZodPrefault`,(e,t)=>{Hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function no(e,t){return new to({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var ro=s(`ZodNonOptional`,(e,t)=>{Un.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new ro({type:`nonoptional`,innerType:e,...x(t)})}var ao=s(`ZodCatch`,(e,t)=>{Gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oo(e,t){return new ao({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var so=s(`ZodPipe`,(e,t)=>{Kn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.in=t.in,e.out=t.out});function co(e,t){return new so({type:`pipe`,in:e,out:t})}var lo=s(`ZodPreprocess`,(e,t)=>{so.init(e,t),Jn.init(e,t)}),uo=s(`ZodReadonly`,(e,t)=>{Yn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fo(e){return new uo({type:`readonly`,innerType:e})}var po=s(`ZodCustom`,(e,t)=>{Zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function mo(e,t={}){return ri(po,e,t)}function ho(e,t){return ii(e,t)}function go(e,t){return new lo({type:`pipe`,in:Ka(e),out:t})}function _o(e){return Ar(xa,e)}var Y={questions:4,id:64,header:12,question:400,minOptions:2,maxOptions:4,label:60,description:280,context:2e4},vo=L().min(1).max(Y.context),yo=G({label:L().min(1).max(Y.label),description:L().max(Y.description).optional()}).strict(),bo=G({id:L().min(1).max(Y.id).optional(),header:L().min(1).max(Y.header),question:L().min(1).max(Y.question),options:W(yo).min(Y.minOptions).max(Y.maxOptions).refine(e=>new Set(e.map(e=>e.label)).size===e.length,{message:`option labels must be unique within a question`}).optional(),multiSelect:H().optional(),allowFreeText:H().optional()}).strict(),xo=G({context:vo.optional(),questions:W(bo).min(1).max(Y.questions).refine(e=>new Set(e.map(e=>e.question)).size===e.length,{message:`question texts must be unique`})}).strict(),So=q([`family`,`peer`]),Co=G({senderRunId:B(),recipientRunId:B(),kind:q([`request`,`progress`,`follow-up`,`reply`]),requestId:B().optional(),relationship:So.optional()}).strict(),X=Co.extend({id:B(),text:L().min(1).max(1e5),createdAt:N(),deadline:N().optional(),requestHash:L().regex(/^[0-9a-f]{64}$/),state:q([`accepted`,`continuation-required`,`destroyed`,`late`]),resumed:J(!0).optional(),instruction:L().max(2048).optional(),question:xo.optional()}),Z=G({requestId:B(),status:q([`replied`,`replied-late`,`completed-without-reply`,`failed`,`cancelled`,`destroyed`,`timed-out`,`sender-closed`,`human-fallback`,`deleted`]),observedAt:N(),replyId:B().optional()}).strict(),wo=G({messages:W(X).max(1024),outcomes:W(Z).max(1024)}).strict(),To=L().max(128).regex(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i,`Not a history cursor; pass nextBefore from an earlier page`);wo.extend({hint:L().optional(),nextBefore:To.optional()}),G({messages:W(X).max(32),outcomes:W(Z).max(32),receiptId:B().optional(),expiresAt:N().optional()}).strict().refine(e=>e.messages.length>0?e.receiptId!==void 0&&e.expiresAt!==void 0:e.receiptId===void 0&&e.expiresAt===void 0,{message:`A nonempty inbox batch requires a receipt and expiry`}),G({receiptId:B()}).strict(),G({receiptId:B(),status:q([`acknowledged`,`already-acknowledged`,`released`])}).strict(),G({id:B(),recipientRunId:B(),kind:Co.shape.kind,requestId:B().optional(),text:L().min(1).max(1e5).refine(e=>e.trim().length>0),timeoutSeconds:V().int().min(1).max(86400).default(600),resume:H().optional()}).strict().refine(e=>e.timeoutSeconds<=7200||e.resume===!0&&e.kind===`request`,{path:[`timeoutSeconds`],message:`Only --resume requests accept deadlines above 7200 seconds (maximum 86400)`}).refine(e=>(e.kind===`reply`||e.kind===`follow-up`)==(e.requestId!==void 0),{message:`Replies and follow-ups require a request ID; new messages must omit it`}).refine(e=>!e.resume||e.kind===`request`||e.kind===`progress`,{message:`--resume requires a new request or progress instruction`});var Eo=q([`applied`,`unchanged`,`refused`,`unknown`]);G({message:X,delivery:q([`queued`,`delivered`,`consumed`,`not-delivered`]),outcome:Z.optional(),effect:Eo.optional()}).strict(),G({recipientRunId:B(),before:To.optional()}).strict(),G({requestId:B()}).strict(),G({requestIds:W(B()).min(1).max(32).refine(e=>new Set(e).size===e.length),mode:q([`one`,`any`,`all`]).optional(),timeoutSeconds:V().int().min(1).max(7200).default(600)}).strict().refine(e=>e.mode!==`one`||e.requestIds.length===1,{message:`one requires exactly one request`});var Do=G({receiptId:B(),generation:B(),expiresAt:N(),acknowledgedAt:N().optional(),memberIds:W(B()).min(1).max(32).refine(e=>new Set(e).size===e.length).optional()}).strict(),Oo=G({conversation:Co.optional(),id:B(),source:q([`agent`,`lifecycle`]),parentRunId:B(),text:L().min(1).max(1e5),createdAt:N(),deliveredAt:N().optional(),consumedAt:N().optional(),awaitingRead:J(!0).optional(),inboxClaim:Do.optional(),purpose:q([`completion-refusal`,`undelivered-question`]).optional(),requestHash:L().regex(/^[0-9a-f]{64}$/).optional(),deadline:N().optional()}).strict(),ko=G({workerId:B(),status:q([`review`,`done`,`failed`,`cancelled`]),observedAt:N(),summary:L().max(4e3).optional(),revision:V().int().nonnegative().optional()}).strict(),Ao=q([`one`,`any`,`all`]),Q=Fa({seq:V(),ts:L(),stepId:L().optional(),type:L()}),jo=Q.extend({type:J(`conversation-message`),message:X,delivery:q([`queued`,`delivered`,`consumed`,`not-delivered`]),deliveredAt:N().optional(),consumedAt:N().optional()}),Mo=Q.extend({type:J(`request-outcome`),outcome:Z}),No=Q.extend({type:J(`agent-input`),input:Oo}),Po=Q.extend({type:J(`human-input-delivered`),askSeq:V().int().nonnegative(),source:q([`human`,`parent`,`cezar`]).optional()}),Fo=Q.extend({type:J(`human-ask-closed`),askSeq:V().int().nonnegative(),reason:q([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`])});Q.extend({type:J(`worker-question-routed`),askSeq:V().int().nonnegative(),messageId:B(),parentRunId:B()}),Q.extend({type:J(`worker-question-fallback`),askSeq:V().int().nonnegative(),reason:L().min(1).max(200)}),Q.extend({type:J(`worker-question-undelivered`),askSeq:V().int().nonnegative(),reason:L().min(1).max(200)}),Q.extend({type:J(`worker-outcome`),outcome:ko});var Io=G({id:L().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)}),$=L().min(1).max(2048);G({cursor:$.optional()}),G({cursor:$.optional(),afterSeq:_o().int().nonnegative().optional()});var Lo=G({seq:V(),ts:L(),stepId:L().optional(),type:L()}).catchall(Oa()),Ro=G({events:W(Lo),itemCount:V().int().min(0).max(100),olderCursor:$.optional(),newerCursor:$.optional(),liveCursor:$,asOfSeq:V().int().nonnegative(),hasOlder:H()}),zo=G({contextEvents:W(Lo),asOfSeq:V().int().nonnegative()}),Bo=G({checkoutId:L().optional(),name:L(),phase:q([`cloning`,`done`,`error`]),line:L().optional(),error:L().optional(),warning:L().optional()}),Vo=1024*1024,Ho=G({projectId:L().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),runId:Io.shape.id,cursor:$.optional(),afterSeq:V().int().nonnegative().safe()});G({runs:W(Ho).min(1).max(32)}).refine(({runs:e})=>new Set(e.map(e=>`${e.projectId}/${e.runId}`)).size===e.length,{message:`duplicate run demand`});var Uo=Ho.pick({projectId:!0,runId:!0}),Wo=Uo.extend({type:q([`error`,`reset`]),status:K([J(400),J(404),J(409),J(413),J(503)]),error:L()}),Go=K([Uo.extend({type:J(`batch`),events:W(Lo).max(256),cursor:$,afterSeq:V().int().nonnegative(),hasMore:H()}),Wo]),Ko=G({generation:L(),results:W(Go)}),qo=K([G({type:J(`ready`),generation:L()}),G({type:J(`ping`)}),Uo.extend({type:J(`event`),name:q([`run-event`,`ui-event`]),event:Lo}),Wo]),Jo=`cezar-live-v3`,Yo=15e3,Xo=5e3;function Zo(e){return!e.startsWith(`/api/v1/`)||e.includes(`#`)||/[\\\r\n]/.test(e)?!1:/^\/api\/v1\/(?:workspace\/(?:runs-index|activity)|p\/[a-zA-Z0-9_-]+\/(?:reports\/state|runs\/[a-zA-Z0-9._-]+\/(?:changes|commits)|github(?:\/(?:checks|ref-status))?))(?:\?[^#]*)?$/.test(e)}var Qo=Ra(`kind`,[G({kind:J(`workspace`)}),Ho.extend({kind:J(`run`)}),G({kind:J(`topic`),topic:L().min(1).max(128)}),G({kind:J(`read`),path:L().max(4096).refine(Zo),intervalMs:V().int().min(1e3).max(2147483647)})]),$o=G({id:L().min(1).max(128),demand:Qo}),es=G({version:J(3),documentId:L().min(1).max(128),epoch:V().int().nonnegative()}),ts=Ra(`type`,[es.extend({type:J(`sync`),entries:W($o).max(64),workspaceReady:J(!0).optional()}).refine(e=>new Set(e.entries.map(e=>e.id)).size===e.entries.length),es.extend({type:J(`ack`),id:L(),seq:V().int().nonnegative()}),es.extend({type:J(`refresh`),id:L()})]),ns=G({event:L(),data:L(),id:L()}),rs=Ra(`type`,[G({type:J(`unavailable`),version:J(3),epoch:V(),reason:L()}),G({type:J(`hello`),version:J(3)}),G({type:J(`alive`),version:J(3),epoch:V()}),G({type:J(`frame`),version:J(3),epoch:V(),id:L(),frame:K([ns,qo])}),G({type:J(`value`),version:J(3),epoch:V(),id:L(),value:U(),error:L().optional()}),G({type:J(`reset`),version:J(3),epoch:V(),id:L(),reason:L()})]),is=e=>`${e.projectId}/${e.runId}`;export{W as A,Pa as B,wo as C,_o as D,xo as E,ja as F,B as G,K as H,V as I,t as J,N as K,G as L,Ra as M,J as N,q as O,Fa as P,go as R,Oo as S,vo as T,U,L as V,aa as W,Mo as _,Qo as a,ko as b,is as c,Vo as d,No as f,Po as g,Fo as h,Zo as i,H as j,Ea as k,Ko as l,jo as m,Jo as n,ts as o,Bo as p,a as q,Xo as r,rs as s,Yo as t,qo as u,zo as v,Z as w,Ao as x,Ro as y,Ha as z};
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ci(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ui(t,`input`,e.processors),output:ui(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return M(r.element,n);if(r.type===`set`)return M(r.valueType,n);if(r.type===`lazy`)return M(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return M(r.innerType,n);if(r.type===`intersection`)return M(r.left,n)||M(r.right,n);if(r.type===`record`||r.type===`map`)return M(r.keyType,n)||M(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M(r.in,n)||M(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M(e,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}var li=(e,t={})=>n=>{let r=oi({...n,processors:t});return j(e,r),si(r,e),ci(r,e)},ui=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=oi({...i??{},target:a,io:t,processors:n});return j(e,o),si(o,e),ci(o,e)},di={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},fi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=di[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},pi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},mi=(e,t,n,r)=>{n.type=`boolean`},hi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},gi=(e,t,n,r)=>{n.not={}},_i=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},yi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},xi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=j(a.element,t,{...r,path:[...r.path,`items`]})},Si=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=j(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=j(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ci=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>j(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wi=(e,t,n,r)=>{let i=e._zod.def,a=j(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=j(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ti=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=j(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=j(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ei=(e,t,n,r)=>{let i=e._zod.def,a=j(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Di=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Oi=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ki=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ai=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ji=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;j(o,t,r);let s=t.seen.get(e);s.ref=o},Mi=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ni=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Pi=s(`ZodISODateTime`,(e,t)=>{Xt.init(e,t),R.init(e,t)});function N(e){return Tr(Pi,e)}var Fi=s(`ZodISODate`,(e,t)=>{Zt.init(e,t),R.init(e,t)});function Ii(e){return Er(Fi,e)}var Li=s(`ZodISOTime`,(e,t)=>{Qt.init(e,t),R.init(e,t)});function Ri(e){return Dr(Li,e)}var zi=s(`ZodISODuration`,(e,t)=>{$t.init(e,t),R.init(e,t)});function Bi(e){return Or(zi,e)}var P=s(`ZodError`,(e,t)=>{we.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>De(e,t)},flatten:{value:t=>Ee(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Vi=Oe(P),Hi=ke(P),Ui=Ae(P),Wi=Me(P),Gi=Pe(P),Ki=Fe(P),qi=Ie(P),Ji=Le(P),Yi=Re(P),Xi=ze(P),Zi=Be(P),Qi=Ve(P),$i=new WeakMap;function F(e,t,n){let r=Object.getPrototypeOf(e),i=$i.get(r);if(i||(i=new Set,$i.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var I=s(`ZodType`,(e,t)=>(D.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ui(e,`input`),output:ui(e,`output`)}}),e.toJSONSchema=li(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Vi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ui(e,t,n),e.parseAsync=async(t,n)=>Hi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Wi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Gi(e,t,n),e.decode=(t,n)=>Ki(e,t,n),e.encodeAsync=async(t,n)=>qi(e,t,n),e.decodeAsync=async(t,n)=>Ji(e,t,n),e.safeEncode=(t,n)=>Yi(e,t,n),e.safeDecode=(t,n)=>Xi(e,t,n),e.safeEncodeAsync=async(t,n)=>Zi(e,t,n),e.safeDecodeAsync=async(t,n)=>Qi(e,t,n),F(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mo(e,t))},superRefine(e,t){return this.check(ho(e,t))},overwrite(e){return this.check(A(e))},optional(){return Ja(this)},exactOptional(){return Xa(this)},nullable(){return Qa(this)},nullish(){return Ja(Qa(this))},nonoptional(e){return io(this,e)},array(){return W(this)},or(e){return K([this,e])},and(e){return Ba(this,e)},transform(e){return co(this,Ka(e))},default(e){return eo(this,e)},prefault(e){return no(this,e)},catch(e){return oo(this,e)},pipe(e){return co(this,e)},readonly(){return fo(this)},describe(e){let t=this.clone();return k.add(t,{description:e}),t},meta(...e){if(e.length===0)return k.get(this);let t=this.clone();return k.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return k.get(e)?.description},configurable:!0}),e)),ea=s(`_ZodString`,(e,t)=>{Rt.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,F(e,`_ZodString`,{regex(...e){return this.check(Gr(...e))},includes(...e){return this.check(Jr(...e))},startsWith(...e){return this.check(Yr(...e))},endsWith(...e){return this.check(Xr(...e))},min(...e){return this.check(Ur(...e))},max(...e){return this.check(Hr(...e))},length(...e){return this.check(Wr(...e))},nonempty(...e){return this.check(Ur(1,...e))},lowercase(e){return this.check(Kr(e))},uppercase(e){return this.check(qr(e))},trim(){return this.check(Qr())},normalize(...e){return this.check(Zr(...e))},toLowerCase(){return this.check($r())},toUpperCase(){return this.check(ei())},slugify(){return this.check(ti())}})}),ta=s(`ZodString`,(e,t)=>{Rt.init(e,t),ea.init(e,t),e.email=t=>e.check(rr(na,t)),e.url=t=>e.check(lr(ia,t)),e.jwt=t=>e.check(wr(ba,t)),e.emoji=t=>e.check(ur(oa,t)),e.guid=t=>e.check(ir(ra,t)),e.uuid=t=>e.check(ar(z,t)),e.uuidv4=t=>e.check(or(z,t)),e.uuidv6=t=>e.check(sr(z,t)),e.uuidv7=t=>e.check(cr(z,t)),e.nanoid=t=>e.check(dr(sa,t)),e.guid=t=>e.check(ir(ra,t)),e.cuid=t=>e.check(fr(ca,t)),e.cuid2=t=>e.check(pr(la,t)),e.ulid=t=>e.check(mr(ua,t)),e.base64=t=>e.check(xr(_a,t)),e.base64url=t=>e.check(Sr(va,t)),e.xid=t=>e.check(hr(da,t)),e.ksuid=t=>e.check(gr(fa,t)),e.ipv4=t=>e.check(_r(pa,t)),e.ipv6=t=>e.check(vr(ma,t)),e.cidrv4=t=>e.check(yr(ha,t)),e.cidrv6=t=>e.check(br(ga,t)),e.e164=t=>e.check(Cr(ya,t)),e.datetime=t=>e.check(N(t)),e.date=t=>e.check(Ii(t)),e.time=t=>e.check(Ri(t)),e.duration=t=>e.check(Bi(t))});function L(e){return nr(ta,e)}var R=s(`ZodStringFormat`,(e,t)=>{O.init(e,t),ea.init(e,t)}),na=s(`ZodEmail`,(e,t)=>{Vt.init(e,t),R.init(e,t)}),ra=s(`ZodGUID`,(e,t)=>{zt.init(e,t),R.init(e,t)}),z=s(`ZodUUID`,(e,t)=>{Bt.init(e,t),R.init(e,t)});function B(e){return ar(z,e)}var ia=s(`ZodURL`,(e,t)=>{Ht.init(e,t),R.init(e,t)});function aa(e){return lr(ia,e)}var oa=s(`ZodEmoji`,(e,t)=>{Ut.init(e,t),R.init(e,t)}),sa=s(`ZodNanoID`,(e,t)=>{Wt.init(e,t),R.init(e,t)}),ca=s(`ZodCUID`,(e,t)=>{Gt.init(e,t),R.init(e,t)}),la=s(`ZodCUID2`,(e,t)=>{Kt.init(e,t),R.init(e,t)}),ua=s(`ZodULID`,(e,t)=>{qt.init(e,t),R.init(e,t)}),da=s(`ZodXID`,(e,t)=>{Jt.init(e,t),R.init(e,t)}),fa=s(`ZodKSUID`,(e,t)=>{Yt.init(e,t),R.init(e,t)}),pa=s(`ZodIPv4`,(e,t)=>{en.init(e,t),R.init(e,t)}),ma=s(`ZodIPv6`,(e,t)=>{tn.init(e,t),R.init(e,t)}),ha=s(`ZodCIDRv4`,(e,t)=>{nn.init(e,t),R.init(e,t)}),ga=s(`ZodCIDRv6`,(e,t)=>{rn.init(e,t),R.init(e,t)}),_a=s(`ZodBase64`,(e,t)=>{on.init(e,t),R.init(e,t)}),va=s(`ZodBase64URL`,(e,t)=>{cn.init(e,t),R.init(e,t)}),ya=s(`ZodE164`,(e,t)=>{ln.init(e,t),R.init(e,t)}),ba=s(`ZodJWT`,(e,t)=>{dn.init(e,t),R.init(e,t)}),xa=s(`ZodNumber`,(e,t)=>{fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r),F(e,`ZodNumber`,{gt(e,t){return this.check(zr(e,t))},gte(e,t){return this.check(Br(e,t))},min(e,t){return this.check(Br(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(Rr(e,t))},max(e,t){return this.check(Rr(e,t))},int(e){return this.check(Ca(e))},safe(e){return this.check(Ca(e))},positive(e){return this.check(zr(0,e))},nonnegative(e){return this.check(Br(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(Rr(0,e))},multipleOf(e,t){return this.check(Vr(e,t))},step(e,t){return this.check(Vr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function V(e){return kr(xa,e)}var Sa=s(`ZodNumberFormat`,(e,t)=>{pn.init(e,t),xa.init(e,t)});function Ca(e){return jr(Sa,e)}var wa=s(`ZodBoolean`,(e,t)=>{mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r)});function H(e){return Mr(wa,e)}var Ta=s(`ZodNull`,(e,t)=>{hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r)});function Ea(e){return Nr(Ta,e)}var Da=s(`ZodAny`,(e,t)=>{gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Oa(){return Pr(Da)}var ka=s(`ZodUnknown`,(e,t)=>{_n.init(e,t),I.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function U(){return Fr(ka)}var Aa=s(`ZodNever`,(e,t)=>{vn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function ja(e){return Ir(Aa,e)}var Ma=s(`ZodArray`,(e,t)=>{bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r),e.element=t.element,F(e,`ZodArray`,{min(e,t){return this.check(Ur(e,t))},nonempty(e){return this.check(Ur(1,e))},max(e,t){return this.check(Hr(e,t))},length(e,t){return this.check(Wr(e,t))},unwrap(){return this.element}})});function W(e,t){return ni(Ma,e,t)}var Na=s(`ZodObject`,(e,t)=>{Tn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),m(e,`shape`,()=>t.shape),F(e,`ZodObject`,{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:U()})},loose(){return this.clone({...this._zod.def,catchall:U()})},strict(){return this.clone({...this._zod.def,catchall:ja()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return he(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return pe(this,e)},omit(e){return me(this,e)},partial(...e){return ve(qa,this,e[0])},required(...e){return ye(ro,this,e[0])}})});function G(e,t){return new Na({type:`object`,shape:e??{},...x(t)})}function Pa(e,t){return new Na({type:`object`,shape:e,catchall:ja(),...x(t)})}function Fa(e,t){return new Na({type:`object`,shape:e,catchall:U(),...x(t)})}var Ia=s(`ZodUnion`,(e,t)=>{Dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.options=t.options});function K(e,t){return new Ia({type:`union`,options:e,...x(t)})}var La=s(`ZodDiscriminatedUnion`,(e,t)=>{Ia.init(e,t),On.init(e,t)});function Ra(e,t,n){return new La({type:`union`,options:t,discriminator:e,...x(n)})}var za=s(`ZodIntersection`,(e,t)=>{kn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function Ba(e,t){return new za({type:`intersection`,left:e,right:t})}var Va=s(`ZodRecord`,(e,t)=>{Mn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ha(e,t,n){return!t||!t._zod?new Va({type:`record`,keyType:L(),valueType:e,...x(t)}):new Va({type:`record`,keyType:e,valueType:t,...x(n)})}var Ua=s(`ZodEnum`,(e,t)=>{Nn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ua({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ua({...t,checks:[],...x(r),entries:i})}});function q(e,t){return new Ua({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var Wa=s(`ZodLiteral`,(e,t)=>{Pn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new Wa({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var Ga=s(`ZodTransform`,(e,t)=>{Fn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(T(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(T(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ka(e){return new Ga({type:`transform`,transform:e})}var qa=s(`ZodOptional`,(e,t)=>{Ln.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ja(e){return new qa({type:`optional`,innerType:e})}var Ya=s(`ZodExactOptional`,(e,t)=>{Rn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xa(e){return new Ya({type:`optional`,innerType:e})}var Za=s(`ZodNullable`,(e,t)=>{zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qa(e){return new Za({type:`nullable`,innerType:e})}var $a=s(`ZodDefault`,(e,t)=>{Bn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function eo(e,t){return new $a({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var to=s(`ZodPrefault`,(e,t)=>{Hn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function no(e,t){return new to({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var ro=s(`ZodNonOptional`,(e,t)=>{Un.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function io(e,t){return new ro({type:`nonoptional`,innerType:e,...x(t)})}var ao=s(`ZodCatch`,(e,t)=>{Gn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oo(e,t){return new ao({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var so=s(`ZodPipe`,(e,t)=>{Kn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e.in=t.in,e.out=t.out});function co(e,t){return new so({type:`pipe`,in:e,out:t})}var lo=s(`ZodPreprocess`,(e,t)=>{so.init(e,t),Jn.init(e,t)}),uo=s(`ZodReadonly`,(e,t)=>{Yn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fo(e){return new uo({type:`readonly`,innerType:e})}var po=s(`ZodCustom`,(e,t)=>{Zn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r)});function mo(e,t={}){return ri(po,e,t)}function ho(e,t){return ii(e,t)}function go(e,t){return new lo({type:`pipe`,in:Ka(e),out:t})}function _o(e){return Ar(xa,e)}var Y={questions:4,id:64,header:12,question:400,minOptions:2,maxOptions:4,label:60,description:280,context:2e4},vo=L().min(1).max(Y.context),yo=G({label:L().min(1).max(Y.label),description:L().max(Y.description).optional()}).strict(),bo=G({id:L().min(1).max(Y.id).optional(),header:L().min(1).max(Y.header),question:L().min(1).max(Y.question),options:W(yo).min(Y.minOptions).max(Y.maxOptions).refine(e=>new Set(e.map(e=>e.label)).size===e.length,{message:`option labels must be unique within a question`}).optional(),multiSelect:H().optional(),allowFreeText:H().optional()}).strict(),xo=G({context:vo.optional(),questions:W(bo).min(1).max(Y.questions).refine(e=>new Set(e.map(e=>e.question)).size===e.length,{message:`question texts must be unique`})}).strict(),So=q([`family`,`peer`]),Co=G({senderRunId:B(),recipientRunId:B(),kind:q([`request`,`progress`,`follow-up`,`reply`]),requestId:B().optional(),relationship:So.optional()}).strict(),X=Co.extend({id:B(),text:L().min(1).max(1e5),createdAt:N(),deadline:N().optional(),requestHash:L().regex(/^[0-9a-f]{64}$/),state:q([`accepted`,`continuation-required`,`destroyed`,`late`]),resumed:J(!0).optional(),instruction:L().max(2048).optional(),question:xo.optional()}),Z=G({requestId:B(),status:q([`replied`,`replied-late`,`completed-without-reply`,`failed`,`cancelled`,`destroyed`,`timed-out`,`sender-closed`,`human-fallback`,`deleted`]),observedAt:N(),replyId:B().optional()}).strict(),wo=G({messages:W(X).max(1024),outcomes:W(Z).max(1024)}).strict(),To=L().max(128).regex(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z)~([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i,`Not a history cursor; pass nextBefore from an earlier page`);wo.extend({hint:L().optional(),nextBefore:To.optional()}),G({messages:W(X).max(32),outcomes:W(Z).max(32),receiptId:B().optional(),expiresAt:N().optional()}).strict().refine(e=>e.messages.length>0?e.receiptId!==void 0&&e.expiresAt!==void 0:e.receiptId===void 0&&e.expiresAt===void 0,{message:`A nonempty inbox batch requires a receipt and expiry`}),G({receiptId:B()}).strict(),G({receiptId:B(),status:q([`acknowledged`,`already-acknowledged`,`released`])}).strict(),G({id:B(),recipientRunId:B(),kind:Co.shape.kind,requestId:B().optional(),text:L().min(1).max(1e5).refine(e=>e.trim().length>0),timeoutSeconds:V().int().min(1).max(86400).default(600),resume:H().optional()}).strict().refine(e=>e.timeoutSeconds<=7200||e.resume===!0&&e.kind===`request`,{path:[`timeoutSeconds`],message:`Only --resume requests accept deadlines above 7200 seconds (maximum 86400)`}).refine(e=>(e.kind===`reply`||e.kind===`follow-up`)==(e.requestId!==void 0),{message:`Replies and follow-ups require a request ID; new messages must omit it`}).refine(e=>!e.resume||e.kind===`request`||e.kind===`progress`,{message:`--resume requires a new request or progress instruction`});var Eo=q([`applied`,`unchanged`,`refused`,`unknown`]);G({message:X,delivery:q([`queued`,`delivered`,`consumed`,`not-delivered`]),outcome:Z.optional(),effect:Eo.optional()}).strict(),G({recipientRunId:B(),before:To.optional()}).strict(),G({requestId:B()}).strict(),G({requestIds:W(B()).min(1).max(32).refine(e=>new Set(e).size===e.length),mode:q([`one`,`any`,`all`]).optional(),timeoutSeconds:V().int().min(1).max(7200).default(600)}).strict().refine(e=>e.mode!==`one`||e.requestIds.length===1,{message:`one requires exactly one request`});var Do=G({receiptId:B(),generation:B(),expiresAt:N(),acknowledgedAt:N().optional(),memberIds:W(B()).min(1).max(32).refine(e=>new Set(e).size===e.length).optional()}).strict(),Oo=G({conversation:Co.optional(),id:B(),source:q([`agent`,`lifecycle`]),parentRunId:B(),text:L().min(1).max(1e5),createdAt:N(),deliveredAt:N().optional(),consumedAt:N().optional(),awaitingRead:J(!0).optional(),inboxClaim:Do.optional(),purpose:q([`completion-refusal`,`undelivered-question`]).optional(),requestHash:L().regex(/^[0-9a-f]{64}$/).optional(),deadline:N().optional()}).strict(),ko=G({workerId:B(),status:q([`review`,`done`,`failed`,`cancelled`]),observedAt:N(),summary:L().max(4e3).optional(),revision:V().int().nonnegative().optional()}).strict(),Ao=q([`one`,`any`,`all`]),Q=Fa({seq:V(),ts:L(),stepId:L().optional(),type:L()}),jo=Q.extend({type:J(`conversation-message`),message:X,delivery:q([`queued`,`delivered`,`consumed`,`not-delivered`]),deliveredAt:N().optional(),consumedAt:N().optional()}),Mo=Q.extend({type:J(`request-outcome`),outcome:Z}),No=Q.extend({type:J(`agent-input`),input:Oo}),Po=Q.extend({type:J(`human-input-delivered`),askSeq:V().int().nonnegative(),source:q([`human`,`parent`,`cezar`]).optional()}),Fo=Q.extend({type:J(`human-ask-closed`),askSeq:V().int().nonnegative(),reason:q([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`])});Q.extend({type:J(`worker-question-routed`),askSeq:V().int().nonnegative(),messageId:B(),parentRunId:B()}),Q.extend({type:J(`worker-question-fallback`),askSeq:V().int().nonnegative(),reason:L().min(1).max(200)}),Q.extend({type:J(`worker-question-undelivered`),askSeq:V().int().nonnegative(),reason:L().min(1).max(200)}),Q.extend({type:J(`worker-outcome`),outcome:ko});var Io=G({id:L().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)}),$=L().min(1).max(2048);G({cursor:$.optional()}),G({cursor:$.optional(),afterSeq:_o().int().nonnegative().optional()});var Lo=G({seq:V(),ts:L(),stepId:L().optional(),type:L()}).catchall(Oa()),Ro=G({events:W(Lo),itemCount:V().int().min(0).max(100),olderCursor:$.optional(),newerCursor:$.optional(),liveCursor:$,asOfSeq:V().int().nonnegative(),hasOlder:H()}),zo=G({contextEvents:W(Lo),asOfSeq:V().int().nonnegative()}),Bo=G({checkoutId:L().optional(),name:L(),phase:q([`cloning`,`done`,`error`]),line:L().optional(),error:L().optional(),warning:L().optional()}),Vo=1024*1024,Ho=G({projectId:L().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/),runId:Io.shape.id,cursor:$.optional(),afterSeq:V().int().nonnegative().safe()});G({runs:W(Ho).min(1).max(32)}).refine(({runs:e})=>new Set(e.map(e=>`${e.projectId}/${e.runId}`)).size===e.length,{message:`duplicate run demand`});var Uo=Ho.pick({projectId:!0,runId:!0}),Wo=Uo.extend({type:q([`error`,`reset`]),status:K([J(400),J(404),J(409),J(413),J(503)]),error:L()}),Go=K([Uo.extend({type:J(`batch`),events:W(Lo).max(256),cursor:$,afterSeq:V().int().nonnegative(),hasMore:H()}),Wo]),Ko=G({generation:L(),results:W(Go)}),qo=K([G({type:J(`ready`),generation:L()}),G({type:J(`ping`)}),Uo.extend({type:J(`event`),name:q([`run-event`,`ui-event`]),event:Lo}),Wo]),Jo=`cezar-live-v3`,Yo=15e3,Xo=5e3;function Zo(e){return!e.startsWith(`/api/v1/`)||e.includes(`#`)||/[\\\r\n]/.test(e)?!1:/^\/api\/v1\/(?:workspace\/(?:runs-index|activity)|p\/[a-zA-Z0-9_-]+\/(?:reports\/state|runs\/[a-zA-Z0-9._-]+\/(?:changes|commits)|github(?:\/(?:checks|ref-status))?))(?:\?[^#]*)?$/.test(e)}var Qo=Ra(`kind`,[G({kind:J(`workspace`)}),Ho.extend({kind:J(`run`)}),G({kind:J(`topic`),topic:L().min(1).max(128)}),G({kind:J(`read`),path:L().max(4096).refine(Zo),intervalMs:V().int().min(1e3).max(2147483647)})]),$o=G({id:L().min(1).max(128),demand:Qo}),es=G({version:J(3),documentId:L().min(1).max(128),epoch:V().int().nonnegative()}),ts=Ra(`type`,[es.extend({type:J(`sync`),entries:W($o).max(64),workspaceReady:J(!0).optional()}).refine(e=>new Set(e.entries.map(e=>e.id)).size===e.entries.length),es.extend({type:J(`ack`),id:L(),seq:V().int().nonnegative()}),es.extend({type:J(`refresh`),id:L()})]),ns=G({event:L(),data:L(),id:L()}),rs=Ra(`type`,[G({type:J(`unavailable`),version:J(3),epoch:V(),reason:L()}),G({type:J(`hello`),version:J(3)}),G({type:J(`alive`),version:J(3),epoch:V()}),G({type:J(`frame`),version:J(3),epoch:V(),id:L(),frame:K([ns,qo])}),G({type:J(`value`),version:J(3),epoch:V(),id:L(),value:U(),error:L().optional()}),G({type:J(`reset`),version:J(3),epoch:V(),id:L(),reason:L()})]),is=e=>`${e.projectId}/${e.runId}`,as=`live channel refused`;export{Ea as A,Ha as B,Oo as C,xo as D,vo as E,Fa as F,aa as G,L as H,ja as I,a as J,B as K,V as L,H as M,Ra as N,_o as O,J as P,G as R,Ao as S,Z as T,K as U,Pa as V,U as W,t as Y,Po as _,Zo as a,Ro as b,rs as c,qo as d,Vo as f,Fo as g,jo as h,Xo as i,W as j,q as k,is as l,Bo as m,Yo as n,Qo as o,No as p,N as q,Jo as r,ts as s,as as t,Ko as u,Mo as v,wo as w,ko as x,zo as y,go as z};
|
|
@@ -2,8 +2,10 @@ import { liveRunFrameSchema } from '@open-mercato/cezar-api-client/contract/live
|
|
|
2
2
|
import { createLiveOwner, type LivePort } from './live-owner'
|
|
3
3
|
import { createTopicSocket } from './topic-socket'
|
|
4
4
|
import { readSse } from './sse-reader'
|
|
5
|
+
import { LIVE_CONNECT_ATTEMPTS } from './live-protocol'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
// The owner is created below; the socket reports a refusal only after its first attempts fail.
|
|
8
|
+
const topicSocket = createTopicSocket(undefined, { connectAttempts: LIVE_CONNECT_ATTEMPTS, onRefused: () => owner.refuse() })
|
|
7
9
|
const owner = createLiveOwner({
|
|
8
10
|
async stream(kind, runs, frame, signal) {
|
|
9
11
|
// The workspace lane reads list rows (hearsay-tools/cezarion#2730); `LIVE_WORKER_NAME` changed with it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,S as i,d as a,w as o}from"./button-C1fD-ZFr.js";import{i as s}from"./bundle-mjs-BT31bpU6.js";import{G as c,J as l,K as u,W as d,dt as f,ft as ee,gt as p,ht as m,lt as h,mt as g,pt as te,ut as ne}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,S as i,d as a,w as o}from"./button-C1fD-ZFr.js";import{i as s}from"./bundle-mjs-BT31bpU6.js";import{G as c,J as l,K as u,W as d,dt as f,ft as ee,gt as p,ht as m,lt as h,mt as g,pt as te,ut as ne}from"./index-DPA7Ibhf.js";import{i as re,n as _}from"./chunk-BO2N2NFS-CM5F_Wdn.js";var v=e(t(),1),y=n();function b({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,y.jsx)(h,{open:e,onOpenChange:e=>{e||t()},children:(0,y.jsxs)(ee,{"data-slot":`link-safety-dialog`,children:[(0,y.jsxs)(m,{children:[(0,y.jsx)(p,{children:`Open this link?`}),(0,y.jsxs)(te,{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,y.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,y.jsxs)(g,{children:[(0,y.jsx)(f,{children:`Cancel`}),(0,y.jsx)(ne,{onClick:n,children:`Open link`})]})]})})}var x=String.raw`https?:\/\/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/`,ie=[{id:`tailwind-v3`,script:/^https?:\/\/cdn\.tailwindcss\.com(?:\/[\d.]+)?\/?(?:[?#]|$)/i},{id:`tailwind`,script:new RegExp(String.raw`^${x}@tailwindcss\/browser@4(?:\.[.\d]*)?(?:\/dist\/index\.global(?:\.min)?\.js)?\/?(?:[?#]|$)`,`i`)},{id:`mermaid`,script:new RegExp(String.raw`^${x}mermaid@11(?:\.[.\d]*)?\/dist\/mermaid(?:\.esm)?(?:\.min)?\.m?js(?:[?#]|$)`,`i`)}],S=new RegExp(String.raw`(['"])(${x}mermaid@11(?:\.[.\d]*)?(?:\/dist\/mermaid(?:\.esm)?(?:\.min)?\.mjs|\/\+esm)?)\1`,`gi`);function C(e){let t=e.trim();return ie.find(e=>e.script.test(t))?.id??null}function w(e){let t=new DOMParser().parseFromString(e,`text/html`),n=new Set;for(let e of t.querySelectorAll(`script`)){let t=e.getAttribute(`src`),r=t===null?null:C(t);r&&n.add(r===`tailwind-v3`?`tailwind`:r).add(r),t===null&&e.getAttribute(`type`)===`module`&&(e.textContent??``).search(S)>=0&&n.add(`mermaid`),S.lastIndex=0}return[...n].sort()}var T={tailwind:async()=>(await s(()=>import(`./index.global-D3Ga_D3Y.js`),[])).default,"tailwind-v3":()=>Promise.resolve(se),mermaid:async()=>(await s(()=>import(`./mermaid.min-3O9YjB2l.js`),[])).default};async function E(e){let t=await Promise.all(e.map(e=>T[e]().then(t=>[e,t],()=>null)));return Object.fromEntries(t.filter(e=>e!==null))}function ae(){let e={colors:`color`,fontFamily:`font`,fontSize:`text`,fontWeight:`font-weight`,spacing:`spacing`,borderRadius:`radius`,boxShadow:`shadow`,dropShadow:`drop-shadow`,blur:`blur`,screens:`breakpoint`,letterSpacing:`tracking`,lineHeight:`leading`,maxWidth:`container`,animation:`animate`,aspectRatio:`aspect`},t=e=>typeof e==`object`&&!!e&&!Array.isArray(e),n=t=>Object.hasOwn(e,t)?e[t]:void 0,r=(e,n,i,a)=>{if(t(a)){for(let[t,o]of Object.entries(a))r(e,n,t===`DEFAULT`?i:i?`${i}-${t}`:t,o);return}let o=i?`--${n}-${i}`:`--${n}`;if(n===`text`&&Array.isArray(a)){e.push(`${o}: ${String(a[0])};`);let n=t(a[1])?a[1].lineHeight:a[1];typeof n==`string`&&e.push(`${o}--line-height: ${n};`);return}typeof a==`string`||typeof a==`number`?e.push(`${o}: ${a};`):Array.isArray(a)&&e.push(`${o}: ${a.join(`, `)};`)},i=e=>{let[t,n]=Array.isArray(e)?e:[e];if(t!==`class`&&t!==`selector`)return``;let r=typeof n==`string`?n:`.dark`;return`@custom-variant dark (&:where(${r}, ${r} *));\n`},a=e=>{let a=t(e)?e:{},o=t(a.theme)?a.theme:{},s=[];for(let[e,t]of Object.entries(o)){let i=n(e);i&&(s.push(`--${i}-*: initial;`),r(s,i,``,t))}for(let[e,i]of Object.entries(t(o.extend)?o.extend:{})){let t=n(e);t&&r(s,t,``,i)}return`${i(a.darkMode)}@theme {\n${s.join(`
|
|
2
2
|
`)}\n}`},o=document.createElement(`style`);o.setAttribute(`type`,`text/tailwindcss`),document.currentScript?.before(o);let s={};Object.defineProperty(globalThis,"tailwind",{configurable:!0,value:{get config(){return s},set config(e){s=e,o.textContent=a(e)}}})}var oe=`(${ae.toString()})()`,se=[`@import "tailwindcss/theme.css";@import "tailwindcss/preflight.css";@import "tailwindcss/utilities.css";`,`@theme{`,`--color-slate-50:#f8fafc;--color-slate-100:#f1f5f9;--color-slate-200:#e2e8f0;--color-slate-300:#cbd5e1;--color-slate-400:#94a3b8;--color-slate-500:#64748b;--color-slate-600:#475569;--color-slate-700:#334155;--color-slate-800:#1e293b;--color-slate-900:#0f172a;--color-slate-950:#020617;`,`--color-gray-50:#f9fafb;--color-gray-100:#f3f4f6;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5db;--color-gray-400:#9ca3af;--color-gray-500:#6b7280;--color-gray-600:#4b5563;--color-gray-700:#374151;--color-gray-800:#1f2937;--color-gray-900:#111827;--color-gray-950:#030712;`,`--color-zinc-50:#fafafa;--color-zinc-100:#f4f4f5;--color-zinc-200:#e4e4e7;--color-zinc-300:#d4d4d8;--color-zinc-400:#a1a1aa;--color-zinc-500:#71717a;--color-zinc-600:#52525b;--color-zinc-700:#3f3f46;--color-zinc-800:#27272a;--color-zinc-900:#18181b;--color-zinc-950:#09090b;`,`--color-neutral-50:#fafafa;--color-neutral-100:#f5f5f5;--color-neutral-200:#e5e5e5;--color-neutral-300:#d4d4d4;--color-neutral-400:#a3a3a3;--color-neutral-500:#737373;--color-neutral-600:#525252;--color-neutral-700:#404040;--color-neutral-800:#262626;--color-neutral-900:#171717;--color-neutral-950:#0a0a0a;`,`--color-stone-50:#fafaf9;--color-stone-100:#f5f5f4;--color-stone-200:#e7e5e4;--color-stone-300:#d6d3d1;--color-stone-400:#a8a29e;--color-stone-500:#78716c;--color-stone-600:#57534e;--color-stone-700:#44403c;--color-stone-800:#292524;--color-stone-900:#1c1917;--color-stone-950:#0c0a09;`,`--color-red-50:#fef2f2;--color-red-100:#fee2e2;--color-red-200:#fecaca;--color-red-300:#fca5a5;--color-red-400:#f87171;--color-red-500:#ef4444;--color-red-600:#dc2626;--color-red-700:#b91c1c;--color-red-800:#991b1b;--color-red-900:#7f1d1d;--color-red-950:#450a0a;`,`--color-orange-50:#fff7ed;--color-orange-100:#ffedd5;--color-orange-200:#fed7aa;--color-orange-300:#fdba74;--color-orange-400:#fb923c;--color-orange-500:#f97316;--color-orange-600:#ea580c;--color-orange-700:#c2410c;--color-orange-800:#9a3412;--color-orange-900:#7c2d12;--color-orange-950:#431407;`,`--color-amber-50:#fffbeb;--color-amber-100:#fef3c7;--color-amber-200:#fde68a;--color-amber-300:#fcd34d;--color-amber-400:#fbbf24;--color-amber-500:#f59e0b;--color-amber-600:#d97706;--color-amber-700:#b45309;--color-amber-800:#92400e;--color-amber-900:#78350f;--color-amber-950:#451a03;`,`--color-yellow-50:#fefce8;--color-yellow-100:#fef9c3;--color-yellow-200:#fef08a;--color-yellow-300:#fde047;--color-yellow-400:#facc15;--color-yellow-500:#eab308;--color-yellow-600:#ca8a04;--color-yellow-700:#a16207;--color-yellow-800:#854d0e;--color-yellow-900:#713f12;--color-yellow-950:#422006;`,`--color-lime-50:#f7fee7;--color-lime-100:#ecfccb;--color-lime-200:#d9f99d;--color-lime-300:#bef264;--color-lime-400:#a3e635;--color-lime-500:#84cc16;--color-lime-600:#65a30d;--color-lime-700:#4d7c0f;--color-lime-800:#3f6212;--color-lime-900:#365314;--color-lime-950:#1a2e05;`,`--color-green-50:#f0fdf4;--color-green-100:#dcfce7;--color-green-200:#bbf7d0;--color-green-300:#86efac;--color-green-400:#4ade80;--color-green-500:#22c55e;--color-green-600:#16a34a;--color-green-700:#15803d;--color-green-800:#166534;--color-green-900:#14532d;--color-green-950:#052e16;`,`--color-emerald-50:#ecfdf5;--color-emerald-100:#d1fae5;--color-emerald-200:#a7f3d0;--color-emerald-300:#6ee7b7;--color-emerald-400:#34d399;--color-emerald-500:#10b981;--color-emerald-600:#059669;--color-emerald-700:#047857;--color-emerald-800:#065f46;--color-emerald-900:#064e3b;--color-emerald-950:#022c22;`,`--color-teal-50:#f0fdfa;--color-teal-100:#ccfbf1;--color-teal-200:#99f6e4;--color-teal-300:#5eead4;--color-teal-400:#2dd4bf;--color-teal-500:#14b8a6;--color-teal-600:#0d9488;--color-teal-700:#0f766e;--color-teal-800:#115e59;--color-teal-900:#134e4a;--color-teal-950:#042f2e;`,`--color-cyan-50:#ecfeff;--color-cyan-100:#cffafe;--color-cyan-200:#a5f3fc;--color-cyan-300:#67e8f9;--color-cyan-400:#22d3ee;--color-cyan-500:#06b6d4;--color-cyan-600:#0891b2;--color-cyan-700:#0e7490;--color-cyan-800:#155e75;--color-cyan-900:#164e63;--color-cyan-950:#083344;`,`--color-sky-50:#f0f9ff;--color-sky-100:#e0f2fe;--color-sky-200:#bae6fd;--color-sky-300:#7dd3fc;--color-sky-400:#38bdf8;--color-sky-500:#0ea5e9;--color-sky-600:#0284c7;--color-sky-700:#0369a1;--color-sky-800:#075985;--color-sky-900:#0c4a6e;--color-sky-950:#082f49;`,`--color-blue-50:#eff6ff;--color-blue-100:#dbeafe;--color-blue-200:#bfdbfe;--color-blue-300:#93c5fd;--color-blue-400:#60a5fa;--color-blue-500:#3b82f6;--color-blue-600:#2563eb;--color-blue-700:#1d4ed8;--color-blue-800:#1e40af;--color-blue-900:#1e3a8a;--color-blue-950:#172554;`,`--color-indigo-50:#eef2ff;--color-indigo-100:#e0e7ff;--color-indigo-200:#c7d2fe;--color-indigo-300:#a5b4fc;--color-indigo-400:#818cf8;--color-indigo-500:#6366f1;--color-indigo-600:#4f46e5;--color-indigo-700:#4338ca;--color-indigo-800:#3730a3;--color-indigo-900:#312e81;--color-indigo-950:#1e1b4b;`,`--color-violet-50:#f5f3ff;--color-violet-100:#ede9fe;--color-violet-200:#ddd6fe;--color-violet-300:#c4b5fd;--color-violet-400:#a78bfa;--color-violet-500:#8b5cf6;--color-violet-600:#7c3aed;--color-violet-700:#6d28d9;--color-violet-800:#5b21b6;--color-violet-900:#4c1d95;--color-violet-950:#2e1065;`,`--color-purple-50:#faf5ff;--color-purple-100:#f3e8ff;--color-purple-200:#e9d5ff;--color-purple-300:#d8b4fe;--color-purple-400:#c084fc;--color-purple-500:#a855f7;--color-purple-600:#9333ea;--color-purple-700:#7e22ce;--color-purple-800:#6b21a8;--color-purple-900:#581c87;--color-purple-950:#3b0764;`,`--color-fuchsia-50:#fdf4ff;--color-fuchsia-100:#fae8ff;--color-fuchsia-200:#f5d0fe;--color-fuchsia-300:#f0abfc;--color-fuchsia-400:#e879f9;--color-fuchsia-500:#d946ef;--color-fuchsia-600:#c026d3;--color-fuchsia-700:#a21caf;--color-fuchsia-800:#86198f;--color-fuchsia-900:#701a75;--color-fuchsia-950:#4a044e;`,`--color-pink-50:#fdf2f8;--color-pink-100:#fce7f3;--color-pink-200:#fbcfe8;--color-pink-300:#f9a8d4;--color-pink-400:#f472b6;--color-pink-500:#ec4899;--color-pink-600:#db2777;--color-pink-700:#be185d;--color-pink-800:#9d174d;--color-pink-900:#831843;--color-pink-950:#500724;`,`--color-rose-50:#fff1f2;--color-rose-100:#ffe4e6;--color-rose-200:#fecdd3;--color-rose-300:#fda4af;--color-rose-400:#fb7185;--color-rose-500:#f43f5e;--color-rose-600:#e11d48;--color-rose-700:#be123c;--color-rose-800:#9f1239;--color-rose-900:#881337;--color-rose-950:#4c0519;`,`--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";`,`--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;`,`--text-xs--line-height:1rem;--text-sm--line-height:1.25rem;--text-base--line-height:1.5rem;--text-lg--line-height:1.75rem;`,`--text-xl--line-height:1.75rem;--text-2xl--line-height:2rem;--text-3xl--line-height:2.25rem;--text-4xl--line-height:2.5rem;`,`--shadow-sm:0 1px 2px 0 rgb(0 0 0 / 0.05);--radius-sm:0.125rem;--blur-sm:4px;`,`}`,`body{line-height:inherit}`,`*,::after,::before,::backdrop,::file-selector-button{border-color:var(--color-gray-200,currentColor)}`,`input::placeholder,textarea::placeholder{color:var(--color-gray-400)}`,`button:not(:disabled),[role="button"]:not(:disabled){cursor:pointer}`].join(`
|
|
3
3
|
`),D=`default-src 'none'; script-src 'unsafe-inline' data:; img-src data:; media-src data:; font-src data:; style-src 'unsafe-inline' data:; form-action 'none'; base-uri 'none'`,ce=`${D}; frame-src 'none'`,O=`allow-scripts allow-popups allow-popups-to-escape-sandbox`,k=`clipboard-write`,A=`data:text/javascript,export%20default%20globalThis.mermaid`;function j(e){return/\.html?$/i.test(e)}var M=/^(?:https?:|mailto:)/i,N=/^data:/i,P=`http://www.w3.org/1999/xlink`,F=/^(?:[a-z][a-z\d+.-]*:|\/\/)/i,I=/url\(\s*(['"]?)([^'")]*)\1\s*\)|@import\s+(['"])([^'"]+)\3/gi,L=[`src`,`href`,`xlink:href`,`poster`,`background`],R=/(?:^|,)\s*(data:\S+|[^,\s]+)/gi,z=/\b(?:preconnect|dns-prefetch|prefetch|preload|modulepreload|prerender)\b/i;function B(e,t){let n=e.trim();!n||n.startsWith(`#`)||N.test(n)||(F.test(n)?t.remote++:t.relative++)}function V(e,t){for(let n of e.matchAll(I))B(n[2]??n[4]??``,t)}function H(e,t){let n=e.createElement(`script`);return n.textContent=t.replace(/<\/script/gi,`<\\/script`),n}function U(e,t){let n=e.createElement(`style`);return n.setAttribute(`type`,`text/tailwindcss`),n.textContent=t,n}var W=`http://www.w3.org/2000/svg`;function G(e){return e.namespaceURI===W?e.getAttribute(`href`)??e.getAttributeNS(P,`href`):e.getAttribute(`src`)}function le(e,t,n,r){let i=r===void 0?[]:[U(e,r),H(e,oe)],a=H(e,n),o=t.hasAttribute(`defer`)||t.hasAttribute(`async`)||t.getAttribute(`type`)===`module`;o&&e.body.append(a),t.replaceWith(...i,...o?[]:[a])}function K(e,t,n){let r=new Set,i=new Set;for(let a of[...e.querySelectorAll(`script`)]){let o=G(a);if(o!==null&&N.test(o.trim()))continue;if(o===null){if(a.getAttribute(`type`)===`module`)for(let e of(a.textContent??``).matchAll(S))i.add(e[2]);continue}let s=C(o),c=s===`tailwind-v3`?`tailwind`:s,l=c?n[c]:void 0;if(!c||l===void 0||s===`tailwind-v3`&&n[`tailwind-v3`]===void 0){t.scripts++,a.remove();continue}if(r.has(c)){a.remove();continue}r.add(c),le(e,a,l,s===`tailwind-v3`?n[`tailwind-v3`]:void 0)}if(!i.size)return;if(n.mermaid===void 0){t.scripts+=i.size;return}let a=e.createElement(`script`);a.setAttribute(`type`,`importmap`),a.textContent=JSON.stringify({imports:Object.fromEntries([...i].map(e=>[e,A]))}),e.head.prepend(a,...r.has(`mermaid`)?[]:[H(e,n.mermaid)])}function ue(e,t,n){let r=t=>{let n=[...e.querySelectorAll(t)];return n.forEach(e=>e.remove()),n.length};K(e,t,n),t.embeds=r(`iframe, frame, frameset, object, embed, portal`),r(`base, meta[http-equiv]`);for(let t of e.querySelectorAll(`link`))z.test(t.getAttribute(`rel`)??``)&&t.remove();for(let t of e.querySelectorAll(`[ping]`))t.removeAttribute(`ping`);for(let n of e.querySelectorAll(`form`))t.forms++,n.removeAttribute(`action`);for(let t of e.querySelectorAll(`[formaction]`))t.removeAttribute(`formaction`)}function de(e,t){for(let n of e.querySelectorAll(`a, area`)){let e=n.getAttribute(`href`)??n.getAttributeNS(P,`href`);if(e===null)continue;let r=e.trim();if(r.startsWith(`#`)){n.setAttribute(`href`,`about:srcdoc${r}`),n.removeAttributeNS(P,`href`),n.removeAttribute(`target`);continue}if(M.test(r)){n.setAttribute(`target`,`_blank`),n.setAttribute(`rel`,`noopener noreferrer`);continue}F.test(r)||t.relative++,n.removeAttribute(`href`),n.removeAttributeNS(P,`href`),n.removeAttribute(`target`)}}function fe(e,t){for(let n of e.querySelectorAll(`[style]`))V(n.getAttribute(`style`),t);for(let n of e.querySelectorAll(`style`))/^(?:text\/css)?$/i.test(n.getAttribute(`type`)?.trim()??``)&&V(n.textContent??``,t);for(let n of e.querySelectorAll(`link[href]`))B(n.getAttribute(`href`),t);for(let n of e.querySelectorAll(`img, source, video, audio, track, input, image, use, body, table, td`)){for(let e of L){let r=n.getAttribute(e);r!==null&&B(r,t)}for(let e of(n.getAttribute(`srcset`)??``).matchAll(R))B(e[1],t)}}function pe(e,t={}){let n=new DOMParser().parseFromString(e,`text/html`),r={scripts:0,remote:0,relative:0,forms:0,embeds:0};ue(n,r,t),de(n,r),fe(n,r);let i=n.createElement(`meta`);i.setAttribute(`http-equiv`,`Content-Security-Policy`),i.setAttribute(`content`,D);let a=n.createElement(`meta`);return a.setAttribute(`name`,`referrer`),a.setAttribute(`content`,`no-referrer`),n.head.prepend(i,a),{srcdoc:`<!DOCTYPE html>${n.documentElement.outerHTML}`,blocked:r}}var q=e=>e.replace(/&/g,`&`).replace(/"/g,`"`);function me(e,t){return`<!DOCTYPE html><html><head><meta http-equiv="Content-Security-Policy" content="${ce}"><meta name="referrer" content="no-referrer"><style>html,body{margin:0;height:100%;overflow:hidden}iframe{display:block;border:0;width:100%;height:100%}</style></head><body><iframe title="${q(t)}" sandbox="${O}" allow="${k}" referrerpolicy="no-referrer" srcdoc="${q(e)}"></iframe></body></html>`}var J=(0,v.createContext)(null),he=/^[0-9a-f-]{36}$/i,ge=/^(\/p\/[^/?#]+\/tasks\/[^/?#]+)\/files\?(artifact=[^&#]*)$/;function Y(e){let t=new URLSearchParams(e);return[...t.keys()].length===1&&he.test(t.get(`artifact`)??``)}function _e(e,t,n){if(e.startsWith(`${t}?artifact=`))return Y(e.slice(t.length+1))?n+e.slice(t.length):null;let r=ge.exec(e);return r&&Y(r[2])?`${r[1]}/report?${r[2]}`:void 0}var ve=/^\/(?:api|p|tasks|new|settings|skills|workflows|git|github|inbox|automations)(?:\/|[?#]|$)/;function ye(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 X(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=_e(r,o,a+s);if(c!==void 0)return c===null?null:c+i;if(ve.test(r))return null;let l=ye(r,t.basePath);return l===null?null:`${a}${j(l)?s:o}?path=${encodeURIComponent(l)}${i}`}var Z=`text-accent-text underline underline-offset-2`;function be({href:e,children:t,internal:n,...r}){let[a,o]=(0,v.useState)(!1),s=i();return e?n?s?(0,y.jsx)(xe,{...r,href:e,children:t}):(0,y.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:Z,children:t}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`cursor-pointer ${Z}`,onClick:e=>{e.preventDefault(),o(!0)},children:t}),(0,y.jsx)(b,{isOpen:a,url:e,onClose:()=>o(!1),onConfirm:()=>{window.open(e,`_blank`,`noreferrer`),o(!1)}})]}):(0,y.jsx)(`span`,{children:t})}function xe({href:e,children:t,...n}){let i=o(),a=r();return(0,y.jsx)(`a`,{...n,href:e,"data-streamdown":`link`,className:Z,onClick:t=>Q(t,i,e,a),children:t})}function Q(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 Se={name:`shiki`,type:`code-highlighter`,getThemes:()=>[d,d],getSupportedLanguages:()=>l(),supportsLanguage:e=>l().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>u(e,String(t))||(c(e,String(t)).then(e=>n?.(e)),null)};function Ce(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
|
|
4
4
|
`)){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 $=[...Object.values(_),Ce],we=[`p`,`strong`,`em`,`del`,`code`,`a`],Te={p:`span`,a:`span`},Ee={enabled:!0,renderModal:e=>(0,y.jsx)(b,{...e})},De=`https://refused.invalid/`,Oe=0,ke=(0,v.memo)(function({children:e,breaks:t=!1,inline:n=!1,document:r=!1,imageSrc:i}){let o=(0,v.useContext)(J),s=(0,v.useMemo)(()=>{let e={instance:++Oe},n=new Set;function a(){let e=t=>{if((t.type===`link`||t.type===`definition`)&&t.url&&o){let e=X(t.url,o);e&&(t.url=e,n.add(e))}t.children?.forEach(e)};return e}let s=new Set;function c(){let e=t=>{if(t.type===`image`&&t.url&&i){let e=i(t.url);t.url=e?new URL(e,window.location.href).href:De,e&&s.add(t.url)}t.children?.forEach(e)};return e}let l=o?[[a,e]]:[],u=r&&i?[[c,e]]:[];return{remark:[...t?$:Object.values(_),...l,...u],components:{...o||r?{a:({href:e,children:t})=>r&&!o&&!/^(?:https?:|mailto:|#)/i.test(e??``)?(0,y.jsx)(`span`,{children:t}):(0,y.jsx)(be,{href:e,internal:n.has(e??``),children:t})}:{},...r?{img:({src:e,alt:t})=>typeof e==`string`&&s.has(e)?(0,y.jsx)(`img`,{src:e,alt:t??``,loading:`lazy`}):(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`[Image: `,t||`embedded image`,`]`]})}:{}}}},[o,t,r,i]);return(0,y.jsx)(re,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:{code:Se},shikiTheme:[d,d],...a({remarkPlugins:o||r&&i?s.remark:t?$:void 0,allowedElements:n?we:void 0,unwrapDisallowed:n||void 0,components:n?Te:o||r?s.components:void 0}),linkSafety:Ee,controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});export{k as a,pe as c,E as d,X as i,me as l,Q as n,O as o,J as r,j as s,ke as t,w as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,l as i,o as a}from"./button-C1fD-ZFr.js";import"./project-scope-context-DMCS5p-N.js";import{a as o,i as s,n as c,r as l,s as u}from"./runners-C-sPUQye.js";import{X as d,l as f}from"./design-icons-B6-0w7Aw.js";import{h as p,l as m}from"./es2015-Ch36azR0.js";import{c as h,i as g,p as _,r as v,s as y,t as ee}from"./dropdown-menu-DRFDwG2X.js";import{a as b,o as x,r as S,t as C}from"./dist-Du8mGhoH.js";import{i as w,o as T,r as E,s as D,t as O}from"./dialog-DSwzMeY3.js";var k=e(t(),1),A=1,j=.9,M=.8,N=.17,P=.1,F=.999,I=.9999,L=.99,R=/[\\\/_+.#"@\[\(\{&]/,z=/[\\\/_+.#"@\[\(\{&]/g,te=/[\s-]/,ne=/[\s-]/g;function B(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?A:L;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=B(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=A:R.test(e.charAt(l-1))?(d*=M,p=e.slice(i,l-1).match(z),p&&i>0&&(d*=F**+p.length)):te.test(e.charAt(l-1))?(d*=j,m=e.slice(i,l-1).match(ne),m&&i>0&&(d*=F**+m.length)):(d*=N,i>0&&(d*=F**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=I)),(d<P&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=B(e,t,n,r,l+1,a+2,o),f*P>d&&(d=f*P)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function re(e){return e.toLowerCase().replace(ne,` `)}function ie(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,B(e,t,re(e),re(t),0,0,{})}var V=`[cmdk-group=""]`,ae=`[cmdk-group-items=""]`,oe=`[cmdk-group-heading=""]`,se=`[cmdk-item=""]`,ce=`${se}:not([aria-disabled="true"])`,H=`cmdk-item-select`,U=`data-value`,le=(e,t,n)=>ie(e,t,n),ue=k.createContext(void 0),W=()=>k.useContext(ue),de=k.createContext(void 0),G=()=>k.useContext(de),fe=k.createContext(void 0),pe=k.forwardRef((e,t)=>{let n=J(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=J(()=>new Set),i=J(()=>new Map),a=J(()=>new Map),o=J(()=>new Set),s=we(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,ee=m(),b=m(),x=m(),S=k.useRef(null),C=Ee();q(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),q(()=>{C(6,j)},[]);let w=k.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(ee))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=M()?.id,w.emit()}),r||C(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=k.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{A(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();C(4,()=>{A(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:ee,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??le;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ae);t?t.appendChild(e.parentElement===t?e:e.closest(`${ae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ae} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${V}[${U}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(U);w.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(V)?.querySelector(oe))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return S.current?.querySelector(`${se}[aria-selected="true"]`)}function N(){return Array.from(S.current?.querySelectorAll(ce)||[])}function P(e){let t=N()[e];t&&w.setState(`value`,t.getAttribute(U))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(U))}function I(e){let t=M()?.closest(V),n;for(;t&&!n;)t=e>0?Se(t,V):Ce(t,V),n=t?.querySelector(ce);n?w.setState(`value`,n.getAttribute(U)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return k.createElement(p.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(H);t.dispatchEvent(e)}}}}},k.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Oe},c),X(e,e=>k.createElement(de.Provider,{value:w},k.createElement(ue.Provider,{value:T},e))))}),me=k.forwardRef((e,t)=>{let n=m(),r=k.useRef(null),i=k.useContext(fe),o=W(),s=we(e),c=s.current?.forceMount??i?.forceMount;q(()=>{if(!c)return o.item(n,i?.id)},[c]);let l=Te(n,r,[e.value,e.children,r],e.keywords),u=G(),d=Y(e=>e.value&&e.value===l.current),f=Y(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);k.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(H,h),()=>t.removeEventListener(H,h)},[f,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function g(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:_,value:v,onSelect:y,forceMount:ee,keywords:b,...x}=e;return k.createElement(p.div,{ref:a(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!d,"data-disabled":!!_,"data-selected":!!d,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),he=k.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=m(),c=k.useRef(null),l=k.useRef(null),u=m(),d=W(),f=Y(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));q(()=>d.group(s),[]),Te(s,c,[e.value,e.heading,l]);let h=k.useMemo(()=>({id:s,forceMount:i}),[i]);return k.createElement(p.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&k.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),X(e,e=>k.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},k.createElement(fe.Provider,{value:h},e))))}),ge=k.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=k.useRef(null),o=Y(e=>!e.search);return!n&&!o?null:k.createElement(p.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),_e=k.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=G(),o=Y(e=>e.search),s=Y(e=>e.selectedItemId),c=W();return k.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),k.createElement(p.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ve=k.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=k.useRef(null),s=k.useRef(null),c=Y(e=>e.selectedItemId),l=W();return k.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),k.createElement(p.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:l.listId},X(e,e=>k.createElement(`div`,{ref:a(s,l.listInnerRef),"cmdk-list-sizer":``},e)))}),ye=k.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return k.createElement(C,{open:n,onOpenChange:r},k.createElement(x,{container:o},k.createElement(b,{"cmdk-overlay":``,className:i}),k.createElement(S,{"aria-label":e.label,"cmdk-dialog":``,className:a},k.createElement(pe,{ref:t,...s}))))}),be=k.forwardRef((e,t)=>Y(e=>e.filtered.count===0)?k.createElement(p.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),xe=k.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return k.createElement(p.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},X(e,e=>k.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(pe,{List:ve,Item:me,Input:_e,Group:he,Separator:ge,Dialog:ye,Empty:be,Loading:xe});function Se(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ce(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function we(e){let t=k.useRef(e);return q(()=>{t.current=e}),t}var q=typeof window>`u`?k.useEffect:k.useLayoutEffect;function J(e){let t=k.useRef();return t.current===void 0&&(t.current=e()),t}function Y(e){let t=G(),n=()=>e(t.snapshot());return k.useSyncExternalStore(t.subscribe,n,n)}function Te(e,t,n,r=[]){let i=k.useRef(),a=W();return q(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(U,s),i.current=s}),i}var Ee=()=>{let[e,t]=k.useState(),n=J(()=>new Map);return q(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function De(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function X({asChild:e,children:t},n){return e&&k.isValidElement(t)?k.cloneElement(De(t),{ref:t.ref},n(t.props.children)):n(t)}var Oe={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Z=n();function ke({className:e,...t}){return(0,Z.jsx)(K,{"data-slot":`command`,className:i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function Ae({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:a,showCloseButton:o=!0,filter:s,...c}){return(0,Z.jsxs)(O,{...c,children:[(0,Z.jsxs)(T,{className:`sr-only`,children:[(0,Z.jsx)(D,{children:e}),(0,Z.jsx)(w,{children:t})]}),(0,Z.jsx)(E,{className:i(`overflow-hidden p-0`,a),showCloseButton:o,children:(0,Z.jsx)(ke,{...r({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function je({className:e,...t}){return(0,Z.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,Z.jsx)(d,{className:`size-4 shrink-0 opacity-50`}),(0,Z.jsx)(K.Input,{"data-slot":`command-input`,className:i(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Me({className:e,onPointerMoveCapture:t,...n}){return(0,Z.jsx)(K.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:i(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Ne({...e}){return(0,Z.jsx)(K.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Pe({className:e,...t}){return(0,Z.jsx)(K.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Fe({className:e,...t}){return(0,Z.jsx)(K.Separator,{"data-slot":`command-separator`,className:i(`-mx-1 h-px bg-border`,e),...t})}function Ie({className:e,...t}){return(0,Z.jsx)(K.Item,{"data-slot":`command-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Le({className:e,...t}){return(0,Z.jsx)(`span`,{"data-slot":`command-shortcut`,className:i(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Re=`quick-task`;function ze(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}function Be(e,t){return l(e,t)?.models.suggested}var Ve=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function He(e,t){let n=Ve,r=t?.models.find(t=>t.id===e)?.effortLevels;if(r===void 0)return n;let i=[Ve[0]],a=new Set;for(let e of r){if(a.has(e))continue;let t=Ve.find(t=>t.value===e);t&&(a.add(e),i.push(t))}return i}function Ue(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}function We(e,t,n){if(!e||Be(n,t)?.some(t=>t.id===e))return!1;let r=(n?.runners??[]).filter(e=>e.id!==t);return r.some(t=>t.models.retired.includes(e))?!0:r.some(t=>t.modelIdScope!==`provider-spanning`&&t.models.suggested.some(t=>t.id!==``&&t.id===e))}function Ge(e,t,n,r=[]){let i=n?.runner===e?n.models:[],a=Be(t,e)??Be(t,`claude`)??[],o=[...i.length?a.slice(0,1):a],s=new Set(o.map(e=>e.id));for(let e of i)!e.id||s.has(e.id)||(s.add(e.id),o.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let n of r)!n||s.has(n)||We(n,e,t)||(s.add(n),o.push({id:n,label:n,desc:`Custom or legacy model`}));return o}function Ke(e,t,n,r=!1,i=!1){let a=o(t,e);if(a!==void 0){if(n?.stale)return`Using cached ${a} model list`;if(r||n?.source===`unavailable`)return`Latest ${a} models unavailable`;if(i&&!n)return`Loading ${a} models…`}}function qe(e,t,n){return Ke(e,t,n?.data,n?.isError,n?.isFetching)}function Je(e,t){let n=s(t).filter(t=>e.some(e=>e.name===t&&e.available));return n.length>0?n:[`claude`]}function Ye(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Xe(e,t,n=!1){return!n&&e===t?void 0:e}function Ze(e,t,n,r,i){let a=Ge(t,n,i,[e,r?.[t]]);if(e!==null&&a.some(t=>t.id===e))return e;let o=r?.[t];return o!==void 0&&a.some(e=>e.id===o)?o:``}function Qe(e,t,n){return e.source===`skill`?t.some(t=>t.id===e.ref&&(e.path===void 0||t.path===e.path)):n.some(t=>t.name===e.ref)}function $e(e,t,n,r=!1){return e?.source===`skill`&&(r||e.typed)||e&&Qe(e,t,n)?e:null}function et(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,...n.path===void 0?{}:{skillPath:n.path},prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Xe(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...tt({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function tt(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function nt(e,t){return t?{...e,notify:!0}:e}function rt(e){return`/tasks/${e.id}`}var it=80,at=2e3,ot=50,st=200,ct=50,lt=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function ut(e){return!!e&&typeof e==`object`}function dt(e){if(e===void 0||!Array.isArray(e))return lt.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!ut(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=ft(r.skills);if(n.push({id:e,label:i.slice(0,it),text:a.slice(0,at),...o.length>0?{skills:o}:{}}),n.length>=ot)break}return n}function ft(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,st)),t.size>=ct))break}return[...t]}function pt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function mt(e,t){return pt(e,t).map(e=>e.text).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{d as r,l as i,o as a}from"./button-C1fD-ZFr.js";import"./project-scope-context-CR3cozni.js";import{a as o,i as s,n as c,r as l,s as u}from"./runners-D8udSrRd.js";import{X as d,l as f}from"./design-icons-B6-0w7Aw.js";import{h as p,l as m}from"./es2015-Ch36azR0.js";import{c as h,i as g,p as _,r as v,s as y,t as ee}from"./dropdown-menu-DRFDwG2X.js";import{a as b,o as x,r as S,t as C}from"./dist-Du8mGhoH.js";import{i as w,o as T,r as E,s as D,t as O}from"./dialog-DSwzMeY3.js";var k=e(t(),1),A=1,j=.9,M=.8,N=.17,P=.1,F=.999,I=.9999,L=.99,R=/[\\\/_+.#"@\[\(\{&]/,z=/[\\\/_+.#"@\[\(\{&]/g,te=/[\s-]/,ne=/[\s-]/g;function B(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?A:L;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=B(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=A:R.test(e.charAt(l-1))?(d*=M,p=e.slice(i,l-1).match(z),p&&i>0&&(d*=F**+p.length)):te.test(e.charAt(l-1))?(d*=j,m=e.slice(i,l-1).match(ne),m&&i>0&&(d*=F**+m.length)):(d*=N,i>0&&(d*=F**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=I)),(d<P&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=B(e,t,n,r,l+1,a+2,o),f*P>d&&(d=f*P)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function re(e){return e.toLowerCase().replace(ne,` `)}function ie(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,B(e,t,re(e),re(t),0,0,{})}var V=`[cmdk-group=""]`,ae=`[cmdk-group-items=""]`,oe=`[cmdk-group-heading=""]`,se=`[cmdk-item=""]`,ce=`${se}:not([aria-disabled="true"])`,H=`cmdk-item-select`,U=`data-value`,le=(e,t,n)=>ie(e,t,n),ue=k.createContext(void 0),W=()=>k.useContext(ue),de=k.createContext(void 0),G=()=>k.useContext(de),fe=k.createContext(void 0),pe=k.forwardRef((e,t)=>{let n=J(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=J(()=>new Set),i=J(()=>new Map),a=J(()=>new Map),o=J(()=>new Set),s=we(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,ee=m(),b=m(),x=m(),S=k.useRef(null),C=Ee();q(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),q(()=>{C(6,j)},[]);let w=k.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(ee))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=M()?.id,w.emit()}),r||C(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=k.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{A(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();C(4,()=>{A(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:ee,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??le;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ae);t?t.appendChild(e.parentElement===t?e:e.closest(`${ae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ae} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${V}[${U}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(U);w.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(V)?.querySelector(oe))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return S.current?.querySelector(`${se}[aria-selected="true"]`)}function N(){return Array.from(S.current?.querySelectorAll(ce)||[])}function P(e){let t=N()[e];t&&w.setState(`value`,t.getAttribute(U))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(U))}function I(e){let t=M()?.closest(V),n;for(;t&&!n;)t=e>0?Se(t,V):Ce(t,V),n=t?.querySelector(ce);n?w.setState(`value`,n.getAttribute(U)):F(e)}let L=()=>P(N().length-1),R=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return k.createElement(p.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&R(e);break;case`ArrowDown`:R(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(H);t.dispatchEvent(e)}}}}},k.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Oe},c),X(e,e=>k.createElement(de.Provider,{value:w},k.createElement(ue.Provider,{value:T},e))))}),me=k.forwardRef((e,t)=>{let n=m(),r=k.useRef(null),i=k.useContext(fe),o=W(),s=we(e),c=s.current?.forceMount??i?.forceMount;q(()=>{if(!c)return o.item(n,i?.id)},[c]);let l=Te(n,r,[e.value,e.children,r],e.keywords),u=G(),d=Y(e=>e.value&&e.value===l.current),f=Y(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);k.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(H,h),()=>t.removeEventListener(H,h)},[f,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=s.current).onSelect)==null||t.call(e,l.current)}function g(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:_,value:v,onSelect:y,forceMount:ee,keywords:b,...x}=e;return k.createElement(p.div,{ref:a(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!d,"data-disabled":!!_,"data-selected":!!d,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),he=k.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=m(),c=k.useRef(null),l=k.useRef(null),u=m(),d=W(),f=Y(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(s));q(()=>d.group(s),[]),Te(s,c,[e.value,e.heading,l]);let h=k.useMemo(()=>({id:s,forceMount:i}),[i]);return k.createElement(p.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&k.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),X(e,e=>k.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},k.createElement(fe.Provider,{value:h},e))))}),ge=k.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=k.useRef(null),o=Y(e=>!e.search);return!n&&!o?null:k.createElement(p.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),_e=k.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=G(),o=Y(e=>e.search),s=Y(e=>e.selectedItemId),c=W();return k.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),k.createElement(p.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ve=k.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=k.useRef(null),s=k.useRef(null),c=Y(e=>e.selectedItemId),l=W();return k.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),k.createElement(p.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:l.listId},X(e,e=>k.createElement(`div`,{ref:a(s,l.listInnerRef),"cmdk-list-sizer":``},e)))}),ye=k.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return k.createElement(C,{open:n,onOpenChange:r},k.createElement(x,{container:o},k.createElement(b,{"cmdk-overlay":``,className:i}),k.createElement(S,{"aria-label":e.label,"cmdk-dialog":``,className:a},k.createElement(pe,{ref:t,...s}))))}),be=k.forwardRef((e,t)=>Y(e=>e.filtered.count===0)?k.createElement(p.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),xe=k.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return k.createElement(p.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},X(e,e=>k.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(pe,{List:ve,Item:me,Input:_e,Group:he,Separator:ge,Dialog:ye,Empty:be,Loading:xe});function Se(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ce(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function we(e){let t=k.useRef(e);return q(()=>{t.current=e}),t}var q=typeof window>`u`?k.useEffect:k.useLayoutEffect;function J(e){let t=k.useRef();return t.current===void 0&&(t.current=e()),t}function Y(e){let t=G(),n=()=>e(t.snapshot());return k.useSyncExternalStore(t.subscribe,n,n)}function Te(e,t,n,r=[]){let i=k.useRef(),a=W();return q(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(U,s),i.current=s}),i}var Ee=()=>{let[e,t]=k.useState(),n=J(()=>new Map);return q(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function De(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function X({asChild:e,children:t},n){return e&&k.isValidElement(t)?k.cloneElement(De(t),{ref:t.ref},n(t.props.children)):n(t)}var Oe={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},Z=n();function ke({className:e,...t}){return(0,Z.jsx)(K,{"data-slot":`command`,className:i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function Ae({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:a,showCloseButton:o=!0,filter:s,...c}){return(0,Z.jsxs)(O,{...c,children:[(0,Z.jsxs)(T,{className:`sr-only`,children:[(0,Z.jsx)(D,{children:e}),(0,Z.jsx)(w,{children:t})]}),(0,Z.jsx)(E,{className:i(`overflow-hidden p-0`,a),showCloseButton:o,children:(0,Z.jsx)(ke,{...r({filter:s}),className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function je({className:e,...t}){return(0,Z.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex min-h-11 shrink-0 items-center gap-2 rounded-ss-[inherit] rounded-se-[inherit] border-b px-3`,children:[(0,Z.jsx)(d,{className:`size-4 shrink-0 opacity-50`}),(0,Z.jsx)(K.Input,{"data-slot":`command-input`,className:i(`flex h-11 min-w-0 flex-1 rounded-md bg-transparent py-3 text-base md:text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Me({className:e,onPointerMoveCapture:t,...n}){return(0,Z.jsx)(K.List,{"data-slot":`command-list`,onPointerMoveCapture:e=>{t?.(e),e.pointerType===`touch`&&e.stopPropagation()},className:i(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function Ne({...e}){return(0,Z.jsx)(K.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Pe({className:e,...t}){return(0,Z.jsx)(K.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function Fe({className:e,...t}){return(0,Z.jsx)(K.Separator,{"data-slot":`command-separator`,className:i(`-mx-1 h-px bg-border`,e),...t})}function Ie({className:e,...t}){return(0,Z.jsx)(K.Item,{"data-slot":`command-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function Le({className:e,...t}){return(0,Z.jsx)(`span`,{"data-slot":`command-shortcut`,className:i(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var Re=`quick-task`;function ze(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}function Be(e,t){return l(e,t)?.models.suggested}var Ve=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function He(e,t){let n=Ve,r=t?.models.find(t=>t.id===e)?.effortLevels;if(r===void 0)return n;let i=[Ve[0]],a=new Set;for(let e of r){if(a.has(e))continue;let t=Ve.find(t=>t.value===e);t&&(a.add(e),i.push(t))}return i}function Ue(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}function We(e,t,n){if(!e||Be(n,t)?.some(t=>t.id===e))return!1;let r=(n?.runners??[]).filter(e=>e.id!==t);return r.some(t=>t.models.retired.includes(e))?!0:r.some(t=>t.modelIdScope!==`provider-spanning`&&t.models.suggested.some(t=>t.id!==``&&t.id===e))}function Ge(e,t,n,r=[]){let i=n?.runner===e?n.models:[],a=Be(t,e)??Be(t,`claude`)??[],o=[...i.length?a.slice(0,1):a],s=new Set(o.map(e=>e.id));for(let e of i)!e.id||s.has(e.id)||(s.add(e.id),o.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let n of r)!n||s.has(n)||We(n,e,t)||(s.add(n),o.push({id:n,label:n,desc:`Custom or legacy model`}));return o}function Ke(e,t,n,r=!1,i=!1){let a=o(t,e);if(a!==void 0){if(n?.stale)return`Using cached ${a} model list`;if(r||n?.source===`unavailable`)return`Latest ${a} models unavailable`;if(i&&!n)return`Loading ${a} models…`}}function qe(e,t,n){return Ke(e,t,n?.data,n?.isError,n?.isFetching)}function Je(e,t){let n=s(t).filter(t=>e.some(e=>e.name===t&&e.available));return n.length>0?n:[`claude`]}function Ye(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Xe(e,t,n=!1){return!n&&e===t?void 0:e}function Ze(e,t,n,r,i){let a=Ge(t,n,i,[e,r?.[t]]);if(e!==null&&a.some(t=>t.id===e))return e;let o=r?.[t];return o!==void 0&&a.some(e=>e.id===o)?o:``}function Qe(e,t,n){return e.source===`skill`?t.some(t=>t.id===e.ref&&(e.path===void 0||t.path===e.path)):n.some(t=>t.name===e.ref)}function $e(e,t,n,r=!1){return e?.source===`skill`&&(r||e.typed)||e&&Qe(e,t,n)?e:null}function et(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,...n.path===void 0?{}:{skillPath:n.path},prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Xe(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...tt({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function tt(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function nt(e,t){return t?{...e,notify:!0}:e}function rt(e){return`/tasks/${e.id}`}var it=80,at=2e3,ot=50,st=200,ct=50,lt=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function ut(e){return!!e&&typeof e==`object`}function dt(e){if(e===void 0||!Array.isArray(e))return lt.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!ut(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=ft(r.skills);if(n.push({id:e,label:i.slice(0,it),text:a.slice(0,at),...o.length>0?{skills:o}:{}}),n.length>=ot)break}return n}function ft(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,st)),t.size>=ct))break}return[...t]}function pt(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function mt(e,t){return pt(e,t).map(e=>e.text).join(`
|
|
2
2
|
|
|
3
3
|
`)}function ht(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function gt(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function _t(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
|
|
4
4
|
|
package/web/dist/assets/{preview-pane-connected-DHH1E04c.js → preview-pane-connected-TaIGMKvt.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{l as r,t as i}from"./button-C1fD-ZFr.js";import{Ir as a,Lr as o,Rr as s,dr as c}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{l as r,t as i}from"./button-C1fD-ZFr.js";import{Ir as a,Lr as o,Rr as s,dr as c}from"./project-scope-context-CR3cozni.js";import{n as l}from"./toaster-Cxgzn9ip.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./arrow-right-Dh_Lx3um.js";import{n as f,r as p,t as m}from"./hourglass-B0lPAJvT.js";import{t as h}from"./info-DA1x_4bz.js";import{a as g}from"./format-BNCkW110.js";import{t as _}from"./play-CmVAj_fu.js";import{d as v,l as y,n as b,u as x}from"./thread-state-DVfKElYJ.js";import{a as S,c as C,i as w,l as T,p as E,r as D,s as ee,t as O}from"./dropdown-menu-DRFDwG2X.js";import{s as te}from"./project-router-BLLH9tz9.js";import{Bt as ne,Ht as k,Vt as A,Zt as j,_n as re,b as ie,cn as ae,d as oe,f as se,g as ce,gn as le,h as M,in as ue,ln as de,m as fe,mn as N,nn as pe,p as me,pn as he,rn as ge,sn as _e,un as P,vn as F,x as ve,y as ye,zt as I}from"./index-DPA7Ibhf.js";var be=u(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),xe=u(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),L=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),R=u(`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`}]]),z=u(`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`}]]),B=u(`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`}]]),V=u(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Se=u(`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`}]]),Ce=u(`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`}]]),H=u(`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`}]]),U=u(`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`}]]),W=u(`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`}]]),G=u(`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`}]]),K=u(`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`}]]),q=u(`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`}]]),we=u(`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`}]]),Te=u(`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`}]]),Ee=u(`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=u(`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}`,i=null,s,l=!1,u=!1,d=0,f=0,p=()=>typeof document>`u`||a(),m=()=>{if(l||!p())return;let e=globalThis.WebSocket;if(typeof e!=`function`)return;let n=new e(r());n.binaryType=`blob`,i=n,n.addEventListener(`open`,()=>{n===i&&(u=!0,t.onTransport(`open`))}),n.addEventListener(`message`,e=>{if(n!==i)return;let r=e.data;if(typeof r==`string`){let e;try{e=JSON.parse(r)}catch{return}let n=c.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!==i||l)return;if(i=null,!u){if(d+=1,d>=2){l=!0,t.onTransport(`blocked`);return}t.onTransport(`reconnecting`,d),s=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),s=setTimeout(m,e)})},h=o(e=>{if(!l)if(e)i||m();else{clearTimeout(s),s=void 0;let e=i;i=null,e?.close()}});return t.onTransport(`connecting`),m(),{send(e){i?.readyState===Ae&&i.send(JSON.stringify(e))},close(){l=!0,h(),clearTimeout(s),s=void 0;let e=i;i=null,e?.close()}}}var Y=n();function Me({iconOnly:e=!1,responsive:t=!1,className:n}){return t?(0,Y.jsx)(A,{children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(k,{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)(z,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[640px]:inline`,children:`Experimental`})]})}),(0,Y.jsx)(ne,{children:`Experimental`})]})}):e?(0,Y.jsx)(A,{children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(k,{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)(z,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(ne,{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)(z,{className:`size-3.5`,"aria-hidden":`true`}),`Experimental`]})}function Ne({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)(N,{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 Pe=/^([a-z][a-z0-9+.-]*):/i;function Fe(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=Pe.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.`}:Ie(n):Ie(`http://${n}`)}function Ie(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 Le(e){return e.replace(/^https?:\/\//i,``)}var Re=`https://github.com/hearsay-tools/squawk#environment-variables`;function ze({state:e,actions:t,url:n,worktree:r}){switch(e.stage){case`chromium-missing`:return(0,Y.jsx)(Ue,{state:e,actions:t});case`downloading`:return(0,Y.jsx)(Ge,{state:e,actions:t});case`download-failed`:return(0,Y.jsx)(Ke,{state:e,actions:t});case`sandbox-failed`:return(0,Y.jsx)(qe,{state:e,actions:t});case`browser-exited`:return(0,Y.jsx)(Je,{state:e,actions:t});case`needs-approval`:return(0,Y.jsx)(Ze,{state:e,actions:t});case`port-held`:return(0,Y.jsx)(Qe,{state:e,actions:t});case`server-starting`:return(0,Y.jsx)($e,{state:e,actions:t});case`server-stalled`:return(0,Y.jsx)(et,{state:e,actions:t});case`server-exited`:return(0,Y.jsx)(tt,{state:e,actions:t});case`server-stopped`:return(0,Y.jsx)(nt,{state:e,actions:t});case`loading`:return(0,Y.jsx)(it,{step:e.step,url:n});case`worktree-removed`:return(0,Y.jsx)(at,{state:e,actions:t,worktree:r});case`proxy-blocked`:return(0,Y.jsx)(ot,{actions:t});case`taken-over`:return(0,Y.jsx)(ct,{state:e,actions:t})}}function X({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 Z=({children:e})=>(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e}),Q=({children:e})=>(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e});function Be({server:e}){return(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ge,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Runs ${M(e.command)} in this task's worktree, on the host.`})]})}function Ve({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)(N,{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 He({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)(j,{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)(Be,{server:e})})]})}function Ue({state:e,actions:t}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(R,{}),title:`This host has no browser yet`,children:[(0,Y.jsx)(Z,{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)(Q,{children:(0,Y.jsxs)(i,{variant:`contrast`,onClick:t.download,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Download Chromium`]})}):null,(0,Y.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:e.canDownload?`Or install it yourself`:`Install it yourself`})]})}function We(e){return Math.round(e/1e6)}function Ge({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,a=(Date.now()-n.current.at)/1e3,o=a>=1?(e.received-n.current.received)/a:0,s=o>0?Math.ceil((e.total-e.received)/o):void 0;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(R,{}),title:`Downloading Chromium`,children:[(0,Y.jsx)(Z,{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:`${We(e.received)} of ${We(e.total)} MB · ${r}%`}),s===void 0?null:(0,Y.jsx)(`span`,{children:`about ${s} s left`})]})]}),(0,Y.jsx)(Q,{children:(0,Y.jsx)(i,{variant:`outline`,onClick:t.cancelDownload,children:`Cancel`})})]})}function Ke({state:e,actions:t}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(Te,{className:`text-danger`}),title:`Couldn't download Chromium`,children:[(0,Y.jsx)(Z,{children:`${e.error.replace(/\.$/,``)}. Install Chromium with the system package manager, then retry.`}),(0,Y.jsx)(Ve,{command:e.installCommand,copy:t.copy,label:`Install it yourself`}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(i,{variant:`contrast`,onClick:t.download,children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Retry download`]}),(0,Y.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`Chromium download failed\n${e.error}\nInstall: ${e.installCommand}`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}function qe({state:e,actions:t}){return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(q,{className:`text-danger`}),title:`Chromium couldn't start its sandbox`,children:[(0,Y.jsx)(Z,{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)(Ne,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(i,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`Chromium failed to start its sandbox\n${e.stderrTail}`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]}),(0,Y.jsx)(`a`,{className:`text-sm font-medium text-accent-text underline-offset-2 hover:underline`,href:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Docs: running without the sandbox (CEZ_PREVIEW_NO_SANDBOX=1)`})]})}function Je({state:e,actions:t}){let n=e.reason===`timeout`,r=e.signal?` (${e.signal})`:e.exitCode===void 0?``:` (code ${e.exitCode})`,a=e.serverUp?`The dev server is still up; only the browser needs a restart.`:`The browser needs a restart.`,o=n?`Chromium did not start in time`:`Chromium exited${r}`;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(f,{className:`text-danger`}),title:n?`The browser did not start`:`The browser stopped`,children:[(0,Y.jsx)(Z,{children:n?`Chromium did not open its DevTools port in time. ${a}`:`Chromium exited unexpectedly${r}. ${a}`}),(0,Y.jsx)(Ne,{text:e.stderrTail,source:`chromium`,onCopy:t.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(i,{variant:`contrast`,onClick:t.retryBrowser,children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Retry`]}),(0,Y.jsxs)(i,{variant:`outline`,onClick:()=>t.copy(`${o}\n${e.stderrTail}`),children:[(0,Y.jsx)(N,{"aria-hidden":`true`}),`Copy diagnostics`]})]})]})}var Ye=2;function Xe(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 Ze({state:e,actions:t}){let{server:n,wasRunning:r}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:r?(0,Y.jsx)(Ee,{className:`text-pending-strong`}):(0,Y.jsx)(_,{}),title:r?`Nothing answers on :${n.port} anymore`:`${n.label} isn't running yet`,children:[(0,Y.jsx)(Z,{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)(He,{server:n,status:r?`was running when registered · silent now`:`registered · not started`}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(_,{"aria-hidden":`true`}),`Run and open`]})})]})}function Qe({state:e,actions:t}){let{server:n,ownerTitle:r}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(Te,{className:`text-pending-strong`}),title:`${n.label} :${n.port} is in use by another task`,children:[(0,Y.jsx)(Z,{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)(Q,{children:(0,Y.jsx)(i,{variant:`contrast`,onClick:t.close,children:`Close preview`})})]})}function $e({state:e,actions:t}){let{server:n}=e,r=Xe(1e3),a=Math.max(0,Math.floor((r-Date.parse(e.startedAt))/1e3)),[o,s]=(0,J.useState)(()=>Date.now());(0,J.useEffect)(()=>s(Date.now()),[e.attempt]);let c=Math.max(0,Math.ceil(Ye-(r-o)/1e3));return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(_,{}),title:`Starting ${n.label}`,children:[(0,Y.jsx)(Z,{children:`Squawk ran ${M(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)(g,{className:`size-4 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}),c>0?`Attempt ${e.attempt} · next try in ${c} s`:`Attempt ${e.attempt}`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`started ${a} s ago`})]}),e.logTail.length>0?(0,Y.jsx)(Ne,{text:e.logTail.join(`
|
|
3
3
|
`),source:M(n.command),onCopy:t.copy}):null,(0,Y.jsx)(Q,{children:(0,Y.jsx)(i,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})})]})}function et({state:e,actions:t}){let{server:n}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(m,{className:`text-pending-strong`}),title:`${n.label} is running, but :${n.port} is silent`,children:[(0,Y.jsx)(Z,{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)(Ne,{text:e.logTail,source:M(n.command),onCopy:t.copy}),(0,Y.jsxs)(Q,{children:[(0,Y.jsx)(i,{variant:`contrast`,onClick:()=>t.keepWaiting(n.port),children:`Keep waiting`}),(0,Y.jsx)(i,{variant:`outline`,onClick:()=>t.stop(n.port),children:`Stop server`})]})]})}function tt({state:e,actions:t}){let{server:n}=e;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(f,{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)(Z,{children:`${M(n.command)} stopped.`}),(0,Y.jsx)(Ne,{text:e.logTail,source:M(n.command),onCopy:t.copy}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(Be,{server:n})]})}function nt({state:e,actions:t}){let{server:n}=e,r=e.reason===`idle`;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(_e,{}),title:r?`Stopped after 15 min idle`:`${n.label} stopped`,children:[(0,Y.jsx)(Z,{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 ${Le(e.lastUrl)}.`:`You stopped ${n.label} :${n.port}. Start again reopens ${Le(e.lastUrl)}.`}),(0,Y.jsx)(Q,{children:(0,Y.jsxs)(i,{variant:`contrast`,onClick:()=>t.run(n.port),children:[(0,Y.jsx)(v,{"aria-hidden":`true`}),`Start again`]})}),(0,Y.jsx)(Be,{server:n})]})}var rt=[`browser`,`page`,`frame`];function it({step:e,url:t}){let n=rt.indexOf(e),i=t?Le(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)(g,{className:`size-5 animate-spin text-success motion-reduce:animate-none`,"aria-hidden":`true`}):(0,Y.jsx)(L,{className:`size-5 text-border`,"aria-hidden":`true`}),i?e.done:a?e.active:e.done]},t)})})})}function at({state:e,actions:t,worktree:n}){let r=n?/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+/.exec(n)?.[0]:void 0,a=e.server?.label;return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(B,{}),title:`This task's worktree is gone`,children:[(0,Y.jsx)(Z,{children:`${a??`The server`} ran in ${r??`this task's worktree`}, which has been removed. There is nothing left to start.`}),e.server?(0,Y.jsx)(y,{entry:{kind:`preview-server`,id:`preview-server:${e.server.port}`,server:e.server,state:`unavailable`},inPreview:!1}):null,(0,Y.jsx)(Q,{children:(0,Y.jsx)(i,{variant:`outline`,onClick:t.close,children:`Close preview`})})]})}function ot({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)(W,{})}),(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)(Z,{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)(Q,{children:[(0,Y.jsx)(i,{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:Re,target:`_blank`,rel:`noopener noreferrer`,children:`Which setups work`})]})]})}function st(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 ct({state:e,actions:t}){let n=st(e.by);return(0,Y.jsxs)(X,{state:e.stage,icon:(0,Y.jsx)(U,{}),title:`Preview is open somewhere else`,children:[(0,Y.jsx)(Z,{children:`Another tab took this browser${n?` (${n})`:``}. Only one tab can view and drive it at a time.`}),(0,Y.jsxs)(Q,{children:[(0,Y.jsxs)(i,{variant:`contrast`,onClick:t.useHere,children:[(0,Y.jsx)(R,{"aria-hidden":`true`}),`Use it here`]}),(0,Y.jsx)(i,{variant:`outline`,onClick:t.close,children:`Close preview`})]})]})}function lt({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)(i,{variant:`outline`,onClick:n,children:t?`Reconnect`:`Reconnect now`})]})}function ut({servers:e,states:t,onOpen:n,agentLive:r=!1,agentIdle:a=!1,onOpenAgent:o}){return(0,Y.jsxs)(`div`,{"data-slot":`preview-state`,"data-state":a?`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)(Z,{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.`}),a?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-start gap-2 text-sm text-foreground`,children:[(0,Y.jsx)(Ee,{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&&o!==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)(j,{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)(i,{variant:`outline`,size:`sm`,className:`max-md:h-11`,"aria-label":`Open the agent's page`,onClick:o,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=me(e,t),a=ce(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)(j,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.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:a.text})]}),(0,Y.jsx)(i,{variant:`outline`,size:`sm`,className:`max-md:h-11`,onClick:()=>n(e.port),children:fe(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)(h,{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 dt({dialog:e,onResult:t}){let[n,r]=(0,J.useState)(e.defaultPrompt??``),a=e.type===`beforeunload`,o=(0,J.useRef)(null),s=(0,J.useRef)(null);(0,J.useEffect)(()=>{(e.type===`prompt`?s.current:o.current)?.focus()},[e.type]);let c=(0,J.useRef)(t);c.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(),c.current({accept:!1}))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let l=()=>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||(a?`Changes you made may not be saved.`:``)}),e.type===`prompt`?(0,Y.jsx)(`input`,{ref:s,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l()},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)(i,{variant:`outline`,onClick:()=>t({accept:!1}),children:a?`Stay`:`Cancel`}),(0,Y.jsx)(i,{ref:o,variant:`contrast`,onClick:l,children:a?`Leave`:`OK`})]})]})})}var ft=10,pt=500,mt=500,ht=4,gt=16,_t=e=>!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);function vt(e,t,n,r){return{x:Math.round((e-n.left)/r),y:Math.round((t-n.top)/r)}}function yt(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 bt=[`left`,`middle`,`right`];function $(e,t,n,r){let i=vt(n.clientX,n.clientY,t.rect,t.scale);return{t:`mouse`,type:e,x:i.x,y:i.y,button:bt[n.button]??`none`,buttons:n.buttons,clickCount:1,modifiers:_t(n),...r}}var xt=e=>e===0?0:-e;function St(e,t,n,r,i){let a=vt(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)<=ft)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<=pt;if(i(),!n||!r)return[];let a={...e,clientX:r.startX,clientY:r.startY};return[$(`mouseMoved`,t,a,{button:`none`,buttons:0}),$(`mousePressed`,t,a,{button:`left`,buttons:1}),$(`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<=mt&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<=ht;return t.click={at:e.timeStamp,x:e.clientX,y:e.clientY,button:e.button,count:r?n.count+1:1},[$(`mousePressed`,t,e,{clickCount:t.click.count})]}case`pointermove`:return[$(`mouseMoved`,t,e,{button:e.buttons&1?`left`:`none`})];case`pointerup`:return[$(`mouseReleased`,t,e,{clickCount:t.click.count})];case`pointercancel`:return[]}}function Tt(e,t,n){let r=vt(e.clientX,e.clientY,t,n),i=e.deltaMode===1?gt: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:_t(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:_t(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:_t(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)(yt({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:o,renderInput:s,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)(o);m.current=o,(0,J.useImperativeHandle)(e,()=>({async draw(e){let t=++l.current,n=d.current,r=n?.getContext(`2d`);if(!(!n||!r||!a()))try{let i=await Mt(e);try{if(t!==l.current||!a()||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`}),s?.({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:ue},{w:820,h:1180,icon:we},{w:1440,h:900,icon:ae}],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)(j,{"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)(j,{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)(i,{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)(j,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}):(0,Y.jsx)(x,{"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)(le,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}function qt({shown:e,live:t,onSelect:n}){return(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,"aria-current":e||void 0,onSelect:n,children:[(0,Y.jsx)(j,{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)(F,{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,a=(0,J.useRef)(null),o=e.urlInputRef??a,s=(0,J.useRef)(!1),[c,l]=(0,J.useState)(null),[u,f]=(0,J.useState)(!1),p=(0,Y.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Back`,disabled:!n,onClick:e.onBack,children:(0,Y.jsx)(be,{"aria-hidden":`true`})}),m=(0,Y.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Forward`,disabled:!n,onClick:e.onForward,children:(0,Y.jsx)(d,{"aria-hidden":`true`})}),h=(0,Y.jsx)(i,{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)(K,{"aria-hidden":`true`})}),g=e.onSession?(0,Y.jsxs)(i,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1 max-md:h-11`,onClick:e.onSession,children:[(0,Y.jsx)(re,{"aria-hidden":`true`}),`Session`]}):null,_=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,v=(0,Y.jsx)(Qt,{props:e,input:o,draft:c,setDraft:l,focused:u,setFocused:f}),{agentListed:y}=Yt(e),b=e.servers.length+ +!!y>=2,x=b||e.adopted,S={back:p,forward:m,reload:h,address:v,more:(0,Y.jsx)(rn,{props:e,compact:t,crowded:x}),session:g,progress:_};return t?(0,Y.jsx)(an,{props:e,elements:S}):(0,Y.jsx)(on,{props:e,elements:S,switcher:b,crowded:x,input:o,focusUrlAfterMenu:s})}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)(O,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsx)(Kt,{current:i,agentShown:o})}),(0,Y.jsxs)(D,{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=ce(me(t,e.serverStates));return(0,Y.jsxs)(w,{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)(j,{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)(F,{className:`size-4`,"aria-hidden":`true`}):null]},t.port)}),(0,Y.jsx)(T,{}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>{n.current=!0},children:[(0,Y.jsx)(P,{"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)(P,{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:Le(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)(Se,{className:`size-3`,"aria-hidden":`true`}),`Not started by Squawk`]}):null]})}function $t({props:e}){let{viewport:t}=e;return(0,Y.jsxs)(O,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(i,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Viewport size: ${Ht(t)}`,children:[t===`fit`?(0,Y.jsx)(H,{"aria-hidden":`true`}):(0,Y.jsx)(ae,{"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)(le,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(D,{align:`start`,className:`min-w-56`,children:[(0,Y.jsxs)(w,{className:`gap-2.5`,"aria-current":t===`fit`||void 0,onSelect:()=>e.onViewport(`fit`),children:[(0,Y.jsx)(H,{"aria-hidden":`true`}),`Fit`,(0,Y.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:`pane size`}),t===`fit`?(0,Y.jsx)(F,{className:`size-4`,"aria-hidden":`true`}):null]}),Bt.map(({w:n,h:r,icon:i})=>(0,Y.jsxs)(w,{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)(F,{className:`ml-auto size-4`,"aria-hidden":`true`}):null]},`${n}x${r}`))]})]})}function en({quality:e,onQuality:t,compact:n}){return(0,Y.jsx)(ee,{value:e,onValueChange:e=>t(It(e)),children:Ft.map(e=>(0,Y.jsx)(C,{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)(O,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsxs)(i,{variant:`outline`,size:`sm`,className:`shrink-0 gap-1.5`,"aria-label":`Stream quality: ${Lt(t)}`,children:[(0,Y.jsx)(V,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`hidden @min-[560px]:inline`,children:Lt(t)}),(0,Y.jsx)(le,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Y.jsxs)(D,{align:`start`,className:`w-64`,children:[(0,Y.jsx)(S,{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)(j,{tone:t.tone,"aria-hidden":`true`}),t.label]}):null}function rn({props:e,compact:t,crowded:n}){let{stats:r,navEnabled:a,url:o,current:s,adopted:c}=e;return(0,Y.jsxs)(O,{children:[(0,Y.jsx)(E,{asChild:!0,children:(0,Y.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`More`,children:(0,Y.jsx)(he,{"aria-hidden":`true`})})}),(0,Y.jsxs)(D,{align:`end`,className:`min-w-64`,children:[n&&r&&!t?(0,Y.jsx)(S,{className:`font-mono text-xs font-normal text-muted-foreground`,children:Wt(r)}):null,(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:!a,onSelect:()=>e.onReload(!0),children:[(0,Y.jsx)(G,{"aria-hidden":`true`}),`Reload without cache`]}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5 md:min-h-0`,disabled:o===``,onSelect:e.onCopyUrl,children:[(0,Y.jsx)(de,{"aria-hidden":`true`}),`Copy page URL`]}),s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{}),c?(0,Y.jsxs)(w,{disabled:!0,className:`items-start gap-2.5 opacity-100 data-[disabled]:opacity-100`,children:[(0,Y.jsx)(Ce,{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 · ${s.label} :${s.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)(w,{variant:`destructive`,className:`min-h-11 gap-2.5 md:min-h-0`,onSelect:()=>e.onStop(s.port),children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),`Stop server · ${s.label} :${s.port}`]})]}):null,t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(T,{}),(0,Y.jsx)(S,{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)(T,{}),(0,Y.jsxs)(w,{className:`min-h-11 gap-2.5`,onSelect:e.onClose,children:[(0,Y.jsx)(pe,{"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)(j,{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:a,focusUrlAfterMenu:o}){let{badge:s=!0,stats:c,status:l}=e,{back:u,forward:d,reload:f,address:p,more:m,session:h,progress:g}=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:[h,u,d,f,n?(0,Y.jsx)(Zt,{props:e,input:a,focusUrlAfterMenu:o}):null,p,(0,Y.jsx)($t,{props:e}),(0,Y.jsx)(tn,{props:e}),(0,Y.jsx)(nn,{stats:c,status:l,crowded:r}),s?(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`}),m,(0,Y.jsx)(i,{variant:`ghost`,size:`icon-sm`,className:Vt,"aria-label":`Close preview`,onClick:e.onClose,children:(0,Y.jsx)(pe,{"aria-hidden":`true`})}),g]})}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)(ze,{...n,actions:o})}case`empty`:return(0,Y.jsx)(ut,{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(()=>l(`Copied`),()=>l(`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 c=un(),l=(0,J.useRef)(c);l.current=c;let u=s(),d=(0,J.useRef)(crypto.randomUUID()),f=(0,J.useRef)(!1),p=te(),m=ie(ye,!1),[h,g]=(0,J.useState)(0),[_,v]=(0,J.useState)({state:`connecting`,attempt:0}),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(void 0),[C,w]=(0,J.useState)(void 0),[T,E]=(0,J.useState)(``),[D,ee]=(0,J.useState)(void 0),[O,ne]=(0,J.useState)(!1),[k,A]=(0,J.useState)(void 0),[j,re]=(0,J.useState)(!1),[ae,oe]=(0,J.useState)(!1),[se,ce]=(0,J.useState)(void 0),[le,M]=(0,J.useState)(void 0),[ue,de]=(0,J.useState)(void 0),[fe,N]=(0,J.useState)(`fit`),[pe,me]=(0,J.useState)(Rt),[he,ge]=(0,J.useState)(null),[_e,P]=(0,J.useState)(void 0),[F,ve]=(0,J.useState)(0),I=(0,J.useRef)(void 0),be=(0,J.useRef)(null),xe=(0,J.useRef)(null),L=(0,J.useRef)(void 0),R=(0,J.useRef)(void 0),z=(0,J.useRef)(pe);z.current=pe;let B=(0,J.useRef)({port:D,stage:C,agent:O});B.current={port:D,stage:C,agent:O};let V=(0,J.useRef)([]),Se=(0,J.useRef)(void 0),Ce=(0,J.useRef)(!1),H=(0,J.useRef)(!1),U=(0,J.useCallback)(e=>{H.current&&I.current?.send(e)},[]);(0,J.useEffect)(()=>{let t;return t=je({projectId:p??`default`,runId:e.id},{onFrame(e){if(!a())return;let n=Date.now();V.current.push({at:n,bytes:e.size}),Ce.current||(Ce.current=!0,oe(!0)),(be.current?.draw(e)??Promise.resolve()).finally(()=>t?.send({t:`ack`}))},onMessage(e){switch(e.t){case`state`:if(w(e),(e.stage===`streaming`||e.stage===`loading`)&&ve(e=>e+1),R.current!==void 0&&mn(e,R.current)){let n=R.current;R.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 E(e.url);case`cursor`:return ce(e.cursor);case`dialog`:return M(e);case`pong`:Se.current=Math.max(0,Date.now()-e.ts);return;case`downloadProgress`:w(t=>t?.stage===`downloading`?{...t,received:e.received,total:e.total}:t);return;case`replaced`:S(e.by),H.current=!1,t?.close();return}},onTransport(e,n){H.current=e===`open`,v({state:e,attempt:n??0}),e===`open`&&(b(!0),L.current&&(t?.send({t:`open`,target:L.current,viewerId:d.current,resume:f.current,quality:z.current,dpr:l.current}),f.current=!0))}}),I.current=t,()=>{H.current=!1,t?.close(),I.current===t&&(I.current=void 0)}},[p,e.id,h]);let W=u&&_.state===`open`&&x===void 0,G=m||fe===`fit`?he:fe;(0,J.useEffect)(()=>{G&&W&&(C?.stage===`streaming`||C?.stage===`loading`)&&U({t:`resize`,w:G.w,h:G.h,...c===1?{}:{dpr:c}})},[G?.w,G?.h,c,W,C?.stage,F,U]),(0,J.useEffect)(()=>{if(!W)return;let e=setInterval(()=>U({t:`ping`,ts:Date.now()}),dn);return()=>clearInterval(e)},[W,U]);let K=W&&C?.stage===`streaming`;(0,J.useEffect)(()=>{if(!K){de(void 0);return}let e=setInterval(()=>{let e=Date.now();V.current=V.current.filter(t=>e-t.at<=pn);let t={fps:V.current.length,kbps:Math.round(V.current.reduce((e,t)=>e+t.bytes,0)/1024),...Se.current===void 0?{}:{rttMs:Se.current},...V.current.length>0?{lastFrameAt:V.current.at(-1).at}:{}};de(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)(()=>{k&&r?.(k)},[k,r]);let q=(0,J.useCallback)((e,t,n=!1)=>{L.current=e,R.current=n&&`port`in e?e.port:void 0,re(!0),w(void 0),S(void 0),P(void 0),E(t),ee(`port`in e?e.port:void 0),ne(`agent`in e),A(vn(e)),U({t:`open`,target:e,viewerId:d.current,quality:z.current,dpr:l.current}),f.current=H.current},[U]),we=(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]),Te=(0,J.useCallback)(()=>q({agent:!0},``),[q]);(0,J.useEffect)(()=>{if(n?.agent){if(B.current.agent&&B.current.stage?.stage===`streaming`)return;Te();return}if(n?.url!==void 0){let e=Fe(n.url,t);e.kind===`server`?we(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)||B.current.port===n.port&&B.current.stage?.stage===`streaming`&&n.run!==!0||we(n.port,n.run===!0))},[n]);let Ee=!j&&!x&&_.state!==`blocked`,De=_n(n,t);(0,J.useEffect)(()=>{Ee&&!De&&xe.current?.focus()},[Ee,De]);let Oe=e=>{let n=Fe(e,t);if(n.kind===`error`)return P(n.message);if(n.kind===`server`)return we(n.port);if(B.current.stage?.stage===`streaming`&&!B.current.agent)return L.current={url:n.url},R.current=void 0,ee(void 0),A({url:n.url}),P(void 0),E(n.url),U({t:`nav`,url:n.url});q({url:n.url},n.url)},ke=(0,J.useCallback)(e=>{z.current=e,me(e),zt(e),U({t:`quality`,quality:e})},[U]),Ae=()=>{f.current=!1,S(void 0),v({state:`connecting`,attempt:0}),Ce.current=!1,g(e=>e+1)};return{compact:m,transport:_,everOpened:y,takenOver:x,stage:C,url:T,port:D,agent:O,hasFrame:ae,cursor:se,dialog:le,setDialog:M,stats:ue,viewport:fe,setViewport:N,quality:pe,chooseQuality:ke,setStageSize:ge,addressError:_e,stageHandle:be,urlInput:xe,send:U,connected:W,streaming:K,openServer:we,openAgent:Te,empty:Ee,navigate:Oe,reconnect:Ae,actions:(0,J.useMemo)(()=>({download:()=>U({t:`download`}),cancelDownload:()=>U({t:`cancelDownload`}),retryBrowser:()=>U({t:`retryBrowser`}),run:e=>U({t:`run`,port:e}),stop:e=>U({t:`stop`,port:e}),keepWaiting:e=>U({t:`keepWaiting`,port:e}),close:o,useHere:Ae,copy:hn}),[U,o])}}function bn(e){return(0,Y.jsx)(ve,{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:b,chooseQuality:x,addressError:S,urlInput:C,send:w,streaming:T,openServer:E,openAgent:D,empty:ee,navigate:O,actions:te}=s,ne=n.find(e=>e.port===m),k=f?.stage===`streaming`&&f.adopted,A=u&&(l.state===`reconnecting`||l.state===`closed`),{content:j,dim:re}=sn({transport:l.state,takenOver:d,empty:ee,stage:f,hasFrame:g,lost:A,url:p,worktree:t.worktreePath}),ie=cn(j,{servers:n,serverStates:r,agentLive:i,openServer:E,openAgent:D,actions:te});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:ne,agentLive:i===!0,agentShown:h,adopted:k,viewport:c?`fit`:v,quality:b,compact:c,navEnabled:T,loading:f?.stage===`loading`,stats:T?_??{fps:0,kbps:0}:void 0,status:T?void 0:xn(l,u,d!==void 0,f),urlInputRef:C,onSession:a,onNavigate:O,onBack:()=>w({t:`back`}),onForward:()=>w({t:`forward`}),onReload:e=>w({t:`reload`,...e?{ignoreCache:!0}:{}}),onPickServer:e=>E(e),onPickAgent:D,onViewport:y,onQuality:x,onCopyUrl:()=>hn(p),onStop:e=>w({t:`stop`,port:e}),onClose:o}),S?(0,Y.jsx)(`p`,{role:`alert`,className:`border-b border-border bg-card px-3 py-1.5 text-xs text-danger`,children:S}):null,(0,Y.jsx)(wn,{transportState:s,overlay:ie,dim:re,lost:A})]})}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)(lt,{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)(dt,{dialog:a,onResult:e=>{_(void 0),p({t:`dialogResult`,...e})}}):null]})}function Tn(e){let{visibleEvents:t}=se(e);return(0,J.useMemo)(()=>{let e=new Map;for(let n of b(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=oe(e.run.id);return(0,Y.jsx)(bn,{...e,serverStates:t,agentLive:n})}export{En as ConnectedPreviewPane};
|
|
@@ -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{C as r,b as i,h as a,m as o,p as s,w as c}from"./button-C1fD-ZFr.js";import{r as l}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{C as r,b as i,h as a,m as o,p as s,w as c}from"./button-C1fD-ZFr.js";import{r as l}from"./project-scope-context-CR3cozni.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}=l(),{pathname:t}=r();return e??p(t)}function v(){let e=_();return(0,u.useCallback)(t=>g(e,t),[e])}function y(e){let{pathname:t}=r();return(0,u.useMemo)(()=>i(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)(o,{...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};
|