@microsoft/agents-copilotstudio-client 1.3.0-beta.10.gf7fc2bf267 → 1.3.0-beta.14.gf38b0646bb

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 ks=Object.create;var yo=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ms=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ds=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rs(e))!Ms.call(t,o)&&o!==r&&yo(t,o,{get:()=>e[o],enumerable:!(n=Us(e,o))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?ks(Ns(t)):{},Ds(e||!t||!t.__esModule?yo(r,"default",{value:t,enumerable:!0}):r,t));var xo=y((cl,bo)=>{var tt=1e3,rt=tt*60,nt=rt*60,Ee=nt*24,Ws=Ee*7,Bs=Ee*365.25;bo.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Ks(t);if(r==="number"&&isFinite(t))return e.long?Gs(t):Js(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Ks(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*Bs;case"weeks":case"week":case"w":return r*Ws;case"days":case"day":case"d":return r*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return r*nt;case"minutes":case"minute":case"mins":case"min":case"m":return r*rt;case"seconds":case"second":case"secs":case"sec":case"s":return r*tt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Js(t){var e=Math.abs(t);return e>=Ee?Math.round(t/Ee)+"d":e>=nt?Math.round(t/nt)+"h":e>=rt?Math.round(t/rt)+"m":e>=tt?Math.round(t/tt)+"s":t+"ms"}function Gs(t){var e=Math.abs(t);return e>=Ee?sr(t,e,Ee,"day"):e>=nt?sr(t,e,nt,"hour"):e>=rt?sr(t,e,rt,"minute"):e>=tt?sr(t,e,tt,"second"):t+" ms"}function sr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Co=y((ul,wo)=>{function Ys(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=xo(),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 g=0;g<f.length;g++)m=(m<<5)-m+f.charCodeAt(g),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,g=null,C,O;function v(...S){if(!v.enabled)return;let A=v,P=Number(new Date),R=P-(m||P);A.diff=R,A.prev=m,A.curr=P,m=P,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let V=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,($,Y)=>{if($==="%%")return"%";V++;let Oe=r.formatters[Y];if(typeof Oe=="function"){let Kr=S[V];$=Oe.call(A,Kr),S.splice(V,1),V--}return $}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return v.namespace=f,v.useColors=r.useColors(),v.color=r.selectColor(f),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(C!==r.namespaces&&(C=r.namespaces,O=r.enabled(f)),O),set:S=>{g=S}}),typeof r.init=="function"&&r.init(v),v}function n(f,m){let g=r(this.namespace+(typeof m=="undefined"?":":m)+f);return g.log=this.log,g}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 g of m)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function i(f,m){let g=0,C=0,O=-1,v=0;for(;g<f.length;)if(C<m.length&&(m[C]===f[g]||m[C]==="*"))m[C]==="*"?(O=C,v=g,C++):(g++,C++);else if(O!==-1)C=O+1,v++,g=v;else return!1;for(;C<m.length&&m[C]==="*";)C++;return C===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}wo.exports=Ys});var Io=y((W,ar)=>{W.formatArgs=Qs;W.save=ea;W.load=ta;W.useColors=Xs;W.storage=ra();W.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`."))}})();W.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 Xs(){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 Qs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ar.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)}W.log=console.debug||console.log||(()=>{});function ea(t){try{t?W.storage.setItem("debug",t):W.storage.removeItem("debug")}catch{}}function ta(){let t;try{t=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function ra(){try{return localStorage}catch{}}ar.exports=Co()(W);var{formatters:na}=ar.exports;na.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var zt=y(je=>{"use strict";var oa=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0});je.Logger=void 0;je.debug=aa;var ia=oa(Io()),sa=["info","warn","error","debug"],cr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of sa){let n=(0,ia.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)}};je.Logger=cr;function aa(t){return new cr(t)}});var Ft=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Qr;(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})(Qr||(k.util=Qr={}));var Oo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Oo||(k.objectUtil=Oo={}));k.ZodParsedType=Qr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var la=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=la});var pr=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.ZodError=_e.quotelessJson=_e.ZodIssueCode=void 0;var Po=Ft();_e.ZodIssueCode=Po.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 fa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");_e.quotelessJson=fa;var Vt=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,Po.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()}};_e.ZodError=Vt;Vt.create=t=>new Vt(t)});var tn=y(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});var D=pr(),Ze=Ft(),pa=(t,e)=>{let r;switch(t.code){case D.ZodIssueCode.invalid_type:t.received===Ze.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case D.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.util.jsonStringifyReplacer)}`;break;case D.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.util.joinValues(t.keys,", ")}`;break;case D.ZodIssueCode.invalid_union:r="Invalid input";break;case D.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.util.joinValues(t.options)}`;break;case D.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.util.joinValues(t.options)}, received '${t.received}'`;break;case D.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case D.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case D.ZodIssueCode.invalid_date:r="Invalid date";break;case D.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}"`:Ze.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case D.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 D.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 D.ZodIssueCode.custom:r="Invalid input";break;case D.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case D.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case D.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.util.assertNever(t)}return{message:r}};en.default=pa});var hr=y(be=>{"use strict";var ha=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=ma;be.getErrorMap=ya;var Eo=ha(tn());be.defaultErrorMap=Eo.default;var jo=Eo.default;function ma(t){jo=t}function ya(){return jo}});var nn=y(j=>{"use strict";var va=j&&j.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(j,"__esModule",{value:!0});j.isAsync=j.isValid=j.isDirty=j.isAborted=j.OK=j.DIRTY=j.INVALID=j.ParseStatus=j.EMPTY_PATH=j.makeIssue=void 0;j.addIssueToContext=ba;var ga=hr(),Zo=va(tn()),_a=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}};j.makeIssue=_a;j.EMPTY_PATH=[];function ba(t,e){let r=(0,ga.getErrorMap)(),n=(0,j.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Zo.default?void 0:Zo.default].filter(o=>!!o)});t.common.issues.push(n)}var rn=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 j.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 j.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}}};j.ParseStatus=rn;j.INVALID=Object.freeze({status:"aborted"});var xa=t=>({status:"dirty",value:t});j.DIRTY=xa;var wa=t=>({status:"valid",value:t});j.OK=wa;var Ca=t=>t.status==="aborted";j.isAborted=Ca;var Ia=t=>t.status==="dirty";j.isDirty=Ia;var Ta=t=>t.status==="valid";j.isValid=Ta;var Sa=t=>typeof Promise!="undefined"&&t instanceof Promise;j.isAsync=Sa});var Uo=y(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0})});var No=y(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.errorUtil=void 0;var Ro;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ro||(mr.errorUtil=Ro={}))});var Ko=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=qo;c.custom=Vo;var p=pr(),yr=hr(),_=No(),u=nn(),h=Ft(),Q=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}},Mo=(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 I(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 T=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 Mo(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 Mo(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 J({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 X.create(this,this._def)}nullable(){return ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return Ce.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new J({...I(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new He({...I(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new $t({typeName:w.ZodBranded,type:this,...I(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new We({...I(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 Ht.create(this,e)}readonly(){return Be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=T;c.Schema=T;c.ZodSchema=T;var Aa=/^c[^\s-]{8,}$/i,Oa=/^[0-9a-z]+$/,Pa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ea=/^[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,ja=/^[a-z0-9_-]{21}$/i,Za=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ka=/^[-+]?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)?)??$/,Ua=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ra="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",on,Na=/^(?:(?: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])$/,Ma=/^(?:(?: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])$/,Da=/^(([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]))$/,La=/^(([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])$/,za=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lo="((\\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])))",Fa=new RegExp(`^${Lo}$`);function zo(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 Va(t){return new RegExp(`^${zo(t)}$`)}function qo(t){let e=`${Lo}T${zo(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 $a(t,e){return!!((e==="v4"||!e)&&Na.test(t)||(e==="v6"||!e)&&Da.test(t))}function Ha(t,e){if(!Za.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 Wa(t,e){return!!((e==="v4"||!e)&&Ma.test(t)||(e==="v6"||!e)&&La.test(t))}var xe=class t extends T{_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")Ua.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")on||(on=new RegExp(Ra,"u")),on.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")Ea.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")ja.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")Aa.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")Oa.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")Pa.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"?qo(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"?Fa.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"?Va(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"?ka.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"?$a(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"?Ha(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"?Wa(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"?za.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"?qa.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,..._.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.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,..._.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,..._.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,_.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=xe;xe.create=t=>{var e;return new xe({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};function Ba(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 ke=class t extends T{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"?Ba(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,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.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=ke;ke.create=t=>new ke({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ue=class t extends T{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,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.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:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.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=Ue;Ue.create=t=>{var e;return new Ue({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};var Re=class extends T{_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=Re;Re.create=t=>new Re({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ne=class t extends T{_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:_.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.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=Ne;Ne.create=t=>new Ne({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...I(t)});var st=class extends T{_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=st;st.create=t=>new st({typeName:w.ZodSymbol,...I(t)});var Me=class extends T{_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=Me;Me.create=t=>new Me({typeName:w.ZodUndefined,...I(t)});var De=class extends T{_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=De;De.create=t=>new De({typeName:w.ZodNull,...I(t)});var we=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=we;we.create=t=>new we({typeName:w.ZodAny,...I(t)});var pe=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:w.ZodUnknown,...I(t)});var re=class extends T{_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=re;re.create=t=>new re({typeName:w.ZodNever,...I(t)});var at=class extends T{_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=at;at.create=t=>new at({typeName:w.ZodVoid,...I(t)});var he=class t extends T{_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 Q(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Q(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:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=he;he.create=(t,e)=>new he({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...I(e)});function it(t){if(t instanceof B){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(it(n))}return new B({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:it(t.element)}):t instanceof X?X.create(it(t.unwrap())):t instanceof ue?ue.create(it(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>it(e))):t}var B=class t extends T{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 re&&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 Q(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof re){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 Q(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,g=await f.value;l.push({key:m,value:g,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 _.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=_.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 it(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 X;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Fo(h.util.objectKeys(this.shape))}};c.ZodObject=B;B.create=(t,e)=>new B({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.strictCreate=(t,e)=>new B({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.lazycreate=(t,e)=>new B({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});var Le=class extends T{_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=Le;Le.create=(t,e)=>new Le({options:t,typeName:w.ZodUnion,...I(e)});var fe=t=>t instanceof qe?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Fe?[t.value]:t instanceof Ve?t.options:t instanceof $e?h.util.objectValues(t.enum):t instanceof He?fe(t._def.innerType):t instanceof Me?[void 0]:t instanceof De?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof $t||t instanceof Be?fe(t.unwrap()):t instanceof We?fe(t._def.innerType):[],vr=class t extends T{_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=fe(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,...I(n)})}};c.ZodDiscriminatedUnion=vr;function sn(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=sn(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=sn(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 ze=class extends T{_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=sn(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=ze;ze.create=(t,e,r)=>new ze({left:t,right:e,typeName:w.ZodIntersection,...I(r)});var ce=class t extends T{_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 Q(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=ce;ce.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:t,typeName:w.ZodTuple,rest:null,...I(e)})};var gr=class t extends T{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 Q(n,a,n.path,a)),value:s._parse(new Q(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 T?new t({keyType:e,valueType:r,typeName:w.ZodRecord,...I(n)}):new t({keyType:xe.create(),valueType:e,typeName:w.ZodRecord,...I(r)})}};c.ZodRecord=gr;var ct=class extends T{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 Q(n,a,n.path,[l,"key"])),value:i._parse(new Q(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=ct;ct.create=(t,e,r)=>new ct({valueType:e,keyType:t,typeName:w.ZodMap,...I(r)});var ut=class t extends T{_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 Q(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:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ut;ut.create=(t,e)=>new ut({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...I(e)});var _r=class t extends T{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,yr.getErrorMap)(),yr.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,yr.getErrorMap)(),yr.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 Ce){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(C=>{throw l.addIssue(n(d,C)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(C=>{throw l.addIssue(o(m,C)),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:ce.create(e).rest(pe.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||ce.create([]).rest(pe.create()),returns:r||pe.create(),typeName:w.ZodFunction,...I(n)})}};c.ZodFunction=_r;var qe=class extends T{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=qe;qe.create=(t,e)=>new qe({getter:t,typeName:w.ZodLazy,...I(e)});var Fe=class extends T{_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=Fe;Fe.create=(t,e)=>new Fe({value:t,typeName:w.ZodLiteral,...I(e)});function Fo(t,e){return new Ve({values:t,typeName:w.ZodEnum,...I(e)})}var Ve=class t extends T{_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=Ve;Ve.create=Fo;var $e=class extends T{_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=$e;$e.create=(t,e)=>new $e({values:t,typeName:w.ZodNativeEnum,...I(e)});var Ce=class extends T{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=Ce;Ce.create=(t,e)=>new Ce({type:t,typeName:w.ZodPromise,...I(e)});var J=class extends T{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=J;c.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:w.ZodEffects,effect:e,...I(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...I(r)});var X=class extends T{_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=X;X.create=(t,e)=>new X({innerType:t,typeName:w.ZodOptional,...I(e)});var ue=class extends T{_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=ue;ue.create=(t,e)=>new ue({innerType:t,typeName:w.ZodNullable,...I(e)});var He=class extends T{_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=He;He.create=(t,e)=>new He({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var We=class extends T{_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=We;We.create=(t,e)=>new We({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var dt=class extends T{_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=dt;dt.create=t=>new dt({typeName:w.ZodNaN,...I(t)});c.BRAND=Symbol("zod_brand");var $t=class extends T{_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=$t;var Ht=class t extends T{_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=Ht;var Be=class extends T{_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=Be;Be.create=(t,e)=>new Be({innerType:t,typeName:w.ZodReadonly,...I(e)});function Do(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Vo(t,e={},r){return t?we.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=Do(e,n),g=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:g})}});if(!i){let d=Do(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):we.create()}c.late={object:B.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 Ka=(t,e={message:`Input not instance of ${t.name}`})=>Vo(r=>r instanceof t,e);c.instanceof=Ka;var $o=xe.create;c.string=$o;var Ho=ke.create;c.number=Ho;var Ja=dt.create;c.nan=Ja;var Ga=Ue.create;c.bigint=Ga;var Wo=Re.create;c.boolean=Wo;var Ya=Ne.create;c.date=Ya;var Xa=st.create;c.symbol=Xa;var Qa=Me.create;c.undefined=Qa;var ec=De.create;c.null=ec;var tc=we.create;c.any=tc;var rc=pe.create;c.unknown=rc;var nc=re.create;c.never=nc;var oc=at.create;c.void=oc;var ic=he.create;c.array=ic;var sc=B.create;c.object=sc;var ac=B.strictCreate;c.strictObject=ac;var cc=Le.create;c.union=cc;var uc=vr.create;c.discriminatedUnion=uc;var dc=ze.create;c.intersection=dc;var lc=ce.create;c.tuple=lc;var fc=gr.create;c.record=fc;var pc=ct.create;c.map=pc;var hc=ut.create;c.set=hc;var mc=_r.create;c.function=mc;var yc=qe.create;c.lazy=yc;var vc=Fe.create;c.literal=vc;var gc=Ve.create;c.enum=gc;var _c=$e.create;c.nativeEnum=_c;var bc=Ce.create;c.promise=bc;var Bo=J.create;c.effect=Bo;c.transformer=Bo;var xc=X.create;c.optional=xc;var wc=ue.create;c.nullable=wc;var Cc=J.createWithPreprocess;c.preprocess=Cc;var Ic=Ht.create;c.pipeline=Ic;var Tc=()=>$o().optional();c.ostring=Tc;var Sc=()=>Ho().optional();c.onumber=Sc;var Ac=()=>Wo().optional();c.oboolean=Ac;c.coerce={string:(t=>xe.create({...t,coerce:!0})),number:(t=>ke.create({...t,coerce:!0})),boolean:(t=>Re.create({...t,coerce:!0})),bigint:(t=>Ue.create({...t,coerce:!0})),date:(t=>Ne.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var an=y(ee=>{"use strict";var Oc=ee&&ee.__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]})),lt=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Oc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});lt(hr(),ee);lt(nn(),ee);lt(Uo(),ee);lt(Ft(),ee);lt(Ko(),ee);lt(pr(),ee)});var Z=y(K=>{"use strict";var Jo=K&&K.__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]})),Pc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ec=K&&K.__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)&&Jo(e,t,r);return Pc(e,t),e},jc=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jo(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Go=Ec(an());K.z=Go;jc(an(),K);K.default=Go});var cn=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.actionTypesZodSchema=ft.ActionTypes=void 0;var Zc=Z(),Yo;(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"})(Yo||(ft.ActionTypes=Yo={}));ft.actionTypesZodSchema=Zc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var un=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.semanticActionStateTypesZodSchema=pt.SemanticActionStateTypes=void 0;var kc=Z(),Xo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Xo||(pt.SemanticActionStateTypes=Xo={}));pt.semanticActionStateTypesZodSchema=kc.z.enum(["start","continue","done"])});var dn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.attachmentLayoutTypesZodSchema=ht.AttachmentLayoutTypes=void 0;var Uc=Z(),Qo;(function(t){t.List="list",t.Carousel="carousel"})(Qo||(ht.AttachmentLayoutTypes=Qo={}));ht.attachmentLayoutTypesZodSchema=Uc.z.enum(["list","carousel"])});var ln=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.Channels=void 0;var ei;(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.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",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"})(ei||(br.Channels=ei={}))});var fn=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.endOfConversationCodesZodSchema=mt.EndOfConversationCodes=void 0;var Rc=Z(),ti;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(ti||(mt.EndOfConversationCodes=ti={}));mt.endOfConversationCodesZodSchema=Rc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var ni=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.membershipSourceTypeZodSchema=yt.MembershipSourceTypes=void 0;var Nc=Z(),ri;(function(t){t.Channel="channel",t.Team="team"})(ri||(yt.MembershipSourceTypes=ri={}));yt.membershipSourceTypeZodSchema=Nc.z.enum(["channel","team"])});var ii=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.membershipTypeZodSchema=vt.MembershipTypes=void 0;var Mc=Z(),oi;(function(t){t.Direct="direct",t.Transitive="transitive"})(oi||(vt.MembershipTypes=oi={}));vt.membershipTypeZodSchema=Mc.z.enum(["direct","transitive"])});var Wt=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.roleTypeZodSchema=gt.RoleTypes=void 0;var Dc=Z(),si;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(si||(gt.RoleTypes=si={}));gt.roleTypeZodSchema=Dc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ai=y(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.addAIToActivity=void 0;var Lc=(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)};xr.addAIToActivity=Lc});var ci=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.adaptiveCardInvokeActionZodSchema=void 0;var Ke=Z();wr.adaptiveCardInvokeActionZodSchema=Ke.z.object({type:Ke.z.string().min(1),id:Ke.z.string().optional(),verb:Ke.z.string().min(1),data:Ke.z.record(Ke.z.string().min(1),Ke.z.any())})});var ui=y(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var di=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.default="00000000-0000-0000-0000-000000000000"});var li=y(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.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 Bt=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var zc=li();function qc(t){return typeof t=="string"&&zc.default.test(t)}yn.default=qc});var Kt=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});var Fc=Bt();function Vc(t){if(!(0,Fc.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)}vn.default=Vc});var me=y(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.unsafeStringify=void 0;var $c=Bt(),N=[];for(let t=0;t<256;++t)N.push((t+256).toString(16).slice(1));function fi(t,e=0){return(N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]).toLowerCase()}Jt.unsafeStringify=fi;function Hc(t,e=0){let r=fi(t,e);if(!(0,$c.default)(r))throw TypeError("Stringified UUID is invalid");return r}Jt.default=Hc});var Cr=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var gn,Wc=new Uint8Array(16);function Bc(){if(!gn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gn=crypto.getRandomValues.bind(crypto)}return gn(Wc)}_n.default=Bc});var bn=y(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.updateV1State=void 0;var pi=Cr(),Kc=me(),Gt={};function Jc(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=hi((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,pi.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,pi.default)();mi(Gt,l,f),n=hi(f,Gt.msecs,Gt.nsecs,o?void 0:Gt.clockseq,o?void 0:Gt.node,e,r)}return e!=null?e:(0,Kc.unsafeStringify)(n)}function mi(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}Yt.updateV1State=mi;function hi(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}Yt.default=Jc});var wn=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var Gc=Kt(),Yc=me();function Xc(t){let e=typeof t=="string"?(0,Gc.default)(t):t,r=Qc(e);return typeof t=="string"?(0,Yc.unsafeStringify)(r):r}xn.default=Xc;function Qc(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 vi=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});function eu(t){let e=nu(t),r=ru(e,t.length*8);return tu(r)}function tu(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 yi(t){return(t+64>>>9<<4)+14+1}function ru(t,e){let r=new Uint32Array(yi(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=L(n,o,i,s,t[a],7,-680876936),s=L(s,n,o,i,t[a+1],12,-389564586),i=L(i,s,n,o,t[a+2],17,606105819),o=L(o,i,s,n,t[a+3],22,-1044525330),n=L(n,o,i,s,t[a+4],7,-176418897),s=L(s,n,o,i,t[a+5],12,1200080426),i=L(i,s,n,o,t[a+6],17,-1473231341),o=L(o,i,s,n,t[a+7],22,-45705983),n=L(n,o,i,s,t[a+8],7,1770035416),s=L(s,n,o,i,t[a+9],12,-1958414417),i=L(i,s,n,o,t[a+10],17,-42063),o=L(o,i,s,n,t[a+11],22,-1990404162),n=L(n,o,i,s,t[a+12],7,1804603682),s=L(s,n,o,i,t[a+13],12,-40341101),i=L(i,s,n,o,t[a+14],17,-1502002290),o=L(o,i,s,n,t[a+15],22,1236535329),n=z(n,o,i,s,t[a+1],5,-165796510),s=z(s,n,o,i,t[a+6],9,-1069501632),i=z(i,s,n,o,t[a+11],14,643717713),o=z(o,i,s,n,t[a],20,-373897302),n=z(n,o,i,s,t[a+5],5,-701558691),s=z(s,n,o,i,t[a+10],9,38016083),i=z(i,s,n,o,t[a+15],14,-660478335),o=z(o,i,s,n,t[a+4],20,-405537848),n=z(n,o,i,s,t[a+9],5,568446438),s=z(s,n,o,i,t[a+14],9,-1019803690),i=z(i,s,n,o,t[a+3],14,-187363961),o=z(o,i,s,n,t[a+8],20,1163531501),n=z(n,o,i,s,t[a+13],5,-1444681467),s=z(s,n,o,i,t[a+2],9,-51403784),i=z(i,s,n,o,t[a+7],14,1735328473),o=z(o,i,s,n,t[a+12],20,-1926607734),n=q(n,o,i,s,t[a+5],4,-378558),s=q(s,n,o,i,t[a+8],11,-2022574463),i=q(i,s,n,o,t[a+11],16,1839030562),o=q(o,i,s,n,t[a+14],23,-35309556),n=q(n,o,i,s,t[a+1],4,-1530992060),s=q(s,n,o,i,t[a+4],11,1272893353),i=q(i,s,n,o,t[a+7],16,-155497632),o=q(o,i,s,n,t[a+10],23,-1094730640),n=q(n,o,i,s,t[a+13],4,681279174),s=q(s,n,o,i,t[a],11,-358537222),i=q(i,s,n,o,t[a+3],16,-722521979),o=q(o,i,s,n,t[a+6],23,76029189),n=q(n,o,i,s,t[a+9],4,-640364487),s=q(s,n,o,i,t[a+12],11,-421815835),i=q(i,s,n,o,t[a+15],16,530742520),o=q(o,i,s,n,t[a+2],23,-995338651),n=F(n,o,i,s,t[a],6,-198630844),s=F(s,n,o,i,t[a+7],10,1126891415),i=F(i,s,n,o,t[a+14],15,-1416354905),o=F(o,i,s,n,t[a+5],21,-57434055),n=F(n,o,i,s,t[a+12],6,1700485571),s=F(s,n,o,i,t[a+3],10,-1894986606),i=F(i,s,n,o,t[a+10],15,-1051523),o=F(o,i,s,n,t[a+1],21,-2054922799),n=F(n,o,i,s,t[a+8],6,1873313359),s=F(s,n,o,i,t[a+15],10,-30611744),i=F(i,s,n,o,t[a+6],15,-1560198380),o=F(o,i,s,n,t[a+13],21,1309151649),n=F(n,o,i,s,t[a+4],6,-145523070),s=F(s,n,o,i,t[a+11],10,-1120210379),i=F(i,s,n,o,t[a+2],15,718787259),o=F(o,i,s,n,t[a+9],21,-343485551),n=Ie(n,d),o=Ie(o,l),i=Ie(i,f),s=Ie(s,m)}return Uint32Array.of(n,o,i,s)}function nu(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(yi(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 Ie(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function ou(t,e){return t<<e|t>>>32-e}function Ir(t,e,r,n,o,i){return Ie(ou(Ie(Ie(e,t),Ie(n,i)),o),r)}function L(t,e,r,n,o,i,s){return Ir(e&r|~e&n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return Ir(e&n|r&~n,t,e,o,i,s)}function q(t,e,r,n,o,i,s){return Ir(e^r^n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return Ir(r^(e|~n),t,e,o,i,s)}Cn.default=eu});var Xt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var gi=Kt(),iu=me();function _i(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}ye.stringToBytes=_i;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function su(t,e,r,n,o,i){let s=typeof r=="string"?_i(r):r,a=typeof n=="string"?(0,gi.default)(n):n;if(typeof n=="string"&&(n=(0,gi.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,iu.unsafeStringify)(d)}ye.default=su});var xi=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.URL=Je.DNS=void 0;var au=vi(),In=Xt(),bi=Xt();Object.defineProperty(Je,"DNS",{enumerable:!0,get:function(){return bi.DNS}});Object.defineProperty(Je,"URL",{enumerable:!0,get:function(){return bi.URL}});function Tn(t,e,r,n){return(0,In.default)(48,au.default,t,e,r,n)}Tn.DNS=In.DNS;Tn.URL=In.URL;Je.default=Tn});var wi=y(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});var cu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);Sn.default={randomUUID:cu}});var Ii=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var Ci=wi(),uu=Cr(),du=me();function lu(t,e,r){var o,i,s;if(Ci.default.randomUUID&&!e&&!t)return Ci.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,uu.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,du.unsafeStringify)(n)}An.default=lu});var Ti=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});function fu(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 On(t,e){return t<<e|t>>>32-e}function pu(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]=On(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],g=r[3],C=r[4];for(let O=0;O<80;++O){let v=Math.floor(O/20),S=On(l,5)+fu(v,f,m,g)+C+e[v]+d[O]>>>0;C=g,g=m,m=On(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]+g>>>0,r[4]=r[4]+C>>>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])}Pn.default=pu});var Ai=y(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.URL=Ge.DNS=void 0;var hu=Ti(),En=Xt(),Si=Xt();Object.defineProperty(Ge,"DNS",{enumerable:!0,get:function(){return Si.DNS}});Object.defineProperty(Ge,"URL",{enumerable:!0,get:function(){return Si.URL}});function jn(t,e,r,n){return(0,En.default)(80,hu.default,t,e,r,n)}jn.DNS=En.DNS;jn.URL=En.URL;Ge.default=jn});var Oi=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var mu=me(),yu=bn(),vu=wn();function gu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,yu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,vu.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,mu.unsafeStringify)(n)}Zn.default=gu});var Pi=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var _u=Kt(),bu=me();function xu(t){let e=typeof t=="string"?(0,_u.default)(t):t,r=wu(e);return typeof t=="string"?(0,bu.unsafeStringify)(r):r}kn.default=xu;function wu(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 ki=y(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.updateV7State=void 0;var Ei=Cr(),Cu=me(),Un={};function Iu(t,e,r){var o,i,s;let n;if(t)n=ji((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ei.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ei.default)();Zi(Un,a,d),n=ji(d,Un.msecs,Un.seq,e,r)}return e!=null?e:(0,Cu.unsafeStringify)(n)}function Zi(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}Qt.updateV7State=Zi;function ji(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}Qt.default=Iu});var Ui=y(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});var Tu=Bt();function Su(t){if(!(0,Tu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Rn.default=Su});var Ri=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.version=E.validate=E.v7=E.v6ToV1=E.v6=E.v5=E.v4=E.v3=E.v1ToV6=E.v1=E.stringify=E.parse=E.NIL=E.MAX=void 0;var Au=ui();Object.defineProperty(E,"MAX",{enumerable:!0,get:function(){return Au.default}});var Ou=di();Object.defineProperty(E,"NIL",{enumerable:!0,get:function(){return Ou.default}});var Pu=Kt();Object.defineProperty(E,"parse",{enumerable:!0,get:function(){return Pu.default}});var Eu=me();Object.defineProperty(E,"stringify",{enumerable:!0,get:function(){return Eu.default}});var ju=bn();Object.defineProperty(E,"v1",{enumerable:!0,get:function(){return ju.default}});var Zu=wn();Object.defineProperty(E,"v1ToV6",{enumerable:!0,get:function(){return Zu.default}});var ku=xi();Object.defineProperty(E,"v3",{enumerable:!0,get:function(){return ku.default}});var Uu=Ii();Object.defineProperty(E,"v4",{enumerable:!0,get:function(){return Uu.default}});var Ru=Ai();Object.defineProperty(E,"v5",{enumerable:!0,get:function(){return Ru.default}});var Nu=Oi();Object.defineProperty(E,"v6",{enumerable:!0,get:function(){return Nu.default}});var Mu=Pi();Object.defineProperty(E,"v6ToV1",{enumerable:!0,get:function(){return Mu.default}});var Du=ki();Object.defineProperty(E,"v7",{enumerable:!0,get:function(){return Du.default}});var Lu=Bt();Object.defineProperty(E,"validate",{enumerable:!0,get:function(){return Lu.default}});var zu=Ui();Object.defineProperty(E,"version",{enumerable:!0,get:function(){return zu.default}})});var Nn=y(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.entityZodSchema=void 0;var Ni=Z();Tr.entityZodSchema=Ni.z.object({type:Ni.z.string().min(1)}).passthrough()});var Mi=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.semanticActionZodSchema=void 0;var er=Z(),qu=Nn(),Fu=un();Sr.semanticActionZodSchema=er.z.object({id:er.z.string().min(1),state:er.z.union([Fu.semanticActionStateTypesZodSchema,er.z.string().min(1)]),entities:er.z.record(qu.entityZodSchema)})});var Di=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.cardActionZodSchema=void 0;var de=Z(),Vu=cn();Ar.cardActionZodSchema=de.z.object({type:de.z.union([Vu.actionTypesZodSchema,de.z.string().min(1)]),title:de.z.string().min(1),image:de.z.string().min(1).optional(),text:de.z.string().min(1).optional(),displayText:de.z.string().min(1).optional(),value:de.z.any().optional(),channelData:de.z.unknown().optional(),imageAltText:de.z.string().min(1).optional()})});var Li=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.suggestedActionsZodSchema=void 0;var Or=Z(),$u=Di();Pr.suggestedActionsZodSchema=Or.z.object({to:Or.z.array(Or.z.string().min(1)),actions:Or.z.array($u.cardActionZodSchema)})});var Mn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityEventNamesZodSchema=_t.ActivityEventNames=void 0;var Hu=Z(),zi;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(zi||(_t.ActivityEventNames=zi={}));_t.activityEventNamesZodSchema=Hu.z.enum(["ContinueConversation","CreateConversation"])});var Dn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.activityImportanceZodSchema=bt.ActivityImportance=void 0;var Wu=Z(),qi;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(qi||(bt.ActivityImportance=qi={}));bt.activityImportanceZodSchema=Wu.z.enum(["low","normal","high"])});var Ln=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.activityTypesZodSchema=xt.ActivityTypes=void 0;var Bu=Z(),Fi;(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"})(Fi||(xt.ActivityTypes=Fi={}));xt.activityTypesZodSchema=Bu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Vi=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.attachmentZodSchema=void 0;var wt=Z();Er.attachmentZodSchema=wt.z.object({contentType:wt.z.string().min(1),contentUrl:wt.z.string().min(1).optional(),content:wt.z.unknown().optional(),name:wt.z.string().min(1).optional(),thumbnailUrl:wt.z.string().min(1).optional()})});var $i=y(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.addProductInfoToActivity=Ye.clearProductInfoFromActivity=void 0;var Ku=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Ye.clearProductInfoFromActivity=Ku;var Ju=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Ye.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Ye.addProductInfoToActivity=Ju});var zn=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.channelAccountZodSchema=void 0;var ne=Z(),Gu=Wt();jr.channelAccountZodSchema=ne.z.object({id:ne.z.string().min(1).optional(),name:ne.z.string().optional(),aadObjectId:ne.z.string().min(1).optional(),tenantId:ne.z.string().min(1).optional(),agenticUserId:ne.z.string().min(1).optional(),agenticAppId:ne.z.string().min(1).optional(),agenticAppBlueprintId:ne.z.string().min(1).optional(),role:ne.z.union([Gu.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var qn=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationAccountZodSchema=void 0;var le=Z(),Yu=Wt();Zr.conversationAccountZodSchema=le.z.object({isGroup:le.z.boolean().optional(),conversationType:le.z.string().min(1).optional(),tenantId:le.z.string().min(1).optional(),id:le.z.string().min(1),name:le.z.string().min(1).optional(),aadObjectId:le.z.string().min(1).optional(),role:le.z.union([Yu.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var Wi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.conversationReferenceZodSchema=void 0;var tr=Z(),Hi=zn(),Xu=qn();kr.conversationReferenceZodSchema=tr.z.object({activityId:tr.z.string().min(1).optional(),user:Hi.channelAccountZodSchema.optional(),locale:tr.z.string().min(1).optional(),agent:Hi.channelAccountZodSchema.optional().nullable(),conversation:Xu.conversationAccountZodSchema,channelId:tr.z.string().min(1),serviceUrl:tr.z.string().min(1).optional()})});var Fn=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.deliveryModesZodSchema=Ct.DeliveryModes=void 0;var Qu=Z(),Bi;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Bi||(Ct.DeliveryModes=Bi={}));Ct.deliveryModesZodSchema=Qu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Vn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.inputHintsZodSchema=It.InputHints=void 0;var ed=Z(),Ki;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Ki||(It.InputHints=Ki={}));It.inputHintsZodSchema=ed.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var $n=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.messageReactionTypesZodSchema=Tt.MessageReactionTypes=void 0;var td=Z(),Ji;(function(t){t.Like="like",t.PlusOne="plusOne"})(Ji||(Tt.MessageReactionTypes=Ji={}));Tt.messageReactionTypesZodSchema=td.z.enum(["like","plusOne"])});var Gi=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.messageReactionZodSchema=void 0;var Hn=Z(),rd=$n();Ur.messageReactionZodSchema=Hn.z.object({type:Hn.z.union([rd.messageReactionTypesZodSchema,Hn.z.string().min(1)])})});var Wn=y(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.textFormatTypesZodSchema=St.TextFormatTypes=void 0;var nd=Z(),Yi;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Yi||(St.TextFormatTypes=Yi={}));St.textFormatTypesZodSchema=nd.z.enum(["markdown","plain","xml"])});var Xi=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.textHighlightZodSchema=void 0;var Bn=Z();Rr.textHighlightZodSchema=Bn.z.object({text:Bn.z.string().min(1),occurrence:Bn.z.number()})});var Kn=y(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ExceptionHelper=void 0;var Nr=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(m=>{s=s.replace(`{${m}}`,o[m])});let d=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${d}`,f=new e(l);return f.code=r.code,f.helpLink=d,n&&(f.innerException=n),f}};Mr.ExceptionHelper=Nr;Nr.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Jn=y(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.Errors=void 0;Dr.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var os=y(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Activity=Xe.activityZodSchema=void 0;var od=Ri(),b=Z(),id=Mi(),sd=Li(),ns=Mn(),ad=Dn(),zr=Ln(),cd=Vi(),ud=dn(),Qi=$i(),Lr=zn(),es=ln(),dd=qn(),ld=Wi(),fd=fn(),pd=Fn(),hd=Nn(),md=Vn(),ts=Gi(),yd=Wn(),vd=Xi(),rs=Wt(),Te=Kn(),Se=Jn();Xe.activityZodSchema=b.z.object({type:b.z.union([zr.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:Lr.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:dd.conversationAccountZodSchema.optional(),recipient:Lr.channelAccountZodSchema.optional(),textFormat:b.z.union([yd.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([ud.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Lr.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Lr.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(ts.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(ts.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([md.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:sd.suggestedActionsZodSchema.optional(),attachments:b.z.array(cd.attachmentZodSchema).optional(),entities:b.z.array(hd.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([ns.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:ld.conversationReferenceZodSchema.optional(),code:b.z.union([fd.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:b.z.union([ad.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([pd.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(vd.textHighlightZodSchema).optional(),semanticAction:id.semanticActionZodSchema.optional()});var Gn=class t{constructor(e){if(e===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeUndefined);if(e===null)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Xe.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 Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Qi.addProductInfoToActivity)(this,n):(0,Qi.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 Te.ExceptionHelper.generateException(Error,Se.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:zr.ActivityTypes.Event,name:ns.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,od.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!==zr.ActivityTypes.ConversationUpdate||this.channelId!==es.Channels.Directline&&this.channelId!==es.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityChannelIdUndefined);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===zr.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()===rs.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===rs.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}};Xe.Activity=Gn});var is=y(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.activityTreatments=At.ActivityTreatments=void 0;var gd=Z(),Yn;(function(t){t.Targeted="targeted"})(Yn||(At.ActivityTreatments=Yn={}));At.activityTreatments=gd.z.nativeEnum(Yn)});var Xn=y(x=>{"use strict";var _d=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]})),ss=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_d(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.Logger=x.debug=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=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 bd=cn();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return bd.ActionTypes}});var xd=un();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return xd.SemanticActionStateTypes}});var wd=dn();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return wd.AttachmentLayoutTypes}});var Cd=ln();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return Cd.Channels}});var Id=fn();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return Id.EndOfConversationCodes}});var Td=ni();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return Td.MembershipSourceTypes}});var Sd=ii();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Sd.MembershipTypes}});var Ad=Wt();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Ad.RoleTypes}});ss(ai(),x);ss(ci(),x);var as=os();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return as.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return as.activityZodSchema}});var Od=Mn();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return Od.ActivityEventNames}});var Pd=Dn();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Pd.ActivityImportance}});var Ed=Ln();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Ed.ActivityTypes}});var jd=Fn();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return jd.DeliveryModes}});var Zd=Vn();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Zd.InputHints}});var kd=$n();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return kd.MessageReactionTypes}});var Ud=Wn();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Ud.TextFormatTypes}});var Rd=is();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Rd.ActivityTreatments}});var cs=zt();Object.defineProperty(x,"debug",{enumerable:!0,get:function(){return cs.debug}});Object.defineProperty(x,"Logger",{enumerable:!0,get:function(){return cs.Logger}});var Nd=Kn();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return Nd.ExceptionHelper}});var Md=Jn();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return Md.Errors}})});var Dt=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Dt||{});var Lt=(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))(Lt||{});var Jr=class{constructor(){this.useExperimentalEndpoint=!1}},Gr=class extends Jr{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(Lt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Lt).join(", ")}`);if(!Object.values(Dt).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Dt).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},nl=()=>{var t,e,r,n,o,i,s;return new Gr({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:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true"})};var or=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 Yr(t){}function vo(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=Yr,onError:r=Yr,onRetry:n=Yr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let S=s?v.replace(/^\xEF\xBB\xBF/,""):v,[A,P]=Ls(`${i}${S}`);for(let R of A)m(R);i=P,s=!1}function m(v){if(v===""){C();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let S=v.indexOf(":");if(S!==-1){let A=v.slice(0,S),P=v[S+1]===" "?2:1,R=v.slice(S+P);g(A,R,v);return}g(v,"",v)}function g(v,S,A){switch(v){case"event":l=S;break;case"data":d=`${d}${S}
1
+ var ks=Object.create;var yo=Object.defineProperty;var Us=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var Ns=Object.getPrototypeOf,Ms=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ds=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Rs(e))!Ms.call(t,o)&&o!==r&&yo(t,o,{get:()=>e[o],enumerable:!(n=Us(e,o))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?ks(Ns(t)):{},Ds(e||!t||!t.__esModule?yo(r,"default",{value:t,enumerable:!0}):r,t));var xo=y((cl,bo)=>{var tt=1e3,rt=tt*60,nt=rt*60,Ee=nt*24,Ws=Ee*7,Bs=Ee*365.25;bo.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Ks(t);if(r==="number"&&isFinite(t))return e.long?Gs(t):Js(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Ks(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*Bs;case"weeks":case"week":case"w":return r*Ws;case"days":case"day":case"d":return r*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return r*nt;case"minutes":case"minute":case"mins":case"min":case"m":return r*rt;case"seconds":case"second":case"secs":case"sec":case"s":return r*tt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Js(t){var e=Math.abs(t);return e>=Ee?Math.round(t/Ee)+"d":e>=nt?Math.round(t/nt)+"h":e>=rt?Math.round(t/rt)+"m":e>=tt?Math.round(t/tt)+"s":t+"ms"}function Gs(t){var e=Math.abs(t);return e>=Ee?sr(t,e,Ee,"day"):e>=nt?sr(t,e,nt,"hour"):e>=rt?sr(t,e,rt,"minute"):e>=tt?sr(t,e,tt,"second"):t+" ms"}function sr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Co=y((ul,wo)=>{function Ys(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=xo(),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 g=0;g<f.length;g++)m=(m<<5)-m+f.charCodeAt(g),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,g=null,C,O;function v(...S){if(!v.enabled)return;let A=v,P=Number(new Date),R=P-(m||P);A.diff=R,A.prev=m,A.curr=P,m=P,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let V=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,($,Y)=>{if($==="%%")return"%";V++;let Oe=r.formatters[Y];if(typeof Oe=="function"){let Kr=S[V];$=Oe.call(A,Kr),S.splice(V,1),V--}return $}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return v.namespace=f,v.useColors=r.useColors(),v.color=r.selectColor(f),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(C!==r.namespaces&&(C=r.namespaces,O=r.enabled(f)),O),set:S=>{g=S}}),typeof r.init=="function"&&r.init(v),v}function n(f,m){let g=r(this.namespace+(typeof m=="undefined"?":":m)+f);return g.log=this.log,g}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 g of m)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function i(f,m){let g=0,C=0,O=-1,v=0;for(;g<f.length;)if(C<m.length&&(m[C]===f[g]||m[C]==="*"))m[C]==="*"?(O=C,v=g,C++):(g++,C++);else if(O!==-1)C=O+1,v++,g=v;else return!1;for(;C<m.length&&m[C]==="*";)C++;return C===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}wo.exports=Ys});var Io=y((W,ar)=>{W.formatArgs=Qs;W.save=ea;W.load=ta;W.useColors=Xs;W.storage=ra();W.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`."))}})();W.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 Xs(){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 Qs(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ar.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)}W.log=console.debug||console.log||(()=>{});function ea(t){try{t?W.storage.setItem("debug",t):W.storage.removeItem("debug")}catch{}}function ta(){let t;try{t=W.storage.getItem("debug")||W.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function ra(){try{return localStorage}catch{}}ar.exports=Co()(W);var{formatters:na}=ar.exports;na.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var zt=y(je=>{"use strict";var oa=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0});je.Logger=void 0;je.debug=aa;var ia=oa(Io()),sa=["info","warn","error","debug"],cr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of sa){let n=(0,ia.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)}};je.Logger=cr;function aa(t){return new cr(t)}});var Ft=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Qr;(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})(Qr||(k.util=Qr={}));var Oo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Oo||(k.objectUtil=Oo={}));k.ZodParsedType=Qr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var la=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=la});var pr=y(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.ZodError=_e.quotelessJson=_e.ZodIssueCode=void 0;var Po=Ft();_e.ZodIssueCode=Po.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 fa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");_e.quotelessJson=fa;var Vt=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,Po.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()}};_e.ZodError=Vt;Vt.create=t=>new Vt(t)});var tn=y(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});var D=pr(),Ze=Ft(),pa=(t,e)=>{let r;switch(t.code){case D.ZodIssueCode.invalid_type:t.received===Ze.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case D.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.util.jsonStringifyReplacer)}`;break;case D.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.util.joinValues(t.keys,", ")}`;break;case D.ZodIssueCode.invalid_union:r="Invalid input";break;case D.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.util.joinValues(t.options)}`;break;case D.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.util.joinValues(t.options)}, received '${t.received}'`;break;case D.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case D.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case D.ZodIssueCode.invalid_date:r="Invalid date";break;case D.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}"`:Ze.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case D.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 D.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 D.ZodIssueCode.custom:r="Invalid input";break;case D.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case D.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case D.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.util.assertNever(t)}return{message:r}};en.default=pa});var hr=y(be=>{"use strict";var ha=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=ma;be.getErrorMap=ya;var Eo=ha(tn());be.defaultErrorMap=Eo.default;var jo=Eo.default;function ma(t){jo=t}function ya(){return jo}});var nn=y(j=>{"use strict";var va=j&&j.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(j,"__esModule",{value:!0});j.isAsync=j.isValid=j.isDirty=j.isAborted=j.OK=j.DIRTY=j.INVALID=j.ParseStatus=j.EMPTY_PATH=j.makeIssue=void 0;j.addIssueToContext=ba;var ga=hr(),Zo=va(tn()),_a=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}};j.makeIssue=_a;j.EMPTY_PATH=[];function ba(t,e){let r=(0,ga.getErrorMap)(),n=(0,j.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Zo.default?void 0:Zo.default].filter(o=>!!o)});t.common.issues.push(n)}var rn=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 j.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 j.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}}};j.ParseStatus=rn;j.INVALID=Object.freeze({status:"aborted"});var xa=t=>({status:"dirty",value:t});j.DIRTY=xa;var wa=t=>({status:"valid",value:t});j.OK=wa;var Ca=t=>t.status==="aborted";j.isAborted=Ca;var Ia=t=>t.status==="dirty";j.isDirty=Ia;var Ta=t=>t.status==="valid";j.isValid=Ta;var Sa=t=>typeof Promise!="undefined"&&t instanceof Promise;j.isAsync=Sa});var Uo=y(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0})});var No=y(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.errorUtil=void 0;var Ro;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ro||(mr.errorUtil=Ro={}))});var Ko=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=qo;c.custom=Vo;var p=pr(),yr=hr(),_=No(),u=nn(),h=Ft(),Q=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}},Mo=(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 I(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 T=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 Mo(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 Mo(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 J({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 X.create(this,this._def)}nullable(){return ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return he.create(this)}promise(){return Ce.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new J({...I(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new He({...I(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new $t({typeName:w.ZodBranded,type:this,...I(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new We({...I(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 Ht.create(this,e)}readonly(){return Be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=T;c.Schema=T;c.ZodSchema=T;var Aa=/^c[^\s-]{8,}$/i,Oa=/^[0-9a-z]+$/,Pa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ea=/^[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,ja=/^[a-z0-9_-]{21}$/i,Za=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ka=/^[-+]?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)?)??$/,Ua=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ra="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",on,Na=/^(?:(?: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])$/,Ma=/^(?:(?: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])$/,Da=/^(([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]))$/,La=/^(([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])$/,za=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lo="((\\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])))",Fa=new RegExp(`^${Lo}$`);function zo(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 Va(t){return new RegExp(`^${zo(t)}$`)}function qo(t){let e=`${Lo}T${zo(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 $a(t,e){return!!((e==="v4"||!e)&&Na.test(t)||(e==="v6"||!e)&&Da.test(t))}function Ha(t,e){if(!Za.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 Wa(t,e){return!!((e==="v4"||!e)&&Ma.test(t)||(e==="v6"||!e)&&La.test(t))}var xe=class t extends T{_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")Ua.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")on||(on=new RegExp(Ra,"u")),on.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")Ea.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")ja.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")Aa.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")Oa.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")Pa.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"?qo(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"?Fa.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"?Va(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"?ka.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"?$a(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"?Ha(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"?Wa(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"?za.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"?qa.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,..._.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.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,..._.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,..._.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,..._.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,_.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=xe;xe.create=t=>{var e;return new xe({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};function Ba(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 ke=class t extends T{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"?Ba(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,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.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=ke;ke.create=t=>new ke({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ue=class t extends T{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,_.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:_.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:_.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.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=Ue;Ue.create=t=>{var e;return new Ue({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...I(t)})};var Re=class extends T{_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=Re;Re.create=t=>new Re({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...I(t)});var Ne=class t extends T{_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:_.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.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=Ne;Ne.create=t=>new Ne({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...I(t)});var st=class extends T{_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=st;st.create=t=>new st({typeName:w.ZodSymbol,...I(t)});var Me=class extends T{_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=Me;Me.create=t=>new Me({typeName:w.ZodUndefined,...I(t)});var De=class extends T{_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=De;De.create=t=>new De({typeName:w.ZodNull,...I(t)});var we=class extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=we;we.create=t=>new we({typeName:w.ZodAny,...I(t)});var pe=class extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:w.ZodUnknown,...I(t)});var re=class extends T{_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=re;re.create=t=>new re({typeName:w.ZodNever,...I(t)});var at=class extends T{_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=at;at.create=t=>new at({typeName:w.ZodVoid,...I(t)});var he=class t extends T{_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 Q(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Q(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:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:_.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:_.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=he;he.create=(t,e)=>new he({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...I(e)});function it(t){if(t instanceof B){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(it(n))}return new B({...t._def,shape:()=>e})}else return t instanceof he?new he({...t._def,type:it(t.element)}):t instanceof X?X.create(it(t.unwrap())):t instanceof ue?ue.create(it(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>it(e))):t}var B=class t extends T{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 re&&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 Q(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof re){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 Q(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,g=await f.value;l.push({key:m,value:g,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 _.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=_.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 it(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 X;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Fo(h.util.objectKeys(this.shape))}};c.ZodObject=B;B.create=(t,e)=>new B({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.strictCreate=(t,e)=>new B({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:w.ZodObject,...I(e)});B.lazycreate=(t,e)=>new B({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:w.ZodObject,...I(e)});var Le=class extends T{_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=Le;Le.create=(t,e)=>new Le({options:t,typeName:w.ZodUnion,...I(e)});var fe=t=>t instanceof qe?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Fe?[t.value]:t instanceof Ve?t.options:t instanceof $e?h.util.objectValues(t.enum):t instanceof He?fe(t._def.innerType):t instanceof Me?[void 0]:t instanceof De?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof $t||t instanceof Be?fe(t.unwrap()):t instanceof We?fe(t._def.innerType):[],vr=class t extends T{_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=fe(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,...I(n)})}};c.ZodDiscriminatedUnion=vr;function sn(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=sn(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=sn(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 ze=class extends T{_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=sn(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=ze;ze.create=(t,e,r)=>new ze({left:t,right:e,typeName:w.ZodIntersection,...I(r)});var ce=class t extends T{_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 Q(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=ce;ce.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:t,typeName:w.ZodTuple,rest:null,...I(e)})};var gr=class t extends T{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 Q(n,a,n.path,a)),value:s._parse(new Q(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 T?new t({keyType:e,valueType:r,typeName:w.ZodRecord,...I(n)}):new t({keyType:xe.create(),valueType:e,typeName:w.ZodRecord,...I(r)})}};c.ZodRecord=gr;var ct=class extends T{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 Q(n,a,n.path,[l,"key"])),value:i._parse(new Q(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=ct;ct.create=(t,e,r)=>new ct({valueType:e,keyType:t,typeName:w.ZodMap,...I(r)});var ut=class t extends T{_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 Q(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:_.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:_.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ut;ut.create=(t,e)=>new ut({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...I(e)});var _r=class t extends T{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,yr.getErrorMap)(),yr.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,yr.getErrorMap)(),yr.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 Ce){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(C=>{throw l.addIssue(n(d,C)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(C=>{throw l.addIssue(o(m,C)),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:ce.create(e).rest(pe.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||ce.create([]).rest(pe.create()),returns:r||pe.create(),typeName:w.ZodFunction,...I(n)})}};c.ZodFunction=_r;var qe=class extends T{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=qe;qe.create=(t,e)=>new qe({getter:t,typeName:w.ZodLazy,...I(e)});var Fe=class extends T{_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=Fe;Fe.create=(t,e)=>new Fe({value:t,typeName:w.ZodLiteral,...I(e)});function Fo(t,e){return new Ve({values:t,typeName:w.ZodEnum,...I(e)})}var Ve=class t extends T{_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=Ve;Ve.create=Fo;var $e=class extends T{_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=$e;$e.create=(t,e)=>new $e({values:t,typeName:w.ZodNativeEnum,...I(e)});var Ce=class extends T{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=Ce;Ce.create=(t,e)=>new Ce({type:t,typeName:w.ZodPromise,...I(e)});var J=class extends T{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=J;c.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:w.ZodEffects,effect:e,...I(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...I(r)});var X=class extends T{_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=X;X.create=(t,e)=>new X({innerType:t,typeName:w.ZodOptional,...I(e)});var ue=class extends T{_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=ue;ue.create=(t,e)=>new ue({innerType:t,typeName:w.ZodNullable,...I(e)});var He=class extends T{_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=He;He.create=(t,e)=>new He({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...I(e)});var We=class extends T{_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=We;We.create=(t,e)=>new We({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...I(e)});var dt=class extends T{_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=dt;dt.create=t=>new dt({typeName:w.ZodNaN,...I(t)});c.BRAND=Symbol("zod_brand");var $t=class extends T{_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=$t;var Ht=class t extends T{_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=Ht;var Be=class extends T{_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=Be;Be.create=(t,e)=>new Be({innerType:t,typeName:w.ZodReadonly,...I(e)});function Do(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Vo(t,e={},r){return t?we.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=Do(e,n),g=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:g})}});if(!i){let d=Do(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):we.create()}c.late={object:B.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 Ka=(t,e={message:`Input not instance of ${t.name}`})=>Vo(r=>r instanceof t,e);c.instanceof=Ka;var $o=xe.create;c.string=$o;var Ho=ke.create;c.number=Ho;var Ja=dt.create;c.nan=Ja;var Ga=Ue.create;c.bigint=Ga;var Wo=Re.create;c.boolean=Wo;var Ya=Ne.create;c.date=Ya;var Xa=st.create;c.symbol=Xa;var Qa=Me.create;c.undefined=Qa;var ec=De.create;c.null=ec;var tc=we.create;c.any=tc;var rc=pe.create;c.unknown=rc;var nc=re.create;c.never=nc;var oc=at.create;c.void=oc;var ic=he.create;c.array=ic;var sc=B.create;c.object=sc;var ac=B.strictCreate;c.strictObject=ac;var cc=Le.create;c.union=cc;var uc=vr.create;c.discriminatedUnion=uc;var dc=ze.create;c.intersection=dc;var lc=ce.create;c.tuple=lc;var fc=gr.create;c.record=fc;var pc=ct.create;c.map=pc;var hc=ut.create;c.set=hc;var mc=_r.create;c.function=mc;var yc=qe.create;c.lazy=yc;var vc=Fe.create;c.literal=vc;var gc=Ve.create;c.enum=gc;var _c=$e.create;c.nativeEnum=_c;var bc=Ce.create;c.promise=bc;var Bo=J.create;c.effect=Bo;c.transformer=Bo;var xc=X.create;c.optional=xc;var wc=ue.create;c.nullable=wc;var Cc=J.createWithPreprocess;c.preprocess=Cc;var Ic=Ht.create;c.pipeline=Ic;var Tc=()=>$o().optional();c.ostring=Tc;var Sc=()=>Ho().optional();c.onumber=Sc;var Ac=()=>Wo().optional();c.oboolean=Ac;c.coerce={string:(t=>xe.create({...t,coerce:!0})),number:(t=>ke.create({...t,coerce:!0})),boolean:(t=>Re.create({...t,coerce:!0})),bigint:(t=>Ue.create({...t,coerce:!0})),date:(t=>Ne.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var an=y(ee=>{"use strict";var Oc=ee&&ee.__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]})),lt=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Oc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});lt(hr(),ee);lt(nn(),ee);lt(Uo(),ee);lt(Ft(),ee);lt(Ko(),ee);lt(pr(),ee)});var Z=y(K=>{"use strict";var Jo=K&&K.__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]})),Pc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ec=K&&K.__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)&&Jo(e,t,r);return Pc(e,t),e},jc=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jo(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Go=Ec(an());K.z=Go;jc(an(),K);K.default=Go});var cn=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.actionTypesZodSchema=ft.ActionTypes=void 0;var Zc=Z(),Yo;(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"})(Yo||(ft.ActionTypes=Yo={}));ft.actionTypesZodSchema=Zc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var un=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.semanticActionStateTypesZodSchema=pt.SemanticActionStateTypes=void 0;var kc=Z(),Xo;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Xo||(pt.SemanticActionStateTypes=Xo={}));pt.semanticActionStateTypesZodSchema=kc.z.enum(["start","continue","done"])});var dn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.attachmentLayoutTypesZodSchema=ht.AttachmentLayoutTypes=void 0;var Uc=Z(),Qo;(function(t){t.List="list",t.Carousel="carousel"})(Qo||(ht.AttachmentLayoutTypes=Qo={}));ht.attachmentLayoutTypesZodSchema=Uc.z.enum(["list","carousel"])});var ln=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.Channels=void 0;var ei;(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.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",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"})(ei||(br.Channels=ei={}))});var fn=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.endOfConversationCodesZodSchema=mt.EndOfConversationCodes=void 0;var Rc=Z(),ti;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(ti||(mt.EndOfConversationCodes=ti={}));mt.endOfConversationCodesZodSchema=Rc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var ni=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.membershipSourceTypeZodSchema=yt.MembershipSourceTypes=void 0;var Nc=Z(),ri;(function(t){t.Channel="channel",t.Team="team"})(ri||(yt.MembershipSourceTypes=ri={}));yt.membershipSourceTypeZodSchema=Nc.z.enum(["channel","team"])});var ii=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.membershipTypeZodSchema=vt.MembershipTypes=void 0;var Mc=Z(),oi;(function(t){t.Direct="direct",t.Transitive="transitive"})(oi||(vt.MembershipTypes=oi={}));vt.membershipTypeZodSchema=Mc.z.enum(["direct","transitive"])});var Wt=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.roleTypeZodSchema=gt.RoleTypes=void 0;var Dc=Z(),si;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(si||(gt.RoleTypes=si={}));gt.roleTypeZodSchema=Dc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ai=y(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.addAIToActivity=void 0;var Lc=(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)};xr.addAIToActivity=Lc});var ci=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.adaptiveCardInvokeActionZodSchema=void 0;var Ke=Z();wr.adaptiveCardInvokeActionZodSchema=Ke.z.object({type:Ke.z.string().min(1),id:Ke.z.string().optional(),verb:Ke.z.string().min(1),data:Ke.z.record(Ke.z.string().min(1),Ke.z.any())})});var ui=y(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var di=y(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.default="00000000-0000-0000-0000-000000000000"});var li=y(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.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 Bt=y(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});var zc=li();function qc(t){return typeof t=="string"&&zc.default.test(t)}yn.default=qc});var Kt=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});var Fc=Bt();function Vc(t){if(!(0,Fc.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)}vn.default=Vc});var me=y(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.unsafeStringify=void 0;var $c=Bt(),N=[];for(let t=0;t<256;++t)N.push((t+256).toString(16).slice(1));function fi(t,e=0){return(N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]).toLowerCase()}Jt.unsafeStringify=fi;function Hc(t,e=0){let r=fi(t,e);if(!(0,$c.default)(r))throw TypeError("Stringified UUID is invalid");return r}Jt.default=Hc});var Cr=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var gn,Wc=new Uint8Array(16);function Bc(){if(!gn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");gn=crypto.getRandomValues.bind(crypto)}return gn(Wc)}_n.default=Bc});var bn=y(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.updateV1State=void 0;var pi=Cr(),Kc=me(),Gt={};function Jc(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=hi((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,pi.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,pi.default)();mi(Gt,l,f),n=hi(f,Gt.msecs,Gt.nsecs,o?void 0:Gt.clockseq,o?void 0:Gt.node,e,r)}return e!=null?e:(0,Kc.unsafeStringify)(n)}function mi(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}Yt.updateV1State=mi;function hi(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}Yt.default=Jc});var wn=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var Gc=Kt(),Yc=me();function Xc(t){let e=typeof t=="string"?(0,Gc.default)(t):t,r=Qc(e);return typeof t=="string"?(0,Yc.unsafeStringify)(r):r}xn.default=Xc;function Qc(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 vi=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});function eu(t){let e=nu(t),r=ru(e,t.length*8);return tu(r)}function tu(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 yi(t){return(t+64>>>9<<4)+14+1}function ru(t,e){let r=new Uint32Array(yi(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=L(n,o,i,s,t[a],7,-680876936),s=L(s,n,o,i,t[a+1],12,-389564586),i=L(i,s,n,o,t[a+2],17,606105819),o=L(o,i,s,n,t[a+3],22,-1044525330),n=L(n,o,i,s,t[a+4],7,-176418897),s=L(s,n,o,i,t[a+5],12,1200080426),i=L(i,s,n,o,t[a+6],17,-1473231341),o=L(o,i,s,n,t[a+7],22,-45705983),n=L(n,o,i,s,t[a+8],7,1770035416),s=L(s,n,o,i,t[a+9],12,-1958414417),i=L(i,s,n,o,t[a+10],17,-42063),o=L(o,i,s,n,t[a+11],22,-1990404162),n=L(n,o,i,s,t[a+12],7,1804603682),s=L(s,n,o,i,t[a+13],12,-40341101),i=L(i,s,n,o,t[a+14],17,-1502002290),o=L(o,i,s,n,t[a+15],22,1236535329),n=z(n,o,i,s,t[a+1],5,-165796510),s=z(s,n,o,i,t[a+6],9,-1069501632),i=z(i,s,n,o,t[a+11],14,643717713),o=z(o,i,s,n,t[a],20,-373897302),n=z(n,o,i,s,t[a+5],5,-701558691),s=z(s,n,o,i,t[a+10],9,38016083),i=z(i,s,n,o,t[a+15],14,-660478335),o=z(o,i,s,n,t[a+4],20,-405537848),n=z(n,o,i,s,t[a+9],5,568446438),s=z(s,n,o,i,t[a+14],9,-1019803690),i=z(i,s,n,o,t[a+3],14,-187363961),o=z(o,i,s,n,t[a+8],20,1163531501),n=z(n,o,i,s,t[a+13],5,-1444681467),s=z(s,n,o,i,t[a+2],9,-51403784),i=z(i,s,n,o,t[a+7],14,1735328473),o=z(o,i,s,n,t[a+12],20,-1926607734),n=q(n,o,i,s,t[a+5],4,-378558),s=q(s,n,o,i,t[a+8],11,-2022574463),i=q(i,s,n,o,t[a+11],16,1839030562),o=q(o,i,s,n,t[a+14],23,-35309556),n=q(n,o,i,s,t[a+1],4,-1530992060),s=q(s,n,o,i,t[a+4],11,1272893353),i=q(i,s,n,o,t[a+7],16,-155497632),o=q(o,i,s,n,t[a+10],23,-1094730640),n=q(n,o,i,s,t[a+13],4,681279174),s=q(s,n,o,i,t[a],11,-358537222),i=q(i,s,n,o,t[a+3],16,-722521979),o=q(o,i,s,n,t[a+6],23,76029189),n=q(n,o,i,s,t[a+9],4,-640364487),s=q(s,n,o,i,t[a+12],11,-421815835),i=q(i,s,n,o,t[a+15],16,530742520),o=q(o,i,s,n,t[a+2],23,-995338651),n=F(n,o,i,s,t[a],6,-198630844),s=F(s,n,o,i,t[a+7],10,1126891415),i=F(i,s,n,o,t[a+14],15,-1416354905),o=F(o,i,s,n,t[a+5],21,-57434055),n=F(n,o,i,s,t[a+12],6,1700485571),s=F(s,n,o,i,t[a+3],10,-1894986606),i=F(i,s,n,o,t[a+10],15,-1051523),o=F(o,i,s,n,t[a+1],21,-2054922799),n=F(n,o,i,s,t[a+8],6,1873313359),s=F(s,n,o,i,t[a+15],10,-30611744),i=F(i,s,n,o,t[a+6],15,-1560198380),o=F(o,i,s,n,t[a+13],21,1309151649),n=F(n,o,i,s,t[a+4],6,-145523070),s=F(s,n,o,i,t[a+11],10,-1120210379),i=F(i,s,n,o,t[a+2],15,718787259),o=F(o,i,s,n,t[a+9],21,-343485551),n=Ie(n,d),o=Ie(o,l),i=Ie(i,f),s=Ie(s,m)}return Uint32Array.of(n,o,i,s)}function nu(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(yi(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 Ie(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function ou(t,e){return t<<e|t>>>32-e}function Ir(t,e,r,n,o,i){return Ie(ou(Ie(Ie(e,t),Ie(n,i)),o),r)}function L(t,e,r,n,o,i,s){return Ir(e&r|~e&n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return Ir(e&n|r&~n,t,e,o,i,s)}function q(t,e,r,n,o,i,s){return Ir(e^r^n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return Ir(r^(e|~n),t,e,o,i,s)}Cn.default=eu});var Xt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var gi=Kt(),iu=me();function _i(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}ye.stringToBytes=_i;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function su(t,e,r,n,o,i){let s=typeof r=="string"?_i(r):r,a=typeof n=="string"?(0,gi.default)(n):n;if(typeof n=="string"&&(n=(0,gi.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,iu.unsafeStringify)(d)}ye.default=su});var xi=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.URL=Je.DNS=void 0;var au=vi(),In=Xt(),bi=Xt();Object.defineProperty(Je,"DNS",{enumerable:!0,get:function(){return bi.DNS}});Object.defineProperty(Je,"URL",{enumerable:!0,get:function(){return bi.URL}});function Tn(t,e,r,n){return(0,In.default)(48,au.default,t,e,r,n)}Tn.DNS=In.DNS;Tn.URL=In.URL;Je.default=Tn});var wi=y(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});var cu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);Sn.default={randomUUID:cu}});var Ii=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});var Ci=wi(),uu=Cr(),du=me();function lu(t,e,r){var o,i,s;if(Ci.default.randomUUID&&!e&&!t)return Ci.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,uu.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,du.unsafeStringify)(n)}An.default=lu});var Ti=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});function fu(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 On(t,e){return t<<e|t>>>32-e}function pu(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]=On(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],g=r[3],C=r[4];for(let O=0;O<80;++O){let v=Math.floor(O/20),S=On(l,5)+fu(v,f,m,g)+C+e[v]+d[O]>>>0;C=g,g=m,m=On(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]+g>>>0,r[4]=r[4]+C>>>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])}Pn.default=pu});var Ai=y(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.URL=Ge.DNS=void 0;var hu=Ti(),En=Xt(),Si=Xt();Object.defineProperty(Ge,"DNS",{enumerable:!0,get:function(){return Si.DNS}});Object.defineProperty(Ge,"URL",{enumerable:!0,get:function(){return Si.URL}});function jn(t,e,r,n){return(0,En.default)(80,hu.default,t,e,r,n)}jn.DNS=En.DNS;jn.URL=En.URL;Ge.default=jn});var Oi=y(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});var mu=me(),yu=bn(),vu=wn();function gu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,yu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,vu.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,mu.unsafeStringify)(n)}Zn.default=gu});var Pi=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});var _u=Kt(),bu=me();function xu(t){let e=typeof t=="string"?(0,_u.default)(t):t,r=wu(e);return typeof t=="string"?(0,bu.unsafeStringify)(r):r}kn.default=xu;function wu(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 ki=y(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.updateV7State=void 0;var Ei=Cr(),Cu=me(),Un={};function Iu(t,e,r){var o,i,s;let n;if(t)n=ji((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ei.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ei.default)();Zi(Un,a,d),n=ji(d,Un.msecs,Un.seq,e,r)}return e!=null?e:(0,Cu.unsafeStringify)(n)}function Zi(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}Qt.updateV7State=Zi;function ji(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}Qt.default=Iu});var Ui=y(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});var Tu=Bt();function Su(t){if(!(0,Tu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Rn.default=Su});var Ri=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.version=E.validate=E.v7=E.v6ToV1=E.v6=E.v5=E.v4=E.v3=E.v1ToV6=E.v1=E.stringify=E.parse=E.NIL=E.MAX=void 0;var Au=ui();Object.defineProperty(E,"MAX",{enumerable:!0,get:function(){return Au.default}});var Ou=di();Object.defineProperty(E,"NIL",{enumerable:!0,get:function(){return Ou.default}});var Pu=Kt();Object.defineProperty(E,"parse",{enumerable:!0,get:function(){return Pu.default}});var Eu=me();Object.defineProperty(E,"stringify",{enumerable:!0,get:function(){return Eu.default}});var ju=bn();Object.defineProperty(E,"v1",{enumerable:!0,get:function(){return ju.default}});var Zu=wn();Object.defineProperty(E,"v1ToV6",{enumerable:!0,get:function(){return Zu.default}});var ku=xi();Object.defineProperty(E,"v3",{enumerable:!0,get:function(){return ku.default}});var Uu=Ii();Object.defineProperty(E,"v4",{enumerable:!0,get:function(){return Uu.default}});var Ru=Ai();Object.defineProperty(E,"v5",{enumerable:!0,get:function(){return Ru.default}});var Nu=Oi();Object.defineProperty(E,"v6",{enumerable:!0,get:function(){return Nu.default}});var Mu=Pi();Object.defineProperty(E,"v6ToV1",{enumerable:!0,get:function(){return Mu.default}});var Du=ki();Object.defineProperty(E,"v7",{enumerable:!0,get:function(){return Du.default}});var Lu=Bt();Object.defineProperty(E,"validate",{enumerable:!0,get:function(){return Lu.default}});var zu=Ui();Object.defineProperty(E,"version",{enumerable:!0,get:function(){return zu.default}})});var Nn=y(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.entityZodSchema=void 0;var Ni=Z();Tr.entityZodSchema=Ni.z.object({type:Ni.z.string().min(1)}).passthrough()});var Mi=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.semanticActionZodSchema=void 0;var er=Z(),qu=Nn(),Fu=un();Sr.semanticActionZodSchema=er.z.object({id:er.z.string().min(1),state:er.z.union([Fu.semanticActionStateTypesZodSchema,er.z.string().min(1)]),entities:er.z.record(qu.entityZodSchema)})});var Di=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.cardActionZodSchema=void 0;var de=Z(),Vu=cn();Ar.cardActionZodSchema=de.z.object({type:de.z.union([Vu.actionTypesZodSchema,de.z.string().min(1)]),title:de.z.string().min(1),image:de.z.string().min(1).optional(),text:de.z.string().min(1).optional(),displayText:de.z.string().min(1).optional(),value:de.z.any().optional(),channelData:de.z.unknown().optional(),imageAltText:de.z.string().min(1).optional()})});var Li=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.suggestedActionsZodSchema=void 0;var Or=Z(),$u=Di();Pr.suggestedActionsZodSchema=Or.z.object({to:Or.z.array(Or.z.string().min(1)),actions:Or.z.array($u.cardActionZodSchema)})});var Mn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityEventNamesZodSchema=_t.ActivityEventNames=void 0;var Hu=Z(),zi;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(zi||(_t.ActivityEventNames=zi={}));_t.activityEventNamesZodSchema=Hu.z.enum(["ContinueConversation","CreateConversation"])});var Dn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.activityImportanceZodSchema=bt.ActivityImportance=void 0;var Wu=Z(),qi;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(qi||(bt.ActivityImportance=qi={}));bt.activityImportanceZodSchema=Wu.z.enum(["low","normal","high"])});var Ln=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.activityTypesZodSchema=xt.ActivityTypes=void 0;var Bu=Z(),Fi;(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"})(Fi||(xt.ActivityTypes=Fi={}));xt.activityTypesZodSchema=Bu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Vi=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.attachmentZodSchema=void 0;var wt=Z();Er.attachmentZodSchema=wt.z.object({contentType:wt.z.string().min(1),contentUrl:wt.z.string().min(1).optional(),content:wt.z.unknown().optional(),name:wt.z.string().min(1).optional(),thumbnailUrl:wt.z.string().min(1).optional()})});var $i=y(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.addProductInfoToActivity=Ye.clearProductInfoFromActivity=void 0;var Ku=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Ye.clearProductInfoFromActivity=Ku;var Ju=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Ye.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Ye.addProductInfoToActivity=Ju});var zn=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.channelAccountZodSchema=void 0;var ne=Z(),Gu=Wt();jr.channelAccountZodSchema=ne.z.object({id:ne.z.string().min(1).optional(),name:ne.z.string().optional(),aadObjectId:ne.z.string().min(1).optional(),tenantId:ne.z.string().min(1).optional(),agenticUserId:ne.z.string().min(1).optional(),agenticAppId:ne.z.string().min(1).optional(),agenticAppBlueprintId:ne.z.string().min(1).optional(),role:ne.z.union([Gu.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var qn=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationAccountZodSchema=void 0;var le=Z(),Yu=Wt();Zr.conversationAccountZodSchema=le.z.object({isGroup:le.z.boolean().optional(),conversationType:le.z.string().min(1).optional(),tenantId:le.z.string().min(1).optional(),id:le.z.string().min(1),name:le.z.string().min(1).optional(),aadObjectId:le.z.string().min(1).optional(),role:le.z.union([Yu.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var Wi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.conversationReferenceZodSchema=void 0;var tr=Z(),Hi=zn(),Xu=qn();kr.conversationReferenceZodSchema=tr.z.object({activityId:tr.z.string().min(1).optional(),user:Hi.channelAccountZodSchema.optional(),locale:tr.z.string().min(1).optional(),agent:Hi.channelAccountZodSchema.optional().nullable(),conversation:Xu.conversationAccountZodSchema,channelId:tr.z.string().min(1),serviceUrl:tr.z.string().min(1).optional()})});var Fn=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.deliveryModesZodSchema=Ct.DeliveryModes=void 0;var Qu=Z(),Bi;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Bi||(Ct.DeliveryModes=Bi={}));Ct.deliveryModesZodSchema=Qu.z.enum(["normal","notification","expectReplies","ephemeral"])});var Vn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.inputHintsZodSchema=It.InputHints=void 0;var ed=Z(),Ki;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Ki||(It.InputHints=Ki={}));It.inputHintsZodSchema=ed.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var $n=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.messageReactionTypesZodSchema=Tt.MessageReactionTypes=void 0;var td=Z(),Ji;(function(t){t.Like="like",t.PlusOne="plusOne"})(Ji||(Tt.MessageReactionTypes=Ji={}));Tt.messageReactionTypesZodSchema=td.z.enum(["like","plusOne"])});var Gi=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.messageReactionZodSchema=void 0;var Hn=Z(),rd=$n();Ur.messageReactionZodSchema=Hn.z.object({type:Hn.z.union([rd.messageReactionTypesZodSchema,Hn.z.string().min(1)])})});var Wn=y(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.textFormatTypesZodSchema=St.TextFormatTypes=void 0;var nd=Z(),Yi;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Yi||(St.TextFormatTypes=Yi={}));St.textFormatTypesZodSchema=nd.z.enum(["markdown","plain","xml"])});var Xi=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.textHighlightZodSchema=void 0;var Bn=Z();Rr.textHighlightZodSchema=Bn.z.object({text:Bn.z.string().min(1),occurrence:Bn.z.number()})});var Kn=y(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.ExceptionHelper=void 0;var Nr=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(m=>{s=s.replace(`{${m}}`,o[m])});let d=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${d}`,f=new e(l);return f.code=r.code,f.helpLink=d,n&&(f.innerException=n),f}};Mr.ExceptionHelper=Nr;Nr.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Jn=y(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.Errors=void 0;Dr.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var os=y(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Activity=Xe.activityZodSchema=void 0;var od=Ri(),b=Z(),id=Mi(),sd=Li(),ns=Mn(),ad=Dn(),zr=Ln(),cd=Vi(),ud=dn(),Qi=$i(),Lr=zn(),es=ln(),dd=qn(),ld=Wi(),fd=fn(),pd=Fn(),hd=Nn(),md=Vn(),ts=Gi(),yd=Wn(),vd=Xi(),rs=Wt(),Te=Kn(),Se=Jn();Xe.activityZodSchema=b.z.object({type:b.z.union([zr.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:Lr.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:dd.conversationAccountZodSchema.optional(),recipient:Lr.channelAccountZodSchema.optional(),textFormat:b.z.union([yd.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([ud.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Lr.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Lr.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(ts.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(ts.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([md.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:sd.suggestedActionsZodSchema.optional(),attachments:b.z.array(cd.attachmentZodSchema).optional(),entities:b.z.array(hd.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([ns.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:ld.conversationReferenceZodSchema.optional(),code:b.z.union([fd.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:b.z.union([ad.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([pd.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(vd.textHighlightZodSchema).optional(),semanticAction:id.semanticActionZodSchema.optional()});var Gn=class t{constructor(e){if(e===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeUndefined);if(e===null)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Xe.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 Te.ExceptionHelper.generateException(Error,Se.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Qi.addProductInfoToActivity)(this,n):(0,Qi.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 Te.ExceptionHelper.generateException(Error,Se.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:zr.ActivityTypes.Event,name:ns.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,od.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!==zr.ActivityTypes.ConversationUpdate||this.channelId!==es.Channels.Directline&&this.channelId!==es.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Te.ExceptionHelper.generateException(Error,Se.Errors.ActivityChannelIdUndefined);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===zr.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(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===rs.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===rs.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}};Xe.Activity=Gn});var is=y(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.activityTreatments=At.ActivityTreatments=void 0;var gd=Z(),Yn;(function(t){t.Targeted="targeted"})(Yn||(At.ActivityTreatments=Yn={}));At.activityTreatments=gd.z.nativeEnum(Yn)});var Xn=y(x=>{"use strict";var _d=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]})),ss=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_d(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.Logger=x.debug=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=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 bd=cn();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return bd.ActionTypes}});var xd=un();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return xd.SemanticActionStateTypes}});var wd=dn();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return wd.AttachmentLayoutTypes}});var Cd=ln();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return Cd.Channels}});var Id=fn();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return Id.EndOfConversationCodes}});var Td=ni();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return Td.MembershipSourceTypes}});var Sd=ii();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Sd.MembershipTypes}});var Ad=Wt();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Ad.RoleTypes}});ss(ai(),x);ss(ci(),x);var as=os();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return as.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return as.activityZodSchema}});var Od=Mn();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return Od.ActivityEventNames}});var Pd=Dn();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Pd.ActivityImportance}});var Ed=Ln();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Ed.ActivityTypes}});var jd=Fn();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return jd.DeliveryModes}});var Zd=Vn();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Zd.InputHints}});var kd=$n();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return kd.MessageReactionTypes}});var Ud=Wn();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Ud.TextFormatTypes}});var Rd=is();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Rd.ActivityTreatments}});var cs=zt();Object.defineProperty(x,"debug",{enumerable:!0,get:function(){return cs.debug}});Object.defineProperty(x,"Logger",{enumerable:!0,get:function(){return cs.Logger}});var Nd=Kn();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return Nd.ExceptionHelper}});var Md=Jn();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return Md.Errors}})});var Dt=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Dt||{});var Lt=(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))(Lt||{});var Jr=class{constructor(){this.useExperimentalEndpoint=!1}},Gr=class extends Jr{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(Lt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Lt).join(", ")}`);if(!Object.values(Dt).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Dt).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},nl=()=>{var t,e,r,n,o,i,s;return new Gr({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:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true"})};var or=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 Yr(t){}function vo(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=Yr,onError:r=Yr,onRetry:n=Yr,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let S=s?v.replace(/^\xEF\xBB\xBF/,""):v,[A,P]=Ls(`${i}${S}`);for(let R of A)m(R);i=P,s=!1}function m(v){if(v===""){C();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let S=v.indexOf(":");if(S!==-1){let A=v.slice(0,S),P=v[S+1]===" "?2:1,R=v.slice(S+P);g(A,R,v);return}g(v,"",v)}function g(v,S,A){switch(v){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 or(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:A}));break;default:r(new or(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:S,line:A}));break}}function C(){d.length>0&&e({id:a,event:l||void 0,data:d.endsWith(`
3
3
  `)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(v={}){i&&v.consume&&m(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:O}}function Ls(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 go="connecting",zs="open",Xr="closed",ir=()=>{};function qs(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=ir,onConnect:i=ir,onDisconnect:s=ir,onScheduleReconnect:a=ir}=r,{fetch:d,url:l,initialLastEventId:f}=Fs(r),m={...r.headers},g=[],C=n?[n]:[],O=U=>C.forEach(se=>se(U)),v=vo({onEvent:Es,onRetry:js,onComment:o}),S,A=l.toString(),P=new AbortController,R=f,V=2e3,ie,$=Xr;return Y(),{close:Oe,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Kr,get lastEventId(){return R},get url(){return A},get readyState(){return $}};function Y(){S||($=go,P=new AbortController,S=d(l,Zs()).then(Ps).catch(U=>{S=null,!(U.name==="AbortError"||U.type==="aborted"||P.signal.aborted)&&po()}))}function Oe(){$=Xr,P.abort(),v.reset(),clearTimeout(ie),g.forEach(U=>U())}function Kr(){let U=[],se=[];function Rt(){return new Promise(H=>{let ae=se.shift();ae?H({value:ae,done:!1}):U.push(H)})}let et=function(H){let ae=U.shift();ae?ae({value:H,done:!1}):se.push(H)};function Pe(){for(C.splice(C.indexOf(et),1);U.shift(););for(;se.shift(););}function Nt(){let H=U.shift();H&&(H({done:!0,value:void 0}),Pe())}return g.push(Nt),C.push(et),{next(){return $===Xr?this.return():Rt()},return(){return Pe(),Promise.resolve({done:!0,value:void 0})},throw(H){return Pe(),Promise.reject(H)},[Symbol.asyncIterator](){return this}}}function po(){a({delay:V}),!P.signal.aborted&&($=go,ie=setTimeout(Y,V))}async function Ps(U){i(),v.reset();let{body:se,redirected:Rt,status:et}=U;if(et===204){s(),Oe();return}if(!se)throw new Error("Missing response body");Rt&&(A=U.url);let Pe=e(se),Nt=new TextDecoder,H=Pe.getReader(),ae=!0;$=zs;do{let{done:ho,value:mo}=await H.read();mo&&v.feed(Nt.decode(mo,{stream:!ho})),ho&&(ae=!1,S=null,v.reset(),po(),s())}while(ae)}function Es(U){typeof U.id=="string"&&(R=U.id),O(U)}function js(U){V=U}function Zs(){let{mode:U,credentials:se,body:Rt,method:et,redirect:Pe,referrer:Nt,referrerPolicy:H}=r,ae={Accept:"text/event-stream",...m,...R?{"Last-Event-ID":R}:void 0};return{mode:U,credentials:se,body:Rt,method:et,redirect:Pe,referrer:Nt,referrerPolicy:H,headers:ae,cache:"no-store",signal:P.signal}}}function Fs(t){let e=t.fetch||globalThis.fetch;if(!Vs(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 Vs(t){return typeof t=="function"}var $s={getStream:Hs};function _o(t){return qs(t,$s)}function Hs(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var So=Mt(zt());var ur=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;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 dr=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 ot=(0,So.debug)("copilot-studio:power-platform");function fr(t,e){var d,l,f,m,g,C,O,v;let r=((d=t.schemaName)==null?void 0:d.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((f=t.directConnectUrl)!=null&&f.trim())&&(!((m=t.environmentId)!=null&&m.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((g=t.directConnectUrl)!=null&&g.trim()){if(ot.debug(`Using direct connection: ${t.directConnectUrl}`),!qt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(ot.warn(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),fr({...t,directConnectUrl:""},e)):ca(t.directConnectUrl,e).href}let n=(C=t.cloud)!=null?C:"Prod",o=(O=t.copilotAgentType)!=null?O:"Published";if(ot.debug(`Using cloud setting: ${n}`),ot.debug(`Using agent type: ${o}`),n==="Other")if((v=t.customPowerPlatformCloud)!=null&&v.trim())if(qt(t.customPowerPlatformCloud))ot.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 i=ua(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new dr({host:i,schema:r}),Prebuilt:()=>new ur({host:i,schema:r})}[o]().getConversationUrl(e);return ot.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Ao(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&&qt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&qt(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://${lr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&qt(n)){if(To(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://${lr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${lr(To(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function qt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ca(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 ua(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=da(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${lr(t,r)}`)}function lr(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 da(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function To(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 Ot=Mt(Xn());var qr=class{constructor(e){this.activity=e}};var ls=Mt(zt());var us="1.3.0-beta.10.gf7fc2bf267";var Fr={};var G=(0,ls.debug)("copilot-studio:client"),ve=class ve{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var s,a,d,l,f,m,g,C,O,v;G.debug(`>>> SEND TO ${e}`);let o=new Map,i=_o({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":ve.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(S,A)=>{let P=await fetch(S,A);return this.processResponseHeaders(P.headers),P}});try{for await(let{data:S,event:A}of i){if(S&&A==="activity")try{let P=Ot.Activity.fromJson(S),R=(s=P.entities)==null?void 0:s.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(P.type){case Ot.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(d=(a=P.conversation)==null?void 0:a.id)!=null?d:"",G.debug(`Conversation ID: ${this.conversationId}`)),yield P;break;case Ot.ActivityTypes.Typing:if(G.debug(`Activity type: ${P.type}`),R||((l=P.channelData)==null?void 0:l.streamType)==="streaming"){let V=(f=P.text)!=null?f:"",ie=(g=R==null?void 0:R.streamId)!=null?g:(m=P.channelData)==null?void 0:m.streamId,$=(O=R==null?void 0:R.streamSequence)!=null?O:(C=P.channelData)==null?void 0:C.streamSequence;if(ie&&$){if(o.has(ie)){let Y=o.get(ie);Y.push({text:V,sequence:$}),o.set(ie,Y)}else o.set(ie,[{text:V,sequence:$}]);P.text=((v=o.get(ie))==null?void 0:v.sort((Y,Oe)=>Y.sequence-Oe.sequence).map(Y=>Y.text).join(""))||""}}yield P;break;default:G.debug(`Activity type: ${P.type}`),yield P;break}}catch(P){G.error("Failed to parse activity:",P)}else if(A==="end"){G.debug("Stream complete");break}if(i.readyState==="closed"){G.debug("Connection closed");break}}}finally{i.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${us}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Fr.platform()}-${Fr.arch()}/${Fr.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(ve.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,G.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(ve.conversationIdHeaderKey))!=null?o:"",this.conversationId&&G.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==ve.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),G.debug("Headers received:",r)}async*startConversationStreaming(e=!0){let r=fr(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=fr(this.settings,n),i=new qr(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=Ot.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}};ve.conversationIdHeaderKey="x-ms-conversationid",ve.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",ve.scopeFromSettings=Ao;var ds=ve;var M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));function fs(t,e=0){return(M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]).toLowerCase()}var Qn,Ld=new Uint8Array(16);function eo(){if(!Qn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qn=crypto.getRandomValues.bind(crypto)}return Qn(Ld)}var zd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),to={randomUUID:zd};function qd(t,e,r){var o,i,s;if(to.randomUUID&&!e&&!t)return to.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:eo();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 fs(n)}var ro=qd;var As=Mt(Xn());var no=function(t,e){return no=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])},no(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");no(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function rr(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 Pt(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 Et(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 te(t){return typeof t=="function"}function Vr(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 $r=Vr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
5
+ `&&n++}}return[e,r]}var go="connecting",zs="open",Xr="closed",ir=()=>{};function qs(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=ir,onConnect:i=ir,onDisconnect:s=ir,onScheduleReconnect:a=ir}=r,{fetch:d,url:l,initialLastEventId:f}=Fs(r),m={...r.headers},g=[],C=n?[n]:[],O=U=>C.forEach(se=>se(U)),v=vo({onEvent:Es,onRetry:js,onComment:o}),S,A=l.toString(),P=new AbortController,R=f,V=2e3,ie,$=Xr;return Y(),{close:Oe,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Kr,get lastEventId(){return R},get url(){return A},get readyState(){return $}};function Y(){S||($=go,P=new AbortController,S=d(l,Zs()).then(Ps).catch(U=>{S=null,!(U.name==="AbortError"||U.type==="aborted"||P.signal.aborted)&&po()}))}function Oe(){$=Xr,P.abort(),v.reset(),clearTimeout(ie),g.forEach(U=>U())}function Kr(){let U=[],se=[];function Rt(){return new Promise(H=>{let ae=se.shift();ae?H({value:ae,done:!1}):U.push(H)})}let et=function(H){let ae=U.shift();ae?ae({value:H,done:!1}):se.push(H)};function Pe(){for(C.splice(C.indexOf(et),1);U.shift(););for(;se.shift(););}function Nt(){let H=U.shift();H&&(H({done:!0,value:void 0}),Pe())}return g.push(Nt),C.push(et),{next(){return $===Xr?this.return():Rt()},return(){return Pe(),Promise.resolve({done:!0,value:void 0})},throw(H){return Pe(),Promise.reject(H)},[Symbol.asyncIterator](){return this}}}function po(){a({delay:V}),!P.signal.aborted&&($=go,ie=setTimeout(Y,V))}async function Ps(U){i(),v.reset();let{body:se,redirected:Rt,status:et}=U;if(et===204){s(),Oe();return}if(!se)throw new Error("Missing response body");Rt&&(A=U.url);let Pe=e(se),Nt=new TextDecoder,H=Pe.getReader(),ae=!0;$=zs;do{let{done:ho,value:mo}=await H.read();mo&&v.feed(Nt.decode(mo,{stream:!ho})),ho&&(ae=!1,S=null,v.reset(),po(),s())}while(ae)}function Es(U){typeof U.id=="string"&&(R=U.id),O(U)}function js(U){V=U}function Zs(){let{mode:U,credentials:se,body:Rt,method:et,redirect:Pe,referrer:Nt,referrerPolicy:H}=r,ae={Accept:"text/event-stream",...m,...R?{"Last-Event-ID":R}:void 0};return{mode:U,credentials:se,body:Rt,method:et,redirect:Pe,referrer:Nt,referrerPolicy:H,headers:ae,cache:"no-store",signal:P.signal}}}function Fs(t){let e=t.fetch||globalThis.fetch;if(!Vs(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 Vs(t){return typeof t=="function"}var $s={getStream:Hs};function _o(t){return qs(t,$s)}function Hs(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var So=Mt(zt());var ur=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;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 dr=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 ot=(0,So.debug)("copilot-studio:power-platform");function fr(t,e){var d,l,f,m,g,C,O,v;let r=((d=t.schemaName)==null?void 0:d.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((f=t.directConnectUrl)!=null&&f.trim())&&(!((m=t.environmentId)!=null&&m.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((g=t.directConnectUrl)!=null&&g.trim()){if(ot.debug(`Using direct connection: ${t.directConnectUrl}`),!qt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(ot.warn(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),fr({...t,directConnectUrl:""},e)):ca(t.directConnectUrl,e).href}let n=(C=t.cloud)!=null?C:"Prod",o=(O=t.copilotAgentType)!=null?O:"Published";if(ot.debug(`Using cloud setting: ${n}`),ot.debug(`Using agent type: ${o}`),n==="Other")if((v=t.customPowerPlatformCloud)!=null&&v.trim())if(qt(t.customPowerPlatformCloud))ot.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 i=ua(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new dr({host:i,schema:r}),Prebuilt:()=>new ur({host:i,schema:r})}[o]().getConversationUrl(e);return ot.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Ao(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&&qt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&qt(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://${lr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&qt(n)){if(To(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://${lr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${lr(To(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function qt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function ca(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 ua(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=da(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${lr(t,r)}`)}function lr(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 da(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function To(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 Ot=Mt(Xn());var qr=class{constructor(e){this.activity=e}};var ls=Mt(zt());var us="1.3.0-beta.14.gf38b0646bb";var Fr={};var G=(0,ls.debug)("copilot-studio:client"),ve=class ve{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var s,a,d,l,f,m,g,C,O,v;G.debug(`>>> SEND TO ${e}`);let o=new Map,i=_o({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":ve.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(S,A)=>{let P=await fetch(S,A);return this.processResponseHeaders(P.headers),P}});try{for await(let{data:S,event:A}of i){if(S&&A==="activity")try{let P=Ot.Activity.fromJson(S),R=(s=P.entities)==null?void 0:s.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(P.type){case Ot.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(d=(a=P.conversation)==null?void 0:a.id)!=null?d:"",G.debug(`Conversation ID: ${this.conversationId}`)),yield P;break;case Ot.ActivityTypes.Typing:if(G.debug(`Activity type: ${P.type}`),R||((l=P.channelData)==null?void 0:l.streamType)==="streaming"){let V=(f=P.text)!=null?f:"",ie=(g=R==null?void 0:R.streamId)!=null?g:(m=P.channelData)==null?void 0:m.streamId,$=(O=R==null?void 0:R.streamSequence)!=null?O:(C=P.channelData)==null?void 0:C.streamSequence;if(ie&&$){if(o.has(ie)){let Y=o.get(ie);Y.push({text:V,sequence:$}),o.set(ie,Y)}else o.set(ie,[{text:V,sequence:$}]);P.text=((v=o.get(ie))==null?void 0:v.sort((Y,Oe)=>Y.sequence-Oe.sequence).map(Y=>Y.text).join(""))||""}}yield P;break;default:G.debug(`Activity type: ${P.type}`),yield P;break}}catch(P){G.error("Failed to parse activity:",P)}else if(A==="end"){G.debug("Stream complete");break}if(i.readyState==="closed"){G.debug("Connection closed");break}}}finally{i.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${us}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Fr.platform()}-${Fr.arch()}/${Fr.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(ve.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,G.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(ve.conversationIdHeaderKey))!=null?o:"",this.conversationId&&G.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==ve.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),G.debug("Headers received:",r)}async*startConversationStreaming(e=!0){let r=fr(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=fr(this.settings,n),i=new qr(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=Ot.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}};ve.conversationIdHeaderKey="x-ms-conversationid",ve.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",ve.scopeFromSettings=Ao;var ds=ve;var M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));function fs(t,e=0){return(M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]).toLowerCase()}var Qn,Ld=new Uint8Array(16);function eo(){if(!Qn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qn=crypto.getRandomValues.bind(crypto)}return Qn(Ld)}var zd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),to={randomUUID:zd};function qd(t,e,r){var o,i,s;if(to.randomUUID&&!e&&!t)return to.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:eo();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 fs(n)}var ro=qd;var As=Mt(Xn());var no=function(t,e){return no=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])},no(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");no(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function rr(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 Pt(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 Et(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 te(t){return typeof t=="function"}function Vr(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 $r=Vr(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
7
  `):"",this.name="UnsubscriptionError",this.errors=r}});function nr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var jt=(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=rr(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(v){e={error:v}}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(te(f))try{f()}catch(v){i=v instanceof $r?v.errors:[v]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var g=rr(m),C=g.next();!C.done;C=g.next()){var O=C.value;try{ps(O)}catch(v){i=i!=null?i:[],v instanceof $r?i=Et(Et([],Pt(i)),Pt(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{C&&!C.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}}if(i)throw new $r(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)ps(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)&&nr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&nr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var oo=jt.EMPTY;function Hr(t){return t instanceof jt||t&&"closed"in t&&te(t.remove)&&te(t.add)&&te(t.unsubscribe)}function ps(t){te(t)?t():t.unsubscribe()}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Zt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Zt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Et([t,e],Pt(r))):setTimeout.apply(void 0,Et([t,e],Pt(r)))},clearTimeout:function(t){var e=Zt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function hs(t){Zt.setTimeout(function(){var e=oe.onUnhandledError;if(e)e(t);else throw t})}function io(){}var ms=(function(){return so("C",void 0,void 0)})();function ys(t){return so("E",void 0,t)}function vs(t){return so("N",t,void 0)}function so(t,e,r){return{kind:t,value:e,error:r}}var Qe=null;function kt(t){if(oe.useDeprecatedSynchronousErrorHandling){var e=!Qe;if(e&&(Qe={errorThrown:!1,error:null}),t(),e){var r=Qe,n=r.errorThrown,o=r.error;if(Qe=null,n)throw o}}else t()}function gs(t){oe.useDeprecatedSynchronousErrorHandling&&Qe&&(Qe.errorThrown=!0,Qe.error=t)}var uo=(function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Hr(r)&&r.add(n)):n.destination=Hd,n}return e.create=function(r,n,o){return new Br(r,n,o)},e.prototype.next=function(r){this.isStopped?co(vs(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?co(ys(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?co(ms,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})(jt);var Fd=Function.prototype.bind;function ao(t,e){return Fd.call(t,e)}var Vd=(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){Wr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Wr(n)}else Wr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Wr(r)}},t})(),Br=(function(t){Ae(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(te(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&&oe.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ao(r.next,a),error:r.error&&ao(r.error,a),complete:r.complete&&ao(r.complete,a)}):s=r}return i.destination=new Vd(s),i}return e})(uo);function Wr(t){oe.useDeprecatedSynchronousErrorHandling?gs(t):hs(t)}function $d(t){throw t}function co(t,e){var r=oe.onStoppedNotification;r&&Zt.setTimeout(function(){return r(t,e)})}var Hd={closed:!0,next:io,error:$d,complete:io};var _s=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function bs(t){return t}function xs(t){return t.length===0?bs:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ut=(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=Bd(e)?e:new Br(e,r,n);return kt(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=ws(r),new r(function(o,i){var s=new Br({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[_s]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return xs(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=ws(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 ws(t){var e;return(e=t!=null?t:oe.Promise)!==null&&e!==void 0?e:Promise}function Wd(t){return t&&te(t.next)&&te(t.error)&&te(t.complete)}function Bd(t){return t&&t instanceof uo||Wd(t)&&Hr(t)}var Cs=Vr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var lo=(function(t){Ae(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 Is(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Cs},e.prototype.next=function(r){var n=this;kt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=rr(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;kt(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;kt(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?oo:(this.currentObservers=null,a.push(r),new jt(function(){n.currentObservers=null,nr(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 Ut;return r.source=this,r},e.create=function(r,n){return new Is(r,n)},e})(Ut);var Is=(function(t){Ae(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:oo},e})(lo);var fo=(function(t){Ae(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})(lo);var Os=Mt(zt()),ge=(0,Os.debug)("copilot-studio:webchat");function Kd(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var Ts=class{static createConnection(e,r){ge.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new fo(0),a=Ss(async f=>{o=f;let m=Kd(async()=>{s.next(2),await Promise.resolve()});if(ge.debug("--> Connection established."),l(),s.value<2){for await(let g of e.startConversationStreaming())delete g.replyToId,!i&&g.conversation&&(i=g.conversation,await m()),d(g);await m()}}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,ge.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(ge.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 Ss(async m=>{try{ge.info("--> Sending activity to Copilot Studio ...");let g=As.Activity.fromObject({...f,id:ro(),attachments:await Jd(f)});d(g),l(),m.next(g.id);for await(let C of e.sendActivityStreaming(g))d(C),ge.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(g){ge.error("Error sending Activity to Copilot Studio:",g),m.error(g)}})},end(){ge.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function Jd(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 Gd(n);e.push(o)}return e}async function Gd(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=Yd(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,ge.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Yd(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 Ss(t){return new Ut(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Dt as AgentType,Gr as ConnectionSettings,ds as CopilotStudioClient,Ts as CopilotStudioWebChat,qr as ExecuteTurnRequest,Lt as PowerPlatformCloud,fr as getCopilotStudioConnectionUrl,Ao as getTokenAudience,nl as loadCopilotStudioConnectionSettingsFromEnv};
8
8
  //# sourceMappingURL=browser.mjs.map