@tung-engineering/agent-platform-web-sdk 0.0.69 → 0.0.70

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.
@@ -1355,7 +1355,7 @@ button.ap-sdk-list-item__link {
1355
1355
 
1356
1356
  `)}k.write("payload.value = newResult;"),k.write("return payload;");const N=k.compile();return(S,P)=>N(m,S,P)};let i;const a=br,d=!$i.jitless,p=d&&cu.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?ta([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function na(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Bn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>on(a,r,tn())))}),t)}const ra=w("$ZodUnion",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),re(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>fs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>na(u,o,e,i)):na(d,o,e,i)}}),Yd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ra.init(e,t);const n=e._zod.parse;re(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=to(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!br(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Vd=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>oa(n,u,p)):oa(n,i,a)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Hn(e)&&Hn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=_s(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=_s(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(j(v({},o),{keys:i})),Bn(e))return e;const a=_s(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Xd=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Hn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Gn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Wi.test(d)&&u.issues.length&&u.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(u=g)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(g=>on(g,r,tn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(d,g.issues)),n.value[u.value]=g.value})):(h.issues.length&&n.issues.push(...Gn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Kd=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=Oi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>lu.has(typeof o)).map(o=>typeof o=="string"?Fn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Qd=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Fn(r):r?Fn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),ep=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new qn;return n.value=o,n}});function sa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ia=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>sa(i,n.value)):sa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),tp=w("$ZodExactOptional",(e,t)=>{ia.init(e,t),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),np=w("$ZodNullable",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.innerType._zod.optin),re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)}|null)$`):void 0}),re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),rp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>aa(i,t)):aa(o,t)}});function aa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const op=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sp=w("$ZodNonOptional",(e,t)=>{me.init(e,t),re(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ca(i,e)):ca(o,e)}});function ca(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ip=w("$ZodCatch",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.innerType._zod.optin),re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:i.issues.map(a=>on(a,r,tn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:o.issues.map(i=>on(i,r,tn()))},input:n.value})),n.issues=[]),n)}}),ap=w("$ZodPipe",(e,t)=>{me.init(e,t),re(e._zod,"values",()=>t.in._zod.values),re(e._zod,"optin",()=>t.in._zod.optin),re(e._zod,"optout",()=>t.out._zod.optout),re(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>ao(a,t.in,r)):ao(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>ao(i,t.out,r)):ao(o,t.out,r)}});function ao(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const cp=w("$ZodReadonly",(e,t)=>{me.init(e,t),re(e._zod,"propValues",()=>t.innerType._zod.propValues),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),re(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(la):la(o)}});function la(e){return e.value=Object.freeze(e.value),e}const lp=w("$ZodCustom",(e,t)=>{rt.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ua(i,n,r,e));ua(o,n,r,e)}});function ua(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(kr(i))}}var da;class up{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function dp(){return new up}(wl=(da=globalThis).__zod_globalRegistry)!=null||(da.__zod_globalRegistry=dp());const _r=globalThis.__zod_globalRegistry;function pp(e,t){return new e(v({type:"string"},D(t)))}function hp(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},D(t)))}function pa(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},D(t)))}function fp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},D(t)))}function gp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},D(t)))}function mp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},D(t)))}function bp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},D(t)))}function kp(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},D(t)))}function _p(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},D(t)))}function vp(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},D(t)))}function yp(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},D(t)))}function wp(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},D(t)))}function xp(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},D(t)))}function Sp(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},D(t)))}function Tp(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},D(t)))}function Ep(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},D(t)))}function Ap(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},D(t)))}function Cp(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},D(t)))}function Pp(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},D(t)))}function Rp(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},D(t)))}function Lp(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},D(t)))}function Ip(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},D(t)))}function zp(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},D(t)))}function $p(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},D(t)))}function Op(e,t){return new e(v({type:"string",format:"date",check:"string_format"},D(t)))}function Np(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},D(t)))}function Dp(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},D(t)))}function Mp(e,t){return new e(v({type:"number",checks:[]},D(t)))}function Up(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},D(t)))}function jp(e,t){return new e(v({type:"boolean"},D(t)))}function Zp(e){return new e({type:"any"})}function qp(e){return new e({type:"unknown"})}function Hp(e,t){return new e(v({type:"never"},D(t)))}function ha(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!1}))}function vs(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!0}))}function fa(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!1}))}function ys(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!0}))}function ga(e,t){return new nd(j(v({check:"multiple_of"},D(t)),{value:e}))}function ma(e,t){return new od(j(v({check:"max_length"},D(t)),{maximum:e}))}function co(e,t){return new sd(j(v({check:"min_length"},D(t)),{minimum:e}))}function ba(e,t){return new id(j(v({check:"length_equals"},D(t)),{length:e}))}function Fp(e,t){return new ad(j(v({check:"string_format",format:"regex"},D(t)),{pattern:e}))}function Bp(e){return new cd(v({check:"string_format",format:"lowercase"},D(e)))}function Gp(e){return new ld(v({check:"string_format",format:"uppercase"},D(e)))}function Wp(e,t){return new ud(j(v({check:"string_format",format:"includes"},D(t)),{includes:e}))}function Jp(e,t){return new dd(j(v({check:"string_format",format:"starts_with"},D(t)),{prefix:e}))}function Yp(e,t){return new pd(j(v({check:"string_format",format:"ends_with"},D(t)),{suffix:e}))}function Wn(e){return new hd({check:"overwrite",tx:e})}function Vp(e){return Wn(t=>t.normalize(e))}function Xp(){return Wn(e=>e.trim())}function Kp(){return Wn(e=>e.toLowerCase())}function Qp(){return Wn(e=>e.toUpperCase())}function eh(){return Wn(e=>au(e))}function th(e,t,n){return new e(v({type:"array",element:t},D(n)))}function nh(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},D(n)))}function rh(e){const t=oh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(kr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(kr(u))}},e(n.value,n)));return t}function oh(e,t){const n=new rt(v({check:"custom"},D(t)));return n._zod.check=e,n}function ka(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:_r,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ae(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=j(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const E=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,E,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Ae(y,t,k),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&We(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _a(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var E,Z,ee,N,T;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(E=e.external.registry.get(h[0]))==null?void 0:E.id,P=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:P(S)};const M=(N=(ee=h[1].defId)!=null?ee:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=M,{defId:M,ref:`${P("__shared")}#/${g}/${M}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(T=h[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const E in y)delete y[E];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1357
1357
 
1358
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function va(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var ee,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(ee=m.def)!=null?ee:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(P.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in S.def&&JSON.stringify(k[J])===JSON.stringify(S.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==E){r(Z);const S=e.seen.get(Z);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:j(v({},t["~standard"]),{jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function We(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return We(r.element,n);if(r.type==="set")return We(r.valueType,n);if(r.type==="lazy")return We(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return We(r.innerType,n);if(r.type==="intersection")return We(r.left,n)||We(r.right,n);if(r.type==="record"||r.type==="map")return We(r.keyType,n)||We(r.valueType,n);if(r.type==="pipe")return We(r.in,n)||We(r.out,n);if(r.type==="object"){for(const o in r.shape)if(We(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(We(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(We(o,n))return!0;return!!(r.rest&&We(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=ka(j(v({},n),{processors:t}));return Ae(e,r),_a(r,e),va(r,e)},lo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(j(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),_a(a,e),va(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>j(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ae(i.element,t,j(v({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,j(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,j(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,j(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,j(v({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,j(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,j(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ah=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const ut=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(ut),Mh=bs(ut),Uh=ro(ut),jh=oo(ut),Zh=xu(ut),qh=Su(ut),Hh=Tu(ut),Fh=Eu(ut),Bh=Au(ut),Gh=Cu(ut),Wh=Pu(ut),Jh=Ru(ut),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(nn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>rn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Wn(n)),e.optional=()=>La(e),e.exactOptional=()=>Lf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>Df(e,n),e.array=()=>kt(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>$a(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(co(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(co(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(fp(uo,n)),e.uuidv4=n=>e.check(gp(uo,n)),e.uuidv6=n=>e.check(mp(uo,n)),e.uuidv7=n=>e.check(bp(uo,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function C(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),wa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),xa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;Ki.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>ch(e,m,k),e.gt=(m,k)=>e.check(fa(m,k)),e.gte=(m,k)=>e.check(ys(m,k)),e.min=(m,k)=>e.check(ys(m,k)),e.lt=(m,k)=>e.check(ha(m,k)),e.lte=(m,k)=>e.check(vs(m,k)),e.max=(m,k)=>e.check(vs(m,k)),e.int=m=>e.check(Ta(m)),e.safe=m=>e.check(Ta(m)),e.positive=m=>e.check(fa(0,m)),e.nonnegative=m=>e.check(ys(0,m)),e.negative=m=>e.check(ha(0,m)),e.nonpositive=m=>e.check(vs(0,m)),e.multipleOf=(m,k)=>e.check(ga(m,k)),e.step=(m,k)=>e.check(ga(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Lt(e){return Mp(Sa,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Sa.init(e,t)});function Ta(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Ea(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Aa(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(co(n,r)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function kt(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),re(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(j(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(j(v({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(j(v({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(Ra,e,n[0]),e.required=(...n)=>ku(za,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new yf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Ca(v({type:"union",options:e},D(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Yd.init(e,t)});function Pa(e,t,n){return new xf(v({type:"union",options:t,discriminator:e},D(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Ef(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pt(e,t){return new Af(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(kr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:kt(C()).optional(),failOnError:_e().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:It(C(),C()).optional(),runOnBackground:_e().optional()});fe({name:C(),command:C(),success:_e(),exitCode:Lt().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Lt(),failOnError:_e()});const kn=fe({path:C(),extraCommands:kt(Gf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:dt(["free","in_use"]).optional()}),Wf=Pa("operation",[kn.extend({operation:pt("create"),content:C().optional(),contentPath:C().optional(),encoding:dt(["utf-8","base64"]).optional()}),kn.extend({operation:pt("merge"),data:It(C(),Ea()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),kn.extend({operation:pt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),kn.extend({operation:pt("delete"),ignoreIfMissing:_e().optional()}),kn.extend({operation:pt("createDirectory"),contentPath:C().optional(),mode:Lt().optional(),ignoreIfExists:_e().optional()}),kn.extend({operation:pt("download"),url:C().url(),headers:It(C(),C()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),kn.extend({operation:pt("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Jf=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Yf=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:kt(C()).optional().describe("Legacy — unused in SDK mode"),env:It(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:kt(Wf).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:kt(Yf).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[fe({executionMode:pt("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:kt(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:kt(C()).optional(),settings:fe({enabledPlugins:It(C(),_e())}),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:kt(C()).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:kt(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:kt(fe({id:C(),selectedText:C(),startOffset:Lt(),endOffset:Lt(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:dt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Vf="browser_automate";function Na(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Xf(e,t){const n=Na(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Na(r)}function Da(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ma(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Kf=3e4;function po(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,j(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield po(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ma(a)})}function Ua(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Qf=["projectId","note","ctx"];function eg(e){const t=Qf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return L(this,null,function*(){var p,h,g,m,k,y;eg(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:u=Oa}=t;return Ue(e,"POST","/tasks",j(v(v(v(v(v(v(v(v(v(v(v(v({type:u,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(p=i==null?void 0:i.selectedPluginIds)!=null&&p.length?{selectedPluginIds:i.selectedPluginIds}:{}),(h=i==null?void 0:i.selectedSkillIds)!=null&&h.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(k=i==null?void 0:i.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:{type:u,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}}))})}function ja(e,t){return L(this,null,function*(){return xs(e,j(v({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function tg(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function ng(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function rg(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function og(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fa(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield po(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ma(i)})}function sg(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function ho(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ba(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1358
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function va(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var ee,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(ee=m.def)!=null?ee:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(P.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in S.def&&JSON.stringify(k[J])===JSON.stringify(S.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==E){r(Z);const S=e.seen.get(Z);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:j(v({},t["~standard"]),{jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function We(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return We(r.element,n);if(r.type==="set")return We(r.valueType,n);if(r.type==="lazy")return We(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return We(r.innerType,n);if(r.type==="intersection")return We(r.left,n)||We(r.right,n);if(r.type==="record"||r.type==="map")return We(r.keyType,n)||We(r.valueType,n);if(r.type==="pipe")return We(r.in,n)||We(r.out,n);if(r.type==="object"){for(const o in r.shape)if(We(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(We(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(We(o,n))return!0;return!!(r.rest&&We(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=ka(j(v({},n),{processors:t}));return Ae(e,r),_a(r,e),va(r,e)},lo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(j(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),_a(a,e),va(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>j(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ae(i.element,t,j(v({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,j(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,j(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,j(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,j(v({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,j(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,j(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ah=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const ut=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(ut),Mh=bs(ut),Uh=ro(ut),jh=oo(ut),Zh=xu(ut),qh=Su(ut),Hh=Tu(ut),Fh=Eu(ut),Bh=Au(ut),Gh=Cu(ut),Wh=Pu(ut),Jh=Ru(ut),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(nn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>rn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Wn(n)),e.optional=()=>La(e),e.exactOptional=()=>Lf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>Df(e,n),e.array=()=>kt(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>$a(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(co(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(co(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(fp(uo,n)),e.uuidv4=n=>e.check(gp(uo,n)),e.uuidv6=n=>e.check(mp(uo,n)),e.uuidv7=n=>e.check(bp(uo,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function C(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),wa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),xa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;Ki.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>ch(e,m,k),e.gt=(m,k)=>e.check(fa(m,k)),e.gte=(m,k)=>e.check(ys(m,k)),e.min=(m,k)=>e.check(ys(m,k)),e.lt=(m,k)=>e.check(ha(m,k)),e.lte=(m,k)=>e.check(vs(m,k)),e.max=(m,k)=>e.check(vs(m,k)),e.int=m=>e.check(Ta(m)),e.safe=m=>e.check(Ta(m)),e.positive=m=>e.check(fa(0,m)),e.nonnegative=m=>e.check(ys(0,m)),e.negative=m=>e.check(ha(0,m)),e.nonpositive=m=>e.check(vs(0,m)),e.multipleOf=(m,k)=>e.check(ga(m,k)),e.step=(m,k)=>e.check(ga(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Lt(e){return Mp(Sa,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Sa.init(e,t)});function Ta(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Ea(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Aa(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(co(n,r)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function kt(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),re(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(j(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(j(v({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(j(v({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(Ra,e,n[0]),e.required=(...n)=>ku(za,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new yf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Ca(v({type:"union",options:e},D(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Yd.init(e,t)});function Pa(e,t,n){return new xf(v({type:"union",options:t,discriminator:e},D(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Ef(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pt(e,t){return new Af(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(kr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:kt(C()).optional(),failOnError:_e().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:It(C(),C()).optional(),runOnBackground:_e().optional()});fe({name:C(),command:C(),success:_e(),exitCode:Lt().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Lt(),failOnError:_e()});const kn=fe({path:C(),extraCommands:kt(Gf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:dt(["free","in_use"]).optional()}),Wf=Pa("operation",[kn.extend({operation:pt("create"),content:C().optional(),contentPath:C().optional(),encoding:dt(["utf-8","base64"]).optional()}),kn.extend({operation:pt("merge"),data:It(C(),Ea()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),kn.extend({operation:pt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),kn.extend({operation:pt("delete"),ignoreIfMissing:_e().optional()}),kn.extend({operation:pt("createDirectory"),contentPath:C().optional(),mode:Lt().optional(),ignoreIfExists:_e().optional()}),kn.extend({operation:pt("download"),url:C().url(),headers:It(C(),C()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),kn.extend({operation:pt("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional(),defaultBranch:C().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Jf=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Yf=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:kt(C()).optional().describe("Legacy — unused in SDK mode"),env:It(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:kt(Wf).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:kt(Yf).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[fe({executionMode:pt("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:kt(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:kt(C()).optional(),settings:fe({enabledPlugins:It(C(),_e())}),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:kt(C()).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:kt(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:kt(fe({id:C(),selectedText:C(),startOffset:Lt(),endOffset:Lt(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:dt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Vf="browser_automate";function Na(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Xf(e,t){const n=Na(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Na(r)}function Da(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ma(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Kf=3e4;function po(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,j(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield po(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ma(a)})}function Ua(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Qf=["projectId","note","ctx"];function eg(e){const t=Qf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return L(this,null,function*(){var p,h,g,m,k,y;eg(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:u=Oa}=t;return Ue(e,"POST","/tasks",j(v(v(v(v(v(v(v(v(v(v(v(v({type:u,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(p=i==null?void 0:i.selectedPluginIds)!=null&&p.length?{selectedPluginIds:i.selectedPluginIds}:{}),(h=i==null?void 0:i.selectedSkillIds)!=null&&h.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(k=i==null?void 0:i.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:{type:u,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}}))})}function ja(e,t){return L(this,null,function*(){return xs(e,j(v({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function tg(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function ng(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function rg(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function og(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fa(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield po(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ma(i)})}function sg(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function ho(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ba(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1359
1359
  * Pusher JavaScript Library v8.5.0
1360
1360
  * https://pusher.com/
1361
1361
  *