@microsoft/agents-copilotstudio-client 1.1.0-alpha.85 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var Os=Object.create;var uo=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Zs=Object.getOwnPropertyNames;var js=Object.getPrototypeOf,ks=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Es=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zs(e))!ks.call(t,o)&&o!==r&&uo(t,o,{get:()=>e[o],enumerable:!(n=Ps(e,o))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Os(js(t)):{},Es(e||!t||!t.__esModule?uo(r,"default",{value:t,enumerable:!0}):r,t));var mo=y((tl,ho)=>{var Je=1e3,Ye=Je*60,Xe=Ye*60,Te=Xe*24,qs=Te*7,Fs=Te*365.25;ho.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Vs(t);if(r==="number"&&isFinite(t))return e.long?Ws(t):$s(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Vs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Fs;case"weeks":case"week":case"w":return r*qs;case"days":case"day":case"d":return r*Te;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Xe;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ye;case"seconds":case"second":case"secs":case"sec":case"s":return r*Je;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function $s(t){var e=Math.abs(t);return e>=Te?Math.round(t/Te)+"d":e>=Xe?Math.round(t/Xe)+"h":e>=Ye?Math.round(t/Ye)+"m":e>=Je?Math.round(t/Je)+"s":t+"ms"}function Ws(t){var e=Math.abs(t);return e>=Te?nr(t,e,Te,"day"):e>=Xe?nr(t,e,Xe,"hour"):e>=Ye?nr(t,e,Ye,"minute"):e>=Je?nr(t,e,Je,"second"):t+" ms"}function nr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var vo=y((rl,yo)=>{function Hs(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=mo(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let m=0;for(let _=0;_<f.length;_++)m=(m<<5)-m+f.charCodeAt(_),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,_=null,T,O;function g(...S){if(!g.enabled)return;let A=g,q=Number(new Date),te=q-(m||q);A.diff=te,A.prev=m,A.curr=q,m=q,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ye=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(re,Pt)=>{if(re==="%%")return"%";ye++;let Zt=r.formatters[Pt];if(typeof Zt=="function"){let $r=S[ye];re=Zt.call(A,$r),S.splice(ye,1),ye--}return re}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(T!==r.namespaces&&(T=r.namespaces,O=r.enabled(f)),O),set:S=>{_=S}}),typeof r.init=="function"&&r.init(g),g}function n(f,m){let _=r(this.namespace+(typeof m=="undefined"?":":m)+f);return _.log=this.log,_}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of m)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function i(f,m){let _=0,T=0,O=-1,g=0;for(;_<f.length;)if(T<m.length&&(m[T]===f[_]||m[T]==="*"))m[T]==="*"?(O=T,g=_,T++):(_++,T++);else if(O!==-1)T=O+1,g++,_=g;else return!1;for(;T<m.length&&m[T]==="*";)T++;return T===m.length}function s(){let f=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),f}function a(f){for(let m of r.skips)if(i(f,m))return!1;for(let m of r.names)if(i(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}yo.exports=Hs});var go=y((V,or)=>{V.formatArgs=Ks;V.save=Gs;V.load=Js;V.useColors=Bs;V.storage=Ys();V.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Bs(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ks(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+or.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function Gs(t){try{t?V.storage.setItem("debug",t):V.storage.removeItem("debug")}catch{}}function Js(){let t;try{t=V.storage.getItem("debug")||V.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ys(){try{return localStorage}catch{}}or.exports=vo()(V);var{formatters:Xs}=or.exports;Xs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(Se=>{"use strict";var Qs=Se&&Se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Se,"__esModule",{value:!0});Se.Logger=void 0;Se.debug=ra;var ea=Qs(go()),ta=["info","warn","error","debug"],ir=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of ta){let n=(0,ea.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};Se.Logger=ir;function ra(t){return new ir(t)}});var Dt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Gr;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Gr||(k.util=Gr={}));var wo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(wo||(k.objectUtil=wo={}));k.ZodParsedType=Gr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var sa=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=sa});var dr=y(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.ZodError=ve.quotelessJson=ve.ZodIssueCode=void 0;var Co=Dt();ve.ZodIssueCode=Co.util.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"]);var aa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ve.quotelessJson=aa;var zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,d=0;for(;d<s.path.length;){let l=s.path[d];d===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Co.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ve.ZodError=zt;zt.create=t=>new zt(t)});var Yr=y(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var M=dr(),Ae=Dt(),ca=(t,e)=>{let r;switch(t.code){case M.ZodIssueCode.invalid_type:t.received===Ae.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case M.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.util.jsonStringifyReplacer)}`;break;case M.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.util.joinValues(t.keys,", ")}`;break;case M.ZodIssueCode.invalid_union:r="Invalid input";break;case M.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.util.joinValues(t.options)}`;break;case M.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.util.joinValues(t.options)}, received '${t.received}'`;break;case M.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case M.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case M.ZodIssueCode.invalid_date:r="Invalid date";break;case M.ZodIssueCode.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}"`:Ae.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case M.ZodIssueCode.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==="bigint"?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 M.ZodIssueCode.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 M.ZodIssueCode.custom:r="Invalid input";break;case M.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case M.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case M.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ae.util.assertNever(t)}return{message:r}};Jr.default=ca});var lr=y(ge=>{"use strict";var ua=ge&&ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});ge.defaultErrorMap=void 0;ge.setErrorMap=da;ge.getErrorMap=la;var Io=ua(Yr());ge.defaultErrorMap=Io.default;var To=Io.default;function da(t){To=t}function la(){return To}});var Qr=y(Z=>{"use strict";var fa=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Z,"__esModule",{value:!0});Z.isAsync=Z.isValid=Z.isDirty=Z.isAborted=Z.OK=Z.DIRTY=Z.INVALID=Z.ParseStatus=Z.EMPTY_PATH=Z.makeIssue=void 0;Z.addIssueToContext=ma;var pa=lr(),So=fa(Yr()),ha=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",d=n.filter(l=>!!l).slice().reverse();for(let l of d)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};Z.makeIssue=ha;Z.EMPTY_PATH=[];function ma(t,e){let r=(0,pa.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===So.default?void 0:So.default].filter(o=>!!o)});t.common.issues.push(n)}var Xr=class t{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 o of r){if(o.status==="aborted")return Z.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Z.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};Z.ParseStatus=Xr;Z.INVALID=Object.freeze({status:"aborted"});var ya=t=>({status:"dirty",value:t});Z.DIRTY=ya;var va=t=>({status:"valid",value:t});Z.OK=va;var ga=t=>t.status==="aborted";Z.isAborted=ga;var _a=t=>t.status==="dirty";Z.isDirty=_a;var ba=t=>t.status==="valid";Z.isValid=ba;var xa=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=xa});var Oo=y(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0})});var Zo=y(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.errorUtil=void 0;var Po;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Po||(fr.errorUtil=Po={}))});var Fo=y(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.discriminatedUnion=c.date=c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=void 0;c.datetimeRegex=Ro;c.custom=No;var p=dr(),pr=lr(),v=Zo(),u=Qr(),h=Dt(),K=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},jo=(t,e)=>{if((0,u.isValid)(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 p.ZodError(t.common.issues);return this._error=r,this._error}}};function C(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(s,a)=>{var l,f;let{message:d}=t;return s.code==="invalid_enum_value"?{message:d!=null?d:a.defaultError}:typeof a.data=="undefined"?{message:(l=d!=null?d:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(f=d!=null?d:r)!=null?f:a.defaultError}},description:o}}var I=class{get description(){return this._def.description}_getType(e){return(0,h.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,u.isAsync)(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 i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return jo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues})}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==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return jo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new H({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return B.create(this,this._def)}nullable(){return se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xe.create(this,this._def)}or(e){return Ue.create([this,e],this._def)}and(e){return Re.create(this,e,this._def)}transform(e){return new H({...C(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Le({...C(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new Lt({typeName:w.ZodBranded,type:this,...C(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new qe({...C(this._def),innerType:this,catchValue:r,typeName:w.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qt.create(this,e)}readonly(){return Fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=I;c.Schema=I;c.ZodSchema=I;var wa=/^c[^\s-]{8,}$/i,Ca=/^[0-9a-z]+$/,Ia=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ta=/^[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,Sa=/^[a-z0-9_-]{21}$/i,Aa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Oa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Za="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",en,ja=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ka=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ea=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ua=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ra=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ma=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Eo="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Na=new RegExp(`^${Eo}$`);function Uo(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Da(t){return new RegExp(`^${Uo(t)}$`)}function Ro(t){let e=`${Eo}T${Uo(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function za(t,e){return!!((e==="v4"||!e)&&ja.test(t)||(e==="v6"||!e)&&Ea.test(t))}function La(t,e){if(!Aa.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function qa(t,e){return!!((e==="v4"||!e)&&ka.test(t)||(e==="v6"||!e)&&Ua.test(t))}var _e=class t extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Pa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"email",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")en||(en=new RegExp(Za,"u")),en.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ta.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Sa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Ca.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ia.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ro(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Na.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Da(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Oa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?za(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?La(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"jwt",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?qa(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cidr",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ra.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ma.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}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}};c.ZodString=_e;_e.create=t=>{var e;return new _e({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};function Fa(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Oe=class t extends I{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)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Fa(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.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"&&h.util.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)}};c.ZodNumber=Oe;Oe.create=t=>new Oe({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var Pe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.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}};c.ZodBigInt=Pe;Pe.create=t=>{var e;return new Pe({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};var Ze=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ze;Ze.create=t=>new Ze({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var je=class t extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),u.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.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}};c.ZodDate=je;je.create=t=>new je({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...C(t)});var tt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=tt;tt.create=t=>new tt({typeName:w.ZodSymbol,...C(t)});var ke=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=ke;ke.create=t=>new ke({typeName:w.ZodUndefined,...C(t)});var Ee=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=Ee;Ee.create=t=>new Ee({typeName:w.ZodNull,...C(t)});var be=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=be;be.create=t=>new be({typeName:w.ZodAny,...C(t)});var de=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=de;de.create=t=>new de({typeName:w.ZodUnknown,...C(t)});var X=class extends I{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=X;X.create=t=>new X({typeName:w.ZodNever,...C(t)});var rt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=rt;rt.create=t=>new rt({typeName:w.ZodVoid,...C(t)});var le=class t extends I{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new K(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new K(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=le;le.create=(t,e)=>new le({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...C(e)});function et(t){if(t instanceof $){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=B.create(et(n))}return new $({...t._def,shape:()=>e})}else return t instanceof le?new le({...t._def,type:et(t.element)}):t instanceof B?B.create(et(t.unwrap())):t instanceof se?se.create(et(t.unwrap())):t instanceof ie?ie.create(t.items.map(e=>et(e))):t}var $=class t extends I{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=h.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],m=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new K(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof X){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let m=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new K(o,m,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let m=await f.key,_=await f.value;l.push({key:m,value:_,alwaysSet:f.alwaysSet})}return l}).then(l=>u.ParseStatus.mergeObjectSync(n,l)):u.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,d;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(d=v.errorUtil.errToObj(e).message)!=null?d:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of h.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of h.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of h.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof B;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Mo(h.util.objectKeys(this.shape))}};c.ZodObject=$;$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...C(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:X.create(),typeName:w.ZodObject,...C(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...C(e)});var Ue=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Ue;Ue.create=(t,e)=>new Ue({options:t,typeName:w.ZodUnion,...C(e)});var ue=t=>t instanceof Me?ue(t.schema):t instanceof H?ue(t.innerType()):t instanceof Ne?[t.value]:t instanceof De?t.options:t instanceof ze?h.util.objectValues(t.enum):t instanceof Le?ue(t._def.innerType):t instanceof ke?[void 0]:t instanceof Ee?[null]:t instanceof B?[void 0,...ue(t.unwrap())]:t instanceof se?[null,...ue(t.unwrap())]:t instanceof Lt||t instanceof Fe?ue(t.unwrap()):t instanceof qe?ue(t._def.innerType):[],hr=class t extends I{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),u.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ue(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...C(n)})}};c.ZodDiscriminatedUnion=hr;function tn(t,e){let r=(0,h.getParsedType)(t),n=(0,h.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(e),i=h.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=tn(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=tn(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Re=class extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,u.isAborted)(i)||(0,u.isAborted)(s))return u.INVALID;let a=tn(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};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(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=Re;Re.create=(t,e,r)=>new Re({left:t,right:e,typeName:w.ZodIntersection,...C(r)});var ie=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new K(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ie;ie.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:t,typeName:w.ZodTuple,rest:null,...C(e)})};var mr=class t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new K(n,a,n.path,a)),value:s._parse(new K(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof I?new t({keyType:e,valueType:r,typeName:w.ZodRecord,...C(n)}):new t({keyType:_e.create(),valueType:e,typeName:w.ZodRecord,...C(r)})}};c.ZodRecord=mr;var nt=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new K(n,a,n.path,[l,"key"])),value:i._parse(new K(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=nt;nt.create=(t,e,r)=>new nt({valueType:e,keyType:t,typeName:w.ZodMap,...C(r)});var ot=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new K(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ot;ot.create=(t,e)=>new ot({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...C(e)});var yr=class t extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),u.INVALID;function n(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function o(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof xe){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(T=>{throw l.addIssue(n(d,T)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(T=>{throw l.addIssue(o(m,T)),l})})}else{let a=this;return(0,u.OK)(function(...d){let l=a._def.args.safeParse(d,i);if(!l.success)throw new p.ZodError([n(d,l.error)]);let f=Reflect.apply(s,this,l.data),m=a._def.returns.safeParse(f,i);if(!m.success)throw new p.ZodError([o(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ie.create(e).rest(de.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ie.create([]).rest(de.create()),returns:r||de.create(),typeName:w.ZodFunction,...C(n)})}};c.ZodFunction=yr;var Me=class extends I{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})}};c.ZodLazy=Me;Me.create=(t,e)=>new Me({getter:t,typeName:w.ZodLazy,...C(e)});var Ne=class extends I{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Ne;Ne.create=(t,e)=>new Ne({value:t,typeName:w.ZodLiteral,...C(e)});function Mo(t,e){return new De({values:t,typeName:w.ZodEnum,...C(e)})}var De=class t extends I{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return(0,u.OK)(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 t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};c.ZodEnum=De;De.create=Mo;var ze=class extends I{_parse(e){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:o}),u.INVALID}return(0,u.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=ze;ze.create=(t,e)=>new ze({values:t,typeName:w.ZodNativeEnum,...C(e)});var xe=class extends I{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,u.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c.ZodPromise=xe;xe.create=(t,e)=>new xe({type:t,typeName:w.ZodPromise,...C(e)});var H=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,u.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return u.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?u.INVALID:d.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(d.value):d});{if(r.value==="aborted")return u.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:a.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let d=o.refinement(a,i);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 a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,u.isValid)(s))return u.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,u.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):u.INVALID);h.util.assertNever(o)}};c.ZodEffects=H;c.ZodTransformer=H;H.create=(t,e,r)=>new H({schema:t,typeName:w.ZodEffects,effect:e,...C(r)});H.createWithPreprocess=(t,e,r)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...C(r)});var B=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=B;B.create=(t,e)=>new B({innerType:t,typeName:w.ZodOptional,...C(e)});var se=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=se;se.create=(t,e)=>new se({innerType:t,typeName:w.ZodNullable,...C(e)});var Le=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c.ZodDefault=Le;Le.create=(t,e)=>new Le({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var qe=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=qe;qe.create=(t,e)=>new qe({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var it=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=it;it.create=t=>new it({typeName:w.ZodNaN,...C(t)});c.BRAND=Symbol("zod_brand");var Lt=class extends I{_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}};c.ZodBranded=Lt;var qt=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?u.INVALID:i.status==="dirty"?(r.dirty(),(0,u.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?u.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:w.ZodPipeline})}};c.ZodPipeline=qt;var Fe=class extends I{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=Fe;Fe.create=(t,e)=>new Fe({innerType:t,typeName:w.ZodReadonly,...C(e)});function ko(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function No(t,e={},r){return t?be.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(d=>{var l,f;if(!d){let m=ko(e,n),_=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:_})}});if(!i){let d=ko(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):be.create()}c.late={object:$.lazycreate};var w;(function(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.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"})(w||(c.ZodFirstPartyTypeKind=w={}));var Va=(t,e={message:`Input not instance of ${t.name}`})=>No(r=>r instanceof t,e);c.instanceof=Va;var Do=_e.create;c.string=Do;var zo=Oe.create;c.number=zo;var $a=it.create;c.nan=$a;var Wa=Pe.create;c.bigint=Wa;var Lo=Ze.create;c.boolean=Lo;var Ha=je.create;c.date=Ha;var Ba=tt.create;c.symbol=Ba;var Ka=ke.create;c.undefined=Ka;var Ga=Ee.create;c.null=Ga;var Ja=be.create;c.any=Ja;var Ya=de.create;c.unknown=Ya;var Xa=X.create;c.never=Xa;var Qa=rt.create;c.void=Qa;var ec=le.create;c.array=ec;var tc=$.create;c.object=tc;var rc=$.strictCreate;c.strictObject=rc;var nc=Ue.create;c.union=nc;var oc=hr.create;c.discriminatedUnion=oc;var ic=Re.create;c.intersection=ic;var sc=ie.create;c.tuple=sc;var ac=mr.create;c.record=ac;var cc=nt.create;c.map=cc;var uc=ot.create;c.set=uc;var dc=yr.create;c.function=dc;var lc=Me.create;c.lazy=lc;var fc=Ne.create;c.literal=fc;var pc=De.create;c.enum=pc;var hc=ze.create;c.nativeEnum=hc;var mc=xe.create;c.promise=mc;var qo=H.create;c.effect=qo;c.transformer=qo;var yc=B.create;c.optional=yc;var vc=se.create;c.nullable=vc;var gc=H.createWithPreprocess;c.preprocess=gc;var _c=qt.create;c.pipeline=_c;var bc=()=>Do().optional();c.ostring=bc;var xc=()=>zo().optional();c.onumber=xc;var wc=()=>Lo().optional();c.oboolean=wc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>Oe.create({...t,coerce:!0})),boolean:(t=>Ze.create({...t,coerce:!0})),bigint:(t=>Pe.create({...t,coerce:!0})),date:(t=>je.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var rn=y(G=>{"use strict";var Cc=G&&G.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),st=G&&G.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cc(e,t,r)};Object.defineProperty(G,"__esModule",{value:!0});st(lr(),G);st(Qr(),G);st(Oo(),G);st(Dt(),G);st(Fo(),G);st(dr(),G)});var j=y(W=>{"use strict";var Vo=W&&W.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ic=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Tc=W&&W.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vo(e,t,r);return Ic(e,t),e},Sc=W&&W.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vo(e,t,r)};Object.defineProperty(W,"__esModule",{value:!0});W.z=void 0;var $o=Tc(rn());W.z=$o;Sc(rn(),W);W.default=$o});var nn=y(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.actionTypesZodSchema=at.ActionTypes=void 0;var Ac=j(),Wo;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})(Wo||(at.ActionTypes=Wo={}));at.actionTypesZodSchema=Ac.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var on=y(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.semanticActionStateTypesZodSchema=ct.SemanticActionStateTypes=void 0;var Oc=j(),Ho;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Ho||(ct.SemanticActionStateTypes=Ho={}));ct.semanticActionStateTypesZodSchema=Oc.z.enum(["start","continue","done"])});var sn=y(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.attachmentLayoutTypesZodSchema=ut.AttachmentLayoutTypes=void 0;var Pc=j(),Bo;(function(t){t.List="list",t.Carousel="carousel"})(Bo||(ut.AttachmentLayoutTypes=Bo={}));ut.attachmentLayoutTypesZodSchema=Pc.z.enum(["list","carousel"])});var an=y(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.Channels=void 0;var Ko;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Ko||(vr.Channels=Ko={}))});var cn=y(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.endOfConversationCodesZodSchema=dt.EndOfConversationCodes=void 0;var Zc=j(),Go;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Go||(dt.EndOfConversationCodes=Go={}));dt.endOfConversationCodesZodSchema=Zc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Yo=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.membershipSourceTypeZodSchema=lt.MembershipSourceTypes=void 0;var jc=j(),Jo;(function(t){t.Channel="channel",t.Team="team"})(Jo||(lt.MembershipSourceTypes=Jo={}));lt.membershipSourceTypeZodSchema=jc.z.enum(["channel","team"])});var Qo=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.membershipTypeZodSchema=ft.MembershipTypes=void 0;var kc=j(),Xo;(function(t){t.Direct="direct",t.Transitive="transitive"})(Xo||(ft.MembershipTypes=Xo={}));ft.membershipTypeZodSchema=kc.z.enum(["direct","transitive"])});var Ft=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.roleTypeZodSchema=pt.RoleTypes=void 0;var Ec=j(),ei;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(ei||(pt.RoleTypes=ei={}));pt.roleTypeZodSchema=Ec.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ti=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.addAIToActivity=void 0;var Uc=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};gr.addAIToActivity=Uc});var ri=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.adaptiveCardInvokeActionZodSchema=void 0;var Ve=j();_r.adaptiveCardInvokeActionZodSchema=Ve.z.object({type:Ve.z.string().min(1),id:Ve.z.string().optional(),verb:Ve.z.string().min(1),data:Ve.z.record(Ve.z.string().min(1),Ve.z.any())})});var ni=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var oi=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.default="00000000-0000-0000-0000-000000000000"});var ii=y(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var Vt=y(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var Rc=ii();function Mc(t){return typeof t=="string"&&Rc.default.test(t)}fn.default=Mc});var $t=y(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});var Nc=Vt();function Dc(t){if(!(0,Nc.default)(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}pn.default=Dc});var fe=y(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.unsafeStringify=void 0;var zc=Vt(),U=[];for(let t=0;t<256;++t)U.push((t+256).toString(16).slice(1));function si(t,e=0){return(U[t[e+0]]+U[t[e+1]]+U[t[e+2]]+U[t[e+3]]+"-"+U[t[e+4]]+U[t[e+5]]+"-"+U[t[e+6]]+U[t[e+7]]+"-"+U[t[e+8]]+U[t[e+9]]+"-"+U[t[e+10]]+U[t[e+11]]+U[t[e+12]]+U[t[e+13]]+U[t[e+14]]+U[t[e+15]]).toLowerCase()}Wt.unsafeStringify=si;function Lc(t,e=0){let r=si(t,e);if(!(0,zc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Wt.default=Lc});var br=y(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});var hn,qc=new Uint8Array(16);function Fc(){if(!hn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");hn=crypto.getRandomValues.bind(crypto)}return hn(qc)}mn.default=Fc});var yn=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.updateV1State=void 0;var ai=br(),Vc=fe(),Ht={};function $c(t,e,r){var i,s,a,d;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let l=Object.keys(t);l.length===1&&l[0]==="_v6"&&(t=void 0)}if(t)n=ci((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,ai.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,ai.default)();ui(Ht,l,f),n=ci(f,Ht.msecs,Ht.nsecs,o?void 0:Ht.clockseq,o?void 0:Ht.node,e,r)}return e!=null?e:(0,Vc.unsafeStringify)(n)}function ui(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.nsecs)!=null||(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}Bt.updateV1State=ui;function ci(t,e,r,n,o,i,s=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),s=0;else if(s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);e!=null||(e=Date.now()),r!=null||(r=0),n!=null||(n=(t[8]<<8|t[9])&16383),o!=null||(o=t.slice(10,16)),e+=122192928e5;let a=((e&268435455)*1e4+r)%4294967296;i[s++]=a>>>24&255,i[s++]=a>>>16&255,i[s++]=a>>>8&255,i[s++]=a&255;let d=e/4294967296*1e4&268435455;i[s++]=d>>>8&255,i[s++]=d&255,i[s++]=d>>>24&15|16,i[s++]=d>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let l=0;l<6;++l)i[s++]=o[l];return i}Bt.default=$c});var gn=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});var Wc=$t(),Hc=fe();function Bc(t){let e=typeof t=="string"?(0,Wc.default)(t):t,r=Kc(e);return typeof t=="string"?(0,Hc.unsafeStringify)(r):r}vn.default=Bc;function Kc(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var li=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});function Gc(t){let e=Xc(t),r=Yc(e,t.length*8);return Jc(r)}function Jc(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}function di(t){return(t+64>>>9<<4)+14+1}function Yc(t,e){let r=new Uint32Array(di(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,o=-271733879,i=-1732584194,s=271733878;for(let a=0;a<t.length;a+=16){let d=n,l=o,f=i,m=s;n=N(n,o,i,s,t[a],7,-680876936),s=N(s,n,o,i,t[a+1],12,-389564586),i=N(i,s,n,o,t[a+2],17,606105819),o=N(o,i,s,n,t[a+3],22,-1044525330),n=N(n,o,i,s,t[a+4],7,-176418897),s=N(s,n,o,i,t[a+5],12,1200080426),i=N(i,s,n,o,t[a+6],17,-1473231341),o=N(o,i,s,n,t[a+7],22,-45705983),n=N(n,o,i,s,t[a+8],7,1770035416),s=N(s,n,o,i,t[a+9],12,-1958414417),i=N(i,s,n,o,t[a+10],17,-42063),o=N(o,i,s,n,t[a+11],22,-1990404162),n=N(n,o,i,s,t[a+12],7,1804603682),s=N(s,n,o,i,t[a+13],12,-40341101),i=N(i,s,n,o,t[a+14],17,-1502002290),o=N(o,i,s,n,t[a+15],22,1236535329),n=D(n,o,i,s,t[a+1],5,-165796510),s=D(s,n,o,i,t[a+6],9,-1069501632),i=D(i,s,n,o,t[a+11],14,643717713),o=D(o,i,s,n,t[a],20,-373897302),n=D(n,o,i,s,t[a+5],5,-701558691),s=D(s,n,o,i,t[a+10],9,38016083),i=D(i,s,n,o,t[a+15],14,-660478335),o=D(o,i,s,n,t[a+4],20,-405537848),n=D(n,o,i,s,t[a+9],5,568446438),s=D(s,n,o,i,t[a+14],9,-1019803690),i=D(i,s,n,o,t[a+3],14,-187363961),o=D(o,i,s,n,t[a+8],20,1163531501),n=D(n,o,i,s,t[a+13],5,-1444681467),s=D(s,n,o,i,t[a+2],9,-51403784),i=D(i,s,n,o,t[a+7],14,1735328473),o=D(o,i,s,n,t[a+12],20,-1926607734),n=z(n,o,i,s,t[a+5],4,-378558),s=z(s,n,o,i,t[a+8],11,-2022574463),i=z(i,s,n,o,t[a+11],16,1839030562),o=z(o,i,s,n,t[a+14],23,-35309556),n=z(n,o,i,s,t[a+1],4,-1530992060),s=z(s,n,o,i,t[a+4],11,1272893353),i=z(i,s,n,o,t[a+7],16,-155497632),o=z(o,i,s,n,t[a+10],23,-1094730640),n=z(n,o,i,s,t[a+13],4,681279174),s=z(s,n,o,i,t[a],11,-358537222),i=z(i,s,n,o,t[a+3],16,-722521979),o=z(o,i,s,n,t[a+6],23,76029189),n=z(n,o,i,s,t[a+9],4,-640364487),s=z(s,n,o,i,t[a+12],11,-421815835),i=z(i,s,n,o,t[a+15],16,530742520),o=z(o,i,s,n,t[a+2],23,-995338651),n=L(n,o,i,s,t[a],6,-198630844),s=L(s,n,o,i,t[a+7],10,1126891415),i=L(i,s,n,o,t[a+14],15,-1416354905),o=L(o,i,s,n,t[a+5],21,-57434055),n=L(n,o,i,s,t[a+12],6,1700485571),s=L(s,n,o,i,t[a+3],10,-1894986606),i=L(i,s,n,o,t[a+10],15,-1051523),o=L(o,i,s,n,t[a+1],21,-2054922799),n=L(n,o,i,s,t[a+8],6,1873313359),s=L(s,n,o,i,t[a+15],10,-30611744),i=L(i,s,n,o,t[a+6],15,-1560198380),o=L(o,i,s,n,t[a+13],21,1309151649),n=L(n,o,i,s,t[a+4],6,-145523070),s=L(s,n,o,i,t[a+11],10,-1120210379),i=L(i,s,n,o,t[a+2],15,718787259),o=L(o,i,s,n,t[a+9],21,-343485551),n=we(n,d),o=we(o,l),i=we(i,f),s=we(s,m)}return Uint32Array.of(n,o,i,s)}function Xc(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(di(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}function we(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Qc(t,e){return t<<e|t>>>32-e}function xr(t,e,r,n,o,i){return we(Qc(we(we(e,t),we(n,i)),o),r)}function N(t,e,r,n,o,i,s){return xr(e&r|~e&n,t,e,o,i,s)}function D(t,e,r,n,o,i,s){return xr(e&n|r&~n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return xr(e^r^n,t,e,o,i,s)}function L(t,e,r,n,o,i,s){return xr(r^(e|~n),t,e,o,i,s)}_n.default=Gc});var Kt=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.URL=pe.DNS=pe.stringToBytes=void 0;var fi=$t(),eu=fe();function pi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}pe.stringToBytes=pi;pe.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";pe.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function tu(t,e,r,n,o,i){let s=typeof r=="string"?pi(r):r,a=typeof n=="string"?(0,fi.default)(n):n;if(typeof n=="string"&&(n=(0,fi.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+s.length);if(d.set(a),d.set(s,a.length),d=e(d),d[6]=d[6]&15|t,d[8]=d[8]&63|128,o){i=i||0;for(let l=0;l<16;++l)o[i+l]=d[l];return o}return(0,eu.unsafeStringify)(d)}pe.default=tu});var mi=y($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.URL=$e.DNS=void 0;var ru=li(),bn=Kt(),hi=Kt();Object.defineProperty($e,"DNS",{enumerable:!0,get:function(){return hi.DNS}});Object.defineProperty($e,"URL",{enumerable:!0,get:function(){return hi.URL}});function xn(t,e,r,n){return(0,bn.default)(48,ru.default,t,e,r,n)}xn.DNS=bn.DNS;xn.URL=bn.URL;$e.default=xn});var yi=y(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});var nu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);wn.default={randomUUID:nu}});var gi=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var vi=yi(),ou=br(),iu=fe();function su(t,e,r){var o,i,s;if(vi.default.randomUUID&&!e&&!t)return vi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ou.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return(0,iu.unsafeStringify)(n)}Cn.default=su});var _i=y(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});function au(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function In(t,e){return t<<e|t>>>32-e}function cu(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128,t=n;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let d=new Uint32Array(16);for(let l=0;l<16;++l)d[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=d}s[i-1][14]=(t.length-1)*8/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<i;++a){let d=new Uint32Array(80);for(let O=0;O<16;++O)d[O]=s[a][O];for(let O=16;O<80;++O)d[O]=In(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],_=r[3],T=r[4];for(let O=0;O<80;++O){let g=Math.floor(O/20),S=In(l,5)+au(g,f,m,_)+T+e[g]+d[O]>>>0;T=_,_=m,m=In(f,30)>>>0,f=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+T>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}Tn.default=cu});var xi=y(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.URL=We.DNS=void 0;var uu=_i(),Sn=Kt(),bi=Kt();Object.defineProperty(We,"DNS",{enumerable:!0,get:function(){return bi.DNS}});Object.defineProperty(We,"URL",{enumerable:!0,get:function(){return bi.URL}});function An(t,e,r,n){return(0,Sn.default)(80,uu.default,t,e,r,n)}An.DNS=Sn.DNS;An.URL=Sn.URL;We.default=An});var wi=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var du=fe(),lu=yn(),fu=gn();function pu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,lu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,fu.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,du.unsafeStringify)(n)}On.default=pu});var Ci=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});var hu=$t(),mu=fe();function yu(t){let e=typeof t=="string"?(0,hu.default)(t):t,r=vu(e);return typeof t=="string"?(0,mu.unsafeStringify)(r):r}Pn.default=yu;function vu(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var Ai=y(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.updateV7State=void 0;var Ii=br(),gu=fe(),Zn={};function _u(t,e,r){var o,i,s;let n;if(t)n=Ti((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ii.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ii.default)();Si(Zn,a,d),n=Ti(d,Zn.msecs,Zn.seq,e,r)}return e!=null?e:(0,gu.unsafeStringify)(n)}function Si(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.seq)!=null||(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}Gt.updateV7State=Si;function Ti(t,e,r,n,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return e!=null||(e=Date.now()),r!=null||(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}Gt.default=_u});var Oi=y(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var bu=Vt();function xu(t){if(!(0,bu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}jn.default=xu});var Pi=y(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.version=P.validate=P.v7=P.v6ToV1=P.v6=P.v5=P.v4=P.v3=P.v1ToV6=P.v1=P.stringify=P.parse=P.NIL=P.MAX=void 0;var wu=ni();Object.defineProperty(P,"MAX",{enumerable:!0,get:function(){return wu.default}});var Cu=oi();Object.defineProperty(P,"NIL",{enumerable:!0,get:function(){return Cu.default}});var Iu=$t();Object.defineProperty(P,"parse",{enumerable:!0,get:function(){return Iu.default}});var Tu=fe();Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return Tu.default}});var Su=yn();Object.defineProperty(P,"v1",{enumerable:!0,get:function(){return Su.default}});var Au=gn();Object.defineProperty(P,"v1ToV6",{enumerable:!0,get:function(){return Au.default}});var Ou=mi();Object.defineProperty(P,"v3",{enumerable:!0,get:function(){return Ou.default}});var Pu=gi();Object.defineProperty(P,"v4",{enumerable:!0,get:function(){return Pu.default}});var Zu=xi();Object.defineProperty(P,"v5",{enumerable:!0,get:function(){return Zu.default}});var ju=wi();Object.defineProperty(P,"v6",{enumerable:!0,get:function(){return ju.default}});var ku=Ci();Object.defineProperty(P,"v6ToV1",{enumerable:!0,get:function(){return ku.default}});var Eu=Ai();Object.defineProperty(P,"v7",{enumerable:!0,get:function(){return Eu.default}});var Uu=Vt();Object.defineProperty(P,"validate",{enumerable:!0,get:function(){return Uu.default}});var Ru=Oi();Object.defineProperty(P,"version",{enumerable:!0,get:function(){return Ru.default}})});var kn=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.entityZodSchema=void 0;var Zi=j();wr.entityZodSchema=Zi.z.object({type:Zi.z.string().min(1)}).passthrough()});var ji=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.semanticActionZodSchema=void 0;var Jt=j(),Mu=kn(),Nu=on();Cr.semanticActionZodSchema=Jt.z.object({id:Jt.z.string().min(1),state:Jt.z.union([Nu.semanticActionStateTypesZodSchema,Jt.z.string().min(1)]),entities:Jt.z.record(Mu.entityZodSchema)})});var ki=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.cardActionZodSchema=void 0;var ae=j(),Du=nn();Ir.cardActionZodSchema=ae.z.object({type:ae.z.union([Du.actionTypesZodSchema,ae.z.string().min(1)]),title:ae.z.string().min(1),image:ae.z.string().min(1).optional(),text:ae.z.string().min(1).optional(),displayText:ae.z.string().min(1).optional(),value:ae.z.any().optional(),channelData:ae.z.unknown().optional(),imageAltText:ae.z.string().min(1).optional()})});var Ei=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.suggestedActionsZodSchema=void 0;var Tr=j(),zu=ki();Sr.suggestedActionsZodSchema=Tr.z.object({to:Tr.z.array(Tr.z.string().min(1)),actions:Tr.z.array(zu.cardActionZodSchema)})});var En=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.activityEventNamesZodSchema=ht.ActivityEventNames=void 0;var Lu=j(),Ui;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Ui||(ht.ActivityEventNames=Ui={}));ht.activityEventNamesZodSchema=Lu.z.enum(["ContinueConversation","CreateConversation"])});var Un=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.activityImportanceZodSchema=mt.ActivityImportance=void 0;var qu=j(),Ri;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Ri||(mt.ActivityImportance=Ri={}));mt.activityImportanceZodSchema=qu.z.enum(["low","normal","high"])});var Rn=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.activityTypesZodSchema=yt.ActivityTypes=void 0;var Fu=j(),Mi;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(Mi||(yt.ActivityTypes=Mi={}));yt.activityTypesZodSchema=Fu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Ni=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.attachmentZodSchema=void 0;var vt=j();Ar.attachmentZodSchema=vt.z.object({contentType:vt.z.string().min(1),contentUrl:vt.z.string().min(1).optional(),content:vt.z.unknown().optional(),name:vt.z.string().min(1).optional(),thumbnailUrl:vt.z.string().min(1).optional()})});var Di=y(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.addProductInfoToActivity=He.clearProductInfoFromActivity=void 0;var Vu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};He.clearProductInfoFromActivity=Vu;var $u=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,He.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};He.addProductInfoToActivity=$u});var Mn=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.channelAccountZodSchema=void 0;var Q=j(),Wu=Ft();Or.channelAccountZodSchema=Q.z.object({id:Q.z.string().min(1).optional(),name:Q.z.string().optional(),aadObjectId:Q.z.string().min(1).optional(),tenantId:Q.z.string().min(1).optional(),agenticUserId:Q.z.string().min(1).optional(),agenticAppId:Q.z.string().min(1).optional(),agenticAppBlueprintId:Q.z.string().min(1).optional(),role:Q.z.union([Wu.roleTypeZodSchema,Q.z.string().min(1)]).optional(),properties:Q.z.unknown().optional()})});var Nn=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.conversationAccountZodSchema=void 0;var ce=j(),Hu=Ft();Pr.conversationAccountZodSchema=ce.z.object({isGroup:ce.z.boolean().optional(),conversationType:ce.z.string().min(1).optional(),tenantId:ce.z.string().min(1).optional(),id:ce.z.string().min(1),name:ce.z.string().min(1).optional(),aadObjectId:ce.z.string().min(1).optional(),role:ce.z.union([Hu.roleTypeZodSchema,ce.z.string().min(1)]).optional(),properties:ce.z.unknown().optional()})});var Li=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationReferenceZodSchema=void 0;var Yt=j(),zi=Mn(),Bu=Nn();Zr.conversationReferenceZodSchema=Yt.z.object({activityId:Yt.z.string().min(1).optional(),user:zi.channelAccountZodSchema.optional(),locale:Yt.z.string().min(1).optional(),agent:zi.channelAccountZodSchema.optional().nullable(),conversation:Bu.conversationAccountZodSchema,channelId:Yt.z.string().min(1),serviceUrl:Yt.z.string().min(1).optional()})});var Dn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.deliveryModesZodSchema=gt.DeliveryModes=void 0;var Ku=j(),qi;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(qi||(gt.DeliveryModes=qi={}));gt.deliveryModesZodSchema=Ku.z.enum(["normal","notification","expectReplies","ephemeral"])});var zn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.inputHintsZodSchema=_t.InputHints=void 0;var Gu=j(),Fi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Fi||(_t.InputHints=Fi={}));_t.inputHintsZodSchema=Gu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var Ln=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.messageReactionTypesZodSchema=bt.MessageReactionTypes=void 0;var Ju=j(),Vi;(function(t){t.Like="like",t.PlusOne="plusOne"})(Vi||(bt.MessageReactionTypes=Vi={}));bt.messageReactionTypesZodSchema=Ju.z.enum(["like","plusOne"])});var $i=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.messageReactionZodSchema=void 0;var qn=j(),Yu=Ln();jr.messageReactionZodSchema=qn.z.object({type:qn.z.union([Yu.messageReactionTypesZodSchema,qn.z.string().min(1)])})});var Fn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.textFormatTypesZodSchema=xt.TextFormatTypes=void 0;var Xu=j(),Wi;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Wi||(xt.TextFormatTypes=Wi={}));xt.textFormatTypesZodSchema=Xu.z.enum(["markdown","plain","xml"])});var Hi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.textHighlightZodSchema=void 0;var Vn=j();kr.textHighlightZodSchema=Vn.z.object({text:Vn.z.string().min(1),occurrence:Vn.z.number()})});var Xi=y(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Activity=Be.activityZodSchema=void 0;var Qu=Pi(),b=j(),ed=ji(),td=Ei(),Yi=En(),rd=Un(),Ur=Rn(),nd=Ni(),od=sn(),Bi=Di(),Er=Mn(),Ki=an(),id=Nn(),sd=Li(),ad=cn(),cd=Dn(),ud=kn(),dd=zn(),Gi=$i(),ld=Fn(),fd=Hi(),Ji=Ft();Be.activityZodSchema=b.z.object({type:b.z.union([Ur.activityTypesZodSchema,b.z.string().min(1)]),text:b.z.string().optional(),id:b.z.string().min(1).optional(),channelId:b.z.string().min(1).optional(),from:Er.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).datetime().optional(),b.z.string().min(1).transform(t=>new Date(t)).optional()]),localTimestamp:b.z.string().min(1).transform(t=>new Date(t)).optional().or(b.z.date()).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:id.conversationAccountZodSchema.optional(),recipient:Er.channelAccountZodSchema.optional(),textFormat:b.z.union([ld.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([od.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Er.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Er.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Gi.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Gi.messageReactionZodSchema).optional(),topicName:b.z.string().min(1).optional(),historyDisclosed:b.z.boolean().optional(),locale:b.z.string().min(1).optional(),speak:b.z.string().min(1).optional(),inputHint:b.z.union([dd.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:td.suggestedActionsZodSchema.optional(),attachments:b.z.array(nd.attachmentZodSchema).optional(),entities:b.z.array(ud.entityZodSchema.passthrough()).optional(),channelData:b.z.any().optional(),action:b.z.string().min(1).optional(),replyToId:b.z.string().min(1).optional(),label:b.z.string().min(1).optional(),valueType:b.z.string().min(1).optional(),value:b.z.unknown().optional(),name:b.z.union([Yi.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:sd.conversationReferenceZodSchema.optional(),code:b.z.union([ad.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.string().min(1).datetime().optional(),importance:b.z.union([rd.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([cd.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(fd.textHighlightZodSchema).optional(),semanticAction:ed.semanticActionZodSchema.optional()});var $n=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Be.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw new Error(`Invalid channelId ${e}. Found subChannel but no main channel.`);this._channelId=r,n?(0,Bi.addProductInfoToActivity)(this,n):(0,Bi.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw new Error("Primary channel must be set before setting subChannel");this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:Ur.ActivityTypes.Event,name:Yi.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,Qu.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==Ur.ActivityTypes.ConversationUpdate||this.channelId!==Ki.Channels.Directline&&this.channelId!==Ki.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===Ur.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(){let e={...this};return e.channelId=e._channelId,delete e._channelId,JSON.stringify(e)}isAgenticRequest(){var e,r;return((e=this.recipient)===null||e===void 0?void 0:e.role)===Ji.RoleTypes.AgenticUser||((r=this.recipient)===null||r===void 0?void 0:r.role)===Ji.RoleTypes.AgenticIdentity}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Be.Activity=$n});var Qi=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.CallerIdConstants=void 0;Rr.CallerIdConstants={PublicAzureChannel:"urn:botframework:azure",USGovChannel:"urn:botframework:azureusgov",AgentPrefix:"urn:botframework:aadappid:"}});var es=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.activityTreatments=wt.ActivityTreatments=void 0;var pd=j(),Wn;(function(t){t.Targeted="targeted"})(Wn||(wt.ActivityTreatments=Wn={}));wt.activityTreatments=pd.z.nativeEnum(Wn)});var Hn=y(x=>{"use strict";var hd=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ts=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hd(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.Logger=x.debug=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.CallerIdConstants=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var md=nn();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return md.ActionTypes}});var yd=on();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return yd.SemanticActionStateTypes}});var vd=sn();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return vd.AttachmentLayoutTypes}});var gd=an();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return gd.Channels}});var _d=cn();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return _d.EndOfConversationCodes}});var bd=Yo();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return bd.MembershipSourceTypes}});var xd=Qo();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return xd.MembershipTypes}});var wd=Ft();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return wd.RoleTypes}});ts(ti(),x);ts(ri(),x);var rs=Xi();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return rs.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return rs.activityZodSchema}});var Cd=En();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return Cd.ActivityEventNames}});var Id=Un();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Id.ActivityImportance}});var Td=Rn();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Td.ActivityTypes}});var Sd=Qi();Object.defineProperty(x,"CallerIdConstants",{enumerable:!0,get:function(){return Sd.CallerIdConstants}});var Ad=Dn();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return Ad.DeliveryModes}});var Od=zn();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Od.InputHints}});var Pd=Ln();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return Pd.MessageReactionTypes}});var Zd=Fn();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Zd.TextFormatTypes}});var jd=es();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return jd.ActivityTreatments}});var ns=Mt();Object.defineProperty(x,"debug",{enumerable:!0,get:function(){return ns.debug}});Object.defineProperty(x,"Logger",{enumerable:!0,get:function(){return ns.Logger}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Rt=(A=>(A.Unknown="Unknown",A.Exp="Exp",A.Dev="Dev",A.Test="Test",A.Preprod="Preprod",A.FirstRelease="FirstRelease",A.Prod="Prod",A.Gov="Gov",A.High="High",A.DoD="DoD",A.Mooncake="Mooncake",A.Ex="Ex",A.Rx="Rx",A.Prv="Prv",A.Local="Local",A.GovFR="GovFR",A.Other="Other",A))(Rt||{});var Wr=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},Hr=class extends Wr{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(Rt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Rt).join(", ")}`);if(!Object.values(Ut).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Ut).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Jd=()=>{var t,e,r,n,o,i;return new Hr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};var tr=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Br(t){}function lo(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Br,onError:r=Br,onRetry:n=Br,onComment:o}=t,i="",s=!0,a,d="",l="";function f(g){let S=s?g.replace(/^\xEF\xBB\xBF/,""):g,[A,q]=Us(`${i}${S}`);for(let te of A)m(te);i=q,s=!1}function m(g){if(g===""){T();return}if(g.startsWith(":")){o&&o(g.slice(g.startsWith(": ")?2:1));return}let S=g.indexOf(":");if(S!==-1){let A=g.slice(0,S),q=g[S+1]===" "?2:1,te=g.slice(S+q);_(A,te,g);return}_(g,"",g)}function _(g,S,A){switch(g){case"event":l=S;break;case"data":d=`${d}${S}
1
+ var Ss=Object.create;var co=Object.defineProperty;var As=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var js=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Os(e))!Zs.call(t,o)&&o!==r&&co(t,o,{get:()=>e[o],enumerable:!(n=As(e,o))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Ss(Ps(t)):{},js(e||!t||!t.__esModule?co(r,"default",{value:t,enumerable:!0}):r,t));var ho=y((Xd,po)=>{var Ge=1e3,Ye=Ge*60,Xe=Ye*60,Te=Xe*24,zs=Te*7,Ls=Te*365.25;po.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Fs(t);if(r==="number"&&isFinite(t))return e.long?Vs(t):qs(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Fs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Ls;case"weeks":case"week":case"w":return r*zs;case"days":case"day":case"d":return r*Te;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Xe;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ye;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ge;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function qs(t){var e=Math.abs(t);return e>=Te?Math.round(t/Te)+"d":e>=Xe?Math.round(t/Xe)+"h":e>=Ye?Math.round(t/Ye)+"m":e>=Ge?Math.round(t/Ge)+"s":t+"ms"}function Vs(t){var e=Math.abs(t);return e>=Te?nr(t,e,Te,"day"):e>=Xe?nr(t,e,Xe,"hour"):e>=Ye?nr(t,e,Ye,"minute"):e>=Ge?nr(t,e,Ge,"second"):t+" ms"}function nr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var yo=y((Qd,mo)=>{function $s(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=ho(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let m=0;for(let b=0;b<f.length;b++)m=(m<<5)-m+f.charCodeAt(b),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,b=null,T,O;function g(...S){if(!g.enabled)return;let A=g,F=Number(new Date),te=F-(m||F);A.diff=te,A.prev=m,A.curr=F,m=F,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ye=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(re,Pt)=>{if(re==="%%")return"%";ye++;let Zt=r.formatters[Pt];if(typeof Zt=="function"){let Vr=S[ye];re=Zt.call(A,Vr),S.splice(ye,1),ye--}return re}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>b!==null?b:(T!==r.namespaces&&(T=r.namespaces,O=r.enabled(f)),O),set:S=>{b=S}}),typeof r.init=="function"&&r.init(g),g}function n(f,m){let b=r(this.namespace+(typeof m=="undefined"?":":m)+f);return b.log=this.log,b}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let b of m)b[0]==="-"?r.skips.push(b.slice(1)):r.names.push(b)}function i(f,m){let b=0,T=0,O=-1,g=0;for(;b<f.length;)if(T<m.length&&(m[T]===f[b]||m[T]==="*"))m[T]==="*"?(O=T,g=b,T++):(b++,T++);else if(O!==-1)T=O+1,g++,b=g;else return!1;for(;T<m.length&&m[T]==="*";)T++;return T===m.length}function s(){let f=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),f}function a(f){for(let m of r.skips)if(i(f,m))return!1;for(let m of r.names)if(i(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}mo.exports=$s});var vo=y((V,or)=>{V.formatArgs=Hs;V.save=Bs;V.load=Ks;V.useColors=Ws;V.storage=Js();V.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Ws(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Hs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+or.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function Bs(t){try{t?V.storage.setItem("debug",t):V.storage.removeItem("debug")}catch{}}function Ks(){let t;try{t=V.storage.getItem("debug")||V.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Js(){try{return localStorage}catch{}}or.exports=yo()(V);var{formatters:Gs}=or.exports;Gs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(Se=>{"use strict";var Ys=Se&&Se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Se,"__esModule",{value:!0});Se.Logger=void 0;Se.debug=ea;var Xs=Ys(vo()),Qs=["info","warn","error","debug"],ir=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of Qs){let n=(0,Xs.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};Se.Logger=ir;function ea(t){return new ir(t)}});var Dt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Kr;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Kr||(k.util=Kr={}));var xo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(xo||(k.objectUtil=xo={}));k.ZodParsedType=Kr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var oa=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=oa});var dr=y(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.ZodError=ve.quotelessJson=ve.ZodIssueCode=void 0;var wo=Dt();ve.ZodIssueCode=wo.util.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"]);var ia=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ve.quotelessJson=ia;var zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,d=0;for(;d<s.path.length;){let l=s.path[d];d===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wo.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ve.ZodError=zt;zt.create=t=>new zt(t)});var Gr=y(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var M=dr(),Ae=Dt(),sa=(t,e)=>{let r;switch(t.code){case M.ZodIssueCode.invalid_type:t.received===Ae.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case M.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.util.jsonStringifyReplacer)}`;break;case M.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.util.joinValues(t.keys,", ")}`;break;case M.ZodIssueCode.invalid_union:r="Invalid input";break;case M.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.util.joinValues(t.options)}`;break;case M.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.util.joinValues(t.options)}, received '${t.received}'`;break;case M.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case M.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case M.ZodIssueCode.invalid_date:r="Invalid date";break;case M.ZodIssueCode.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}"`:Ae.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case M.ZodIssueCode.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==="bigint"?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 M.ZodIssueCode.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 M.ZodIssueCode.custom:r="Invalid input";break;case M.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case M.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case M.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ae.util.assertNever(t)}return{message:r}};Jr.default=sa});var lr=y(ge=>{"use strict";var aa=ge&&ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});ge.defaultErrorMap=void 0;ge.setErrorMap=ca;ge.getErrorMap=ua;var Co=aa(Gr());ge.defaultErrorMap=Co.default;var Io=Co.default;function ca(t){Io=t}function ua(){return Io}});var Xr=y(Z=>{"use strict";var da=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Z,"__esModule",{value:!0});Z.isAsync=Z.isValid=Z.isDirty=Z.isAborted=Z.OK=Z.DIRTY=Z.INVALID=Z.ParseStatus=Z.EMPTY_PATH=Z.makeIssue=void 0;Z.addIssueToContext=pa;var la=lr(),To=da(Gr()),fa=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",d=n.filter(l=>!!l).slice().reverse();for(let l of d)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};Z.makeIssue=fa;Z.EMPTY_PATH=[];function pa(t,e){let r=(0,la.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===To.default?void 0:To.default].filter(o=>!!o)});t.common.issues.push(n)}var Yr=class t{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 o of r){if(o.status==="aborted")return Z.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Z.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};Z.ParseStatus=Yr;Z.INVALID=Object.freeze({status:"aborted"});var ha=t=>({status:"dirty",value:t});Z.DIRTY=ha;var ma=t=>({status:"valid",value:t});Z.OK=ma;var ya=t=>t.status==="aborted";Z.isAborted=ya;var va=t=>t.status==="dirty";Z.isDirty=va;var ga=t=>t.status==="valid";Z.isValid=ga;var _a=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=_a});var Ao=y(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0})});var Po=y(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.errorUtil=void 0;var Oo;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Oo||(fr.errorUtil=Oo={}))});var Fo=y(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.discriminatedUnion=c.date=c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=void 0;c.datetimeRegex=Uo;c.custom=Mo;var p=dr(),pr=lr(),v=Po(),u=Xr(),h=Dt(),K=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zo=(t,e)=>{if((0,u.isValid)(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 p.ZodError(t.common.issues);return this._error=r,this._error}}};function C(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:(s,a)=>{var l,f;let{message:d}=t;return s.code==="invalid_enum_value"?{message:d!=null?d:a.defaultError}:typeof a.data=="undefined"?{message:(l=d!=null?d:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(f=d!=null?d:r)!=null?f:a.defaultError}},description:o}}var I=class{get description(){return this._def.description}_getType(e){return(0,h.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,u.isAsync)(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 i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Zo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues})}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==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return Zo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new H({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return B.create(this,this._def)}nullable(){return se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xe.create(this,this._def)}or(e){return Ue.create([this,e],this._def)}and(e){return Re.create(this,e,this._def)}transform(e){return new H({...C(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Le({...C(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new Lt({typeName:x.ZodBranded,type:this,...C(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Fe({...C(this._def),innerType:this,catchValue:r,typeName:x.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ft.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=I;c.Schema=I;c.ZodSchema=I;var ba=/^c[^\s-]{8,}$/i,xa=/^[0-9a-z]+$/,wa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ca=/^[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,Ia=/^[a-z0-9_-]{21}$/i,Ta=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Aa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Qr,Pa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Za=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ja=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ka=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ea=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ua=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ko="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ra=new RegExp(`^${ko}$`);function Eo(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Ma(t){return new RegExp(`^${Eo(t)}$`)}function Uo(t){let e=`${ko}T${Eo(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Na(t,e){return!!((e==="v4"||!e)&&Pa.test(t)||(e==="v6"||!e)&&ja.test(t))}function Da(t,e){if(!Ta.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function za(t,e){return!!((e==="v4"||!e)&&Za.test(t)||(e==="v6"||!e)&&ka.test(t))}var _e=class t extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Aa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"email",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Qr||(Qr=new RegExp(Oa,"u")),Qr.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ca.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ia.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")ba.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")xa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Uo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Ra.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Ma(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Sa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Na(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Da(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"jwt",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?za(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cidr",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ea.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ua.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}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 isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}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 isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}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}};c.ZodString=_e;_e.create=t=>{var e;return new _e({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};function La(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Oe=class t extends I{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)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?La(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.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"&&h.util.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)}};c.ZodNumber=Oe;Oe.create=t=>new Oe({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var Pe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.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}};c.ZodBigInt=Pe;Pe.create=t=>{var e;return new Pe({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};var Ze=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ze;Ze.create=t=>new Ze({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var je=class t extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),u.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.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}};c.ZodDate=je;je.create=t=>new je({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...C(t)});var tt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=tt;tt.create=t=>new tt({typeName:x.ZodSymbol,...C(t)});var ke=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=ke;ke.create=t=>new ke({typeName:x.ZodUndefined,...C(t)});var Ee=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=Ee;Ee.create=t=>new Ee({typeName:x.ZodNull,...C(t)});var be=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=be;be.create=t=>new be({typeName:x.ZodAny,...C(t)});var de=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=de;de.create=t=>new de({typeName:x.ZodUnknown,...C(t)});var X=class extends I{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=X;X.create=t=>new X({typeName:x.ZodNever,...C(t)});var rt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=rt;rt.create=t=>new rt({typeName:x.ZodVoid,...C(t)});var le=class t extends I{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new K(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new K(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=le;le.create=(t,e)=>new le({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...C(e)});function et(t){if(t instanceof $){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=B.create(et(n))}return new $({...t._def,shape:()=>e})}else return t instanceof le?new le({...t._def,type:et(t.element)}):t instanceof B?B.create(et(t.unwrap())):t instanceof se?se.create(et(t.unwrap())):t instanceof ie?ie.create(t.items.map(e=>et(e))):t}var $=class t extends I{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=h.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],m=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new K(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof X){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let m=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new K(o,m,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let m=await f.key,b=await f.value;l.push({key:m,value:b,alwaysSet:f.alwaysSet})}return l}).then(l=>u.ParseStatus.mergeObjectSync(n,l)):u.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,d;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(d=v.errorUtil.errToObj(e).message)!=null?d:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of h.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of h.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of h.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof B;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ro(h.util.objectKeys(this.shape))}};c.ZodObject=$;$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:X.create(),typeName:x.ZodObject,...C(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:X.create(),typeName:x.ZodObject,...C(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:X.create(),typeName:x.ZodObject,...C(e)});var Ue=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Ue;Ue.create=(t,e)=>new Ue({options:t,typeName:x.ZodUnion,...C(e)});var ue=t=>t instanceof Me?ue(t.schema):t instanceof H?ue(t.innerType()):t instanceof Ne?[t.value]:t instanceof De?t.options:t instanceof ze?h.util.objectValues(t.enum):t instanceof Le?ue(t._def.innerType):t instanceof ke?[void 0]:t instanceof Ee?[null]:t instanceof B?[void 0,...ue(t.unwrap())]:t instanceof se?[null,...ue(t.unwrap())]:t instanceof Lt||t instanceof qe?ue(t.unwrap()):t instanceof Fe?ue(t._def.innerType):[],hr=class t extends I{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),u.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ue(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...C(n)})}};c.ZodDiscriminatedUnion=hr;function en(t,e){let r=(0,h.getParsedType)(t),n=(0,h.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(e),i=h.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=en(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=en(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Re=class extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,u.isAborted)(i)||(0,u.isAborted)(s))return u.INVALID;let a=en(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};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(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=Re;Re.create=(t,e,r)=>new Re({left:t,right:e,typeName:x.ZodIntersection,...C(r)});var ie=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new K(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ie;ie.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:t,typeName:x.ZodTuple,rest:null,...C(e)})};var mr=class t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new K(n,a,n.path,a)),value:s._parse(new K(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof I?new t({keyType:e,valueType:r,typeName:x.ZodRecord,...C(n)}):new t({keyType:_e.create(),valueType:e,typeName:x.ZodRecord,...C(r)})}};c.ZodRecord=mr;var nt=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new K(n,a,n.path,[l,"key"])),value:i._parse(new K(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=nt;nt.create=(t,e,r)=>new nt({valueType:e,keyType:t,typeName:x.ZodMap,...C(r)});var ot=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new K(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ot;ot.create=(t,e)=>new ot({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...C(e)});var yr=class t extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),u.INVALID;function n(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function o(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof xe){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(T=>{throw l.addIssue(n(d,T)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(T=>{throw l.addIssue(o(m,T)),l})})}else{let a=this;return(0,u.OK)(function(...d){let l=a._def.args.safeParse(d,i);if(!l.success)throw new p.ZodError([n(d,l.error)]);let f=Reflect.apply(s,this,l.data),m=a._def.returns.safeParse(f,i);if(!m.success)throw new p.ZodError([o(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ie.create(e).rest(de.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ie.create([]).rest(de.create()),returns:r||de.create(),typeName:x.ZodFunction,...C(n)})}};c.ZodFunction=yr;var Me=class extends I{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})}};c.ZodLazy=Me;Me.create=(t,e)=>new Me({getter:t,typeName:x.ZodLazy,...C(e)});var Ne=class extends I{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Ne;Ne.create=(t,e)=>new Ne({value:t,typeName:x.ZodLiteral,...C(e)});function Ro(t,e){return new De({values:t,typeName:x.ZodEnum,...C(e)})}var De=class t extends I{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return(0,u.OK)(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 t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};c.ZodEnum=De;De.create=Ro;var ze=class extends I{_parse(e){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:o}),u.INVALID}return(0,u.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=ze;ze.create=(t,e)=>new ze({values:t,typeName:x.ZodNativeEnum,...C(e)});var xe=class extends I{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,u.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c.ZodPromise=xe;xe.create=(t,e)=>new xe({type:t,typeName:x.ZodPromise,...C(e)});var H=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,u.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return u.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?u.INVALID:d.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(d.value):d});{if(r.value==="aborted")return u.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:a.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let d=o.refinement(a,i);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 a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,u.isValid)(s))return u.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,u.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):u.INVALID);h.util.assertNever(o)}};c.ZodEffects=H;c.ZodTransformer=H;H.create=(t,e,r)=>new H({schema:t,typeName:x.ZodEffects,effect:e,...C(r)});H.createWithPreprocess=(t,e,r)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...C(r)});var B=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=B;B.create=(t,e)=>new B({innerType:t,typeName:x.ZodOptional,...C(e)});var se=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=se;se.create=(t,e)=>new se({innerType:t,typeName:x.ZodNullable,...C(e)});var Le=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c.ZodDefault=Le;Le.create=(t,e)=>new Le({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var Fe=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=Fe;Fe.create=(t,e)=>new Fe({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var it=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=it;it.create=t=>new it({typeName:x.ZodNaN,...C(t)});c.BRAND=Symbol("zod_brand");var Lt=class extends I{_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}};c.ZodBranded=Lt;var Ft=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?u.INVALID:i.status==="dirty"?(r.dirty(),(0,u.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?u.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:x.ZodPipeline})}};c.ZodPipeline=Ft;var qe=class extends I{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=qe;qe.create=(t,e)=>new qe({innerType:t,typeName:x.ZodReadonly,...C(e)});function jo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Mo(t,e={},r){return t?be.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(d=>{var l,f;if(!d){let m=jo(e,n),b=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:b})}});if(!i){let d=jo(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):be.create()}c.late={object:$.lazycreate};var x;(function(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.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"})(x||(c.ZodFirstPartyTypeKind=x={}));var Fa=(t,e={message:`Input not instance of ${t.name}`})=>Mo(r=>r instanceof t,e);c.instanceof=Fa;var No=_e.create;c.string=No;var Do=Oe.create;c.number=Do;var qa=it.create;c.nan=qa;var Va=Pe.create;c.bigint=Va;var zo=Ze.create;c.boolean=zo;var $a=je.create;c.date=$a;var Wa=tt.create;c.symbol=Wa;var Ha=ke.create;c.undefined=Ha;var Ba=Ee.create;c.null=Ba;var Ka=be.create;c.any=Ka;var Ja=de.create;c.unknown=Ja;var Ga=X.create;c.never=Ga;var Ya=rt.create;c.void=Ya;var Xa=le.create;c.array=Xa;var Qa=$.create;c.object=Qa;var ec=$.strictCreate;c.strictObject=ec;var tc=Ue.create;c.union=tc;var rc=hr.create;c.discriminatedUnion=rc;var nc=Re.create;c.intersection=nc;var oc=ie.create;c.tuple=oc;var ic=mr.create;c.record=ic;var sc=nt.create;c.map=sc;var ac=ot.create;c.set=ac;var cc=yr.create;c.function=cc;var uc=Me.create;c.lazy=uc;var dc=Ne.create;c.literal=dc;var lc=De.create;c.enum=lc;var fc=ze.create;c.nativeEnum=fc;var pc=xe.create;c.promise=pc;var Lo=H.create;c.effect=Lo;c.transformer=Lo;var hc=B.create;c.optional=hc;var mc=se.create;c.nullable=mc;var yc=H.createWithPreprocess;c.preprocess=yc;var vc=Ft.create;c.pipeline=vc;var gc=()=>No().optional();c.ostring=gc;var _c=()=>Do().optional();c.onumber=_c;var bc=()=>zo().optional();c.oboolean=bc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>Oe.create({...t,coerce:!0})),boolean:(t=>Ze.create({...t,coerce:!0})),bigint:(t=>Pe.create({...t,coerce:!0})),date:(t=>je.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var tn=y(J=>{"use strict";var xc=J&&J.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),st=J&&J.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xc(e,t,r)};Object.defineProperty(J,"__esModule",{value:!0});st(lr(),J);st(Xr(),J);st(Ao(),J);st(Dt(),J);st(Fo(),J);st(dr(),J)});var j=y(W=>{"use strict";var qo=W&&W.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),wc=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Cc=W&&W.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qo(e,t,r);return wc(e,t),e},Ic=W&&W.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qo(e,t,r)};Object.defineProperty(W,"__esModule",{value:!0});W.z=void 0;var Vo=Cc(tn());W.z=Vo;Ic(tn(),W);W.default=Vo});var rn=y(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.actionTypesZodSchema=at.ActionTypes=void 0;var Tc=j(),$o;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})($o||(at.ActionTypes=$o={}));at.actionTypesZodSchema=Tc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var nn=y(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.semanticActionStateTypesZodSchema=ct.SemanticActionStateTypes=void 0;var Sc=j(),Wo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Wo||(ct.SemanticActionStateTypes=Wo={}));ct.semanticActionStateTypesZodSchema=Sc.z.enum(["start","continue","done"])});var on=y(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.attachmentLayoutTypesZodSchema=ut.AttachmentLayoutTypes=void 0;var Ac=j(),Ho;(function(t){t.List="list",t.Carousel="carousel"})(Ho||(ut.AttachmentLayoutTypes=Ho={}));ut.attachmentLayoutTypesZodSchema=Ac.z.enum(["list","carousel"])});var sn=y(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.Channels=void 0;var Bo;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Bo||(vr.Channels=Bo={}))});var an=y(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.endOfConversationCodesZodSchema=dt.EndOfConversationCodes=void 0;var Oc=j(),Ko;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Ko||(dt.EndOfConversationCodes=Ko={}));dt.endOfConversationCodesZodSchema=Oc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Go=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.membershipSourceTypeZodSchema=lt.MembershipSourceTypes=void 0;var Pc=j(),Jo;(function(t){t.Channel="channel",t.Team="team"})(Jo||(lt.MembershipSourceTypes=Jo={}));lt.membershipSourceTypeZodSchema=Pc.z.enum(["channel","team"])});var Xo=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.membershipTypeZodSchema=ft.MembershipTypes=void 0;var Zc=j(),Yo;(function(t){t.Direct="direct",t.Transitive="transitive"})(Yo||(ft.MembershipTypes=Yo={}));ft.membershipTypeZodSchema=Zc.z.enum(["direct","transitive"])});var qt=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.roleTypeZodSchema=pt.RoleTypes=void 0;var jc=j(),Qo;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(Qo||(pt.RoleTypes=Qo={}));pt.roleTypeZodSchema=jc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ei=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.addAIToActivity=void 0;var kc=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};gr.addAIToActivity=kc});var ti=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.adaptiveCardInvokeActionZodSchema=void 0;var Ve=j();_r.adaptiveCardInvokeActionZodSchema=Ve.z.object({type:Ve.z.string().min(1),id:Ve.z.string().optional(),verb:Ve.z.string().min(1),data:Ve.z.record(Ve.z.string().min(1),Ve.z.any())})});var ri=y(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ni=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.default="00000000-0000-0000-0000-000000000000"});var oi=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var Vt=y(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});var Ec=oi();function Uc(t){return typeof t=="string"&&Ec.default.test(t)}ln.default=Uc});var $t=y(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var Rc=Vt();function Mc(t){if(!(0,Rc.default)(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}fn.default=Mc});var fe=y(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.unsafeStringify=void 0;var Nc=Vt(),U=[];for(let t=0;t<256;++t)U.push((t+256).toString(16).slice(1));function ii(t,e=0){return(U[t[e+0]]+U[t[e+1]]+U[t[e+2]]+U[t[e+3]]+"-"+U[t[e+4]]+U[t[e+5]]+"-"+U[t[e+6]]+U[t[e+7]]+"-"+U[t[e+8]]+U[t[e+9]]+"-"+U[t[e+10]]+U[t[e+11]]+U[t[e+12]]+U[t[e+13]]+U[t[e+14]]+U[t[e+15]]).toLowerCase()}Wt.unsafeStringify=ii;function Dc(t,e=0){let r=ii(t,e);if(!(0,Nc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Wt.default=Dc});var br=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});var pn,zc=new Uint8Array(16);function Lc(){if(!pn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pn=crypto.getRandomValues.bind(crypto)}return pn(zc)}hn.default=Lc});var mn=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.updateV1State=void 0;var si=br(),Fc=fe(),Ht={};function qc(t,e,r){var i,s,a,d;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let l=Object.keys(t);l.length===1&&l[0]==="_v6"&&(t=void 0)}if(t)n=ai((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,si.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,si.default)();ci(Ht,l,f),n=ai(f,Ht.msecs,Ht.nsecs,o?void 0:Ht.clockseq,o?void 0:Ht.node,e,r)}return e!=null?e:(0,Fc.unsafeStringify)(n)}function ci(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.nsecs)!=null||(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}Bt.updateV1State=ci;function ai(t,e,r,n,o,i,s=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),s=0;else if(s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);e!=null||(e=Date.now()),r!=null||(r=0),n!=null||(n=(t[8]<<8|t[9])&16383),o!=null||(o=t.slice(10,16)),e+=122192928e5;let a=((e&268435455)*1e4+r)%4294967296;i[s++]=a>>>24&255,i[s++]=a>>>16&255,i[s++]=a>>>8&255,i[s++]=a&255;let d=e/4294967296*1e4&268435455;i[s++]=d>>>8&255,i[s++]=d&255,i[s++]=d>>>24&15|16,i[s++]=d>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let l=0;l<6;++l)i[s++]=o[l];return i}Bt.default=qc});var vn=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var Vc=$t(),$c=fe();function Wc(t){let e=typeof t=="string"?(0,Vc.default)(t):t,r=Hc(e);return typeof t=="string"?(0,$c.unsafeStringify)(r):r}yn.default=Wc;function Hc(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var di=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});function Bc(t){let e=Gc(t),r=Jc(e,t.length*8);return Kc(r)}function Kc(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}function ui(t){return(t+64>>>9<<4)+14+1}function Jc(t,e){let r=new Uint32Array(ui(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,o=-271733879,i=-1732584194,s=271733878;for(let a=0;a<t.length;a+=16){let d=n,l=o,f=i,m=s;n=N(n,o,i,s,t[a],7,-680876936),s=N(s,n,o,i,t[a+1],12,-389564586),i=N(i,s,n,o,t[a+2],17,606105819),o=N(o,i,s,n,t[a+3],22,-1044525330),n=N(n,o,i,s,t[a+4],7,-176418897),s=N(s,n,o,i,t[a+5],12,1200080426),i=N(i,s,n,o,t[a+6],17,-1473231341),o=N(o,i,s,n,t[a+7],22,-45705983),n=N(n,o,i,s,t[a+8],7,1770035416),s=N(s,n,o,i,t[a+9],12,-1958414417),i=N(i,s,n,o,t[a+10],17,-42063),o=N(o,i,s,n,t[a+11],22,-1990404162),n=N(n,o,i,s,t[a+12],7,1804603682),s=N(s,n,o,i,t[a+13],12,-40341101),i=N(i,s,n,o,t[a+14],17,-1502002290),o=N(o,i,s,n,t[a+15],22,1236535329),n=D(n,o,i,s,t[a+1],5,-165796510),s=D(s,n,o,i,t[a+6],9,-1069501632),i=D(i,s,n,o,t[a+11],14,643717713),o=D(o,i,s,n,t[a],20,-373897302),n=D(n,o,i,s,t[a+5],5,-701558691),s=D(s,n,o,i,t[a+10],9,38016083),i=D(i,s,n,o,t[a+15],14,-660478335),o=D(o,i,s,n,t[a+4],20,-405537848),n=D(n,o,i,s,t[a+9],5,568446438),s=D(s,n,o,i,t[a+14],9,-1019803690),i=D(i,s,n,o,t[a+3],14,-187363961),o=D(o,i,s,n,t[a+8],20,1163531501),n=D(n,o,i,s,t[a+13],5,-1444681467),s=D(s,n,o,i,t[a+2],9,-51403784),i=D(i,s,n,o,t[a+7],14,1735328473),o=D(o,i,s,n,t[a+12],20,-1926607734),n=z(n,o,i,s,t[a+5],4,-378558),s=z(s,n,o,i,t[a+8],11,-2022574463),i=z(i,s,n,o,t[a+11],16,1839030562),o=z(o,i,s,n,t[a+14],23,-35309556),n=z(n,o,i,s,t[a+1],4,-1530992060),s=z(s,n,o,i,t[a+4],11,1272893353),i=z(i,s,n,o,t[a+7],16,-155497632),o=z(o,i,s,n,t[a+10],23,-1094730640),n=z(n,o,i,s,t[a+13],4,681279174),s=z(s,n,o,i,t[a],11,-358537222),i=z(i,s,n,o,t[a+3],16,-722521979),o=z(o,i,s,n,t[a+6],23,76029189),n=z(n,o,i,s,t[a+9],4,-640364487),s=z(s,n,o,i,t[a+12],11,-421815835),i=z(i,s,n,o,t[a+15],16,530742520),o=z(o,i,s,n,t[a+2],23,-995338651),n=L(n,o,i,s,t[a],6,-198630844),s=L(s,n,o,i,t[a+7],10,1126891415),i=L(i,s,n,o,t[a+14],15,-1416354905),o=L(o,i,s,n,t[a+5],21,-57434055),n=L(n,o,i,s,t[a+12],6,1700485571),s=L(s,n,o,i,t[a+3],10,-1894986606),i=L(i,s,n,o,t[a+10],15,-1051523),o=L(o,i,s,n,t[a+1],21,-2054922799),n=L(n,o,i,s,t[a+8],6,1873313359),s=L(s,n,o,i,t[a+15],10,-30611744),i=L(i,s,n,o,t[a+6],15,-1560198380),o=L(o,i,s,n,t[a+13],21,1309151649),n=L(n,o,i,s,t[a+4],6,-145523070),s=L(s,n,o,i,t[a+11],10,-1120210379),i=L(i,s,n,o,t[a+2],15,718787259),o=L(o,i,s,n,t[a+9],21,-343485551),n=we(n,d),o=we(o,l),i=we(i,f),s=we(s,m)}return Uint32Array.of(n,o,i,s)}function Gc(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(ui(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}function we(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Yc(t,e){return t<<e|t>>>32-e}function xr(t,e,r,n,o,i){return we(Yc(we(we(e,t),we(n,i)),o),r)}function N(t,e,r,n,o,i,s){return xr(e&r|~e&n,t,e,o,i,s)}function D(t,e,r,n,o,i,s){return xr(e&n|r&~n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return xr(e^r^n,t,e,o,i,s)}function L(t,e,r,n,o,i,s){return xr(r^(e|~n),t,e,o,i,s)}gn.default=Bc});var Kt=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.URL=pe.DNS=pe.stringToBytes=void 0;var li=$t(),Xc=fe();function fi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}pe.stringToBytes=fi;pe.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";pe.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Qc(t,e,r,n,o,i){let s=typeof r=="string"?fi(r):r,a=typeof n=="string"?(0,li.default)(n):n;if(typeof n=="string"&&(n=(0,li.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+s.length);if(d.set(a),d.set(s,a.length),d=e(d),d[6]=d[6]&15|t,d[8]=d[8]&63|128,o){i=i||0;for(let l=0;l<16;++l)o[i+l]=d[l];return o}return(0,Xc.unsafeStringify)(d)}pe.default=Qc});var hi=y($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.URL=$e.DNS=void 0;var eu=di(),_n=Kt(),pi=Kt();Object.defineProperty($e,"DNS",{enumerable:!0,get:function(){return pi.DNS}});Object.defineProperty($e,"URL",{enumerable:!0,get:function(){return pi.URL}});function bn(t,e,r,n){return(0,_n.default)(48,eu.default,t,e,r,n)}bn.DNS=_n.DNS;bn.URL=_n.URL;$e.default=bn});var mi=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var tu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);xn.default={randomUUID:tu}});var vi=y(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});var yi=mi(),ru=br(),nu=fe();function ou(t,e,r){var o,i,s;if(yi.default.randomUUID&&!e&&!t)return yi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ru.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return(0,nu.unsafeStringify)(n)}wn.default=ou});var gi=y(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});function iu(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function Cn(t,e){return t<<e|t>>>32-e}function su(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128,t=n;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let d=new Uint32Array(16);for(let l=0;l<16;++l)d[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=d}s[i-1][14]=(t.length-1)*8/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<i;++a){let d=new Uint32Array(80);for(let O=0;O<16;++O)d[O]=s[a][O];for(let O=16;O<80;++O)d[O]=Cn(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],b=r[3],T=r[4];for(let O=0;O<80;++O){let g=Math.floor(O/20),S=Cn(l,5)+iu(g,f,m,b)+T+e[g]+d[O]>>>0;T=b,b=m,m=Cn(f,30)>>>0,f=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+T>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}In.default=su});var bi=y(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.URL=We.DNS=void 0;var au=gi(),Tn=Kt(),_i=Kt();Object.defineProperty(We,"DNS",{enumerable:!0,get:function(){return _i.DNS}});Object.defineProperty(We,"URL",{enumerable:!0,get:function(){return _i.URL}});function Sn(t,e,r,n){return(0,Tn.default)(80,au.default,t,e,r,n)}Sn.DNS=Tn.DNS;Sn.URL=Tn.URL;We.default=Sn});var xi=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var cu=fe(),uu=mn(),du=vn();function lu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,uu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,du.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,cu.unsafeStringify)(n)}An.default=lu});var wi=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var fu=$t(),pu=fe();function hu(t){let e=typeof t=="string"?(0,fu.default)(t):t,r=mu(e);return typeof t=="string"?(0,pu.unsafeStringify)(r):r}On.default=hu;function mu(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var Si=y(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.updateV7State=void 0;var Ci=br(),yu=fe(),Pn={};function vu(t,e,r){var o,i,s;let n;if(t)n=Ii((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ci.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ci.default)();Ti(Pn,a,d),n=Ii(d,Pn.msecs,Pn.seq,e,r)}return e!=null?e:(0,yu.unsafeStringify)(n)}function Ti(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.seq)!=null||(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}Jt.updateV7State=Ti;function Ii(t,e,r,n,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return e!=null||(e=Date.now()),r!=null||(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}Jt.default=vu});var Ai=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var gu=Vt();function _u(t){if(!(0,gu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Zn.default=_u});var Oi=y(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.version=P.validate=P.v7=P.v6ToV1=P.v6=P.v5=P.v4=P.v3=P.v1ToV6=P.v1=P.stringify=P.parse=P.NIL=P.MAX=void 0;var bu=ri();Object.defineProperty(P,"MAX",{enumerable:!0,get:function(){return bu.default}});var xu=ni();Object.defineProperty(P,"NIL",{enumerable:!0,get:function(){return xu.default}});var wu=$t();Object.defineProperty(P,"parse",{enumerable:!0,get:function(){return wu.default}});var Cu=fe();Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return Cu.default}});var Iu=mn();Object.defineProperty(P,"v1",{enumerable:!0,get:function(){return Iu.default}});var Tu=vn();Object.defineProperty(P,"v1ToV6",{enumerable:!0,get:function(){return Tu.default}});var Su=hi();Object.defineProperty(P,"v3",{enumerable:!0,get:function(){return Su.default}});var Au=vi();Object.defineProperty(P,"v4",{enumerable:!0,get:function(){return Au.default}});var Ou=bi();Object.defineProperty(P,"v5",{enumerable:!0,get:function(){return Ou.default}});var Pu=xi();Object.defineProperty(P,"v6",{enumerable:!0,get:function(){return Pu.default}});var Zu=wi();Object.defineProperty(P,"v6ToV1",{enumerable:!0,get:function(){return Zu.default}});var ju=Si();Object.defineProperty(P,"v7",{enumerable:!0,get:function(){return ju.default}});var ku=Vt();Object.defineProperty(P,"validate",{enumerable:!0,get:function(){return ku.default}});var Eu=Ai();Object.defineProperty(P,"version",{enumerable:!0,get:function(){return Eu.default}})});var jn=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.entityZodSchema=void 0;var Pi=j();wr.entityZodSchema=Pi.z.object({type:Pi.z.string().min(1)}).passthrough()});var Zi=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.semanticActionZodSchema=void 0;var Gt=j(),Uu=jn(),Ru=nn();Cr.semanticActionZodSchema=Gt.z.object({id:Gt.z.string().min(1),state:Gt.z.union([Ru.semanticActionStateTypesZodSchema,Gt.z.string().min(1)]),entities:Gt.z.record(Uu.entityZodSchema)})});var ji=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.cardActionZodSchema=void 0;var ae=j(),Mu=rn();Ir.cardActionZodSchema=ae.z.object({type:ae.z.union([Mu.actionTypesZodSchema,ae.z.string().min(1)]),title:ae.z.string().min(1),image:ae.z.string().min(1).optional(),text:ae.z.string().min(1).optional(),displayText:ae.z.string().min(1).optional(),value:ae.z.any().optional(),channelData:ae.z.unknown().optional(),imageAltText:ae.z.string().min(1).optional()})});var ki=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.suggestedActionsZodSchema=void 0;var Tr=j(),Nu=ji();Sr.suggestedActionsZodSchema=Tr.z.object({to:Tr.z.array(Tr.z.string().min(1)),actions:Tr.z.array(Nu.cardActionZodSchema)})});var kn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.activityEventNamesZodSchema=ht.ActivityEventNames=void 0;var Du=j(),Ei;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Ei||(ht.ActivityEventNames=Ei={}));ht.activityEventNamesZodSchema=Du.z.enum(["ContinueConversation","CreateConversation"])});var En=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.activityImportanceZodSchema=mt.ActivityImportance=void 0;var zu=j(),Ui;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Ui||(mt.ActivityImportance=Ui={}));mt.activityImportanceZodSchema=zu.z.enum(["low","normal","high"])});var Un=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.activityTypesZodSchema=yt.ActivityTypes=void 0;var Lu=j(),Ri;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(Ri||(yt.ActivityTypes=Ri={}));yt.activityTypesZodSchema=Lu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Mi=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.attachmentZodSchema=void 0;var vt=j();Ar.attachmentZodSchema=vt.z.object({contentType:vt.z.string().min(1),contentUrl:vt.z.string().min(1).optional(),content:vt.z.unknown().optional(),name:vt.z.string().min(1).optional(),thumbnailUrl:vt.z.string().min(1).optional()})});var Ni=y(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.addProductInfoToActivity=He.clearProductInfoFromActivity=void 0;var Fu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};He.clearProductInfoFromActivity=Fu;var qu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,He.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};He.addProductInfoToActivity=qu});var Rn=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.channelAccountZodSchema=void 0;var Q=j(),Vu=qt();Or.channelAccountZodSchema=Q.z.object({id:Q.z.string().min(1).optional(),name:Q.z.string().optional(),aadObjectId:Q.z.string().min(1).optional(),tenantId:Q.z.string().min(1).optional(),agenticUserId:Q.z.string().min(1).optional(),agenticAppId:Q.z.string().min(1).optional(),agenticAppBlueprintId:Q.z.string().min(1).optional(),role:Q.z.union([Vu.roleTypeZodSchema,Q.z.string().min(1)]).optional(),properties:Q.z.unknown().optional()})});var Mn=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.conversationAccountZodSchema=void 0;var ce=j(),$u=qt();Pr.conversationAccountZodSchema=ce.z.object({isGroup:ce.z.boolean().optional(),conversationType:ce.z.string().min(1).optional(),tenantId:ce.z.string().min(1).optional(),id:ce.z.string().min(1),name:ce.z.string().min(1).optional(),aadObjectId:ce.z.string().min(1).optional(),role:ce.z.union([$u.roleTypeZodSchema,ce.z.string().min(1)]).optional(),properties:ce.z.unknown().optional()})});var zi=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationReferenceZodSchema=void 0;var Yt=j(),Di=Rn(),Wu=Mn();Zr.conversationReferenceZodSchema=Yt.z.object({activityId:Yt.z.string().min(1).optional(),user:Di.channelAccountZodSchema.optional(),locale:Yt.z.string().min(1).optional(),agent:Di.channelAccountZodSchema.optional().nullable(),conversation:Wu.conversationAccountZodSchema,channelId:Yt.z.string().min(1),serviceUrl:Yt.z.string().min(1).optional()})});var Nn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.deliveryModesZodSchema=gt.DeliveryModes=void 0;var Hu=j(),Li;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Li||(gt.DeliveryModes=Li={}));gt.deliveryModesZodSchema=Hu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Dn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.inputHintsZodSchema=_t.InputHints=void 0;var Bu=j(),Fi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Fi||(_t.InputHints=Fi={}));_t.inputHintsZodSchema=Bu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var zn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.messageReactionTypesZodSchema=bt.MessageReactionTypes=void 0;var Ku=j(),qi;(function(t){t.Like="like",t.PlusOne="plusOne"})(qi||(bt.MessageReactionTypes=qi={}));bt.messageReactionTypesZodSchema=Ku.z.enum(["like","plusOne"])});var Vi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.messageReactionZodSchema=void 0;var Ln=j(),Ju=zn();jr.messageReactionZodSchema=Ln.z.object({type:Ln.z.union([Ju.messageReactionTypesZodSchema,Ln.z.string().min(1)])})});var Fn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.textFormatTypesZodSchema=xt.TextFormatTypes=void 0;var Gu=j(),$i;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})($i||(xt.TextFormatTypes=$i={}));xt.textFormatTypesZodSchema=Gu.z.enum(["markdown","plain","xml"])});var Wi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.textHighlightZodSchema=void 0;var qn=j();kr.textHighlightZodSchema=qn.z.object({text:qn.z.string().min(1),occurrence:qn.z.number()})});var Yi=y(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Activity=Be.activityZodSchema=void 0;var Yu=Oi(),_=j(),Xu=Zi(),Qu=ki(),Gi=kn(),ed=En(),Ur=Un(),td=Mi(),rd=on(),Hi=Ni(),Er=Rn(),Bi=sn(),nd=Mn(),od=zi(),id=an(),sd=Nn(),ad=jn(),cd=Dn(),Ki=Vi(),ud=Fn(),dd=Wi(),Ji=qt();Be.activityZodSchema=_.z.object({type:_.z.union([Ur.activityTypesZodSchema,_.z.string().min(1)]),text:_.z.string().optional(),id:_.z.string().min(1).optional(),channelId:_.z.string().min(1).optional(),from:Er.channelAccountZodSchema.optional(),timestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:_.z.string().min(1).optional(),callerId:_.z.string().min(1).optional(),serviceUrl:_.z.string().min(1).optional(),conversation:nd.conversationAccountZodSchema.optional(),recipient:Er.channelAccountZodSchema.optional(),textFormat:_.z.union([ud.textFormatTypesZodSchema,_.z.string().min(1)]).optional(),attachmentLayout:_.z.union([rd.attachmentLayoutTypesZodSchema,_.z.string().min(1)]).optional(),membersAdded:_.z.array(Er.channelAccountZodSchema).optional(),membersRemoved:_.z.array(Er.channelAccountZodSchema).optional(),reactionsAdded:_.z.array(Ki.messageReactionZodSchema).optional(),reactionsRemoved:_.z.array(Ki.messageReactionZodSchema).optional(),topicName:_.z.string().min(1).optional(),historyDisclosed:_.z.boolean().optional(),locale:_.z.string().min(1).optional(),speak:_.z.string().min(1).optional(),inputHint:_.z.union([cd.inputHintsZodSchema,_.z.string().min(1)]).optional(),summary:_.z.string().min(1).optional(),suggestedActions:Qu.suggestedActionsZodSchema.optional(),attachments:_.z.array(td.attachmentZodSchema).optional(),entities:_.z.array(ad.entityZodSchema.passthrough()).optional(),channelData:_.z.any().optional(),action:_.z.string().min(1).optional(),replyToId:_.z.string().min(1).optional(),label:_.z.string().min(1).optional(),valueType:_.z.string().min(1).optional(),value:_.z.unknown().optional(),name:_.z.union([Gi.activityEventNamesZodSchema,_.z.string().min(1)]).optional(),relatesTo:od.conversationReferenceZodSchema.optional(),code:_.z.union([id.endOfConversationCodesZodSchema,_.z.string().min(1)]).optional(),expiration:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:_.z.union([ed.activityImportanceZodSchema,_.z.string().min(1)]).optional(),deliveryMode:_.z.union([sd.deliveryModesZodSchema,_.z.string().min(1)]).optional(),listenFor:_.z.array(_.z.string().min(1)).optional(),textHighlights:_.z.array(dd.textHighlightZodSchema).optional(),semanticAction:Xu.semanticActionZodSchema.optional()});var Vn=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Be.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw new Error(`Invalid channelId ${e}. Found subChannel but no main channel.`);this._channelId=r,n?(0,Hi.addProductInfoToActivity)(this,n):(0,Hi.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw new Error("Primary channel must be set before setting subChannel");this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:Ur.ActivityTypes.Event,name:Gi.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,Yu.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==Ur.ActivityTypes.ConversationUpdate||this.channelId!==Bi.Channels.Directline&&this.channelId!==Bi.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===Ur.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(){let e={...this};return e.channelId=e._channelId,delete e._channelId,JSON.stringify(e)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Ji.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Be.Activity=Vn});var Xi=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.activityTreatments=wt.ActivityTreatments=void 0;var ld=j(),$n;(function(t){t.Targeted="targeted"})($n||(wt.ActivityTreatments=$n={}));wt.activityTreatments=ld.z.nativeEnum($n)});var Wn=y(w=>{"use strict";var fd=w&&w.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Qi=w&&w.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&fd(e,t,r)};Object.defineProperty(w,"__esModule",{value:!0});w.Logger=w.debug=w.ActivityTreatments=w.TextFormatTypes=w.MessageReactionTypes=w.InputHints=w.DeliveryModes=w.ActivityTypes=w.ActivityImportance=w.ActivityEventNames=w.activityZodSchema=w.Activity=w.RoleTypes=w.MembershipTypes=w.MembershipSourceTypes=w.EndOfConversationCodes=w.Channels=w.AttachmentLayoutTypes=w.SemanticActionStateTypes=w.ActionTypes=void 0;var pd=rn();Object.defineProperty(w,"ActionTypes",{enumerable:!0,get:function(){return pd.ActionTypes}});var hd=nn();Object.defineProperty(w,"SemanticActionStateTypes",{enumerable:!0,get:function(){return hd.SemanticActionStateTypes}});var md=on();Object.defineProperty(w,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return md.AttachmentLayoutTypes}});var yd=sn();Object.defineProperty(w,"Channels",{enumerable:!0,get:function(){return yd.Channels}});var vd=an();Object.defineProperty(w,"EndOfConversationCodes",{enumerable:!0,get:function(){return vd.EndOfConversationCodes}});var gd=Go();Object.defineProperty(w,"MembershipSourceTypes",{enumerable:!0,get:function(){return gd.MembershipSourceTypes}});var _d=Xo();Object.defineProperty(w,"MembershipTypes",{enumerable:!0,get:function(){return _d.MembershipTypes}});var bd=qt();Object.defineProperty(w,"RoleTypes",{enumerable:!0,get:function(){return bd.RoleTypes}});Qi(ei(),w);Qi(ti(),w);var es=Yi();Object.defineProperty(w,"Activity",{enumerable:!0,get:function(){return es.Activity}});Object.defineProperty(w,"activityZodSchema",{enumerable:!0,get:function(){return es.activityZodSchema}});var xd=kn();Object.defineProperty(w,"ActivityEventNames",{enumerable:!0,get:function(){return xd.ActivityEventNames}});var wd=En();Object.defineProperty(w,"ActivityImportance",{enumerable:!0,get:function(){return wd.ActivityImportance}});var Cd=Un();Object.defineProperty(w,"ActivityTypes",{enumerable:!0,get:function(){return Cd.ActivityTypes}});var Id=Nn();Object.defineProperty(w,"DeliveryModes",{enumerable:!0,get:function(){return Id.DeliveryModes}});var Td=Dn();Object.defineProperty(w,"InputHints",{enumerable:!0,get:function(){return Td.InputHints}});var Sd=zn();Object.defineProperty(w,"MessageReactionTypes",{enumerable:!0,get:function(){return Sd.MessageReactionTypes}});var Ad=Fn();Object.defineProperty(w,"TextFormatTypes",{enumerable:!0,get:function(){return Ad.TextFormatTypes}});var Od=Xi();Object.defineProperty(w,"ActivityTreatments",{enumerable:!0,get:function(){return Od.ActivityTreatments}});var ts=Mt();Object.defineProperty(w,"debug",{enumerable:!0,get:function(){return ts.debug}});Object.defineProperty(w,"Logger",{enumerable:!0,get:function(){return ts.Logger}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Rt=(A=>(A.Unknown="Unknown",A.Exp="Exp",A.Dev="Dev",A.Test="Test",A.Preprod="Preprod",A.FirstRelease="FirstRelease",A.Prod="Prod",A.Gov="Gov",A.High="High",A.DoD="DoD",A.Mooncake="Mooncake",A.Ex="Ex",A.Rx="Rx",A.Prv="Prv",A.Local="Local",A.GovFR="GovFR",A.Other="Other",A))(Rt||{});var $r=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},Wr=class extends $r{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(Rt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Rt).join(", ")}`);if(!Object.values(Ut).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Ut).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Bd=()=>{var t,e,r,n,o,i;return new Wr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};var tr=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Hr(t){}function uo(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Hr,onError:r=Hr,onRetry:n=Hr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(g){let S=s?g.replace(/^\xEF\xBB\xBF/,""):g,[A,F]=ks(`${i}${S}`);for(let te of A)m(te);i=F,s=!1}function m(g){if(g===""){T();return}if(g.startsWith(":")){o&&o(g.slice(g.startsWith(": ")?2:1));return}let S=g.indexOf(":");if(S!==-1){let A=g.slice(0,S),F=g[S+1]===" "?2:1,te=g.slice(S+F);b(A,te,g);return}b(g,"",g)}function b(g,S,A){switch(g){case"event":l=S;break;case"data":d=`${d}${S}
2
2
  `;break;case"id":a=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new tr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:A}));break;default:r(new tr(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:S,line:A}));break}}function T(){d.length>0&&e({id:a,event:l||void 0,data:d.endsWith(`
3
- `)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(g={}){i&&g.consume&&m(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:O}}function Us(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
3
+ `)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(g={}){i&&g.consume&&m(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:O}}function ks(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
4
4
  `,n),s=-1;if(o!==-1&&i!==-1?s=Math.min(o,i):o!==-1?o===t.length-1?s=-1:s=o:i!==-1&&(s=i),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
5
- `&&n++}}return[e,r]}var fo="connecting",Rs="open",Kr="closed",rr=()=>{};function Ms(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=rr,onConnect:i=rr,onDisconnect:s=rr,onScheduleReconnect:a=rr}=r,{fetch:d,url:l,initialLastEventId:f}=Ns(r),m={...r.headers},_=[],T=n?[n]:[],O=E=>T.forEach(ne=>ne(E)),g=lo({onEvent:Ts,onRetry:Ss,onComment:o}),S,A=l.toString(),q=new AbortController,te=f,ye=2e3,Vr,re=Kr;return Pt(),{close:Zt,connect:Pt,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:$r,get lastEventId(){return te},get url(){return A},get readyState(){return re}};function Pt(){S||(re=fo,q=new AbortController,S=d(l,As()).then(Is).catch(E=>{S=null,!(E.name==="AbortError"||E.type==="aborted"||q.signal.aborted)&&so()}))}function Zt(){re=Kr,q.abort(),g.reset(),clearTimeout(Vr),_.forEach(E=>E())}function $r(){let E=[],ne=[];function jt(){return new Promise(F=>{let oe=ne.shift();oe?F({value:oe,done:!1}):E.push(F)})}let Ge=function(F){let oe=E.shift();oe?oe({value:F,done:!1}):ne.push(F)};function Ie(){for(T.splice(T.indexOf(Ge),1);E.shift(););for(;ne.shift(););}function kt(){let F=E.shift();F&&(F({done:!0,value:void 0}),Ie())}return _.push(kt),T.push(Ge),{next(){return re===Kr?this.return():jt()},return(){return Ie(),Promise.resolve({done:!0,value:void 0})},throw(F){return Ie(),Promise.reject(F)},[Symbol.asyncIterator](){return this}}}function so(){a({delay:ye}),!q.signal.aborted&&(re=fo,Vr=setTimeout(Pt,ye))}async function Is(E){i(),g.reset();let{body:ne,redirected:jt,status:Ge}=E;if(Ge===204){s(),Zt();return}if(!ne)throw new Error("Missing response body");jt&&(A=E.url);let Ie=e(ne),kt=new TextDecoder,F=Ie.getReader(),oe=!0;re=Rs;do{let{done:ao,value:co}=await F.read();co&&g.feed(kt.decode(co,{stream:!ao})),ao&&(oe=!1,S=null,g.reset(),so(),s())}while(oe)}function Ts(E){typeof E.id=="string"&&(te=E.id),O(E)}function Ss(E){ye=E}function As(){let{mode:E,credentials:ne,body:jt,method:Ge,redirect:Ie,referrer:kt,referrerPolicy:F}=r,oe={Accept:"text/event-stream",...m,...te?{"Last-Event-ID":te}:void 0};return{mode:E,credentials:ne,body:jt,method:Ge,redirect:Ie,referrer:kt,referrerPolicy:F,headers:oe,cache:"no-store",signal:q.signal}}}function Ns(t){let e=t.fetch||globalThis.fetch;if(!Ds(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function Ds(t){return typeof t=="function"}var zs={getStream:Ls};function po(t){return Ms(t,zs)}function Ls(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var bo=Et(Mt());var sr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var ar=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var Qe=(0,bo.debug)("copilot-studio:power-platform");function ur(t,e){var a,d,l,f,m,_;if((a=t.directConnectUrl)!=null&&a.trim()){if(Qe.debug(`Using direct connection: ${t.directConnectUrl}`),!Nt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(Qe.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),ur({...t,directConnectUrl:""},e)):na(t.directConnectUrl,e).href}let r=(d=t.cloud)!=null?d:"Prod",n=(l=t.copilotAgentType)!=null?l:"Published";if(Qe.debug(`Using cloud setting: ${r}`),Qe.debug(`Using agent type: ${n}`),!((f=t.environmentId)!=null&&f.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((_=t.customPowerPlatformCloud)!=null&&_.trim())if(Nt(t.customPowerPlatformCloud))Qe.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=oa(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new ar({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new sr({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return Qe.debug(`Generated Copilot Studio connection URL: ${s}`),s}function xo(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&Nt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Nt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${cr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Nt(n)){if(_o(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${cr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${cr(_o(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Nt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function na(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function oa(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=ia(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${cr(t,r)}`)}function cr(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function ia(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function _o(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var Xt=Et(Hn());var Mr=class{constructor(e){this.activity=e}};var ss=Et(Mt());var os="1.1.0-alpha.85";var Nr={};var J=(0,ss.debug)("copilot-studio:client"),he=class he{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var i,s;J.debug(`>>> SEND TO ${e}`);let o=po({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":he.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(a,d)=>{let l=await fetch(a,d);return this.processResponseHeaders(l.headers),l}});try{for await(let{data:a,event:d}of o){if(a&&d==="activity")try{let l=Xt.Activity.fromJson(a);switch(l.type){case Xt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(i=l.conversation)==null?void 0:i.id)!=null?s:"",J.debug(`Conversation ID: ${this.conversationId}`)),yield l;break;default:J.debug(`Activity type: ${l.type}`),yield l;break}}catch(l){J.error("Failed to parse activity:",l)}else if(d==="end"){J.debug("Stream complete");break}if(o.readyState==="closed"){J.debug("Connection closed");break}}}finally{o.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${os}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Nr.platform()}-${Nr.arch()}/${Nr.release()}`,J.debug(`User-Agent: ${r}`),r}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(he.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,J.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(he.conversationIdHeaderKey))!=null?o:"",this.conversationId&&J.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==he.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),J.debug("Headers received:",r)}async*startConversationAsync(e=!0){let r=ur(this.settings),n={emitStartConversationEvent:e};J.info("Starting conversation ..."),yield*this.postRequestAsync(r,n,"POST")}async*askQuestionAsync(e,r=this.conversationId){let o={type:"message",text:e,conversation:{id:r}},i=Xt.Activity.fromObject(o);yield*this.sendActivity(i)}async*sendActivity(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=ur(this.settings,n),i=new Mr(e);J.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}};he.conversationIdHeaderKey="x-ms-conversationid",he.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",he.scopeFromSettings=xo;var is=he;var R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function as(t,e=0){return(R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]).toLowerCase()}var Bn,Ed=new Uint8Array(16);function Kn(){if(!Bn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bn=crypto.getRandomValues.bind(crypto)}return Bn(Ed)}var Ud=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gn={randomUUID:Ud};function Rd(t,e,r){var o,i,s;if(Gn.randomUUID&&!e&&!t)return Gn.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Kn();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return as(n)}var Jn=Rd;var ws=Et(Hn());var Yn=function(t,e){return Yn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Yn(t,e)};function Ce(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Yn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ct(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function It(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Y(t){return typeof t=="function"}function Dr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var zr=Dr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
5
+ `&&n++}}return[e,r]}var lo="connecting",Es="open",Br="closed",rr=()=>{};function Us(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=rr,onConnect:i=rr,onDisconnect:s=rr,onScheduleReconnect:a=rr}=r,{fetch:d,url:l,initialLastEventId:f}=Rs(r),m={...r.headers},b=[],T=n?[n]:[],O=E=>T.forEach(ne=>ne(E)),g=uo({onEvent:Cs,onRetry:Is,onComment:o}),S,A=l.toString(),F=new AbortController,te=f,ye=2e3,qr,re=Br;return Pt(),{close:Zt,connect:Pt,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Vr,get lastEventId(){return te},get url(){return A},get readyState(){return re}};function Pt(){S||(re=lo,F=new AbortController,S=d(l,Ts()).then(ws).catch(E=>{S=null,!(E.name==="AbortError"||E.type==="aborted"||F.signal.aborted)&&io()}))}function Zt(){re=Br,F.abort(),g.reset(),clearTimeout(qr),b.forEach(E=>E())}function Vr(){let E=[],ne=[];function jt(){return new Promise(q=>{let oe=ne.shift();oe?q({value:oe,done:!1}):E.push(q)})}let Je=function(q){let oe=E.shift();oe?oe({value:q,done:!1}):ne.push(q)};function Ie(){for(T.splice(T.indexOf(Je),1);E.shift(););for(;ne.shift(););}function kt(){let q=E.shift();q&&(q({done:!0,value:void 0}),Ie())}return b.push(kt),T.push(Je),{next(){return re===Br?this.return():jt()},return(){return Ie(),Promise.resolve({done:!0,value:void 0})},throw(q){return Ie(),Promise.reject(q)},[Symbol.asyncIterator](){return this}}}function io(){a({delay:ye}),!F.signal.aborted&&(re=lo,qr=setTimeout(Pt,ye))}async function ws(E){i(),g.reset();let{body:ne,redirected:jt,status:Je}=E;if(Je===204){s(),Zt();return}if(!ne)throw new Error("Missing response body");jt&&(A=E.url);let Ie=e(ne),kt=new TextDecoder,q=Ie.getReader(),oe=!0;re=Es;do{let{done:so,value:ao}=await q.read();ao&&g.feed(kt.decode(ao,{stream:!so})),so&&(oe=!1,S=null,g.reset(),io(),s())}while(oe)}function Cs(E){typeof E.id=="string"&&(te=E.id),O(E)}function Is(E){ye=E}function Ts(){let{mode:E,credentials:ne,body:jt,method:Je,redirect:Ie,referrer:kt,referrerPolicy:q}=r,oe={Accept:"text/event-stream",...m,...te?{"Last-Event-ID":te}:void 0};return{mode:E,credentials:ne,body:jt,method:Je,redirect:Ie,referrer:kt,referrerPolicy:q,headers:oe,cache:"no-store",signal:F.signal}}}function Rs(t){let e=t.fetch||globalThis.fetch;if(!Ms(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function Ms(t){return typeof t=="function"}var Ns={getStream:Ds};function fo(t){return Us(t,Ns)}function Ds(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var _o=Et(Mt());var sr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var ar=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var Qe=(0,_o.debug)("copilot-studio:power-platform");function ur(t,e){var a,d,l,f,m,b;if((a=t.directConnectUrl)!=null&&a.trim()){if(Qe.debug(`Using direct connection: ${t.directConnectUrl}`),!Nt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(Qe.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),ur({...t,directConnectUrl:""},e)):ta(t.directConnectUrl,e).href}let r=(d=t.cloud)!=null?d:"Prod",n=(l=t.copilotAgentType)!=null?l:"Published";if(Qe.debug(`Using cloud setting: ${r}`),Qe.debug(`Using agent type: ${n}`),!((f=t.environmentId)!=null&&f.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((b=t.customPowerPlatformCloud)!=null&&b.trim())if(Nt(t.customPowerPlatformCloud))Qe.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=ra(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new ar({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new sr({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return Qe.debug(`Generated Copilot Studio connection URL: ${s}`),s}function bo(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&Nt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Nt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${cr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Nt(n)){if(go(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${cr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${cr(go(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Nt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ta(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function ra(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=na(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${cr(t,r)}`)}function cr(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function na(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function go(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var Xt=Et(Wn());var Rr=class{constructor(e){this.activity=e}};var os=Et(Mt());var rs="1.1.1";var Mr={};var G=(0,os.debug)("copilot-studio:client"),he=class he{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var i,s;G.debug(`>>> SEND TO ${e}`);let o=fo({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":he.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(a,d)=>{let l=await fetch(a,d);return this.processResponseHeaders(l.headers),l}});try{for await(let{data:a,event:d}of o){if(a&&d==="activity")try{let l=Xt.Activity.fromJson(a);switch(l.type){case Xt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(i=l.conversation)==null?void 0:i.id)!=null?s:"",G.debug(`Conversation ID: ${this.conversationId}`)),yield l;break;default:G.debug(`Activity type: ${l.type}`),yield l;break}}catch(l){G.error("Failed to parse activity:",l)}else if(d==="end"){G.debug("Stream complete");break}if(o.readyState==="closed"){G.debug("Connection closed");break}}}finally{o.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${rs}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Mr.platform()}-${Mr.arch()}/${Mr.release()}`,G.debug(`User-Agent: ${r}`),r}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(he.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,G.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(he.conversationIdHeaderKey))!=null?o:"",this.conversationId&&G.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==he.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),G.debug("Headers received:",r)}async*startConversationStreaming(e=!0){let r=ur(this.settings),n={emitStartConversationEvent:e};G.info("Starting conversation ..."),yield*this.postRequestAsync(r,n,"POST")}async*sendActivityStreaming(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=ur(this.settings,n),i=new Rr(e);G.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}async startConversationAsync(e=!0){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=Xt.Activity.fromObject(i),a=[];for await(let d of this.sendActivityStreaming(s,r))a.push(d);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}};he.conversationIdHeaderKey="x-ms-conversationid",he.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",he.scopeFromSettings=bo;var ns=he;var R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function is(t,e=0){return(R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]).toLowerCase()}var Hn,Zd=new Uint8Array(16);function Bn(){if(!Hn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hn=crypto.getRandomValues.bind(crypto)}return Hn(Zd)}var jd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Kn={randomUUID:jd};function kd(t,e,r){var o,i,s;if(Kn.randomUUID&&!e&&!t)return Kn.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Bn();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return is(n)}var Jn=kd;var bs=Et(Wn());var Gn=function(t,e){return Gn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Gn(t,e)};function Ce(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Gn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ct(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function It(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Y(t){return typeof t=="function"}function Nr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Dr=Nr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
6
6
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
7
- `):"",this.name="UnsubscriptionError",this.errors=r}});function er(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Tt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Qt(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(g){e={error:g}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(Y(f))try{f()}catch(g){i=g instanceof zr?g.errors:[g]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var _=Qt(m),T=_.next();!T.done;T=_.next()){var O=T.value;try{cs(O)}catch(g){i=i!=null?i:[],g instanceof zr?i=It(It([],Ct(i)),Ct(g.errors)):i.push(g)}}}catch(g){n={error:g}}finally{try{T&&!T.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(i)throw new zr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)cs(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&er(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&er(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Xn=Tt.EMPTY;function Lr(t){return t instanceof Tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function cs(t){Y(t)?t():t.unsubscribe()}var ee={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var St={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=St.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,It([t,e],Ct(r))):setTimeout.apply(void 0,It([t,e],Ct(r)))},clearTimeout:function(t){var e=St.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function us(t){St.setTimeout(function(){var e=ee.onUnhandledError;if(e)e(t);else throw t})}function Qn(){}var ds=(function(){return eo("C",void 0,void 0)})();function ls(t){return eo("E",void 0,t)}function fs(t){return eo("N",t,void 0)}function eo(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function At(t){if(ee.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,o=r.error;if(Ke=null,n)throw o}}else t()}function ps(t){ee.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=t)}var no=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lr(r)&&r.add(n)):n.destination=zd,n}return e.create=function(r,n,o){return new Fr(r,n,o)},e.prototype.next=function(r){this.isStopped?ro(fs(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?ro(ls(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?ro(ds,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Tt);var Md=Function.prototype.bind;function to(t,e){return Md.call(t,e)}var Nd=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){qr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){qr(n)}else qr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){qr(r)}},t})(),Fr=(function(t){Ce(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(Y(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ee.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&to(r.next,a),error:r.error&&to(r.error,a),complete:r.complete&&to(r.complete,a)}):s=r}return i.destination=new Nd(s),i}return e})(no);function qr(t){ee.useDeprecatedSynchronousErrorHandling?ps(t):us(t)}function Dd(t){throw t}function ro(t,e){var r=ee.onStoppedNotification;r&&St.setTimeout(function(){return r(t,e)})}var zd={closed:!0,next:Qn,error:Dd,complete:Qn};var hs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ms(t){return t}function ys(t){return t.length===0?ms:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ot=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=qd(e)?e:new Fr(e,r,n);return At(function(){var s=o,a=s.operator,d=s.source;i.add(a?a.call(i,d):d?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=vs(r),new r(function(o,i){var s=new Fr({next:function(a){try{e(a)}catch(d){i(d),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[hs]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ys(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=vs(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function vs(t){var e;return(e=t!=null?t:ee.Promise)!==null&&e!==void 0?e:Promise}function Ld(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function qd(t){return t&&t instanceof no||Ld(t)&&Lr(t)}var gs=Dr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var oo=(function(t){Ce(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new _s(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new gs},e.prototype.next=function(r){var n=this;At(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Qt(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;At(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;At(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Xn:(this.currentObservers=null,a.push(r),new Tt(function(){n.currentObservers=null,er(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Ot;return r.source=this,r},e.create=function(r,n){return new _s(r,n)},e})(Ot);var _s=(function(t){Ce(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Xn},e})(oo);var io=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(oo);var Cs=Et(Mt()),me=(0,Cs.debug)("copilot-studio:webchat"),bs=class{static createConnection(e,r){me.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new io(0),a=xs(async f=>{if(o=f,s.value<2){s.next(2);return}me.debug("--> Connection established."),l();for await(let m of e.startConversationAsync())delete m.replyToId,i=m.conversation,d(m)}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,me.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},l=()=>{if(!(r!=null&&r.showTyping))return;let f=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};d({type:"typing",from:f})};return{connectionStatus$:s,activity$:a,postActivity(f){if(me.info("--> Preparing to send activity to Copilot Studio ..."),!f)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return xs(async m=>{try{me.info("--> Sending activity to Copilot Studio ...");let _=ws.Activity.fromObject({...f,id:Jn(),attachments:await Fd(f)});d(_),l(),m.next(_.id);for await(let T of e.sendActivity(_))d(T),me.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(_){me.error("Error sending Activity to Copilot Studio:",_),m.error(_)}})},end(){me.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function Fd(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Vd(n);e.push(o)}return e}async function Vd(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=$d(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,me.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function $d(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function xs(t){return new Ot(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Ut as AgentType,Hr as ConnectionSettings,is as CopilotStudioClient,bs as CopilotStudioWebChat,Mr as ExecuteTurnRequest,Rt as PowerPlatformCloud,ur as getCopilotStudioConnectionUrl,xo as getTokenAudience,Jd as loadCopilotStudioConnectionSettingsFromEnv};
7
+ `):"",this.name="UnsubscriptionError",this.errors=r}});function er(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Tt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Qt(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(g){e={error:g}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(Y(f))try{f()}catch(g){i=g instanceof Dr?g.errors:[g]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var b=Qt(m),T=b.next();!T.done;T=b.next()){var O=T.value;try{ss(O)}catch(g){i=i!=null?i:[],g instanceof Dr?i=It(It([],Ct(i)),Ct(g.errors)):i.push(g)}}}catch(g){n={error:g}}finally{try{T&&!T.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new Dr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)ss(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&er(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&er(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Yn=Tt.EMPTY;function zr(t){return t instanceof Tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function ss(t){Y(t)?t():t.unsubscribe()}var ee={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var St={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=St.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,It([t,e],Ct(r))):setTimeout.apply(void 0,It([t,e],Ct(r)))},clearTimeout:function(t){var e=St.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function as(t){St.setTimeout(function(){var e=ee.onUnhandledError;if(e)e(t);else throw t})}function Xn(){}var cs=(function(){return Qn("C",void 0,void 0)})();function us(t){return Qn("E",void 0,t)}function ds(t){return Qn("N",t,void 0)}function Qn(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function At(t){if(ee.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,o=r.error;if(Ke=null,n)throw o}}else t()}function ls(t){ee.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=t)}var ro=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,zr(r)&&r.add(n)):n.destination=Md,n}return e.create=function(r,n,o){return new Fr(r,n,o)},e.prototype.next=function(r){this.isStopped?to(ds(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?to(us(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?to(cs,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Tt);var Ed=Function.prototype.bind;function eo(t,e){return Ed.call(t,e)}var Ud=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Lr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Lr(n)}else Lr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Lr(r)}},t})(),Fr=(function(t){Ce(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(Y(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ee.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&eo(r.next,a),error:r.error&&eo(r.error,a),complete:r.complete&&eo(r.complete,a)}):s=r}return i.destination=new Ud(s),i}return e})(ro);function Lr(t){ee.useDeprecatedSynchronousErrorHandling?ls(t):as(t)}function Rd(t){throw t}function to(t,e){var r=ee.onStoppedNotification;r&&St.setTimeout(function(){return r(t,e)})}var Md={closed:!0,next:Xn,error:Rd,complete:Xn};var fs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ps(t){return t}function hs(t){return t.length===0?ps:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ot=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=Dd(e)?e:new Fr(e,r,n);return At(function(){var s=o,a=s.operator,d=s.source;i.add(a?a.call(i,d):d?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=ms(r),new r(function(o,i){var s=new Fr({next:function(a){try{e(a)}catch(d){i(d),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[fs]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return hs(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=ms(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function ms(t){var e;return(e=t!=null?t:ee.Promise)!==null&&e!==void 0?e:Promise}function Nd(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function Dd(t){return t&&t instanceof ro||Nd(t)&&zr(t)}var ys=Nr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var no=(function(t){Ce(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new vs(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ys},e.prototype.next=function(r){var n=this;At(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Qt(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;At(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;At(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Yn:(this.currentObservers=null,a.push(r),new Tt(function(){n.currentObservers=null,er(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Ot;return r.source=this,r},e.create=function(r,n){return new vs(r,n)},e})(Ot);var vs=(function(t){Ce(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Yn},e})(no);var oo=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(no);var xs=Et(Mt()),me=(0,xs.debug)("copilot-studio:webchat"),gs=class{static createConnection(e,r){me.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new oo(0),a=_s(async f=>{if(o=f,s.value<2){s.next(2);return}me.debug("--> Connection established."),l();for await(let m of e.startConversationStreaming())delete m.replyToId,i=m.conversation,d(m)}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,me.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},l=()=>{if(!(r!=null&&r.showTyping))return;let f=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};d({type:"typing",from:f})};return{connectionStatus$:s,activity$:a,postActivity(f){if(me.info("--> Preparing to send activity to Copilot Studio ..."),!f)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return _s(async m=>{try{me.info("--> Sending activity to Copilot Studio ...");let b=bs.Activity.fromObject({...f,id:Jn(),attachments:await zd(f)});d(b),l(),m.next(b.id);for await(let T of e.sendActivityStreaming(b))d(T),me.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(b){me.error("Error sending Activity to Copilot Studio:",b),m.error(b)}})},end(){me.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function zd(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Ld(n);e.push(o)}return e}async function Ld(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=Fd(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,me.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Fd(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function _s(t){return new Ot(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Ut as AgentType,Wr as ConnectionSettings,ns as CopilotStudioClient,gs as CopilotStudioWebChat,Rr as ExecuteTurnRequest,Rt as PowerPlatformCloud,ur as getCopilotStudioConnectionUrl,bo as getTokenAudience,Bd as loadCopilotStudioConnectionSettingsFromEnv};
8
8
  //# sourceMappingURL=browser.mjs.map