allyhub 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
  2. package/dist/node_modules/@allyhub-next/browser/package.json +1 -1
  3. package/dist/node_modules/@allyhub-next/build/package.json +1 -1
  4. package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
  5. package/dist/node_modules/@allyhub-next/check/package.json +1 -1
  6. package/dist/node_modules/@allyhub-next/cloud/package.json +1 -1
  7. package/dist/node_modules/@allyhub-next/components/package.json +1 -1
  8. package/dist/node_modules/@allyhub-next/dev-server/dist/project.js +1 -1
  9. package/dist/node_modules/@allyhub-next/dev-server/dist/writer.js +2 -2
  10. package/dist/node_modules/@allyhub-next/dev-server/package.json +1 -1
  11. package/dist/node_modules/@allyhub-next/doc/package.json +1 -1
  12. package/dist/node_modules/@allyhub-next/export/package.json +1 -1
  13. package/dist/node_modules/@allyhub-next/formats/package.json +1 -1
  14. package/dist/node_modules/@allyhub-next/measure/package.json +1 -1
  15. package/dist/node_modules/@allyhub-next/media/package.json +1 -1
  16. package/dist/node_modules/@allyhub-next/model/package.json +1 -1
  17. package/dist/node_modules/@allyhub-next/ooxml/package.json +1 -1
  18. package/dist/node_modules/@allyhub-next/project/package.json +1 -1
  19. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +19 -0
  20. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +1 -1
  21. package/dist/node_modules/@allyhub-next/protocol/package.json +1 -1
  22. package/dist/node_modules/@allyhub-next/registry/package.json +1 -1
  23. package/dist/node_modules/@allyhub-next/render/package.json +1 -1
  24. package/dist/node_modules/@allyhub-next/runtime/package.json +1 -1
  25. package/dist/node_modules/@allyhub-next/runtimes/dist/download.d.ts +19 -1
  26. package/dist/node_modules/@allyhub-next/runtimes/dist/download.js +1 -1
  27. package/dist/node_modules/@allyhub-next/runtimes/dist/index.d.ts +2 -2
  28. package/dist/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
  29. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
  30. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +1 -1
  31. package/dist/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +19 -2
  32. package/dist/node_modules/@allyhub-next/runtimes/dist/packages.js +3 -3
  33. package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +3 -0
  34. package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -3
  35. package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
  36. package/dist/node_modules/@allyhub-next/scaffold/package.json +1 -1
  37. package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
  38. package/dist/node_modules/@allyhub-next/scenery-host/package.json +1 -1
  39. package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
  40. package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
  41. package/dist/node_modules/@allyhub-next/slides-pptx/package.json +1 -1
  42. package/dist/node_modules/@allyhub-next/slides-runtime/package.json +1 -1
  43. package/dist/node_modules/@allyhub-next/stage/package.json +1 -1
  44. package/dist/node_modules/@allyhub-next/stage-page/package.json +1 -1
  45. package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
  46. package/dist/node_modules/@allyhub-next/website/package.json +1 -1
  47. package/editor-web/assets/{dist-B3UoDUa5.js → dist-B-BI8jma.js} +1 -1
  48. package/editor-web/assets/{dist-DNZ8PQ-E.js → dist-CS-Z5JSF.js} +1 -1
  49. package/editor-web/assets/{dist-CTQIm8Im.js → dist-ClE1xUdI.js} +1 -1
  50. package/editor-web/assets/{dist-Bc5iA5k1.js → dist-Cqu9f1N5.js} +1 -1
  51. package/editor-web/assets/{dist-0emakyZE.js → dist-CsDICOqP.js} +1 -1
  52. package/editor-web/assets/{dist-B6KzR3pN.js → dist-DegNYCaB.js} +1 -1
  53. package/editor-web/assets/{dist-CiHNHwyq.js → dist-EotuIcA_.js} +1 -1
  54. package/editor-web/assets/index-CwDs3z43.js +69 -0
  55. package/editor-web/assets/minus-DLhpe7h_.js +1 -0
  56. package/editor-web/assets/{react-C_-rEEBU.js → react-CT8OUeCe.js} +1 -1
  57. package/editor-web/assets/{tabs-Den4gHrU.js → tabs-BEPTOFm5.js} +1 -1
  58. package/editor-web/assets/{text-align-start-CsW4nqqL.js → text-align-start-CfqIQSWH.js} +1 -1
  59. package/editor-web/index.html +2 -2
  60. package/package.json +2 -2
  61. package/editor-web/assets/index-CFt3ovRY.js +0 -69
  62. package/editor-web/assets/minus-BhoPZC5P.js +0 -1
@@ -0,0 +1 @@
1
+ import{nn as e}from"./react-CT8OUeCe.js";var t=e(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]);export{t};
@@ -53,7 +53,7 @@ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";var n=t((e=>{var t=Symbol.f
53
53
 
54
54
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=D,c=!Ve.jitless,l=c&&ee.value,d=t.catchall,f;e._zod.parse=(i,u)=>{f??=r.value;let p=i.value;return s(p)?c&&l&&u?.async===!1&&u.jitless!==!0?(o||=a(t.shape),i=o(i,u),d?xr([],p,i,u,f,e,u?.abortEarly===!0):i):n(i,u):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function wr(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=>!de(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=>_e(e,r,He())))}),t)}var Tr=R(`$ZodUnion`,(e,t)=>{z.init(e,t),L(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),L(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),L(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),L(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>f(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=>wr(t,r,e,i)):wr(o,r,e,i)}});function Er(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Dr=R(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Tr.init(e,t);let n=e._zod.parse;L(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||g(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=_(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=u(()=>Er(t));e._zod.parse=(i,a)=>{let o=i.value;if(!D(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._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()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Or=R(`$ZodIntersection`,(e,t)=>{z.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])=>Ar(e,t,n)):Ar(e,i,a)}});function kr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(O(e)&&O(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=kr(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=kr(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 Ar(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=kr(t.value,n.value);if(!c.valid){if(de(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var jr=R(`$ZodTuple`,(e,t)=>{z.init(e,t);let n=t.items,r=Ve.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Mr(n,`optin`),l=Mr(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=de(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(de(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Nr(t,i,e))):Nr(r,i,e)}}return s.length?Promise.all(s).then(()=>Pr(u,i,n,o,l)):Pr(u,i,n,o,l)}});function Mr(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Nr(e,t,n){e.issues.length&&t.issues.push(...pe(n,e.issues)),t.value[n]=e.value}function Pr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...pe(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Fr=R(`$ZodRecord`,(e,t)=>{z.init(e,t);let n=Ve.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!O(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>_e(e,i,He())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...pe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...pe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Jt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>_e(e,i,He())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...pe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...pe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ir=R(`$ZodEnum`,(e,t)=>{z.init(e,t);let n=o(t.entries),r=new Set(n);e._zod.values=r,L(e,`pattern`,e=>{let t=o(e.def.entries).filter(e=>te.has(typeof e));return RegExp(t.length?`^(${t.map(e=>A(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Lr=R(`$ZodLiteral`,(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,L(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?A(e):e?A(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Rr=R(`$ZodTransform`,(e,t)=>{z.init(e,t),e._zod.optin=`optional`,Ve.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(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));if(i instanceof Promise)throw new ze;return n.value=i,n}});function zr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Br=R(`$ZodOptional`,(e,t)=>{z.init(e,t),L(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,L(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),L(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>zr(e,t)):zr(e,r)}return t.innerType._zod.run(e,n)}}),Vr=R(`$ZodExactOptional`,(e,t)=>{Br.init(e,t),L(e,`values`,e=>e.def.innerType._zod.values),L(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hr=R(`$ZodNullable`,(e,t)=>{z.init(e,t),L(e,`optin`,e=>e.def.innerType._zod.optin),L(e,`optout`,e=>e.def.innerType._zod.optout),L(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)}|null)$`):void 0}),L(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ur=R(`$ZodDefault`,(e,t)=>{z.init(e,t),e._zod.optin=`defaulted`,L(e,`values`,e=>e.def.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=>Wr(e,t)):Wr(r,t)}});function Wr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Gr=R(`$ZodPrefault`,(e,t)=>{z.init(e,t),e._zod.optin=`defaulted`,L(e,`values`,e=>e.def.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))}),Kr=R(`$ZodNonOptional`,(e,t)=>{z.init(e,t),L(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>qr(t,e)):qr(i,e)}});function qr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Jr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>_e(e,r,He()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Yr=R(`$ZodCatch`,(e,t)=>{z.init(e,t),L(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),L(e,`optout`,e=>e.def.innerType._zod.optout),L(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Jr(e,r,t,n)):Jr(e,r,t,n)}}),Xr=R(`$ZodPipe`,(e,t)=>{z.init(e,t),L(e,`values`,e=>e.def.in._zod.values),L(e,`optin`,e=>e.def.in._zod.optin),L(e,`optout`,e=>e.def.out._zod.optout),L(e,`propValues`,e=>e.def.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=>Zr(e,t.in,n)):Zr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Zr(e,t.out,n)):Zr(r,t.out,n)}});function Zr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Qr=R(`$ZodReadonly`,(e,t)=>{z.init(e,t),L(e,`propValues`,e=>e.def.innerType._zod.propValues),L(e,`values`,e=>e.def.innerType._zod.values),L(e,`optin`,e=>e.def.innerType?._zod?.optin),L(e,`optout`,e=>e.def.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($r):$r(r)}});function $r(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ei=R(`$ZodLazy`,(e,t)=>{z.init(e,t),h(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),L(e,`pattern`,e=>e.innerType?._zod?.pattern),L(e,`propValues`,e=>e.innerType?._zod?.propValues),L(e,`optin`,e=>e.innerType?._zod?.optin??void 0),L(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ti=R(`$ZodCustom`,(e,t)=>{$t.init(e,t),z.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=>ni(t,n,r,e));ni(i,n,r,e)}});function ni(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(Se(e))}}var ri=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ii=`~memo`,ai=[];function oi(e){return typeof e==`object`&&!!e}function si(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ci=new WeakMap,li=0,ui=1,di=2;function fi(e,t,n){let r=ci.get(e);if(r!==void 0)return r?di:li;if(t.has(e))return di;t.add(e);let i=li,a=e=>{if(i!==di&&e?._zod){let r=fi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=li;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?ui:o.value?._zod?fi(o.value,t,n):li;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=_(c);s(e?o(e,!0):ui),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?fi(r,t,!1):ui);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),pi(e,i)}function pi(e,t){return t!==ui&&ci.set(e,t===di),t}function mi(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var hi,gi=[],_i={alloc(e,t,n){let r=hi;if(!r)return n;hi=void 0;let i={value:n,issues:null};return r.set(t.value,i),gi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&yi(n,e.value))throw new ri;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=fi(e,new Set,!1);if(i===li)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===di||r?n=!0:r=!0}let l=s.value;if(!oi(l))return t(s,c);let u=c[ii];u||(u={buckets:new WeakMap,backEdges:void 0},c[ii]=u);let d;i===c?d=a:(d=mi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...si(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;hi=d;let p=gi.length,m=t(s,c);hi=void 0;let h=gi.length>p?gi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?si(e.issues):ai),e)):(h&&(h.issues=m.issues.length?si(m.issues):ai),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function vi(){return _i}function yi(e,t){let n=e[ii]?.backEdges;return n!==void 0&&oi(t)&&n.has(t)}var bi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(xe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${N(e.values[0])}`:`Invalid option: expected one of ${s(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${s(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function xi(){return{localeError:bi()}}var Si,Ci=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 wi(){return new Ci}(Si=globalThis).__zod_globalRegistry??(Si.__zod_globalRegistry=wi());var Ti=globalThis.__zod_globalRegistry;function Ei(e){return e.checks&&=[...e.checks],e}function Di(e,t){return new e(Ei({type:`string`,...M(t)}))}function Oi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function ki(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Ai(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function Mi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Pi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Fi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Ii(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function Li(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Ri(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function zi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Bi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Vi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function Hi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Ui(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function Wi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Gi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Ki(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function qi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Ji(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Yi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Xi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Zi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function Qi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function $i(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function ea(e,t){return new e(Ei({type:`number`,checks:[],...M(t)}))}function ta(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function na(e,t){return new e({type:`boolean`,...M(t)})}function ra(e,t){return new e({type:`null`,...M(t)})}function ia(e){return new e({type:`unknown`})}function aa(e,t){return new e({type:`never`,...M(t)})}function oa(e,t){return new nn({check:`less_than`,...M(t),value:e,inclusive:!1})}function sa(e,t){return new nn({check:`less_than`,...M(t),value:e,inclusive:!0})}function ca(e,t){return new rn({check:`greater_than`,...M(t),value:e,inclusive:!1})}function la(e,t){return new rn({check:`greater_than`,...M(t),value:e,inclusive:!0})}function ua(e,t){return new an({check:`multiple_of`,...M(t),value:e})}function da(e,t){return new sn({check:`max_length`,...M(t),maximum:e})}function fa(e,t){return new cn({check:`min_length`,...M(t),minimum:e})}function pa(e,t){return new ln({check:`length_equals`,...M(t),length:e})}function ma(e,t){return new dn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function ha(e){return new fn({check:`string_format`,format:`lowercase`,...M(e)})}function ga(e){return new pn({check:`string_format`,format:`uppercase`,...M(e)})}function _a(e,t){return new mn({check:`string_format`,format:`includes`,...M(t),includes:e})}function va(e,t){return new hn({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function ya(e,t){return new gn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function ba(e){return new _n({check:`overwrite`,tx:e})}function xa(e){return ba(t=>t.normalize(e))}function Sa(){return ba(e=>e.trim())}function Ca(){return ba(e=>e.toLowerCase())}function wa(){return ba(e=>e.toUpperCase())}function Ta(){return ba(e=>T(e))}function Ea(e,t,n){return new e({type:`array`,element:t,...M(n)})}function Da(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function Oa(e,t){let n=ka(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Se(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Se(r))}},e(t.value,t)),t);return n}function ka(e,t){let n=new $t({check:`custom`,...M(t)});return n._zod.check=e,n}function Aa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&g(e,t,n[t]);return e}function ja(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??Ti,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ma(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Na(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,Na(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Aa(o.schema,c),t.io===`input`&&Ua(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 Pa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Fa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${Pa(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Pa(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>
55
55
 
56
- 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ia(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ia(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var La=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ra=[`oneOf`,`anyOf`];function za(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ba(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!La.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??za(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}g(n,r,e.length===1?e[0]:Ba(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=za(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Va(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of La)if(t in e)return;let n=t.filter(e=>Ra.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ba(t);else{let e=n[0],i=Ra.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ba([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Aa(e,r))}function Ha(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)):Aa(i,s),Aa(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ia(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Va(e)}}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)}Aa(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,g(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:Ga(t,`input`,e.processors),output:Ga(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ua(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 Ua(r.element,n);if(r.type===`set`)return Ua(r.valueType,n);if(r.type===`lazy`)return Ua(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`||r.type===`catch`)return Ua(r.innerType,n);if(r.type===`intersection`)return Ua(r.left,n)||Ua(r.right,n);if(r.type===`record`||r.type===`map`)return Ua(r.keyType,n)||Ua(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ua(r.in,n)||Ua(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ua(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ua(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ua(e,n))return!0;return!!(r.rest&&Ua(r.rest,n))}return!1}var Wa=(e,t={})=>n=>{let r=ja({...n,processors:t});return Na(e,r),Fa(r,e),Ha(r,e)},Ga=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ja({...i??{},target:a,io:t,processors:n});return Na(e,o),Fa(o,e),Ha(o,e)},Ka=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},qa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ja=(e,t)=>{Ka(e,`minimum`,t),qa(e,`maximum`,t)},Ya=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Xa=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Za=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Qa=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},$a=(e,t)=>Ka(e,`minimum`,t.minimum),eo=(e,t)=>qa(e,`maximum`,t.maximum),to=e=>(t,n)=>{Qa(t,n.format);let[r,i]=e[n.format];Ka(t,`minimum`,r),qa(t,`maximum`,i)},no={greater_than:(e,t)=>Ka(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>qa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ya(e,t.value),number_format:to(F),bigint_format:to(I),min_length:$a,max_length:eo,length_equals:(e,t)=>Ja(e,t.length),min_size:$a,max_size:eo,size_equals:(e,t)=>Ja(e,t.size),string_format:(e,t)=>{Qa(e,t.format),t.pattern&&Xa(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Za(e,t.mime)};function ro(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)no[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ka(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ka(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&qa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&qa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ya(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Za(t,i.mime);for(let e of i.patterns??[])Xa(t,e);return t}var io={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ao=new Map([[er,It],[nr,Lt]]),oo=e=>ao.get(e)??e,so=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ro(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=io[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(oo);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}))])}},co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ro(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ma(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},lo=(e,t,n,r)=>{n.type=`boolean`},uo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},fo=(e,t,n,r)=>{n.not={}},po=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},mo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ma(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ma(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},ho=(e,t,n,r)=>{Ma(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},go=(e,t,n,r)=>{Ma(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},_o=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ro(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Na(a.element,t,{...r,path:[...r.path,`items`]})};function vo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?vo(t.out):t.type===`catch`?vo(t.innerType):e._zod.optin}var yo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ma(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)g(i.properties,e,Na(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?vo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Na(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},bo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Na(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},xo=(e,t,n,r)=>{let i=e._zod.def,a=Na(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Na(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},So=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Na(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Na(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?vo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=ro(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Co(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Co(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Co(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Jt:qt).source)),p}var wo=new WeakMap;function To(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of wo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Co(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Eo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=ro(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Na(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)g(i.patternProperties,oo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Na(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=wo.get(t);n||(n=[],wo.set(t,n),t.deferred.push(()=>To(t))),n.push(e)}i.additionalProperties=Na(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&vo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Do=(e,t,n,r)=>{let i=e._zod.def,a=Na(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`}]},Oo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ko=Symbol();function Ao(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ma(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ko):JSON.parse(o)}var jo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ao(i.defaultValue,e,t,n,r);o!==ko&&(n.default=o)},Mo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ao(i.defaultValue,e,t,n,r);o!==ko&&(n._prefault=o)},No=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ma(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Po=(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;Na(o,t,r);let s=t.seen.get(e);s.ref=o},Fo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Io=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=(e,t,n,r)=>{let i=e._zod.innerType;Na(i,t,r);let a=t.seen.get(e);a.ref=i},Ro=new WeakSet([Object.prototype,Error.prototype]);function zo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Bo=R(`ZodError`,(e,t)=>{Je.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Ro.has(n)||(Ro.add(n),zo(n,`format`,e=>t=>Ze(e,t)),zo(n,`flatten`,e=>t=>Xe(e,t)),zo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),zo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Vo=tt(Bo),Ho=nt(Bo),Uo=rt(Bo),Wo=at(Bo),Go=dt(Bo),Ko=ft(Bo),qo=pt(Bo),Jo=mt(Bo),Yo=ht(Bo),Xo=gt(Bo),Zo=_t(Bo),Qo=vt(Bo);function $o(){Ve.localeError||He(xi())}function es(){Ve.memoizer||He({memoizer:vi()})}var V=R(`ZodType`,(e,t)=>($o(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C(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 j(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ec(e,t))},superRefine(e,t){return this.check(Dc(e,t))},overwrite(e){return this.check(ba(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return G(this)},or(e){return Us([this,e])},and(e){return qs(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return Ti.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ti.get(this);let t=this.clone();return Ti.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Te(this,`~standard`,{...Sn(this),jsonSchema:{input:Ga(this,`input`),output:Ga(this,`output`)}})},set"~standard"(e){we(this,`~standard`,e)},parse:function e(t,n){return Vo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ho(this,t,n,{callee:e})},safeParse(e,t){return Uo(this,e,t)},async safeParseAsync(e,t){return Wo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){we(this,`spa`,e)},validate(e,t){return ct(this,e,t)},validateAsync(e,t){return ut(this,e,t)},encode:function e(t,n){return Go(this,t,n,{callee:e})},decode:function e(t,n){return Ko(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await qo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Jo(this,t,n,{callee:e})},safeEncode(e,t){return Yo(this,e,t)},safeDecode(e,t){return Xo(this,e,t)},async safeEncodeAsync(e,t){return Zo(this,e,t)},async safeDecodeAsync(e,t){return Qo(this,e,t)},toJSONSchema(e){return Wa(this,{})(e)},get description(){return Ti.get(this)?.description},get _def(){return this._zod.def}}),ts=R(`_ZodString`,(e,t)=>{Cn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)},Ee({format:e=>ro(e).format??null,minLength:e=>ro(e).minimum??null,maxLength:e=>ro(e).maximum??null},{regex(...e){return this.check(ma(...e))},includes(...e){return this.check(_a(...e))},startsWith(...e){return this.check(va(...e))},endsWith(...e){return this.check(ya(...e))},min(...e){return this.check(fa(...e))},max(...e){return this.check(da(...e))},length(...e){return this.check(pa(...e))},nonempty(...e){return this.check(fa(1,...e))},lowercase(e){return this.check(ha(e))},uppercase(e){return this.check(ga(e))},trim(){return this.check(Sa())},normalize(...e){return this.check(xa(...e))},toLowerCase(){return this.check(Ca())},toUpperCase(){return this.check(wa())},slugify(){return this.check(Ta())}})),ns=R(`ZodString`,(e,t)=>{Cn.init(e,t),ts.init(e,t)},{email(e){return this.check(Oi(cs,e))},url(e){return this.check(Pi(ds,e))},jwt(e){return this.check(Yi(Os,e))},emoji(e){return this.check(Fi(ps,e))},guid(e){return this.check(ki(ls,e))},uuid(e){return this.check(Ai(us,e))},uuidv4(e){return this.check(ji(us,e))},uuidv6(e){return this.check(Mi(us,e))},uuidv7(e){return this.check(Ni(us,e))},nanoid(e){return this.check(Ii(ms,e))},cuid(e){return this.check(Li(hs,e))},cuid2(e){return this.check(Ri(gs,e))},ulid(e){return this.check(zi(_s,e))},base64(e){return this.check(Ki(ws,e))},base64url(e){return this.check(qi(Es,e))},xid(e){return this.check(Bi(vs,e))},ksuid(e){return this.check(Vi(ys,e))},ipv4(e){return this.check(Hi(bs,e))},ipv6(e){return this.check(Ui(xs,e))},cidrv4(e){return this.check(Wi(Ss,e))},cidrv6(e){return this.check(Gi(Cs,e))},e164(e){return this.check(Ji(Ds,e))},datetime(e){return this.check(Xi(is,e))},date(e){return this.check(Zi(as,e))},time(e){return this.check(Qi(os,e))},duration(e){return this.check($i(ss,e))}});function H(e){return Di(ns,e)}var rs=R(`ZodStringFormat`,(e,t)=>{B.init(e,t),ts.init(e,t)}),is=R(`ZodISODateTime`,(e,t)=>{Hn.init(e,t),rs.init(e,t)}),as=R(`ZodISODate`,(e,t)=>{Un.init(e,t),rs.init(e,t)}),os=R(`ZodISOTime`,(e,t)=>{Wn.init(e,t),rs.init(e,t)}),ss=R(`ZodISODuration`,(e,t)=>{Gn.init(e,t),rs.init(e,t)}),cs=R(`ZodEmail`,(e,t)=>{En.init(e,t),rs.init(e,t)}),ls=R(`ZodGUID`,(e,t)=>{wn.init(e,t),rs.init(e,t)}),us=R(`ZodUUID`,(e,t)=>{Tn.init(e,t),rs.init(e,t)}),ds=R(`ZodURL`,(e,t)=>{Pn.init(e,t),rs.init(e,t)});function fs(e){return Pi(ds,e)}var ps=R(`ZodEmoji`,(e,t)=>{Fn.init(e,t),rs.init(e,t)}),ms=R(`ZodNanoID`,(e,t)=>{In.init(e,t),rs.init(e,t)}),hs=R(`ZodCUID`,(e,t)=>{Ln.init(e,t),rs.init(e,t)}),gs=R(`ZodCUID2`,(e,t)=>{Rn.init(e,t),rs.init(e,t)}),_s=R(`ZodULID`,(e,t)=>{zn.init(e,t),rs.init(e,t)}),vs=R(`ZodXID`,(e,t)=>{Bn.init(e,t),rs.init(e,t)}),ys=R(`ZodKSUID`,(e,t)=>{Vn.init(e,t),rs.init(e,t)}),bs=R(`ZodIPv4`,(e,t)=>{Kn.init(e,t),rs.init(e,t)}),xs=R(`ZodIPv6`,(e,t)=>{Yn.init(e,t),rs.init(e,t)}),Ss=R(`ZodCIDRv4`,(e,t)=>{Xn.init(e,t),rs.init(e,t)}),Cs=R(`ZodCIDRv6`,(e,t)=>{Qn.init(e,t),rs.init(e,t)}),ws=R(`ZodBase64`,(e,t)=>{tr.init(e,t),rs.init(e,t)});function Ts(e){return Ki(ws,e)}var Es=R(`ZodBase64URL`,(e,t)=>{ir.init(e,t),rs.init(e,t)}),Ds=R(`ZodE164`,(e,t)=>{ar.init(e,t),rs.init(e,t)}),Os=R(`ZodJWT`,(e,t)=>{sr.init(e,t),rs.init(e,t)}),ks=R(`ZodNumber`,(e,t)=>{cr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.isFinite=!0},Ee({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=ro(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=ro(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=ro(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ro(e).format??null},{gt(e,t){return this.check(ca(e,t))},gte(e,t){return this.check(la(e,t))},min(e,t){return this.check(la(e,t))},lt(e,t){return this.check(oa(e,t))},lte(e,t){return this.check(sa(e,t))},max(e,t){return this.check(sa(e,t))},int(e){return this.check(js(e))},safe(e){return this.check(js(e))},positive(e){return this.check(ca(0,e))},nonnegative(e){return this.check(la(0,e))},negative(e){return this.check(oa(0,e))},nonpositive(e){return this.check(sa(0,e))},multipleOf(e,t){return this.check(ua(e,t))},step(e,t){return this.check(ua(e,t))},finite(){return this}}));function U(e){return ea(ks,e)}var As=R(`ZodNumberFormat`,(e,t)=>{lr.init(e,t),ks.init(e,t)});function js(e){return ta(As,e)}var Ms=R(`ZodBoolean`,(e,t)=>{ur.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)});function Ns(e){return na(Ms,e)}var Ps=R(`ZodNull`,(e,t)=>{dr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Fs(e){return ra(Ps,e)}var Is=R(`ZodUnknown`,(e,t)=>{fr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function W(){return ia(Is)}var Ls=R(`ZodNever`,(e,t)=>{pr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r)});function Rs(e){return aa(Ls,e)}var zs=R(`ZodArray`,(e,t)=>{es(),_r.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.element=t.element},{min(e,t){return this.check(fa(e,t))},nonempty(e){return this.check(fa(1,e))},max(e,t){return this.check(da(e,t))},length(e,t){return this.check(pa(e,t))},unwrap(){return this.element}});function G(e,t){return Ea(zs,e,t)}var Bs=R(`ZodObject`,(e,t)=>{es(),Cr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),Me(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ec(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(C(this._zod.def,{catchall:e}))},passthrough(){return this.clone(C(this._zod.def,{catchall:W()}))},loose(){return this.clone(C(this._zod.def,{catchall:W()}))},strict(){return this.clone(C(this._zod.def,{catchall:Rs()}))},strip(){return this.clone(C(this._zod.def,{catchall:void 0}))},extend(e){return ae(this,e)},safeExtend(e){return se(this,e)},merge(e){return ce(this,e)},pick(e){return ne(this,e)},omit(e){return ie(this,e)},partial(...e){return le(ac,this,e[0])},exactPartial(...e){return le(sc,this,e[0],`exactPartial`)},required(...e){return ue(hc,this,e[0])}});function K(e,t){return new Bs({type:`object`,shape:e??{},...M(t)})}function q(e,t){return new Bs({type:`object`,shape:e,catchall:Rs(),...M(t)})}function Vs(e,t){return new Bs({type:`object`,shape:e,catchall:W(),...M(t)})}var Hs=R(`ZodUnion`,(e,t)=>{Tr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.options=t.options});function Us(e,t){return new Hs({type:`union`,options:e,...M(t)})}var Ws=R(`ZodDiscriminatedUnion`,(e,t)=>{Hs.init(e,t),Dr.init(e,t)});function Gs(e,t,n){return new Ws({type:`union`,options:t,discriminator:e,...M(n)})}var Ks=R(`ZodIntersection`,(e,t)=>{Or.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function qs(e,t){return new Ks({type:`intersection`,left:e,right:t})}var Js=R(`ZodTuple`,(e,t)=>{es(),jr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new ac({type:`optional`,innerType:e}))})}});function Ys(e,t,n){let r=t instanceof z;return new Js({type:`tuple`,items:e,rest:r?t:null,...M(r?n:t)})}var Xs=R(`ZodRecord`,(e,t)=>{es(),Fr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Zs(e,t,n){return!t||!t._zod?new Xs({type:`record`,keyType:H(),valueType:e,...M(t)}):new Xs({type:`record`,keyType:e,valueType:t,...M(n)})}function Qs(e,t,n){return new Xs({type:`record`,keyType:e,valueType:t,...M(n),partial:!0})}var $s=R(`ZodEnum`,(e,t)=>{Ir.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 $s({...t,checks:[],...M(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 $s({...t,checks:[],...M(r),entries:i})}});function ec(e,t){return new $s({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var tc=R(`ZodLiteral`,(e,t)=>{Lr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(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 nc(e,t){return new tc({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var rc=R(`ZodTransform`,(e,t)=>{es(),Rr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Se(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Se(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ic(e){return new rc({type:`transform`,transform:e})}var ac=R(`ZodOptional`,(e,t)=>{Br.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}var sc=R(`ZodExactOptional`,(e,t)=>{Vr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}var lc=R(`ZodNullable`,(e,t)=>{Hr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}var dc=R(`ZodDefault`,(e,t)=>{Ur.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}var pc=R(`ZodPrefault`,(e,t)=>{Gr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}var hc=R(`ZodNonOptional`,(e,t)=>{Kr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...M(t)})}var _c=R(`ZodCatch`,(e,t)=>{Yr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Pe(t)})}var yc=R(`ZodPipe`,(e,t)=>{Xr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}var xc=R(`ZodReadonly`,(e,t)=>{Qr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}var Cc=R(`ZodLazy`,(e,t)=>{ei.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function wc(e){return new Cc({type:`lazy`,getter:e})}var Tc=R(`ZodCustom`,(e,t)=>{ti.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function Ec(e,t={}){return Da(Tc,e,t)}function Dc(e,t){return Oa(e,t)}function Oc(e){return Xi(is,e)}function kc(e){return Zi(as,e)}q({jsonrpc:nc(`2.0`),id:Us([H(),js()]),method:H().min(1),params:W().optional()}),q({jsonrpc:nc(`2.0`),method:H().min(1),params:W().optional()});var Ac=q({code:js(),message:H(),data:W().optional()});Us([q({jsonrpc:nc(`2.0`),id:Us([H(),js()]),result:W()}),q({jsonrpc:nc(`2.0`),id:Us([H(),js(),Fs()]),error:Ac})]);var jc={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,conflict:-32001,notFound:-32002,invalid:-32003,forbidden:-32004,unavailable:-32005},J=(e,t,n)=>({params:e,result:t,about:n}),Mc=(e,t)=>({params:e,about:t}),Nc=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RpcError`,this.code=e,this.data=n}};async function Pc(e,t,n){let{id:r}=n,i=Object.hasOwn(e,n.method)?e[n.method]:void 0;if(!i)return{jsonrpc:`2.0`,id:r,error:{code:jc.methodNotFound,message:`There is no method "${n.method}".`}};let a=i.params.safeParse(n.params??{});if(!a.success)return{jsonrpc:`2.0`,id:r,error:{code:jc.invalidParams,message:$e(a.error)}};try{let e=t[n.method],o=await e(a.data);return{jsonrpc:`2.0`,id:r,result:i.result.parse(o)}}catch(e){return e instanceof Nc?{jsonrpc:`2.0`,id:r,error:{code:e.code,message:e.message,...e.data===void 0?{}:{data:e.data}}}:{jsonrpc:`2.0`,id:r,error:{code:jc.internal,message:e instanceof Error?e.message:String(e)}}}}var Y=H().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(`/`).includes(`..`),{message:`A path is inside the project.`}),Fc=H().regex(/^[0-9a-f]{64}$/u).nullable(),Ic=q({kind:ec([`person`,`agent`,`tool`]),name:H().min(1)}),Lc=q({path:Y,size:js().nonnegative(),modified:U()}),Rc={"files/read":J(q({path:Y}),q({text:H(),version:Fc}),`A text file, with its version; a file that is not there reads as empty with version null.`),"files/write":J(q({path:Y,text:H(),over:Fc}),q({version:Fc}),`Writes a text file over the version read. Errors: conflict (data: { text, version }) when it changed; invalid (data: { problems }) when its format refuses it.`),"files/upload":J(q({dir:Y,name:H().min(1),data:Ts()}),q({path:Y}),`Keeps a file the person added, under a free name in the folder.`),"files/url":J(q({path:Y}),q({url:H()}),`An address a page can load the file from (a picture, a video).`),"files/list":J(q({dir:H()}),q({files:G(Lc),dirs:G(Y)}),`A folder's files and folders, as on disk.`),"files/move":J(q({from:Y,to:Y}),q({rewritten:G(Y)}),`Moves a file or a folder, and rewrites the relative imports and links that pointed at it, as an editor does.`),"files/remove":J(q({path:Y}),q({trash:H()}),`Moves a file or folder to the recycle bin (nothing is deleted).`),"files/trash":J(q({}),q({entries:G(q({id:H(),path:Y,removed:U()}))}),`What the recycle bin holds.`),"files/restore":J(q({id:H()}),q({path:Y}),`Puts a removed thing back where it was; refused while something is there.`),"files/watch":J(q({paths:G(Y).min(1)}),q({watch:H()}),"Starts telling `files/changed` for these files or folders."),"files/unwatch":J(q({watch:H()}),q({}),`Stops a watch.`)},zc={"files/changed":Mc(q({watch:H(),changes:G(q({path:Y,version:Fc,by:Ic.optional()}))}),`Files under a watch changed, other than by this client's own writes.`)},Bc=`website.json`,Vc=q({$schema:H().optional(),dev:H().min(1).optional().describe("The command that serves the website while it is made, run in its folder by a shell. It listens on $PORT at $HOST, which the host sets (`astro dev --port $PORT --host $HOST --ignore-lock`), and allows the hosts in $ALLYHUB_PREVIEW_HOSTS when its server checks the Host header. None: the output folder is served as it is."),build:H().min(1).optional().describe("The command that builds the website into its output folder (`astro build`). None: it is not built."),output:H().min(1).describe("The folder that is the built website, from the website's folder (`dist`); `.` for a website of plain files."),site:H().min(1).optional().describe("The hosted site this website publishes to, written by `allyhub site deploy` the first time, so the folder publishes to the same site from any computer.")}),Hc=[`ts`,`tsx`,`mts`,`js`,`jsx`,`mjs`],Uc=e=>Hc.map(t=>`${e}.${t}`),Wc=[`video`,`slides`,`doc`,`sheet`,`scenery`,`website`],Gc={video:{entries:Uc(`video`),editor:`video`,name:`video`},slides:{entries:Uc(`slides`),editor:`slides`,name:`slides`},doc:{entries:[`doc.mdx`],editor:`doc`,name:`doc`},sheet:{entries:[`sheet.yaml`],editor:`sheet`,name:`sheet`},scenery:{entries:Uc(`scenery`),editor:`scenery`,name:`3D scenery`},model:{entries:Uc(`model`),editor:`scenery`,name:`3D model`},website:{entries:[Bc],editor:`website`,name:`website`}},Kc={video:{types:[`mp4`,`mov`,`gif`],extras:[`srt`,`cover`]},slides:{types:[`pptx`,`pdf`,`png`],extras:[`cover`],options:[{name:`pptx`,only:[`pptx`],values:[`native`,`picture`]},{name:`steps`,only:[`pdf`,`png`]}]},doc:{types:[`pdf`,`docx`,`png`,`md`],extras:[]},sheet:{types:[`xlsx`,`pdf`,`png`,`csv`,`md`,`json`],extras:[]},model:{types:[`glb`],extras:[]}},qc=Object.keys(Gc);new Map(qc.flatMap(e=>Gc[e].entries.map(t=>[t,e])));var Jc={item:Y,version:H().optional()},Yc=q({mime:H().regex(/^image\//u),data:Ts()}),Xc=Vs({code:H(),level:ec([`error`,`warn`]),message:H(),piece:H().optional(),part:H().optional(),t:U().optional()}),Zc=Vs({kind:H(),data:W()}),Qc=Vs({fps:U(),width:U(),height:U(),duration:U(),parts:G(W())}),$c=q({status:ec([`off`,`waiting`,`running`,`done`,`failed`]),revision:js().nonnegative(),problems:G(Xc),facts:G(Zc),versions:q({total:js(),loaded:js(),reused:js()}).optional(),error:H().optional()}),el=[`queued`,`running`,`done`,`failed`,`cancelled`],tl=Zs(H(),Us([H(),Ns()])),nl=q({id:H(),item:Y,versions:G(H()),types:G(H()),options:tl.optional(),state:ec(el),progress:U().min(0).max(1),files:G(Y),error:H().optional()}),rl=q({file:Y,status:ec([`running`,`done`,`failed`]),message:H(),share:U().min(0).max(1).optional()}),il=Ys([U(),U(),U()]),al=q({url:H(),probe:H()}),ol={"project/items":J(q({}),q({items:G(q({kind:ec(qc),dir:Y,entry:Y,title:H().optional()})),name:H(),scope:H(),revision:js().nonnegative()}),`The project's items, as the build finds them.`),"sheet/generated":J(q({item:Y}),q({generated:W().optional(),failed:Ns()}),`What a sheet's sheet.ts makes now: sheets as sheet.yaml would hold them. Never written to a file.`),"video/versions":J(q({item:Y}),q({piece:H(),kind:ec([`video`,`slides`]),title:H().optional(),width:U(),height:U(),versions:G(q({key:H(),lang:H().optional()}))}),`A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for.`),"slides/deck":J(q({item:Y}),q({piece:H(),file:Y,prefix:H(),layouts:G(H()),components:Zs(H(),W()),generators:G(H()),scripts:Zs(H(),Y),code:W(),theme:q({name:H(),colors:Zs(H(),H()),fonts:Zs(H(),H())})}),`A deck's layouts, components and generators, and its files: slides.yaml (its slides) and its script in each language (their words and notes), which the deck's editor edits.`),"video/stage":J(q({...Jc,start:q({t:U().nonnegative().optional(),part:H().optional(),offset:U().nonnegative().optional(),dur:U().positive().optional()}).optional(),play:Ns().optional(),chrome:Ns().optional(),mode:ec([`code`,`component`]).optional()}),al,`The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage.`),"video/timeline":J(q(Jc),q({timeline:Qc,text:G(W())}),`A version's timeline, drawn nowhere.`),"video/still":J(q({...Jc,t:U().nonnegative().optional()}),q({t:U(),image:Yc,width:js().positive(),height:js().positive(),duration:U().nonnegative()}),`A moment of a version as the render draws it, as a picture.`),"video/stills":J(q({...Jc,moments:G(U().nonnegative()).min(1).max(32)}),q({stills:G(q({t:U(),image:Yc}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"slides/fonts":J(q({item:Y}),q({faces:G(q({family:H(),url:fs(),weight:H().optional(),style:H().optional(),stretch:H().optional(),unicodeRange:H().optional()}))}),`The font faces a deck's slides draw with: the stage's own (the theme's standard fonts), allyhub.config.ts's fonts and what the deck's code imports, for a document that draws its slides without the project's stylesheets.`),"slides/component-stills":J(q({...Jc,components:G(q({name:H(),props:Zs(H(),W()),width:U().positive(),height:U().positive(),t:U().nonnegative()})).min(1).max(64)}),q({stills:G(q({key:H(),url:fs()}).nullable())}),`Components of a deck drawn alone, transparent, as the render draws them: pictures kept by what they show, given as addresses.`),"check/results":J(q({}),$c,`The check run after edits, as it stands.`),"check/run":J(q({}),q({}),`Runs the check again now.`),"export/start":J(q({item:Y,versions:G(H()).optional(),types:G(H().min(1)).max(10).optional(),options:tl.optional()}),q({job:nl}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":J(q({job:H()}),q({}),`Stops an export.`),"export/list":J(q({}),q({jobs:G(nl),reveal:Ns()}),`The exports asked for since the server started.`),"export/reveal":J(q({path:Y}),q({}),"Shows an exported file in the person's file manager, where the server runs on their computer (`export/list`'s `reveal`)."),"scenery/viewer":J(q({item:Y,camera:q({position:il,target:il}).optional()}),al,`The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.`)},sl={"project/changed":Mc(q({revision:js().nonnegative()}),`The build saw a change: a stage or a timeline asked for now is the new one's.`),"check/changed":Mc($c,`The check started, ended or failed.`),"export/changed":Mc(q({job:nl}),`An export moved on.`),"index/changed":Mc(q({jobs:G(rl)}),`Making what the media index lacks moved on.`)},cl=ec([`light`,`dark`]),ll=Us([q({t:U().nonnegative()}),q({slide:H().min(1)})]),ul=[`t`,`slide`];function dl(e){return e===void 0?{}:`t`in e?{t:String(Math.round(e.t*1e3)/1e3)}:{slide:e.slide}}function fl(e){let t=e.get(`t`),n=ll.safeParse(t===null?{slide:e.get(`slide`)}:{t:Number(t)});return n.success?n.data:void 0}var pl=q({locale:H().min(2),theme:cl,agent:q({name:H().min(1)}).optional(),project:q({name:H().min(1)}),notes:Ns().optional(),audienceWindow:Ns().optional(),readOnly:Ns().optional(),viewer:Ns().optional(),place:ll.optional(),item:q({kind:ec(qc),dir:Y,entry:Y}),editor:ec(Wc)}),ml=Gs(`type`,[q({type:nc(`file`),path:Y,line:js().positive().optional()}),q({type:nc(`browser`),url:fs({protocol:/^https?$/u}).optional(),tabId:H().min(1).optional()})]),hl=`allyhub-audience`,gl={"host/context":J(q({}),pl,`Where the editor runs.`),"items/open":J(q({target:ml}),q({}),`Shows another item, a file or a page, where the host shows things.`),"storage/get":J(q({key:H().min(1)}),q({value:W()}),`What the editor kept for this person on this computer (a hand sort, what was last seen), or null.`),"storage/set":J(q({key:H().min(1),value:W()}),q({}),`Keeps a value for this person on this computer; null removes it.`),"editor/state":J(q({state:ec([`saved`,`saving`,`unsaved`,`error`]),message:H().optional()}),q({}),`Says whether what the person typed is saved.`),"editor/place":J(q({place:ll}),q({}),"Says where the person is in the item (a video's moment, a deck's slide), on a pause, a seek or another slide, never each frame, so the host opens it there again (HostContext's `place`)."),"agent/ask":J(q({text:H().min(1)}),q({delivered:Ns()}),`Puts words before the person's agent, for them to go on and send; false where no agent takes them. Never sent by itself.`),"note/begin":J(q({}),q({begun:Ns()}),`Starts the host's Note mode on what is on show, as its own Note button does, so a person can mark anything up for their agent from wherever they are; false where the host has none. Sends nothing.`),"edit/request":J(q({}),q({asked:Ns()}),"The person tried to change what a read-only host shows (`readOnly`): the host offers to wake the machine that changes it; false where nothing does."),"tools/call":J(q({name:H().min(1),arguments:Zs(H(),W()).default({})}),q({result:W()}),`Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).`)};q({command:ec([`export`])}),{...zc,...sl};var _l={...Rc,...gl},vl=e=>Us([ec(e),H().min(1).brand()]),yl=e=>G(W()).transform(t=>t.flatMap(t=>{let n=e.safeParse(t);return n.success?[n.data]:[]})),bl=[`no_card`,`saving_card`,`not_a_card`,`declined`,`needs_authentication`,`not_charged`,`under_line`,`refunded`,`disputed`,`monthly_limit`],xl=[`month`,`year`];K({credits:U(),held:U(),owed:U(),frozen:H().nullable().default(null),plan:K({id:H(),name:H(),interval:vl(xl),status:H(),renewsAt:Oc().nullable(),endsAt:Oc().nullable(),monthlyCredits:U().default(0),price:K({amountCents:U(),currency:H()}).nullable().default(null)}).nullable(),allowance:K({total:U(),used:U(),renewsAt:Oc()}).nullable().default(null),bought:U().default(0),customer:Ns().default(!1),autoTopUp:K({below:U(),amountCents:U(),monthlyLimitCents:U().nullable().default(null),chargedThisMonthCents:U().default(0),stopped:vl(bl).nullable()}).nullable()}),K({plans:G(K({id:H(),name:H(),family:H().nullable().default(null),recommended:Ns().default(!1),monthlyCredits:U(),prices:G(K({interval:vl(xl),amountCents:U(),currency:H()}))})),topUp:K({currency:H(),creditsPerDollar:U(),minCents:U(),maxCents:U(),presetsCents:G(U()).default([])})}),K({days:G(K({day:kc(),credits:U(),byKind:Zs(H(),U()).default({})}))}),Us([q({plan:H(),interval:ec(xl)}),q({topUpCents:U().int()})]),Us([q({flow:ec([`home`,`payment_method`,`cancel`])}),q({flow:nc(`change_plan`),plan:H(),interval:ec(xl)})]).default({flow:`home`}),K({card:K({brand:H(),last4:H(),expMonth:U(),expYear:U()}).nullable(),email:H().nullable()}),q({topUpCents:U().int()}),q({below:U().nonnegative(),amountCents:U().int().positive(),monthlyLimitCents:U().int().positive().nullable().optional(),newCard:Ns().optional()});var Sl={tier:vl([`premium`,`standard`,`efficient`]).optional(),maker:H().min(1).optional()};K({models:G(Vs({id:H().min(1),name:H().min(1),...Sl,reasoning:Ns().optional(),input:G(H()).optional(),contextWindow:U().int().positive().optional(),maxOutput:U().int().positive().optional()})).min(1),defaultModel:H().min(1),needPlan:G(Vs({id:H().min(1),name:H().min(1),...Sl})).default([])});var Cl=Zs(H(),W()),wl=K({id:H().min(1),title:H().min(1),description:H().min(1)}),Tl=K({name:H().min(1),work:H().min(1),title:H().min(1),description:H().min(1),input:Cl,output:Cl,long:Ns()});K({version:H().min(1),works:G(wl),tools:G(Tl)}),q({input:Zs(H(),W())}),K({id:H().min(1),tool:H().min(1),status:vl([`working`,`completed`,`failed`]),output:W().optional(),error:K({kind:H().min(1),message:H().min(1)}).optional(),credits:U().nonnegative().optional(),pollAfterMs:U().int().nonnegative().optional(),createdAt:H(),endedAt:H().optional()});var El=1073741824;q({name:H().min(1).max(255),size:js().positive().max(El),sha256:H().regex(/^[0-9a-f]{64}$/u),contentType:H().min(1).max(255)}),K({id:H().min(1),upload:K({url:fs(),headers:Zs(H(),H())}).nullable()}),K({id:H().min(1),name:H()}),K({url:fs()});var Dl=H().regex(/^[0-9a-f]{64}$/u),Ol=H().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),`a relative path of forward slashes, without . or ..`),kl=K({sha256:Dl,size:js().nonnegative().max(El)}),Al=kl.extend({type:H().min(1).max(255)});q({blobs:G(kl.extend({contentType:H().min(1).max(255)})).min(1).max(1e3)}),K({uploads:G(K({sha256:Dl,url:fs(),headers:Zs(H(),H())}))});var jl=K({sessionId:H().min(1),agent:H().min(1),title:H().optional(),createdAt:Oc(),updatedAt:Oc(),transcript:Dl});K({sessionId:H().min(1),messages:G(K({method:H().min(1),params:W()}))});var Ml=[`project`,`home`],Nl=H().refine(e=>e.endsWith(`/`)&&Ol.safeParse(e.slice(0,-1)).success,`a folder of the tree, ending in /`),Pl=K({tree:G(Ol),files:G(Ol),own:Zs(Ol,Al)}),Fl=K({shared:G(Nl),items:Zs(H(),Pl)}),Il=K({format:nc(1),kind:ec(Ml),project:K({name:H().min(1).max(255)}),host:K({version:H().min(1)}),madeAt:Oc(),files:Zs(Ol,kl),tree:Zs(Ol,Al),conversations:G(jl),reach:Fl.optional()}),Ll={editor:`editor/`,runtime:`runtime/`,build:`build/`,media:`media/`,matte:`matte/`,scenery:`scenery/`,bakes:`bakes/`,stills:`stills/`,answers:`answers/`,previews:`previews/`};function Rl(e){return Array.isArray(e)?e.map(Rl):typeof e==`object`&&e?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Rl(e[t])])):e}var zl=(e,t)=>`${Ll.answers}${e}/${encodeURIComponent(JSON.stringify(Rl(t??{})))}.json`,Bl=e=>`${Ll.stills}${e}.webp`,Vl=(e,t)=>`${Ll.stills}index/${encodeURIComponent(e)}/${encodeURIComponent(t)}.json`,Hl=K({stills:Zs(H(),H().regex(/^[0-9a-f]{64}$/u))}),Ul=e=>JSON.stringify(Rl(e)),Wl={stage:`${Ll.runtime}stage.html`,viewer:`${Ll.runtime}viewer.html`,probe:`${Ll.runtime}probe.html`},Gl=e=>e.split(`/`).map(encodeURIComponent).join(`/`),Kl=[`cloud`,`computer`];H().regex(/^[A-Za-z0-9_-]{16,64}$/u);var ql=K({kind:vl(Kl),here:Ns()});q({project:q({id:H().min(1).optional(),kind:ec(Ml),name:H().min(1).max(255)}),manifest:Dl}),K({id:H().min(1),projectId:H().min(1)}),K({missing:G(Dl)});var Jl=K({id:H().min(1),madeAt:Oc(),hostVersion:H()});K({projects:yl(K({id:H().min(1),kind:ec(Ml),name:H(),latest:Jl.nullable(),executor:ql}))}),q({kind:ec(Kl)}),K({origin:fs(),expiresAt:Oc()});var Yl={manifest:`manifest.json`,files:`files/`,conversations:`conversations/`},Xl=-32010,Zl=3e5,Ql=class{next=1;pending=new Map;listeners=new Map;stop;channel;timeout;constructor(e,t={}){this.channel=e,this.timeout=t.timeout??Zl,this.stop=e.listen(e=>{this.receive(e)})}request(e,t){let n=this.next++;return new Promise((r,i)=>{let a=setTimeout(()=>{this.pending.delete(n),i(new Nc(jc.unavailable,`${e} had no answer.`))},this.timeout);this.pending.set(n,{resolve:r,reject:i,timer:a});try{this.channel.send({jsonrpc:`2.0`,id:n,method:e,params:t})}catch(e){clearTimeout(a),this.pending.delete(n),i(e instanceof Error?e:Error(String(e)))}})}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}fail(e){for(let[t,n]of this.pending)clearTimeout(n.timer),n.reject(new Nc(jc.unavailable,e)),this.pending.delete(t)}close(){this.stop(),this.fail(`The host closed.`),this.channel.close?.()}receive(e){if(typeof e!=`object`||!e)return;let t=e;if(t.jsonrpc!==`2.0`)return;if(typeof t.method==`string`&&!(`id`in t)){for(let e of this.listeners.get(t.method)??[])e(t.params);return}if(typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),clearTimeout(n.timer);let r=t.error;r?n.reject(new Nc(r.code,r.message,r.data)):n.resolve(t.result)}},$l=(e,t,n)=>{let r=e.result.safeParse(t);if(!r.success)throw new Nc(jc.internal,`The host's answer to ${n} is not what the protocol says.`);return r.data};function eu(e){let t={on:(t,n)=>e.on(t,n)};for(let[n,r]of Object.entries(_l))t[n]=async t=>$l(r,await e.request(n,t??{}),n);return t}function tu(e,t={}){let n=new Ql(e,t);return Object.assign(eu(n),{close:()=>{n.close()}})}function nu(e,t){let n=new Map,r={...e};for(let e of Object.keys(t)){let n=gl[e];r[e]=async r=>{let i=await Pc({[e]:n},{[e]:t[e]},{jsonrpc:`2.0`,id:0,method:e,params:r??{}});if(`error`in i)throw new Nc(i.error.code,i.error.message,i.error.data);return $l(n,i.result,e)}}r.on=(t,r)=>{let i=e.on(t,r),a=n.get(t);return a||(a=new Set,n.set(t,a)),a.add(r),()=>{i(),a.delete(r)}},r.notify=(e,t)=>{for(let r of n.get(e)??[])r(t)};let i,a=new Set;return r.notes=e=>{i=e;for(let e of a)e(!0);return()=>{if(i===e){i=void 0;for(let e of a)e(!1)}}},r.noteSurface=()=>i,r.onNoteSurface=e=>(a.add(e),()=>{a.delete(e)}),r}var ru=e=>new Nc(Xl,`${e} needs the machine: this is the project as it was.`),iu={...Rc,"tools/call":gl[`tools/call`]};function au(e,t={}){let n=t.fetch??fetch.bind(globalThis),r=t=>new URL(Gl(t),e).href,i=t=>new URL(t,e).href,a,o=()=>(a??=(async()=>{let e=await n(r(Yl.manifest));if(!e.ok)throw ru(`Reading this project`);let t=Il.safeParse(await e.json());if(!t.success)throw ru(`Reading this project`);return t.data})(),a),s=async(e,t)=>{let i=await n(r(zl(e,t)));if(!i.ok)throw ru(e);let a=await i.json();if(a.error)throw new Nc(a.error.code,a.error.message);return a.result},c=new Map,l=(e,t)=>{let i=Vl(e,t),a=c.get(i);return a||(a=(async()=>{let e=await n(r(i)).catch(()=>void 0),t=e?.ok===!0?await e.json().catch(()=>({})):{},a=Hl.safeParse(t);return a.success?a.data:{stills:{}}})(),c.set(i,a)),a},u=0,d={"files/read":async({path:e})=>{let t=(await o()).files[e];if(!t)return{text:``,version:null};let i=await n(r(`${Yl.files}${e}`));if(!i.ok)throw new Nc(jc.notFound,`${e} could not be read.`);return{text:await i.text(),version:t.sha256}},"files/url":async({path:e})=>{if(!(await o()).files[e])throw new Nc(jc.notFound,`There is no file ${e}.`);return{url:r(`${Yl.files}${e}`)}},"files/list":async({dir:e})=>{let t=await o(),n=Date.parse(t.madeAt),r=e===``?``:`${e.replace(/\/$/u,``)}/`,i=[],a=new Set;for(let[e,o]of Object.entries(t.files)){if(!e.startsWith(r))continue;i.push({path:e,size:o.size,modified:n});let t=e.slice(r.length).split(`/`).slice(0,-1);for(let e=1;e<=t.length;e++)a.add(`${r}${t.slice(0,e).join(`/`)}`)}return{files:i.sort((e,t)=>e.path.localeCompare(t.path)),dirs:[...a].sort()}},"files/watch":()=>Promise.resolve({watch:`w${String(++u)}`}),"files/unwatch":()=>Promise.resolve({}),"files/trash":()=>Promise.resolve({entries:[]}),"files/write":()=>Promise.reject(ru(`Saving`)),"files/upload":()=>Promise.reject(ru(`Adding a file`)),"files/move":()=>Promise.reject(ru(`Moving`)),"files/remove":()=>Promise.reject(ru(`Removing`)),"files/restore":()=>Promise.reject(ru(`Restoring`)),"tools/call":async({name:e,arguments:t})=>{if(!Object.hasOwn(ol,e))throw new Nc(jc.methodNotFound,`There is no tool ${e}.`);let n=e,r=ol[n].params.safeParse(t);if(!r.success)throw new Nc(jc.invalidParams,`${e}'s arguments.`);return{result:await f(n,r.data)}}},f=async(e,t)=>{switch(e){case`video/stage`:{let{item:n,version:r,start:a,play:o,chrome:c,mode:l}=t,u=await s(e,{item:n,...r===void 0?{}:{version:r}}),d=new URL(i(u.url));for(let[e,t]of Object.entries(a??{}))d.searchParams.set(e,String(t));return o===!0&&d.searchParams.set(`play`,`1`),c===!1&&d.searchParams.set(`chrome`,`0`),l!==void 0&&d.searchParams.set(`mode`,l),{url:d.href,probe:i(u.probe)}}case`scenery/viewer`:{let{item:e,camera:n}=t,{items:r}=await s(`project/items`,{}),a=r.find(t=>t.dir===e&&(t.kind===`scenery`||t.kind===`model`));if(!a)throw new Nc(jc.notFound,`There is no scenery or 3D model ${e}.`);let o=new URL(i(Wl.viewer));return o.searchParams.set(`file`,a.entry),n!==void 0&&o.searchParams.set(`camera`,JSON.stringify(n)),{url:o.href,probe:i(Wl.probe)}}case`slides/fonts`:{let n=await s(e,t);return{...n,faces:n.faces.map(e=>({...e,url:i(e.url)}))}}case`slides/component-stills`:{let{item:e,version:n,components:i}=t,a=n??(await s(`video/versions`,{item:e})).versions[0]?.key,{stills:o}=a===void 0?{stills:{}}:await l(e,a);return{stills:i.map(e=>{let t=o[Ul(e)];return t===void 0?null:{key:t,url:r(Bl(t))}})}}case`export/list`:return{jobs:[],reveal:!1};case`video/timeline`:case`video/still`:case`video/stills`:throw ru(e);default:return s(e,t)}},p=new Set;return tu({send(e){Pc(iu,d,e).then(e=>{for(let t of p)t(e)})},listen(e){return p.add(e),()=>p.delete(e)}})}async function ou(e,t,n){let{result:r}=await e[`tools/call`]({name:t,arguments:n}),i=ol[t].result.safeParse(r);if(!i.success)throw new Nc(jc.internal,`The answer to the tool ${t} is not what the protocol says.`);return i.data}var su=`allyhub.stage-sandbox`;function cu(e){let t=e;return typeof t==`object`&&!!t&&t.allyhub===!0&&t.type===`probe`}function lu(e){try{let t=e?.getItem(su);return t===`1`||t!==`0`&&void 0}catch{return}}async function uu(e){let t=lu(e.storage);if(t!==void 0)return t;let n,r=()=>void 0,i=await new Promise(t=>{n=setTimeout(()=>{t(!1)},e.ms??1500),r=e.open(()=>{t(!0)})});clearTimeout(n),r();try{e.storage?.setItem(su,i?`1`:`0`)}catch{}return i}function du(e){return t=>{let n=document.createElement(`iframe`);n.setAttribute(`sandbox`,`allow-scripts`),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.cssText=`position:fixed;width:1px;height:1px;left:-10px;top:-10px;border:0;opacity:0`;let r=e=>{e.source===n.contentWindow&&cu(e.data)&&t()};return window.addEventListener(`message`,r),n.src=e,document.body.append(n),()=>{window.removeEventListener(`message`,r),n.remove()}}}var fu;function pu(e){let t;try{t=sessionStorage}catch{t=void 0}return fu??=uu({open:du(e),storage:t}),fu}var mu=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends mu{};function hu(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function gu(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function _u(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function vu(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function yu(e,t){return _u(e,t,``)}function bu(e,t){return vu(e,t,``)}function xu(e,t){return t.slice(0,Su(e,t))}function Su(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Cu(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function wu(e,t){if(t)return Eu(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Tu(e,t){if(t)return Eu(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Eu(e,t){if(!t)return[Tu(e),wu(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Cu(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Du=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Ou=RegExp(`[${Du}]+|\\s+|[^${Du}]`,`ug`);new class extends mu{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Cu(e,r)}else n=e.match(Ou)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&ku(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&ku(n,i,r,null,t.intlSegmenter),e}};function ku(e,t,n,r,i){if(t&&n){let[a,o]=Eu(t.value,i),[s,c]=Eu(n.value,i);if(e){let r=hu(a,s);e.value=vu(e.value,s,r),t.value=yu(t.value,r),n.value=yu(n.value,r)}if(r){let e=gu(o,c);r.value=_u(r.value,c,e),t.value=bu(t.value,e),n.value=bu(n.value,e)}}else if(n){if(e){let e=Tu(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Tu(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Tu(r.value,i),[a,o]=Eu(t.value,i),s=hu(n,a);t.value=yu(t.value,s);let c=gu(yu(n,s),o);t.value=bu(t.value,c),r.value=_u(r.value,n,c),e.value=vu(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Tu(r.value,i),n=xu(wu(t.value,i),e);t.value=bu(t.value,n)}else if(e){let n=xu(wu(e.value,i),Tu(t.value,i));t.value=yu(t.value,n)}}new class extends mu{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Du}]+|[^\\S\\n\\r]+|[^${Du}]`,`ug`);return e.match(t)||[]}},new class extends mu{constructor(){super(...arguments),this.tokenize=Au}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
56
+ 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ia(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ia(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var La=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ra=[`oneOf`,`anyOf`];function za(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ba(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!La.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??za(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}g(n,r,e.length===1?e[0]:Ba(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=za(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Va(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of La)if(t in e)return;let n=t.filter(e=>Ra.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ba(t);else{let e=n[0],i=Ra.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ba([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Aa(e,r))}function Ha(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)):Aa(i,s),Aa(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ia(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Va(e)}}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)}Aa(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,g(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:Ga(t,`input`,e.processors),output:Ga(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ua(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 Ua(r.element,n);if(r.type===`set`)return Ua(r.valueType,n);if(r.type===`lazy`)return Ua(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`||r.type===`catch`)return Ua(r.innerType,n);if(r.type===`intersection`)return Ua(r.left,n)||Ua(r.right,n);if(r.type===`record`||r.type===`map`)return Ua(r.keyType,n)||Ua(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ua(r.in,n)||Ua(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ua(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ua(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ua(e,n))return!0;return!!(r.rest&&Ua(r.rest,n))}return!1}var Wa=(e,t={})=>n=>{let r=ja({...n,processors:t});return Na(e,r),Fa(r,e),Ha(r,e)},Ga=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ja({...i??{},target:a,io:t,processors:n});return Na(e,o),Fa(o,e),Ha(o,e)},Ka=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},qa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ja=(e,t)=>{Ka(e,`minimum`,t),qa(e,`maximum`,t)},Ya=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Xa=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Za=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Qa=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},$a=(e,t)=>Ka(e,`minimum`,t.minimum),eo=(e,t)=>qa(e,`maximum`,t.maximum),to=e=>(t,n)=>{Qa(t,n.format);let[r,i]=e[n.format];Ka(t,`minimum`,r),qa(t,`maximum`,i)},no={greater_than:(e,t)=>Ka(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>qa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ya(e,t.value),number_format:to(F),bigint_format:to(I),min_length:$a,max_length:eo,length_equals:(e,t)=>Ja(e,t.length),min_size:$a,max_size:eo,size_equals:(e,t)=>Ja(e,t.size),string_format:(e,t)=>{Qa(e,t.format),t.pattern&&Xa(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Za(e,t.mime)};function ro(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)no[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ka(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ka(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&qa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&qa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ya(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Za(t,i.mime);for(let e of i.patterns??[])Xa(t,e);return t}var io={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ao=new Map([[er,It],[nr,Lt]]),oo=e=>ao.get(e)??e,so=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ro(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=io[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(oo);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}))])}},co=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ro(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ma(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},lo=(e,t,n,r)=>{n.type=`boolean`},uo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},fo=(e,t,n,r)=>{n.not={}},po=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},mo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ma(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ma(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},ho=(e,t,n,r)=>{Ma(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},go=(e,t,n,r)=>{Ma(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},_o=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ro(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Na(a.element,t,{...r,path:[...r.path,`items`]})};function vo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?vo(t.out):t.type===`catch`?vo(t.innerType):e._zod.optin}var yo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ma(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)g(i.properties,e,Na(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?vo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Na(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},bo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Na(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},xo=(e,t,n,r)=>{let i=e._zod.def,a=Na(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Na(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},So=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Na(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Na(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?vo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=ro(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Co(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Co(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Co(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Jt:qt).source)),p}var wo=new WeakMap;function To(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of wo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Co(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Eo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=ro(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Na(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)g(i.patternProperties,oo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Na(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=wo.get(t);n||(n=[],wo.set(t,n),t.deferred.push(()=>To(t))),n.push(e)}i.additionalProperties=Na(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&vo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Do=(e,t,n,r)=>{let i=e._zod.def,a=Na(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`}]},Oo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ko=Symbol();function Ao(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ma(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ko):JSON.parse(o)}var jo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Ao(i.defaultValue,e,t,n,r);o!==ko&&(n.default=o)},Mo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Ao(i.defaultValue,e,t,n,r);o!==ko&&(n._prefault=o)},No=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ma(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Po=(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;Na(o,t,r);let s=t.seen.get(e);s.ref=o},Fo=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Io=(e,t,n,r)=>{let i=e._zod.def;Na(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Lo=(e,t,n,r)=>{let i=e._zod.innerType;Na(i,t,r);let a=t.seen.get(e);a.ref=i},Ro=new WeakSet([Object.prototype,Error.prototype]);function zo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Bo=R(`ZodError`,(e,t)=>{Je.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Ro.has(n)||(Ro.add(n),zo(n,`format`,e=>t=>Ze(e,t)),zo(n,`flatten`,e=>t=>Xe(e,t)),zo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),zo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Vo=tt(Bo),Ho=nt(Bo),Uo=rt(Bo),Wo=at(Bo),Go=dt(Bo),Ko=ft(Bo),qo=pt(Bo),Jo=mt(Bo),Yo=ht(Bo),Xo=gt(Bo),Zo=_t(Bo),Qo=vt(Bo);function $o(){Ve.localeError||He(xi())}function es(){Ve.memoizer||He({memoizer:vi()})}var V=R(`ZodType`,(e,t)=>($o(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C(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 j(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ec(e,t))},superRefine(e,t){return this.check(Dc(e,t))},overwrite(e){return this.check(ba(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return G(this)},or(e){return Us([this,e])},and(e){return qs(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return Ti.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ti.get(this);let t=this.clone();return Ti.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Te(this,`~standard`,{...Sn(this),jsonSchema:{input:Ga(this,`input`),output:Ga(this,`output`)}})},set"~standard"(e){we(this,`~standard`,e)},parse:function e(t,n){return Vo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ho(this,t,n,{callee:e})},safeParse(e,t){return Uo(this,e,t)},async safeParseAsync(e,t){return Wo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){we(this,`spa`,e)},validate(e,t){return ct(this,e,t)},validateAsync(e,t){return ut(this,e,t)},encode:function e(t,n){return Go(this,t,n,{callee:e})},decode:function e(t,n){return Ko(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await qo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Jo(this,t,n,{callee:e})},safeEncode(e,t){return Yo(this,e,t)},safeDecode(e,t){return Xo(this,e,t)},async safeEncodeAsync(e,t){return Zo(this,e,t)},async safeDecodeAsync(e,t){return Qo(this,e,t)},toJSONSchema(e){return Wa(this,{})(e)},get description(){return Ti.get(this)?.description},get _def(){return this._zod.def}}),ts=R(`_ZodString`,(e,t)=>{Cn.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)},Ee({format:e=>ro(e).format??null,minLength:e=>ro(e).minimum??null,maxLength:e=>ro(e).maximum??null},{regex(...e){return this.check(ma(...e))},includes(...e){return this.check(_a(...e))},startsWith(...e){return this.check(va(...e))},endsWith(...e){return this.check(ya(...e))},min(...e){return this.check(fa(...e))},max(...e){return this.check(da(...e))},length(...e){return this.check(pa(...e))},nonempty(...e){return this.check(fa(1,...e))},lowercase(e){return this.check(ha(e))},uppercase(e){return this.check(ga(e))},trim(){return this.check(Sa())},normalize(...e){return this.check(xa(...e))},toLowerCase(){return this.check(Ca())},toUpperCase(){return this.check(wa())},slugify(){return this.check(Ta())}})),ns=R(`ZodString`,(e,t)=>{Cn.init(e,t),ts.init(e,t)},{email(e){return this.check(Oi(cs,e))},url(e){return this.check(Pi(ds,e))},jwt(e){return this.check(Yi(Os,e))},emoji(e){return this.check(Fi(ps,e))},guid(e){return this.check(ki(ls,e))},uuid(e){return this.check(Ai(us,e))},uuidv4(e){return this.check(ji(us,e))},uuidv6(e){return this.check(Mi(us,e))},uuidv7(e){return this.check(Ni(us,e))},nanoid(e){return this.check(Ii(ms,e))},cuid(e){return this.check(Li(hs,e))},cuid2(e){return this.check(Ri(gs,e))},ulid(e){return this.check(zi(_s,e))},base64(e){return this.check(Ki(ws,e))},base64url(e){return this.check(qi(Es,e))},xid(e){return this.check(Bi(vs,e))},ksuid(e){return this.check(Vi(ys,e))},ipv4(e){return this.check(Hi(bs,e))},ipv6(e){return this.check(Ui(xs,e))},cidrv4(e){return this.check(Wi(Ss,e))},cidrv6(e){return this.check(Gi(Cs,e))},e164(e){return this.check(Ji(Ds,e))},datetime(e){return this.check(Xi(is,e))},date(e){return this.check(Zi(as,e))},time(e){return this.check(Qi(os,e))},duration(e){return this.check($i(ss,e))}});function H(e){return Di(ns,e)}var rs=R(`ZodStringFormat`,(e,t)=>{B.init(e,t),ts.init(e,t)}),is=R(`ZodISODateTime`,(e,t)=>{Hn.init(e,t),rs.init(e,t)}),as=R(`ZodISODate`,(e,t)=>{Un.init(e,t),rs.init(e,t)}),os=R(`ZodISOTime`,(e,t)=>{Wn.init(e,t),rs.init(e,t)}),ss=R(`ZodISODuration`,(e,t)=>{Gn.init(e,t),rs.init(e,t)}),cs=R(`ZodEmail`,(e,t)=>{En.init(e,t),rs.init(e,t)}),ls=R(`ZodGUID`,(e,t)=>{wn.init(e,t),rs.init(e,t)}),us=R(`ZodUUID`,(e,t)=>{Tn.init(e,t),rs.init(e,t)}),ds=R(`ZodURL`,(e,t)=>{Pn.init(e,t),rs.init(e,t)});function fs(e){return Pi(ds,e)}var ps=R(`ZodEmoji`,(e,t)=>{Fn.init(e,t),rs.init(e,t)}),ms=R(`ZodNanoID`,(e,t)=>{In.init(e,t),rs.init(e,t)}),hs=R(`ZodCUID`,(e,t)=>{Ln.init(e,t),rs.init(e,t)}),gs=R(`ZodCUID2`,(e,t)=>{Rn.init(e,t),rs.init(e,t)}),_s=R(`ZodULID`,(e,t)=>{zn.init(e,t),rs.init(e,t)}),vs=R(`ZodXID`,(e,t)=>{Bn.init(e,t),rs.init(e,t)}),ys=R(`ZodKSUID`,(e,t)=>{Vn.init(e,t),rs.init(e,t)}),bs=R(`ZodIPv4`,(e,t)=>{Kn.init(e,t),rs.init(e,t)}),xs=R(`ZodIPv6`,(e,t)=>{Yn.init(e,t),rs.init(e,t)}),Ss=R(`ZodCIDRv4`,(e,t)=>{Xn.init(e,t),rs.init(e,t)}),Cs=R(`ZodCIDRv6`,(e,t)=>{Qn.init(e,t),rs.init(e,t)}),ws=R(`ZodBase64`,(e,t)=>{tr.init(e,t),rs.init(e,t)});function Ts(e){return Ki(ws,e)}var Es=R(`ZodBase64URL`,(e,t)=>{ir.init(e,t),rs.init(e,t)}),Ds=R(`ZodE164`,(e,t)=>{ar.init(e,t),rs.init(e,t)}),Os=R(`ZodJWT`,(e,t)=>{sr.init(e,t),rs.init(e,t)}),ks=R(`ZodNumber`,(e,t)=>{cr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.isFinite=!0},Ee({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=ro(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=ro(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=ro(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>ro(e).format??null},{gt(e,t){return this.check(ca(e,t))},gte(e,t){return this.check(la(e,t))},min(e,t){return this.check(la(e,t))},lt(e,t){return this.check(oa(e,t))},lte(e,t){return this.check(sa(e,t))},max(e,t){return this.check(sa(e,t))},int(e){return this.check(js(e))},safe(e){return this.check(js(e))},positive(e){return this.check(ca(0,e))},nonnegative(e){return this.check(la(0,e))},negative(e){return this.check(oa(0,e))},nonpositive(e){return this.check(sa(0,e))},multipleOf(e,t){return this.check(ua(e,t))},step(e,t){return this.check(ua(e,t))},finite(){return this}}));function U(e){return ea(ks,e)}var As=R(`ZodNumberFormat`,(e,t)=>{lr.init(e,t),ks.init(e,t)});function js(e){return ta(As,e)}var Ms=R(`ZodBoolean`,(e,t)=>{ur.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)});function Ns(e){return na(Ms,e)}var Ps=R(`ZodNull`,(e,t)=>{dr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Fs(e){return ra(Ps,e)}var Is=R(`ZodUnknown`,(e,t)=>{fr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function W(){return ia(Is)}var Ls=R(`ZodNever`,(e,t)=>{pr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r)});function Rs(e){return aa(Ls,e)}var zs=R(`ZodArray`,(e,t)=>{es(),_r.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.element=t.element},{min(e,t){return this.check(fa(e,t))},nonempty(e){return this.check(fa(1,e))},max(e,t){return this.check(da(e,t))},length(e,t){return this.check(pa(e,t))},unwrap(){return this.element}});function G(e,t){return Ea(zs,e,t)}var Bs=R(`ZodObject`,(e,t)=>{es(),Cr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),Me(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ec(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(C(this._zod.def,{catchall:e}))},passthrough(){return this.clone(C(this._zod.def,{catchall:W()}))},loose(){return this.clone(C(this._zod.def,{catchall:W()}))},strict(){return this.clone(C(this._zod.def,{catchall:Rs()}))},strip(){return this.clone(C(this._zod.def,{catchall:void 0}))},extend(e){return ae(this,e)},safeExtend(e){return se(this,e)},merge(e){return ce(this,e)},pick(e){return ne(this,e)},omit(e){return ie(this,e)},partial(...e){return le(ac,this,e[0])},exactPartial(...e){return le(sc,this,e[0],`exactPartial`)},required(...e){return ue(hc,this,e[0])}});function K(e,t){return new Bs({type:`object`,shape:e??{},...M(t)})}function q(e,t){return new Bs({type:`object`,shape:e,catchall:Rs(),...M(t)})}function Vs(e,t){return new Bs({type:`object`,shape:e,catchall:W(),...M(t)})}var Hs=R(`ZodUnion`,(e,t)=>{Tr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.options=t.options});function Us(e,t){return new Hs({type:`union`,options:e,...M(t)})}var Ws=R(`ZodDiscriminatedUnion`,(e,t)=>{Hs.init(e,t),Dr.init(e,t)});function Gs(e,t,n){return new Ws({type:`union`,options:t,discriminator:e,...M(n)})}var Ks=R(`ZodIntersection`,(e,t)=>{Or.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function qs(e,t){return new Ks({type:`intersection`,left:e,right:t})}var Js=R(`ZodTuple`,(e,t)=>{es(),jr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new ac({type:`optional`,innerType:e}))})}});function Ys(e,t,n){let r=t instanceof z;return new Js({type:`tuple`,items:e,rest:r?t:null,...M(r?n:t)})}var Xs=R(`ZodRecord`,(e,t)=>{es(),Fr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Zs(e,t,n){return!t||!t._zod?new Xs({type:`record`,keyType:H(),valueType:e,...M(t)}):new Xs({type:`record`,keyType:e,valueType:t,...M(n)})}function Qs(e,t,n){return new Xs({type:`record`,keyType:e,valueType:t,...M(n),partial:!0})}var $s=R(`ZodEnum`,(e,t)=>{Ir.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 $s({...t,checks:[],...M(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 $s({...t,checks:[],...M(r),entries:i})}});function ec(e,t){return new $s({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var tc=R(`ZodLiteral`,(e,t)=>{Lr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(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 nc(e,t){return new tc({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var rc=R(`ZodTransform`,(e,t)=>{es(),Rr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Be(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Se(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Se(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ic(e){return new rc({type:`transform`,transform:e})}var ac=R(`ZodOptional`,(e,t)=>{Br.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}var sc=R(`ZodExactOptional`,(e,t)=>{Vr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}var lc=R(`ZodNullable`,(e,t)=>{Hr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}var dc=R(`ZodDefault`,(e,t)=>{Ur.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}var pc=R(`ZodPrefault`,(e,t)=>{Gr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():k(t)}})}var hc=R(`ZodNonOptional`,(e,t)=>{Kr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...M(t)})}var _c=R(`ZodCatch`,(e,t)=>{Yr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Pe(t)})}var yc=R(`ZodPipe`,(e,t)=>{Xr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}var xc=R(`ZodReadonly`,(e,t)=>{Qr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}var Cc=R(`ZodLazy`,(e,t)=>{ei.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function wc(e){return new Cc({type:`lazy`,getter:e})}var Tc=R(`ZodCustom`,(e,t)=>{ti.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function Ec(e,t={}){return Da(Tc,e,t)}function Dc(e,t){return Oa(e,t)}function Oc(e){return Xi(is,e)}function kc(e){return Zi(as,e)}q({jsonrpc:nc(`2.0`),id:Us([H(),js()]),method:H().min(1),params:W().optional()}),q({jsonrpc:nc(`2.0`),method:H().min(1),params:W().optional()});var Ac=q({code:js(),message:H(),data:W().optional()});Us([q({jsonrpc:nc(`2.0`),id:Us([H(),js()]),result:W()}),q({jsonrpc:nc(`2.0`),id:Us([H(),js(),Fs()]),error:Ac})]);var jc={parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603,conflict:-32001,notFound:-32002,invalid:-32003,forbidden:-32004,unavailable:-32005},J=(e,t,n)=>({params:e,result:t,about:n}),Mc=(e,t)=>({params:e,about:t}),Nc=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RpcError`,this.code=e,this.data=n}};async function Pc(e,t,n){let{id:r}=n,i=Object.hasOwn(e,n.method)?e[n.method]:void 0;if(!i)return{jsonrpc:`2.0`,id:r,error:{code:jc.methodNotFound,message:`There is no method "${n.method}".`}};let a=i.params.safeParse(n.params??{});if(!a.success)return{jsonrpc:`2.0`,id:r,error:{code:jc.invalidParams,message:$e(a.error)}};try{let e=t[n.method],o=await e(a.data);return{jsonrpc:`2.0`,id:r,result:i.result.parse(o)}}catch(e){return e instanceof Nc?{jsonrpc:`2.0`,id:r,error:{code:e.code,message:e.message,...e.data===void 0?{}:{data:e.data}}}:{jsonrpc:`2.0`,id:r,error:{code:jc.internal,message:e instanceof Error?e.message:String(e)}}}}var Y=H().min(1).refine(e=>!e.startsWith(`/`)&&!e.split(`/`).includes(`..`),{message:`A path is inside the project.`}),Fc=H().regex(/^[0-9a-f]{64}$/u).nullable(),Ic=q({kind:ec([`person`,`agent`,`tool`]),name:H().min(1)}),Lc=q({path:Y,size:js().nonnegative(),modified:U()}),Rc={"files/read":J(q({path:Y}),q({text:H(),version:Fc}),`A text file, with its version; a file that is not there reads as empty with version null.`),"files/write":J(q({path:Y,text:H(),over:Fc}),q({version:Fc}),`Writes a text file over the version read. Errors: conflict (data: { text, version }) when it changed; invalid (data: { problems }) when its format refuses it.`),"files/upload":J(q({dir:Y,name:H().min(1),data:Ts()}),q({path:Y}),`Keeps a file the person added, under a free name in the folder.`),"files/url":J(q({path:Y}),q({url:H()}),`An address a page can load the file from (a picture, a video).`),"files/list":J(q({dir:H()}),q({files:G(Lc),dirs:G(Y)}),`A folder's files and folders, as on disk.`),"files/move":J(q({from:Y,to:Y}),q({rewritten:G(Y)}),`Moves a file or a folder, and rewrites the relative imports and links that pointed at it, as an editor does.`),"files/remove":J(q({path:Y}),q({trash:H()}),`Moves a file or folder to the recycle bin (nothing is deleted).`),"files/trash":J(q({}),q({entries:G(q({id:H(),path:Y,removed:U()}))}),`What the recycle bin holds.`),"files/restore":J(q({id:H()}),q({path:Y}),`Puts a removed thing back where it was; refused while something is there.`),"files/watch":J(q({paths:G(Y).min(1)}),q({watch:H()}),"Starts telling `files/changed` for these files or folders."),"files/unwatch":J(q({watch:H()}),q({}),`Stops a watch.`)},zc={"files/changed":Mc(q({watch:H(),changes:G(q({path:Y,version:Fc,by:Ic.optional()}))}),`Files under a watch changed, other than by this client's own writes.`)},Bc=`website.json`,Vc=q({$schema:H().optional(),dev:H().min(1).optional().describe("The command that serves the website while it is made, run in its folder by a shell. It listens on $PORT at $HOST, which the host sets (`astro dev --port $PORT --host $HOST --ignore-lock`), and allows the hosts in $ALLYHUB_PREVIEW_HOSTS when its server checks the Host header. None: the output folder is served as it is."),build:H().min(1).optional().describe("The command that builds the website into its output folder (`astro build`). None: it is not built."),output:H().min(1).describe("The folder that is the built website, from the website's folder (`dist`); `.` for a website of plain files."),site:H().min(1).optional().describe("The hosted site this website publishes to, written by `allyhub site deploy` the first time, so the folder publishes to the same site from any computer.")}),Hc=[`ts`,`tsx`,`mts`,`js`,`jsx`,`mjs`],Uc=e=>Hc.map(t=>`${e}.${t}`),Wc=[`video`,`slides`,`doc`,`sheet`,`scenery`,`website`],Gc={video:{entries:Uc(`video`),editor:`video`,name:`video`},slides:{entries:Uc(`slides`),editor:`slides`,name:`slides`},doc:{entries:[`doc.mdx`],editor:`doc`,name:`doc`},sheet:{entries:[`sheet.yaml`],editor:`sheet`,name:`sheet`},scenery:{entries:Uc(`scenery`),editor:`scenery`,name:`3D scenery`},model:{entries:Uc(`model`),editor:`scenery`,name:`3D model`},website:{entries:[Bc],editor:`website`,name:`website`}},Kc={video:{types:[`mp4`,`mov`,`gif`],extras:[`srt`,`cover`]},slides:{types:[`pptx`,`pdf`,`png`],extras:[`cover`],options:[{name:`pptx`,only:[`pptx`],values:[`native`,`picture`]},{name:`steps`,only:[`pdf`,`png`]}]},doc:{types:[`pdf`,`docx`,`png`,`md`],extras:[]},sheet:{types:[`xlsx`,`pdf`,`png`,`csv`,`md`,`json`],extras:[]},model:{types:[`glb`],extras:[]}},qc=Object.keys(Gc);new Map(qc.flatMap(e=>Gc[e].entries.map(t=>[t,e])));var Jc={item:Y,version:H().optional()},Yc=q({mime:H().regex(/^image\//u),data:Ts()}),Xc=Vs({code:H(),level:ec([`error`,`warn`]),message:H(),piece:H().optional(),part:H().optional(),t:U().optional()}),Zc=Vs({kind:H(),data:W()}),Qc=Vs({fps:U(),width:U(),height:U(),duration:U(),parts:G(W())}),$c=q({status:ec([`off`,`waiting`,`running`,`done`,`failed`]),revision:js().nonnegative(),problems:G(Xc),facts:G(Zc),versions:q({total:js(),loaded:js(),reused:js()}).optional(),error:H().optional()}),el=[`queued`,`running`,`done`,`failed`,`cancelled`],tl=Zs(H(),Us([H(),Ns()])),nl=q({id:H(),item:Y,versions:G(H()),types:G(H()),options:tl.optional(),state:ec(el),progress:U().min(0).max(1),files:G(Y),error:H().optional()}),rl=q({file:Y,status:ec([`running`,`done`,`failed`]),message:H(),share:U().min(0).max(1).optional()}),il=Ys([U(),U(),U()]),al=q({url:H(),probe:H()}),ol={"project/items":J(q({}),q({items:G(q({kind:ec(qc),dir:Y,entry:Y,title:H().optional()})),name:H(),scope:H(),revision:js().nonnegative()}),`The project's items, as the build finds them.`),"sheet/generated":J(q({item:Y}),q({generated:W().optional(),failed:Ns()}),`What a sheet's sheet.ts makes now: sheets as sheet.yaml would hold them. Never written to a file.`),"video/versions":J(q({item:Y}),q({piece:H(),kind:ec([`video`,`slides`]),title:H().optional(),width:U(),height:U(),versions:G(q({key:H(),lang:H().optional()}))}),`A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for.`),"slides/deck":J(q({item:Y}),q({piece:H(),file:Y,prefix:H(),layouts:G(H()),components:Zs(H(),W()),generators:G(H()),scripts:Zs(H(),Y),code:W(),theme:q({name:H(),colors:Zs(H(),H()),fonts:Zs(H(),H())})}),`A deck's layouts, components and generators, and its files: slides.yaml (its slides) and its script in each language (their words and notes), which the deck's editor edits.`),"video/stage":J(q({...Jc,start:q({t:U().nonnegative().optional(),part:H().optional(),offset:U().nonnegative().optional(),dur:U().positive().optional()}).optional(),play:Ns().optional(),chrome:Ns().optional(),mode:ec([`code`,`component`]).optional()}),al,`The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage.`),"video/timeline":J(q(Jc),q({timeline:Qc,text:G(W())}),`A version's timeline, drawn nowhere.`),"video/still":J(q({...Jc,t:U().nonnegative().optional()}),q({t:U(),image:Yc,width:js().positive(),height:js().positive(),duration:U().nonnegative()}),`A moment of a version as the render draws it, as a picture.`),"video/stills":J(q({...Jc,moments:G(U().nonnegative()).min(1).max(32)}),q({stills:G(q({t:U(),image:Yc}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"slides/fonts":J(q({item:Y}),q({faces:G(q({family:H(),url:fs(),weight:H().optional(),style:H().optional(),stretch:H().optional(),unicodeRange:H().optional()}))}),`The font faces a deck's slides draw with: the stage's own (the theme's standard fonts), allyhub.config.ts's fonts and what the deck's code imports, for a document that draws its slides without the project's stylesheets.`),"slides/component-stills":J(q({...Jc,components:G(q({name:H(),props:Zs(H(),W()),width:U().positive(),height:U().positive(),t:U().nonnegative()})).min(1).max(64)}),q({stills:G(q({key:H(),url:fs()}).nullable())}),`Components of a deck drawn alone, transparent, as the render draws them: pictures kept by what they show, given as addresses.`),"check/results":J(q({}),$c,`The check run after edits, as it stands.`),"check/run":J(q({}),q({}),`Runs the check again now.`),"export/start":J(q({item:Y,versions:G(H()).optional(),types:G(H().min(1)).max(10).optional(),options:tl.optional()}),q({job:nl}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":J(q({job:H()}),q({}),`Stops an export.`),"export/list":J(q({}),q({jobs:G(nl),reveal:Ns()}),`The exports asked for since the server started.`),"export/reveal":J(q({path:Y}),q({}),"Shows an exported file in the person's file manager, where the server runs on their computer (`export/list`'s `reveal`)."),"scenery/viewer":J(q({item:Y,camera:q({position:il,target:il}).optional()}),al,`The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.`)},sl={"project/changed":Mc(q({revision:js().nonnegative()}),`The build saw a change: a stage or a timeline asked for now is the new one's.`),"check/changed":Mc($c,`The check started, ended or failed.`),"export/changed":Mc(q({job:nl}),`An export moved on.`),"index/changed":Mc(q({jobs:G(rl)}),`Making what the media index lacks moved on.`)},cl=ec([`light`,`dark`]),ll=Us([q({t:U().nonnegative()}),q({slide:H().min(1)})]),ul=[`t`,`slide`];function dl(e){return e===void 0?{}:`t`in e?{t:String(Math.round(e.t*1e3)/1e3)}:{slide:e.slide}}function fl(e){let t=e.get(`t`),n=ll.safeParse(t===null?{slide:e.get(`slide`)}:{t:Number(t)});return n.success?n.data:void 0}var pl=q({locale:H().min(2),theme:cl,agent:q({name:H().min(1)}).optional(),project:q({name:H().min(1)}),notes:Ns().optional(),audienceWindow:Ns().optional(),readOnly:Ns().optional(),viewer:Ns().optional(),place:ll.optional(),item:q({kind:ec(qc),dir:Y,entry:Y}),editor:ec(Wc)}),ml=Gs(`type`,[q({type:nc(`file`),path:Y,line:js().positive().optional()}),q({type:nc(`browser`),url:fs({protocol:/^https?$/u}).optional(),tabId:H().min(1).optional()})]),hl=`allyhub-audience`,gl={"host/context":J(q({}),pl,`Where the editor runs.`),"items/open":J(q({target:ml}),q({}),`Shows another item, a file or a page, where the host shows things.`),"storage/get":J(q({key:H().min(1)}),q({value:W()}),`What the editor kept for this person on this computer (a hand sort, what was last seen), or null.`),"storage/set":J(q({key:H().min(1),value:W()}),q({}),`Keeps a value for this person on this computer; null removes it.`),"editor/state":J(q({state:ec([`saved`,`saving`,`unsaved`,`error`]),message:H().optional()}),q({}),`Says whether what the person typed is saved.`),"editor/place":J(q({place:ll}),q({}),"Says where the person is in the item (a video's moment, a deck's slide), on a pause, a seek or another slide, never each frame, so the host opens it there again (HostContext's `place`)."),"agent/ask":J(q({text:H().min(1)}),q({delivered:Ns()}),`Puts words before the person's agent, for them to go on and send; false where no agent takes them. Never sent by itself.`),"note/begin":J(q({}),q({begun:Ns()}),`Starts the host's Note mode on what is on show, as its own Note button does, so a person can mark anything up for their agent from wherever they are; false where the host has none. Sends nothing.`),"edit/request":J(q({}),q({asked:Ns()}),"The person tried to change what a read-only host shows (`readOnly`): the host offers to wake the machine that changes it; false where nothing does."),"tools/call":J(q({name:H().min(1),arguments:Zs(H(),W()).default({})}),q({result:W()}),`Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).`)};q({command:ec([`export`])}),{...zc,...sl};var _l={...Rc,...gl},vl=e=>Us([ec(e),H().min(1).brand()]),yl=e=>G(W()).transform(t=>t.flatMap(t=>{let n=e.safeParse(t);return n.success?[n.data]:[]})),bl=[`no_card`,`saving_card`,`not_a_card`,`declined`,`needs_authentication`,`not_charged`,`under_line`,`refunded`,`disputed`,`monthly_limit`],xl=[`month`,`year`];K({credits:U(),held:U(),owed:U(),frozen:H().nullable().default(null),plan:K({id:H(),name:H(),interval:vl(xl),status:H(),renewsAt:Oc().nullable(),endsAt:Oc().nullable(),monthlyCredits:U().default(0),price:K({amountCents:U(),currency:H()}).nullable().default(null)}).nullable(),allowance:K({total:U(),used:U(),renewsAt:Oc()}).nullable().default(null),bought:U().default(0),customer:Ns().default(!1),autoTopUp:K({below:U(),amountCents:U(),monthlyLimitCents:U().nullable().default(null),chargedThisMonthCents:U().default(0),stopped:vl(bl).nullable()}).nullable()}),K({plans:G(K({id:H(),name:H(),family:H().nullable().default(null),recommended:Ns().default(!1),monthlyCredits:U(),prices:G(K({interval:vl(xl),amountCents:U(),currency:H()}))})),topUp:K({currency:H(),creditsPerDollar:U(),minCents:U(),maxCents:U(),presetsCents:G(U()).default([])})}),K({days:G(K({day:kc(),credits:U(),byKind:Zs(H(),U()).default({})}))}),Us([q({plan:H(),interval:ec(xl)}),q({topUpCents:U().int()})]),Us([q({flow:ec([`home`,`payment_method`,`cancel`])}),q({flow:nc(`change_plan`),plan:H(),interval:ec(xl)})]).default({flow:`home`}),K({card:K({brand:H(),last4:H(),expMonth:U(),expYear:U()}).nullable(),email:H().nullable()}),q({topUpCents:U().int()}),q({below:U().nonnegative(),amountCents:U().int().positive(),monthlyLimitCents:U().int().positive().nullable().optional(),newCard:Ns().optional()});var Sl={tier:vl([`premium`,`standard`,`efficient`]).optional(),maker:H().min(1).optional()};K({models:G(Vs({id:H().min(1),name:H().min(1),...Sl,reasoning:Ns().optional(),input:G(H()).optional(),contextWindow:U().int().positive().optional(),maxOutput:U().int().positive().optional()})).min(1),defaultModel:H().min(1),needPlan:G(Vs({id:H().min(1),name:H().min(1),...Sl})).default([])});var Cl=Zs(H(),W()),wl=K({id:H().min(1),title:H().min(1),description:H().min(1)}),Tl=K({name:H().min(1),work:H().min(1),title:H().min(1),description:H().min(1),input:Cl,output:Cl,long:Ns()});K({version:H().min(1),works:G(wl),tools:G(Tl)}),q({input:Zs(H(),W())}),K({id:H().min(1),tool:H().min(1),status:vl([`working`,`completed`,`failed`]),output:W().optional(),error:K({kind:H().min(1),message:H().min(1)}).optional(),credits:U().nonnegative().optional(),pollAfterMs:U().int().nonnegative().optional(),createdAt:H(),endedAt:H().optional()});var El=1073741824;q({name:H().min(1).max(255),size:js().positive().max(El),sha256:H().regex(/^[0-9a-f]{64}$/u),contentType:H().min(1).max(255)}),K({id:H().min(1),upload:K({url:fs(),headers:Zs(H(),H())}).nullable()}),K({id:H().min(1),name:H()}),K({url:fs()});var Dl=H().regex(/^[0-9a-f]{64}$/u),Ol=H().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),`a relative path of forward slashes, without . or ..`),kl=K({sha256:Dl,size:js().nonnegative().max(El)}),Al=kl.extend({type:H().min(1).max(255)});q({blobs:G(kl.extend({contentType:H().min(1).max(255)})).min(1).max(1e3)}),K({uploads:G(K({sha256:Dl,url:fs(),headers:Zs(H(),H())}))});var jl=K({sessionId:H().min(1),agent:H().min(1),title:H().optional(),createdAt:Oc(),updatedAt:Oc(),transcript:Dl});K({sessionId:H().min(1),messages:G(K({method:H().min(1),params:W()}))});var Ml=[`project`,`home`],Nl=H().refine(e=>e.endsWith(`/`)&&Ol.safeParse(e.slice(0,-1)).success,`a folder of the tree, ending in /`),Pl=K({tree:G(Ol),files:G(Ol),own:Zs(Ol,Al)}),Fl=K({shared:G(Nl),items:Zs(H(),Pl)}),Il=K({format:nc(1),kind:ec(Ml),project:K({name:H().min(1).max(255)}),host:K({version:H().min(1)}),madeAt:Oc(),files:Zs(Ol,kl),tree:Zs(Ol,Al),conversations:G(jl),reach:Fl.optional()}),Ll={editor:`editor/`,runtime:`runtime/`,build:`build/`,media:`media/`,matte:`matte/`,scenery:`scenery/`,bakes:`bakes/`,stills:`stills/`,answers:`answers/`,previews:`previews/`};function Rl(e){return Array.isArray(e)?e.map(Rl):typeof e==`object`&&e?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Rl(e[t])])):e}var zl=(e,t)=>`${Ll.answers}${e}/${encodeURIComponent(JSON.stringify(Rl(t??{})))}.json`,Bl=e=>`${Ll.stills}${e}.webp`,Vl=(e,t)=>`${Ll.stills}index/${encodeURIComponent(e)}/${encodeURIComponent(t)}.json`,Hl=K({stills:Zs(H(),H().regex(/^[0-9a-f]{64}$/u))}),Ul=e=>JSON.stringify(Rl(e)),Wl={stage:`${Ll.runtime}stage.html`,viewer:`${Ll.runtime}viewer.html`,probe:`${Ll.runtime}probe.html`},Gl=e=>e.split(`/`).map(encodeURIComponent).join(`/`),Kl=[`cloud`,`computer`];H().regex(/^[A-Za-z0-9_-]{16,64}$/u);var ql=K({kind:vl(Kl),here:Ns()});q({project:q({id:H().min(1).optional(),kind:ec(Ml),name:H().min(1).max(255)}),manifest:Dl}),K({id:H().min(1),projectId:H().min(1)}),K({missing:G(Dl)});var Jl=K({id:H().min(1),madeAt:Oc(),hostVersion:H()});K({projects:yl(K({id:H().min(1),kind:ec(Ml),name:H(),latest:Jl.nullable(),executor:ql}))}),q({kind:ec(Kl)}),K({origin:fs(),expiresAt:Oc()});var Yl={manifest:`manifest.json`,files:`files/`,conversations:`conversations/`},Xl=-32010;K({changed:G(H())});var Zl=3e5,Ql=class{next=1;pending=new Map;listeners=new Map;stop;channel;timeout;constructor(e,t={}){this.channel=e,this.timeout=t.timeout??Zl,this.stop=e.listen(e=>{this.receive(e)})}request(e,t){let n=this.next++;return new Promise((r,i)=>{let a=setTimeout(()=>{this.pending.delete(n),i(new Nc(jc.unavailable,`${e} had no answer.`))},this.timeout);this.pending.set(n,{resolve:r,reject:i,timer:a});try{this.channel.send({jsonrpc:`2.0`,id:n,method:e,params:t})}catch(e){clearTimeout(a),this.pending.delete(n),i(e instanceof Error?e:Error(String(e)))}})}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}fail(e){for(let[t,n]of this.pending)clearTimeout(n.timer),n.reject(new Nc(jc.unavailable,e)),this.pending.delete(t)}close(){this.stop(),this.fail(`The host closed.`),this.channel.close?.()}receive(e){if(typeof e!=`object`||!e)return;let t=e;if(t.jsonrpc!==`2.0`)return;if(typeof t.method==`string`&&!(`id`in t)){for(let e of this.listeners.get(t.method)??[])e(t.params);return}if(typeof t.id!=`number`)return;let n=this.pending.get(t.id);if(!n)return;this.pending.delete(t.id),clearTimeout(n.timer);let r=t.error;r?n.reject(new Nc(r.code,r.message,r.data)):n.resolve(t.result)}},$l=(e,t,n)=>{let r=e.result.safeParse(t);if(!r.success)throw new Nc(jc.internal,`The host's answer to ${n} is not what the protocol says.`);return r.data};function eu(e){let t={on:(t,n)=>e.on(t,n)};for(let[n,r]of Object.entries(_l))t[n]=async t=>$l(r,await e.request(n,t??{}),n);return t}function tu(e,t={}){let n=new Ql(e,t);return Object.assign(eu(n),{close:()=>{n.close()}})}function nu(e,t){let n=new Map,r={...e};for(let e of Object.keys(t)){let n=gl[e];r[e]=async r=>{let i=await Pc({[e]:n},{[e]:t[e]},{jsonrpc:`2.0`,id:0,method:e,params:r??{}});if(`error`in i)throw new Nc(i.error.code,i.error.message,i.error.data);return $l(n,i.result,e)}}r.on=(t,r)=>{let i=e.on(t,r),a=n.get(t);return a||(a=new Set,n.set(t,a)),a.add(r),()=>{i(),a.delete(r)}},r.notify=(e,t)=>{for(let r of n.get(e)??[])r(t)};let i,a=new Set;return r.notes=e=>{i=e;for(let e of a)e(!0);return()=>{if(i===e){i=void 0;for(let e of a)e(!1)}}},r.noteSurface=()=>i,r.onNoteSurface=e=>(a.add(e),()=>{a.delete(e)}),r}var ru=e=>new Nc(Xl,`${e} needs the machine: this is the project as it was.`),iu={...Rc,"tools/call":gl[`tools/call`]};function au(e,t={}){let n=t.fetch??fetch.bind(globalThis),r=t=>new URL(Gl(t),e).href,i=t=>new URL(t,e).href,a,o=()=>(a??=(async()=>{let e=await n(r(Yl.manifest));if(!e.ok)throw ru(`Reading this project`);let t=Il.safeParse(await e.json());if(!t.success)throw ru(`Reading this project`);return t.data})(),a),s=async(e,t)=>{let i=await n(r(zl(e,t)));if(!i.ok)throw ru(e);let a=await i.json();if(a.error)throw new Nc(a.error.code,a.error.message);return a.result},c=new Map,l=(e,t)=>{let i=Vl(e,t),a=c.get(i);return a||(a=(async()=>{let e=await n(r(i)).catch(()=>void 0),t=e?.ok===!0?await e.json().catch(()=>({})):{},a=Hl.safeParse(t);return a.success?a.data:{stills:{}}})(),c.set(i,a)),a},u=0,d={"files/read":async({path:e})=>{let t=(await o()).files[e];if(!t)return{text:``,version:null};let i=await n(r(`${Yl.files}${e}`));if(!i.ok)throw new Nc(jc.notFound,`${e} could not be read.`);return{text:await i.text(),version:t.sha256}},"files/url":async({path:e})=>{if(!(await o()).files[e])throw new Nc(jc.notFound,`There is no file ${e}.`);return{url:r(`${Yl.files}${e}`)}},"files/list":async({dir:e})=>{let t=await o(),n=Date.parse(t.madeAt),r=e===``?``:`${e.replace(/\/$/u,``)}/`,i=[],a=new Set;for(let[e,o]of Object.entries(t.files)){if(!e.startsWith(r))continue;i.push({path:e,size:o.size,modified:n});let t=e.slice(r.length).split(`/`).slice(0,-1);for(let e=1;e<=t.length;e++)a.add(`${r}${t.slice(0,e).join(`/`)}`)}return{files:i.sort((e,t)=>e.path.localeCompare(t.path)),dirs:[...a].sort()}},"files/watch":()=>Promise.resolve({watch:`w${String(++u)}`}),"files/unwatch":()=>Promise.resolve({}),"files/trash":()=>Promise.resolve({entries:[]}),"files/write":()=>Promise.reject(ru(`Saving`)),"files/upload":()=>Promise.reject(ru(`Adding a file`)),"files/move":()=>Promise.reject(ru(`Moving`)),"files/remove":()=>Promise.reject(ru(`Removing`)),"files/restore":()=>Promise.reject(ru(`Restoring`)),"tools/call":async({name:e,arguments:t})=>{if(!Object.hasOwn(ol,e))throw new Nc(jc.methodNotFound,`There is no tool ${e}.`);let n=e,r=ol[n].params.safeParse(t);if(!r.success)throw new Nc(jc.invalidParams,`${e}'s arguments.`);return{result:await f(n,r.data)}}},f=async(e,t)=>{switch(e){case`video/stage`:{let{item:n,version:r,start:a,play:o,chrome:c,mode:l}=t,u=await s(e,{item:n,...r===void 0?{}:{version:r}}),d=new URL(i(u.url));for(let[e,t]of Object.entries(a??{}))d.searchParams.set(e,String(t));return o===!0&&d.searchParams.set(`play`,`1`),c===!1&&d.searchParams.set(`chrome`,`0`),l!==void 0&&d.searchParams.set(`mode`,l),{url:d.href,probe:i(u.probe)}}case`scenery/viewer`:{let{item:e,camera:n}=t,{items:r}=await s(`project/items`,{}),a=r.find(t=>t.dir===e&&(t.kind===`scenery`||t.kind===`model`));if(!a)throw new Nc(jc.notFound,`There is no scenery or 3D model ${e}.`);let o=new URL(i(Wl.viewer));return o.searchParams.set(`file`,a.entry),n!==void 0&&o.searchParams.set(`camera`,JSON.stringify(n)),{url:o.href,probe:i(Wl.probe)}}case`slides/fonts`:{let n=await s(e,t);return{...n,faces:n.faces.map(e=>({...e,url:i(e.url)}))}}case`slides/component-stills`:{let{item:e,version:n,components:i}=t,a=n??(await s(`video/versions`,{item:e})).versions[0]?.key,{stills:o}=a===void 0?{stills:{}}:await l(e,a);return{stills:i.map(e=>{let t=o[Ul(e)];return t===void 0?null:{key:t,url:r(Bl(t))}})}}case`export/list`:return{jobs:[],reveal:!1};case`video/timeline`:case`video/still`:case`video/stills`:throw ru(e);default:return s(e,t)}},p=new Set;return tu({send(e){Pc(iu,d,e).then(e=>{for(let t of p)t(e)})},listen(e){return p.add(e),()=>p.delete(e)}})}async function ou(e,t,n){let{result:r}=await e[`tools/call`]({name:t,arguments:n}),i=ol[t].result.safeParse(r);if(!i.success)throw new Nc(jc.internal,`The answer to the tool ${t} is not what the protocol says.`);return i.data}var su=`allyhub.stage-sandbox`;function cu(e){let t=e;return typeof t==`object`&&!!t&&t.allyhub===!0&&t.type===`probe`}function lu(e){try{let t=e?.getItem(su);return t===`1`||t!==`0`&&void 0}catch{return}}async function uu(e){let t=lu(e.storage);if(t!==void 0)return t;let n,r=()=>void 0,i=await new Promise(t=>{n=setTimeout(()=>{t(!1)},e.ms??1500),r=e.open(()=>{t(!0)})});clearTimeout(n),r();try{e.storage?.setItem(su,i?`1`:`0`)}catch{}return i}function du(e){return t=>{let n=document.createElement(`iframe`);n.setAttribute(`sandbox`,`allow-scripts`),n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.cssText=`position:fixed;width:1px;height:1px;left:-10px;top:-10px;border:0;opacity:0`;let r=e=>{e.source===n.contentWindow&&cu(e.data)&&t()};return window.addEventListener(`message`,r),n.src=e,document.body.append(n),()=>{window.removeEventListener(`message`,r),n.remove()}}}var fu;function pu(e){let t;try{t=sessionStorage}catch{t=void 0}return fu??=uu({open:du(e),storage:t}),fu}var mu=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r)setTimeout(function(){r(e)},0);else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h)d[r]=void 0;else{if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends mu{};function hu(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function gu(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function _u(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function vu(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function yu(e,t){return _u(e,t,``)}function bu(e,t){return vu(e,t,``)}function xu(e,t){return t.slice(0,Su(e,t))}function Su(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Cu(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function wu(e,t){if(t)return Eu(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Tu(e,t){if(t)return Eu(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Eu(e,t){if(!t)return[Tu(e),wu(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Cu(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Du=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Ou=RegExp(`[${Du}]+|\\s+|[^${Du}]`,`ug`);new class extends mu{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Cu(e,r)}else n=e.match(Ou)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&ku(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&ku(n,i,r,null,t.intlSegmenter),e}};function ku(e,t,n,r,i){if(t&&n){let[a,o]=Eu(t.value,i),[s,c]=Eu(n.value,i);if(e){let r=hu(a,s);e.value=vu(e.value,s,r),t.value=yu(t.value,r),n.value=yu(n.value,r)}if(r){let e=gu(o,c);r.value=_u(r.value,c,e),t.value=bu(t.value,e),n.value=bu(n.value,e)}}else if(n){if(e){let e=Tu(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Tu(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Tu(r.value,i),[a,o]=Eu(t.value,i),s=hu(n,a);t.value=yu(t.value,s);let c=gu(yu(n,s),o);t.value=bu(t.value,c),r.value=_u(r.value,n,c),e.value=vu(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Tu(r.value,i),n=xu(wu(t.value,i),e);t.value=bu(t.value,n)}else if(e){let n=xu(wu(e.value,i),Tu(t.value,i));t.value=yu(t.value,n)}}new class extends mu{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Du}]+|[^\\S\\n\\r]+|[^${Du}]`,`ug`);return e.match(t)||[]}},new class extends mu{constructor(){super(...arguments),this.tokenize=Au}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes(`
57
57
  `)||(e=e.trim()),n.newlineIsToken&&t.includes(`
58
58
  `)||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
59
59
  `)&&(e=e.slice(0,-1)),t.endsWith(`