@tung-engineering/agent-platform-web-sdk 0.0.68 → 0.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-sdk.cjs +1 -1
- package/dist/web-sdk.cjs.map +1 -1
- package/dist/web-sdk.min.js +20 -20
- package/dist/web-sdk.min.js.map +1 -1
- package/dist/web-sdk.mjs +2 -1
- package/dist/web-sdk.mjs.map +1 -1
- package/package.json +1 -1
package/dist/web-sdk.cjs
CHANGED
|
@@ -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,C)=>N(m,S,C)};let i;const a=Dr,d=!Ja.jitless,p=d&&Td.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?dc([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Ui(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=>un(a,r,ln())))}),t)}const pc=w("$ZodUnion",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),oe(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),oe(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),oe(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=>qs(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 l of t.options){const p=l._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(l=>Ui(l,o,e,i)):Ui(d,o,e,i)}}),ph=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,pc.init(e,t);const n=e._zod.parse;oe(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,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=Yo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){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(!Dr(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)}}),hh=w("$ZodIntersection",(e,t)=>{be.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(([l,p])=>ji(n,l,p)):ji(n,i,a)}});function As(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(nr(e)&&nr(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=As(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=As(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 ji(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 l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).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(U(v({},o),{keys:i})),Bn(e))return e;const a=As(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 fh=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nr(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 l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&oc.test(d)&&l.issues.length&&l.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&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>un(g,r,ln())),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[l.value]=g.value})):(h.issues.length&&n.issues.push(...Gn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),gh=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Ya(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ed.has(typeof o)).map(o=>typeof o=="string"?rr(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}}),mh=w("$ZodLiteral",(e,t)=>{if(be.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"?rr(r):r?rr(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}}),bh=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(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 Kn;return n.value=o,n}});function Zi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hc=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(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=>Zi(i,n.value)):Zi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kh=w("$ZodExactOptional",(e,t)=>{hc.init(e,t),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_h=w("$ZodNullable",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(n.source)}|null)$`):void 0}),oe(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)}),vh=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",oe(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=>qi(i,t)):qi(o,t)}});function qi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yh=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",oe(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))}),wh=w("$ZodNonOptional",(e,t)=>{be.init(e,t),oe(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=>Hi(i,e)):Hi(o,e)}});function Hi(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 xh=w("$ZodCatch",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(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(U(v({},n),{error:{issues:i.issues.map(a=>un(a,r,ln()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(U(v({},n),{error:{issues:o.issues.map(i=>un(i,r,ln()))},input:n.value})),n.issues=[]),n)}}),Sh=w("$ZodPipe",(e,t)=>{be.init(e,t),oe(e._zod,"values",()=>t.in._zod.values),oe(e._zod,"optin",()=>t.in._zod.optin),oe(e._zod,"optout",()=>t.out._zod.optout),oe(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=>co(a,t.in,r)):co(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>co(i,t.out,r)):co(o,t.out,r)}});function co(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Th=w("$ZodReadonly",(e,t)=>{be.init(e,t),oe(e._zod,"propValues",()=>t.innerType._zod.propValues),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),oe(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(Fi):Fi(o)}});function Fi(e){return e.value=Object.freeze(e.value),e}const Eh=w("$ZodCustom",(e,t)=>{tt.init(e,t),be.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=>Bi(i,n,r,e));Bi(o,n,r,e)}});function Bi(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(Mr(i))}}var Gi;class Ah{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 Ch(){return new Ah}var ja;(ja=(Gi=globalThis).__zod_globalRegistry)!=null||(Gi.__zod_globalRegistry=Ch());const Pr=globalThis.__zod_globalRegistry;function Ph(e,t){return new e(v({type:"string"},j(t)))}function Rh(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},j(t)))}function Wi(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},j(t)))}function Lh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},j(t)))}function Ih(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},j(t)))}function zh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},j(t)))}function $h(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},j(t)))}function Oh(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},j(t)))}function Nh(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},j(t)))}function Dh(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},j(t)))}function Mh(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},j(t)))}function Uh(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},j(t)))}function jh(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},j(t)))}function Zh(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},j(t)))}function qh(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},j(t)))}function Hh(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},j(t)))}function Fh(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},j(t)))}function Bh(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},j(t)))}function Gh(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},j(t)))}function Wh(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},j(t)))}function Jh(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},j(t)))}function Yh(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},j(t)))}function Xh(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},j(t)))}function Vh(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},j(t)))}function Kh(e,t){return new e(v({type:"string",format:"date",check:"string_format"},j(t)))}function Qh(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},j(t)))}function ef(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},j(t)))}function tf(e,t){return new e(v({type:"number",checks:[]},j(t)))}function nf(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},j(t)))}function rf(e,t){return new e(v({type:"boolean"},j(t)))}function of(e){return new e({type:"any"})}function sf(e){return new e({type:"unknown"})}function af(e,t){return new e(v({type:"never"},j(t)))}function Ji(e,t){return new ic(U(v({check:"less_than"},j(t)),{value:e,inclusive:!1}))}function fs(e,t){return new ic(U(v({check:"less_than"},j(t)),{value:e,inclusive:!0}))}function Yi(e,t){return new ac(U(v({check:"greater_than"},j(t)),{value:e,inclusive:!1}))}function gs(e,t){return new ac(U(v({check:"greater_than"},j(t)),{value:e,inclusive:!0}))}function Xi(e,t){return new _p(U(v({check:"multiple_of"},j(t)),{value:e}))}function fc(e,t){return new yp(U(v({check:"max_length"},j(t)),{maximum:e}))}function $o(e,t){return new wp(U(v({check:"min_length"},j(t)),{minimum:e}))}function gc(e,t){return new xp(U(v({check:"length_equals"},j(t)),{length:e}))}function cf(e,t){return new Sp(U(v({check:"string_format",format:"regex"},j(t)),{pattern:e}))}function lf(e){return new Tp(v({check:"string_format",format:"lowercase"},j(e)))}function uf(e){return new Ep(v({check:"string_format",format:"uppercase"},j(e)))}function df(e,t){return new Ap(U(v({check:"string_format",format:"includes"},j(t)),{includes:e}))}function pf(e,t){return new Cp(U(v({check:"string_format",format:"starts_with"},j(t)),{prefix:e}))}function hf(e,t){return new Pp(U(v({check:"string_format",format:"ends_with"},j(t)),{suffix:e}))}function ar(e){return new Rp({check:"overwrite",tx:e})}function ff(e){return ar(t=>t.normalize(e))}function gf(){return ar(e=>e.trim())}function mf(){return ar(e=>e.toLowerCase())}function bf(){return ar(e=>e.toUpperCase())}function kf(){return ar(e=>Sd(e))}function _f(e,t,n){return new e(v({type:"array",element:t},j(n)))}function vf(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},j(n)))}function yf(e){const t=wf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Mr(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(Mr(l))}},e(n.value,n)));return t}function wf(e,t){const n=new tt(v({check:"custom"},j(t)));return n._zod.check=e,n}function mc(e){var n,r,o,i,a,d,l,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:Pr,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:(l=e==null?void 0:e.cycles)!=null?l:"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 Re(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=U(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),Re(y,t,k),t.seen.get(y).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Ye(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 bc(e,t){var a,d,l,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,C=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:C(S)};const D=(N=(ee=h[1].defId)!=null?ee:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=D,{defId:D,ref:`${C("__shared")}#/${g}/${D}`}}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=(l=e.external.registry.get(h[0]))==null?void 0:l.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 kc(e,t){var a,d,l,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),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(C.$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 C in k)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(k[C])===JSON.stringify(S.def[C])&&delete k[C]}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,(l=n.def)!=null?l: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:U(v({},t["~standard"]),{jsonSchema:{input:Oo(t,"input",e.processors),output:Oo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ye(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 Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(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 Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ye(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ye(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ye(o,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const xf=(e,t={})=>n=>{const r=mc(U(v({},n),{processors:t}));return Re(e,r),bc(r,e),kc(r,e)},Oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=mc(U(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),bc(a,e),kc(a,e)},Sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tf=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Sf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>U(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},Ef=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,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 l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},Cf=(e,t,n,r)=>{n.not={}},Pf=(e,t,n,r)=>{},Rf=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{const o=e._zod.def,i=Ya(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},If=(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},zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Of=(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=Re(i.element,t,U(v({},r),{path:[...r.path,"items"]}))},Nf=(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]=Re(a[h],t,U(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,U(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Df=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,U(v({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Mf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,U(v({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,U(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},Uf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,U(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,U(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,U(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)}},jf=(e,t,n,r)=>{const o=e._zod.def,i=Re(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"}]},Zf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},qf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Hf=(e,t,n,r)=>{const o=e._zod.def;Re(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)))},Ff=(e,t,n,r)=>{const o=e._zod.def;Re(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},Bf=(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;Re(i,t,r);const a=t.seen.get(e);a.ref=i},Gf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},_c=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=w("ZodISODateTime",(e,t)=>{Fp.init(e,t),ye.init(e,t)});function Jf(e){return Vh(Wf,e)}const Yf=w("ZodISODate",(e,t)=>{Bp.init(e,t),ye.init(e,t)});function Xf(e){return Kh(Yf,e)}const Vf=w("ZodISOTime",(e,t)=>{Gp.init(e,t),ye.init(e,t)});function Kf(e){return Qh(Vf,e)}const Qf=w("ZodISODuration",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function eg(e){return ef(Qf,e)}const tg=(e,t)=>{Qa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dd(e,n)},flatten:{value:n=>Nd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Es,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Es,2)}},isEmpty:{get(){return e.issues.length===0}}})},ft=w("ZodError",tg,{Parent:Error}),ng=Fs(ft),rg=Bs(ft),og=Xo(ft),sg=Vo(ft),ig=jd(ft),ag=Zd(ft),cg=qd(ft),lg=Hd(ft),ug=Fd(ft),dg=Bd(ft),pg=Gd(ft),hg=Wd(ft),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oo(e,"input"),output:Oo(e,"output")}}),e.toJSONSchema=xf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(dn(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)=>pn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ng(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>og(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return rg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return sg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>ig(e,n,r),e.decode=(n,r)=>ag(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return cg(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return lg(e,n,r)}),e.safeEncode=(n,r)=>ug(e,n,r),e.safeDecode=(n,r)=>dg(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return pg(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return hg(e,n,r)}),e.refine=(n,r)=>e.check(cm(n,r)),e.superRefine=n=>e.check(lm(n)),e.overwrite=n=>e.check(ar(n)),e.optional=()=>ea(e),e.exactOptional=()=>Yg(e),e.nullable=()=>ta(e),e.nullish=()=>ea(ta(e)),e.nonoptional=n=>tm(e,n),e.array=()=>St(e),e.or=n=>jg([e,n]),e.and=n=>Hg(e,n),e.transform=n=>na(e,Wg(n)),e.default=n=>Kg(e,n),e.prefault=n=>em(e,n),e.catch=n=>rm(e,n),e.pipe=n=>na(e,n),e.readonly=()=>im(e),e.describe=n=>{const r=e.clone();return Pr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Pr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Pr.get(e);const r=e.clone();return Pr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),vc=w("_ZodString",(e,t)=>{var r,o,i;Gs.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Tf(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(cf(...a)),e.includes=(...a)=>e.check(df(...a)),e.startsWith=(...a)=>e.check(pf(...a)),e.endsWith=(...a)=>e.check(hf(...a)),e.min=(...a)=>e.check($o(...a)),e.max=(...a)=>e.check(fc(...a)),e.length=(...a)=>e.check(gc(...a)),e.nonempty=(...a)=>e.check($o(1,...a)),e.lowercase=a=>e.check(lf(a)),e.uppercase=a=>e.check(uf(a)),e.trim=()=>e.check(gf()),e.normalize=(...a)=>e.check(ff(...a)),e.toLowerCase=()=>e.check(mf()),e.toUpperCase=()=>e.check(bf()),e.slugify=()=>e.check(kf())}),fg=w("ZodString",(e,t)=>{Gs.init(e,t),vc.init(e,t),e.email=n=>e.check(Rh(gg,n)),e.url=n=>e.check(Oh(mg,n)),e.jwt=n=>e.check(Xh(Lg,n)),e.emoji=n=>e.check(Nh(bg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.uuid=n=>e.check(Lh(lo,n)),e.uuidv4=n=>e.check(Ih(lo,n)),e.uuidv6=n=>e.check(zh(lo,n)),e.uuidv7=n=>e.check($h(lo,n)),e.nanoid=n=>e.check(Dh(kg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.cuid=n=>e.check(Mh(_g,n)),e.cuid2=n=>e.check(Uh(vg,n)),e.ulid=n=>e.check(jh(yg,n)),e.base64=n=>e.check(Wh(Cg,n)),e.base64url=n=>e.check(Jh(Pg,n)),e.xid=n=>e.check(Zh(wg,n)),e.ksuid=n=>e.check(qh(xg,n)),e.ipv4=n=>e.check(Hh(Sg,n)),e.ipv6=n=>e.check(Fh(Tg,n)),e.cidrv4=n=>e.check(Bh(Eg,n)),e.cidrv6=n=>e.check(Gh(Ag,n)),e.e164=n=>e.check(Yh(Rg,n)),e.datetime=n=>e.check(Jf(n)),e.date=n=>e.check(Xf(n)),e.time=n=>e.check(Kf(n)),e.duration=n=>e.check(eg(n))});function R(e){return Ph(fg,e)}const ye=w("ZodStringFormat",(e,t)=>{ke.init(e,t),vc.init(e,t)}),gg=w("ZodEmail",(e,t)=>{Op.init(e,t),ye.init(e,t)}),Vi=w("ZodGUID",(e,t)=>{zp.init(e,t),ye.init(e,t)}),lo=w("ZodUUID",(e,t)=>{$p.init(e,t),ye.init(e,t)}),mg=w("ZodURL",(e,t)=>{Np.init(e,t),ye.init(e,t)}),bg=w("ZodEmoji",(e,t)=>{Dp.init(e,t),ye.init(e,t)}),kg=w("ZodNanoID",(e,t)=>{Mp.init(e,t),ye.init(e,t)}),_g=w("ZodCUID",(e,t)=>{Up.init(e,t),ye.init(e,t)}),vg=w("ZodCUID2",(e,t)=>{jp.init(e,t),ye.init(e,t)}),yg=w("ZodULID",(e,t)=>{Zp.init(e,t),ye.init(e,t)}),wg=w("ZodXID",(e,t)=>{qp.init(e,t),ye.init(e,t)}),xg=w("ZodKSUID",(e,t)=>{Hp.init(e,t),ye.init(e,t)}),Sg=w("ZodIPv4",(e,t)=>{Jp.init(e,t),ye.init(e,t)}),Tg=w("ZodIPv6",(e,t)=>{Yp.init(e,t),ye.init(e,t)}),Eg=w("ZodCIDRv4",(e,t)=>{Xp.init(e,t),ye.init(e,t)}),Ag=w("ZodCIDRv6",(e,t)=>{Vp.init(e,t),ye.init(e,t)}),Cg=w("ZodBase64",(e,t)=>{Kp.init(e,t),ye.init(e,t)}),Pg=w("ZodBase64URL",(e,t)=>{eh.init(e,t),ye.init(e,t)}),Rg=w("ZodE164",(e,t)=>{th.init(e,t),ye.init(e,t)}),Lg=w("ZodJWT",(e,t)=>{rh.init(e,t),ye.init(e,t)}),yc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;lc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(m,k,y)=>Ef(e,m,k),e.gt=(m,k)=>e.check(Yi(m,k)),e.gte=(m,k)=>e.check(gs(m,k)),e.min=(m,k)=>e.check(gs(m,k)),e.lt=(m,k)=>e.check(Ji(m,k)),e.lte=(m,k)=>e.check(fs(m,k)),e.max=(m,k)=>e.check(fs(m,k)),e.int=m=>e.check(Ki(m)),e.safe=m=>e.check(Ki(m)),e.positive=m=>e.check(Yi(0,m)),e.nonnegative=m=>e.check(gs(0,m)),e.negative=m=>e.check(Ji(0,m)),e.nonpositive=m=>e.check(fs(0,m)),e.multipleOf=(m,k)=>e.check(Xi(m,k)),e.step=(m,k)=>e.check(Xi(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=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l: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 Ot(e){return tf(yc,e)}const Ig=w("ZodNumberFormat",(e,t)=>{oh.init(e,t),yc.init(e,t)});function Ki(e){return nf(Ig,e)}const zg=w("ZodBoolean",(e,t)=>{sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function ge(e){return rf(zg,e)}const $g=w("ZodAny",(e,t)=>{ih.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf()});function wc(){return of($g)}const Og=w("ZodUnknown",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf()});function Qi(){return sf(Og)}const Ng=w("ZodNever",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r)});function Dg(e){return af(Ng,e)}const Mg=w("ZodArray",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check($o(n,r)),e.nonempty=n=>e.check($o(1,n)),e.max=(n,r)=>e.check(fc(n,r)),e.length=(n,r)=>e.check(gc(n,r)),e.unwrap=()=>e.element});function St(e,t){return _f(Mg,e,t)}const Ug=w("ZodObject",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n,r,o),oe(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(U(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.loose=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.strict=()=>e.clone(U(v({},e._zod.def),{catchall:Dg()})),e.strip=()=>e.clone(U(v({},e._zod.def),{catchall:void 0})),e.extend=n=>Ld(e,n),e.safeExtend=n=>Id(e,n),e.merge=n=>zd(e,n),e.pick=n=>Pd(e,n),e.omit=n=>Rd(e,n),e.partial=(...n)=>$d(Tc,e,n[0]),e.required=(...n)=>Od(Ec,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},j(t));return new Ug(n)}const xc=w("ZodUnion",(e,t)=>{pc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.options=t.options});function jg(e,t){return new xc(v({type:"union",options:e},j(t)))}const Zg=w("ZodDiscriminatedUnion",(e,t)=>{xc.init(e,t),ph.init(e,t)});function Sc(e,t,n){return new Zg(v({type:"union",options:t,discriminator:e},j(n)))}const qg=w("ZodIntersection",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});function Hg(e,t){return new qg({type:"intersection",left:e,right:t})}const Fg=w("ZodRecord",(e,t)=>{fh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Fg(v({type:"record",keyType:e,valueType:t},j(n)))}const Cs=w("ZodEnum",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(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 Cs(U(v(U(v({},t),{checks:[]}),j(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 Cs(U(v(U(v({},t),{checks:[]}),j(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Cs(v({type:"enum",entries:n},j(t)))}const Bg=w("ZodLiteral",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(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 ut(e,t){return new Bg(v({type:"literal",values:Array.isArray(e)?e:[e]},j(t)))}const Gg=w("ZodTransform",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Mr(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),(l=p.inst)!=null||(p.inst=e),n.issues.push(Mr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Wg(e){return new Gg({type:"transform",transform:e})}const Tc=w("ZodOptional",(e,t)=>{hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ea(e){return new Tc({type:"optional",innerType:e})}const Jg=w("ZodExactOptional",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yg(e){return new Jg({type:"optional",innerType:e})}const Xg=w("ZodNullable",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Xg({type:"nullable",innerType:e})}const Vg=w("ZodDefault",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kg(e,t){return new Vg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Qg=w("ZodPrefault",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e,t){return new Qg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Ec=w("ZodNonOptional",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e,t){return new Ec(v({type:"nonoptional",innerType:e},j(t)))}const nm=w("ZodCatch",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rm(e,t){return new nm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const om=w("ZodPipe",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.in=t.in,e.out=t.out});function na(e,t){return new om({type:"pipe",in:e,out:t})}const sm=w("ZodReadonly",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e){return new sm({type:"readonly",innerType:e})}const am=w("ZodCustom",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n)});function cm(e,t={}){return vf(am,e,t)}function lm(e){return yf(e)}const um=fe({name:R().min(1).max(100).optional(),command:R().min(1).max(500),args:St(R()).optional(),failOnError:ge().default(!0).optional(),timeout:Ot().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:R().optional(),env:It(R(),R()).optional(),runOnBackground:ge().optional()});fe({name:R(),command:R(),success:ge(),exitCode:Ot().optional(),stdout:R().optional(),stderr:R().optional(),error:R().optional(),duration:Ot(),failOnError:ge()});const yn=fe({path:R(),extraCommands:St(um).optional(),id:R().uuid().optional(),rotationKey:R().optional(),usageStatus:dt(["free","in_use"]).optional()}),dm=Sc("operation",[yn.extend({operation:ut("create"),content:R().optional(),contentPath:R().optional(),encoding:dt(["utf-8","base64"]).optional()}),yn.extend({operation:ut("merge"),data:It(R(),wc()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),yn.extend({operation:ut("modify"),content:R().optional(),contentPath:R().optional(),createIfMissing:ge().optional()}),yn.extend({operation:ut("delete"),ignoreIfMissing:ge().optional()}),yn.extend({operation:ut("createDirectory"),contentPath:R().optional(),mode:Ot().optional(),ignoreIfExists:ge().optional()}),yn.extend({operation:ut("download"),url:R().url(),headers:It(R(),R()).optional(),timeout:Ot().min(1e3).max(3e5).optional()}),yn.extend({operation:ut("gitClone"),gitUrl:R(),gitSecretKey:R().optional(),sourceBranch:R().optional(),targetBranch:R().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 pm=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:R().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:R().optional().describe("Regex pattern for extraction")}),hm=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:wc().describe("Hook-specific configuration")});fe({command:R().optional().describe("Legacy — unused in SDK mode"),args:St(R()).optional().describe("Legacy — unused in SDK mode"),env:It(R(),R()).optional().describe("Environment variables"),workingDirectory:R().optional().describe("Working directory for command execution"),fileOperations:St(dm).optional().describe("File operations to perform during setup"),gitUrl:R().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:R().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:R().optional().describe("Commit message for git operations"),resultExtraction:pm.optional().describe("Schema for extracting result data"),postExecutionHooks:St(hm).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Sc("executionMode",[fe({executionMode:ut("claudeAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:St(R()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:St(R()).optional(),settings:fe({enabledPlugins:It(R(),ge())}),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("opencodeSdk"),promptText:R(),sdkOptions:fe({provider:R(),model:R(),allowedTools:St(R()).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("openaiAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("codexSdk"),promptText:R(),sdkOptions:fe({model:R().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("cursorSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:R().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:R().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:R().optional().describe("User rejection feedback"),rejectedPlanContent:R().optional().describe("Previously rejected plan content"),planCompletedAt:R().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:R().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:R().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:R().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:St(fe({feedback:R(),rejectedAt:R()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Ot().optional(),notificationChannelPlanMessageSentAt:R().optional(),notificationChannelCompletedMessageId:Ot().optional(),notificationChannelFailedMessageId:Ot().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:R().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:St(fe({id:R(),selectedText:R(),startOffset:Ot(),endOffset:Ot(),commentText:R(),createdAt:R()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().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:ge().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 Ac="browser_capture",fm="browser_automate";function ra(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 gm(e,t){const n=ra(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===ra(r)}function oa(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:[])gm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Cc(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 mm=3e4;function No(r){return L(this,arguments,function*(e,t={},n=mm){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,U(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 No(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Cc(a)})}function Pc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const bm=["projectId","note","ctx"];function km(e){const t=bm.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function Ps(e,t){return L(this,null,function*(){var p,h,g,m,k,y;km(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:l=Ac}=t;return Ue(e,"POST","/tasks",U(v(v(v(v(v(v(v(v(v(v(v(v({type:l,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:l,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 sa(e,t){return L(this,null,function*(){return Ps(e,U(v({},t),{type:fm}))})}function ia(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 _m(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function Rc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function vm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function aa(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function ym(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function wm(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function ca(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield No(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Cc(i)})}function xm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Sm(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 Tm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function Em(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Am(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function Cm(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function Pm(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Do(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Lc(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Rm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={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=(l=e.external.registry.get(h[0]))==null?void 0:l.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 kc(e,t){var a,d,l,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),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(C.$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 C in k)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(k[C])===JSON.stringify(S.def[C])&&delete k[C]}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,(l=n.def)!=null?l: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:U(v({},t["~standard"]),{jsonSchema:{input:Oo(t,"input",e.processors),output:Oo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ye(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 Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(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 Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ye(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ye(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ye(o,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const xf=(e,t={})=>n=>{const r=mc(U(v({},n),{processors:t}));return Re(e,r),bc(r,e),kc(r,e)},Oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=mc(U(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),bc(a,e),kc(a,e)},Sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tf=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Sf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>U(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},Ef=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,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 l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},Cf=(e,t,n,r)=>{n.not={}},Pf=(e,t,n,r)=>{},Rf=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{const o=e._zod.def,i=Ya(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},If=(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},zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Of=(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=Re(i.element,t,U(v({},r),{path:[...r.path,"items"]}))},Nf=(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]=Re(a[h],t,U(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,U(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Df=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,U(v({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Mf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,U(v({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,U(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},Uf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,U(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,U(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,U(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)}},jf=(e,t,n,r)=>{const o=e._zod.def,i=Re(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"}]},Zf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},qf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Hf=(e,t,n,r)=>{const o=e._zod.def;Re(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)))},Ff=(e,t,n,r)=>{const o=e._zod.def;Re(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},Bf=(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;Re(i,t,r);const a=t.seen.get(e);a.ref=i},Gf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},_c=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=w("ZodISODateTime",(e,t)=>{Fp.init(e,t),ye.init(e,t)});function Jf(e){return Vh(Wf,e)}const Yf=w("ZodISODate",(e,t)=>{Bp.init(e,t),ye.init(e,t)});function Xf(e){return Kh(Yf,e)}const Vf=w("ZodISOTime",(e,t)=>{Gp.init(e,t),ye.init(e,t)});function Kf(e){return Qh(Vf,e)}const Qf=w("ZodISODuration",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function eg(e){return ef(Qf,e)}const tg=(e,t)=>{Qa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dd(e,n)},flatten:{value:n=>Nd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Es,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Es,2)}},isEmpty:{get(){return e.issues.length===0}}})},ft=w("ZodError",tg,{Parent:Error}),ng=Fs(ft),rg=Bs(ft),og=Xo(ft),sg=Vo(ft),ig=jd(ft),ag=Zd(ft),cg=qd(ft),lg=Hd(ft),ug=Fd(ft),dg=Bd(ft),pg=Gd(ft),hg=Wd(ft),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oo(e,"input"),output:Oo(e,"output")}}),e.toJSONSchema=xf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(dn(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)=>pn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ng(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>og(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return rg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return sg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>ig(e,n,r),e.decode=(n,r)=>ag(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return cg(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return lg(e,n,r)}),e.safeEncode=(n,r)=>ug(e,n,r),e.safeDecode=(n,r)=>dg(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return pg(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return hg(e,n,r)}),e.refine=(n,r)=>e.check(cm(n,r)),e.superRefine=n=>e.check(lm(n)),e.overwrite=n=>e.check(ar(n)),e.optional=()=>ea(e),e.exactOptional=()=>Yg(e),e.nullable=()=>ta(e),e.nullish=()=>ea(ta(e)),e.nonoptional=n=>tm(e,n),e.array=()=>St(e),e.or=n=>jg([e,n]),e.and=n=>Hg(e,n),e.transform=n=>na(e,Wg(n)),e.default=n=>Kg(e,n),e.prefault=n=>em(e,n),e.catch=n=>rm(e,n),e.pipe=n=>na(e,n),e.readonly=()=>im(e),e.describe=n=>{const r=e.clone();return Pr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Pr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Pr.get(e);const r=e.clone();return Pr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),vc=w("_ZodString",(e,t)=>{var r,o,i;Gs.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Tf(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(cf(...a)),e.includes=(...a)=>e.check(df(...a)),e.startsWith=(...a)=>e.check(pf(...a)),e.endsWith=(...a)=>e.check(hf(...a)),e.min=(...a)=>e.check($o(...a)),e.max=(...a)=>e.check(fc(...a)),e.length=(...a)=>e.check(gc(...a)),e.nonempty=(...a)=>e.check($o(1,...a)),e.lowercase=a=>e.check(lf(a)),e.uppercase=a=>e.check(uf(a)),e.trim=()=>e.check(gf()),e.normalize=(...a)=>e.check(ff(...a)),e.toLowerCase=()=>e.check(mf()),e.toUpperCase=()=>e.check(bf()),e.slugify=()=>e.check(kf())}),fg=w("ZodString",(e,t)=>{Gs.init(e,t),vc.init(e,t),e.email=n=>e.check(Rh(gg,n)),e.url=n=>e.check(Oh(mg,n)),e.jwt=n=>e.check(Xh(Lg,n)),e.emoji=n=>e.check(Nh(bg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.uuid=n=>e.check(Lh(lo,n)),e.uuidv4=n=>e.check(Ih(lo,n)),e.uuidv6=n=>e.check(zh(lo,n)),e.uuidv7=n=>e.check($h(lo,n)),e.nanoid=n=>e.check(Dh(kg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.cuid=n=>e.check(Mh(_g,n)),e.cuid2=n=>e.check(Uh(vg,n)),e.ulid=n=>e.check(jh(yg,n)),e.base64=n=>e.check(Wh(Cg,n)),e.base64url=n=>e.check(Jh(Pg,n)),e.xid=n=>e.check(Zh(wg,n)),e.ksuid=n=>e.check(qh(xg,n)),e.ipv4=n=>e.check(Hh(Sg,n)),e.ipv6=n=>e.check(Fh(Tg,n)),e.cidrv4=n=>e.check(Bh(Eg,n)),e.cidrv6=n=>e.check(Gh(Ag,n)),e.e164=n=>e.check(Yh(Rg,n)),e.datetime=n=>e.check(Jf(n)),e.date=n=>e.check(Xf(n)),e.time=n=>e.check(Kf(n)),e.duration=n=>e.check(eg(n))});function R(e){return Ph(fg,e)}const ye=w("ZodStringFormat",(e,t)=>{ke.init(e,t),vc.init(e,t)}),gg=w("ZodEmail",(e,t)=>{Op.init(e,t),ye.init(e,t)}),Vi=w("ZodGUID",(e,t)=>{zp.init(e,t),ye.init(e,t)}),lo=w("ZodUUID",(e,t)=>{$p.init(e,t),ye.init(e,t)}),mg=w("ZodURL",(e,t)=>{Np.init(e,t),ye.init(e,t)}),bg=w("ZodEmoji",(e,t)=>{Dp.init(e,t),ye.init(e,t)}),kg=w("ZodNanoID",(e,t)=>{Mp.init(e,t),ye.init(e,t)}),_g=w("ZodCUID",(e,t)=>{Up.init(e,t),ye.init(e,t)}),vg=w("ZodCUID2",(e,t)=>{jp.init(e,t),ye.init(e,t)}),yg=w("ZodULID",(e,t)=>{Zp.init(e,t),ye.init(e,t)}),wg=w("ZodXID",(e,t)=>{qp.init(e,t),ye.init(e,t)}),xg=w("ZodKSUID",(e,t)=>{Hp.init(e,t),ye.init(e,t)}),Sg=w("ZodIPv4",(e,t)=>{Jp.init(e,t),ye.init(e,t)}),Tg=w("ZodIPv6",(e,t)=>{Yp.init(e,t),ye.init(e,t)}),Eg=w("ZodCIDRv4",(e,t)=>{Xp.init(e,t),ye.init(e,t)}),Ag=w("ZodCIDRv6",(e,t)=>{Vp.init(e,t),ye.init(e,t)}),Cg=w("ZodBase64",(e,t)=>{Kp.init(e,t),ye.init(e,t)}),Pg=w("ZodBase64URL",(e,t)=>{eh.init(e,t),ye.init(e,t)}),Rg=w("ZodE164",(e,t)=>{th.init(e,t),ye.init(e,t)}),Lg=w("ZodJWT",(e,t)=>{rh.init(e,t),ye.init(e,t)}),yc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;lc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(m,k,y)=>Ef(e,m,k),e.gt=(m,k)=>e.check(Yi(m,k)),e.gte=(m,k)=>e.check(gs(m,k)),e.min=(m,k)=>e.check(gs(m,k)),e.lt=(m,k)=>e.check(Ji(m,k)),e.lte=(m,k)=>e.check(fs(m,k)),e.max=(m,k)=>e.check(fs(m,k)),e.int=m=>e.check(Ki(m)),e.safe=m=>e.check(Ki(m)),e.positive=m=>e.check(Yi(0,m)),e.nonnegative=m=>e.check(gs(0,m)),e.negative=m=>e.check(Ji(0,m)),e.nonpositive=m=>e.check(fs(0,m)),e.multipleOf=(m,k)=>e.check(Xi(m,k)),e.step=(m,k)=>e.check(Xi(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=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l: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 Ot(e){return tf(yc,e)}const Ig=w("ZodNumberFormat",(e,t)=>{oh.init(e,t),yc.init(e,t)});function Ki(e){return nf(Ig,e)}const zg=w("ZodBoolean",(e,t)=>{sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function ge(e){return rf(zg,e)}const $g=w("ZodAny",(e,t)=>{ih.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf()});function wc(){return of($g)}const Og=w("ZodUnknown",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf()});function Qi(){return sf(Og)}const Ng=w("ZodNever",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r)});function Dg(e){return af(Ng,e)}const Mg=w("ZodArray",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check($o(n,r)),e.nonempty=n=>e.check($o(1,n)),e.max=(n,r)=>e.check(fc(n,r)),e.length=(n,r)=>e.check(gc(n,r)),e.unwrap=()=>e.element});function St(e,t){return _f(Mg,e,t)}const Ug=w("ZodObject",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n,r,o),oe(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(U(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.loose=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.strict=()=>e.clone(U(v({},e._zod.def),{catchall:Dg()})),e.strip=()=>e.clone(U(v({},e._zod.def),{catchall:void 0})),e.extend=n=>Ld(e,n),e.safeExtend=n=>Id(e,n),e.merge=n=>zd(e,n),e.pick=n=>Pd(e,n),e.omit=n=>Rd(e,n),e.partial=(...n)=>$d(Tc,e,n[0]),e.required=(...n)=>Od(Ec,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},j(t));return new Ug(n)}const xc=w("ZodUnion",(e,t)=>{pc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.options=t.options});function jg(e,t){return new xc(v({type:"union",options:e},j(t)))}const Zg=w("ZodDiscriminatedUnion",(e,t)=>{xc.init(e,t),ph.init(e,t)});function Sc(e,t,n){return new Zg(v({type:"union",options:t,discriminator:e},j(n)))}const qg=w("ZodIntersection",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});function Hg(e,t){return new qg({type:"intersection",left:e,right:t})}const Fg=w("ZodRecord",(e,t)=>{fh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Fg(v({type:"record",keyType:e,valueType:t},j(n)))}const Cs=w("ZodEnum",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(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 Cs(U(v(U(v({},t),{checks:[]}),j(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 Cs(U(v(U(v({},t),{checks:[]}),j(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Cs(v({type:"enum",entries:n},j(t)))}const Bg=w("ZodLiteral",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(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 ut(e,t){return new Bg(v({type:"literal",values:Array.isArray(e)?e:[e]},j(t)))}const Gg=w("ZodTransform",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Mr(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),(l=p.inst)!=null||(p.inst=e),n.issues.push(Mr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Wg(e){return new Gg({type:"transform",transform:e})}const Tc=w("ZodOptional",(e,t)=>{hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ea(e){return new Tc({type:"optional",innerType:e})}const Jg=w("ZodExactOptional",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yg(e){return new Jg({type:"optional",innerType:e})}const Xg=w("ZodNullable",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Xg({type:"nullable",innerType:e})}const Vg=w("ZodDefault",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kg(e,t){return new Vg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Qg=w("ZodPrefault",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e,t){return new Qg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Ec=w("ZodNonOptional",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e,t){return new Ec(v({type:"nonoptional",innerType:e},j(t)))}const nm=w("ZodCatch",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rm(e,t){return new nm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const om=w("ZodPipe",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.in=t.in,e.out=t.out});function na(e,t){return new om({type:"pipe",in:e,out:t})}const sm=w("ZodReadonly",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e){return new sm({type:"readonly",innerType:e})}const am=w("ZodCustom",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n)});function cm(e,t={}){return vf(am,e,t)}function lm(e){return yf(e)}const um=fe({name:R().min(1).max(100).optional(),command:R().min(1).max(500),args:St(R()).optional(),failOnError:ge().default(!0).optional(),timeout:Ot().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:R().optional(),env:It(R(),R()).optional(),runOnBackground:ge().optional()});fe({name:R(),command:R(),success:ge(),exitCode:Ot().optional(),stdout:R().optional(),stderr:R().optional(),error:R().optional(),duration:Ot(),failOnError:ge()});const yn=fe({path:R(),extraCommands:St(um).optional(),id:R().uuid().optional(),rotationKey:R().optional(),usageStatus:dt(["free","in_use"]).optional()}),dm=Sc("operation",[yn.extend({operation:ut("create"),content:R().optional(),contentPath:R().optional(),encoding:dt(["utf-8","base64"]).optional()}),yn.extend({operation:ut("merge"),data:It(R(),wc()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),yn.extend({operation:ut("modify"),content:R().optional(),contentPath:R().optional(),createIfMissing:ge().optional()}),yn.extend({operation:ut("delete"),ignoreIfMissing:ge().optional()}),yn.extend({operation:ut("createDirectory"),contentPath:R().optional(),mode:Ot().optional(),ignoreIfExists:ge().optional()}),yn.extend({operation:ut("download"),url:R().url(),headers:It(R(),R()).optional(),timeout:Ot().min(1e3).max(3e5).optional()}),yn.extend({operation:ut("gitClone"),gitUrl:R(),gitSecretKey:R().optional(),sourceBranch:R().optional(),targetBranch:R().optional(),originalBranch:R().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 pm=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:R().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:R().optional().describe("Regex pattern for extraction")}),hm=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:wc().describe("Hook-specific configuration")});fe({command:R().optional().describe("Legacy — unused in SDK mode"),args:St(R()).optional().describe("Legacy — unused in SDK mode"),env:It(R(),R()).optional().describe("Environment variables"),workingDirectory:R().optional().describe("Working directory for command execution"),fileOperations:St(dm).optional().describe("File operations to perform during setup"),gitUrl:R().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:R().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:R().optional().describe("Commit message for git operations"),resultExtraction:pm.optional().describe("Schema for extracting result data"),postExecutionHooks:St(hm).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Sc("executionMode",[fe({executionMode:ut("claudeAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:St(R()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:St(R()).optional(),settings:fe({enabledPlugins:It(R(),ge())}),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("opencodeSdk"),promptText:R(),sdkOptions:fe({provider:R(),model:R(),allowedTools:St(R()).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("openaiAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("codexSdk"),promptText:R(),sdkOptions:fe({model:R().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()}),fe({executionMode:ut("cursorSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:R().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:R().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:R().optional().describe("User rejection feedback"),rejectedPlanContent:R().optional().describe("Previously rejected plan content"),planCompletedAt:R().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:R().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:R().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:R().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:St(fe({feedback:R(),rejectedAt:R()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Ot().optional(),notificationChannelPlanMessageSentAt:R().optional(),notificationChannelCompletedMessageId:Ot().optional(),notificationChannelFailedMessageId:Ot().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:R().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:St(fe({id:R(),selectedText:R(),startOffset:Ot(),endOffset:Ot(),commentText:R(),createdAt:R()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().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:ge().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 Ac="browser_capture",fm="browser_automate";function ra(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 gm(e,t){const n=ra(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===ra(r)}function oa(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:[])gm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Cc(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 mm=3e4;function No(r){return L(this,arguments,function*(e,t={},n=mm){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,U(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 No(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Cc(a)})}function Pc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const bm=["projectId","note","ctx"];function km(e){const t=bm.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function Ps(e,t){return L(this,null,function*(){var p,h,g,m,k,y;km(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:l=Ac}=t;return Ue(e,"POST","/tasks",U(v(v(v(v(v(v(v(v(v(v(v(v({type:l,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:l,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 sa(e,t){return L(this,null,function*(){return Ps(e,U(v({},t),{type:fm}))})}function ia(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 _m(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function Rc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function vm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function aa(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function ym(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function wm(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function ca(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield No(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Cc(i)})}function xm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Sm(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 Tm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function Em(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Am(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function Cm(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function Pm(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Do(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Lc(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Rm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}};/*!
|
|
1359
1359
|
* Pusher JavaScript Library v8.5.0
|
|
1360
1360
|
* https://pusher.com/
|
|
1361
1361
|
*
|