@botpress/sdk 2.4.3 → 3.0.0
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/.turbo/turbo-build.log +11 -5
- package/dist/base-logger.d.ts +0 -0
- package/dist/bot/bot-logger.d.ts +0 -0
- package/dist/bot/client/index.d.ts +6 -0
- package/dist/bot/client/types.d.ts +87 -0
- package/dist/bot/client/types.test.d.ts +0 -0
- package/dist/bot/definition.d.ts +17 -9
- package/dist/bot/implementation.d.ts +11 -10
- package/dist/bot/index.d.ts +1 -1
- package/dist/bot/server/context.d.ts +0 -0
- package/dist/bot/server/index.d.ts +0 -0
- package/dist/bot/server/types.d.ts +32 -26
- package/dist/bot/server/types.test.d.ts +0 -0
- package/dist/bot/types/common.d.ts +6 -2
- package/dist/bot/types/common.test.d.ts +0 -0
- package/dist/bot/types/generic.d.ts +110 -9
- package/dist/bot/types/generic.test.d.ts +0 -0
- package/dist/bot/types/index.d.ts +0 -0
- package/dist/const.d.ts +0 -0
- package/dist/fixtures.d.ts +49 -0
- package/dist/index.cjs +129 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +123 -0
- package/dist/index.mjs.map +7 -0
- package/dist/integration/client/index.d.ts +0 -0
- package/dist/integration/client/types.d.ts +2 -1
- package/dist/integration/client/types.test.d.ts +0 -0
- package/dist/integration/definition/branded-schema.d.ts +0 -0
- package/dist/integration/definition/generic.d.ts +0 -0
- package/dist/integration/definition/index.d.ts +53 -12
- package/dist/integration/definition/types.d.ts +6 -1
- package/dist/integration/implementation.d.ts +0 -0
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/server/action-metadata.d.ts +0 -0
- package/dist/integration/server/context.d.ts +0 -0
- package/dist/integration/server/index.d.ts +0 -0
- package/dist/integration/server/integration-logger.d.ts +0 -0
- package/dist/integration/server/types.d.ts +0 -0
- package/dist/integration/types/common.d.ts +0 -7
- package/dist/integration/types/generic.d.ts +0 -0
- package/dist/integration/types/generic.test.d.ts +0 -0
- package/dist/integration/types/index.d.ts +0 -0
- package/dist/interface/definition.d.ts +0 -2
- package/dist/interface/index.d.ts +1 -0
- package/dist/interface/resolve.d.ts +18 -0
- package/dist/interface/types/generic.d.ts +0 -0
- package/dist/interface/types/generic.test.d.ts +0 -0
- package/dist/interface/types/index.d.ts +1 -0
- package/dist/log.d.ts +0 -0
- package/dist/message.d.ts +0 -0
- package/dist/package.d.ts +4 -2
- package/dist/plugin/action-proxy/index.d.ts +2 -0
- package/dist/plugin/action-proxy/proxy.d.ts +5 -0
- package/dist/plugin/action-proxy/types.d.ts +14 -0
- package/dist/plugin/action-proxy/types.test.d.ts +1 -0
- package/dist/plugin/definition.d.ts +11 -6
- package/dist/plugin/implementation.d.ts +21 -15
- package/dist/plugin/index.d.ts +2 -1
- package/dist/plugin/interface-resolution.d.ts +15 -0
- package/dist/plugin/server/index.d.ts +1 -0
- package/dist/plugin/server/types.d.ts +241 -1
- package/dist/plugin/server/types.test.d.ts +0 -0
- package/dist/plugin/types/common.d.ts +41 -0
- package/dist/plugin/types/generic.d.ts +110 -2
- package/dist/plugin/types/generic.test.d.ts +0 -0
- package/dist/plugin/types/index.d.ts +2 -0
- package/dist/retry.d.ts +0 -0
- package/dist/schema.d.ts +0 -0
- package/dist/serve.d.ts +2 -2
- package/dist/utils/array-utils.d.ts +0 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/utils/record-utils.d.ts +2 -0
- package/dist/utils/record-utils.test.d.ts +1 -0
- package/dist/utils/type-utils.d.ts +15 -0
- package/dist/utils/type-utils.test.d.ts +0 -0
- package/dist/zui.d.ts +1 -0
- package/package.json +18 -8
- package/dist/bot/merge-bots.d.ts +0 -2
- package/dist/index.js +0 -129
- package/dist/index.js.map +0 -7
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";var sg=Object.create;var Ir=Object.defineProperty;var ig=Object.getOwnPropertyDescriptor;var og=Object.getOwnPropertyNames;var ug=Object.getPrototypeOf,cg=Object.prototype.hasOwnProperty;var Ia=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Zr=(t,e)=>{for(var r in e)Ir(t,r,{get:e[r],enumerable:!0})},Hi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of og(e))!cg.call(t,a)&&a!==r&&Ir(t,a,{get:()=>e[a],enumerable:!(n=ig(e,a))||n.enumerable});return t};var et=(t,e,r)=>(r=t!=null?sg(ug(t)):{},Hi(e||!t||!t.__esModule?Ir(r,"default",{value:t,enumerable:!0}):r,t)),lg=t=>Hi(Ir({},"__esModule",{value:!0}),t);var Ji=Ia(N=>{"use strict";var Wt=Symbol.for("react.element"),dg=Symbol.for("react.portal"),fg=Symbol.for("react.fragment"),pg=Symbol.for("react.strict_mode"),gg=Symbol.for("react.profiler"),mg=Symbol.for("react.provider"),hg=Symbol.for("react.context"),yg=Symbol.for("react.forward_ref"),vg=Symbol.for("react.suspense"),_g=Symbol.for("react.memo"),bg=Symbol.for("react.lazy"),Ni=Symbol.iterator;function Tg(t){return t===null||typeof t!="object"?null:(t=Ni&&t[Ni]||t["@@iterator"],typeof t=="function"?t:null)}var Fi={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Li=Object.assign,zi={};function Pt(t,e,r){this.props=t,this.context=e,this.refs=zi,this.updater=r||Fi}Pt.prototype.isReactComponent={};Pt.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Pt.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Ki(){}Ki.prototype=Pt.prototype;function Aa(t,e,r){this.props=t,this.context=e,this.refs=zi,this.updater=r||Fi}var Ra=Aa.prototype=new Ki;Ra.constructor=Aa;Li(Ra,Pt.prototype);Ra.isPureReactComponent=!0;var $i=Array.isArray,Vi=Object.prototype.hasOwnProperty,Ba={current:null},qi={key:!0,ref:!0,__self:!0,__source:!0};function Gi(t,e,r){var n,a={},s=null,i=null;if(e!=null)for(n in e.ref!==void 0&&(i=e.ref),e.key!==void 0&&(s=""+e.key),e)Vi.call(e,n)&&!qi.hasOwnProperty(n)&&(a[n]=e[n]);var o=arguments.length-2;if(o===1)a.children=r;else if(1<o){for(var d=Array(o),p=0;p<o;p++)d[p]=arguments[p+2];a.children=d}if(t&&t.defaultProps)for(n in o=t.defaultProps,o)a[n]===void 0&&(a[n]=o[n]);return{$$typeof:Wt,type:t,key:s,ref:i,props:a,_owner:Ba.current}}function Pg(t,e){return{$$typeof:Wt,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Da(t){return typeof t=="object"&&t!==null&&t.$$typeof===Wt}function Eg(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var Ui=/\/+/g;function Za(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Eg(""+t.key):e.toString(36)}function Rr(t,e,r,n,a){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var i=!1;if(t===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(t.$$typeof){case Wt:case dg:i=!0}}if(i)return i=t,a=a(i),t=n===""?"."+Za(i,0):n,$i(a)?(r="",t!=null&&(r=t.replace(Ui,"$&/")+"/"),Rr(a,e,r,"",function(p){return p})):a!=null&&(Da(a)&&(a=Pg(a,r+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(Ui,"$&/")+"/")+t)),e.push(a)),1;if(i=0,n=n===""?".":n+":",$i(t))for(var o=0;o<t.length;o++){s=t[o];var d=n+Za(s,o);i+=Rr(s,e,r,d,a)}else if(d=Tg(t),typeof d=="function")for(t=d.call(t),o=0;!(s=t.next()).done;)s=s.value,d=n+Za(s,o++),i+=Rr(s,e,r,d,a);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return i}function Ar(t,e,r){if(t==null)return t;var n=[],a=0;return Rr(t,n,"","",function(s){return e.call(r,s,a++)}),n}function xg(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r)},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var he={current:null},Br={transition:null},Sg={ReactCurrentDispatcher:he,ReactCurrentBatchConfig:Br,ReactCurrentOwner:Ba};function Wi(){throw Error("act(...) is not supported in production builds of React.")}N.Children={map:Ar,forEach:function(t,e,r){Ar(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Ar(t,function(){e++}),e},toArray:function(t){return Ar(t,function(e){return e})||[]},only:function(t){if(!Da(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};N.Component=Pt;N.Fragment=fg;N.Profiler=gg;N.PureComponent=Aa;N.StrictMode=pg;N.Suspense=vg;N.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Sg;N.act=Wi;N.cloneElement=function(t,e,r){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=Li({},t.props),a=t.key,s=t.ref,i=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,i=Ba.current),e.key!==void 0&&(a=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(d in e)Vi.call(e,d)&&!qi.hasOwnProperty(d)&&(n[d]=e[d]===void 0&&o!==void 0?o[d]:e[d])}var d=arguments.length-2;if(d===1)n.children=r;else if(1<d){o=Array(d);for(var p=0;p<d;p++)o[p]=arguments[p+2];n.children=o}return{$$typeof:Wt,type:t.type,key:a,ref:s,props:n,_owner:i}};N.createContext=function(t){return t={$$typeof:hg,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:mg,_context:t},t.Consumer=t};N.createElement=Gi;N.createFactory=function(t){var e=Gi.bind(null,t);return e.type=t,e};N.createRef=function(){return{current:null}};N.forwardRef=function(t){return{$$typeof:yg,render:t}};N.isValidElement=Da;N.lazy=function(t){return{$$typeof:bg,_payload:{_status:-1,_result:t},_init:xg}};N.memo=function(t,e){return{$$typeof:_g,type:t,compare:e===void 0?null:e}};N.startTransition=function(t){var e=Br.transition;Br.transition={};try{t()}finally{Br.transition=e}};N.unstable_act=Wi;N.useCallback=function(t,e){return he.current.useCallback(t,e)};N.useContext=function(t){return he.current.useContext(t)};N.useDebugValue=function(){};N.useDeferredValue=function(t){return he.current.useDeferredValue(t)};N.useEffect=function(t,e){return he.current.useEffect(t,e)};N.useId=function(){return he.current.useId()};N.useImperativeHandle=function(t,e,r){return he.current.useImperativeHandle(t,e,r)};N.useInsertionEffect=function(t,e){return he.current.useInsertionEffect(t,e)};N.useLayoutEffect=function(t,e){return he.current.useLayoutEffect(t,e)};N.useMemo=function(t,e){return he.current.useMemo(t,e)};N.useReducer=function(t,e,r){return he.current.useReducer(t,e,r)};N.useRef=function(t){return he.current.useRef(t)};N.useState=function(t){return he.current.useState(t)};N.useSyncExternalStore=function(t,e,r){return he.current.useSyncExternalStore(t,e,r)};N.useTransition=function(){return he.current.useTransition()};N.version="18.3.1"});var Yi=Ia(($,Dr)=>{"use strict";process.env.NODE_ENV!=="production"&&function(){"use strict";typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t="18.3.1",e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),D=Symbol.iterator,z="@@iterator";function q(c){if(c===null||typeof c!="object")return null;var f=D&&c[D]||c[z];return typeof f=="function"?f:null}var se={current:null},V={transition:null},H={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},W={current:null},ce={},Le=null;function Xe(c){Le=c}ce.setExtraStackFrame=function(c){Le=c},ce.getCurrentStack=null,ce.getStackAddendum=function(){var c="";Le&&(c+=Le);var f=ce.getCurrentStack;return f&&(c+=f()||""),c};var Oe=!1,Te=!1,da=!1,fa=!1,Pe=!1,_e={ReactCurrentDispatcher:se,ReactCurrentBatchConfig:V,ReactCurrentOwner:W};_e.ReactDebugCurrentFrame=ce,_e.ReactCurrentActQueue=H;function Ee(c){{for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];Ce("warn",c,g)}}function j(c){{for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];Ce("error",c,g)}}function Ce(c,f,g){{var h=_e.ReactDebugCurrentFrame,b=h.getStackAddendum();b!==""&&(f+="%s",g=g.concat([b]));var I=g.map(function(w){return String(w)});I.unshift("Warning: "+f),Function.prototype.apply.call(console[c],console,I)}}var ke={};function ze(c,f){{var g=c.constructor,h=g&&(g.displayName||g.name)||"ReactClass",b=h+"."+f;if(ke[b])return;j("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",f,h),ke[b]=!0}}var Qs={isMounted:function(c){return!1},enqueueForceUpdate:function(c,f,g){ze(c,"forceUpdate")},enqueueReplaceState:function(c,f,g,h){ze(c,"replaceState")},enqueueSetState:function(c,f,g,h){ze(c,"setState")}},Re=Object.assign,pa={};Object.freeze(pa);function Qe(c,f,g){this.props=c,this.context=f,this.refs=pa,this.updater=g||Qs}Qe.prototype.isReactComponent={},Qe.prototype.setState=function(c,f){if(typeof c!="object"&&typeof c!="function"&&c!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,c,f,"setState")},Qe.prototype.forceUpdate=function(c){this.updater.enqueueForceUpdate(this,c,"forceUpdate")};{var ga={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},Xf=function(c,f){Object.defineProperty(Qe.prototype,c,{get:function(){Ee("%s(...) is deprecated in plain JavaScript React classes. %s",f[0],f[1])}})};for(var ma in ga)ga.hasOwnProperty(ma)&&Xf(ma,ga[ma])}function ei(){}ei.prototype=Qe.prototype;function ha(c,f,g){this.props=c,this.context=f,this.refs=pa,this.updater=g||Qs}var ya=ha.prototype=new ei;ya.constructor=ha,Re(ya,Qe.prototype),ya.isPureReactComponent=!0;function Qf(){var c={current:null};return Object.seal(c),c}var ep=Array.isArray;function _r(c){return ep(c)}function tp(c){{var f=typeof Symbol=="function"&&Symbol.toStringTag,g=f&&c[Symbol.toStringTag]||c.constructor.name||"Object";return g}}function rp(c){try{return ti(c),!1}catch{return!0}}function ti(c){return""+c}function br(c){if(rp(c))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",tp(c)),ti(c)}function np(c,f,g){var h=c.displayName;if(h)return h;var b=f.displayName||f.name||"";return b!==""?g+"("+b+")":g}function ri(c){return c.displayName||"Context"}function Ke(c){if(c==null)return null;if(typeof c.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case y:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case o:var f=c;return ri(f)+".Consumer";case i:var g=c;return ri(g._context)+".Provider";case d:return np(c,c.render,"ForwardRef");case T:var h=c.displayName||null;return h!==null?h:Ke(c.type)||"Memo";case k:{var b=c,I=b._payload,w=b._init;try{return Ke(w(I))}catch{return null}}}return null}var Vt=Object.prototype.hasOwnProperty,ni={key:!0,ref:!0,__self:!0,__source:!0},ai,si,va;va={};function ii(c){if(Vt.call(c,"ref")){var f=Object.getOwnPropertyDescriptor(c,"ref").get;if(f&&f.isReactWarning)return!1}return c.ref!==void 0}function oi(c){if(Vt.call(c,"key")){var f=Object.getOwnPropertyDescriptor(c,"key").get;if(f&&f.isReactWarning)return!1}return c.key!==void 0}function ap(c,f){var g=function(){ai||(ai=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(c,"key",{get:g,configurable:!0})}function sp(c,f){var g=function(){si||(si=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",f))};g.isReactWarning=!0,Object.defineProperty(c,"ref",{get:g,configurable:!0})}function ip(c){if(typeof c.ref=="string"&&W.current&&c.__self&&W.current.stateNode!==c.__self){var f=Ke(W.current.type);va[f]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',f,c.ref),va[f]=!0)}}var _a=function(c,f,g,h,b,I,w){var R={$$typeof:e,type:c,key:f,ref:g,props:w,_owner:I};return R._store={},Object.defineProperty(R._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(R,"_self",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.defineProperty(R,"_source",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.freeze&&(Object.freeze(R.props),Object.freeze(R)),R};function op(c,f,g){var h,b={},I=null,w=null,R=null,F=null;if(f!=null){ii(f)&&(w=f.ref,ip(f)),oi(f)&&(br(f.key),I=""+f.key),R=f.__self===void 0?null:f.__self,F=f.__source===void 0?null:f.__source;for(h in f)Vt.call(f,h)&&!ni.hasOwnProperty(h)&&(b[h]=f[h])}var J=arguments.length-2;if(J===1)b.children=g;else if(J>1){for(var Q=Array(J),ee=0;ee<J;ee++)Q[ee]=arguments[ee+2];Object.freeze&&Object.freeze(Q),b.children=Q}if(c&&c.defaultProps){var re=c.defaultProps;for(h in re)b[h]===void 0&&(b[h]=re[h])}if(I||w){var oe=typeof c=="function"?c.displayName||c.name||"Unknown":c;I&&ap(b,oe),w&&sp(b,oe)}return _a(c,I,w,R,F,W.current,b)}function up(c,f){var g=_a(c.type,f,c.ref,c._self,c._source,c._owner,c.props);return g}function cp(c,f,g){if(c==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+c+".");var h,b=Re({},c.props),I=c.key,w=c.ref,R=c._self,F=c._source,J=c._owner;if(f!=null){ii(f)&&(w=f.ref,J=W.current),oi(f)&&(br(f.key),I=""+f.key);var Q;c.type&&c.type.defaultProps&&(Q=c.type.defaultProps);for(h in f)Vt.call(f,h)&&!ni.hasOwnProperty(h)&&(f[h]===void 0&&Q!==void 0?b[h]=Q[h]:b[h]=f[h])}var ee=arguments.length-2;if(ee===1)b.children=g;else if(ee>1){for(var re=Array(ee),oe=0;oe<ee;oe++)re[oe]=arguments[oe+2];b.children=re}return _a(c.type,I,w,R,F,J,b)}function _t(c){return typeof c=="object"&&c!==null&&c.$$typeof===e}var ui=".",lp=":";function dp(c){var f=/[=:]/g,g={"=":"=0",":":"=2"},h=c.replace(f,function(b){return g[b]});return"$"+h}var ci=!1,fp=/\/+/g;function li(c){return c.replace(fp,"$&/")}function ba(c,f){return typeof c=="object"&&c!==null&&c.key!=null?(br(c.key),dp(""+c.key)):f.toString(36)}function Tr(c,f,g,h,b){var I=typeof c;(I==="undefined"||I==="boolean")&&(c=null);var w=!1;if(c===null)w=!0;else switch(I){case"string":case"number":w=!0;break;case"object":switch(c.$$typeof){case e:case r:w=!0}}if(w){var R=c,F=b(R),J=h===""?ui+ba(R,0):h;if(_r(F)){var Q="";J!=null&&(Q=li(J)+"/"),Tr(F,f,Q,"",function(ag){return ag})}else F!=null&&(_t(F)&&(F.key&&(!R||R.key!==F.key)&&br(F.key),F=up(F,g+(F.key&&(!R||R.key!==F.key)?li(""+F.key)+"/":"")+J)),f.push(F));return 1}var ee,re,oe=0,de=h===""?ui:h+lp;if(_r(c))for(var Cr=0;Cr<c.length;Cr++)ee=c[Cr],re=de+ba(ee,Cr),oe+=Tr(ee,f,g,re,b);else{var Ca=q(c);if(typeof Ca=="function"){var Di=c;Ca===Di.entries&&(ci||Ee("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),ci=!0);for(var rg=Ca.call(Di),Mi,ng=0;!(Mi=rg.next()).done;)ee=Mi.value,re=de+ba(ee,ng++),oe+=Tr(ee,f,g,re,b)}else if(I==="object"){var ji=String(c);throw new Error("Objects are not valid as a React child (found: "+(ji==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":ji)+"). If you meant to render a collection of children, use an array instead.")}}return oe}function Pr(c,f,g){if(c==null)return c;var h=[],b=0;return Tr(c,h,"","",function(I){return f.call(g,I,b++)}),h}function pp(c){var f=0;return Pr(c,function(){f++}),f}function gp(c,f,g){Pr(c,function(){f.apply(this,arguments)},g)}function mp(c){return Pr(c,function(f){return f})||[]}function hp(c){if(!_t(c))throw new Error("React.Children.only expected to receive a single React element child.");return c}function yp(c){var f={$$typeof:o,_currentValue:c,_currentValue2:c,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};f.Provider={$$typeof:i,_context:f};var g=!1,h=!1,b=!1;{var I={$$typeof:o,_context:f};Object.defineProperties(I,{Provider:{get:function(){return h||(h=!0,j("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),f.Provider},set:function(w){f.Provider=w}},_currentValue:{get:function(){return f._currentValue},set:function(w){f._currentValue=w}},_currentValue2:{get:function(){return f._currentValue2},set:function(w){f._currentValue2=w}},_threadCount:{get:function(){return f._threadCount},set:function(w){f._threadCount=w}},Consumer:{get:function(){return g||(g=!0,j("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),f.Consumer}},displayName:{get:function(){return f.displayName},set:function(w){b||(Ee("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",w),b=!0)}}}),f.Consumer=I}return f._currentRenderer=null,f._currentRenderer2=null,f}var qt=-1,Ta=0,di=1,vp=2;function _p(c){if(c._status===qt){var f=c._result,g=f();if(g.then(function(I){if(c._status===Ta||c._status===qt){var w=c;w._status=di,w._result=I}},function(I){if(c._status===Ta||c._status===qt){var w=c;w._status=vp,w._result=I}}),c._status===qt){var h=c;h._status=Ta,h._result=g}}if(c._status===di){var b=c._result;return b===void 0&&j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
2
|
+
|
|
3
|
+
Your code should look like:
|
|
4
|
+
const MyComponent = lazy(() => import('./MyComponent'))
|
|
5
|
+
|
|
6
|
+
Did you accidentally put curly braces around the import?`,b),"default"in b||j(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
+
|
|
8
|
+
Your code should look like:
|
|
9
|
+
const MyComponent = lazy(() => import('./MyComponent'))`,b),b.default}else throw c._result}function bp(c){var f={_status:qt,_result:c},g={$$typeof:k,_payload:f,_init:_p};{var h,b;Object.defineProperties(g,{defaultProps:{configurable:!0,get:function(){return h},set:function(I){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),h=I,Object.defineProperty(g,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return b},set:function(I){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),b=I,Object.defineProperty(g,"propTypes",{enumerable:!0})}}})}return g}function Tp(c){c!=null&&c.$$typeof===T?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof c!="function"?j("forwardRef requires a render function but was given %s.",c===null?"null":typeof c):c.length!==0&&c.length!==2&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",c.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),c!=null&&(c.defaultProps!=null||c.propTypes!=null)&&j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var f={$$typeof:d,render:c};{var g;Object.defineProperty(f,"displayName",{enumerable:!1,configurable:!0,get:function(){return g},set:function(h){g=h,!c.name&&!c.displayName&&(c.displayName=h)}})}return f}var fi;fi=Symbol.for("react.module.reference");function pi(c){return!!(typeof c=="string"||typeof c=="function"||c===n||c===s||Pe||c===a||c===p||c===y||fa||c===P||Oe||Te||da||typeof c=="object"&&c!==null&&(c.$$typeof===k||c.$$typeof===T||c.$$typeof===i||c.$$typeof===o||c.$$typeof===d||c.$$typeof===fi||c.getModuleId!==void 0))}function Pp(c,f){pi(c)||j("memo: The first argument must be a component. Instead received: %s",c===null?"null":typeof c);var g={$$typeof:T,type:c,compare:f===void 0?null:f};{var h;Object.defineProperty(g,"displayName",{enumerable:!1,configurable:!0,get:function(){return h},set:function(b){h=b,!c.name&&!c.displayName&&(c.displayName=b)}})}return g}function me(){var c=se.current;return c===null&&j(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
10
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
11
|
+
2. You might be breaking the Rules of Hooks
|
|
12
|
+
3. You might have more than one copy of React in the same app
|
|
13
|
+
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),c}function Ep(c){var f=me();if(c._context!==void 0){var g=c._context;g.Consumer===c?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):g.Provider===c&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return f.useContext(c)}function xp(c){var f=me();return f.useState(c)}function Sp(c,f,g){var h=me();return h.useReducer(c,f,g)}function wp(c){var f=me();return f.useRef(c)}function kp(c,f){var g=me();return g.useEffect(c,f)}function Op(c,f){var g=me();return g.useInsertionEffect(c,f)}function Cp(c,f){var g=me();return g.useLayoutEffect(c,f)}function Ip(c,f){var g=me();return g.useCallback(c,f)}function Zp(c,f){var g=me();return g.useMemo(c,f)}function Ap(c,f,g){var h=me();return h.useImperativeHandle(c,f,g)}function Rp(c,f){{var g=me();return g.useDebugValue(c,f)}}function Bp(){var c=me();return c.useTransition()}function Dp(c){var f=me();return f.useDeferredValue(c)}function Mp(){var c=me();return c.useId()}function jp(c,f,g){var h=me();return h.useSyncExternalStore(c,f,g)}var Gt=0,gi,mi,hi,yi,vi,_i,bi;function Ti(){}Ti.__reactDisabledLog=!0;function Hp(){{if(Gt===0){gi=console.log,mi=console.info,hi=console.warn,yi=console.error,vi=console.group,_i=console.groupCollapsed,bi=console.groupEnd;var c={configurable:!0,enumerable:!0,value:Ti,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}Gt++}}function Np(){{if(Gt--,Gt===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Re({},c,{value:gi}),info:Re({},c,{value:mi}),warn:Re({},c,{value:hi}),error:Re({},c,{value:yi}),group:Re({},c,{value:vi}),groupCollapsed:Re({},c,{value:_i}),groupEnd:Re({},c,{value:bi})})}Gt<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Pa=_e.ReactCurrentDispatcher,Ea;function Er(c,f,g){{if(Ea===void 0)try{throw Error()}catch(b){var h=b.stack.trim().match(/\n( *(at )?)/);Ea=h&&h[1]||""}return`
|
|
14
|
+
`+Ea+c}}var xa=!1,xr;{var $p=typeof WeakMap=="function"?WeakMap:Map;xr=new $p}function Pi(c,f){if(!c||xa)return"";{var g=xr.get(c);if(g!==void 0)return g}var h;xa=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=Pa.current,Pa.current=null,Hp();try{if(f){var w=function(){throw Error()};if(Object.defineProperty(w.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(w,[])}catch(de){h=de}Reflect.construct(c,[],w)}else{try{w.call()}catch(de){h=de}c.call(w.prototype)}}else{try{throw Error()}catch(de){h=de}c()}}catch(de){if(de&&h&&typeof de.stack=="string"){for(var R=de.stack.split(`
|
|
15
|
+
`),F=h.stack.split(`
|
|
16
|
+
`),J=R.length-1,Q=F.length-1;J>=1&&Q>=0&&R[J]!==F[Q];)Q--;for(;J>=1&&Q>=0;J--,Q--)if(R[J]!==F[Q]){if(J!==1||Q!==1)do if(J--,Q--,Q<0||R[J]!==F[Q]){var ee=`
|
|
17
|
+
`+R[J].replace(" at new "," at ");return c.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",c.displayName)),typeof c=="function"&&xr.set(c,ee),ee}while(J>=1&&Q>=0);break}}}finally{xa=!1,Pa.current=I,Np(),Error.prepareStackTrace=b}var re=c?c.displayName||c.name:"",oe=re?Er(re):"";return typeof c=="function"&&xr.set(c,oe),oe}function Up(c,f,g){return Pi(c,!1)}function Fp(c){var f=c.prototype;return!!(f&&f.isReactComponent)}function Sr(c,f,g){if(c==null)return"";if(typeof c=="function")return Pi(c,Fp(c));if(typeof c=="string")return Er(c);switch(c){case p:return Er("Suspense");case y:return Er("SuspenseList")}if(typeof c=="object")switch(c.$$typeof){case d:return Up(c.render);case T:return Sr(c.type,f,g);case k:{var h=c,b=h._payload,I=h._init;try{return Sr(I(b),f,g)}catch{}}}return""}var Ei={},xi=_e.ReactDebugCurrentFrame;function wr(c){if(c){var f=c._owner,g=Sr(c.type,c._source,f?f.type:null);xi.setExtraStackFrame(g)}else xi.setExtraStackFrame(null)}function Lp(c,f,g,h,b){{var I=Function.call.bind(Vt);for(var w in c)if(I(c,w)){var R=void 0;try{if(typeof c[w]!="function"){var F=Error((h||"React class")+": "+g+" type `"+w+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[w]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw F.name="Invariant Violation",F}R=c[w](f,w,h,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(J){R=J}R&&!(R instanceof Error)&&(wr(b),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",h||"React class",g,w,typeof R),wr(null)),R instanceof Error&&!(R.message in Ei)&&(Ei[R.message]=!0,wr(b),j("Failed %s type: %s",g,R.message),wr(null))}}}function bt(c){if(c){var f=c._owner,g=Sr(c.type,c._source,f?f.type:null);Xe(g)}else Xe(null)}var Sa;Sa=!1;function Si(){if(W.current){var c=Ke(W.current.type);if(c)return`
|
|
18
|
+
|
|
19
|
+
Check the render method of \``+c+"`."}return""}function zp(c){if(c!==void 0){var f=c.fileName.replace(/^.*[\\\/]/,""),g=c.lineNumber;return`
|
|
20
|
+
|
|
21
|
+
Check your code at `+f+":"+g+"."}return""}function Kp(c){return c!=null?zp(c.__source):""}var wi={};function Vp(c){var f=Si();if(!f){var g=typeof c=="string"?c:c.displayName||c.name;g&&(f=`
|
|
22
|
+
|
|
23
|
+
Check the top-level render call using <`+g+">.")}return f}function ki(c,f){if(!(!c._store||c._store.validated||c.key!=null)){c._store.validated=!0;var g=Vp(f);if(!wi[g]){wi[g]=!0;var h="";c&&c._owner&&c._owner!==W.current&&(h=" It was passed a child from "+Ke(c._owner.type)+"."),bt(c),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,h),bt(null)}}}function Oi(c,f){if(typeof c=="object"){if(_r(c))for(var g=0;g<c.length;g++){var h=c[g];_t(h)&&ki(h,f)}else if(_t(c))c._store&&(c._store.validated=!0);else if(c){var b=q(c);if(typeof b=="function"&&b!==c.entries)for(var I=b.call(c),w;!(w=I.next()).done;)_t(w.value)&&ki(w.value,f)}}}function Ci(c){{var f=c.type;if(f==null||typeof f=="string")return;var g;if(typeof f=="function")g=f.propTypes;else if(typeof f=="object"&&(f.$$typeof===d||f.$$typeof===T))g=f.propTypes;else return;if(g){var h=Ke(f);Lp(g,c.props,"prop",h,c)}else if(f.PropTypes!==void 0&&!Sa){Sa=!0;var b=Ke(f);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",b||"Unknown")}typeof f.getDefaultProps=="function"&&!f.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function qp(c){{for(var f=Object.keys(c.props),g=0;g<f.length;g++){var h=f[g];if(h!=="children"&&h!=="key"){bt(c),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",h),bt(null);break}}c.ref!==null&&(bt(c),j("Invalid attribute `ref` supplied to `React.Fragment`."),bt(null))}}function Ii(c,f,g){var h=pi(c);if(!h){var b="";(c===void 0||typeof c=="object"&&c!==null&&Object.keys(c).length===0)&&(b+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var I=Kp(f);I?b+=I:b+=Si();var w;c===null?w="null":_r(c)?w="array":c!==void 0&&c.$$typeof===e?(w="<"+(Ke(c.type)||"Unknown")+" />",b=" Did you accidentally export a JSX literal instead of a component?"):w=typeof c,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",w,b)}var R=op.apply(this,arguments);if(R==null)return R;if(h)for(var F=2;F<arguments.length;F++)Oi(arguments[F],c);return c===n?qp(R):Ci(R),R}var Zi=!1;function Gp(c){var f=Ii.bind(null,c);return f.type=c,Zi||(Zi=!0,Ee("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(f,"type",{enumerable:!1,get:function(){return Ee("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:c}),c}}),f}function Wp(c,f,g){for(var h=cp.apply(this,arguments),b=2;b<arguments.length;b++)Oi(arguments[b],h.type);return Ci(h),h}function Jp(c,f){var g=V.transition;V.transition={};var h=V.transition;V.transition._updatedFibers=new Set;try{c()}finally{if(V.transition=g,g===null&&h._updatedFibers){var b=h._updatedFibers.size;b>10&&Ee("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),h._updatedFibers.clear()}}}var Ai=!1,kr=null;function Yp(c){if(kr===null)try{var f=("require"+Math.random()).slice(0,7),g=Dr&&Dr[f];kr=g.call(Dr,"timers").setImmediate}catch{kr=function(b){Ai===!1&&(Ai=!0,typeof MessageChannel>"u"&&j("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var I=new MessageChannel;I.port1.onmessage=b,I.port2.postMessage(void 0)}}return kr(c)}var Tt=0,Ri=!1;function Bi(c){{var f=Tt;Tt++,H.current===null&&(H.current=[]);var g=H.isBatchingLegacy,h;try{if(H.isBatchingLegacy=!0,h=c(),!g&&H.didScheduleLegacyUpdate){var b=H.current;b!==null&&(H.didScheduleLegacyUpdate=!1,Oa(b))}}catch(re){throw Or(f),re}finally{H.isBatchingLegacy=g}if(h!==null&&typeof h=="object"&&typeof h.then=="function"){var I=h,w=!1,R={then:function(re,oe){w=!0,I.then(function(de){Or(f),Tt===0?wa(de,re,oe):re(de)},function(de){Or(f),oe(de)})}};return!Ri&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){w||(Ri=!0,j("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),R}else{var F=h;if(Or(f),Tt===0){var J=H.current;J!==null&&(Oa(J),H.current=null);var Q={then:function(re,oe){H.current===null?(H.current=[],wa(F,re,oe)):re(F)}};return Q}else{var ee={then:function(re,oe){re(F)}};return ee}}}}function Or(c){c!==Tt-1&&j("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Tt=c}function wa(c,f,g){{var h=H.current;if(h!==null)try{Oa(h),Yp(function(){h.length===0?(H.current=null,f(c)):wa(c,f,g)})}catch(b){g(b)}else f(c)}}var ka=!1;function Oa(c){if(!ka){ka=!0;var f=0;try{for(;f<c.length;f++){var g=c[f];do g=g(!0);while(g!==null)}c.length=0}catch(h){throw c=c.slice(f+1),h}finally{ka=!1}}}var Xp=Ii,Qp=Wp,eg=Gp,tg={map:Pr,forEach:gp,count:pp,toArray:mp,only:hp};$.Children=tg,$.Component=Qe,$.Fragment=n,$.Profiler=s,$.PureComponent=ha,$.StrictMode=a,$.Suspense=p,$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_e,$.act=Bi,$.cloneElement=Qp,$.createContext=yp,$.createElement=Xp,$.createFactory=eg,$.createRef=Qf,$.forwardRef=Tp,$.isValidElement=_t,$.lazy=bp,$.memo=Pp,$.startTransition=Jp,$.unstable_act=Bi,$.useCallback=Ip,$.useContext=Ep,$.useDebugValue=Rp,$.useDeferredValue=Dp,$.useEffect=kp,$.useId=Mp,$.useImperativeHandle=Ap,$.useInsertionEffect=Op,$.useLayoutEffect=Cp,$.useMemo=Zp,$.useReducer=Sp,$.useRef=wp,$.useState=xp,$.useSyncExternalStore=jp,$.useTransition=Bp,$.version=t,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()});var Et=Ia((nb,Ma)=>{"use strict";process.env.NODE_ENV==="production"?Ma.exports=Ji():Ma.exports=Yi()});var eb={};Zr(eb,{BRAND:()=>wl,Bot:()=>ia,BotDefinition:()=>sa,BotLogger:()=>Ye,BotSpecificClient:()=>Ze,DIRTY:()=>it,EMPTY_PATH:()=>bl,ErrorBoundary:()=>Zt,INVALID:()=>C,Integration:()=>aa,IntegrationDefinition:()=>ta,IntegrationLogger:()=>Je,IntegrationSpecificClient:()=>zt,InterfaceDefinition:()=>oa,NEVER:()=>_f,OK:()=>pe,ParseInputLazyPath:()=>Se,ParseStatus:()=>ye,Plugin:()=>ca,PluginDefinition:()=>ua,RuntimeError:()=>la.RuntimeError,Schema:()=>B,ZodAny:()=>ur,ZodArray:()=>Dt,ZodBigInt:()=>Nn,ZodBoolean:()=>$n,ZodBranded:()=>Un,ZodCatch:()=>Fn,ZodDate:()=>Ln,ZodDefault:()=>lr,ZodDiscriminatedUnion:()=>bs,ZodEffects:()=>We,ZodEnum:()=>yt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>hs,ZodFunction:()=>Ps,ZodIntersection:()=>zn,ZodIssueCode:()=>_,ZodLazy:()=>Kn,ZodLiteral:()=>Vn,ZodMap:()=>Es,ZodNaN:()=>xs,ZodNativeEnum:()=>qn,ZodNever:()=>qe,ZodNull:()=>Gn,ZodNullable:()=>ut,ZodNumber:()=>Wn,ZodObject:()=>ct,ZodOptional:()=>He,ZodParsedType:()=>x,ZodPipeline:()=>Jn,ZodPromise:()=>fr,ZodReadonly:()=>pr,ZodRecord:()=>Ss,ZodRef:()=>ws,ZodSchema:()=>B,ZodSet:()=>ks,ZodString:()=>ge,ZodSymbol:()=>Ms,ZodTransformer:()=>We,ZodTuple:()=>lt,ZodType:()=>B,ZodUndefined:()=>Yn,ZodUnion:()=>Xn,ZodUnknown:()=>It,ZodVoid:()=>js,ZuiForm:()=>T_,addIssueToContext:()=>E,agent:()=>xd,aimodel:()=>Cd,any:()=>$d,array:()=>zd,bigint:()=>Dd,boolean:()=>Ls,botIdHeader:()=>mr,botUserIdHeader:()=>Vs,coerce:()=>vf,configurationHeader:()=>hr,configurationTypeHeader:()=>Ws,conversation:()=>Td,createZodEnum:()=>dr,cuid2Regex:()=>Cs,cuidRegex:()=>Os,custom:()=>_s,datasource:()=>Id,date:()=>Md,datetimeRegex:()=>Ds,defaultComponentDefinitions:()=>P_,discriminatedUnion:()=>Gd,effect:()=>ss,emailRegex:()=>As,enum:()=>sf,errorUtil:()=>O,event:()=>Sd,fromJsonSchema:()=>hf,fromObject:()=>yf,function:()=>rf,getErrorMap:()=>Rt,getParsedType:()=>Me,instanceof:()=>Rd,integrationIdHeader:()=>qs,intent:()=>Od,intersection:()=>Wd,ipv4Regex:()=>Rs,ipv6Regex:()=>Bs,isAborted:()=>Yr,isApiError:()=>la.isApiError,isAsync:()=>or,isDirty:()=>Xr,isEmojiRegex:()=>Ll,isValid:()=>Bt,jsonSchemaToZui:()=>gr,knowledgebase:()=>Zd,late:()=>Ad,lazy:()=>nf,literal:()=>af,makeIssue:()=>ir,map:()=>ef,mergeObjectSchemas:()=>Ut,message:()=>Ed,messages:()=>Ks,nan:()=>Bd,nativeEnum:()=>of,never:()=>Fd,null:()=>Nd,nullable:()=>lf,number:()=>Fs,object:()=>Kd,objectToZui:()=>jt,objectUtil:()=>Wr,oboolean:()=>mf,onumber:()=>gf,operationHeader:()=>yr,optional:()=>cf,ostring:()=>pf,parseBody:()=>we,pipeline:()=>ff,preprocess:()=>df,processCreateParams:()=>A,promise:()=>uf,quotelessJson:()=>yl,readonly:()=>Qd,record:()=>Yd,ref:()=>Xd,serve:()=>vr,set:()=>tf,setErrorMap:()=>vs,strictObject:()=>Vd,string:()=>Us,symbol:()=>jd,table:()=>wd,tablerow:()=>kd,transformer:()=>ss,transforms:()=>E_,tuple:()=>Jd,typeHeader:()=>Js,ulidRegex:()=>Is,undefined:()=>Hd,union:()=>qd,unknown:()=>Ud,user:()=>Pd,util:()=>M,uuidRegex:()=>Zs,variable:()=>bd,void:()=>Ld,webhookIdHeader:()=>Gs,withErrorBoundary:()=>Ef,z:()=>S,zuiToJsonSchema:()=>Qn});module.exports=lg(eb);var Ks={};Zr(Ks,{defaults:()=>O_,markdown:()=>k_});var Zn=et(Et(),1),ne=et(Et(),1),Ne=et(Et(),1),Ht=et(Et(),1),be=et(Et(),1),is=Object.defineProperty,wg=Object.defineProperties,kg=Object.getOwnPropertyDescriptors,Vr=Object.getOwnPropertySymbols,Ro=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable,Xi=(t,e,r)=>e in t?is(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))Ro.call(e,r)&&Xi(t,r,e[r]);if(Vr)for(var r of Vr(e))Bo.call(e,r)&&Xi(t,r,e[r]);return t},m=(t,e)=>wg(t,kg(e)),u=(t,e)=>is(t,"name",{value:e,configurable:!0}),Do=(t,e)=>{var r={};for(var n in t)Ro.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&Vr)for(var n of Vr(t))e.indexOf(n)<0&&Bo.call(t,n)&&(r[n]=t[n]);return r},Mo=(t,e)=>{for(var r in e)is(t,r,{get:e[r],enumerable:!0})},S={};Mo(S,{BRAND:()=>wl,DIRTY:()=>it,EMPTY_PATH:()=>bl,INVALID:()=>C,NEVER:()=>_f,OK:()=>pe,ParseInputLazyPath:()=>Se,ParseStatus:()=>ye,Schema:()=>B,ZodAny:()=>ur,ZodArray:()=>Dt,ZodBigInt:()=>Nn,ZodBoolean:()=>$n,ZodBranded:()=>Un,ZodCatch:()=>Fn,ZodDate:()=>Ln,ZodDefault:()=>lr,ZodDiscriminatedUnion:()=>bs,ZodEffects:()=>We,ZodEnum:()=>yt,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>hs,ZodFunction:()=>Ps,ZodIntersection:()=>zn,ZodIssueCode:()=>_,ZodLazy:()=>Kn,ZodLiteral:()=>Vn,ZodMap:()=>Es,ZodNaN:()=>xs,ZodNativeEnum:()=>qn,ZodNever:()=>qe,ZodNull:()=>Gn,ZodNullable:()=>ut,ZodNumber:()=>Wn,ZodObject:()=>ct,ZodOptional:()=>He,ZodParsedType:()=>x,ZodPipeline:()=>Jn,ZodPromise:()=>fr,ZodReadonly:()=>pr,ZodRecord:()=>Ss,ZodRef:()=>ws,ZodSchema:()=>B,ZodSet:()=>ks,ZodString:()=>ge,ZodSymbol:()=>Ms,ZodTransformer:()=>We,ZodTuple:()=>lt,ZodType:()=>B,ZodUndefined:()=>Yn,ZodUnion:()=>Xn,ZodUnknown:()=>It,ZodVoid:()=>js,addIssueToContext:()=>E,agent:()=>xd,aimodel:()=>Cd,any:()=>$d,array:()=>zd,bigint:()=>Dd,boolean:()=>Ls,coerce:()=>vf,conversation:()=>Td,createZodEnum:()=>dr,cuid2Regex:()=>Cs,cuidRegex:()=>Os,custom:()=>_s,datasource:()=>Id,date:()=>Md,datetimeRegex:()=>Ds,default:()=>Yv,discriminatedUnion:()=>Gd,effect:()=>ss,emailRegex:()=>As,enum:()=>sf,errorUtil:()=>O,event:()=>Sd,fromJsonSchema:()=>hf,fromObject:()=>yf,function:()=>rf,getErrorMap:()=>Rt,getParsedType:()=>Me,instanceof:()=>Rd,intent:()=>Od,intersection:()=>Wd,ipv4Regex:()=>Rs,ipv6Regex:()=>Bs,isAborted:()=>Yr,isAsync:()=>or,isDirty:()=>Xr,isEmojiRegex:()=>Ll,isValid:()=>Bt,jsonSchemaToZui:()=>gr,knowledgebase:()=>Zd,late:()=>Ad,lazy:()=>nf,literal:()=>af,makeIssue:()=>ir,map:()=>ef,message:()=>Ed,nan:()=>Bd,nativeEnum:()=>of,never:()=>Fd,null:()=>Nd,nullable:()=>lf,number:()=>Fs,object:()=>Kd,objectToZui:()=>jt,objectUtil:()=>Wr,oboolean:()=>mf,onumber:()=>gf,optional:()=>cf,ostring:()=>pf,pipeline:()=>ff,preprocess:()=>df,processCreateParams:()=>A,promise:()=>uf,quotelessJson:()=>yl,readonly:()=>Qd,record:()=>Yd,ref:()=>Xd,set:()=>tf,setErrorMap:()=>vs,strictObject:()=>Vd,string:()=>Us,symbol:()=>jd,table:()=>wd,tablerow:()=>kd,transformer:()=>ss,tuple:()=>Jd,ulidRegex:()=>Is,undefined:()=>Hd,union:()=>qd,unknown:()=>Ud,user:()=>Pd,util:()=>M,uuidRegex:()=>Zs,variable:()=>bd,void:()=>Ld,zuiToJsonSchema:()=>Qn});var U="x-zui",jo=(0,ne.createContext)({formData:void 0,formSchema:void 0,setFormData:u(()=>{throw new Error("Must be within a FormDataProvider")},"setFormData"),setHiddenState:u(()=>{throw new Error("Must be within a FormDataProvider")},"setHiddenState"),setDisabledState:u(()=>{throw new Error("Must be within a FormDataProvider")},"setDisabledState"),hiddenState:{},disabledState:{},validation:{formValid:null,formErrors:null}}),Qi=u((t,e,r)=>{var n;let a=(n=e[U])==null?void 0:n[t];if(typeof a>"u")return!1;if(typeof a=="boolean")return a;if(typeof a=="string"){if(typeof window>"u")return console.warn("Function evaluation is not supported in server side rendering"),!1;let i=new Function("return "+a)()(r);switch(typeof i){case"object":case"boolean":return i;default:return!1}}return!1},"parseMaskableField"),Ho=u((t,e)=>{let r=(0,ne.useContext)(jo);if(r===void 0)throw new Error("useFormData must be used within a FormDataProvider");let n=(0,ne.useMemo)(()=>at(r.formData,e),[r.formData,e]),a=(0,ne.useMemo)(()=>{var P;return r.validation.formValid===null?{formValid:null,formErrors:null}:r.validation.formValid===!1?{formValid:!1,formErrors:((P=r.validation.formErrors)==null?void 0:P.filter(D=>Uo(D.path,e)).map(D=>({message:D.message,code:D.code,path:e})))||null}:{formValid:!0,formErrors:[]}},[r.validation.formValid,r.validation.formErrors,e]),s=r.dataTransform?r.dataTransform(n):n,i=(0,ne.useMemo)(()=>Qi("hidden",t,s),[t,s]),o=(0,ne.useMemo)(()=>Qi("disabled",t,s),[t,s]);(0,ne.useEffect)(()=>{r.setHiddenState(P=>xt(P,e,i||{})),r.setDisabledState(P=>xt(P,e,o||{}))},[JSON.stringify({fieldSchema:t,data:n})]);let{disabled:d,hidden:p}=(0,ne.useMemo)(()=>{let P=i===!0||at(r.hiddenState,e),D=o===!0||at(r.disabledState,e);return{hidden:P===!0,disabled:D===!0}},[r.hiddenState,r.disabledState,i,o,e]),y=(0,ne.useCallback)((P,D)=>{r.setFormData(z=>xt(z,P,D))},[r.setFormData]),T=(0,ne.useCallback)((P,D=void 0)=>{let z=Ct(t.items);r.setFormData(q=>{let se=at(q,P)||[];return D===void 0&&(D=z),xt(q,P,Array.isArray(se)?[...se,D]:[D])})},[r.setFormData]),k=(0,ne.useCallback)((P,D)=>{r.setFormData(z=>{let q=at(z,P)||[];return Array.isArray(q)?(q.splice(D,1),xt(z,P,q)):z})},[r.setFormData]);return l(m(l({},r),{data:n,disabled:d,hidden:p,handlePropertyChange:y,addArrayItem:T,removeArrayItem:k}),a)},"useFormData");function xt(t,e,r){if(e.length===0)return r;let n=e.length;return e.reduce((a,s,i)=>(i===n-1?a[s]=r:a[s]||(a[s]=isNaN(Number(s))?{}:[]),a[s]),t??{}),l({},t)}u(xt,"setObjectPath");var Ct=u((t,e)=>{var r,n,a,s;if(Array.isArray(t))return Ct(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((r=t.anyOf)!=null&&r.length)return Ct(t.anyOf[0]);if(t.type==="object"&&t.properties){let i={};return Object.entries(t.properties).map(([o,d])=>{var p;i[o]=Ct(d,!((p=t.required)!=null&&p.includes(o))||No(d)||!1)}),i}if(t.type==="array")return t.minItems&&t.minItems>0?[Ct(t.items)]:[];if(t.type==="string")return(n=t.enum)!=null&&n.length?t.enum[0]:"";if(t.type==="number")return(a=t.enum)!=null&&a.length?t.enum[0]:0;if(t.type==="boolean")return(s=t.enum)!=null&&s.length?t.enum[0]:!1}},"getDefaultValues"),Og=u(({children:t,setFormData:e,formData:r,formSchema:n,disableValidation:a,onValidation:s,dataTransform:i})=>{let[o,d]=(0,ne.useState)({}),[p,y]=(0,ne.useState)({}),T=i?i(r):r,k=(0,ne.useMemo)(()=>{if(a)return{formValid:null,formErrors:null};if(!n)return{formValid:null,formErrors:null};let P=gr(n).safeParse(T);return P.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:P.error.issues}},[JSON.stringify({transformedData:T})]);return(0,ne.useEffect)(()=>{s&&s(k)},[k]),ne.default.createElement(jo.Provider,{value:{formData:r,setFormData:e,formSchema:n,validation:k,hiddenState:o,setHiddenState:d,disabledState:p,setDisabledState:y,dataTransform:i}},t)},"FormDataProvider");function at(t,e){return e.reduce((r,n)=>r?r[n]:null,t)}u(at,"getPathData");function No(t){var e;return((e=t.anyOf)==null?void 0:e.some(r=>r.not&&Object.keys(r.not).length===0))||!1}u(No,"isOptional");function qr(t,e){let r=l({},t);for(let n in e)e.hasOwnProperty(n)&&(typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])?typeof r[n]=="object"&&r[n]!==null&&!Array.isArray(r[n])?r[n]=qr(r[n],e[n]):r[n]=qr({},e[n]):r[n]=e[n]);return r}u(qr,"deepMerge");var Cg=u((t,e)=>{let{handlePropertyChange:r,data:n}=Ho(t,e),{discriminator:a,value:s,discriminatedSchema:i}=(0,Zn.useMemo)(()=>{let o=$o(t.anyOf),d=o?.key?n?.[o.key]:t.default||null,p=Ig(o?.key||null,d,t.anyOf);return{discriminator:o,value:d,discriminatedSchema:p}},[t.anyOf,n]);return(0,Zn.useEffect)(()=>{a?.key&&a?.values.length&&Object.keys(n||{}).length<1&&!t.default&&r(e,{[a.key]:a.values[0]})},[]),{discriminator:a,discriminatorValue:s,discriminatedSchema:i}},"useDiscriminator"),$o=u(t=>{let e=t?.map(r=>r.type!=="object"||!r.properties?null:Object.entries(r.properties).map(([n,a])=>{var s;return a.type==="string"&&((s=a.enum)!=null&&s.length)?{key:n,value:a.enum[0]}:null}).filter(n=>!!n)).flat().reduce((r,n)=>{if(!n)return r;let{key:a,value:s}=n;return r.key===null&&(r.key=a),r.key===a&&r.values.push(s),r},{key:null,values:[]});return e?.key===null||!e?.values.length?null:e},"resolveDiscriminator"),Ig=u((t,e,r)=>{var n,a;if(!r?.length||!t||!e)return null;for(let s of r){if(s.type!=="object")continue;let i=(n=s.properties)==null?void 0:n[t];if(i?.type==="string"&&((a=i.enum)!=null&&a.length)&&i.enum[0]===e)return m(l({},s),{properties:m(l({},s.properties),{[t]:m(l({},i),{[U]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),Zg=u(t=>{var e;return(e=t.anyOf)!=null&&e.length?$o(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),Ag=u((t,e)=>{var r,n,a;let s=Zg(e),i=((r=e[U])==null?void 0:r.displayAs)||null;if(!i||!Array.isArray(i)||i.length<2){let y=(n=t?.[s])==null?void 0:n.default;return y?{Component:y,type:s,id:"default",params:{}}:null}let o=i[0],d=((a=t?.[s])==null?void 0:a[o])||null;if(!d)return console.warn(`Component ${s}.${o} not found`),null;let p=i[1]||{};return{Component:d,type:s,id:o,params:p}},"resolveComponent");function Uo(t,e){return t.length!==e.length?!1:t.every((r,n)=>r===e[n])}u(Uo,"pathMatches");function Ua(t,e){return e||(e=new RegExp("/s|-|_| ","g")),zo(t).split(e).map(Fo).map(Ko).reduce(Lo)}u(Ua,"formatTitle");function Fo(t){return t.charAt(0).toUpperCase()+t.substring(1)}u(Fo,"capitalize");function Lo(t,e){return`${t} ${e}`}u(Lo,"combine");function zo(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}u(zo,"decamelize");function Ko(t,e,r){let n=t.toLowerCase(),a=t.toUpperCase();for(let s of jg)if(s.toLowerCase()===n)return s;return Rg.includes(a)?a:e===0||e===r.length-1||t.length>=4?t:Mg.includes(n)||Dg.includes(n)||Bg.includes(n)?n:t}u(Ko,"handleSpecialWords");var Rg=["2D","3D","4WD","A2O","API","BIOS","CCTV","CC","CCV","CD","CD-ROM","COBOL","CIA","CMS","CSS","CSV","CV","DIY","DVD","DB","DNA","E3","EIN","ESPN","FAQ","FAQs","FTP","FPS","FORTRAN","FBI","HTML","HTTP","ID","IP","ISO","JS","JSON","LASER","M2A","M2M","M2MM","M2O","MMORPG","NAFTA","NASA","NDA","O2M","PDF","PHP","POP","RAM","RNGR","ROM","RPG","RTFM","RTS","SCUBA","SITCOM","SKU","SMTP","SQL","SSN","SWAT","TBS","TTL","TV","TNA","UI","URL","USB","UWP","VIP","W3C","WYSIWYG","WWW","WWE","WWF"],Bg=["a","an","the"],Dg=["and","that","but","or","as","if","when","than","because","while","where","after","so","though","since","until","whether","before","although","nor","like","once","unless","now","except"],Mg=["about","above","across","after","against","along","among","around","at","because of","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","despite","down","during","except","excepting","for","from","in","in front of","inside","in spite of","instead of","into","like","near","of","off","on","onto","out","outside","over","past","regarding","since","through","throughout","to","toward","under","underneath","until","up","upon","up to","with","within","without","with regard to","with respect to"],jg=["2FA","3D","4K","5K","8K","AGI","BI","ChatGPT","CTA","DateTime","GitHub","GPT","HD","IBMid","ID","IDs","iMac","IMAX","iOS","IP","iPad","iPhone","iPod","LDAP","LinkedIn","LLM","M2M","M2O","macOS","McDonalds","ML","MySQL","NLG","NLP","NLU","O2M","OpenAI","PDFs","PEFT","pH","PostgreSQL","SEO","TTS","UHD","UUID","XSS","YouTube"];function Vo(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:je(t)}u(Vo,"primitiveToTypscriptLiteralType");function je(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${je(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}u(je,"primitiveToTypescriptValue");function qo(t){return typeof t>"u"?"undefined":JSON.stringify(t)}u(qo,"unknownToTypescriptValue");var eo=u(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:je(t),"toPropertyKey"),Hg=u(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Go=u(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(Hg).filter(n=>!!n).join("")},"toTypeArgumentName"),Z=u(t=>{let e=(t??"").split(`
|
|
24
|
+
`).filter(r=>r.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
|
|
25
|
+
* ${e.join(`
|
|
26
|
+
* `)}
|
|
27
|
+
*/`},"getMultilineComment"),Wo={};Mo(Wo,{JsonSchemaToZuiError:()=>Xo,ObjectToZuiError:()=>Fa,UnrepresentableGenericError:()=>La,UnsupportedZuiToJsonSchemaError:()=>Ng,UnsupportedZuiToTypescriptSchemaError:()=>rt,UnsupportedZuiToTypescriptTypeError:()=>uu,UntitledDeclarationError:()=>lu,ZuiToJsonSchemaError:()=>tu,ZuiToTypescriptSchemaError:()=>au,ZuiToTypescriptTypeError:()=>An,ZuiTransformError:()=>Nt});var Jo=class extends Error{constructor(e,r){super(r),this.transform=e}};u(Jo,"ZuiTransformError");var Nt=Jo,Yo=class extends Nt{constructor(e){super("json-schema-to-zui",e)}};u(Yo,"JsonSchemaToZuiError");var Xo=Yo,Qo=class extends Nt{constructor(e){super("object-to-zui",e)}};u(Qo,"ObjectToZuiError");var Fa=Qo,eu=class extends Nt{constructor(e){super("zui-to-json-schema",e)}};u(eu,"ZuiToJsonSchemaError");var tu=eu,ru=class extends tu{constructor(e){super(`Zod type ${e} cannot be transformed to JSON Schema.`)}};u(ru,"UnsupportedZuiToJsonSchemaError");var Ng=ru,nu=class extends Nt{constructor(e){super("zui-to-typescript-schema",e)}};u(nu,"ZuiToTypescriptSchemaError");var au=nu,su=class extends au{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};u(su,"UnsupportedZuiToTypescriptSchemaError");var rt=su,iu=class extends Nt{constructor(e){super("zui-to-typescript-type",e)}};u(iu,"ZuiToTypescriptTypeError");var An=iu,ou=class extends An{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};u(ou,"UnsupportedZuiToTypescriptTypeError");var uu=ou,cu=class extends An{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};u(cu,"UntitledDeclarationError");var lu=cu,du=class extends An{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};u(du,"UnrepresentableGenericError");var La=du,fu=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],$g=u(t=>fu.includes(t),"isPrimitive"),Ug=u(t=>fu.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),to=u(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),pu=class{constructor(e,r,n=!1){this.key=e,this.value=r,this.optional=n}};u(pu,"KeyValue");var Mr=pu,gu=class{constructor(e){this.schema=e}};u(gu,"FnParameters");var ro=gu,mu=class{constructor(e){this.schema=e}};u(mu,"FnReturn");var no=mu,hu=class{constructor(e){this.props=e}};u(hu,"Declaration");var Hr=hu;function Gr(t,e={}){let r=zg(t,e),n=L(r,{});return e.formatter&&(n=e.formatter(n)),n}u(Gr,"toTypescript");function L(t,e){var r,n,a;let s=m(l({},e),{parent:t});if(t===null)return"";if(t instanceof Hr)return Fg(t,s);if(t instanceof Mr){if(t.value instanceof v.ZodOptional){let P=t.value._def.innerType;return P instanceof v.Schema&&!P.description&&t.value.description&&(P=P?.describe(t.value.description)),L(new Mr(t.key,P,!0),s)}let d=Z(t.value._def.description),p=d?.trim().length>0?`
|
|
28
|
+
`:"",y=t.value.describe(""),k=t.optional||t.value.isOptional()?"?":"";return`${p}${d}${p}${t.key}${k}: ${L(y,s)}${p}`}if(t instanceof ro){if(t.schema instanceof v.ZodTuple){let y="";for(let T=0;T<t.schema.items.length;T++){let k=(a=(n=(r=t.schema.items[T])==null?void 0:r.ui)==null?void 0:n.title)!=null?a:`arg${T}`,P=t.schema.items[T];y+=`${L(new Mr(eo(k),P),s)}${T<t.schema.items.length-1?", ":""} `}return y}let d=L(t.schema,s);return d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]")||d.startsWith("(")&&d.endsWith(")")||d.startsWith("Array<")&&d.endsWith(">")||d.startsWith("Record<")&&d.endsWith(">")||Ug(d)?`args: ${d}`:d}if(t instanceof no)return t.schema instanceof v.ZodOptional?`${L(t.schema.unwrap(),s)} | undefined`:L(t.schema,s);let o=t._def;switch(o.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(o.description)} string`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:case v.ZodFirstPartyTypeKind.ZodNaN:case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(o.description)} number`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)} boolean`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(o.description)} Date`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(o.description)} undefined`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(o.description)} null`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(o.description)} any`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(o.description)} unknown`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(o.description)} never`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(o.description)} void`.trim();case v.ZodFirstPartyTypeKind.ZodArray:let d=L(o.type,s);return $g(d)?`${d}[]`:`Array<${d}>`;case v.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(o.shape()).map(([H,W])=>L(new Mr(eo(H),W),s)).join("; ")} }`;case v.ZodFirstPartyTypeKind.ZodUnion:let y=o.options.map(H=>L(H,s));return`${Z(o.description)}
|
|
29
|
+
${y.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let T=o.options.map(H=>L(H,s));return`${Z(t._def.description)}
|
|
30
|
+
${T.join(" | ")}`;case v.ZodFirstPartyTypeKind.ZodIntersection:return`${L(o.left,s)} & ${L(o.right,s)}`;case v.ZodFirstPartyTypeKind.ZodTuple:return o.items.length===0?"":`[${o.items.map(H=>L(H,s)).join(", ")}]`;case v.ZodFirstPartyTypeKind.ZodRecord:let P=L(o.keyType,s),D=L(o.valueType,s);return`${Z(o.description)} { [key: ${P}]: ${D} }`;case v.ZodFirstPartyTypeKind.ZodMap:return`Map<${L(o.keyType,s)}, ${L(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodSet:return`Set<${L(o.valueType,s)}>`;case v.ZodFirstPartyTypeKind.ZodFunction:let z=L(new ro(o.args),s),q=L(new no(o.returns),s);return`${Z(o.description)}
|
|
31
|
+
(${z}) => ${q}`;case v.ZodFirstPartyTypeKind.ZodLazy:return L(o.getter(),s);case v.ZodFirstPartyTypeKind.ZodLiteral:let se=Vo(o.value);return`${Z(o.description)}
|
|
32
|
+
${se}`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(je).join(" | ");case v.ZodFirstPartyTypeKind.ZodEffects:return L(o.schema,s);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new uu(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${L(o.innerType,s)} | undefined`;case v.ZodFirstPartyTypeKind.ZodNullable:return`${L(o.innerType,s)} | null`;case v.ZodFirstPartyTypeKind.ZodDefault:return L(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodCatch:return L(o.innerType,s);case v.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${L(o.type,s)}>`;case v.ZodFirstPartyTypeKind.ZodBranded:return L(o.type,s);case v.ZodFirstPartyTypeKind.ZodPipeline:return L(o.in,s);case v.ZodFirstPartyTypeKind.ZodSymbol:return`${Z(o.description)} symbol`.trim();case v.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${L(o.innerType,s)}>`;case v.ZodFirstPartyTypeKind.ZodRef:return Go(o.uri);default:M.assertNever(o)}}u(L,"sUnwrapZod");var Fg=u((t,e)=>{if(t.props.type==="none")return L(t.props.schema,e);let r=Z(t.props.schema.description),n=t.props.schema.describe(""),a=L(n,e);if(t.props.type==="variable")return to(`${r}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(Go).join(", ")}>`:"";return to(`${r}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Lg=u(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),zg=u((t,e)=>{let r=Lg(e),n=t.getReferences();if(r==="none"){if(n.length>0)throw new La;return new Hr({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new lu;if(r==="variable"){if(n.length>0)throw new La;return new Hr({type:"variable",identifier:a,schema:t})}return new Hr({type:"type",identifier:a,schema:t,args:n})},"getDeclarationProps"),Kg=typeof global=="object"&&global&&global.Object===Object&&global,yu=Kg,Vg=typeof self=="object"&&self&&self.Object===Object&&self,qg=yu||Vg||Function("return this")(),Ue=qg,Gg=Ue.Symbol,Ve=Gg,vu=Object.prototype,Wg=vu.hasOwnProperty,Jg=vu.toString,Jt=Ve?Ve.toStringTag:void 0;function _u(t){var e=Wg.call(t,Jt),r=t[Jt];try{t[Jt]=void 0;var n=!0}catch{}var a=Jg.call(t);return n&&(e?t[Jt]=r:delete t[Jt]),a}u(_u,"getRawTag");var Yg=_u,Xg=Object.prototype,Qg=Xg.toString;function bu(t){return Qg.call(t)}u(bu,"objectToString");var em=bu,tm="[object Null]",rm="[object Undefined]",ao=Ve?Ve.toStringTag:void 0;function Tu(t){return t==null?t===void 0?rm:tm:ao&&ao in Object(t)?Yg(t):em(t)}u(Tu,"baseGetTag");var $t=Tu;function Pu(t){return t!=null&&typeof t=="object"}u(Pu,"isObjectLike");var At=Pu,nm="[object Symbol]";function Eu(t){return typeof t=="symbol"||At(t)&&$t(t)==nm}u(Eu,"isSymbol");var os=Eu;function xu(t,e){for(var r=-1,n=t==null?0:t.length,a=Array(n);++r<n;)a[r]=e(t[r],r,t);return a}u(xu,"arrayMap");var am=xu,sm=Array.isArray,$e=sm,im=1/0,so=Ve?Ve.prototype:void 0,io=so?so.toString:void 0;function us(t){if(typeof t=="string")return t;if($e(t))return am(t,us)+"";if(os(t))return io?io.call(t):"";var e=t+"";return e=="0"&&1/t==-im?"-0":e}u(us,"baseToString");var om=us;function Su(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}u(Su,"isObject");var cs=Su;function wu(t){return t}u(wu,"identity");var um=wu,cm="[object AsyncFunction]",lm="[object Function]",dm="[object GeneratorFunction]",fm="[object Proxy]";function ku(t){if(!cs(t))return!1;var e=$t(t);return e==lm||e==dm||e==cm||e==fm}u(ku,"isFunction");var Ou=ku,pm=Ue["__core-js_shared__"],ja=pm,oo=function(){var t=/[^.]+$/.exec(ja&&ja.keys&&ja.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Cu(t){return!!oo&&oo in t}u(Cu,"isMasked");var gm=Cu,mm=Function.prototype,hm=mm.toString;function Iu(t){if(t!=null){try{return hm.call(t)}catch{}try{return t+""}catch{}}return""}u(Iu,"toSource");var dt=Iu,ym=/[\\^$.*+?()[\]{}|]/g,vm=/^\[object .+?Constructor\]$/,_m=Function.prototype,bm=Object.prototype,Tm=_m.toString,Pm=bm.hasOwnProperty,Em=RegExp("^"+Tm.call(Pm).replace(ym,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Zu(t){if(!cs(t)||gm(t))return!1;var e=Ou(t)?Em:vm;return e.test(dt(t))}u(Zu,"baseIsNative");var xm=Zu;function Au(t,e){return t?.[e]}u(Au,"getValue");var Sm=Au;function Ru(t,e){var r=Sm(t,e);return xm(r)?r:void 0}u(Ru,"getNative");var ft=Ru,wm=ft(Ue,"WeakMap"),za=wm,km=function(){try{var t=ft(Object,"defineProperty");return t({},"",{}),t}catch{}}(),uo=km,Om=9007199254740991,Cm=/^(?:0|[1-9]\d*)$/;function Bu(t,e){var r=typeof t;return e=e??Om,!!e&&(r=="number"||r!="symbol"&&Cm.test(t))&&t>-1&&t%1==0&&t<e}u(Bu,"isIndex");var Du=Bu;function Mu(t,e,r){e=="__proto__"&&uo?uo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}u(Mu,"baseAssignValue");var Im=Mu;function ju(t,e){return t===e||t!==t&&e!==e}u(ju,"eq");var Hu=ju,Zm=9007199254740991;function Nu(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Zm}u(Nu,"isLength");var ls=Nu;function $u(t){return t!=null&&ls(t.length)&&!Ou(t)}u($u,"isArrayLike");var Am=$u,Rm=Object.prototype;function Uu(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Rm;return t===r}u(Uu,"isPrototype");var Bm=Uu;function Fu(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}u(Fu,"baseTimes");var Dm=Fu,Mm="[object Arguments]";function Lu(t){return At(t)&&$t(t)==Mm}u(Lu,"baseIsArguments");var co=Lu,zu=Object.prototype,jm=zu.hasOwnProperty,Hm=zu.propertyIsEnumerable,Nm=co(function(){return arguments}())?co:function(t){return At(t)&&jm.call(t,"callee")&&!Hm.call(t,"callee")},Ku=Nm;function Vu(){return!1}u(Vu,"stubFalse");var $m=Vu,qu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lo=qu&&typeof module=="object"&&module&&!module.nodeType&&module,Um=lo&&lo.exports===qu,fo=Um?Ue.Buffer:void 0,Fm=fo?fo.isBuffer:void 0,Lm=Fm||$m,Ka=Lm,zm="[object Arguments]",Km="[object Array]",Vm="[object Boolean]",qm="[object Date]",Gm="[object Error]",Wm="[object Function]",Jm="[object Map]",Ym="[object Number]",Xm="[object Object]",Qm="[object RegExp]",eh="[object Set]",th="[object String]",rh="[object WeakMap]",nh="[object ArrayBuffer]",ah="[object DataView]",sh="[object Float32Array]",ih="[object Float64Array]",oh="[object Int8Array]",uh="[object Int16Array]",ch="[object Int32Array]",lh="[object Uint8Array]",dh="[object Uint8ClampedArray]",fh="[object Uint16Array]",ph="[object Uint32Array]",X={};X[sh]=X[ih]=X[oh]=X[uh]=X[ch]=X[lh]=X[dh]=X[fh]=X[ph]=!0;X[zm]=X[Km]=X[nh]=X[Vm]=X[ah]=X[qm]=X[Gm]=X[Wm]=X[Jm]=X[Ym]=X[Xm]=X[Qm]=X[eh]=X[th]=X[rh]=!1;function Gu(t){return At(t)&&ls(t.length)&&!!X[$t(t)]}u(Gu,"baseIsTypedArray");var gh=Gu;function Wu(t){return function(e){return t(e)}}u(Wu,"baseUnary");var mh=Wu,Ju=typeof exports=="object"&&exports&&!exports.nodeType&&exports,rr=Ju&&typeof module=="object"&&module&&!module.nodeType&&module,hh=rr&&rr.exports===Ju,Ha=hh&&yu.process,yh=function(){try{var t=rr&&rr.require&&rr.require("util").types;return t||Ha&&Ha.binding&&Ha.binding("util")}catch{}}(),po=yh,go=po&&po.isTypedArray,vh=go?mh(go):gh,Yu=vh,_h=Object.prototype,bh=_h.hasOwnProperty;function Xu(t,e){var r=$e(t),n=!r&&Ku(t),a=!r&&!n&&Ka(t),s=!r&&!n&&!a&&Yu(t),i=r||n||a||s,o=i?Dm(t.length,String):[],d=o.length;for(var p in t)(e||bh.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Du(p,d)))&&o.push(p);return o}u(Xu,"arrayLikeKeys");var Th=Xu;function Qu(t,e){return function(r){return t(e(r))}}u(Qu,"overArg");var Ph=Qu,Eh=Ph(Object.keys,Object),xh=Eh,Sh=Object.prototype,wh=Sh.hasOwnProperty;function ec(t){if(!Bm(t))return xh(t);var e=[];for(var r in Object(t))wh.call(t,r)&&r!="constructor"&&e.push(r);return e}u(ec,"baseKeys");var kh=ec;function tc(t){return Am(t)?Th(t):kh(t)}u(tc,"keys");var ds=tc,Oh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ch=/^\w*$/;function rc(t,e){if($e(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||os(t)?!0:Ch.test(t)||!Oh.test(t)||e!=null&&t in Object(e)}u(rc,"isKey");var fs=rc,Ih=ft(Object,"create"),nr=Ih;function nc(){this.__data__=nr?nr(null):{},this.size=0}u(nc,"hashClear");var Zh=nc;function ac(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}u(ac,"hashDelete");var Ah=ac,Rh="__lodash_hash_undefined__",Bh=Object.prototype,Dh=Bh.hasOwnProperty;function sc(t){var e=this.__data__;if(nr){var r=e[t];return r===Rh?void 0:r}return Dh.call(e,t)?e[t]:void 0}u(sc,"hashGet");var Mh=sc,jh=Object.prototype,Hh=jh.hasOwnProperty;function ic(t){var e=this.__data__;return nr?e[t]!==void 0:Hh.call(e,t)}u(ic,"hashHas");var Nh=ic,$h="__lodash_hash_undefined__";function oc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=nr&&e===void 0?$h:e,this}u(oc,"hashSet");var Uh=oc;function pt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u(pt,"Hash");pt.prototype.clear=Zh;pt.prototype.delete=Ah;pt.prototype.get=Mh;pt.prototype.has=Nh;pt.prototype.set=Uh;var mo=pt;function uc(){this.__data__=[],this.size=0}u(uc,"listCacheClear");var Fh=uc;function cc(t,e){for(var r=t.length;r--;)if(Hu(t[r][0],e))return r;return-1}u(cc,"assocIndexOf");var Rn=cc,Lh=Array.prototype,zh=Lh.splice;function lc(t){var e=this.__data__,r=Rn(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():zh.call(e,r,1),--this.size,!0}u(lc,"listCacheDelete");var Kh=lc;function dc(t){var e=this.__data__,r=Rn(e,t);return r<0?void 0:e[r][1]}u(dc,"listCacheGet");var Vh=dc;function fc(t){return Rn(this.__data__,t)>-1}u(fc,"listCacheHas");var qh=fc;function pc(t,e){var r=this.__data__,n=Rn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}u(pc,"listCacheSet");var Gh=pc;function gt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u(gt,"ListCache");gt.prototype.clear=Fh;gt.prototype.delete=Kh;gt.prototype.get=Vh;gt.prototype.has=qh;gt.prototype.set=Gh;var Bn=gt,Wh=ft(Ue,"Map"),ar=Wh;function gc(){this.size=0,this.__data__={hash:new mo,map:new(ar||Bn),string:new mo}}u(gc,"mapCacheClear");var Jh=gc;function mc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}u(mc,"isKeyable");var Yh=mc;function hc(t,e){var r=t.__data__;return Yh(e)?r[typeof e=="string"?"string":"hash"]:r.map}u(hc,"getMapData");var Dn=hc;function yc(t){var e=Dn(this,t).delete(t);return this.size-=e?1:0,e}u(yc,"mapCacheDelete");var Xh=yc;function vc(t){return Dn(this,t).get(t)}u(vc,"mapCacheGet");var Qh=vc;function _c(t){return Dn(this,t).has(t)}u(_c,"mapCacheHas");var ey=_c;function bc(t,e){var r=Dn(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}u(bc,"mapCacheSet");var ty=bc;function mt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u(mt,"MapCache");mt.prototype.clear=Jh;mt.prototype.delete=Xh;mt.prototype.get=Qh;mt.prototype.has=ey;mt.prototype.set=ty;var Mn=mt,ry="Expected a function";function jn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ry);var r=u(function(){var n=arguments,a=e?e.apply(this,n):n[0],s=r.cache;if(s.has(a))return s.get(a);var i=t.apply(this,n);return r.cache=s.set(a,i)||s,i},"memoized");return r.cache=new(jn.Cache||Mn),r}u(jn,"memoize");jn.Cache=Mn;var ny=jn,ay=500;function Tc(t){var e=ny(t,function(n){return r.size===ay&&r.clear(),n}),r=e.cache;return e}u(Tc,"memoizeCapped");var sy=Tc,iy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oy=/\\(\\)?/g,uy=sy(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(iy,function(r,n,a,s){e.push(a?s.replace(oy,"$1"):n||r)}),e}),cy=uy;function Pc(t){return t==null?"":om(t)}u(Pc,"toString");var ly=Pc;function Ec(t,e){return $e(t)?t:fs(t,e)?[t]:cy(ly(t))}u(Ec,"castPath");var xc=Ec,dy=1/0;function Sc(t){if(typeof t=="string"||os(t))return t;var e=t+"";return e=="0"&&1/t==-dy?"-0":e}u(Sc,"toKey");var Hn=Sc;function wc(t,e){e=xc(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Hn(e[r++])];return r&&r==n?t:void 0}u(wc,"baseGet");var kc=wc;function Oc(t,e,r){var n=t==null?void 0:kc(t,e);return n===void 0?r:n}u(Oc,"get");var fy=Oc;function Cc(t,e){for(var r=-1,n=e.length,a=t.length;++r<n;)t[a+r]=e[r];return t}u(Cc,"arrayPush");var py=Cc;function Ic(){this.__data__=new Bn,this.size=0}u(Ic,"stackClear");var gy=Ic;function Zc(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}u(Zc,"stackDelete");var my=Zc;function Ac(t){return this.__data__.get(t)}u(Ac,"stackGet");var hy=Ac;function Rc(t){return this.__data__.has(t)}u(Rc,"stackHas");var yy=Rc,vy=200;function Bc(t,e){var r=this.__data__;if(r instanceof Bn){var n=r.__data__;if(!ar||n.length<vy-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Mn(n)}return r.set(t,e),this.size=r.size,this}u(Bc,"stackSet");var _y=Bc;function ht(t){var e=this.__data__=new Bn(t);this.size=e.size}u(ht,"Stack");ht.prototype.clear=gy;ht.prototype.delete=my;ht.prototype.get=hy;ht.prototype.has=yy;ht.prototype.set=_y;var Nr=ht;function Dc(t,e){for(var r=-1,n=t==null?0:t.length,a=0,s=[];++r<n;){var i=t[r];e(i,r,t)&&(s[a++]=i)}return s}u(Dc,"arrayFilter");var by=Dc;function Mc(){return[]}u(Mc,"stubArray");var Ty=Mc,Py=Object.prototype,Ey=Py.propertyIsEnumerable,ho=Object.getOwnPropertySymbols,xy=ho?function(t){return t==null?[]:(t=Object(t),by(ho(t),function(e){return Ey.call(t,e)}))}:Ty,Sy=xy;function jc(t,e,r){var n=e(t);return $e(t)?n:py(n,r(t))}u(jc,"baseGetAllKeys");var wy=jc;function Hc(t){return wy(t,ds,Sy)}u(Hc,"getAllKeys");var yo=Hc,ky=ft(Ue,"DataView"),Va=ky,Oy=ft(Ue,"Promise"),qa=Oy,Cy=ft(Ue,"Set"),Ga=Cy,vo="[object Map]",Iy="[object Object]",_o="[object Promise]",bo="[object Set]",To="[object WeakMap]",Po="[object DataView]",Zy=dt(Va),Ay=dt(ar),Ry=dt(qa),By=dt(Ga),Dy=dt(za),nt=$t;(Va&&nt(new Va(new ArrayBuffer(1)))!=Po||ar&&nt(new ar)!=vo||qa&&nt(qa.resolve())!=_o||Ga&&nt(new Ga)!=bo||za&&nt(new za)!=To)&&(nt=u(function(t){var e=$t(t),r=e==Iy?t.constructor:void 0,n=r?dt(r):"";if(n)switch(n){case Zy:return Po;case Ay:return vo;case Ry:return _o;case By:return bo;case Dy:return To}return e},"getTag"));var Eo=nt,My=Ue.Uint8Array,xo=My,jy="__lodash_hash_undefined__";function Nc(t){return this.__data__.set(t,jy),this}u(Nc,"setCacheAdd");var Hy=Nc;function $c(t){return this.__data__.has(t)}u($c,"setCacheHas");var Ny=$c;function sr(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Mn;++e<r;)this.add(t[e])}u(sr,"SetCache");sr.prototype.add=sr.prototype.push=Hy;sr.prototype.has=Ny;var $y=sr;function Uc(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}u(Uc,"arraySome");var Uy=Uc;function Fc(t,e){return t.has(e)}u(Fc,"cacheHas");var Fy=Fc,Ly=1,zy=2;function Lc(t,e,r,n,a,s){var i=r&Ly,o=t.length,d=e.length;if(o!=d&&!(i&&d>o))return!1;var p=s.get(t),y=s.get(e);if(p&&y)return p==e&&y==t;var T=-1,k=!0,P=r&zy?new $y:void 0;for(s.set(t,e),s.set(e,t);++T<o;){var D=t[T],z=e[T];if(n)var q=i?n(z,D,T,e,t,s):n(D,z,T,t,e,s);if(q!==void 0){if(q)continue;k=!1;break}if(P){if(!Uy(e,function(se,V){if(!Fy(P,V)&&(D===se||a(D,se,r,n,s)))return P.push(V)})){k=!1;break}}else if(!(D===z||a(D,z,r,n,s))){k=!1;break}}return s.delete(t),s.delete(e),k}u(Lc,"equalArrays");var zc=Lc;function Kc(t){var e=-1,r=Array(t.size);return t.forEach(function(n,a){r[++e]=[a,n]}),r}u(Kc,"mapToArray");var Ky=Kc;function Vc(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}u(Vc,"setToArray");var Vy=Vc,qy=1,Gy=2,Wy="[object Boolean]",Jy="[object Date]",Yy="[object Error]",Xy="[object Map]",Qy="[object Number]",ev="[object RegExp]",tv="[object Set]",rv="[object String]",nv="[object Symbol]",av="[object ArrayBuffer]",sv="[object DataView]",So=Ve?Ve.prototype:void 0,Na=So?So.valueOf:void 0;function qc(t,e,r,n,a,s,i){switch(r){case sv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case av:return!(t.byteLength!=e.byteLength||!s(new xo(t),new xo(e)));case Wy:case Jy:case Qy:return Hu(+t,+e);case Yy:return t.name==e.name&&t.message==e.message;case ev:case rv:return t==e+"";case Xy:var o=Ky;case tv:var d=n&qy;if(o||(o=Vy),t.size!=e.size&&!d)return!1;var p=i.get(t);if(p)return p==e;n|=Gy,i.set(t,e);var y=zc(o(t),o(e),n,a,s,i);return i.delete(t),y;case nv:if(Na)return Na.call(t)==Na.call(e)}return!1}u(qc,"equalByTag");var iv=qc,ov=1,uv=Object.prototype,cv=uv.hasOwnProperty;function Gc(t,e,r,n,a,s){var i=r&ov,o=yo(t),d=o.length,p=yo(e),y=p.length;if(d!=y&&!i)return!1;for(var T=d;T--;){var k=o[T];if(!(i?k in e:cv.call(e,k)))return!1}var P=s.get(t),D=s.get(e);if(P&&D)return P==e&&D==t;var z=!0;s.set(t,e),s.set(e,t);for(var q=i;++T<d;){k=o[T];var se=t[k],V=e[k];if(n)var H=i?n(V,se,k,e,t,s):n(se,V,k,t,e,s);if(!(H===void 0?se===V||a(se,V,r,n,s):H)){z=!1;break}q||(q=k=="constructor")}if(z&&!q){var W=t.constructor,ce=e.constructor;W!=ce&&"constructor"in t&&"constructor"in e&&!(typeof W=="function"&&W instanceof W&&typeof ce=="function"&&ce instanceof ce)&&(z=!1)}return s.delete(t),s.delete(e),z}u(Gc,"equalObjects");var lv=Gc,dv=1,wo="[object Arguments]",ko="[object Array]",jr="[object Object]",fv=Object.prototype,Oo=fv.hasOwnProperty;function Wc(t,e,r,n,a,s){var i=$e(t),o=$e(e),d=i?ko:Eo(t),p=o?ko:Eo(e);d=d==wo?jr:d,p=p==wo?jr:p;var y=d==jr,T=p==jr,k=d==p;if(k&&Ka(t)){if(!Ka(e))return!1;i=!0,y=!1}if(k&&!y)return s||(s=new Nr),i||Yu(t)?zc(t,e,r,n,a,s):iv(t,e,d,r,n,a,s);if(!(r&dv)){var P=y&&Oo.call(t,"__wrapped__"),D=T&&Oo.call(e,"__wrapped__");if(P||D){var z=P?t.value():t,q=D?e.value():e;return s||(s=new Nr),a(z,q,r,n,s)}}return k?(s||(s=new Nr),lv(t,e,r,n,a,s)):!1}u(Wc,"baseIsEqualDeep");var pv=Wc;function ps(t,e,r,n,a){return t===e?!0:t==null||e==null||!At(t)&&!At(e)?t!==t&&e!==e:pv(t,e,r,n,ps,a)}u(ps,"baseIsEqual");var gs=ps,gv=1,mv=2;function Jc(t,e,r,n){var a=r.length,s=a,i=!n;if(t==null)return!s;for(t=Object(t);a--;){var o=r[a];if(i&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++a<s;){o=r[a];var d=o[0],p=t[d],y=o[1];if(i&&o[2]){if(p===void 0&&!(d in t))return!1}else{var T=new Nr;if(n)var k=n(p,y,d,t,e,T);if(!(k===void 0?gs(y,p,gv|mv,n,T):k))return!1}}return!0}u(Jc,"baseIsMatch");var hv=Jc;function Yc(t){return t===t&&!cs(t)}u(Yc,"isStrictComparable");var Xc=Yc;function Qc(t){for(var e=ds(t),r=e.length;r--;){var n=e[r],a=t[n];e[r]=[n,a,Xc(a)]}return e}u(Qc,"getMatchData");var yv=Qc;function el(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}u(el,"matchesStrictComparable");var tl=el;function rl(t){var e=yv(t);return e.length==1&&e[0][2]?tl(e[0][0],e[0][1]):function(r){return r===t||hv(r,t,e)}}u(rl,"baseMatches");var vv=rl;function nl(t,e){return t!=null&&e in Object(t)}u(nl,"baseHasIn");var _v=nl;function al(t,e,r){e=xc(e,t);for(var n=-1,a=e.length,s=!1;++n<a;){var i=Hn(e[n]);if(!(s=t!=null&&r(t,i)))break;t=t[i]}return s||++n!=a?s:(a=t==null?0:t.length,!!a&&ls(a)&&Du(i,a)&&($e(t)||Ku(t)))}u(al,"hasPath");var bv=al;function sl(t,e){return t!=null&&bv(t,e,_v)}u(sl,"hasIn");var Tv=sl,Pv=1,Ev=2;function il(t,e){return fs(t)&&Xc(e)?tl(Hn(t),e):function(r){var n=fy(r,t);return n===void 0&&n===e?Tv(r,t):gs(e,n,Pv|Ev)}}u(il,"baseMatchesProperty");var xv=il;function ol(t){return function(e){return e?.[t]}}u(ol,"baseProperty");var Sv=ol;function ul(t){return function(e){return kc(e,t)}}u(ul,"basePropertyDeep");var wv=ul;function cl(t){return fs(t)?Sv(Hn(t)):wv(t)}u(cl,"property");var kv=cl;function ll(t){return typeof t=="function"?t:t==null?um:typeof t=="object"?$e(t)?xv(t[0],t[1]):vv(t):kv(t)}u(ll,"baseIteratee");var Ov=ll;function dl(t){return function(e,r,n){for(var a=-1,s=Object(e),i=n(e),o=i.length;o--;){var d=i[t?o:++a];if(r(s[d],d,s)===!1)break}return e}}u(dl,"createBaseFor");var Cv=dl,Iv=Cv(),Zv=Iv;function fl(t,e){return t&&Zv(t,e,ds)}u(fl,"baseForOwn");var Av=fl;function pl(t,e){return gs(t,e)}u(pl,"isEqual");var ot=pl;function gl(t,e){var r={};return e=Ov(e,3),Av(t,function(n,a,s){Im(r,a,e(n,a,s))}),r}u(gl,"mapValues");var Rv=gl;function ms(t){return ae(t)}u(ms,"toTypescriptSchema");function ae(t){let r=t._def;switch(r.typeName){case v.ZodFirstPartyTypeKind.ZodString:return`${Z(r.description)}z.string()`.trim();case v.ZodFirstPartyTypeKind.ZodNumber:return`${Z(r.description)}z.number()`.trim();case v.ZodFirstPartyTypeKind.ZodNaN:return`${Z(r.description)}z.nan()`.trim();case v.ZodFirstPartyTypeKind.ZodBigInt:return`${Z(r.description)}z.bigint()`.trim();case v.ZodFirstPartyTypeKind.ZodBoolean:return`${Z(t._def.description)}z.boolean()`.trim();case v.ZodFirstPartyTypeKind.ZodDate:return`${Z(r.description)}z.date()`.trim();case v.ZodFirstPartyTypeKind.ZodUndefined:return`${Z(r.description)}z.undefined()`.trim();case v.ZodFirstPartyTypeKind.ZodNull:return`${Z(r.description)}z.null()`.trim();case v.ZodFirstPartyTypeKind.ZodAny:return`${Z(r.description)}z.any()`.trim();case v.ZodFirstPartyTypeKind.ZodUnknown:return`${Z(r.description)}z.unknown()`.trim();case v.ZodFirstPartyTypeKind.ZodNever:return`${Z(r.description)}z.never()`.trim();case v.ZodFirstPartyTypeKind.ZodVoid:return`${Z(r.description)}z.void()`.trim();case v.ZodFirstPartyTypeKind.ZodArray:return`z.array(${ae(r.type)})`;case v.ZodFirstPartyTypeKind.ZodObject:let n=Rv(r.shape(),ce=>ce instanceof v.Schema?ae(ce):"z.any()");return[`${Z(r.description)}z.object({`,...Object.entries(n).map(([ce,Le])=>` ${ce}: ${Le},`),"})"].join(`
|
|
33
|
+
`).trim();case v.ZodFirstPartyTypeKind.ZodUnion:let a=r.options.map(ae);return`${Z(r.description)}z.union([${a.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=r.options.map(ae),i=je(r.discriminator);return`${Z(r.description)}z.discriminatedUnion(${i}, [${s.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodIntersection:let o=ae(r.left),d=ae(r.right);return`${Z(r.description)}z.intersection(${o}, ${d})`.trim();case v.ZodFirstPartyTypeKind.ZodTuple:let p=r.items.map(ae);return`${Z(r.description)}z.tuple([${p.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodRecord:let y=ae(r.keyType),T=ae(r.valueType);return`${Z(r.description)}z.record(${y}, ${T})`.trim();case v.ZodFirstPartyTypeKind.ZodMap:let k=ae(r.keyType),P=ae(r.valueType);return`${Z(r.description)}z.map(${k}, ${P})`.trim();case v.ZodFirstPartyTypeKind.ZodSet:return`${Z(r.description)}z.set(${ae(r.valueType)})`.trim();case v.ZodFirstPartyTypeKind.ZodFunction:let D=r.args.items.map(ae),z=D.length?`.args(${D.join(", ")})`:"",q=ae(r.returns);return`${Z(r.description)}z.function()${z}.returns(${q})`.trim();case v.ZodFirstPartyTypeKind.ZodLazy:return`${Z(r.description)}z.lazy(() => ${ae(r.getter())})`.trim();case v.ZodFirstPartyTypeKind.ZodLiteral:let se=je(r.value);return`${Z(r.description)}z.literal(${se})`.trim();case v.ZodFirstPartyTypeKind.ZodEnum:let V=r.values.map(je);return`${Z(r.description)}z.enum([${V.join(", ")}])`.trim();case v.ZodFirstPartyTypeKind.ZodEffects:throw new rt(v.ZodFirstPartyTypeKind.ZodEffects);case v.ZodFirstPartyTypeKind.ZodNativeEnum:throw new rt(v.ZodFirstPartyTypeKind.ZodNativeEnum);case v.ZodFirstPartyTypeKind.ZodOptional:return`${Z(r.description)}z.optional(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodNullable:return`${Z(r.description)}z.nullable(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodDefault:let H=qo(r.defaultValue());return`${Z(r.description)}${ae(r.innerType)}.default(${H})`.trim();case v.ZodFirstPartyTypeKind.ZodCatch:throw new rt(v.ZodFirstPartyTypeKind.ZodCatch);case v.ZodFirstPartyTypeKind.ZodPromise:return`${Z(r.description)}z.promise(${ae(r.type)})`.trim();case v.ZodFirstPartyTypeKind.ZodBranded:throw new rt(v.ZodFirstPartyTypeKind.ZodBranded);case v.ZodFirstPartyTypeKind.ZodPipeline:throw new rt(v.ZodFirstPartyTypeKind.ZodPipeline);case v.ZodFirstPartyTypeKind.ZodSymbol:throw new rt(v.ZodFirstPartyTypeKind.ZodSymbol);case v.ZodFirstPartyTypeKind.ZodReadonly:return`${Z(r.description)}z.readonly(${ae(r.innerType)})`.trim();case v.ZodFirstPartyTypeKind.ZodRef:let W=je(r.uri);return`${Z(r.description)}z.ref(${W})`.trim();default:M.assertNever(r)}}u(ae,"sUnwrapZod");var ml=class{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};u(ml,"ParseInputLazyPath");var Se=ml,Co=u((t,e)=>{if(Bt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ie(t.common.issues);return this._error=r,this._error}}},"handleResult"),hl=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}dereference(e){return this}getReferences(){return[]}_getType(e){return Me(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ye,ctx:{common:e.parent.common,data:e.data,parsedType:Me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(or(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let a={common:{issues:[],async:(n=r?.async)!=null?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},s=this._parseSync({data:e,path:a.path,parent:a});return Co(a,s)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Me(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(or(a)?a:Promise.resolve(a));return Co(n,s)}refine(e,r){let n=u(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let i=e(a),o=u(()=>s.addIssue(l({code:_.custom},n(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new We({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return He.create(this,this._def)}nullable(){return ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Dt.create(this,this._def)}promise(){return fr.create(this,this._def)}or(e){return Xn.create([this,e],this._def)}and(e){return zn.create(this,e,this._def)}transform(e){return new We(m(l({},A(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new lr(m(l({},A(this._def)),{innerType:this,defaultValue:r,typeName:"ZodDefault"}))}brand(){return new Un(l({typeName:"ZodBranded",type:this},A(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new Fn(m(l({},A(this._def)),{innerType:this,catchValue:r,typeName:"ZodCatch"}))}describe(e){let r=this.constructor;return new r(m(l({},this._def),{description:e}))}pipe(e){return Jn.create(this,e)}readonly(){return pr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){for(let[r,n]of Object.entries(e))this._def[U]=m(l({},this._def[U]),{[r]:n});return this}getMetadata(){return l({},this._def[U])}setMetadata(e){this._def[U]=l({},e)}get ui(){let e=this._getMetadataRoot();return l({},e._def[U])}_setZuiMeta(e,r){let n=this._getMetadataRoot();n._def[U]=m(l({},n._def[U]),{[e]:r})}_getMetadataRoot(){let e=this._def;switch(e.typeName){case"ZodNullable":case"ZodDefault":case"ZodOptional":case"ZodReadonly":return e.innerType;case"ZodEffects":return e.schema;default:return this}}displayAs(e){var r,n,a;return(a=(r=this._def)[n=U])!=null||(r[n]={}),this._def[U].displayAs=[e.id,e.params],this}title(e){return this._setZuiMeta("title",e),this}hidden(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("hidden",r),this}disabled(e){let r;return e===void 0?r=!0:typeof e=="function"?r=e.toString():r=e,this._setZuiMeta("disabled",r),this}placeholder(e){return this._setZuiMeta("placeholder",e),this}toJsonSchema(e){return Qn(this,e)}toTypescript(e){return Gr(this,e)}toTypescriptSchema(){return ms(this)}async toTypescriptAsync(e){let r=Gr(this,m(l({},e),{formatter:void 0}));return e?.formatter&&(r=await e.formatter(r)),r}static fromObject(e,r){return jt(e,r)}static fromJsonSchema(e){return gr(e)}};u(hl,"ZodType");var B=hl,hs=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(hs||{}),M;(t=>{t.assertEqual=u(a=>a,"assertEqual");function e(a){}t.assertIs=e,u(e,"assertIs");function r(a){throw new Error("assertNever called")}t.assertNever=r,u(r,"assertNever"),t.arrayToEnum=u(a=>{let s={};for(let i of a)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=u(a=>{let s=(0,t.objectKeys)(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=u(a=>(0,t.objectKeys)(a).map(function(s){return a[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=u((a,s)=>{for(let i of a)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,u(n,"joinValues"),t.jsonStringifyReplacer=u((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=u((a,s)=>a.toString()===s.toString(),"compareFunctions")})(M||(M={}));var Wr;(t=>{t.mergeShapes=u((e,r)=>l(l({},e),r),"mergeShapes")})(Wr||(Wr={}));var x=M.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Me=u(t=>{switch(typeof t){case"undefined":return x.undefined;case"string":return x.string;case"number":return isNaN(t)?x.nan:x.number;case"boolean":return x.boolean;case"function":return x.function;case"bigint":return x.bigint;case"symbol":return x.symbol;case"object":return Array.isArray(t)?x.array:t===null?x.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?x.promise:typeof Map<"u"&&t instanceof Map?x.map:typeof Set<"u"&&t instanceof Set?x.set:typeof Date<"u"&&t instanceof Date?x.date:x.object;default:return x.unknown}},"getParsedType");function A(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[U]:t?.[U]}:{errorMap:u((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:r??o.defaultError},"customMap"),description:a,[U]:t?.[U]}}u(A,"processCreateParams");var ys=u((t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===x.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,M.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${M.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${M.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${M.joinValues(t.options)}, received '${t.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:M.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;case _.unresolved_reference:r="Unresolved reference";break;default:r=e.defaultError,M.assertNever(t)}return{message:r}},"errorMap"),Io=ys,_=M.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite","unresolved_reference"]),yl=u(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Jr=class vl extends Error{constructor(e){super(),this.issues=[],this.addIssue=u(n=>{this.issues=[...this.issues,n]},"addIssue"),this.addIssues=u((n=[])=>{this.issues=[...this.issues,...n]},"addIssues");let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(s){return s.message},n={_errors:[]},a=u(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,d=0;for(;d<i.path.length;){let p=i.path[d];d===i.path.length-1?(o[p]=o[p]||{_errors:[]},o[p]._errors.push(r(i))):o[p]=o[p]||{_errors:[]},o=o[p],d++}}},"processError");return a(this),n}static assert(e){if(!(e instanceof vl))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,M.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};u(Jr,"ZodError");Jr.create=u(t=>new Jr(t),"create");var Ie=Jr,_l=ys;function vs(t){_l=t}u(vs,"setErrorMap");function Rt(){return _l}u(Rt,"getErrorMap");var ir=u(t=>{var e;let{data:r,path:n,errorMaps:a,issueData:s}=t,i=[...n,...s.path||[]],o=m(l({},s),{path:i}),d="",p=a.filter(y=>!!y).slice().reverse();for(let y of p)d=y(o,{data:r,defaultError:d}).message;return m(l({},s),{path:i,message:(e=s.message)!=null?e:d})},"makeIssue"),bl=[];function E(t,e){let r=ir({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rt(),ys].filter(n=>!!n)});t.common.issues.push(r)}u(E,"addIssueToContext");var Tl=class Pl{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let a of r){if(a.status==="aborted")return C;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return Pl.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let a of r){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return C;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}};u(Tl,"ParseStatus");var ye=Tl,C=Object.freeze({status:"aborted"}),it=u(t=>({status:"dirty",value:t}),"DIRTY"),pe=u(t=>({status:"valid",value:t}),"OK"),Yr=u(t=>t.status==="aborted","isAborted"),Xr=u(t=>t.status==="dirty","isDirty"),Bt=u(t=>t.status==="valid","isValid"),or=u(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),O;(t=>{t.errToObj=u(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=u(e=>typeof e=="string"?e:e?.message,"toString")})(O||(O={}));var Qr=class El extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof El}};u(Qr,"ZodAny");Qr.create=u(t=>new Qr(l({typeName:"ZodAny"},A(t))),"create");var ur=Qr,en=class St extends B{dereference(e){return new St(m(l({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}isEqual(e){var r,n,a,s,i,o;return e instanceof St?ot((r=this._def.exactLength)==null?void 0:r.value,(n=e._def.exactLength)==null?void 0:n.value)&&ot((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&ot((i=this._def.minLength)==null?void 0:i.value,(o=e._def.minLength)==null?void 0:o.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==x.array)return E(r,{code:_.invalid_type,expected:x.array,received:r.parsedType}),C;if(a.exactLength!==null){let i=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(i||o)&&(E(r,{code:i?_.too_big:_.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(E(r,{code:_.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(E(r,{code:_.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>a.type._parseAsync(new Se(r,i,r.path,o)))).then(i=>ye.mergeArray(n,i));let s=[...r.data].map((i,o)=>a.type._parseSync(new Se(r,i,r.path,o)));return ye.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new St(m(l({},this._def),{minLength:{value:e,message:O.toString(r)}}))}max(e,r){return new St(m(l({},this._def),{maxLength:{value:e,message:O.toString(r)}}))}length(e,r){return new St(m(l({},this._def),{exactLength:{value:e,message:O.toString(r)}}))}nonempty(e){return this.min(1,e)}};u(en,"ZodArray");en.create=u((t,e)=>new en(l({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},A(e))),"create");var Dt=en,Bv={compare:ot},xl=class{constructor(e=[],r={}){this._options=l(l({},Bv),r),this._items=[];for(let n of e)this.add(n)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(r=>this._options.compare(r,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(r=>e.has(r))}};u(xl,"CustomSet");var ue=xl,tn=class $r extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==x.bigint){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.bigint,received:s.parsedType}),C}let n,a=new ye;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof $r)||this._def.coerce!==e._def.coerce)return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new $r(m(l({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new $r(m(l({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u(tn,"ZodBigInt");tn.create=u(t=>{var e;return new tn(l({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var Nn=tn,rn=class Sl extends B{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==x.boolean){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.boolean,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Sl?this._def.coerce===e._def.coerce:!1}};u(rn,"ZodBoolean");rn.create=u(t=>new rn(l({typeName:"ZodBoolean",coerce:t?.coerce||!1},A(t))),"create");var $n=rn,wl=Symbol("zod_brand"),kl=class Ol extends B{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}isEqual(e){return e instanceof Ol?this._def.type.isEqual(e._def.type):!1}};u(kl,"ZodBranded");var Un=kl,nn=class Cl extends B{_parse(e){let{ctx:r}=this._processInputParams(e),n=m(l({},r),{common:m(l({},r.common),{issues:[]})}),a=this._def.innerType._parse({data:n.data,path:n.path,parent:l({},n)});return or(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Cl?this._def.innerType.isEqual(e._def.innerType)&&M.compareFunctions(this._def.catchValue,e._def.catchValue):!1}};u(nn,"ZodCatch");nn.create=u((t,e)=>new nn(l({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},A(e))),"create");var Fn=nn,_s=u((t,e={},r)=>t?ur.create().superRefine((n,a)=>{var s,i;if(!t(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(s=o.fatal)!=null?s:r)!=null?i:!0,p=typeof o=="string"?{message:o}:o;a.addIssue(m(l({code:"custom"},p),{fatal:d}))}}):ur.create(),"custom"),an=class Wa extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==x.date){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.date,received:s.parsedType}),C}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_date}),C}let n=new ye,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:_.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:_.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):M.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Wa(m(l({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof Wa))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)&&this._def.coerce===e._def.coerce}};u(an,"ZodDate");an.create=u(t=>new an(l({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},A(t))),"create");var Ln=an,sn=class Ja extends B{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===x.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}dereference(e){return new Ja(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}isEqual(e){return e instanceof Ja?this._def.innerType.isEqual(e._def.innerType)&&ot(this._def.defaultValue(),e._def.defaultValue()):!1}};u(sn,"ZodDefault");sn.create=u((t,e,r)=>new sn(l({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},A(r))),"create");var lr=sn,Fe=u(t=>Array.from(new Set(t)),"unique"),De=u(t=>t instanceof Kn?De(t.schema):t instanceof We?De(t.innerType()):t instanceof Vn?[t.value]:t instanceof yt?t.options:t instanceof qn?M.objectValues(t.enum):t instanceof lr?De(t._def.innerType):t instanceof Yn?[void 0]:t instanceof Gn?[null]:t instanceof He?[void 0,...De(t.unwrap())]:t instanceof ut?[null,...De(t.unwrap())]:t instanceof Un||t instanceof pr?De(t.unwrap()):t instanceof Fn?De(t._def.innerType):[],"getDiscriminator"),Il=class wt extends B{dereference(e){let r=this.options.map(a=>a.dereference(e)),n=wt._getOptionsMap(this.discriminator,r);return new wt(m(l({},this._def),{options:r,optionsMap:n}))}getReferences(){return Fe(this.options.flatMap(e=>e.getReferences()))}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==x.object)return E(r,{code:_.invalid_type,expected:x.object,received:r.parsedType}),C;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(E(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let a=wt._getOptionsMap(e,r);return new wt(l({typeName:"ZodDiscriminatedUnion",discriminator:e,options:r,optionsMap:a},A(n)))}static _getOptionsMap(e,r){let n=new Map;for(let a of r){let s=De(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,a)}}return n}isEqual(e){if(!(e instanceof wt)||this._def.discriminator!==e._def.discriminator)return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue(this._def.options,{compare:r}),a=new ue(e._def.options,{compare:r});return n.isEqual(a)}};u(Il,"ZodDiscriminatedUnion");var bs=Il;function dr(t,e){return new yt(l({values:t,typeName:"ZodEnum"},A(e)))}u(dr,"createZodEnum");var Ts=class Ur extends B{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{expected:M.joinValues(n),received:r.parsedType,code:_.invalid_type}),C}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return E(r,{received:r.data,code:_.invalid_enum_value,options:n}),C}return pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Ur.create(e,l(l({},this._def),r))}exclude(e,r=this._def){return Ur.create(this.options.filter(n=>!e.includes(n)),l(l({},this._def),r))}isEqual(e){if(!(e instanceof Ur))return!1;let r=new ue(this._def.values),n=new ue(e._def.values);return r.isEqual(n)}};u(Ts,"ZodEnum");Ts.create=dr;var yt=Ts,Zl=class kt extends B{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let r=this._def.args.dereference(e),n=this._def.returns.dereference(e);return new kt(m(l({},this._def),{args:r,returns:n}))}getReferences(){return Fe([...this._def.args.getReferences(),...this._def.returns.getReferences()])}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==x.function)return E(r,{code:_.invalid_type,expected:x.function,received:r.parsedType}),C;function n(o,d){return ir({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Io].filter(p=>!!p),issueData:{code:_.invalid_arguments,argumentsError:d}})}u(n,"makeArgsIssue");function a(o,d){return ir({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rt(),Io].filter(p=>!!p),issueData:{code:_.invalid_return_type,returnTypeError:d}})}u(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof fr){let o=this;return pe(async function(...d){let p=new Ie([]),y=await o._def.args.parseAsync(d,s).catch(P=>{throw p.addIssue(n(d,P)),p}),T=await Reflect.apply(i,this,y);return await o._def.returns._def.type.parseAsync(T,s).catch(P=>{throw p.addIssue(a(T,P)),p})})}else{let o=this;return pe(function(...d){let p=o._def.args.safeParse(d,s);if(!p.success)throw new Ie([n(d,p.error)]);let y=Reflect.apply(i,this,p.data),T=o._def.returns.safeParse(y,s);if(!T.success)throw new Ie([a(y,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new kt(m(l({},this._def),{args:lt.create(e).rest(It.create())}))}returns(e){return new kt(m(l({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new kt(l({args:e||lt.create([]).rest(It.create()),returns:r||It.create(),typeName:"ZodFunction"},A(n)))}isEqual(e){return e instanceof kt&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};u(Zl,"ZodFunction");var Ps=Zl;function on(t,e){let r=Me(t),n=Me(e);if(t===e)return{valid:!0,data:t};if(r===x.object&&n===x.object){let a=M.objectKeys(e),s=M.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i=l(l({},t),e);for(let o of s){let d=on(t[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(r===x.array&&n===x.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=t[s],o=e[s],d=on(i,o);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===x.date&&n===x.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}u(on,"mergeValues");var un=class Ya extends B{dereference(e){return new Ya(m(l({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Fe([...this._def.left.getReferences(),...this._def.right.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=u((s,i)=>{if(Yr(s)||Yr(i))return C;let o=on(s.value,i.value);return o.valid?((Xr(s)||Xr(i))&&r.dirty(),{status:r.value,value:o.data}):(E(n,{code:_.invalid_intersection_types}),C)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}isEqual(e){if(!(e instanceof Ya))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue([this._def.left,this._def.right],{compare:r}),a=new ue([e._def.left,e._def.right],{compare:r});return n.isEqual(a)}};u(un,"ZodIntersection");un.create=u((t,e,r)=>new un(l({left:t,right:e,typeName:"ZodIntersection"},A(r))),"create");var zn=un,cn=class Al extends B{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}isEqual(e){return e instanceof Al?this._def.getter().isEqual(e._def.getter()):!1}};u(cn,"ZodLazy");cn.create=u((t,e)=>new cn(l({getter:t,typeName:"ZodLazy"},A(e))),"create");var Kn=cn,ln=class Rl extends B{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return E(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Rl?ot(this._def.value,e._def.value):!1}};u(ln,"ZodLiteral");ln.create=u((t,e)=>new ln(l({value:t,typeName:"ZodLiteral"},A(e))),"create");var Vn=ln,dn=class Xa extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new Xa(m(l({},this._def),{keyType:r,valueType:n}))}getReferences(){return Fe([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==x.map)return E(n,{code:_.invalid_type,expected:x.map,received:n.parsedType}),C;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,d],p)=>({key:a._parse(new Se(n,o,n.path,[p,"key"])),value:s._parse(new Se(n,d,n.path,[p,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let p=await d.key,y=await d.value;if(p.status==="aborted"||y.status==="aborted")return C;(p.status==="dirty"||y.status==="dirty")&&r.dirty(),o.set(p.value,y.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let d of i){let p=d.key,y=d.value;if(p.status==="aborted"||y.status==="aborted")return C;(p.status==="dirty"||y.status==="dirty")&&r.dirty(),o.set(p.value,y.value)}return{status:r.value,value:o}}}isEqual(e){return!(!(e instanceof Xa)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};u(dn,"ZodMap");dn.create=u((t,e,r)=>new dn(l({valueType:e,keyType:t,typeName:"ZodMap"},A(r))),"create");var Es=dn,fn=class Bl extends B{_parse(e){if(this._getType(e)!==x.nan){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}isEqual(e){return e instanceof Bl}};u(fn,"ZodNaN");fn.create=u(t=>new fn(l({typeName:"ZodNaN"},A(t))),"create");var xs=fn,pn=class Dl extends B{_parse(e){let r=M.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==x.string&&n.parsedType!==x.number){let a=M.objectValues(r);return E(n,{expected:M.joinValues(a),received:n.parsedType,code:_.invalid_type}),C}if(r.indexOf(e.data)===-1){let a=M.objectValues(r);return E(n,{received:n.data,code:_.invalid_enum_value,options:a}),C}return pe(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof Dl?ot(this._def.values,e._def.values):!1}};u(pn,"ZodNativeEnum");pn.create=u((t,e)=>new pn(l({values:t,typeName:"ZodNativeEnum"},A(e))),"create");var qn=pn,gn=class Ml extends B{_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:_.invalid_type,expected:x.never,received:r.parsedType}),C}isEqual(e){return e instanceof Ml}};u(gn,"ZodNever");gn.create=u(t=>new gn(l({typeName:"ZodNever"},A(t))),"create");var qe=gn,mn=class jl extends B{_parse(e){if(this._getType(e)!==x.null){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.null,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof jl}};u(mn,"ZodNull");mn.create=u(t=>new mn(l({typeName:"ZodNull"},A(t))),"create");var Gn=mn,hn=class Qa extends B{dereference(e){return new Qa(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===x.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Qa?this._def.innerType.isEqual(e._def.innerType):!1}};u(hn,"ZodNullable");hn.create=u((t,e)=>new hn(l({innerType:t,typeName:"ZodNullable"},A(e))),"create");var ut=hn;function Hl(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return s%i/Math.pow(10,a)}u(Hl,"floatSafeRemainder");var yn=class Fr extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==x.number){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.number,received:s.parsedType}),C}let n,a=new ye;for(let s of this._def.checks)s.kind==="int"?M.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:_.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Hl(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),E(n,{code:_.not_finite,message:s.message}),a.dirty()):M.assertNever(s);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,O.toString(r))}gt(e,r){return this.setLimit("min",e,!1,O.toString(r))}lte(e,r){return this.setLimit("max",e,!0,O.toString(r))}lt(e,r){return this.setLimit("max",e,!1,O.toString(r))}setLimit(e,r,n,a){return new Fr(m(l({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:O.toString(a)}]}))}_addCheck(e){return new Fr(m(l({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&M.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof Fr))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)}};u(yn,"ZodNumber");yn.create=u(t=>new yn(l({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},A(t))),"create");var Wn=yn;function st(t){if(t instanceof ct){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=He.create(st(n))}return new ct(m(l({},t._def),{shape:u(()=>e,"shape")}))}else return t instanceof Dt?new Dt(m(l({},t._def),{type:st(t.element)})):t instanceof He?He.create(st(t.unwrap())):t instanceof ut?ut.create(st(t.unwrap())):t instanceof lt?lt.create(t.items.map(e=>st(e))):t}u(st,"deepPartialify");var Ge=class xe extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=M.objectKeys(e);return this._cached={shape:e,keys:r}}dereference(e){let r=this._def.shape(),n={};for(let a in r)n[a]=r[a].dereference(e);return new xe(m(l({},this._def),{shape:u(()=>n,"shape")}))}getReferences(){let e=this._def.shape(),r=[];for(let n in e)r.push(...e[n].getReferences());return Fe(r)}_parse(e){if(this._getType(e)!==x.object){let p=this._getOrReturnCtx(e);return E(p,{code:_.invalid_type,expected:x.object,received:p.parsedType}),C}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof qe&&this._def.unknownKeys==="strip"))for(let p in a.data)i.includes(p)||o.push(p);let d=[];for(let p of i){let y=s[p],T=a.data[p];d.push({key:{status:"valid",value:p},value:y._parse(new Se(a,T,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qe){let p=this._def.unknownKeys;if(p==="passthrough")for(let y of o)d.push({key:{status:"valid",value:y},value:{status:"valid",value:a.data[y]}});else if(p==="strict")o.length>0&&(E(a,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let y of o){let T=a.data[y];d.push({key:{status:"valid",value:y},value:p._parse(new Se(a,T,a.path,y)),alwaysSet:y in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of d){let T=await y.key;p.push({key:T,value:await y.value,alwaysSet:y.alwaysSet})}return p}).then(p=>ye.mergeObjectSync(n,p)):ye.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new xe(l(m(l({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:u((r,n)=>{var a,s,i,o;let d=(i=(s=(a=this._def).errorMap)==null?void 0:s.call(a,r,n).message)!=null?i:n.defaultError;return r.code==="unrecognized_keys"?{message:(o=O.errToObj(e).message)!=null?o:d}:{message:d}},"errorMap")}:{}))}strip(){return new xe(m(l({},this._def),{unknownKeys:"strip"}))}passthrough(){return new xe(m(l({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new xe(m(l({},this._def),{shape:u(()=>l(l({},this._def.shape()),e),"shape")}))}merge(e){return new xe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:u(()=>l(l({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new xe(m(l({},this._def),{catchall:e}))}pick(e){let r={};return M.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}omit(e){let r={};return M.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}deepPartial(){return st(this)}partial(e){let r={};return M.objectKeys(this.shape).forEach(n=>{let a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a?.optional()}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}required(e){let r={};return M.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof He;)s=s._def.innerType;r[n]=s}}),new xe(m(l({},this._def),{shape:u(()=>r,"shape")}))}keyof(){return dr(M.objectKeys(this.shape))}isEqual(e){if(!(e instanceof xe)||!this._def.catchall.isEqual(e._def.catchall)||this._def.unknownKeys!==e._def.unknownKeys)return!1;let r=this._def.shape(),n=e._def.shape(),a=u((o,d)=>o[0]===d[0]&&o[1].isEqual(d[1]),"compare"),s=new ue(Object.entries(r),{compare:a}),i=new ue(Object.entries(n),{compare:a});return s.isEqual(i)}};u(Ge,"ZodObject");Ge.create=u((t,e)=>new Ge(l({shape:u(()=>t,"shape"),unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"create");Ge.strictCreate=u((t,e)=>new Ge(l({shape:u(()=>t,"shape"),unknownKeys:"strict",catchall:qe.create(),typeName:"ZodObject"},A(e))),"strictCreate");Ge.lazycreate=u((t,e)=>new Ge(l({shape:t,unknownKeys:"strip",catchall:qe.create(),typeName:"ZodObject"},A(e))),"lazycreate");var ct=Ge,vn=class es extends B{dereference(e){return new es(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){return this._getType(e)===x.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof es?this._def.innerType.isEqual(e._def.innerType):!1}};u(vn,"ZodOptional");vn.create=u((t,e)=>new vn(l({innerType:t,typeName:"ZodOptional"},A(e))),"create");var He=vn,Nl=class Lr extends B{dereference(e){return new Lr(m(l({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Fe([...this._def.in.getReferences(),...this._def.out.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return u(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?(r.dirty(),it(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?C:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Lr({in:e,out:r,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Lr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};u(Nl,"ZodPipeline");var Jn=Nl,_n=class ts extends B{unwrap(){return this._def.type}dereference(e){return new ts(m(l({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==x.promise&&r.common.async===!1)return E(r,{code:_.invalid_type,expected:x.promise,received:r.parsedType}),C;let n=r.parsedType===x.promise?r.data:Promise.resolve(r.data);return pe(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}isEqual(e){return e instanceof ts?this._def.type.isEqual(e._def.type):!1}};u(_n,"ZodPromise");_n.create=u((t,e)=>new _n(l({type:t,typeName:"ZodPromise"},A(e))),"create");var fr=_n,bn=class rs extends B{dereference(e){return new rs(m(l({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}_parse(e){let r=this._def.innerType._parse(e);return Bt(r)&&(r.value=Object.freeze(r.value)),r}unwrap(){return this._def.innerType}isEqual(e){return e instanceof rs?this._def.innerType.isEqual(e._def.innerType):!1}};u(bn,"ZodReadonly");bn.create=u((t,e)=>new bn(l({innerType:t,typeName:"ZodReadonly"},A(e))),"create");var pr=bn,$l=class Xt extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let r=this._def.keyType.dereference(e),n=this._def.valueType.dereference(e);return new Xt(m(l({},this._def),{keyType:r,valueType:n}))}getReferences(){return Fe([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==x.object)return E(n,{code:_.invalid_type,expected:x.object,received:n.parsedType}),C;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:s._parse(new Se(n,o,n.path,o)),value:i._parse(new Se(n,n.data[o],n.path,o))});return n.common.async?ye.mergeObjectAsync(r,a):ye.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof B?new Xt(l({keyType:e,valueType:r,typeName:"ZodRecord"},A(n))):new Xt(l({keyType:ge.create(),valueType:e,typeName:"ZodRecord"},A(r)))}isEqual(e){return!(!(e instanceof Xt)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};u($l,"ZodRecord");var Ss=$l,Tn=class Ul extends B{dereference(e){let r=e[this._def.uri];return r||this}getReferences(){return[this._def.uri]}_parse(e){let r=this._getOrReturnCtx(e);return E(r,{code:_.unresolved_reference}),C}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Ul?this._def.uri===e._def.uri:!1}};u(Tn,"ZodRef");Tn.create=u(t=>new Tn({typeName:"ZodRef",uri:t}),"create");var ws=Tn,Pn=class Qt extends B{dereference(e){return new Qt(m(l({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==x.set)return E(n,{code:_.invalid_type,expected:x.set,received:n.parsedType}),C;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(E(n,{code:_.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(E(n,{code:_.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function i(d){let p=new Set;for(let y of d){if(y.status==="aborted")return C;y.status==="dirty"&&r.dirty(),p.add(y.value)}return{status:r.value,value:p}}u(i,"finalizeSet");let o=[...n.data.values()].map((d,p)=>s._parse(new Se(n,d,n.path,p)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,r){return new Qt(m(l({},this._def),{minSize:{value:e,message:O.toString(r)}}))}max(e,r){return new Qt(m(l({},this._def),{maxSize:{value:e,message:O.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}isEqual(e){var r,n,a,s;if(!(e instanceof Qt))return!1;let i=(r=this._def.minSize)==null?void 0:r.value,o=(n=e._def.minSize)==null?void 0:n.value;if(i!==o)return!1;let d=(a=this._def.maxSize)==null?void 0:a.value,p=(s=e._def.maxSize)==null?void 0:s.value;return d!==p?!1:this._def.valueType.isEqual(e._def.valueType)}};u(Pn,"ZodSet");Pn.create=u((t,e)=>new Pn(l({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},A(e))),"create");var ks=Pn,Os=/^c[^\s-]{8,}$/i,Cs=/^[a-z][a-z0-9]*$/,Is=/^[0-9A-HJKMNP-TV-Z]{26}$/,Zs=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,As=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ll=u(t=>t===Fl,"isEmojiRegex"),$a,Rs=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Bs=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ds=u(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex");function zl(t,e){return!!((e==="v4"||!e)&&Rs.test(t)||(e==="v6"||!e)&&Bs.test(t))}u(zl,"isValidIP");var En=class Ot extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==x.string){let s=this._getOrReturnCtx(e);return E(s,{code:_.invalid_type,expected:x.string,received:s.parsedType}),C}let n=new ye,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),E(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?E(a,{code:_.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&E(a,{code:_.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")As.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"email",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")$a||($a=new RegExp(Fl,"u")),$a.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"emoji",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Zs.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"uuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Os.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Cs.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"cuid2",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Is.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ulid",code:_.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),E(a,{validation:"url",code:_.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"regex",code:_.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),E(a,{code:_.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:_.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),E(a,{code:_.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ds(s).test(e.data)||(a=this._getOrReturnCtx(e,a),E(a,{code:_.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="ip"?zl(e.data,s.version)||(a=this._getOrReturnCtx(e,a),E(a,{validation:"ip",code:_.invalid_string,message:s.message}),n.dirty()):M.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),l({validation:r,code:_.invalid_string},O.errToObj(n)))}_addCheck(e){return new Ot(m(l({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(l({kind:"email"},O.errToObj(e)))}url(e){return this._addCheck(l({kind:"url"},O.errToObj(e)))}emoji(e){return this._addCheck(l({kind:"emoji"},O.errToObj(e)))}uuid(e){return this._addCheck(l({kind:"uuid"},O.errToObj(e)))}cuid(e){return this._addCheck(l({kind:"cuid"},O.errToObj(e)))}cuid2(e){return this._addCheck(l({kind:"cuid2"},O.errToObj(e)))}ulid(e){return this._addCheck(l({kind:"ulid"},O.errToObj(e)))}ip(e){return this._addCheck(l({kind:"ip"},O.errToObj(e)))}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(l({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!=null?r:!1},O.errToObj(e?.message)))}regex(e,r){return this._addCheck(l({kind:"regex",regex:e},O.errToObj(r)))}includes(e,r){return this._addCheck(l({kind:"includes",value:e,position:r?.position},O.errToObj(r?.message)))}startsWith(e,r){return this._addCheck(l({kind:"startsWith",value:e},O.errToObj(r)))}endsWith(e,r){return this._addCheck(l({kind:"endsWith",value:e},O.errToObj(r)))}min(e,r){return this._addCheck(l({kind:"min",value:e},O.errToObj(r)))}max(e,r){return this._addCheck(l({kind:"max",value:e},O.errToObj(r)))}length(e,r){return this._addCheck(l({kind:"length",value:e},O.errToObj(r)))}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new Ot(m(l({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[U]=m(l({},this._def[U]),{secret:!0}),this}toLowerCase(){return new Ot(m(l({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Ot(m(l({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}isEqual(e){if(!(e instanceof Ot))return!1;let r=new ue(this._def.checks),n=new ue(e._def.checks);return r.isEqual(n)}};u(En,"ZodString");En.create=u(t=>{var e;return new En(l({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},A(t)))},"create");var ge=En,xn=class Kl extends B{_parse(e){if(this._getType(e)!==x.symbol){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.symbol,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Kl}};u(xn,"ZodSymbol");xn.create=u(t=>new xn(l({typeName:"ZodSymbol"},A(t))),"create");var Ms=xn,Mt=class ns extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new ns(m(l({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:u(i=>{E(n,i),i.fatal?r.abort():r.dirty()},"addIssue"),get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return C;let d=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return d.status==="aborted"?C:d.status==="dirty"||r.value==="dirty"?it(d.value):d});{if(r.value==="aborted")return C;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"||r.value==="dirty"?it(o.value):o}}if(a.type==="refinement"){let i=u(o=>{let d=a.refinement(o,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?C:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Bt(i))return i;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Bt(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:r.value,value:o})):i);M.assertNever(a)}isEqual(e){return!(e instanceof ns)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:M.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:M.compareFunctions(this._def.effect.transform,e._def.effect.transform):(M.assertNever(this._def.effect),!1)}};u(Mt,"ZodEffects");Mt.create=u((t,e,r)=>new Mt(l({schema:t,typeName:"ZodEffects",effect:e},A(r))),"create");Mt.createWithPreprocess=u((t,e,r)=>new Mt(l({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},A(r))),"createWithPreprocess");var We=Mt,Sn=class zr extends B{dereference(e){let r=this._def.items.map(a=>a.dereference(e)),n=this._def.rest?this._def.rest.dereference(e):null;return new zr(m(l({},this._def),{items:r,rest:n}))}getReferences(){return Fe([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==x.array)return E(n,{code:_.invalid_type,expected:x.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return E(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(E(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new Se(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>ye.mergeArray(r,i)):ye.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new zr(m(l({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof zr)||!this._restEquals(e))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue(this._def.items,{compare:r}),a=new ue(e._def.items,{compare:r});return n.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};u(Sn,"ZodTuple");Sn.create=u((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Sn(l({items:t,typeName:"ZodTuple",rest:null},A(e)))},"create");var lt=Sn,wn=class Vl extends B{_parse(e){if(this._getType(e)!==x.undefined){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.undefined,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Vl}};u(wn,"ZodUndefined");wn.create=u(t=>new wn(l({typeName:"ZodUndefined"},A(t))),"create");var Yn=wn,kn=class as extends B{dereference(e){let r=this._def.options.map(n=>n.dereference(e));return new as(m(l({},this._def),{options:r}))}getReferences(){return Fe(this._def.options.reduce((e,r)=>[...e,...r.getReferences()],[]))}_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new Ie(o.ctx.common.issues));return E(r,{code:_.invalid_union,unionErrors:i}),C}if(u(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let i=m(l({},r),{common:m(l({},r.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(a);{let s,i=[];for(let d of n){let p=m(l({},r),{common:m(l({},r.common),{issues:[]}),parent:null}),y=d._parseSync({data:r.data,path:r.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!s&&(s={result:y,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(d=>new Ie(d));return E(r,{code:_.invalid_union,unionErrors:o}),C}}get options(){return this._def.options}isEqual(e){if(!(e instanceof as))return!1;let r=u((s,i)=>s.isEqual(i),"compare"),n=new ue([...this._def.options],{compare:r}),a=new ue([...e._def.options],{compare:r});return n.isEqual(a)}};u(kn,"ZodUnion");kn.create=u((t,e)=>new kn(l({options:t,typeName:"ZodUnion"},A(e))),"create");var Xn=kn,On=class ql extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}isEqual(e){return e instanceof ql}};u(On,"ZodUnknown");On.create=u(t=>new On(l({typeName:"ZodUnknown"},A(t))),"create");var It=On,Cn=class Gl extends B{_parse(e){if(this._getType(e)!==x.undefined){let n=this._getOrReturnCtx(e);return E(n,{code:_.invalid_type,expected:x.void,received:n.parsedType}),C}return pe(e.data)}isEqual(e){return e instanceof Gl}};u(Cn,"ZodVoid");Cn.create=u(t=>new Cn(l({typeName:"ZodVoid"},A(t))),"create");var js=Cn,Dv=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,jt=u((t,e,r=!0)=>{if(typeof t!="object")throw new Fa("Input must be an object");let n=u(i=>{let o=i;return e?.nullable&&(o=o.nullable()),e?.optional&&(o=o.optional()),e?.passtrough&&typeof o.passthrough=="function"&&(o=o.passthrough()),o},"applyOptions"),a=Object.entries(t).reduce((i,[o,d])=>{if(d===null)i[o]=n(S.null());else switch(typeof d){case"string":i[o]=Dv.test(d)?n(S.string().datetime()):n(S.string());break;case"number":i[o]=n(S.number());break;case"boolean":i[o]=n(S.boolean());break;case"object":Array.isArray(d)?d.length===0?i[o]=n(S.array(S.unknown())):typeof d[0]=="object"?i[o]=n(S.array(jt(d[0],e,!1))):["string","number","boolean"].includes(typeof d[0])&&(i[o]=n(S.array(S[typeof d[0]]()))):i[o]=n(jt(d,e,!1));break;default:throw new Fa(`Unsupported type for key ${o}`)}return i},{}),s=Object.keys(a).length>0;return e?.passtrough||!r&&!s?S.object(a).passthrough():S.object(a)},"objectToZui");function Wl(){return{}}u(Wl,"parseAnyDef");function Hs(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage=m(l({},t.errorMessage),{[e]:r}))}u(Hs,"addErrorMessage");function G(t,e,r,n,a){t[e]=r,Hs(t,e,n,a)}u(G,"setResponseValueAndErrors");function Jl(t,e){var r,n;let a={type:"array"};return((n=(r=t.type)==null?void 0:r._def)==null?void 0:n.typeName)!=="ZodAny"&&(a.items=K(t.type._def,m(l({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&G(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&G(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(G(a,"minItems",t.exactLength.value,t.exactLength.message,e),G(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}u(Jl,"parseArrayDef");function Yl(t,e){let r=l({type:"integer",format:"int64"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}u(Yl,"parseBigintDef");function Xl(t){return l({type:"boolean"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{})}u(Xl,"parseBooleanDef");function Ql(t,e){return K(t.type._def,e)}u(Ql,"parseBrandedDef");var Mv=u((t,e)=>K(t.innerType._def,e),"parseCatchDef");function ed(t,e){return e.dateStrategy=="integer"?jv(t,e):l({type:"string",format:"date-time"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{})}u(ed,"parseDateDef");var jv=u((t,e)=>{let r=l({type:"integer",format:"unix-time"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"&&G(r,"minimum",n.value,n.message,e);break;case"max":e.target==="jsonSchema7"&&G(r,"maximum",n.value,n.message,e);break}return r},"integerDateParser");function td(t,e){return m(l({},K(t.innerType._def,e)),{default:t.defaultValue()})}u(td,"parseDefaultDef");function rd(t,e){return e.effectStrategy==="input"?K(t.schema._def,e):{}}u(rd,"parseEffectsDef");function nd(t){return{type:"string",enum:t.values}}u(nd,"parseEnumDef");var Hv=u(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function ad(t,e){let r=[K(t.left._def,m(l({},e),{currentPath:[...e.currentPath,"allOf","0"]})),K(t.right._def,m(l({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return r.forEach(s=>{if(Hv(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let o=s,{additionalProperties:d}=o;i=Do(o,["additionalProperties"])}else n=void 0;a.push(i)}}),a.length?l({allOf:a},n):void 0}u(ad,"parseIntersectionDef");function sd(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}u(sd,"parseLiteralDef");var Yt={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function Ns(t,e){let r=l({type:"string"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});function n(a){return e.patternStrategy==="escape"?Nv(a):a}if(u(n,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e);break;case"max":G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":tt(r,"email",a.message,e);break;case"format:idn-email":tt(r,"idn-email",a.message,e);break;case"pattern:zod":Be(r,Yt.email,a.message,e);break}break;case"url":tt(r,"uri",a.message,e);break;case"uuid":tt(r,"uuid",a.message,e);break;case"regex":Be(r,a.regex.source,a.message,e);break;case"cuid":Be(r,Yt.cuid,a.message,e);break;case"cuid2":Be(r,Yt.cuid2,a.message,e);break;case"startsWith":Be(r,"^"+n(a.value),a.message,e);break;case"endsWith":Be(r,n(a.value)+"$",a.message,e);break;case"datetime":tt(r,"date-time",a.message,e);break;case"length":G(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,e),G(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,e);break;case"includes":{Be(r,n(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&tt(r,"ipv4",a.message,e),a.version!=="v4"&&tt(r,"ipv6",a.message,e);break}case"emoji":Be(r,Yt.emoji,a.message,e);break;case"ulid":{Be(r,Yt.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}u(Ns,"parseStringDef");var Nv=u(t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),"escapeNonAlphaNumeric"),tt=u((t,e,r,n)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(l({format:t.format},t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(l({format:e},r&&n.errorMessages&&{errorMessage:{format:r}}))):G(t,"format",e,r,n)},"addFormat"),Be=u((t,e,r,n)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(l({pattern:t.pattern},t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(l({pattern:e},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):G(t,"pattern",e,r,n)},"addPattern");function $s(t,e){var r,n,a,s,i;if(e.target==="openApi3"&&((r=t.keyType)==null?void 0:r._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((d,p)=>{var y;return m(l({},d),{[p]:(y=K(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"properties",p]})))!=null?y:{}})},{}),additionalProperties:!1};let o={type:"object",additionalProperties:(n=K(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:{}};if(e.target==="openApi3")return o;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let d=Object.entries(Ns(t.keyType._def,e)).reduce((p,[y,T])=>y==="type"?p:m(l({},p),{[y]:T}),{});return m(l({},o),{propertyNames:d})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return m(l({},o),{propertyNames:{enum:t.keyType._def.values}});return o}u($s,"parseRecordDef");function id(t,e){if(e.mapStrategy==="record")return $s(t,e);let r=K(t.keyType._def,m(l({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},n=K(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}u(id,"parseMapDef");function od(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(n.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:n.filter(s=>typeof s=="string"||typeof s=="number")}}u(od,"parseNativeEnumDef");function ud(){return{not:{}}}u(ud,"parseNeverDef");function cd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}u(cd,"parseNullDef");var In={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ld(t,e){if(e.target==="openApi3")return Zo(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in In&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((a,s)=>{let i=In[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((a,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(n.length===r.length){let a=n.filter((s,i,o)=>o.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,a)=>[...n,...a._def.values.filter(s=>!n.includes(s))],[])};return Zo(t,e)}u(ld,"parseUnionDef");var Zo=u((t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>K(a._def,m(l({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).length>0)),n=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(r.length)return e.unionStrategy==="anyOf"?l({anyOf:r},n):l({oneOf:r},n)},"asUnionOf");function dd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:In[t.innerType._def.typeName],nullable:!0}:{type:[In[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=K(t.innerType._def,m(l({},e),{currentPath:[...e.currentPath]}));return n&&m(l({},n),{nullable:!0})}let r=K(t.innerType._def,m(l({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return r&&{anyOf:[r,{type:"null"}]}}u(dd,"parseNullableDef");function fd(t,e){let r=l({type:"number"},t.coerce?{[U]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Hs(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?G(r,"minimum",n.value,n.message,e):G(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),G(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?G(r,"maximum",n.value,n.message,e):G(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),G(r,"maximum",n.value,n.message,e));break;case"multipleOf":G(r,"multipleOf",n.value,n.message,e);break}return r}u(fd,"parseNumberDef");function pd(t,e){var r;let n=m(l({type:"object"},Object.entries(t.shape()).reduce((a,[s,i])=>{if(i===void 0||i._def===void 0)return a;let o=K(i._def,m(l({},e),{currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]}));return o===void 0?a:{properties:m(l({},a.properties),{[s]:o}),required:i.isOptional()?a.required:[...a.required,s]}},{properties:{},required:[]})),{additionalProperties:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(r=K(t.catchall._def,m(l({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:!0});return n.required.length||delete n.required,n}u(pd,"parseObjectDef");var $v=u((t,e)=>{var r;if(e.currentPath.toString()===((r=e.propertyPath)==null?void 0:r.toString()))return K(t.innerType._def,e);let n=K(t.innerType._def,m(l({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return n?{anyOf:[{not:{}},n]}:{}},"parseOptionalDef"),Uv=u((t,e)=>{if(e.pipeStrategy==="input")return K(t.in._def,e);if(e.pipeStrategy==="output")return K(t.out._def,e);let r=K(t.in._def,m(l({},e),{currentPath:[...e.currentPath,"allOf","0"]})),n=K(t.out._def,m(l({},e),{currentPath:[...e.currentPath,"allOf",r?"1":"0"]}));return{allOf:[r,n].filter(a=>a!==void 0)}},"parsePipelineDef");function gd(t,e){return K(t.type._def,e)}u(gd,"parsePromiseDef");function md(t,e){let n={type:"array",uniqueItems:!0,items:K(t.valueType._def,m(l({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&G(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&G(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}u(md,"parseSetDef");function hd(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>K(r._def,m(l({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:K(t.rest._def,m(l({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>K(r._def,m(l({},e),{currentPath:[...e.currentPath,"items",`${n}`]}))).reduce((r,n)=>n===void 0?r:[...r,n],[])}}u(hd,"parseTupleDef");function yd(){return{not:{}}}u(yd,"parseUndefinedDef");function vd(){return{}}u(vd,"parseUnknownDef");var Fv=u((t,e)=>K(t.innerType._def,e),"parseReadonlyDef");function _d(t){return{$ref:t.uri}}u(_d,"parseRefDef");function K(t,e,r=!1){let n=e.seen.get(t);if(n&&!r){let i=Lv(n,e);if(i!==void 0)return i}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=Kv(t,t.typeName,e);return s&&Vv(t,e,s),a.jsonSchema=s,s}u(K,"parseDef");var Lv=u((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:zv(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),zv=u((t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},"getRelativePath"),Kv=u((t,e,r)=>{switch(e){case"ZodString":return Ns(t,r);case"ZodNumber":return fd(t,r);case"ZodObject":return pd(t,r);case"ZodBigInt":return Yl(t,r);case"ZodBoolean":return Xl(t);case"ZodDate":return ed(t,r);case"ZodUndefined":return yd();case"ZodNull":return cd(r);case"ZodArray":return Jl(t,r);case"ZodUnion":case"ZodDiscriminatedUnion":return ld(t,r);case"ZodIntersection":return ad(t,r);case"ZodTuple":return hd(t,r);case"ZodRecord":return $s(t,r);case"ZodRef":return _d(t);case"ZodLiteral":return sd(t,r);case"ZodEnum":return nd(t);case"ZodNativeEnum":return od(t);case"ZodNullable":return dd(t,r);case"ZodOptional":return $v(t,r);case"ZodMap":return id(t,r);case"ZodSet":return md(t,r);case"ZodLazy":return K(t.getter()._def,r);case"ZodPromise":return gd(t,r);case"ZodNaN":case"ZodNever":return ud();case"ZodEffects":return rd(t,r);case"ZodAny":return Wl();case"ZodUnknown":return vd();case"ZodDefault":return td(t,r);case"ZodBranded":return Ql(t,r);case"ZodReadonly":return Fv(t,r);case"ZodCatch":return Mv(t,r);case"ZodPipeline":return Uv(t,r);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(n=>{})(e)}},"selectParser"),Vv=u((t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),Object.assign(r,{[U]:l(l({},t[U]),r[U])}),r),"addMeta"),Ao={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},qv=u(t=>typeof t=="string"?m(l({},Ao),{name:t}):l(l({},Ao),t),"getDefaultOptions"),Gv=u(t=>{let e=qv(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return m(l({},e),{currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))})},"getRefs"),Wv=u((t,e)=>{var r;let n=Gv(e),a=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[p,y])=>{var T;return m(l({},d),{[p]:(T=K(y._def,m(l({},n),{currentPath:[...n.basePath,n.definitionPath,p]}),!0))!=null?T:{}})},{}):void 0,s=typeof e=="string"?e:e?.name,i=(r=K(t._def,s===void 0?n:m(l({},n),{currentPath:[...n.basePath,n.definitionPath,s]}),!1))!=null?r:{},o=s===void 0?a?m(l({},i),{[n.definitionPath]:a}):i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:m(l({},a),{[s]:i})};return n.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":n.target==="jsonSchema2019-09"&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),o},"zodToJsonSchema"),Qn=u((t,e={target:"openApi3"})=>{let r=Wv(t,e);return e.$schemaUrl===!1?delete r.$schema:typeof e.$schemaUrl=="string"&&(r.$schema=e.$schemaUrl),r},"zuiToJsonSchema"),Jv=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],Pb=yt.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),bd=u(t=>ge.create().displayAs({id:"variable",params:l({type:t?.type||"any"},t?.params)}),"variable"),Td=u(t=>ge.create().displayAs({id:"conversation",params:l({},t?.params)}),"conversation"),Pd=u(t=>ge.create().displayAs({id:"user",params:l({},t?.params)}),"user"),Ed=u(t=>ge.create().displayAs({id:"message",params:l({},t?.params)}),"message"),xd=u(t=>ge.create().displayAs({id:"agent",params:l({},t?.params)}),"agent"),Sd=u(t=>ge.create().displayAs({id:"event",params:l({},t?.params)}),"event"),wd=u(t=>ge.create().displayAs({id:"table",params:l({},t?.params)}),"table"),kd=u(t=>ge.create().displayAs({id:"tablerow",params:l({},t?.params)}),"tablerow"),Od=u(t=>ge.create().displayAs({id:"intent",params:l({},t?.params)}),"intent"),Cd=u(()=>yt.create(Jv).displayAs({id:"dropdown",params:{}}),"aimodel"),Id=u(t=>ge.create().displayAs({id:"datasource",params:l({},t)}),"datasource"),Zd=u(t=>ge.create().displayAs({id:"knowledgebase",params:l({},t)}),"knowledgebase"),Ad={object:ct.lazycreate},Rd=u((t,e={message:`Input not instance of ${t.name}`})=>_s(r=>r instanceof t,e),"instanceOfType"),Us=ge.create,Fs=Wn.create,Bd=xs.create,Dd=Nn.create,Ls=$n.create,Md=Ln.create,jd=Ms.create,Hd=Yn.create,Nd=Gn.create,$d=ur.create,Ud=It.create,Fd=qe.create,Ld=js.create,zd=Dt.create,Kd=ct.create,Vd=ct.strictCreate,qd=Xn.create,Gd=bs.create,Wd=zn.create,Jd=lt.create,Yd=Ss.create,Xd=ws.create,Qd=pr.create,ef=Es.create,tf=ks.create,rf=Ps.create,nf=Kn.create,af=Vn.create,sf=yt.create,of=qn.create,uf=fr.create,ss=We.create,cf=He.create,lf=ut.create,Yv=lr.create,df=We.createWithPreprocess,ff=Jn.create,pf=u(()=>Us().optional(),"ostring"),gf=u(()=>Fs().optional(),"onumber"),mf=u(()=>Ls().optional(),"oboolean"),hf=B.fromJsonSchema,yf=B.fromObject,vf={string:u(t=>ge.create(m(l({},t),{coerce:!0})),"string"),number:u(t=>Wn.create(m(l({},t),{coerce:!0})),"number"),boolean:u(t=>$n.create(m(l({},t),{coerce:!0})),"boolean"),bigint:u(t=>Nn.create(m(l({},t),{coerce:!0})),"bigint"),date:u(t=>Ln.create(m(l({},t),{coerce:!0})),"date")},_f=C,v=S,bf=u((t,e)=>t.anyOf.length?t.anyOf.length===1?le(t.anyOf[0],m(l({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((r,n)=>le(r,m(l({},e),{path:[...e.path,"anyOf",n]}))).join(", ")}])`:"z.any()","parseAnyOf"),Xv=u(t=>{var e;return(e=t[U])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),Qv=u(t=>"z.any()","parseDefault"),e_=u((t,e)=>`z.union([${t.type.map(r=>le(m(l({},t),{type:r}),e)).join(", ")}])`,"parseMultipleType"),t_=u((t,e)=>`z.any().refine((value) => !${le(t.not,m(l({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),r_=u(t=>"z.null()","parseNull"),n_=u(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),a_=u((t,...e)=>Object.keys(t).reduce((r,n)=>(e.includes(n)||(r[n]=t[n]),r),{}),"omit");function fe(t,e,r){var n;let a=t[e],s="";if(a!==void 0){let i=r({value:a,json:JSON.stringify(a)});if(i){let o=i[0],d=i.length===3?i[1]:"",p=i.length===3?i[2]:i[1];s+=o,((n=t.errorMessage)==null?void 0:n[e])!==void 0&&(s+=d+JSON.stringify(t.errorMessage[e])),s+=p}}return s}u(fe,"withMessage");var er=Symbol("Original index"),s_=u(t=>{let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(typeof n=="boolean")e.push(n?{[er]:r}:{[er]:r,not:{}});else{if(er in n)return t;e.push(m(l({},n),{[er]:r}))}}return e},"ensureOriginalIndex");function cr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let r=t.allOf[0];return le(r,m(l({},e),{path:[...e.path,"allOf",r[er]]}))}else{let[r,n]=n_(s_(t.allOf));return`z.intersection(${cr({allOf:r},e)}, ${cr({allOf:n},e)})`}}u(cr,"parseAllOf");var i_=u((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((n,a)=>le(n,m(l({},e),{path:[...e.path,"items",a]})))}])`;let r=t.items?`z.array(${le(t.items,m(l({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return r+=fe(t,"minItems",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxItems",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseArray"),o_=u(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),u_=u(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),c_=u((t,e)=>{let r=le(t.if,m(l({},e),{path:[...e.path,"if"]})),n=le(t.then,m(l({},e),{path:[...e.path,"then"]})),a=le(t.else,m(l({},e),{path:[...e.path,"else"]}));return`z.union([${n}, ${a}]).superRefine((value,ctx) => {
|
|
34
|
+
const result = ${r}.safeParse(value).success
|
|
35
|
+
? ${n}.safeParse(value)
|
|
36
|
+
: ${a}.safeParse(value);
|
|
37
|
+
if (!result.success) {
|
|
38
|
+
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
39
|
+
}
|
|
40
|
+
})`},"parseIfThenElse"),l_=u(t=>{var e;let r="z.number()";return(e=t[U])!=null&&e.coerce&&(r="z.coerce.number()"),t.type==="integer"?r+=fe(t,"type",()=>[".int(",")"]):r+=fe(t,"format",({value:n})=>{if(n==="int64")return[".int(",")"]}),r+=fe(t,"multipleOf",({value:n,json:a})=>n===1?r.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${a}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?r+=fe(t,"minimum",({json:n})=>[`.gt(${n}`,", ",")"]):r+=fe(t,"minimum",({json:n})=>[`.gte(${n}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(r+=fe(t,"exclusiveMinimum",({json:n})=>[`.gt(${n}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?r+=fe(t,"maximum",({json:n})=>[`.lt(${n}`,", ",")"]):r+=fe(t,"maximum",({json:n})=>[`.lte(${n}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(r+=fe(t,"exclusiveMaximum",({json:n})=>[`.lt(${n}`,", ",")"])),r},"parseNumber"),zs=u((t,e)=>t.oneOf.length?t.oneOf.length===1?le(t.oneOf[0],m(l({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
41
|
+
const schemas = [${t.oneOf.map((r,n)=>le(r,m(l({},e),{path:[...e.path,"oneOf",n]}))).join(", ")}];
|
|
42
|
+
const errors = schemas.reduce(
|
|
43
|
+
(errors: z.ZodError[], schema) =>
|
|
44
|
+
((result) => ("error" in result ? [...errors, result.error] : errors))(
|
|
45
|
+
schema.safeParse(x)
|
|
46
|
+
),
|
|
47
|
+
[]
|
|
48
|
+
);
|
|
49
|
+
if (schemas.length - errors.length !== 1) {
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
path: ctx.path,
|
|
52
|
+
code: "invalid_union",
|
|
53
|
+
unionErrors: errors,
|
|
54
|
+
message: "Invalid input: Should pass single schema",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
})`:"z.any()","parseOneOf");function Tf(t,e){let r;t.properties&&(Object.keys(t.properties).length?(r="z.object({ ",r+=Object.keys(t.properties).map(i=>{let o=t.properties[i],d=`${JSON.stringify(i)}: ${le(o,m(l({},e),{path:[...e.path,"properties",i]}))}`,p=typeof o=="object"&&o.default!==void 0||typeof t.default=="object"&&t.default!==null&&i in t.default,y=Array.isArray(t.required)?t.required.includes(i):typeof o=="object"&&o.required===!0;return!p&&!y?`${d}.optional()`:d}).join(", "),r+=" })"):r="z.object({})");let n=t.additionalProperties!==void 0?le(t.additionalProperties,m(l({},e),{path:[...e.path,"additionalProperties"]})):void 0,a;if(t.patternProperties){let i=Object.fromEntries(Object.entries(t.patternProperties).map(([o,d])=>[o,le(d,m(l({},e),{path:[...e.path,"patternProperties",o]}))],{}));a="",r?n?a+=`.catchall(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`.catchall(z.union([${Object.values(i).join(", ")}]))`:a+=`.catchall(${Object.values(i)})`:n?a+=`z.record(z.union([${[...Object.values(i),n].join(", ")}]))`:Object.keys(i).length>1?a+=`z.record(z.union([${Object.values(i).join(", ")}]))`:a+=`z.record(${Object.values(i)})`,a+=`.superRefine((value, ctx) => {
|
|
58
|
+
`,a+=`for (const key in value) {
|
|
59
|
+
`,n&&(t.properties?a+=`let evaluated = [${Object.keys(t.properties).map(o=>JSON.stringify(o)).join(", ")}].includes(key)
|
|
60
|
+
`:a+=`let evaluated = false
|
|
61
|
+
`);for(let o in t.patternProperties)a+="if (key.match(new RegExp("+JSON.stringify(o)+`))) {
|
|
62
|
+
`,n&&(a+=`evaluated = true
|
|
63
|
+
`),a+="const result = "+i[o]+`.safeParse(value[key])
|
|
64
|
+
`,a+=`if (!result.success) {
|
|
65
|
+
`,a+=`ctx.addIssue({
|
|
66
|
+
path: [...ctx.path, key],
|
|
67
|
+
code: 'custom',
|
|
68
|
+
message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
|
|
69
|
+
params: {
|
|
70
|
+
issues: result.error.issues
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
`,a+=`}
|
|
74
|
+
`,a+=`}
|
|
75
|
+
`;n&&(a+=`if (!evaluated) {
|
|
76
|
+
`,a+="const result = "+n+`.safeParse(value[key])
|
|
77
|
+
`,a+=`if (!result.success) {
|
|
78
|
+
`,a+=`ctx.addIssue({
|
|
79
|
+
path: [...ctx.path, key],
|
|
80
|
+
code: 'custom',
|
|
81
|
+
message: \`Invalid input: must match catchall schema\`,
|
|
82
|
+
params: {
|
|
83
|
+
issues: result.error.issues
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
`,a+=`}
|
|
87
|
+
`,a+=`}
|
|
88
|
+
`),a+=`}
|
|
89
|
+
`,a+="})"}let s=r?a?r+a:n?n==="z.never()"?r+".strict()":r+`.catchall(${n})`:r:a||(n?`z.record(${n})`:"z.record(z.any())");return ie.an.anyOf(t)&&(s+=`.and(${bf(m(l({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),ie.a.oneOf(t)&&(s+=`.and(${zs(m(l({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),ie.an.allOf(t)&&(s+=`.and(${cr(m(l({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?m(l({},i),{type:"object"}):i)}),e)})`),s}u(Tf,"parseObject");var d_=u(t=>{var e;let r="z.string()";if((e=t[U])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";r="z.coerce.string()"}return r+=fe(t,"format",({value:n})=>{switch(n){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),r+=fe(t,"pattern",({json:n})=>[`.regex(new RegExp(${n})`,", ",")"]),r+=fe(t,"minLength",({json:n})=>[`.min(${n}`,", ",")"]),r+=fe(t,"maxLength",({json:n})=>[`.max(${n}`,", ",")"]),r},"parseString"),f_=u((t,e)=>`${le(a_(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),p_=u(t=>`z.ref('${t.$ref}')`,"parseRef"),g_=u((t,e)=>{var r,n;if(t.oneOf.length<=1||!((r=t.discriminator)!=null&&r.propertyName))return zs(t,e);let a=t.oneOf.map((s,i)=>le(s,m(l({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(n=t.discriminator)==null?void 0:n.propertyName}", [${a.join(", ")}])`},"parseDiscriminator"),le=u((t,e={seen:new Map,path:[]},r)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let n=e.seen.get(t);if(n){if(n.r!==void 0)return n.r;if(e.depth===void 0||n.n>=e.depth)return"z.any()";n.n+=1}else n={r:void 0,n:0},e.seen.set(t,n);let a=y_(t,e);return r||(a=m_(t,a),e.withoutDefaults||(a=h_(t,a))),n.r=a,a},"parseSchema"),m_=u((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),h_=u((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),y_=u((t,e)=>ie.a.nullable(t)?f_(t,e):ie.an.object(t)?Tf(t,e):ie.an.array(t)?i_(t,e):ie.an.anyOf(t)?bf(t,e):ie.an.allOf(t)?cr(t,e):ie.a.discriminator(t)?g_(t,e):ie.a.oneOf(t)?zs(t,e):ie.a.not(t)?t_(t,e):ie.an.enum(t)?u_(t):ie.a.const(t)?o_(t):ie.a.multipleType(t)?e_(t,e):ie.a.primitive(t,"string")?d_(t):ie.a.primitive(t,"number")||ie.a.primitive(t,"integer")?l_(t):ie.a.primitive(t,"boolean")?Xv(t):ie.a.primitive(t,"null")?r_(t):ie.a.conditional(t)?c_(t,e):ie.a.ref(t)?p_(t):Qv(t),"selectParser"),ie={an:{object:u(t=>t.type==="object","object"),array:u(t=>t.type==="array","array"),anyOf:u(t=>t.anyOf!==void 0,"anyOf"),allOf:u(t=>t.allOf!==void 0,"allOf"),enum:u(t=>t.enum!==void 0,"enum")},a:{nullable:u(t=>t.nullable===!0,"nullable"),multipleType:u(t=>Array.isArray(t.type),"multipleType"),not:u(t=>t.not!==void 0,"not"),const:u(t=>t.const!==void 0,"const"),primitive:u((t,e)=>t.type===e,"primitive"),conditional:u(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:u(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:u(t=>t.oneOf!==void 0,"oneOf"),ref:u(t=>t.$ref!==void 0,"ref")}},v_=u(t=>{let e;try{e=new Function("z",`return ${t}`)(v)}catch(r){return{sucess:!1,error:`Failed to evaluate schema: ${(r instanceof Error?r:new Error(String(r))).message}`}}return e instanceof v.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),__=u(t=>le(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),b_=u(t=>{let e=__(t);e=e.replaceAll("errors: z.ZodError[]","errors");let r=v_(e);if(!r.sucess)throw new Xo(r.error);return r.value},"jsonSchemaToZod"),tr=u((t,e)=>{var r,n;if(e[U]&&t._def&&(t._def[U]=e[U]),((r=t._def)==null?void 0:r.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&tr(i[a],s)}),((n=t._def)==null?void 0:n.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&tr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let s=t._def.type;s&&tr(s,a)}else Array.isArray(a)&&a.forEach((s,i)=>{let o=t._def;o.typeName===S.ZodFirstPartyTypeKind.ZodTuple&&tr(o.items[i],s)})}},"applyZuiPropsRecursively"),gr=u(t=>{let e=b_(t);return tr(e,t),e},"jsonSchemaToZui"),Pf=class extends Ht.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){console.error("Uncaught error:",e,r)}render(){return this.state.hasError&&this.props.fallback?Ht.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};u(Pf,"ErrorBoundary");var Zt=Pf;function Ef(t,e){return r=>Ht.default.createElement(Zt,{fallback:e,fieldSchema:r.fieldSchema,path:r.path},Ht.default.createElement(t,l({},r)))}u(Ef,"withErrorBoundary");var Kr=u(t=>{var e=t,{components:r,fieldSchema:n,path:a,required:s,fallback:i}=e,o=Do(e,["components","fieldSchema","path","required","fallback"]),d,p;let{formData:y,disabled:T,hidden:k,handlePropertyChange:P,addArrayItem:D,removeArrayItem:z,formErrors:q,formValid:se}=Ho(n,a),V=(0,be.useMemo)(()=>at(y,a),[y,a]),H=(0,be.useMemo)(()=>Ag(r,n),[n,r]),{discriminator:W,discriminatedSchema:ce,discriminatorValue:Le}=Cg(n,a);if(!H||k===!0)return null;let{Component:Xe,type:Oe}=H,Te={type:Oe,componentID:H.id,scope:a.join("."),context:{path:a,readonly:!1,formData:y,formErrors:q,formValid:se,updateForm:P,updateFormData:u(Pe=>P([],Pe),"updateFormData")},onChange:u(Pe=>P(a,Pe),"onChange"),disabled:T,errors:q?.filter(Pe=>Pe.path===a)||[],label:((d=n[U])==null?void 0:d.title)||Ua(((p=a[a.length-1])==null?void 0:p.toString())||""),params:H.params,schema:n,zuiProps:n[U]};if(n.type==="array"&&Oe==="array"){let Pe=Xe,_e=Te.schema,Ee=Array.isArray(V)||typeof V=="object"?V:[],j=l(m(l({},Te),{type:Oe,schema:_e,data:Ee,addItem:u(Ce=>D(a,Ce),"addItem"),removeItem:u(Ce=>z(a,Ce),"removeItem")}),o);return Array.isArray(n.items)?null:be.default.createElement(Pe,m(l({key:Te.scope},j),{isArrayChild:j.isArrayChild}),Array.isArray(j.data)?j.data.map((Ce,ke)=>{let ze=[...a,ke.toString()];return be.default.createElement(Zt,{key:ze.join("."),fallback:i,fieldSchema:n.items,path:ze},be.default.createElement(Kr,{key:ze.join("."),components:r,fieldSchema:n.items,path:ze,required:s,isArrayChild:!0,index:ke,removeSelf:()=>z(a,ke),fallback:i}))}):[])}if(n.type==="object"&&Oe==="object"&&n.properties){let Pe=Xe,_e=l(m(l({},Te),{type:Oe,schema:Te.schema,data:V||{}}),o);return be.default.createElement(Pe,m(l({key:Te.scope},_e),{isArrayChild:_e.isArrayChild}),Object.entries(n.properties).map(([Ee,j])=>{var Ce;let ke=[...a,Ee];return be.default.createElement(Zt,{key:ke.join("."),fallback:i,fieldSchema:j,path:ke},be.default.createElement(Kr,{key:ke.join("."),components:r,fieldSchema:j,path:ke,required:((Ce=n.required)==null?void 0:Ce.includes(Ee))||!1,isArrayChild:!1,fallback:i}))}))}if(Oe==="discriminatedUnion"){let Pe=Xe,_e=l(m(l({},Te),{type:Oe,schema:Te.schema,data:V||{},discriminatorKey:W?.key||null,discriminatorLabel:Ua(W?.key||"Unknown"),discriminatorOptions:W?.values||null,discriminatorValue:Le,setDiscriminator:u(Ee=>{if(!W?.key){console.warn("No discriminator key found, cannot set discriminator");return}P(a,{[W.key]:Ee})},"setDiscriminator")}),o);return be.default.createElement(Pe,m(l({key:Te.scope},_e),{isArrayChild:_e.isArrayChild}),ce&&be.default.createElement(Zt,{key:a.join("."),fallback:i,fieldSchema:ce,path:a},be.default.createElement(Kr,{components:r,fieldSchema:ce,path:a,required:s,isArrayChild:!1,fallback:i})))}let da=Xe,fa=l(m(l({},Te),{type:Oe,schema:Te.schema,config:{},required:s,data:V,description:n.description}),o);return be.default.createElement(da,l({},fa))},"FormElementRenderer"),T_=u(({schema:t,components:e,onChange:r,value:n,disableValidation:a,fallback:s,dataTransform:i,onValidation:o})=>{let[d,p]=(0,Ne.useState)(n);return(0,Ne.useEffect)(()=>{r(d)},[d]),(0,Ne.useEffect)(()=>{let y=Ct(t);p(T=>qr(y,T))},[JSON.stringify(t),p]),Ne.default.createElement(Og,{formData:d,setFormData:p,formSchema:t,disableValidation:a||!1,dataTransform:i,onValidation:o},Ne.default.createElement(Zt,{fallback:s,fieldSchema:t,path:[]},Ne.default.createElement(Kr,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),P_={string:{},number:{slider:{id:"slider",params:v.object({})}},boolean:{switch:{id:"switch",params:v.object({})}},array:{},object:{},discriminatedUnion:{}},E_={errors:Wo,jsonSchemaToZui:gr,zuiToJsonSchema:Qn,objectToZui:jt,toTypescript:Gr,toTypescriptSchema:ms};var Ut=(t,e)=>{let r=t._def,n=e._def;if(r.typeName===S.ZodFirstPartyTypeKind.ZodObject&&n.typeName===S.ZodFirstPartyTypeKind.ZodObject){let a=r.shape(),s=n.shape();return S.object({...a,...s})}if(r.typeName===S.ZodFirstPartyTypeKind.ZodRecord&&n.typeName===S.ZodFirstPartyTypeKind.ZodRecord)return S.record(S.intersection(r.valueType,n.valueType));throw new Error("Cannot merge object schemas with record schemas")},xf=S;var ve=S.string().min(1),wf=S.object({text:ve}),kf=S.object({markdown:ve}),Of=S.object({imageUrl:ve}),Cf=S.object({audioUrl:ve}),If=S.object({videoUrl:ve}),Zf=S.object({fileUrl:ve,title:ve.optional()}),Af=S.object({latitude:S.number(),longitude:S.number(),address:S.string().optional(),title:S.string().optional()}),Rf=S.object({title:ve,subtitle:ve.optional(),imageUrl:ve.optional(),actions:S.array(S.object({action:S.enum(["postback","url","say"]),label:ve,value:ve}))}),Sf=S.object({text:ve,options:S.array(S.object({label:ve,value:ve}))}),x_=S.object({items:S.array(Rf)}),S_=S.union([S.object({type:S.literal("text"),payload:wf}),S.object({type:S.literal("markdown"),payload:kf}),S.object({type:S.literal("image"),payload:Of}),S.object({type:S.literal("audio"),payload:Cf}),S.object({type:S.literal("video"),payload:If}),S.object({type:S.literal("file"),payload:Zf}),S.object({type:S.literal("location"),payload:Af})]),w_=S.object({items:S.array(S_)}),k_={schema:kf},O_={text:{schema:wf},image:{schema:Of},audio:{schema:Cf},video:{schema:If},file:{schema:Zf},location:{schema:Af},carousel:{schema:x_},card:{schema:Rf},dropdown:{schema:Sf},choice:{schema:Sf},bloc:{schema:w_}};var mr="x-bot-id",Vs="x-bot-user-id",qs="x-integration-id",Gs="x-webhook-id",Ws="x-bp-configuration-type",hr="x-bp-configuration",yr="x-bp-operation",Js="x-bp-type";var Bf=require("browser-or-node");var Ft=console;function we(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function vr(t,e=8072,r=A_){if(!Bf.isNode)throw new Error("This function can only be called in Node.js");let a=require("http").createServer(async(s,i)=>{try{let o=await C_(s);if(o.path==="/health"){i.writeHead(200).end("ok");return}let d=await t(o);i.writeHead(d?.status??200,d?.headers??{}).end(d?.body??"{}")}catch(o){Ft.error("Error while handling request",{error:o?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:o?.message??"Internal error occured"}))}});return a.listen(e,()=>r(e)),a}async function C_(t){let e=await Z_(t),r={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),i=t.rawHeaders[a+1];r[s]=i}let n=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:n.pathname,query:I_(n.search,"?"),headers:r,method:t.method?.toUpperCase()??"GET"}}function I_(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Z_(t){return new Promise((e,r)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let n="";t.on("data",a=>n+=a.toString()),t.on("error",a=>r(a)),t.on("end",()=>e(n))})}function A_(t){Ft.info(`Listening on port ${t}`)}var la=require("@botpress/client");var te={};Zr(te,{mapValues:()=>B_,mergeRecords:()=>M_,pairs:()=>Ys,stripUndefinedProps:()=>D_,values:()=>R_});var Ys=t=>Object.entries(t),R_=t=>Object.values(t),B_=(t,e)=>Object.fromEntries(Ys(t).map(([r,n])=>[r,e(n,r)])),D_=t=>Object.fromEntries(Ys(t).filter(([,e])=>e!==void 0)),M_=(t,e,r)=>{let n=[...Object.keys(t),...Object.keys(e)],a=[...new Set(n)],s={};for(let i of a){let o=t[i],d=e[i];o&&d?s[i]=r(o,d):o?s[i]=o:d&&(s[i]=d)}return s};var Y={};Zr(Y,{safePush:()=>j_});var j_=(t,...e)=>t?[...t,...e]:[...e];var Df=t=>{let{name:e,version:r}=t,n={actions:{},events:{},channels:{}},a={name:e,version:r,entities:te.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=te.mapValues(t.entities,i=>i.schema);for(let[i,o]of Object.entries(t.definition.actions??{})){let d=o.input.schema.dereference(s),p=o.output.schema.dereference(s),y=t.actions?.[i]?.name??i;n.actions[y]={...o,...t.actions?.[i]??{},input:{schema:d},output:{schema:p}},a.actions[i]={name:y}}for(let[i,o]of Object.entries(t.definition.events??{})){let d=o.schema.dereference(s),p=t.events?.[i]?.name??i;n.events[p]={...o,...t.events?.[i]??{},schema:d},a.events[i]={name:p}}for(let[i,o]of Object.entries(t.definition.channels??{})){let d={};for(let[y,T]of Object.entries(o.messages)){let k=T.schema.dereference(s);d[y]={...T,schema:k}}let p=t.channels?.[i]?.name??i;n.channels[p]={...o,...t.channels?.[i]??{},message:{...o.message??{},tags:{...o.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...o.conversation??{},tags:{...o.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:d},a.channels[i]={name:p}}return{resolved:n,statement:a}};var ea=Symbol("schemaName"),Mf=t=>t?te.mapValues(t,(r,n)=>({...r,[ea]:n})):{},jf=t=>ea in t&&t[ea]!==void 0,Hf=t=>t[ea];var ta=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;extend(e,r){let{entities:n,actions:a,events:s,channels:i}=this._callBuilder(e,r),o=this;o.interfaces??={};let d=Object.values(n).map(k=>k.name),p=d.length===0?e.name:`${e.name}<${d.join(",")}>`,{resolved:y,statement:T}=Df({...e,entities:n,actions:te.stripUndefinedProps(a),events:te.stripUndefinedProps(s),channels:te.stripUndefinedProps(i)});return o.actions=te.mergeRecords(o.actions??{},y.actions,this._mergeActions),o.channels=te.mergeRecords(o.channels??{},y.channels,this._mergeChannels),o.events=te.mergeRecords(o.events??{},y.events,this._mergeEvents),o.interfaces[p]={id:e.id,...T},this}_callBuilder(e,r){let a={entities:Mf(this.entities)},s=r(a),i=te.pairs(s.entities).find(([d,p])=>!jf(p));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:te.mapValues(s.entities,d=>({name:Hf(d),schema:d.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,r)=>({...e,...r,input:{schema:Ut(e.input.schema,r.input.schema)},output:{schema:Ut(e.input.schema,r.output.schema)}});_mergeEvents=(e,r)=>({...e,...r,schema:Ut(e.schema,r.schema)});_mergeChannels=(e,r)=>{let n=te.mergeRecords(e.messages,r.messages,this._mergeMessage);return{...e,...r,messages:n}};_mergeMessage=(e,r)=>({schema:Ut(e.schema,r.schema)})};var vt=require("@botpress/client");var Nf=require("@botpress/client"),ra={retries:3,retryCondition:t=>Nf.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};var zt=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e)};var na=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};var H_=S.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),$f=t=>{let e=t[mr],r=t[Vs],n=t[qs],a=t[Gs],s=t[Ws],i=t[hr],o=H_.parse(t[yr]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing bot user headers");if(!n)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,botUserId:r,integrationId:n,webhookId:a,operation:o,configurationType:s??null,configuration:i?JSON.parse(Buffer.from(i,"base64").toString("utf-8")):{}}};var Uf=et(require("util")),Kt=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,r){this._getConsoleMethod(e)(this._serializeMessage(r))}_serializeMessage(e){let r=Uf.default.format(...e);return process.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(r):r}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var Je=class extends Kt{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Je({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};var Ff=t=>async e=>{let r=$f(e.headers),n=new vt.Client({botId:r.botId,integrationId:r.integrationId,retry:ra}),a=new zt(n),s=new Je,i={ctx:r,req:e,client:a,logger:s,instance:t};try{let o;switch(r.operation){case"webhook_received":o=await $_(i);break;case"register":o=await U_(i);break;case"unregister":o=await F_(i);break;case"message_created":o=await K_(i);break;case"action_triggered":o=await V_(i);break;case"ping":o=await N_(i);break;case"create_user":o=await L_(i);break;case"create_conversation":o=await z_(i);break;default:throw new Error(`Unknown operation ${r.operation}`)}return o?{...o,status:o.status??200}:{status:200}}catch(o){if((0,vt.isApiError)(o)){let p=o.type==="Runtime"?o:new vt.RuntimeError(o.message,o);return s.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(o);let d=new vt.RuntimeError("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return s.forBot().error(d.message),{status:d.code,body:JSON.stringify(d.toJSON())}}},N_=async t=>{},$_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{let{req:s}=we(r);return a.webhook({client:t,ctx:e,req:s,logger:n})},U_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=we(r);await a.register({client:t,ctx:e,webhookUrl:s,logger:n})},F_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=we(r);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:n})},L_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createUser)return;let{tags:s}=we(r);return await a.createUser({ctx:e,client:t,tags:s,logger:n})},z_=async({client:t,ctx:e,req:r,logger:n,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:i}=we(r);return await a.createConversation({ctx:e,client:t,channel:s,tags:i,logger:n})},K_=async({ctx:t,req:e,client:r,logger:n,instance:a})=>{let{conversation:s,user:i,type:o,payload:d,message:p}=we(e),y=a.channels[s.channel];if(!y)throw new Error(`Channel ${s.channel} not found`);let T=y.messages[o];if(!T)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await T({ctx:t,conversation:s,message:p,user:i,type:o,client:r,payload:d,ack:async({tags:P})=>{await r.updateMessage({id:p.id,tags:P})},logger:n})},V_=async({req:t,ctx:e,client:r,logger:n,instance:a})=>{let{input:s,type:i}=we(t);if(!i)throw new Error("Missing action type");let o=a.actions[i];if(!o)throw new Error(`Action ${i} not found`);let d=new na,y={output:await o({ctx:e,input:s,client:r,type:i,logger:n,metadata:d}),meta:d.toJSON()};return{body:JSON.stringify(y)}};var aa=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=Ff(this);start=e=>vr(this.handler,e)};var sa=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;addIntegration(e,r){let n=this;return n.integrations||(n.integrations={}),n.integrations[e.name]={enabled:r.enabled,...e,configurationType:r.configurationType,configuration:r.configuration},this}addPlugin(e,r){let n=this;return n.plugins||(n.plugins={}),n.plugins[e.name]={...e,configuration:r.configuration,interfaces:r.interfaces},n.user=this._mergeUser(n.user,e.definition.user),n.conversation=this._mergeConversation(n.conversation,e.definition.conversation),n.message=this._mergeMessage(n.message,e.definition.message),n.states=this._mergeStates(n.states,e.definition.states),n.events=this._mergeEvents(n.events,e.definition.events),n.recurringEvents=this._mergeRecurringEvents(n.recurringEvents,e.definition.recurringEvents),n.actions=this._mergeActions(n.actions,e.definition.actions),n.tables=this._mergeTables(n.tables,e.definition.tables),this}_mergeUser=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeConversation=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeMessage=(e,r)=>({tags:{...e?.tags,...r?.tags}});_mergeStates=(e,r)=>({...e,...r});_mergeEvents=(e,r)=>({...e,...r});_mergeRecurringEvents=(e,r)=>({...e,...r});_mergeActions=(e,r)=>({...e,...r});_mergeTables=(e,r)=>({...e,...r})};var zf=et(require("@botpress/client"));var Ye=class extends Kt{constructor(e){super({...e})}with(e){return new Ye({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}};var Ze=class{constructor(e,r={before:{},after:{}}){this._client=e;this._hooks=r}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,r)=>{let n=this._hooks.before[e];n&&(r=await n(r));let a=await this._client[e](r),s=this._hooks.after[e];return s&&(a=await s(a)),a}};var q_=S.enum(["event_received","register","unregister","ping","action_triggered"]),Lf=t=>{let e=t[mr],r=t[hr],n=t[Js],a=q_.parse(t[yr]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing type headers");if(!r)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:n,configuration:r?JSON.parse(Buffer.from(r,"base64").toString("utf-8")):{}}};var Ae={status:200},Kf=t=>async e=>{let r=Lf(e.headers),n=new Ye,a=new zf.Client({botId:r.botId,retry:ra}),s=new Ze(a,{before:{createMessage:async o=>{let d=t.hookHandlers.before_outgoing_message[o.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o},callAction:async o=>{let d=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o}},after:{createMessage:async o=>{let d=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o},callAction:async o=>{let d=t.hookHandlers.after_outgoing_call_action[o.output.type]??[];for(let p of d)o=(await p({client:new Ze(a),ctx:r,logger:n,data:o}))?.data??o;return o}}}),i={req:e,ctx:r,logger:n,client:s,self:t};switch(r.operation){case"action_triggered":return await X_(i);case"event_received":return await Y_(i);case"register":return await W_(i);case"unregister":return await J_(i);case"ping":return await G_(i);default:throw new Error(`Unknown operation ${r.operation}`)}},G_=async({ctx:t})=>(Ft.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),Ae),W_=async t=>Ae,J_=async t=>Ae,Y_=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let s={client:n,ctx:t,logger:e};Ft.debug(`Received event ${t.type}`);let i=we(r);if(t.type==="message_created"){let k=i.event,P=k.payload.message,D=a.hookHandlers.before_incoming_message[P.type]??[];for(let V of D){let H=await V({...s,data:P});if(P=H?.data??P,H?.stop)return Ae}let z={...s,user:k.payload.user,conversation:k.payload.conversation,states:k.payload.states,message:P,event:k},q=a.messageHandlers[P.type]??[];for(let V of q)await V(z);let se=a.hookHandlers.after_incoming_message[P.type]??[];for(let V of se){let H=await V({...s,data:P});if(P=H?.data??P,H?.stop)return Ae}return Ae}if(t.type==="state_expired"){let P=i.event.payload.state,D={...s,state:P},z=a.stateExpiredHandlers["*"]??[];for(let q of z)await q(D);return Ae}let o=i.event,d=a.hookHandlers.before_incoming_event[o.type]??[];for(let k of d){let P=await k({...s,data:o});if(o=P?.data??o,P?.stop)return Ae}let p={...s,event:o},y=a.eventHandlers[o.type]??[];for(let k of y)await k(p);let T=a.hookHandlers.after_incoming_event[o.type]??[];for(let k of T){let P=await k({...s,data:o});if(o=P?.data??o,P?.stop)return Ae}return Ae},X_=async({ctx:t,logger:e,req:r,client:n,self:a})=>{let{input:s,type:i}=we(r);if(!i)throw new Error("Missing action type");let o=a.actionHandlers[i];if(!o)throw new Error(`Action ${i} not found`);let p={output:await o({ctx:t,logger:e,input:s,client:n,type:i})};return{status:200,body:JSON.stringify(p)}};var ia=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_plugins={};get actionHandlers(){let e=this._actionHandlers,r=Object.values(this._plugins).reduce((n,a)=>({...n,...a.actionHandlers}),{});return{...e,...r}}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.messageHandlers[r]??[]);return[...s,...i]}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._eventHandlers[r]??[],a=this._eventHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.eventHandlers[r]??[]);return[...s,...i]}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[],s=[...n,...a],i=Object.values(this._plugins).flatMap(o=>o.stateExpiredHandlers[r]??[]);return[...s,...i]}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>new Proxy({},{get:(n,a)=>{let s=r,i=this._hookHandlers[s]??{},o=i[a]??[],d=i["*"]??[],p=[...o,...d],y=Object.values(this._plugins).flatMap(T=>T.hookHandlers[s]?.[a]??[]);return[...p,...y]}})})}on={message:(e,r)=>{this._messageHandlers[e]=Y.safePush(this._messageHandlers[e],r)},event:(e,r)=>{this._eventHandlers[e]=Y.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=Y.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=Y.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=Y.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=Y.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=Y.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=Y.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=Y.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=Y.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=Y.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};handler=Kf(this);start=e=>vr(this.handler,e)};var oa=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.entities=e.entities??{};let r=this._getEntityReference(this.entities),n=e.events===void 0?{}:te.mapValues(e.events,i=>({...i,schema:i.schema(r)})),a=e.actions===void 0?{}:te.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(r)},output:{...i.output,schema:i.output.schema(r)}})),s=e.channels===void 0?{}:te.mapValues(e.channels,i=>({...i,messages:te.mapValues(i.messages,o=>({...o,schema:o.schema(r)}))}));this.events=n,this.actions=a,this.channels=s}name;version;entities;events;actions;channels;_getEntityReference=e=>{let r={};for(let[n,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,i=a.schema._def.description,o=xf.ref(n);s&&o.title(s),i&&o.describe(i),r[n]=o}return r}};var ua=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables}name;version;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables};var Xs=":";var Vf=t=>{let[e,r]=t.split(Xs);return!e||!r?null:{namespace:e,eventName:r}},qf=t=>`${t.namespace}${Xs}${t.actionName}`,Gf=t=>`${t.namespace}${Xs}${t.eventName}`,Wf=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.actions[t.actionName]?.name??t.actionName;return{namespace:n,actionName:a}},Jf=(t,e)=>{let r=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},n=r.name,a=r.events[t.eventName]?.name??t.eventName;return{namespace:n,eventName:a}};var Yf=(t,e)=>new Proxy({},{get:(r,n)=>new Proxy({},{get:(a,s)=>i=>Q_({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:s,input:i})})}),Q_=async({client:t,interfaces:e,integrationOrInterfaceName:r,methodName:n,input:a})=>{let s=Wf({namespace:r,actionName:n},e),i=qf(s);return(await t.callAction({type:i,input:a})).output};var ca=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:r,interfaces:n}=this._runtime,a=Yf(e,n);return{configuration:r,interfaces:n,actions:a}}get actionHandlers(){let e=this._actionHandlers,r={};for(let[n,a]of te.pairs(e))r[n]=async s=>a({...s,...this._getTools(s.client)});return r}get messageHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._messageHandlers[r]??[],a=this._messageHandlers["*"]??[];return[...n,...a].map(i=>o=>i({...o,...this._getTools(o.client)}))}})}get eventHandlers(){return new Proxy({},{get:(e,r)=>{let n=Object.entries(this._eventHandlers).filter(([i])=>this._eventResolvesTo(i,r)).flatMap(([,i])=>i??[]),a=this._eventHandlers["*"]??[];return[...n,...a].map(i=>o=>i({...o,...this._getTools(o.client)}))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._stateExpiredHandlers[r]??[],a=this._stateExpiredHandlers["*"]??[];return[...n,...a].map(i=>o=>i({...o,...this._getTools(o.client)}))}})}get hookHandlers(){return new Proxy({},{get:(e,r)=>{let n=this._hookHandlers[r];if(n)return new Proxy({},{get:(a,s)=>{let i=n[s]??[],o=n["*"]??[];return[...i,...o].map(p=>y=>p({...y,...this._getTools(y.client)}))}})}})}on={message:(e,r)=>{this._messageHandlers[e]=Y.safePush(this._messageHandlers[e],r)},event:(e,r)=>{this._eventHandlers[e]=Y.safePush(this._eventHandlers[e],r)},stateExpired:(e,r)=>{this._stateExpiredHandlers[e]=Y.safePush(this._stateExpiredHandlers[e],r)},beforeIncomingEvent:(e,r)=>{this._hookHandlers.before_incoming_event[e]=Y.safePush(this._hookHandlers.before_incoming_event[e],r)},beforeIncomingMessage:(e,r)=>{this._hookHandlers.before_incoming_message[e]=Y.safePush(this._hookHandlers.before_incoming_message[e],r)},beforeOutgoingMessage:(e,r)=>{this._hookHandlers.before_outgoing_message[e]=Y.safePush(this._hookHandlers.before_outgoing_message[e],r)},beforeOutgoingCallAction:(e,r)=>{this._hookHandlers.before_outgoing_call_action[e]=Y.safePush(this._hookHandlers.before_outgoing_call_action[e],r)},afterIncomingEvent:(e,r)=>{this._hookHandlers.after_incoming_event[e]=Y.safePush(this._hookHandlers.after_incoming_event[e],r)},afterIncomingMessage:(e,r)=>{this._hookHandlers.after_incoming_message[e]=Y.safePush(this._hookHandlers.after_incoming_message[e],r)},afterOutgoingMessage:(e,r)=>{this._hookHandlers.after_outgoing_message[e]=Y.safePush(this._hookHandlers.after_outgoing_message[e],r)},afterOutgoingCallAction:(e,r)=>{this._hookHandlers.after_outgoing_call_action[e]=Y.safePush(this._hookHandlers.after_outgoing_call_action[e],r)}};_eventResolvesTo=(e,r)=>{let n=Vf(e);if(!n)return!1;let a=Jf(n,this._runtime.interfaces);return Gf(a)===r}};0&&(module.exports={BRAND,Bot,BotDefinition,BotLogger,BotSpecificClient,DIRTY,EMPTY_PATH,ErrorBoundary,INVALID,Integration,IntegrationDefinition,IntegrationLogger,IntegrationSpecificClient,InterfaceDefinition,NEVER,OK,ParseInputLazyPath,ParseStatus,Plugin,PluginDefinition,RuntimeError,Schema,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,ZodFirstPartyTypeKind,ZodFunction,ZodIntersection,ZodIssueCode,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodRef,ZodSchema,ZodSet,ZodString,ZodSymbol,ZodTransformer,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,ZuiForm,addIssueToContext,agent,aimodel,any,array,bigint,boolean,botIdHeader,botUserIdHeader,coerce,configurationHeader,configurationTypeHeader,conversation,createZodEnum,cuid2Regex,cuidRegex,custom,datasource,date,datetimeRegex,defaultComponentDefinitions,discriminatedUnion,effect,emailRegex,enum:null,errorUtil,event,fromJsonSchema,fromObject,function:null,getErrorMap,getParsedType,instanceof:null,integrationIdHeader,intent,intersection,ipv4Regex,ipv6Regex,isAborted,isApiError,isAsync,isDirty,isEmojiRegex,isValid,jsonSchemaToZui,knowledgebase,late,lazy,literal,makeIssue,map,mergeObjectSchemas,message,messages,nan,nativeEnum,never,null:null,nullable,number,object,objectToZui,objectUtil,oboolean,onumber,operationHeader,optional,ostring,parseBody,pipeline,preprocess,processCreateParams,promise,quotelessJson,readonly,record,ref,serve,set,setErrorMap,strictObject,string,symbol,table,tablerow,transformer,transforms,tuple,typeHeader,ulidRegex,undefined,union,unknown,user,util,uuidRegex,variable,void:null,webhookIdHeader,withErrorBoundary,z,zuiToJsonSchema});
|
|
90
|
+
/*! Bundled license information:
|
|
91
|
+
|
|
92
|
+
react/cjs/react.production.min.js:
|
|
93
|
+
(**
|
|
94
|
+
* @license React
|
|
95
|
+
* react.production.min.js
|
|
96
|
+
*
|
|
97
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the MIT license found in the
|
|
100
|
+
* LICENSE file in the root directory of this source tree.
|
|
101
|
+
*)
|
|
102
|
+
|
|
103
|
+
react/cjs/react.development.js:
|
|
104
|
+
(**
|
|
105
|
+
* @license React
|
|
106
|
+
* react.development.js
|
|
107
|
+
*
|
|
108
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the MIT license found in the
|
|
111
|
+
* LICENSE file in the root directory of this source tree.
|
|
112
|
+
*)
|
|
113
|
+
|
|
114
|
+
@bpinternal/zui/dist/index.js:
|
|
115
|
+
(*! Bundled license information:
|
|
116
|
+
|
|
117
|
+
lodash-es/lodash.js:
|
|
118
|
+
(**
|
|
119
|
+
* @license
|
|
120
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
121
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
122
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
123
|
+
* Released under MIT license <https://lodash.com/license>
|
|
124
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
125
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
126
|
+
*)
|
|
127
|
+
*)
|
|
128
|
+
*/
|
|
129
|
+
//# sourceMappingURL=index.cjs.map
|