@microsoft/agents-copilotstudio-client 1.1.0-alpha.5 → 1.1.0-alpha.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +3 -3
- package/dist/src/browser.mjs +6 -8
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/copilotStudioClient.d.ts +16 -8
- package/dist/src/copilotStudioClient.js +88 -97
- package/dist/src/copilotStudioClient.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +80 -11
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/package.json +3 -3
- package/src/copilotStudioClient.ts +92 -110
- package/src/copilotStudioWebChat.ts +88 -13
package/dist/src/browser.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
var Ya=Object.create;var An=Object.defineProperty;var Xa=Object.getOwnPropertyDescriptor;var Qa=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),rc=(t,e)=>{for(var r in e)An(t,r,{get:e[r],enumerable:!0})},nc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Qa(e))!tc.call(t,o)&&o!==r&&An(t,o,{get:()=>e[o],enumerable:!(n=Xa(e,o))||n.enumerable});return t};var xr=(t,e,r)=>(r=t!=null?Ya(ec(t)):{},nc(e||!t||!t.__esModule?An(r,"default",{value:t,enumerable:!0}):r,t));var Ki=x((My,Ji)=>{var dt=1e3,lt=dt*60,ft=lt*60,Ze=ft*24,vu=Ze*7,bu=Ze*365.25;Ji.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return _u(t);if(r==="number"&&isFinite(t))return e.long?wu(t):xu(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function _u(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*bu;case"weeks":case"week":case"w":return r*vu;case"days":case"day":case"d":return r*Ze;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ft;case"minutes":case"minute":case"mins":case"min":case"m":return r*lt;case"seconds":case"second":case"secs":case"sec":case"s":return r*dt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function xu(t){var e=Math.abs(t);return e>=Ze?Math.round(t/Ze)+"d":e>=ft?Math.round(t/ft)+"h":e>=lt?Math.round(t/lt)+"m":e>=dt?Math.round(t/dt)+"s":t+"ms"}function wu(t){var e=Math.abs(t);return e>=Ze?Mr(t,e,Ze,"day"):e>=ft?Mr(t,e,ft,"hour"):e>=lt?Mr(t,e,lt,"minute"):e>=dt?Mr(t,e,dt,"second"):t+" ms"}function Mr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Yi=x((Fy,Gi)=>{function Cu(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=a,r.humanize=Ki(),r.destroy=u,Object.keys(t).forEach(d=>{r[d]=t[d]}),r.names=[],r.skips=[],r.formatters={};function e(d){let m=0;for(let b=0;b<d.length;b++)m=(m<<5)-m+d.charCodeAt(b),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(d){let m,b=null,C,y;function v(..._){if(!v.enabled)return;let S=v,R=Number(new Date),N=R-(m||R);S.diff=N,S.prev=m,S.curr=R,m=R,_[0]=r.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let z=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(te,ye)=>{if(te==="%%")return"%";z++;let je=r.formatters[ye];if(typeof je=="function"){let _r=_[z];te=je.call(S,_r),_.splice(z,1),z--}return te}),r.formatArgs.call(S,_),(S.log||r.log).apply(S,_)}return v.namespace=d,v.useColors=r.useColors(),v.color=r.selectColor(d),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>b!==null?b:(C!==r.namespaces&&(C=r.namespaces,y=r.enabled(d)),y),set:_=>{b=_}}),typeof r.init=="function"&&r.init(v),v}function n(d,m){let b=r(this.namespace+(typeof m=="undefined"?":":m)+d);return b.log=this.log,b}function o(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let m=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let b of m)b[0]==="-"?r.skips.push(b.slice(1)):r.names.push(b)}function i(d,m){let b=0,C=0,y=-1,v=0;for(;b<d.length;)if(C<m.length&&(m[C]===d[b]||m[C]==="*"))m[C]==="*"?(y=C,v=b,C++):(b++,C++);else if(y!==-1)C=y+1,v++,b=v;else return!1;for(;C<m.length&&m[C]==="*";)C++;return C===m.length}function s(){let d=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),d}function a(d){for(let m of r.skips)if(i(d,m))return!1;for(let m of r.names)if(i(d,m))return!0;return!1}function c(d){return d instanceof Error?d.stack||d.message:d}function u(){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}Gi.exports=Cu});var Xi=x((G,Fr)=>{G.formatArgs=Su;G.save=Iu;G.load=Au;G.useColors=Tu;G.storage=Ou();G.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`."))}})();G.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 Tu(){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 Su(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Fr.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)}G.log=console.debug||console.log||(()=>{});function Iu(t){try{t?G.storage.setItem("debug",t):G.storage.removeItem("debug")}catch{}}function Au(){let t;try{t=G.storage.getItem("debug")||G.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ou(){try{return localStorage}catch{}}Fr.exports=Yi()(G);var{formatters:Eu}=Fr.exports;Eu.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var rr=x(Ue=>{"use strict";var Pu=Ue&&Ue.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.Logger=void 0;Ue.debug=ku;var Ru=Pu(Xi()),ju=["info","warn","error","debug"],zr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of ju){let n=(0,Ru.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)}};Ue.Logger=zr;function ku(t){return new zr(t)}});var or=x(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.getParsedType=Z.ZodParsedType=Z.objectUtil=Z.util=void 0;var eo;(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})(eo||(Z.util=eo={}));var rs;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(rs||(Z.objectUtil=rs={}));Z.ZodParsedType=eo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Du=t=>{switch(typeof t){case"undefined":return Z.ZodParsedType.undefined;case"string":return Z.ZodParsedType.string;case"number":return Number.isNaN(t)?Z.ZodParsedType.nan:Z.ZodParsedType.number;case"boolean":return Z.ZodParsedType.boolean;case"function":return Z.ZodParsedType.function;case"bigint":return Z.ZodParsedType.bigint;case"symbol":return Z.ZodParsedType.symbol;case"object":return Array.isArray(t)?Z.ZodParsedType.array:t===null?Z.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Z.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?Z.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?Z.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?Z.ZodParsedType.date:Z.ZodParsedType.object;default:return Z.ZodParsedType.unknown}};Z.getParsedType=Du});var Hr=x(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.ZodError=Te.quotelessJson=Te.ZodIssueCode=void 0;var ns=or();Te.ZodIssueCode=ns.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 Lu=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Te.quotelessJson=Lu;var ir=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,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};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,ns.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()}};Te.ZodError=ir;ir.create=t=>new ir(t)});var ro=x(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});var $=Hr(),Ne=or(),Mu=(t,e)=>{let r;switch(t.code){case $.ZodIssueCode.invalid_type:t.received===Ne.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case $.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ne.util.jsonStringifyReplacer)}`;break;case $.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.util.joinValues(t.keys,", ")}`;break;case $.ZodIssueCode.invalid_union:r="Invalid input";break;case $.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.util.joinValues(t.options)}`;break;case $.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.util.joinValues(t.options)}, received '${t.received}'`;break;case $.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case $.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case $.ZodIssueCode.invalid_date:r="Invalid date";break;case $.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}"`:Ne.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case $.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 $.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 $.ZodIssueCode.custom:r="Invalid input";break;case $.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case $.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case $.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ne.util.assertNever(t)}return{message:r}};to.default=Mu});var Wr=x(Se=>{"use strict";var Fu=Se&&Se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Se,"__esModule",{value:!0});Se.defaultErrorMap=void 0;Se.setErrorMap=zu;Se.getErrorMap=qu;var os=Fu(ro());Se.defaultErrorMap=os.default;var is=os.default;function zu(t){is=t}function qu(){return is}});var oo=x(k=>{"use strict";var Vu=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(k,"__esModule",{value:!0});k.isAsync=k.isValid=k.isDirty=k.isAborted=k.OK=k.DIRTY=k.INVALID=k.ParseStatus=k.EMPTY_PATH=k.makeIssue=void 0;k.addIssueToContext=Hu;var $u=Wr(),ss=Vu(ro()),Bu=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="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};k.makeIssue=Bu;k.EMPTY_PATH=[];function Hu(t,e){let r=(0,$u.getErrorMap)(),n=(0,k.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ss.default?void 0:ss.default].filter(o=>!!o)});t.common.issues.push(n)}var no=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 k.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 k.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}}};k.ParseStatus=no;k.INVALID=Object.freeze({status:"aborted"});var Wu=t=>({status:"dirty",value:t});k.DIRTY=Wu;var Ju=t=>({status:"valid",value:t});k.OK=Ju;var Ku=t=>t.status==="aborted";k.isAborted=Ku;var Gu=t=>t.status==="dirty";k.isDirty=Gu;var Yu=t=>t.status==="valid";k.isValid=Yu;var Xu=t=>typeof Promise!="undefined"&&t instanceof Promise;k.isAsync=Xu});var cs=x(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0})});var ds=x(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.errorUtil=void 0;var us;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(us||(Jr.errorUtil=us={}))});var ws=x(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});l.discriminatedUnion=l.date=l.boolean=l.bigint=l.array=l.any=l.coerce=l.ZodFirstPartyTypeKind=l.late=l.ZodSchema=l.Schema=l.ZodReadonly=l.ZodPipeline=l.ZodBranded=l.BRAND=l.ZodNaN=l.ZodCatch=l.ZodDefault=l.ZodNullable=l.ZodOptional=l.ZodTransformer=l.ZodEffects=l.ZodPromise=l.ZodNativeEnum=l.ZodEnum=l.ZodLiteral=l.ZodLazy=l.ZodFunction=l.ZodSet=l.ZodMap=l.ZodRecord=l.ZodTuple=l.ZodIntersection=l.ZodDiscriminatedUnion=l.ZodUnion=l.ZodObject=l.ZodArray=l.ZodVoid=l.ZodNever=l.ZodUnknown=l.ZodAny=l.ZodNull=l.ZodUndefined=l.ZodSymbol=l.ZodDate=l.ZodBoolean=l.ZodBigInt=l.ZodNumber=l.ZodString=l.ZodType=void 0;l.NEVER=l.void=l.unknown=l.union=l.undefined=l.tuple=l.transformer=l.symbol=l.string=l.strictObject=l.set=l.record=l.promise=l.preprocess=l.pipeline=l.ostring=l.optional=l.onumber=l.oboolean=l.object=l.number=l.nullable=l.null=l.never=l.nativeEnum=l.nan=l.map=l.literal=l.lazy=l.intersection=l.instanceof=l.function=l.enum=l.effect=void 0;l.datetimeRegex=hs;l.custom=gs;var h=Hr(),Kr=Wr(),w=ds(),f=oo(),g=or(),ne=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}},ls=(t,e)=>{if((0,f.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 h.ZodError(t.common.issues);return this._error=r,this._error}}};function E(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 u,d;let{message:c}=t;return s.code==="invalid_enum_value"?{message:c!=null?c:a.defaultError}:typeof a.data=="undefined"?{message:(u=c!=null?c:n)!=null?u:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(d=c!=null?c:r)!=null?d:a.defaultError}},description:o}}var P=class{get description(){return this._def.description}_getType(e){return(0,g.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,g.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new f.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,g.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,f.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,g.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return ls(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,g.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,f.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,f.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,g.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,f.isAsync)(o)?o:Promise.resolve(o));return ls(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:h.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!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 ee({schema:this,typeName:I.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 re.create(this,this._def)}nullable(){return pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return be.create(this)}promise(){return Oe.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return $e.create(this,e,this._def)}transform(e){return new ee({...E(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ke({...E(this._def),innerType:this,defaultValue:r,typeName:I.ZodDefault})}brand(){return new sr({typeName:I.ZodBranded,type:this,...E(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ge({...E(this._def),innerType:this,catchValue:r,typeName:I.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ar.create(this,e)}readonly(){return Ye.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};l.ZodType=P;l.Schema=P;l.ZodSchema=P;var Qu=/^c[^\s-]{8,}$/i,ed=/^[0-9a-z]+$/,td=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rd=/^[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,nd=/^[a-z0-9_-]{21}$/i,od=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,id=/^[-+]?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)?)??$/,sd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ad="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",io,cd=/^(?:(?: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])$/,ud=/^(?:(?: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])$/,dd=/^(([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]))$/,ld=/^(([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])$/,fd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ps="((\\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])))",md=new RegExp(`^${ps}$`);function ms(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 hd(t){return new RegExp(`^${ms(t)}$`)}function hs(t){let e=`${ps}T${ms(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 yd(t,e){return!!((e==="v4"||!e)&&cd.test(t)||(e==="v6"||!e)&&dd.test(t))}function gd(t,e){if(!od.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 vd(t,e){return!!((e==="v4"||!e)&&ud.test(t)||(e==="v6"||!e)&&ld.test(t))}var Ie=class t extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(i,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.string,received:i.parsedType}),f.INVALID}let n=new f.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{code:h.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,f.addIssueToContext)(o,{code:h.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,f.addIssueToContext)(o,{code:h.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,f.addIssueToContext)(o,{code:h.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")sd.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"email",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")io||(io=new RegExp(ad,"u")),io.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"emoji",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")rd.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"uuid",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")nd.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"nanoid",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Qu.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"cuid",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")ed.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"cuid2",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")td.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"ulid",code:h.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,f.addIssueToContext)(o,{validation:"url",code:h.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,f.addIssueToContext)(o,{validation:"regex",code:h.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,f.addIssueToContext)(o,{code:h.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,f.addIssueToContext)(o,{code:h.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,f.addIssueToContext)(o,{code:h.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?hs(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{code:h.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?md.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{code:h.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?hd(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{code:h.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?id.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"duration",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?yd(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"ip",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?gd(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"jwt",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?vd(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"cidr",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?fd.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"base64",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?pd.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{validation:"base64url",code:h.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):g.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:h.ZodIssueCode.invalid_string,...w.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.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,...w.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,...w.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...w.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...w.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...w.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...w.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...w.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...w.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...w.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,w.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}};l.ZodString=Ie;Ie.create=t=>{var e;return new Ie({checks:[],typeName:I.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...E(t)})};function bd(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 De=class t extends P{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)!==g.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(i,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.number,received:i.parsedType}),f.INVALID}let n,o=new f.ParseStatus;for(let i of this._def.checks)i.kind==="int"?g.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?bd(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.ZodIssueCode.not_finite,message:i.message}),o.dirty()):g.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,w.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,w.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,w.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,w.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:w.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:w.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:w.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.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"&&g.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)}};l.ZodNumber=De;De.create=t=>new De({checks:[],typeName:I.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});var Le=class t extends P{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)!==g.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new f.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,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):g.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.bigint,received:r.parsedType}),f.INVALID}gte(e,r){return this.setLimit("min",e,!0,w.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,w.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,w.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,w.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:w.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:w.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:w.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}};l.ZodBigInt=Le;Le.create=t=>{var e;return new Le({checks:[],typeName:I.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...E(t)})};var Me=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.boolean,received:n.parsedType}),f.INVALID}return(0,f.OK)(e.data)}};l.ZodBoolean=Me;Me.create=t=>new Me({typeName:I.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});var Fe=class t extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(i,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.date,received:i.parsedType}),f.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(i,{code:h.ZodIssueCode.invalid_date}),f.INVALID}let n=new f.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,f.addIssueToContext)(o,{code:h.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,f.addIssueToContext)(o,{code:h.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):g.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:w.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:w.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}};l.ZodDate=Fe;Fe.create=t=>new Fe({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:I.ZodDate,...E(t)});var ht=class extends P{_parse(e){if(this._getType(e)!==g.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.symbol,received:n.parsedType}),f.INVALID}return(0,f.OK)(e.data)}};l.ZodSymbol=ht;ht.create=t=>new ht({typeName:I.ZodSymbol,...E(t)});var ze=class extends P{_parse(e){if(this._getType(e)!==g.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.undefined,received:n.parsedType}),f.INVALID}return(0,f.OK)(e.data)}};l.ZodUndefined=ze;ze.create=t=>new ze({typeName:I.ZodUndefined,...E(t)});var qe=class extends P{_parse(e){if(this._getType(e)!==g.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.null,received:n.parsedType}),f.INVALID}return(0,f.OK)(e.data)}};l.ZodNull=qe;qe.create=t=>new qe({typeName:I.ZodNull,...E(t)});var Ae=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,f.OK)(e.data)}};l.ZodAny=Ae;Ae.create=t=>new Ae({typeName:I.ZodAny,...E(t)});var ve=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,f.OK)(e.data)}};l.ZodUnknown=ve;ve.create=t=>new ve({typeName:I.ZodUnknown,...E(t)});var ce=class extends P{_parse(e){let r=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.never,received:r.parsedType}),f.INVALID}};l.ZodNever=ce;ce.create=t=>new ce({typeName:I.ZodNever,...E(t)});var yt=class extends P{_parse(e){if(this._getType(e)!==g.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.void,received:n.parsedType}),f.INVALID}return(0,f.OK)(e.data)}};l.ZodVoid=yt;yt.create=t=>new yt({typeName:I.ZodVoid,...E(t)});var be=class t extends P{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==g.ZodParsedType.array)return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.array,received:r.parsedType}),f.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,f.addIssueToContext)(r,{code:s?h.ZodIssueCode.too_big:h.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,f.addIssueToContext)(r,{code:h.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,f.addIssueToContext)(r,{code:h.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 ne(r,s,r.path,a)))).then(s=>f.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new ne(r,s,r.path,a)));return f.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:w.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:w.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:w.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};l.ZodArray=be;be.create=(t,e)=>new be({type:t,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...E(e)});function mt(t){if(t instanceof Y){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=re.create(mt(n))}return new Y({...t._def,shape:()=>e})}else return t instanceof be?new be({...t._def,type:mt(t.element)}):t instanceof re?re.create(mt(t.unwrap())):t instanceof pe?pe.create(mt(t.unwrap())):t instanceof fe?fe.create(t.items.map(e=>mt(e))):t}var Y=class t extends P{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=g.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==g.ZodParsedType.object){let u=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(u,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.object,received:u.parsedType}),f.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ce&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let d=i[u],m=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ne(o,m,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof ce){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&((0,f.addIssueToContext)(o,{code:h.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let m=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ne(o,m,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let m=await d.key,b=await d.value;u.push({key:m,value:b,alwaysSet:d.alwaysSet})}return u}).then(u=>f.ParseStatus.mergeObjectSync(n,u)):f.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return w.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,c;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:(c=w.errorUtil.errToObj(e).message)!=null?c: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:I.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 g.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 g.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return mt(this)}partial(e){let r={};for(let n of g.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 g.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof re;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return ys(g.util.objectKeys(this.shape))}};l.ZodObject=Y;Y.create=(t,e)=>new Y({shape:()=>t,unknownKeys:"strip",catchall:ce.create(),typeName:I.ZodObject,...E(e)});Y.strictCreate=(t,e)=>new Y({shape:()=>t,unknownKeys:"strict",catchall:ce.create(),typeName:I.ZodObject,...E(e)});Y.lazycreate=(t,e)=>new Y({shape:t,unknownKeys:"strip",catchall:ce.create(),typeName:I.ZodObject,...E(e)});var Ve=class extends P{_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 h.ZodError(a.ctx.common.issues));return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_union,unionErrors:s}),f.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 c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new h.ZodError(c));return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_union,unionErrors:a}),f.INVALID}}get options(){return this._def.options}};l.ZodUnion=Ve;Ve.create=(t,e)=>new Ve({options:t,typeName:I.ZodUnion,...E(e)});var ge=t=>t instanceof Be?ge(t.schema):t instanceof ee?ge(t.innerType()):t instanceof He?[t.value]:t instanceof We?t.options:t instanceof Je?g.util.objectValues(t.enum):t instanceof Ke?ge(t._def.innerType):t instanceof ze?[void 0]:t instanceof qe?[null]:t instanceof re?[void 0,...ge(t.unwrap())]:t instanceof pe?[null,...ge(t.unwrap())]:t instanceof sr||t instanceof Ye?ge(t.unwrap()):t instanceof Ge?ge(t._def.innerType):[],Gr=class t extends P{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==g.ZodParsedType.object)return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.object,received:r.parsedType}),f.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,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),f.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=ge(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:I.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...E(n)})}};l.ZodDiscriminatedUnion=Gr;function so(t,e){let r=(0,g.getParsedType)(t),n=(0,g.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===g.ZodParsedType.object&&n===g.ZodParsedType.object){let o=g.util.objectKeys(e),i=g.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let c=so(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===g.ZodParsedType.array&&n===g.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],c=so(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===g.ZodParsedType.date&&n===g.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var $e=class extends P{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,f.isAborted)(i)||(0,f.isAborted)(s))return f.INVALID;let a=so(i.value,s.value);return a.valid?(((0,f.isDirty)(i)||(0,f.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_intersection_types}),f.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}))}};l.ZodIntersection=$e;$e.create=(t,e,r)=>new $e({left:t,right:e,typeName:I.ZodIntersection,...E(r)});var fe=class t extends P{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.ZodParsedType.array)return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.array,received:n.parsedType}),f.INVALID;if(n.data.length<this._def.items.length)return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,f.addIssueToContext)(n,{code:h.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ne(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>f.ParseStatus.mergeArray(r,s)):f.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};l.ZodTuple=fe;fe.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fe({items:t,typeName:I.ZodTuple,rest:null,...E(e)})};var Yr=class t extends P{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!==g.ZodParsedType.object)return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.object,received:n.parsedType}),f.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new ne(n,a,n.path,a)),value:s._parse(new ne(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?f.ParseStatus.mergeObjectAsync(r,o):f.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof P?new t({keyType:e,valueType:r,typeName:I.ZodRecord,...E(n)}):new t({keyType:Ie.create(),valueType:e,typeName:I.ZodRecord,...E(r)})}};l.ZodRecord=Yr;var gt=class extends P{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!==g.ZodParsedType.map)return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.map,received:n.parsedType}),f.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new ne(n,a,n.path,[u,"key"])),value:i._parse(new ne(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return f.INVALID;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return f.INVALID;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};l.ZodMap=gt;gt.create=(t,e,r)=>new gt({valueType:e,keyType:t,typeName:I.ZodMap,...E(r)});var vt=class t extends P{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==g.ZodParsedType.set)return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.set,received:n.parsedType}),f.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,f.addIssueToContext)(n,{code:h.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,f.addIssueToContext)(n,{code:h.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(c){let u=new Set;for(let d of c){if(d.status==="aborted")return f.INVALID;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new ne(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:w.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:w.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};l.ZodSet=vt;vt.create=(t,e)=>new vt({valueType:t,minSize:null,maxSize:null,typeName:I.ZodSet,...E(e)});var Xr=class t extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==g.ZodParsedType.function)return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.function,received:r.parsedType}),f.INVALID;function n(a,c){return(0,f.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Kr.getErrorMap)(),Kr.defaultErrorMap].filter(u=>!!u),issueData:{code:h.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(a,c){return(0,f.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Kr.getErrorMap)(),Kr.defaultErrorMap].filter(u=>!!u),issueData:{code:h.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Oe){let a=this;return(0,f.OK)(async function(...c){let u=new h.ZodError([]),d=await a._def.args.parseAsync(c,i).catch(C=>{throw u.addIssue(n(c,C)),u}),m=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(m,i).catch(C=>{throw u.addIssue(o(m,C)),u})})}else{let a=this;return(0,f.OK)(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new h.ZodError([n(c,u.error)]);let d=Reflect.apply(s,this,u.data),m=a._def.returns.safeParse(d,i);if(!m.success)throw new h.ZodError([o(d,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:fe.create(e).rest(ve.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||fe.create([]).rest(ve.create()),returns:r||ve.create(),typeName:I.ZodFunction,...E(n)})}};l.ZodFunction=Xr;var Be=class extends P{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})}};l.ZodLazy=Be;Be.create=(t,e)=>new Be({getter:t,typeName:I.ZodLazy,...E(e)});var He=class extends P{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(r,{received:r.data,code:h.ZodIssueCode.invalid_literal,expected:this._def.value}),f.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};l.ZodLiteral=He;He.create=(t,e)=>new He({value:t,typeName:I.ZodLiteral,...E(e)});function ys(t,e){return new We({values:t,typeName:I.ZodEnum,...E(e)})}var We=class t extends P{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,f.addIssueToContext)(r,{expected:g.util.joinValues(n),received:r.parsedType,code:h.ZodIssueCode.invalid_type}),f.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,f.addIssueToContext)(r,{received:r.data,code:h.ZodIssueCode.invalid_enum_value,options:n}),f.INVALID}return(0,f.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})}};l.ZodEnum=We;We.create=ys;var Je=class extends P{_parse(e){let r=g.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==g.ZodParsedType.string&&n.parsedType!==g.ZodParsedType.number){let o=g.util.objectValues(r);return(0,f.addIssueToContext)(n,{expected:g.util.joinValues(o),received:n.parsedType,code:h.ZodIssueCode.invalid_type}),f.INVALID}if(this._cache||(this._cache=new Set(g.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=g.util.objectValues(r);return(0,f.addIssueToContext)(n,{received:n.data,code:h.ZodIssueCode.invalid_enum_value,options:o}),f.INVALID}return(0,f.OK)(e.data)}get enum(){return this._def.values}};l.ZodNativeEnum=Je;Je.create=(t,e)=>new Je({values:t,typeName:I.ZodNativeEnum,...E(e)});var Oe=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==g.ZodParsedType.promise&&r.common.async===!1)return(0,f.addIssueToContext)(r,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.promise,received:r.parsedType}),f.INVALID;let n=r.parsedType===g.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,f.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};l.ZodPromise=Oe;Oe.create=(t,e)=>new Oe({type:t,typeName:I.ZodPromise,...E(e)});var ee=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.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,f.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 f.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?f.INVALID:c.status==="dirty"||r.value==="dirty"?(0,f.DIRTY)(c.value):c});{if(r.value==="aborted")return f.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?f.INVALID:a.status==="dirty"||r.value==="dirty"?(0,f.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c 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"?f.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"?f.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,f.isValid)(s))return f.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,f.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):f.INVALID);g.util.assertNever(o)}};l.ZodEffects=ee;l.ZodTransformer=ee;ee.create=(t,e,r)=>new ee({schema:t,typeName:I.ZodEffects,effect:e,...E(r)});ee.createWithPreprocess=(t,e,r)=>new ee({schema:e,effect:{type:"preprocess",transform:t},typeName:I.ZodEffects,...E(r)});var re=class extends P{_parse(e){return this._getType(e)===g.ZodParsedType.undefined?(0,f.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};l.ZodOptional=re;re.create=(t,e)=>new re({innerType:t,typeName:I.ZodOptional,...E(e)});var pe=class extends P{_parse(e){return this._getType(e)===g.ZodParsedType.null?(0,f.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};l.ZodNullable=pe;pe.create=(t,e)=>new pe({innerType:t,typeName:I.ZodNullable,...E(e)});var Ke=class extends P{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===g.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};l.ZodDefault=Ke;Ke.create=(t,e)=>new Ke({innerType:t,typeName:I.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});var Ge=class extends P{_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,f.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new h.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new h.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};l.ZodCatch=Ge;Ge.create=(t,e)=>new Ge({innerType:t,typeName:I.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});var bt=class extends P{_parse(e){if(this._getType(e)!==g.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,f.addIssueToContext)(n,{code:h.ZodIssueCode.invalid_type,expected:g.ZodParsedType.nan,received:n.parsedType}),f.INVALID}return{status:"valid",value:e.data}}};l.ZodNaN=bt;bt.create=t=>new bt({typeName:I.ZodNaN,...E(t)});l.BRAND=Symbol("zod_brand");var sr=class extends P{_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}};l.ZodBranded=sr;var ar=class t extends P{_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"?f.INVALID:i.status==="dirty"?(r.dirty(),(0,f.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"?f.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:I.ZodPipeline})}};l.ZodPipeline=ar;var Ye=class extends P{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,f.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,f.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};l.ZodReadonly=Ye;Ye.create=(t,e)=>new Ye({innerType:t,typeName:I.ZodReadonly,...E(e)});function fs(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function gs(t,e={},r){return t?Ae.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(c=>{var u,d;if(!c){let m=fs(e,n),b=(d=(u=m.fatal)!=null?u:r)!=null?d:!0;o.addIssue({code:"custom",...m,fatal:b})}});if(!i){let c=fs(e,n),u=(a=(s=c.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...c,fatal:u})}}):Ae.create()}l.late={object:Y.lazycreate};var I;(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"})(I||(l.ZodFirstPartyTypeKind=I={}));var _d=(t,e={message:`Input not instance of ${t.name}`})=>gs(r=>r instanceof t,e);l.instanceof=_d;var vs=Ie.create;l.string=vs;var bs=De.create;l.number=bs;var xd=bt.create;l.nan=xd;var wd=Le.create;l.bigint=wd;var _s=Me.create;l.boolean=_s;var Cd=Fe.create;l.date=Cd;var Td=ht.create;l.symbol=Td;var Sd=ze.create;l.undefined=Sd;var Id=qe.create;l.null=Id;var Ad=Ae.create;l.any=Ad;var Od=ve.create;l.unknown=Od;var Ed=ce.create;l.never=Ed;var Pd=yt.create;l.void=Pd;var Rd=be.create;l.array=Rd;var jd=Y.create;l.object=jd;var kd=Y.strictCreate;l.strictObject=kd;var Zd=Ve.create;l.union=Zd;var Ud=Gr.create;l.discriminatedUnion=Ud;var Nd=$e.create;l.intersection=Nd;var Dd=fe.create;l.tuple=Dd;var Ld=Yr.create;l.record=Ld;var Md=gt.create;l.map=Md;var Fd=vt.create;l.set=Fd;var zd=Xr.create;l.function=zd;var qd=Be.create;l.lazy=qd;var Vd=He.create;l.literal=Vd;var $d=We.create;l.enum=$d;var Bd=Je.create;l.nativeEnum=Bd;var Hd=Oe.create;l.promise=Hd;var xs=ee.create;l.effect=xs;l.transformer=xs;var Wd=re.create;l.optional=Wd;var Jd=pe.create;l.nullable=Jd;var Kd=ee.createWithPreprocess;l.preprocess=Kd;var Gd=ar.create;l.pipeline=Gd;var Yd=()=>vs().optional();l.ostring=Yd;var Xd=()=>bs().optional();l.onumber=Xd;var Qd=()=>_s().optional();l.oboolean=Qd;l.coerce={string:(t=>Ie.create({...t,coerce:!0})),number:(t=>De.create({...t,coerce:!0})),boolean:(t=>Me.create({...t,coerce:!0})),bigint:(t=>Le.create({...t,coerce:!0})),date:(t=>Fe.create({...t,coerce:!0}))};l.NEVER=f.INVALID});var ao=x(oe=>{"use strict";var el=oe&&oe.__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]})),_t=oe&&oe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&el(e,t,r)};Object.defineProperty(oe,"__esModule",{value:!0});_t(Wr(),oe);_t(oo(),oe);_t(cs(),oe);_t(or(),oe);_t(ws(),oe);_t(Hr(),oe)});var U=x(X=>{"use strict";var Cs=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]})),tl=X&&X.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),rl=X&&X.__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)&&Cs(e,t,r);return tl(e,t),e},nl=X&&X.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cs(e,t,r)};Object.defineProperty(X,"__esModule",{value:!0});X.z=void 0;var Ts=rl(ao());X.z=Ts;nl(ao(),X);X.default=Ts});var co=x(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.actionTypesZodSchema=xt.ActionTypes=void 0;var ol=U(),Ss;(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"})(Ss||(xt.ActionTypes=Ss={}));xt.actionTypesZodSchema=ol.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var uo=x(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.semanticActionStateTypesZodSchema=wt.SemanticActionStateTypes=void 0;var il=U(),Is;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Is||(wt.SemanticActionStateTypes=Is={}));wt.semanticActionStateTypesZodSchema=il.z.enum(["start","continue","done"])});var lo=x(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.attachmentLayoutTypesZodSchema=Ct.AttachmentLayoutTypes=void 0;var sl=U(),As;(function(t){t.List="list",t.Carousel="carousel"})(As||(Ct.AttachmentLayoutTypes=As={}));Ct.attachmentLayoutTypesZodSchema=sl.z.enum(["list","carousel"])});var fo=x(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.Channels=void 0;var Os;(function(t){t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Os||(Qr.Channels=Os={}))});var po=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.endOfConversationCodesZodSchema=Tt.EndOfConversationCodes=void 0;var al=U(),Es;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Es||(Tt.EndOfConversationCodes=Es={}));Tt.endOfConversationCodesZodSchema=al.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var en=x(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.roleTypeZodSchema=St.RoleTypes=void 0;var cl=U(),Ps;(function(t){t.User="user",t.Agent="bot",t.Skill="skill"})(Ps||(St.RoleTypes=Ps={}));St.roleTypeZodSchema=cl.z.enum(["user","bot","skill"])});var Rs=x(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.addAIToActivity=void 0;var ul=(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)};tn.addAIToActivity=ul});var js=x(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.adaptiveCardInvokeActionZodSchema=void 0;var Xe=U();rn.adaptiveCardInvokeActionZodSchema=Xe.z.object({type:Xe.z.string().min(1),id:Xe.z.string().optional(),verb:Xe.z.string().min(1),data:Xe.z.record(Xe.z.string().min(1),Xe.z.any())})});var ks=x(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Zs=x(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.default="00000000-0000-0000-0000-000000000000"});var Us=x(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});yo.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 cr=x(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var dl=Us();function ll(t){return typeof t=="string"&&dl.default.test(t)}go.default=ll});var ur=x(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var fl=cr();function pl(t){if(!(0,fl.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)}vo.default=pl});var _e=x(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.unsafeStringify=void 0;var ml=cr(),q=[];for(let t=0;t<256;++t)q.push((t+256).toString(16).slice(1));function Ns(t,e=0){return(q[t[e+0]]+q[t[e+1]]+q[t[e+2]]+q[t[e+3]]+"-"+q[t[e+4]]+q[t[e+5]]+"-"+q[t[e+6]]+q[t[e+7]]+"-"+q[t[e+8]]+q[t[e+9]]+"-"+q[t[e+10]]+q[t[e+11]]+q[t[e+12]]+q[t[e+13]]+q[t[e+14]]+q[t[e+15]]).toLowerCase()}dr.unsafeStringify=Ns;function hl(t,e=0){let r=Ns(t,e);if(!(0,ml.default)(r))throw TypeError("Stringified UUID is invalid");return r}dr.default=hl});var nn=x(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});var bo,yl=new Uint8Array(16);function gl(){if(!bo){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");bo=crypto.getRandomValues.bind(crypto)}return bo(yl)}_o.default=gl});var xo=x(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.updateV1State=void 0;var Ds=nn(),vl=_e(),lr={};function bl(t,e,r){var i,s,a,c;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let u=Object.keys(t);u.length===1&&u[0]==="_v6"&&(t=void 0)}if(t)n=Ls((c=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?c:(0,Ds.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let u=Date.now(),d=(0,Ds.default)();Ms(lr,u,d),n=Ls(d,lr.msecs,lr.nsecs,o?void 0:lr.clockseq,o?void 0:lr.node,e,r)}return e!=null?e:(0,vl.unsafeStringify)(n)}function Ms(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}fr.updateV1State=Ms;function Ls(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 c=e/4294967296*1e4&268435455;i[s++]=c>>>8&255,i[s++]=c&255,i[s++]=c>>>24&15|16,i[s++]=c>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let u=0;u<6;++u)i[s++]=o[u];return i}fr.default=bl});var Co=x(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});var _l=ur(),xl=_e();function wl(t){let e=typeof t=="string"?(0,_l.default)(t):t,r=Cl(e);return typeof t=="string"?(0,xl.unsafeStringify)(r):r}wo.default=wl;function Cl(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 zs=x(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});function Tl(t){let e=Al(t),r=Il(e,t.length*8);return Sl(r)}function Sl(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 Fs(t){return(t+64>>>9<<4)+14+1}function Il(t,e){let r=new Uint32Array(Fs(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 c=n,u=o,d=i,m=s;n=B(n,o,i,s,t[a],7,-680876936),s=B(s,n,o,i,t[a+1],12,-389564586),i=B(i,s,n,o,t[a+2],17,606105819),o=B(o,i,s,n,t[a+3],22,-1044525330),n=B(n,o,i,s,t[a+4],7,-176418897),s=B(s,n,o,i,t[a+5],12,1200080426),i=B(i,s,n,o,t[a+6],17,-1473231341),o=B(o,i,s,n,t[a+7],22,-45705983),n=B(n,o,i,s,t[a+8],7,1770035416),s=B(s,n,o,i,t[a+9],12,-1958414417),i=B(i,s,n,o,t[a+10],17,-42063),o=B(o,i,s,n,t[a+11],22,-1990404162),n=B(n,o,i,s,t[a+12],7,1804603682),s=B(s,n,o,i,t[a+13],12,-40341101),i=B(i,s,n,o,t[a+14],17,-1502002290),o=B(o,i,s,n,t[a+15],22,1236535329),n=H(n,o,i,s,t[a+1],5,-165796510),s=H(s,n,o,i,t[a+6],9,-1069501632),i=H(i,s,n,o,t[a+11],14,643717713),o=H(o,i,s,n,t[a],20,-373897302),n=H(n,o,i,s,t[a+5],5,-701558691),s=H(s,n,o,i,t[a+10],9,38016083),i=H(i,s,n,o,t[a+15],14,-660478335),o=H(o,i,s,n,t[a+4],20,-405537848),n=H(n,o,i,s,t[a+9],5,568446438),s=H(s,n,o,i,t[a+14],9,-1019803690),i=H(i,s,n,o,t[a+3],14,-187363961),o=H(o,i,s,n,t[a+8],20,1163531501),n=H(n,o,i,s,t[a+13],5,-1444681467),s=H(s,n,o,i,t[a+2],9,-51403784),i=H(i,s,n,o,t[a+7],14,1735328473),o=H(o,i,s,n,t[a+12],20,-1926607734),n=W(n,o,i,s,t[a+5],4,-378558),s=W(s,n,o,i,t[a+8],11,-2022574463),i=W(i,s,n,o,t[a+11],16,1839030562),o=W(o,i,s,n,t[a+14],23,-35309556),n=W(n,o,i,s,t[a+1],4,-1530992060),s=W(s,n,o,i,t[a+4],11,1272893353),i=W(i,s,n,o,t[a+7],16,-155497632),o=W(o,i,s,n,t[a+10],23,-1094730640),n=W(n,o,i,s,t[a+13],4,681279174),s=W(s,n,o,i,t[a],11,-358537222),i=W(i,s,n,o,t[a+3],16,-722521979),o=W(o,i,s,n,t[a+6],23,76029189),n=W(n,o,i,s,t[a+9],4,-640364487),s=W(s,n,o,i,t[a+12],11,-421815835),i=W(i,s,n,o,t[a+15],16,530742520),o=W(o,i,s,n,t[a+2],23,-995338651),n=J(n,o,i,s,t[a],6,-198630844),s=J(s,n,o,i,t[a+7],10,1126891415),i=J(i,s,n,o,t[a+14],15,-1416354905),o=J(o,i,s,n,t[a+5],21,-57434055),n=J(n,o,i,s,t[a+12],6,1700485571),s=J(s,n,o,i,t[a+3],10,-1894986606),i=J(i,s,n,o,t[a+10],15,-1051523),o=J(o,i,s,n,t[a+1],21,-2054922799),n=J(n,o,i,s,t[a+8],6,1873313359),s=J(s,n,o,i,t[a+15],10,-30611744),i=J(i,s,n,o,t[a+6],15,-1560198380),o=J(o,i,s,n,t[a+13],21,1309151649),n=J(n,o,i,s,t[a+4],6,-145523070),s=J(s,n,o,i,t[a+11],10,-1120210379),i=J(i,s,n,o,t[a+2],15,718787259),o=J(o,i,s,n,t[a+9],21,-343485551),n=Ee(n,c),o=Ee(o,u),i=Ee(i,d),s=Ee(s,m)}return Uint32Array.of(n,o,i,s)}function Al(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(Fs(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 Ee(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Ol(t,e){return t<<e|t>>>32-e}function on(t,e,r,n,o,i){return Ee(Ol(Ee(Ee(e,t),Ee(n,i)),o),r)}function B(t,e,r,n,o,i,s){return on(e&r|~e&n,t,e,o,i,s)}function H(t,e,r,n,o,i,s){return on(e&n|r&~n,t,e,o,i,s)}function W(t,e,r,n,o,i,s){return on(e^r^n,t,e,o,i,s)}function J(t,e,r,n,o,i,s){return on(r^(e|~n),t,e,o,i,s)}To.default=Tl});var pr=x(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.URL=xe.DNS=xe.stringToBytes=void 0;var qs=ur(),El=_e();function Vs(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}xe.stringToBytes=Vs;xe.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";xe.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Pl(t,e,r,n,o,i){let s=typeof r=="string"?Vs(r):r,a=typeof n=="string"?(0,qs.default)(n):n;if(typeof n=="string"&&(n=(0,qs.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(a),c.set(s,a.length),c=e(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,o){i=i||0;for(let u=0;u<16;++u)o[i+u]=c[u];return o}return(0,El.unsafeStringify)(c)}xe.default=Pl});var Bs=x(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.URL=Qe.DNS=void 0;var Rl=zs(),So=pr(),$s=pr();Object.defineProperty(Qe,"DNS",{enumerable:!0,get:function(){return $s.DNS}});Object.defineProperty(Qe,"URL",{enumerable:!0,get:function(){return $s.URL}});function Io(t,e,r,n){return(0,So.default)(48,Rl.default,t,e,r,n)}Io.DNS=So.DNS;Io.URL=So.URL;Qe.default=Io});var Hs=x(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});var jl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);Ao.default={randomUUID:jl}});var Js=x(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});var Ws=Hs(),kl=nn(),Zl=_e();function Ul(t,e,r){var o,i,s;if(Ws.default.randomUUID&&!e&&!t)return Ws.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,kl.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,Zl.unsafeStringify)(n)}Oo.default=Ul});var Ks=x(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});function Nl(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 Eo(t,e){return t<<e|t>>>32-e}function Dl(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 c=new Uint32Array(16);for(let u=0;u<16;++u)c[u]=t[a*64+u*4]<<24|t[a*64+u*4+1]<<16|t[a*64+u*4+2]<<8|t[a*64+u*4+3];s[a]=c}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 c=new Uint32Array(80);for(let y=0;y<16;++y)c[y]=s[a][y];for(let y=16;y<80;++y)c[y]=Eo(c[y-3]^c[y-8]^c[y-14]^c[y-16],1);let u=r[0],d=r[1],m=r[2],b=r[3],C=r[4];for(let y=0;y<80;++y){let v=Math.floor(y/20),_=Eo(u,5)+Nl(v,d,m,b)+C+e[v]+c[y]>>>0;C=b,b=m,m=Eo(d,30)>>>0,d=u,u=_}r[0]=r[0]+u>>>0,r[1]=r[1]+d>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+b>>>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])}Po.default=Dl});var Ys=x(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.URL=et.DNS=void 0;var Ll=Ks(),Ro=pr(),Gs=pr();Object.defineProperty(et,"DNS",{enumerable:!0,get:function(){return Gs.DNS}});Object.defineProperty(et,"URL",{enumerable:!0,get:function(){return Gs.URL}});function jo(t,e,r,n){return(0,Ro.default)(80,Ll.default,t,e,r,n)}jo.DNS=Ro.DNS;jo.URL=Ro.URL;et.default=jo});var Xs=x(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});var Ml=_e(),Fl=xo(),zl=Co();function ql(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,Fl.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,zl.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,Ml.unsafeStringify)(n)}ko.default=ql});var Qs=x(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});var Vl=ur(),$l=_e();function Bl(t){let e=typeof t=="string"?(0,Vl.default)(t):t,r=Hl(e);return typeof t=="string"?(0,$l.unsafeStringify)(r):r}Zo.default=Bl;function Hl(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 na=x(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.updateV7State=void 0;var ea=nn(),Wl=_e(),Uo={};function Jl(t,e,r){var o,i,s;let n;if(t)n=ta((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ea.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),c=(0,ea.default)();ra(Uo,a,c),n=ta(c,Uo.msecs,Uo.seq,e,r)}return e!=null?e:(0,Wl.unsafeStringify)(n)}function ra(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}mr.updateV7State=ra;function ta(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}mr.default=Jl});var oa=x(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});var Kl=cr();function Gl(t){if(!(0,Kl.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}No.default=Gl});var ia=x(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.version=j.validate=j.v7=j.v6ToV1=j.v6=j.v5=j.v4=j.v3=j.v1ToV6=j.v1=j.stringify=j.parse=j.NIL=j.MAX=void 0;var Yl=ks();Object.defineProperty(j,"MAX",{enumerable:!0,get:function(){return Yl.default}});var Xl=Zs();Object.defineProperty(j,"NIL",{enumerable:!0,get:function(){return Xl.default}});var Ql=ur();Object.defineProperty(j,"parse",{enumerable:!0,get:function(){return Ql.default}});var ef=_e();Object.defineProperty(j,"stringify",{enumerable:!0,get:function(){return ef.default}});var tf=xo();Object.defineProperty(j,"v1",{enumerable:!0,get:function(){return tf.default}});var rf=Co();Object.defineProperty(j,"v1ToV6",{enumerable:!0,get:function(){return rf.default}});var nf=Bs();Object.defineProperty(j,"v3",{enumerable:!0,get:function(){return nf.default}});var of=Js();Object.defineProperty(j,"v4",{enumerable:!0,get:function(){return of.default}});var sf=Ys();Object.defineProperty(j,"v5",{enumerable:!0,get:function(){return sf.default}});var af=Xs();Object.defineProperty(j,"v6",{enumerable:!0,get:function(){return af.default}});var cf=Qs();Object.defineProperty(j,"v6ToV1",{enumerable:!0,get:function(){return cf.default}});var uf=na();Object.defineProperty(j,"v7",{enumerable:!0,get:function(){return uf.default}});var df=cr();Object.defineProperty(j,"validate",{enumerable:!0,get:function(){return df.default}});var lf=oa();Object.defineProperty(j,"version",{enumerable:!0,get:function(){return lf.default}})});var Do=x(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.entityZodSchema=void 0;var sa=U();sn.entityZodSchema=sa.z.object({type:sa.z.string().min(1)}).passthrough()});var aa=x(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.semanticActionZodSchema=void 0;var hr=U(),ff=Do(),pf=uo();an.semanticActionZodSchema=hr.z.object({id:hr.z.string().min(1),state:hr.z.union([pf.semanticActionStateTypesZodSchema,hr.z.string().min(1)]),entities:hr.z.record(ff.entityZodSchema)})});var ca=x(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.cardActionZodSchema=void 0;var me=U(),mf=co();cn.cardActionZodSchema=me.z.object({type:me.z.union([mf.actionTypesZodSchema,me.z.string().min(1)]),title:me.z.string().min(1),image:me.z.string().min(1).optional(),text:me.z.string().min(1).optional(),displayText:me.z.string().min(1).optional(),value:me.z.any().optional(),channelData:me.z.unknown().optional(),imageAltText:me.z.string().min(1).optional()})});var ua=x(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.suggestedActionsZodSchema=void 0;var un=U(),hf=ca();dn.suggestedActionsZodSchema=un.z.object({to:un.z.array(un.z.string().min(1)),actions:un.z.array(hf.cardActionZodSchema)})});var Lo=x(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.activityEventNamesZodSchema=It.ActivityEventNames=void 0;var yf=U(),da;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(da||(It.ActivityEventNames=da={}));It.activityEventNamesZodSchema=yf.z.enum(["ContinueConversation","CreateConversation"])});var Mo=x(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.activityImportanceZodSchema=At.ActivityImportance=void 0;var gf=U(),la;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(la||(At.ActivityImportance=la={}));At.activityImportanceZodSchema=gf.z.enum(["low","normal","high"])});var Fo=x(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.activityTypesZodSchema=Ot.ActivityTypes=void 0;var vf=U(),fa;(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",t.Delay="delay"})(fa||(Ot.ActivityTypes=fa={}));Ot.activityTypesZodSchema=vf.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult","delay"])});var pa=x(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.attachmentZodSchema=void 0;var Et=U();ln.attachmentZodSchema=Et.z.object({contentType:Et.z.string().min(1),contentUrl:Et.z.string().min(1).optional(),content:Et.z.unknown().optional(),name:Et.z.string().min(1).optional(),thumbnailUrl:Et.z.string().min(1).optional()})});var zo=x(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.channelAccountZodSchema=void 0;var tt=U(),bf=en();fn.channelAccountZodSchema=tt.z.object({id:tt.z.string().min(1).optional(),name:tt.z.string().optional(),aadObjectId:tt.z.string().min(1).optional(),role:tt.z.union([bf.roleTypeZodSchema,tt.z.string().min(1)]).optional(),properties:tt.z.unknown().optional()})});var qo=x(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.conversationAccountZodSchema=void 0;var he=U(),_f=en();pn.conversationAccountZodSchema=he.z.object({isGroup:he.z.boolean().optional(),conversationType:he.z.string().min(1).optional(),tenantId:he.z.string().min(1).optional(),id:he.z.string().min(1),name:he.z.string().min(1).optional(),aadObjectId:he.z.string().min(1).optional(),role:he.z.union([_f.roleTypeZodSchema,he.z.string().min(1)]).optional(),properties:he.z.unknown().optional()})});var ha=x(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.conversationReferenceZodSchema=void 0;var yr=U(),ma=zo(),xf=qo();mn.conversationReferenceZodSchema=yr.z.object({activityId:yr.z.string().min(1).optional(),user:ma.channelAccountZodSchema.optional(),locale:yr.z.string().min(1).optional(),agent:ma.channelAccountZodSchema.optional().nullable(),conversation:xf.conversationAccountZodSchema,channelId:yr.z.string().min(1),serviceUrl:yr.z.string().min(1).optional()})});var Vo=x(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.deliveryModesZodSchema=Pt.DeliveryModes=void 0;var wf=U(),ya;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(ya||(Pt.DeliveryModes=ya={}));Pt.deliveryModesZodSchema=wf.z.enum(["normal","notification","expectReplies","ephemeral"])});var $o=x(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.inputHintsZodSchema=Rt.InputHints=void 0;var Cf=U(),ga;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(ga||(Rt.InputHints=ga={}));Rt.inputHintsZodSchema=Cf.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var Bo=x(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.messageReactionTypesZodSchema=jt.MessageReactionTypes=void 0;var Tf=U(),va;(function(t){t.Like="like",t.PlusOne="plusOne"})(va||(jt.MessageReactionTypes=va={}));jt.messageReactionTypesZodSchema=Tf.z.enum(["like","plusOne"])});var ba=x(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.messageReactionZodSchema=void 0;var Ho=U(),Sf=Bo();hn.messageReactionZodSchema=Ho.z.object({type:Ho.z.union([Sf.messageReactionTypesZodSchema,Ho.z.string().min(1)])})});var Wo=x(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.textFormatTypesZodSchema=kt.TextFormatTypes=void 0;var If=U(),_a;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(_a||(kt.TextFormatTypes=_a={}));kt.textFormatTypesZodSchema=If.z.enum(["markdown","plain","xml"])});var xa=x(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.textHighlightZodSchema=void 0;var Jo=U();yn.textHighlightZodSchema=Jo.z.object({text:Jo.z.string().min(1),occurrence:Jo.z.number()})});var Sa=x(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.Activity=rt.activityZodSchema=void 0;var Af=ia(),T=U(),Of=aa(),Ef=ua(),Ta=Lo(),Pf=Mo(),vn=Fo(),Rf=pa(),jf=lo(),gn=zo(),wa=fo(),kf=qo(),Zf=ha(),Uf=po(),Nf=Vo(),Df=Do(),Lf=$o(),Ca=ba(),Mf=Wo(),Ff=xa();rt.activityZodSchema=T.z.object({type:T.z.union([vn.activityTypesZodSchema,T.z.string().min(1)]),text:T.z.string().optional(),id:T.z.string().min(1).optional(),channelId:T.z.string().min(1).optional(),from:gn.channelAccountZodSchema.optional(),timestamp:T.z.union([T.z.date(),T.z.string().min(1).datetime().optional(),T.z.string().min(1).transform(t=>new Date(t)).optional()]),localTimestamp:T.z.string().min(1).transform(t=>new Date(t)).optional().or(T.z.date()).optional(),localTimezone:T.z.string().min(1).optional(),callerId:T.z.string().min(1).optional(),serviceUrl:T.z.string().min(1).optional(),conversation:kf.conversationAccountZodSchema.optional(),recipient:gn.channelAccountZodSchema.optional(),textFormat:T.z.union([Mf.textFormatTypesZodSchema,T.z.string().min(1)]).optional(),attachmentLayout:T.z.union([jf.attachmentLayoutTypesZodSchema,T.z.string().min(1)]).optional(),membersAdded:T.z.array(gn.channelAccountZodSchema).optional(),membersRemoved:T.z.array(gn.channelAccountZodSchema).optional(),reactionsAdded:T.z.array(Ca.messageReactionZodSchema).optional(),reactionsRemoved:T.z.array(Ca.messageReactionZodSchema).optional(),topicName:T.z.string().min(1).optional(),historyDisclosed:T.z.boolean().optional(),locale:T.z.string().min(1).optional(),speak:T.z.string().min(1).optional(),inputHint:T.z.union([Lf.inputHintsZodSchema,T.z.string().min(1)]).optional(),summary:T.z.string().min(1).optional(),suggestedActions:Ef.suggestedActionsZodSchema.optional(),attachments:T.z.array(Rf.attachmentZodSchema).optional(),entities:T.z.array(Df.entityZodSchema.passthrough()).optional(),channelData:T.z.any().optional(),action:T.z.string().min(1).optional(),replyToId:T.z.string().min(1).optional(),label:T.z.string().min(1).optional(),valueType:T.z.string().min(1).optional(),value:T.z.unknown().optional(),name:T.z.union([Ta.activityEventNamesZodSchema,T.z.string().min(1)]).optional(),relatesTo:Zf.conversationReferenceZodSchema.optional(),code:T.z.union([Uf.endOfConversationCodesZodSchema,T.z.string().min(1)]).optional(),expiration:T.z.string().min(1).datetime().optional(),importance:T.z.union([Pf.activityImportanceZodSchema,T.z.string().min(1)]).optional(),deliveryMode:T.z.union([Nf.deliveryModesZodSchema,T.z.string().min(1)]).optional(),listenFor:T.z.array(T.z.string().min(1)).optional(),textHighlights:T.z.array(Ff.textHighlightZodSchema).optional(),semanticAction:Of.semanticActionZodSchema.optional()});var Ko=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=rt.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}static getContinuationActivity(e){let r={type:vn.ActivityTypes.Event,name:Ta.ActivityEventNames.ContinueConversation,id:(0,Af.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(r)}getAppropriateReplyToId(){if(this.type!==vn.ActivityTypes.ConversationUpdate||this.channelId!==wa.Channels.Directline&&this.channelId!==wa.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===vn.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),c=e.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),e=c+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(){return JSON.stringify(this)}};rt.Activity=Ko});var Ia=x(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.CallerIdConstants=void 0;bn.CallerIdConstants={PublicAzureChannel:"urn:botframework:azure",USGovChannel:"urn:botframework:azureusgov",AgentPrefix:"urn:botframework:aadappid:"}});var Aa=x(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.activityTreatments=Zt.ActivityTreatments=void 0;var zf=U(),Go;(function(t){t.Targeted="targeted"})(Go||(Zt.ActivityTreatments=Go={}));Zt.activityTreatments=zf.z.nativeEnum(Go)});var Ra=x(O=>{"use strict";var qf=O&&O.__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]})),Oa=O&&O.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qf(e,t,r)};Object.defineProperty(O,"__esModule",{value:!0});O.Logger=O.debug=O.ActivityTreatments=O.TextFormatTypes=O.MessageReactionTypes=O.InputHints=O.DeliveryModes=O.CallerIdConstants=O.ActivityTypes=O.ActivityImportance=O.ActivityEventNames=O.activityZodSchema=O.Activity=O.RoleTypes=O.EndOfConversationCodes=O.Channels=O.AttachmentLayoutTypes=O.SemanticActionStateTypes=O.ActionTypes=void 0;var Vf=co();Object.defineProperty(O,"ActionTypes",{enumerable:!0,get:function(){return Vf.ActionTypes}});var $f=uo();Object.defineProperty(O,"SemanticActionStateTypes",{enumerable:!0,get:function(){return $f.SemanticActionStateTypes}});var Bf=lo();Object.defineProperty(O,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Bf.AttachmentLayoutTypes}});var Hf=fo();Object.defineProperty(O,"Channels",{enumerable:!0,get:function(){return Hf.Channels}});var Wf=po();Object.defineProperty(O,"EndOfConversationCodes",{enumerable:!0,get:function(){return Wf.EndOfConversationCodes}});var Jf=en();Object.defineProperty(O,"RoleTypes",{enumerable:!0,get:function(){return Jf.RoleTypes}});Oa(Rs(),O);Oa(js(),O);var Ea=Sa();Object.defineProperty(O,"Activity",{enumerable:!0,get:function(){return Ea.Activity}});Object.defineProperty(O,"activityZodSchema",{enumerable:!0,get:function(){return Ea.activityZodSchema}});var Kf=Lo();Object.defineProperty(O,"ActivityEventNames",{enumerable:!0,get:function(){return Kf.ActivityEventNames}});var Gf=Mo();Object.defineProperty(O,"ActivityImportance",{enumerable:!0,get:function(){return Gf.ActivityImportance}});var Yf=Fo();Object.defineProperty(O,"ActivityTypes",{enumerable:!0,get:function(){return Yf.ActivityTypes}});var Xf=Ia();Object.defineProperty(O,"CallerIdConstants",{enumerable:!0,get:function(){return Xf.CallerIdConstants}});var Qf=Vo();Object.defineProperty(O,"DeliveryModes",{enumerable:!0,get:function(){return Qf.DeliveryModes}});var ep=$o();Object.defineProperty(O,"InputHints",{enumerable:!0,get:function(){return ep.InputHints}});var tp=Bo();Object.defineProperty(O,"MessageReactionTypes",{enumerable:!0,get:function(){return tp.MessageReactionTypes}});var rp=Wo();Object.defineProperty(O,"TextFormatTypes",{enumerable:!0,get:function(){return rp.TextFormatTypes}});var np=Aa();Object.defineProperty(O,"ActivityTreatments",{enumerable:!0,get:function(){return np.ActivityTreatments}});var Pa=rr();Object.defineProperty(O,"debug",{enumerable:!0,get:function(){return Pa.debug}});Object.defineProperty(O,"Logger",{enumerable:!0,get:function(){return Pa.Logger}})});var zt=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(zt||{});var qt=(S=>(S.Unknown="Unknown",S.Exp="Exp",S.Dev="Dev",S.Test="Test",S.Preprod="Preprod",S.FirstRelease="FirstRelease",S.Prod="Prod",S.Gov="Gov",S.High="High",S.DoD="DoD",S.Mooncake="Mooncake",S.Ex="Ex",S.Rx="Rx",S.Prv="Prv",S.Local="Local",S.GovFR="GovFR",S.Other="Other",S))(qt||{});var On=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},En=class extends On{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(qt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(qt).join(", ")}`);if(!Object.values(zt).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(zt).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},bp=()=>{var t,e,r,n,o,i;return new En({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};function Vt(t,e){return function(){return t.apply(e,arguments)}}var{toString:oc}=Object.prototype,{getPrototypeOf:Rn}=Object,{iterator:Cr,toStringTag:li}=Symbol,Tr=(t=>e=>{let r=oc.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),se=t=>(t=t.toLowerCase(),e=>Tr(e)===t),Sr=t=>e=>typeof e===t,{isArray:ot}=Array,$t=Sr("undefined");function Bt(t){return t!==null&&!$t(t)&&t.constructor!==null&&!$t(t.constructor)&&K(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var fi=se("ArrayBuffer");function ic(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&fi(t.buffer),e}var sc=Sr("string"),K=Sr("function"),pi=Sr("number"),Ht=t=>t!==null&&typeof t=="object",ac=t=>t===!0||t===!1,wr=t=>{if(Tr(t)!=="object")return!1;let e=Rn(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(li in t)&&!(Cr in t)},cc=t=>{if(!Ht(t)||Bt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},uc=se("Date"),dc=se("File"),lc=se("Blob"),fc=se("FileList"),pc=t=>Ht(t)&&K(t.pipe),mc=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||K(t.append)&&((e=Tr(t))==="formdata"||e==="object"&&K(t.toString)&&t.toString()==="[object FormData]"))},hc=se("URLSearchParams"),[yc,gc,vc,bc]=["ReadableStream","Request","Response","Headers"].map(se),_c=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Wt(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t=="undefined")return;let n,o;if(typeof t!="object"&&(t=[t]),ot(t))for(n=0,o=t.length;n<o;n++)e.call(null,t[n],n,t);else{if(Bt(t))return;let i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length,a;for(n=0;n<s;n++)a=i[n],e.call(null,t[a],a,t)}}function mi(t,e){if(Bt(t))return null;e=e.toLowerCase();let r=Object.keys(t),n=r.length,o;for(;n-- >0;)if(o=r[n],e===o.toLowerCase())return o;return null}var ke=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,hi=t=>!$t(t)&&t!==ke;function Pn(){let{caseless:t}=hi(this)&&this||{},e={},r=(n,o)=>{let i=t&&mi(e,o)||o;wr(e[i])&&wr(n)?e[i]=Pn(e[i],n):wr(n)?e[i]=Pn({},n):ot(n)?e[i]=n.slice():e[i]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&Wt(arguments[n],r);return e}var xc=(t,e,r,{allOwnKeys:n}={})=>(Wt(e,(o,i)=>{r&&K(o)?t[i]=Vt(o,r):t[i]=o},{allOwnKeys:n}),t),wc=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Cc=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},Tc=(t,e,r,n)=>{let o,i,s,a={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)s=o[i],(!n||n(s,t,e))&&!a[s]&&(e[s]=t[s],a[s]=!0);t=r!==!1&&Rn(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},Sc=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;let n=t.indexOf(e,r);return n!==-1&&n===r},Ic=t=>{if(!t)return null;if(ot(t))return t;let e=t.length;if(!pi(e))return null;let r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},Ac=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&Rn(Uint8Array)),Oc=(t,e)=>{let n=(t&&t[Cr]).call(t),o;for(;(o=n.next())&&!o.done;){let i=o.value;e.call(t,i[0],i[1])}},Ec=(t,e)=>{let r,n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},Pc=se("HTMLFormElement"),Rc=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,o){return n.toUpperCase()+o}),di=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),jc=se("RegExp"),yi=(t,e)=>{let r=Object.getOwnPropertyDescriptors(t),n={};Wt(r,(o,i)=>{let s;(s=e(o,i,t))!==!1&&(n[i]=s||o)}),Object.defineProperties(t,n)},kc=t=>{yi(t,(e,r)=>{if(K(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=t[r];if(K(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Zc=(t,e)=>{let r={},n=o=>{o.forEach(i=>{r[i]=!0})};return ot(t)?n(t):n(String(t).split(e)),r},Uc=()=>{},Nc=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Dc(t){return!!(t&&K(t.append)&&t[li]==="FormData"&&t[Cr])}var Lc=t=>{let e=new Array(10),r=(n,o)=>{if(Ht(n)){if(e.indexOf(n)>=0)return;if(Bt(n))return n;if(!("toJSON"in n)){e[o]=n;let i=ot(n)?[]:{};return Wt(n,(s,a)=>{let c=r(s,o+1);!$t(c)&&(i[a]=c)}),e[o]=void 0,i}}return n};return r(t,0)},Mc=se("AsyncFunction"),Fc=t=>t&&(Ht(t)||K(t))&&K(t.then)&&K(t.catch),gi=((t,e)=>t?setImmediate:e?((r,n)=>(ke.addEventListener("message",({source:o,data:i})=>{o===ke&&i===r&&n.length&&n.shift()()},!1),o=>{n.push(o),ke.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",K(ke.postMessage)),zc=typeof queueMicrotask!="undefined"?queueMicrotask.bind(ke):typeof process!="undefined"&&process.nextTick||gi,qc=t=>t!=null&&K(t[Cr]),p={isArray:ot,isArrayBuffer:fi,isBuffer:Bt,isFormData:mc,isArrayBufferView:ic,isString:sc,isNumber:pi,isBoolean:ac,isObject:Ht,isPlainObject:wr,isEmptyObject:cc,isReadableStream:yc,isRequest:gc,isResponse:vc,isHeaders:bc,isUndefined:$t,isDate:uc,isFile:dc,isBlob:lc,isRegExp:jc,isFunction:K,isStream:pc,isURLSearchParams:hc,isTypedArray:Ac,isFileList:fc,forEach:Wt,merge:Pn,extend:xc,trim:_c,stripBOM:wc,inherits:Cc,toFlatObject:Tc,kindOf:Tr,kindOfTest:se,endsWith:Sc,toArray:Ic,forEachEntry:Oc,matchAll:Ec,isHTMLForm:Pc,hasOwnProperty:di,hasOwnProp:di,reduceDescriptors:yi,freezeMethods:kc,toObjectSet:Zc,toCamelCase:Rc,noop:Uc,toFiniteNumber:Nc,findKey:mi,global:ke,isContextDefined:hi,isSpecCompliantForm:Dc,toJSONObject:Lc,isAsyncFn:Mc,isThenable:Fc,setImmediate:gi,asap:zc,isIterable:qc};function it(t,e,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}p.inherits(it,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.status}}});var vi=it.prototype,bi={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{bi[t]={value:t}});Object.defineProperties(it,bi);Object.defineProperty(vi,"isAxiosError",{value:!0});it.from=(t,e,r,n,o,i)=>{let s=Object.create(vi);return p.toFlatObject(t,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),it.call(s,t.message,e,r,n,o),s.cause=t,s.name=t.name,i&&Object.assign(s,i),s};var A=it;var Ir=null;function jn(t){return p.isPlainObject(t)||p.isArray(t)}function xi(t){return p.endsWith(t,"[]")?t.slice(0,-2):t}function _i(t,e,r){return t?t.concat(e).map(function(o,i){return o=xi(o),!r&&i?"["+o+"]":o}).join(r?".":""):e}function Vc(t){return p.isArray(t)&&!t.some(jn)}var $c=p.toFlatObject(p,{},null,function(e){return/^is[A-Z]/.test(e)});function Bc(t,e,r){if(!p.isObject(t))throw new TypeError("target must be an object");e=e||new(Ir||FormData),r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!p.isUndefined(_[v])});let n=r.metaTokens,o=r.visitor||d,i=r.dots,s=r.indexes,c=(r.Blob||typeof Blob!="undefined"&&Blob)&&p.isSpecCompliantForm(e);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function u(y){if(y===null)return"";if(p.isDate(y))return y.toISOString();if(p.isBoolean(y))return y.toString();if(!c&&p.isBlob(y))throw new A("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(y)||p.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function d(y,v,_){let S=y;if(y&&!_&&typeof y=="object"){if(p.endsWith(v,"{}"))v=n?v:v.slice(0,-2),y=JSON.stringify(y);else if(p.isArray(y)&&Vc(y)||(p.isFileList(y)||p.endsWith(v,"[]"))&&(S=p.toArray(y)))return v=xi(v),S.forEach(function(N,z){!(p.isUndefined(N)||N===null)&&e.append(s===!0?_i([v],z,i):s===null?v:v+"[]",u(N))}),!1}return jn(y)?!0:(e.append(_i(_,v,i),u(y)),!1)}let m=[],b=Object.assign($c,{defaultVisitor:d,convertValue:u,isVisitable:jn});function C(y,v){if(!p.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+v.join("."));m.push(y),p.forEach(y,function(S,R){(!(p.isUndefined(S)||S===null)&&o.call(e,S,p.isString(R)?R.trim():R,v,b))===!0&&C(S,v?v.concat(R):[R])}),m.pop()}}if(!p.isObject(t))throw new TypeError("data must be an object");return C(t),e}var Ce=Bc;function wi(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function Ci(t,e){this._pairs=[],t&&Ce(t,this,e)}var Ti=Ci.prototype;Ti.append=function(e,r){this._pairs.push([e,r])};Ti.toString=function(e){let r=e?function(n){return e.call(this,n,wi)}:wi;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var Ar=Ci;function Hc(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Jt(t,e,r){if(!e)return t;let n=r&&r.encode||Hc;p.isFunction(r)&&(r={serialize:r});let o=r&&r.serialize,i;if(o?i=o(e,r):i=p.isURLSearchParams(e)?e.toString():new Ar(e,r).toString(n),i){let s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}var kn=class{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){p.forEach(this.handlers,function(n){n!==null&&e(n)})}},Zn=kn;var Or={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Si=typeof URLSearchParams!="undefined"?URLSearchParams:Ar;var Ii=typeof FormData!="undefined"?FormData:null;var Ai=typeof Blob!="undefined"?Blob:null;var Oi={isBrowser:!0,classes:{URLSearchParams:Si,FormData:Ii,Blob:Ai},protocols:["http","https","file","blob","url","data"]};var Dn={};rc(Dn,{hasBrowserEnv:()=>Nn,hasStandardBrowserEnv:()=>Wc,hasStandardBrowserWebWorkerEnv:()=>Jc,navigator:()=>Un,origin:()=>Kc});var Nn=typeof window!="undefined"&&typeof document!="undefined",Un=typeof navigator=="object"&&navigator||void 0,Wc=Nn&&(!Un||["ReactNative","NativeScript","NS"].indexOf(Un.product)<0),Jc=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Kc=Nn&&window.location.href||"http://localhost";var L={...Dn,...Oi};function Ln(t,e){return Ce(t,new L.classes.URLSearchParams,{visitor:function(r,n,o,i){return L.isNode&&p.isBuffer(r)?(this.append(n,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Gc(t){return p.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Yc(t){let e={},r=Object.keys(t),n,o=r.length,i;for(n=0;n<o;n++)i=r[n],e[i]=t[i];return e}function Xc(t){function e(r,n,o,i){let s=r[i++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=i>=r.length;return s=!s&&p.isArray(o)?o.length:s,c?(p.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!a):((!o[s]||!p.isObject(o[s]))&&(o[s]=[]),e(r,n,o[s],i)&&p.isArray(o[s])&&(o[s]=Yc(o[s])),!a)}if(p.isFormData(t)&&p.isFunction(t.entries)){let r={};return p.forEachEntry(t,(n,o)=>{e(Gc(n),o,r,0)}),r}return null}var Er=Xc;function Qc(t,e,r){if(p.isString(t))try{return(e||JSON.parse)(t),p.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Mn={transitional:Or,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){let n=r.getContentType()||"",o=n.indexOf("application/json")>-1,i=p.isObject(e);if(i&&p.isHTMLForm(e)&&(e=new FormData(e)),p.isFormData(e))return o?JSON.stringify(Er(e)):e;if(p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)||p.isReadableStream(e))return e;if(p.isArrayBufferView(e))return e.buffer;if(p.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Ln(e,this.formSerializer).toString();if((a=p.isFileList(e))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Ce(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||o?(r.setContentType("application/json",!1),Qc(e)):e}],transformResponse:[function(e){let r=this.transitional||Mn.transitional,n=r&&r.forcedJSONParsing,o=this.responseType==="json";if(p.isResponse(e)||p.isReadableStream(e))return e;if(e&&p.isString(e)&&(n&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?A.from(a,A.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:L.classes.FormData,Blob:L.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],t=>{Mn.headers[t]={}});var st=Mn;var eu=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ei=t=>{let e={},r,n,o;return t&&t.split(`
|
|
2
|
-
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){let n=new this(e);return r.forEach(o=>n.set(o)),n}static accessor(e){let n=(this[Pi]=this[Pi]={accessors:{}}).accessors,o=this.prototype;function i(s){let a=Kt(s);n[a]||(ou(o,s),n[a]=!0)}return p.isArray(e)?e.forEach(i):i(e),this}};at.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(at.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}});p.freezeMethods(at);var F=at;function Gt(t,e){let r=this||st,n=e||r,o=F.from(n.headers),i=n.data;return p.forEach(t,function(a){i=a.call(r,i,o.normalize(),e?e.status:void 0)}),o.normalize(),i}function Yt(t){return!!(t&&t.__CANCEL__)}function Ri(t,e,r){A.call(this,t==null?"canceled":t,A.ERR_CANCELED,e,r),this.name="CanceledError"}p.inherits(Ri,A,{__CANCEL__:!0});var de=Ri;function Xt(t,e,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new A("Request failed with status code "+r.status,[A.ERR_BAD_REQUEST,A.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function zn(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function iu(t,e){t=t||10;let r=new Array(t),n=new Array(t),o=0,i=0,s;return e=e!==void 0?e:1e3,function(c){let u=Date.now(),d=n[i];s||(s=u),r[o]=c,n[o]=u;let m=i,b=0;for(;m!==o;)b+=r[m++],m=m%t;if(o=(o+1)%t,o===i&&(i=(i+1)%t),u-s<e)return;let C=d&&u-d;return C?Math.round(b*1e3/C):void 0}}var ji=iu;function su(t,e){let r=0,n=1e3/e,o,i,s=(u,d=Date.now())=>{r=d,o=null,i&&(clearTimeout(i),i=null),t(...u)};return[(...u)=>{let d=Date.now(),m=d-r;m>=n?s(u,d):(o=u,i||(i=setTimeout(()=>{i=null,s(o)},n-m)))},()=>o&&s(o)]}var ki=su;var ct=(t,e,r=3)=>{let n=0,o=ji(50,250);return ki(i=>{let s=i.loaded,a=i.lengthComputable?i.total:void 0,c=s-n,u=o(c),d=s<=a;n=s;let m={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-s)/u:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(m)},r)},qn=(t,e)=>{let r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Vn=t=>(...e)=>p.asap(()=>t(...e));var Zi=L.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,L.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(L.origin),L.navigator&&/(msie|trident)/i.test(L.navigator.userAgent)):()=>!0;var Ui=L.hasStandardBrowserEnv?{write(t,e,r,n,o,i){let s=[t+"="+encodeURIComponent(e)];p.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),p.isString(n)&&s.push("path="+n),p.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){let e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $n(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Bn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Qt(t,e,r){let n=!$n(e);return t&&(n||r==!1)?Bn(t,e):e}var Ni=t=>t instanceof F?{...t}:t;function ae(t,e){e=e||{};let r={};function n(u,d,m,b){return p.isPlainObject(u)&&p.isPlainObject(d)?p.merge.call({caseless:b},u,d):p.isPlainObject(d)?p.merge({},d):p.isArray(d)?d.slice():d}function o(u,d,m,b){if(p.isUndefined(d)){if(!p.isUndefined(u))return n(void 0,u,m,b)}else return n(u,d,m,b)}function i(u,d){if(!p.isUndefined(d))return n(void 0,d)}function s(u,d){if(p.isUndefined(d)){if(!p.isUndefined(u))return n(void 0,u)}else return n(void 0,d)}function a(u,d,m){if(m in e)return n(u,d);if(m in t)return n(void 0,u)}let c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,d,m)=>o(Ni(u),Ni(d),m,!0)};return p.forEach(Object.keys({...t,...e}),function(d){let m=c[d]||o,b=m(t[d],e[d],d);p.isUndefined(b)&&m!==a||(r[d]=b)}),r}var Rr=t=>{let e=ae({},t),{data:r,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=e;e.headers=s=F.from(s),e.url=Jt(Qt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(p.isFormData(r)){if(L.hasStandardBrowserEnv||L.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[u,...d]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(L.hasStandardBrowserEnv&&(n&&p.isFunction(n)&&(n=n(e)),n||n!==!1&&Zi(e.url))){let u=o&&i&&Ui.read(i);u&&s.set(o,u)}return e};var au=typeof XMLHttpRequest!="undefined",Di=au&&function(t){return new Promise(function(r,n){let o=Rr(t),i=o.data,s=F.from(o.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:u}=o,d,m,b,C,y;function v(){C&&C(),y&&y(),o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let _=new XMLHttpRequest;_.open(o.method.toUpperCase(),o.url,!0),_.timeout=o.timeout;function S(){if(!_)return;let N=F.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),D={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:N,config:t,request:_};Xt(function(ye){r(ye),v()},function(ye){n(ye),v()},D),_=null}"onloadend"in _?_.onloadend=S:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(S)},_.onabort=function(){_&&(n(new A("Request aborted",A.ECONNABORTED,t,_)),_=null)},_.onerror=function(){n(new A("Network Error",A.ERR_NETWORK,t,_)),_=null},_.ontimeout=function(){let z=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",D=o.transitional||Or;o.timeoutErrorMessage&&(z=o.timeoutErrorMessage),n(new A(z,D.clarifyTimeoutError?A.ETIMEDOUT:A.ECONNABORTED,t,_)),_=null},i===void 0&&s.setContentType(null),"setRequestHeader"in _&&p.forEach(s.toJSON(),function(z,D){_.setRequestHeader(D,z)}),p.isUndefined(o.withCredentials)||(_.withCredentials=!!o.withCredentials),a&&a!=="json"&&(_.responseType=o.responseType),u&&([b,y]=ct(u,!0),_.addEventListener("progress",b)),c&&_.upload&&([m,C]=ct(c),_.upload.addEventListener("progress",m),_.upload.addEventListener("loadend",C)),(o.cancelToken||o.signal)&&(d=N=>{_&&(n(!N||N.type?new de(null,t,_):N),_.abort(),_=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));let R=zn(o.url);if(R&&L.protocols.indexOf(R)===-1){n(new A("Unsupported protocol "+R+":",A.ERR_BAD_REQUEST,t));return}_.send(i||null)})};var cu=(t,e)=>{let{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,o,i=function(u){if(!o){o=!0,a();let d=u instanceof Error?u:this.reason;n.abort(d instanceof A?d:new de(d instanceof Error?d.message:d))}},s=e&&setTimeout(()=>{s=null,i(new A(`timeout ${e} of ms exceeded`,A.ETIMEDOUT))},e),a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),t=null)};t.forEach(u=>u.addEventListener("abort",i));let{signal:c}=n;return c.unsubscribe=()=>p.asap(a),c}},Li=cu;var uu=function*(t,e){let r=t.byteLength;if(!e||r<e){yield t;return}let n=0,o;for(;n<r;)o=n+e,yield t.slice(n,o),n=o},du=async function*(t,e){for await(let r of lu(t))yield*uu(r,e)},lu=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},Hn=(t,e,r,n)=>{let o=du(t,e),i=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:u,value:d}=await o.next();if(u){a(),c.close();return}let m=d.byteLength;if(r){let b=i+=m;r(b)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),o.return()}},{highWaterMark:2})};var kr=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Fi=kr&&typeof ReadableStream=="function",fu=kr&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),zi=(t,...e)=>{try{return!!t(...e)}catch{return!1}},pu=Fi&&zi(()=>{let t=!1,e=new Request(L.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Mi=64*1024,Wn=Fi&&zi(()=>p.isReadableStream(new Response("").body)),jr={stream:Wn&&(t=>t.body)};kr&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!jr[e]&&(jr[e]=p.isFunction(t[e])?r=>r[e]():(r,n)=>{throw new A(`Response type '${e}' is not supported`,A.ERR_NOT_SUPPORT,n)})})})(new Response);var mu=async t=>{if(t==null)return 0;if(p.isBlob(t))return t.size;if(p.isSpecCompliantForm(t))return(await new Request(L.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(p.isArrayBufferView(t)||p.isArrayBuffer(t))return t.byteLength;if(p.isURLSearchParams(t)&&(t=t+""),p.isString(t))return(await fu(t)).byteLength},hu=async(t,e)=>{let r=p.toFiniteNumber(t.getContentLength());return r==null?mu(e):r},qi=kr&&(async t=>{let{url:e,method:r,data:n,signal:o,cancelToken:i,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:d,withCredentials:m="same-origin",fetchOptions:b}=Rr(t);u=u?(u+"").toLowerCase():"text";let C=Li([o,i&&i.toAbortSignal()],s),y,v=C&&C.unsubscribe&&(()=>{C.unsubscribe()}),_;try{if(c&&pu&&r!=="get"&&r!=="head"&&(_=await hu(d,n))!==0){let D=new Request(e,{method:"POST",body:n,duplex:"half"}),te;if(p.isFormData(n)&&(te=D.headers.get("content-type"))&&d.setContentType(te),D.body){let[ye,je]=qn(_,ct(Vn(c)));n=Hn(D.body,Mi,ye,je)}}p.isString(m)||(m=m?"include":"omit");let S="credentials"in Request.prototype;y=new Request(e,{...b,signal:C,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:S?m:void 0});let R=await fetch(y,b),N=Wn&&(u==="stream"||u==="response");if(Wn&&(a||N&&v)){let D={};["status","statusText","headers"].forEach(_r=>{D[_r]=R[_r]});let te=p.toFiniteNumber(R.headers.get("content-length")),[ye,je]=a&&qn(te,ct(Vn(a),!0))||[];R=new Response(Hn(R.body,Mi,ye,()=>{je&&je(),v&&v()}),D)}u=u||"text";let z=await jr[p.findKey(jr,u)||"text"](R,t);return!N&&v&&v(),await new Promise((D,te)=>{Xt(D,te,{data:z,headers:F.from(R.headers),status:R.status,statusText:R.statusText,config:t,request:y})})}catch(S){throw v&&v(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new A("Network Error",A.ERR_NETWORK,t,y),{cause:S.cause||S}):A.from(S,S&&S.code,t,y)}});var Jn={http:Ir,xhr:Di,fetch:qi};p.forEach(Jn,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var Vi=t=>`- ${t}`,yu=t=>p.isFunction(t)||t===null||t===!1,Zr={getAdapter:t=>{t=p.isArray(t)?t:[t];let{length:e}=t,r,n,o={};for(let i=0;i<e;i++){r=t[i];let s;if(n=r,!yu(r)&&(n=Jn[(s=String(r)).toLowerCase()],n===void 0))throw new A(`Unknown adapter '${s}'`);if(n)break;o[s||"#"+i]=n}if(!n){let i=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=e?i.length>1?`since :
|
|
4
|
-
|
|
5
|
-
`):" "+Vi(i[0]):"as no adapter specified";throw new A("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:Jn};function Kn(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new de(null,t)}function Ur(t){return Kn(t),t.headers=F.from(t.headers),t.data=Gt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Zr.getAdapter(t.adapter||st.adapter)(t).then(function(n){return Kn(t),n.data=Gt.call(t,t.transformResponse,n),n.headers=F.from(n.headers),n},function(n){return Yt(n)||(Kn(t),n&&n.response&&(n.response.data=Gt.call(t,t.transformResponse,n.response),n.response.headers=F.from(n.response.headers))),Promise.reject(n)})}var Nr="1.11.0";var Dr={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Dr[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var $i={};Dr.transitional=function(e,r,n){function o(i,s){return"[Axios v"+Nr+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return(i,s,a)=>{if(e===!1)throw new A(o(s," has been removed"+(r?" in "+r:"")),A.ERR_DEPRECATED);return r&&!$i[s]&&($i[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,s,a):!0}};Dr.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function gu(t,e,r){if(typeof t!="object")throw new A("options must be an object",A.ERR_BAD_OPTION_VALUE);let n=Object.keys(t),o=n.length;for(;o-- >0;){let i=n[o],s=e[i];if(s){let a=t[i],c=a===void 0||s(a,i,t);if(c!==!0)throw new A("option "+i+" must be "+c,A.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new A("Unknown option "+i,A.ERR_BAD_OPTION)}}var er={assertOptions:gu,validators:Dr};var le=er.validators,ut=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Zn,response:new Zn}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;let i=o.stack?o.stack.replace(/^.+\n/,""):"";try{n.stack?i&&!String(n.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
6
|
-
`+i):n.stack=i}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ae(this.defaults,r);let{transitional:n,paramsSerializer:o,headers:i}=r;n!==void 0&&er.assertOptions(n,{silentJSONParsing:le.transitional(le.boolean),forcedJSONParsing:le.transitional(le.boolean),clarifyTimeoutError:le.transitional(le.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:er.assertOptions(o,{encode:le.function,serialize:le.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),er.assertOptions(r,{baseUrl:le.spelling("baseURL"),withXsrfToken:le.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),r.headers=F.concat(s,i);let a=[],c=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(r)===!1||(c=c&&v.synchronous,a.unshift(v.fulfilled,v.rejected))});let u=[];this.interceptors.response.forEach(function(v){u.push(v.fulfilled,v.rejected)});let d,m=0,b;if(!c){let y=[Ur.bind(this),void 0];for(y.unshift(...a),y.push(...u),b=y.length,d=Promise.resolve(r);m<b;)d=d.then(y[m++],y[m++]);return d}b=a.length;let C=r;for(m=0;m<b;){let y=a[m++],v=a[m++];try{C=y(C)}catch(_){v.call(this,_);break}}try{d=Ur.call(this,C)}catch(y){return Promise.reject(y)}for(m=0,b=u.length;m<b;)d=d.then(u[m++],u[m++]);return d}getUri(e){e=ae(this.defaults,e);let r=Qt(e.baseURL,e.url,e.allowAbsoluteUrls);return Jt(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){ut.prototype[e]=function(r,n){return this.request(ae(n||{},{method:e,url:r,data:(n||{}).data}))}});p.forEach(["post","put","patch"],function(e){function r(n){return function(i,s,a){return this.request(ae(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}ut.prototype[e]=r(),ut.prototype[e+"Form"]=r(!0)});var tr=ut;var Gn=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});let n=this;this.promise.then(o=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](o);n._listeners=null}),this.promise.then=o=>{let i,s=new Promise(a=>{n.subscribe(a),i=a}).then(o);return s.cancel=function(){n.unsubscribe(i)},s},e(function(i,s,a){n.reason||(n.reason=new de(i,s,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(o){e=o}),cancel:e}}},Bi=Gn;function Yn(t){return function(r){return t.apply(null,r)}}function Xn(t){return p.isObject(t)&&t.isAxiosError===!0}var Qn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Qn).forEach(([t,e])=>{Qn[e]=t});var Hi=Qn;function Wi(t){let e=new tr(t),r=Vt(tr.prototype.request,e);return p.extend(r,tr.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(o){return Wi(ae(t,o))},r}var M=Wi(st);M.Axios=tr;M.CanceledError=de;M.CancelToken=Bi;M.isCancel=Yt;M.VERSION=Nr;M.toFormData=Ce;M.AxiosError=A;M.Cancel=M.CanceledError;M.all=function(e){return Promise.all(e)};M.spread=Yn;M.isAxiosError=Xn;M.mergeConfig=ae;M.AxiosHeaders=F;M.formToJSON=t=>Er(p.isHTMLForm(t)?new FormData(t):t);M.getAdapter=Zr.getAdapter;M.HttpStatusCode=Hi;M.default=M;var Lr=M;var{Axios:wy,AxiosError:Cy,CanceledError:Ty,isCancel:Sy,CancelToken:Iy,VERSION:Ay,all:Oy,Cancel:Ey,isAxiosError:Py,spread:Ry,toFormData:jy,AxiosHeaders:ky,HttpStatusCode:Zy,formToJSON:Uy,getAdapter:Ny,mergeConfig:Dy}=Lr;var es=xr(rr());var qr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var Vr=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 pt=(0,es.debug)("copilot-studio:power-platform");function Br(t,e){var a,c,u,d,m,b;if((a=t.directConnectUrl)!=null&&a.trim()){if(pt.debug(`Using direct connection: ${t.directConnectUrl}`),!nr(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(pt.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),Br({...t,directConnectUrl:""},e)):Zu(t.directConnectUrl,e).href}let r=(c=t.cloud)!=null?c:"Prod",n=(u=t.copilotAgentType)!=null?u:"Published";if(pt.debug(`Using cloud setting: ${r}`),pt.debug(`Using agent type: ${n}`),!((d=t.environmentId)!=null&&d.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((b=t.customPowerPlatformCloud)!=null&&b.trim())if(nr(t.customPowerPlatformCloud))pt.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=Uu(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new Vr({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new qr({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return pt.debug(`Generated Copilot Studio connection URL: ${s}`),s}function ts(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&&nr(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&nr(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://${$r(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&nr(n)){if(Qi(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://${$r(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${$r(Qi(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function nr(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function Zu(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 Uu(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=Nu(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${$r(t,r)}`)}function $r(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 Nu(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Qi(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 gr=xr(Ra());var _n=class{constructor(e){this.activity=e}};var Za=xr(rr());var ja="1.1.0-alpha.5";var xn={};var Q=(0,Za.debug)("copilot-studio:client"),we=class we{constructor(e,r){this.conversationId="";this.settings=e,this.client=Lr.create(),this.client.defaults.headers.common.Authorization=`Bearer ${r}`,this.client.defaults.headers.common["User-Agent"]=we.getProductInfo()}async postRequestAsync(e){var m,b,C,y;let r=[];Q.debug(`>>> SEND TO ${e.url}`);let n=await this.client(e);if(this.settings.useExperimentalEndpoint&&!((m=this.settings.directConnectUrl)!=null&&m.trim())){let v=(b=n.headers)==null?void 0:b[we.islandExperimentalUrlHeaderKey];v&&(this.settings.directConnectUrl=v,Q.debug(`Island Experimental URL: ${v}`))}this.conversationId=(y=(C=n.headers)==null?void 0:C[we.conversationIdHeaderKey])!=null?y:"",this.conversationId&&Q.debug(`Conversation ID: ${this.conversationId}`);let o={...n.headers};delete o.Authorization,delete o[we.conversationIdHeaderKey],Q.debug("Headers received:",o);let s=n.data.pipeThrough(new TextDecoderStream).getReader(),a="",c=[],u=async({done:v,value:_})=>v?(Q.debug("Stream complete"),a+=_,c.push(a),c):(Q.info("Agent is typing ..."),a+=_,await u(await s.read()));return(await s.read().then(u)).forEach(v=>{v.toString().split(`
|
|
7
|
-
`).filter(R=>R.substring(0,4)==="data"&&R!=="data: end\r").forEach(R=>{var N,z;try{let D=gr.Activity.fromJson(R.substring(5,R.length));D.type===gr.ActivityTypes.Message?(r.push(D),this.conversationId.trim()||(this.conversationId=(z=(N=D.conversation)==null?void 0:N.id)!=null?z:"",Q.debug(`Conversation ID: ${this.conversationId}`))):Q.debug(`Activity type: ${D.type}`)}catch(D){throw Q.error("Error: ",D),D}})}),r}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${ja}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${xn.platform()}-${xn.arch()}/${xn.release()}`,Q.debug(`User-Agent: ${r}`),r}async startConversationAsync(e=!0){var a;let o={method:"post",url:Br(this.settings),headers:{Accept:"text/event-stream","Content-Type":"application/json"},data:{emitStartConversationEvent:e},responseType:"stream",adapter:"fetch"};Q.info("Starting conversation ...");let i=await this.postRequestAsync(o),s=i[0];return Q.info(`Conversation '${(a=s.conversation)==null?void 0:a.id}' started. Received ${i.length} activities.`,i),s}async askQuestionAsync(e,r=this.conversationId){let o={type:"message",text:e,conversation:{id:r}},i=gr.Activity.fromObject(o);return this.sendActivity(i)}async sendActivity(e,r=this.conversationId){var c,u;let n=(u=(c=e.conversation)==null?void 0:c.id)!=null?u:r,o=Br(this.settings,n),i=new _n(e),s={method:"post",url:o,headers:{Accept:"text/event-stream","Content-Type":"application/json"},data:i,responseType:"stream",adapter:"fetch"};Q.info("Sending activity...",e);let a=await this.postRequestAsync(s);return Q.info(`Received ${a.length} activities.`,a),a}};we.conversationIdHeaderKey="x-ms-conversationid",we.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",we.scopeFromSettings=ts;var ka=we;var V=[];for(let t=0;t<256;++t)V.push((t+256).toString(16).slice(1));function Ua(t,e=0){return(V[t[e+0]]+V[t[e+1]]+V[t[e+2]]+V[t[e+3]]+"-"+V[t[e+4]]+V[t[e+5]]+"-"+V[t[e+6]]+V[t[e+7]]+"-"+V[t[e+8]]+V[t[e+9]]+"-"+V[t[e+10]]+V[t[e+11]]+V[t[e+12]]+V[t[e+13]]+V[t[e+14]]+V[t[e+15]]).toLowerCase()}var Yo,ip=new Uint8Array(16);function Xo(){if(!Yo){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yo=crypto.getRandomValues.bind(crypto)}return Yo(ip)}var sp=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Qo={randomUUID:sp};function ap(t,e,r){var o,i,s;if(Qo.randomUUID&&!e&&!t)return Qo.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Xo();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 Ua(n)}var ei=ap;var ti=function(t,e){return ti=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])},ti(t,e)};function Pe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ti(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function vr(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 Ut(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 Nt(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 ie(t){return typeof t=="function"}function wn(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 Cn=wn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
1
|
+
var Os=Object.create;var uo=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Zs=Object.getOwnPropertyNames;var js=Object.getPrototypeOf,ks=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Es=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Zs(e))!ks.call(t,o)&&o!==r&&uo(t,o,{get:()=>e[o],enumerable:!(n=Ps(e,o))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?Os(js(t)):{},Es(e||!t||!t.__esModule?uo(r,"default",{value:t,enumerable:!0}):r,t));var mo=y((tl,ho)=>{var Je=1e3,Ye=Je*60,Xe=Ye*60,Te=Xe*24,qs=Te*7,Fs=Te*365.25;ho.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Vs(t);if(r==="number"&&isFinite(t))return e.long?Ws(t):$s(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Vs(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Fs;case"weeks":case"week":case"w":return r*qs;case"days":case"day":case"d":return r*Te;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Xe;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ye;case"seconds":case"second":case"secs":case"sec":case"s":return r*Je;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function $s(t){var e=Math.abs(t);return e>=Te?Math.round(t/Te)+"d":e>=Xe?Math.round(t/Xe)+"h":e>=Ye?Math.round(t/Ye)+"m":e>=Je?Math.round(t/Je)+"s":t+"ms"}function Ws(t){var e=Math.abs(t);return e>=Te?nr(t,e,Te,"day"):e>=Xe?nr(t,e,Xe,"hour"):e>=Ye?nr(t,e,Ye,"minute"):e>=Je?nr(t,e,Je,"second"):t+" ms"}function nr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var vo=y((rl,yo)=>{function Hs(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=mo(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let m=0;for(let _=0;_<f.length;_++)m=(m<<5)-m+f.charCodeAt(_),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=e;function r(f){let m,_=null,T,O;function g(...S){if(!g.enabled)return;let A=g,q=Number(new Date),te=q-(m||q);A.diff=te,A.prev=m,A.curr=q,m=q,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let ye=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(re,Pt)=>{if(re==="%%")return"%";ye++;let Zt=r.formatters[Pt];if(typeof Zt=="function"){let $r=S[ye];re=Zt.call(A,$r),S.splice(ye,1),ye--}return re}),r.formatArgs.call(A,S),(A.log||r.log).apply(A,S)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(T!==r.namespaces&&(T=r.namespaces,O=r.enabled(f)),O),set:S=>{_=S}}),typeof r.init=="function"&&r.init(g),g}function n(f,m){let _=r(this.namespace+(typeof m=="undefined"?":":m)+f);return _.log=this.log,_}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let m=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of m)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function i(f,m){let _=0,T=0,O=-1,g=0;for(;_<f.length;)if(T<m.length&&(m[T]===f[_]||m[T]==="*"))m[T]==="*"?(O=T,g=_,T++):(_++,T++);else if(O!==-1)T=O+1,g++,_=g;else return!1;for(;T<m.length&&m[T]==="*";)T++;return T===m.length}function s(){let f=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),f}function a(f){for(let m of r.skips)if(i(f,m))return!1;for(let m of r.names)if(i(f,m))return!0;return!1}function d(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}yo.exports=Hs});var go=y((V,or)=>{V.formatArgs=Ks;V.save=Gs;V.load=Js;V.useColors=Bs;V.storage=Ys();V.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Bs(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ks(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+or.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}V.log=console.debug||console.log||(()=>{});function Gs(t){try{t?V.storage.setItem("debug",t):V.storage.removeItem("debug")}catch{}}function Js(){let t;try{t=V.storage.getItem("debug")||V.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ys(){try{return localStorage}catch{}}or.exports=vo()(V);var{formatters:Xs}=or.exports;Xs.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(Se=>{"use strict";var Qs=Se&&Se.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Se,"__esModule",{value:!0});Se.Logger=void 0;Se.debug=ra;var ea=Qs(go()),ta=["info","warn","error","debug"],ir=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of ta){let n=(0,ea.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};Se.Logger=ir;function ra(t){return new ir(t)}});var Dt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Gr;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},t.find=(o,i)=>{for(let s of o)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Gr||(k.util=Gr={}));var wo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(wo||(k.objectUtil=wo={}));k.ZodParsedType=Gr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var sa=t=>{switch(typeof t){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return Number.isNaN(t)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(t)?k.ZodParsedType.array:t===null?k.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?k.ZodParsedType.promise:typeof Map!="undefined"&&t instanceof Map?k.ZodParsedType.map:typeof Set!="undefined"&&t instanceof Set?k.ZodParsedType.set:typeof Date!="undefined"&&t instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=sa});var dr=y(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.ZodError=ve.quotelessJson=ve.ZodIssueCode=void 0;var Co=Dt();ve.ZodIssueCode=Co.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var aa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ve.quotelessJson=aa;var zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,d=0;for(;d<s.path.length;){let l=s.path[d];d===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Co.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ve.ZodError=zt;zt.create=t=>new zt(t)});var Yr=y(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var M=dr(),Ae=Dt(),ca=(t,e)=>{let r;switch(t.code){case M.ZodIssueCode.invalid_type:t.received===Ae.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case M.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.util.jsonStringifyReplacer)}`;break;case M.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ae.util.joinValues(t.keys,", ")}`;break;case M.ZodIssueCode.invalid_union:r="Invalid input";break;case M.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ae.util.joinValues(t.options)}`;break;case M.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ae.util.joinValues(t.options)}, received '${t.received}'`;break;case M.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case M.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case M.ZodIssueCode.invalid_date:r="Invalid date";break;case M.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ae.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case M.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case M.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case M.ZodIssueCode.custom:r="Invalid input";break;case M.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case M.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case M.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ae.util.assertNever(t)}return{message:r}};Jr.default=ca});var lr=y(ge=>{"use strict";var ua=ge&&ge.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ge,"__esModule",{value:!0});ge.defaultErrorMap=void 0;ge.setErrorMap=da;ge.getErrorMap=la;var Io=ua(Yr());ge.defaultErrorMap=Io.default;var To=Io.default;function da(t){To=t}function la(){return To}});var Qr=y(Z=>{"use strict";var fa=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Z,"__esModule",{value:!0});Z.isAsync=Z.isValid=Z.isDirty=Z.isAborted=Z.OK=Z.DIRTY=Z.INVALID=Z.ParseStatus=Z.EMPTY_PATH=Z.makeIssue=void 0;Z.addIssueToContext=ma;var pa=lr(),So=fa(Yr()),ha=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",d=n.filter(l=>!!l).slice().reverse();for(let l of d)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};Z.makeIssue=ha;Z.EMPTY_PATH=[];function ma(t,e){let r=(0,pa.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===So.default?void 0:So.default].filter(o=>!!o)});t.common.issues.push(n)}var Xr=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Z.INVALID;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Z.INVALID;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}};Z.ParseStatus=Xr;Z.INVALID=Object.freeze({status:"aborted"});var ya=t=>({status:"dirty",value:t});Z.DIRTY=ya;var va=t=>({status:"valid",value:t});Z.OK=va;var ga=t=>t.status==="aborted";Z.isAborted=ga;var _a=t=>t.status==="dirty";Z.isDirty=_a;var ba=t=>t.status==="valid";Z.isValid=ba;var xa=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=xa});var Oo=y(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0})});var Zo=y(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.errorUtil=void 0;var Po;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Po||(fr.errorUtil=Po={}))});var Fo=y(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.discriminatedUnion=c.date=c.boolean=c.bigint=c.array=c.any=c.coerce=c.ZodFirstPartyTypeKind=c.late=c.ZodSchema=c.Schema=c.ZodReadonly=c.ZodPipeline=c.ZodBranded=c.BRAND=c.ZodNaN=c.ZodCatch=c.ZodDefault=c.ZodNullable=c.ZodOptional=c.ZodTransformer=c.ZodEffects=c.ZodPromise=c.ZodNativeEnum=c.ZodEnum=c.ZodLiteral=c.ZodLazy=c.ZodFunction=c.ZodSet=c.ZodMap=c.ZodRecord=c.ZodTuple=c.ZodIntersection=c.ZodDiscriminatedUnion=c.ZodUnion=c.ZodObject=c.ZodArray=c.ZodVoid=c.ZodNever=c.ZodUnknown=c.ZodAny=c.ZodNull=c.ZodUndefined=c.ZodSymbol=c.ZodDate=c.ZodBoolean=c.ZodBigInt=c.ZodNumber=c.ZodString=c.ZodType=void 0;c.NEVER=c.void=c.unknown=c.union=c.undefined=c.tuple=c.transformer=c.symbol=c.string=c.strictObject=c.set=c.record=c.promise=c.preprocess=c.pipeline=c.ostring=c.optional=c.onumber=c.oboolean=c.object=c.number=c.nullable=c.null=c.never=c.nativeEnum=c.nan=c.map=c.literal=c.lazy=c.intersection=c.instanceof=c.function=c.enum=c.effect=void 0;c.datetimeRegex=Ro;c.custom=No;var p=dr(),pr=lr(),v=Zo(),u=Qr(),h=Dt(),K=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},jo=(t,e)=>{if((0,u.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new p.ZodError(t.common.issues);return this._error=r,this._error}}};function C(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{var l,f;let{message:d}=t;return s.code==="invalid_enum_value"?{message:d!=null?d:a.defaultError}:typeof a.data=="undefined"?{message:(l=d!=null?d:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(f=d!=null?d:r)!=null?f:a.defaultError}},description:o}}var I=class{get description(){return this._def.description}_getType(e){return(0,h.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,u.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var i;let n={common:{issues:[],async:(i=r==null?void 0:r.async)!=null?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return jo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(o=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>(0,u.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,h.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return jo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new H({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return B.create(this,this._def)}nullable(){return se.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return xe.create(this,this._def)}or(e){return Ue.create([this,e],this._def)}and(e){return Re.create(this,e,this._def)}transform(e){return new H({...C(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Le({...C(this._def),innerType:this,defaultValue:r,typeName:w.ZodDefault})}brand(){return new Lt({typeName:w.ZodBranded,type:this,...C(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new qe({...C(this._def),innerType:this,catchValue:r,typeName:w.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return qt.create(this,e)}readonly(){return Fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=I;c.Schema=I;c.ZodSchema=I;var wa=/^c[^\s-]{8,}$/i,Ca=/^[0-9a-z]+$/,Ia=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ta=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Sa=/^[a-z0-9_-]{21}$/i,Aa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Oa=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Za="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",en,ja=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ka=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ea=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ua=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ra=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ma=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Eo="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Na=new RegExp(`^${Eo}$`);function Uo(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Da(t){return new RegExp(`^${Uo(t)}$`)}function Ro(t){let e=`${Eo}T${Uo(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function za(t,e){return!!((e==="v4"||!e)&&ja.test(t)||(e==="v6"||!e)&&Ea.test(t))}function La(t,e){if(!Aa.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function qa(t,e){return!!((e==="v4"||!e)&&ka.test(t)||(e==="v6"||!e)&&Ua.test(t))}var _e=class t extends I{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Pa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"email",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")en||(en=new RegExp(Za,"u")),en.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ta.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Sa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Ca.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Ia.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ro(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Na.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Da(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Oa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?za(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?La(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"jwt",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?qa(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"cidr",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Ra.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Ma.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:p.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodString=_e;_e.create=t=>{var e;return new _e({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};function Fa(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Oe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Fa(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c.ZodNumber=Oe;Oe.create=t=>new Oe({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var Pe=class t extends I{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};c.ZodBigInt=Pe;Pe.create=t=>{var e;return new Pe({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...C(t)})};var Ze=class extends I{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ze;Ze.create=t=>new Ze({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...C(t)});var je=class t extends I{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),u.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_date}),u.INVALID}let n=new u.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{code:p.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};c.ZodDate=je;je.create=t=>new je({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate,...C(t)});var tt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=tt;tt.create=t=>new tt({typeName:w.ZodSymbol,...C(t)});var ke=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=ke;ke.create=t=>new ke({typeName:w.ZodUndefined,...C(t)});var Ee=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=Ee;Ee.create=t=>new Ee({typeName:w.ZodNull,...C(t)});var be=class extends I{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=be;be.create=t=>new be({typeName:w.ZodAny,...C(t)});var de=class extends I{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=de;de.create=t=>new de({typeName:w.ZodUnknown,...C(t)});var X=class extends I{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=X;X.create=t=>new X({typeName:w.ZodNever,...C(t)});var rt=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=rt;rt.create=t=>new rt({typeName:w.ZodVoid,...C(t)});var le=class t extends I{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new K(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new K(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=le;le.create=(t,e)=>new le({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...C(e)});function et(t){if(t instanceof $){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=B.create(et(n))}return new $({...t._def,shape:()=>e})}else return t instanceof le?new le({...t._def,type:et(t.element)}):t instanceof B?B.create(et(t.unwrap())):t instanceof se?se.create(et(t.unwrap())):t instanceof ie?ie.create(t.items.map(e=>et(e))):t}var $=class t extends I{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=h.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],m=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new K(o,m,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof X){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let m=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new K(o,m,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let m=await f.key,_=await f.value;l.push({key:m,value:_,alwaysSet:f.alwaysSet})}return l}).then(l=>u.ParseStatus.mergeObjectSync(n,l)):u.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,d;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(d=v.errorUtil.errToObj(e).message)!=null?d:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of h.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of h.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return et(this)}partial(e){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of h.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof B;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Mo(h.util.objectKeys(this.shape))}};c.ZodObject=$;$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...C(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:X.create(),typeName:w.ZodObject,...C(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...C(e)});var Ue=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Ue;Ue.create=(t,e)=>new Ue({options:t,typeName:w.ZodUnion,...C(e)});var ue=t=>t instanceof Me?ue(t.schema):t instanceof H?ue(t.innerType()):t instanceof Ne?[t.value]:t instanceof De?t.options:t instanceof ze?h.util.objectValues(t.enum):t instanceof Le?ue(t._def.innerType):t instanceof ke?[void 0]:t instanceof Ee?[null]:t instanceof B?[void 0,...ue(t.unwrap())]:t instanceof se?[null,...ue(t.unwrap())]:t instanceof Lt||t instanceof Fe?ue(t.unwrap()):t instanceof qe?ue(t._def.innerType):[],hr=class t extends I{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),u.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=ue(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...C(n)})}};c.ZodDiscriminatedUnion=hr;function tn(t,e){let r=(0,h.getParsedType)(t),n=(0,h.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(e),i=h.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=tn(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let s=t[i],a=e[i],d=tn(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Re=class extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,u.isAborted)(i)||(0,u.isAborted)(s))return u.INVALID;let a=tn(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=Re;Re.create=(t,e,r)=>new Re({left:t,right:e,typeName:w.ZodIntersection,...C(r)});var ie=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new K(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ie;ie.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:t,typeName:w.ZodTuple,rest:null,...C(e)})};var mr=class t extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new K(n,a,n.path,a)),value:s._parse(new K(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof I?new t({keyType:e,valueType:r,typeName:w.ZodRecord,...C(n)}):new t({keyType:_e.create(),valueType:e,typeName:w.ZodRecord,...C(r)})}};c.ZodRecord=mr;var nt=class extends I{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new K(n,a,n.path,[l,"key"])),value:i._parse(new K(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=nt;nt.create=(t,e,r)=>new nt({valueType:e,keyType:t,typeName:w.ZodMap,...C(r)});var ot=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new K(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=ot;ot.create=(t,e)=>new ot({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet,...C(e)});var yr=class t extends I{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),u.INVALID;function n(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function o(a,d){return(0,u.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,pr.getErrorMap)(),pr.defaultErrorMap].filter(l=>!!l),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof xe){let a=this;return(0,u.OK)(async function(...d){let l=new p.ZodError([]),f=await a._def.args.parseAsync(d,i).catch(T=>{throw l.addIssue(n(d,T)),l}),m=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(m,i).catch(T=>{throw l.addIssue(o(m,T)),l})})}else{let a=this;return(0,u.OK)(function(...d){let l=a._def.args.safeParse(d,i);if(!l.success)throw new p.ZodError([n(d,l.error)]);let f=Reflect.apply(s,this,l.data),m=a._def.returns.safeParse(f,i);if(!m.success)throw new p.ZodError([o(f,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ie.create(e).rest(de.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ie.create([]).rest(de.create()),returns:r||de.create(),typeName:w.ZodFunction,...C(n)})}};c.ZodFunction=yr;var Me=class extends I{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};c.ZodLazy=Me;Me.create=(t,e)=>new Me({getter:t,typeName:w.ZodLazy,...C(e)});var Ne=class extends I{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Ne;Ne.create=(t,e)=>new Ne({value:t,typeName:w.ZodLiteral,...C(e)});function Mo(t,e){return new De({values:t,typeName:w.ZodEnum,...C(e)})}var De=class t extends I{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),u.INVALID}return(0,u.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};c.ZodEnum=De;De.create=Mo;var ze=class extends I{_parse(e){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=h.util.objectValues(r);return(0,u.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:o}),u.INVALID}return(0,u.OK)(e.data)}get enum(){return this._def.values}};c.ZodNativeEnum=ze;ze.create=(t,e)=>new ze({values:t,typeName:w.ZodNativeEnum,...C(e)});var xe=class extends I{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,u.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};c.ZodPromise=xe;xe.create=(t,e)=>new xe({type:t,typeName:w.ZodPromise,...C(e)});var H=class extends I{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{(0,u.addIssueToContext)(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return u.INVALID;let d=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return d.status==="aborted"?u.INVALID:d.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(d.value):d});{if(r.value==="aborted")return u.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:a.status==="dirty"||r.value==="dirty"?(0,u.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let d=o.refinement(a,i);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?u.INVALID:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,u.isValid)(s))return u.INVALID;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>(0,u.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):u.INVALID);h.util.assertNever(o)}};c.ZodEffects=H;c.ZodTransformer=H;H.create=(t,e,r)=>new H({schema:t,typeName:w.ZodEffects,effect:e,...C(r)});H.createWithPreprocess=(t,e,r)=>new H({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects,...C(r)});var B=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=B;B.create=(t,e)=>new B({innerType:t,typeName:w.ZodOptional,...C(e)});var se=class extends I{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=se;se.create=(t,e)=>new se({innerType:t,typeName:w.ZodNullable,...C(e)});var Le=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c.ZodDefault=Le;Le.create=(t,e)=>new Le({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...C(e)});var qe=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=qe;qe.create=(t,e)=>new qe({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...C(e)});var it=class extends I{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=it;it.create=t=>new it({typeName:w.ZodNaN,...C(t)});c.BRAND=Symbol("zod_brand");var Lt=class extends I{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};c.ZodBranded=Lt;var qt=class t extends I{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?u.INVALID:i.status==="dirty"?(r.dirty(),(0,u.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?u.INVALID:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:w.ZodPipeline})}};c.ZodPipeline=qt;var Fe=class extends I{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=Fe;Fe.create=(t,e)=>new Fe({innerType:t,typeName:w.ZodReadonly,...C(e)});function ko(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function No(t,e={},r){return t?be.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(d=>{var l,f;if(!d){let m=ko(e,n),_=(f=(l=m.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...m,fatal:_})}});if(!i){let d=ko(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):be.create()}c.late={object:$.lazycreate};var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(w||(c.ZodFirstPartyTypeKind=w={}));var Va=(t,e={message:`Input not instance of ${t.name}`})=>No(r=>r instanceof t,e);c.instanceof=Va;var Do=_e.create;c.string=Do;var zo=Oe.create;c.number=zo;var $a=it.create;c.nan=$a;var Wa=Pe.create;c.bigint=Wa;var Lo=Ze.create;c.boolean=Lo;var Ha=je.create;c.date=Ha;var Ba=tt.create;c.symbol=Ba;var Ka=ke.create;c.undefined=Ka;var Ga=Ee.create;c.null=Ga;var Ja=be.create;c.any=Ja;var Ya=de.create;c.unknown=Ya;var Xa=X.create;c.never=Xa;var Qa=rt.create;c.void=Qa;var ec=le.create;c.array=ec;var tc=$.create;c.object=tc;var rc=$.strictCreate;c.strictObject=rc;var nc=Ue.create;c.union=nc;var oc=hr.create;c.discriminatedUnion=oc;var ic=Re.create;c.intersection=ic;var sc=ie.create;c.tuple=sc;var ac=mr.create;c.record=ac;var cc=nt.create;c.map=cc;var uc=ot.create;c.set=uc;var dc=yr.create;c.function=dc;var lc=Me.create;c.lazy=lc;var fc=Ne.create;c.literal=fc;var pc=De.create;c.enum=pc;var hc=ze.create;c.nativeEnum=hc;var mc=xe.create;c.promise=mc;var qo=H.create;c.effect=qo;c.transformer=qo;var yc=B.create;c.optional=yc;var vc=se.create;c.nullable=vc;var gc=H.createWithPreprocess;c.preprocess=gc;var _c=qt.create;c.pipeline=_c;var bc=()=>Do().optional();c.ostring=bc;var xc=()=>zo().optional();c.onumber=xc;var wc=()=>Lo().optional();c.oboolean=wc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>Oe.create({...t,coerce:!0})),boolean:(t=>Ze.create({...t,coerce:!0})),bigint:(t=>Pe.create({...t,coerce:!0})),date:(t=>je.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var rn=y(G=>{"use strict";var Cc=G&&G.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),st=G&&G.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cc(e,t,r)};Object.defineProperty(G,"__esModule",{value:!0});st(lr(),G);st(Qr(),G);st(Oo(),G);st(Dt(),G);st(Fo(),G);st(dr(),G)});var j=y(W=>{"use strict";var Vo=W&&W.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Ic=W&&W.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Tc=W&&W.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Vo(e,t,r);return Ic(e,t),e},Sc=W&&W.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Vo(e,t,r)};Object.defineProperty(W,"__esModule",{value:!0});W.z=void 0;var $o=Tc(rn());W.z=$o;Sc(rn(),W);W.default=$o});var nn=y(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.actionTypesZodSchema=at.ActionTypes=void 0;var Ac=j(),Wo;(function(t){t.OpenUrl="openUrl",t.ImBack="imBack",t.PostBack="postBack",t.PlayAudio="playAudio",t.PlayVideo="playVideo",t.ShowImage="showImage",t.DownloadFile="downloadFile",t.Signin="signin",t.Call="call",t.MessageBack="messageBack",t.OpenApp="openApp"})(Wo||(at.ActionTypes=Wo={}));at.actionTypesZodSchema=Ac.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var on=y(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.semanticActionStateTypesZodSchema=ct.SemanticActionStateTypes=void 0;var Oc=j(),Ho;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(Ho||(ct.SemanticActionStateTypes=Ho={}));ct.semanticActionStateTypesZodSchema=Oc.z.enum(["start","continue","done"])});var sn=y(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.attachmentLayoutTypesZodSchema=ut.AttachmentLayoutTypes=void 0;var Pc=j(),Bo;(function(t){t.List="list",t.Carousel="carousel"})(Bo||(ut.AttachmentLayoutTypes=Bo={}));ut.attachmentLayoutTypesZodSchema=Pc.z.enum(["list","carousel"])});var an=y(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.Channels=void 0;var Ko;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(Ko||(vr.Channels=Ko={}))});var cn=y(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.endOfConversationCodesZodSchema=dt.EndOfConversationCodes=void 0;var Zc=j(),Go;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(Go||(dt.EndOfConversationCodes=Go={}));dt.endOfConversationCodesZodSchema=Zc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Yo=y(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.membershipSourceTypeZodSchema=lt.MembershipSourceTypes=void 0;var jc=j(),Jo;(function(t){t.Channel="channel",t.Team="team"})(Jo||(lt.MembershipSourceTypes=Jo={}));lt.membershipSourceTypeZodSchema=jc.z.enum(["channel","team"])});var Qo=y(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.membershipTypeZodSchema=ft.MembershipTypes=void 0;var kc=j(),Xo;(function(t){t.Direct="direct",t.Transitive="transitive"})(Xo||(ft.MembershipTypes=Xo={}));ft.membershipTypeZodSchema=kc.z.enum(["direct","transitive"])});var Ft=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.roleTypeZodSchema=pt.RoleTypes=void 0;var Ec=j(),ei;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(ei||(pt.RoleTypes=ei={}));pt.roleTypeZodSchema=Ec.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var ti=y(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.addAIToActivity=void 0;var Uc=(t,e,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:e,usageInfo:r};(n=t.entities)!==null&&n!==void 0||(t.entities=[]),t.entities.push(o)};gr.addAIToActivity=Uc});var ri=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.adaptiveCardInvokeActionZodSchema=void 0;var Ve=j();_r.adaptiveCardInvokeActionZodSchema=Ve.z.object({type:Ve.z.string().min(1),id:Ve.z.string().optional(),verb:Ve.z.string().min(1),data:Ve.z.record(Ve.z.string().min(1),Ve.z.any())})});var ni=y(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var oi=y(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.default="00000000-0000-0000-0000-000000000000"});var ii=y(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var Vt=y(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});var Rc=ii();function Mc(t){return typeof t=="string"&&Rc.default.test(t)}fn.default=Mc});var $t=y(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});var Nc=Vt();function Dc(t){if(!(0,Nc.default)(t))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(t.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(t.slice(9,13),16))>>>8,e&255,(e=parseInt(t.slice(14,18),16))>>>8,e&255,(e=parseInt(t.slice(19,23),16))>>>8,e&255,(e=parseInt(t.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}pn.default=Dc});var fe=y(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.unsafeStringify=void 0;var zc=Vt(),U=[];for(let t=0;t<256;++t)U.push((t+256).toString(16).slice(1));function si(t,e=0){return(U[t[e+0]]+U[t[e+1]]+U[t[e+2]]+U[t[e+3]]+"-"+U[t[e+4]]+U[t[e+5]]+"-"+U[t[e+6]]+U[t[e+7]]+"-"+U[t[e+8]]+U[t[e+9]]+"-"+U[t[e+10]]+U[t[e+11]]+U[t[e+12]]+U[t[e+13]]+U[t[e+14]]+U[t[e+15]]).toLowerCase()}Wt.unsafeStringify=si;function Lc(t,e=0){let r=si(t,e);if(!(0,zc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Wt.default=Lc});var br=y(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});var hn,qc=new Uint8Array(16);function Fc(){if(!hn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");hn=crypto.getRandomValues.bind(crypto)}return hn(qc)}mn.default=Fc});var yn=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.updateV1State=void 0;var ai=br(),Vc=fe(),Ht={};function $c(t,e,r){var i,s,a,d;let n,o=(i=t==null?void 0:t._v6)!=null?i:!1;if(t){let l=Object.keys(t);l.length===1&&l[0]==="_v6"&&(t=void 0)}if(t)n=ci((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,ai.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,ai.default)();ui(Ht,l,f),n=ci(f,Ht.msecs,Ht.nsecs,o?void 0:Ht.clockseq,o?void 0:Ht.node,e,r)}return e!=null?e:(0,Vc.unsafeStringify)(n)}function ui(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.nsecs)!=null||(t.nsecs=0),e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=r.slice(10,16),t.node[0]|=1,t.clockseq=(r[8]<<8|r[9])&16383),t.msecs=e,t}Bt.updateV1State=ui;function ci(t,e,r,n,o,i,s=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),s=0;else if(s<0||s+16>i.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);e!=null||(e=Date.now()),r!=null||(r=0),n!=null||(n=(t[8]<<8|t[9])&16383),o!=null||(o=t.slice(10,16)),e+=122192928e5;let a=((e&268435455)*1e4+r)%4294967296;i[s++]=a>>>24&255,i[s++]=a>>>16&255,i[s++]=a>>>8&255,i[s++]=a&255;let d=e/4294967296*1e4&268435455;i[s++]=d>>>8&255,i[s++]=d&255,i[s++]=d>>>24&15|16,i[s++]=d>>>16&255,i[s++]=n>>>8|128,i[s++]=n&255;for(let l=0;l<6;++l)i[s++]=o[l];return i}Bt.default=$c});var gn=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});var Wc=$t(),Hc=fe();function Bc(t){let e=typeof t=="string"?(0,Wc.default)(t):t,r=Kc(e);return typeof t=="string"?(0,Hc.unsafeStringify)(r):r}vn.default=Bc;function Kc(t){return Uint8Array.of((t[6]&15)<<4|t[7]>>4&15,(t[7]&15)<<4|(t[4]&240)>>4,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,(t[1]&15)<<4|(t[2]&240)>>4,96|t[2]&15,t[3],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var li=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});function Gc(t){let e=Xc(t),r=Yc(e,t.length*8);return Jc(r)}function Jc(t){let e=new Uint8Array(t.length*4);for(let r=0;r<t.length*4;r++)e[r]=t[r>>2]>>>r%4*8&255;return e}function di(t){return(t+64>>>9<<4)+14+1}function Yc(t,e){let r=new Uint32Array(di(e)).fill(0);r.set(t),r[e>>5]|=128<<e%32,r[r.length-1]=e,t=r;let n=1732584193,o=-271733879,i=-1732584194,s=271733878;for(let a=0;a<t.length;a+=16){let d=n,l=o,f=i,m=s;n=N(n,o,i,s,t[a],7,-680876936),s=N(s,n,o,i,t[a+1],12,-389564586),i=N(i,s,n,o,t[a+2],17,606105819),o=N(o,i,s,n,t[a+3],22,-1044525330),n=N(n,o,i,s,t[a+4],7,-176418897),s=N(s,n,o,i,t[a+5],12,1200080426),i=N(i,s,n,o,t[a+6],17,-1473231341),o=N(o,i,s,n,t[a+7],22,-45705983),n=N(n,o,i,s,t[a+8],7,1770035416),s=N(s,n,o,i,t[a+9],12,-1958414417),i=N(i,s,n,o,t[a+10],17,-42063),o=N(o,i,s,n,t[a+11],22,-1990404162),n=N(n,o,i,s,t[a+12],7,1804603682),s=N(s,n,o,i,t[a+13],12,-40341101),i=N(i,s,n,o,t[a+14],17,-1502002290),o=N(o,i,s,n,t[a+15],22,1236535329),n=D(n,o,i,s,t[a+1],5,-165796510),s=D(s,n,o,i,t[a+6],9,-1069501632),i=D(i,s,n,o,t[a+11],14,643717713),o=D(o,i,s,n,t[a],20,-373897302),n=D(n,o,i,s,t[a+5],5,-701558691),s=D(s,n,o,i,t[a+10],9,38016083),i=D(i,s,n,o,t[a+15],14,-660478335),o=D(o,i,s,n,t[a+4],20,-405537848),n=D(n,o,i,s,t[a+9],5,568446438),s=D(s,n,o,i,t[a+14],9,-1019803690),i=D(i,s,n,o,t[a+3],14,-187363961),o=D(o,i,s,n,t[a+8],20,1163531501),n=D(n,o,i,s,t[a+13],5,-1444681467),s=D(s,n,o,i,t[a+2],9,-51403784),i=D(i,s,n,o,t[a+7],14,1735328473),o=D(o,i,s,n,t[a+12],20,-1926607734),n=z(n,o,i,s,t[a+5],4,-378558),s=z(s,n,o,i,t[a+8],11,-2022574463),i=z(i,s,n,o,t[a+11],16,1839030562),o=z(o,i,s,n,t[a+14],23,-35309556),n=z(n,o,i,s,t[a+1],4,-1530992060),s=z(s,n,o,i,t[a+4],11,1272893353),i=z(i,s,n,o,t[a+7],16,-155497632),o=z(o,i,s,n,t[a+10],23,-1094730640),n=z(n,o,i,s,t[a+13],4,681279174),s=z(s,n,o,i,t[a],11,-358537222),i=z(i,s,n,o,t[a+3],16,-722521979),o=z(o,i,s,n,t[a+6],23,76029189),n=z(n,o,i,s,t[a+9],4,-640364487),s=z(s,n,o,i,t[a+12],11,-421815835),i=z(i,s,n,o,t[a+15],16,530742520),o=z(o,i,s,n,t[a+2],23,-995338651),n=L(n,o,i,s,t[a],6,-198630844),s=L(s,n,o,i,t[a+7],10,1126891415),i=L(i,s,n,o,t[a+14],15,-1416354905),o=L(o,i,s,n,t[a+5],21,-57434055),n=L(n,o,i,s,t[a+12],6,1700485571),s=L(s,n,o,i,t[a+3],10,-1894986606),i=L(i,s,n,o,t[a+10],15,-1051523),o=L(o,i,s,n,t[a+1],21,-2054922799),n=L(n,o,i,s,t[a+8],6,1873313359),s=L(s,n,o,i,t[a+15],10,-30611744),i=L(i,s,n,o,t[a+6],15,-1560198380),o=L(o,i,s,n,t[a+13],21,1309151649),n=L(n,o,i,s,t[a+4],6,-145523070),s=L(s,n,o,i,t[a+11],10,-1120210379),i=L(i,s,n,o,t[a+2],15,718787259),o=L(o,i,s,n,t[a+9],21,-343485551),n=we(n,d),o=we(o,l),i=we(i,f),s=we(s,m)}return Uint32Array.of(n,o,i,s)}function Xc(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(di(t.length*8)).fill(0);for(let r=0;r<t.length;r++)e[r>>2]|=(t[r]&255)<<r%4*8;return e}function we(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function Qc(t,e){return t<<e|t>>>32-e}function xr(t,e,r,n,o,i){return we(Qc(we(we(e,t),we(n,i)),o),r)}function N(t,e,r,n,o,i,s){return xr(e&r|~e&n,t,e,o,i,s)}function D(t,e,r,n,o,i,s){return xr(e&n|r&~n,t,e,o,i,s)}function z(t,e,r,n,o,i,s){return xr(e^r^n,t,e,o,i,s)}function L(t,e,r,n,o,i,s){return xr(r^(e|~n),t,e,o,i,s)}_n.default=Gc});var Kt=y(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.URL=pe.DNS=pe.stringToBytes=void 0;var fi=$t(),eu=fe();function pi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}pe.stringToBytes=pi;pe.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";pe.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function tu(t,e,r,n,o,i){let s=typeof r=="string"?pi(r):r,a=typeof n=="string"?(0,fi.default)(n):n;if(typeof n=="string"&&(n=(0,fi.default)(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+s.length);if(d.set(a),d.set(s,a.length),d=e(d),d[6]=d[6]&15|t,d[8]=d[8]&63|128,o){i=i||0;for(let l=0;l<16;++l)o[i+l]=d[l];return o}return(0,eu.unsafeStringify)(d)}pe.default=tu});var mi=y($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.URL=$e.DNS=void 0;var ru=li(),bn=Kt(),hi=Kt();Object.defineProperty($e,"DNS",{enumerable:!0,get:function(){return hi.DNS}});Object.defineProperty($e,"URL",{enumerable:!0,get:function(){return hi.URL}});function xn(t,e,r,n){return(0,bn.default)(48,ru.default,t,e,r,n)}xn.DNS=bn.DNS;xn.URL=bn.URL;$e.default=xn});var yi=y(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});var nu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);wn.default={randomUUID:nu}});var gi=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var vi=yi(),ou=br(),iu=fe();function su(t,e,r){var o,i,s;if(vi.default.randomUUID&&!e&&!t)return vi.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ou.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return(0,iu.unsafeStringify)(n)}Cn.default=su});var _i=y(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});function au(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function In(t,e){return t<<e|t>>>32-e}function cu(t){let e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(t.length+1);n.set(t),n[t.length]=128,t=n;let o=t.length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let a=0;a<i;++a){let d=new Uint32Array(16);for(let l=0;l<16;++l)d[l]=t[a*64+l*4]<<24|t[a*64+l*4+1]<<16|t[a*64+l*4+2]<<8|t[a*64+l*4+3];s[a]=d}s[i-1][14]=(t.length-1)*8/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=(t.length-1)*8&4294967295;for(let a=0;a<i;++a){let d=new Uint32Array(80);for(let O=0;O<16;++O)d[O]=s[a][O];for(let O=16;O<80;++O)d[O]=In(d[O-3]^d[O-8]^d[O-14]^d[O-16],1);let l=r[0],f=r[1],m=r[2],_=r[3],T=r[4];for(let O=0;O<80;++O){let g=Math.floor(O/20),S=In(l,5)+au(g,f,m,_)+T+e[g]+d[O]>>>0;T=_,_=m,m=In(f,30)>>>0,f=l,l=S}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+T>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}Tn.default=cu});var xi=y(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.URL=We.DNS=void 0;var uu=_i(),Sn=Kt(),bi=Kt();Object.defineProperty(We,"DNS",{enumerable:!0,get:function(){return bi.DNS}});Object.defineProperty(We,"URL",{enumerable:!0,get:function(){return bi.URL}});function An(t,e,r,n){return(0,Sn.default)(80,uu.default,t,e,r,n)}An.DNS=Sn.DNS;An.URL=Sn.URL;We.default=An});var wi=y(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});var du=fe(),lu=yn(),fu=gn();function pu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,lu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,fu.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,du.unsafeStringify)(n)}On.default=pu});var Ci=y(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});var hu=$t(),mu=fe();function yu(t){let e=typeof t=="string"?(0,hu.default)(t):t,r=vu(e);return typeof t=="string"?(0,mu.unsafeStringify)(r):r}Pn.default=yu;function vu(t){return Uint8Array.of((t[3]&15)<<4|t[4]>>4&15,(t[4]&15)<<4|(t[5]&240)>>4,(t[5]&15)<<4|t[6]&15,t[7],(t[1]&15)<<4|(t[2]&240)>>4,(t[2]&15)<<4|(t[3]&240)>>4,16|(t[0]&240)>>4,(t[0]&15)<<4|(t[1]&240)>>4,t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}});var Ai=y(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.updateV7State=void 0;var Ii=br(),gu=fe(),Zn={};function _u(t,e,r){var o,i,s;let n;if(t)n=Ti((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,Ii.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,Ii.default)();Si(Zn,a,d),n=Ti(d,Zn.msecs,Zn.seq,e,r)}return e!=null?e:(0,gu.unsafeStringify)(n)}function Si(t,e,r){var n,o;return(n=t.msecs)!=null||(t.msecs=-1/0),(o=t.seq)!=null||(t.seq=0),e>t.msecs?(t.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],t.msecs=e):(t.seq=t.seq+1|0,t.seq===0&&t.msecs++),t}Gt.updateV7State=Si;function Ti(t,e,r,n,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),o=0;else if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return e!=null||(e=Date.now()),r!=null||(r=t[6]*127<<24|t[7]<<16|t[8]<<8|t[9]),n[o++]=e/1099511627776&255,n[o++]=e/4294967296&255,n[o++]=e/16777216&255,n[o++]=e/65536&255,n[o++]=e/256&255,n[o++]=e&255,n[o++]=112|r>>>28&15,n[o++]=r>>>20&255,n[o++]=128|r>>>14&63,n[o++]=r>>>6&255,n[o++]=r<<2&255|t[10]&3,n[o++]=t[11],n[o++]=t[12],n[o++]=t[13],n[o++]=t[14],n[o++]=t[15],n}Gt.default=_u});var Oi=y(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var bu=Vt();function xu(t){if(!(0,bu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}jn.default=xu});var Pi=y(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.version=P.validate=P.v7=P.v6ToV1=P.v6=P.v5=P.v4=P.v3=P.v1ToV6=P.v1=P.stringify=P.parse=P.NIL=P.MAX=void 0;var wu=ni();Object.defineProperty(P,"MAX",{enumerable:!0,get:function(){return wu.default}});var Cu=oi();Object.defineProperty(P,"NIL",{enumerable:!0,get:function(){return Cu.default}});var Iu=$t();Object.defineProperty(P,"parse",{enumerable:!0,get:function(){return Iu.default}});var Tu=fe();Object.defineProperty(P,"stringify",{enumerable:!0,get:function(){return Tu.default}});var Su=yn();Object.defineProperty(P,"v1",{enumerable:!0,get:function(){return Su.default}});var Au=gn();Object.defineProperty(P,"v1ToV6",{enumerable:!0,get:function(){return Au.default}});var Ou=mi();Object.defineProperty(P,"v3",{enumerable:!0,get:function(){return Ou.default}});var Pu=gi();Object.defineProperty(P,"v4",{enumerable:!0,get:function(){return Pu.default}});var Zu=xi();Object.defineProperty(P,"v5",{enumerable:!0,get:function(){return Zu.default}});var ju=wi();Object.defineProperty(P,"v6",{enumerable:!0,get:function(){return ju.default}});var ku=Ci();Object.defineProperty(P,"v6ToV1",{enumerable:!0,get:function(){return ku.default}});var Eu=Ai();Object.defineProperty(P,"v7",{enumerable:!0,get:function(){return Eu.default}});var Uu=Vt();Object.defineProperty(P,"validate",{enumerable:!0,get:function(){return Uu.default}});var Ru=Oi();Object.defineProperty(P,"version",{enumerable:!0,get:function(){return Ru.default}})});var kn=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.entityZodSchema=void 0;var Zi=j();wr.entityZodSchema=Zi.z.object({type:Zi.z.string().min(1)}).passthrough()});var ji=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.semanticActionZodSchema=void 0;var Jt=j(),Mu=kn(),Nu=on();Cr.semanticActionZodSchema=Jt.z.object({id:Jt.z.string().min(1),state:Jt.z.union([Nu.semanticActionStateTypesZodSchema,Jt.z.string().min(1)]),entities:Jt.z.record(Mu.entityZodSchema)})});var ki=y(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.cardActionZodSchema=void 0;var ae=j(),Du=nn();Ir.cardActionZodSchema=ae.z.object({type:ae.z.union([Du.actionTypesZodSchema,ae.z.string().min(1)]),title:ae.z.string().min(1),image:ae.z.string().min(1).optional(),text:ae.z.string().min(1).optional(),displayText:ae.z.string().min(1).optional(),value:ae.z.any().optional(),channelData:ae.z.unknown().optional(),imageAltText:ae.z.string().min(1).optional()})});var Ei=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.suggestedActionsZodSchema=void 0;var Tr=j(),zu=ki();Sr.suggestedActionsZodSchema=Tr.z.object({to:Tr.z.array(Tr.z.string().min(1)),actions:Tr.z.array(zu.cardActionZodSchema)})});var En=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.activityEventNamesZodSchema=ht.ActivityEventNames=void 0;var Lu=j(),Ui;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Ui||(ht.ActivityEventNames=Ui={}));ht.activityEventNamesZodSchema=Lu.z.enum(["ContinueConversation","CreateConversation"])});var Un=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.activityImportanceZodSchema=mt.ActivityImportance=void 0;var qu=j(),Ri;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Ri||(mt.ActivityImportance=Ri={}));mt.activityImportanceZodSchema=qu.z.enum(["low","normal","high"])});var Rn=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.activityTypesZodSchema=yt.ActivityTypes=void 0;var Fu=j(),Mi;(function(t){t.Message="message",t.ContactRelationUpdate="contactRelationUpdate",t.ConversationUpdate="conversationUpdate",t.Typing="typing",t.EndOfConversation="endOfConversation",t.Event="event",t.Invoke="invoke",t.InvokeResponse="invokeResponse",t.DeleteUserData="deleteUserData",t.MessageUpdate="messageUpdate",t.MessageDelete="messageDelete",t.InstallationUpdate="installationUpdate",t.MessageReaction="messageReaction",t.Suggestion="suggestion",t.Trace="trace",t.Handoff="handoff",t.Command="command",t.CommandResult="commandResult"})(Mi||(yt.ActivityTypes=Mi={}));yt.activityTypesZodSchema=Fu.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Ni=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.attachmentZodSchema=void 0;var vt=j();Ar.attachmentZodSchema=vt.z.object({contentType:vt.z.string().min(1),contentUrl:vt.z.string().min(1).optional(),content:vt.z.unknown().optional(),name:vt.z.string().min(1).optional(),thumbnailUrl:vt.z.string().min(1).optional()})});var Di=y(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.addProductInfoToActivity=He.clearProductInfoFromActivity=void 0;var Vu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};He.clearProductInfoFromActivity=Vu;var $u=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,He.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};He.addProductInfoToActivity=$u});var Mn=y(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.channelAccountZodSchema=void 0;var Q=j(),Wu=Ft();Or.channelAccountZodSchema=Q.z.object({id:Q.z.string().min(1).optional(),name:Q.z.string().optional(),aadObjectId:Q.z.string().min(1).optional(),tenantId:Q.z.string().min(1).optional(),agenticUserId:Q.z.string().min(1).optional(),agenticAppId:Q.z.string().min(1).optional(),agenticAppBlueprintId:Q.z.string().min(1).optional(),role:Q.z.union([Wu.roleTypeZodSchema,Q.z.string().min(1)]).optional(),properties:Q.z.unknown().optional()})});var Nn=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.conversationAccountZodSchema=void 0;var ce=j(),Hu=Ft();Pr.conversationAccountZodSchema=ce.z.object({isGroup:ce.z.boolean().optional(),conversationType:ce.z.string().min(1).optional(),tenantId:ce.z.string().min(1).optional(),id:ce.z.string().min(1),name:ce.z.string().min(1).optional(),aadObjectId:ce.z.string().min(1).optional(),role:ce.z.union([Hu.roleTypeZodSchema,ce.z.string().min(1)]).optional(),properties:ce.z.unknown().optional()})});var Li=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.conversationReferenceZodSchema=void 0;var Yt=j(),zi=Mn(),Bu=Nn();Zr.conversationReferenceZodSchema=Yt.z.object({activityId:Yt.z.string().min(1).optional(),user:zi.channelAccountZodSchema.optional(),locale:Yt.z.string().min(1).optional(),agent:zi.channelAccountZodSchema.optional().nullable(),conversation:Bu.conversationAccountZodSchema,channelId:Yt.z.string().min(1),serviceUrl:Yt.z.string().min(1).optional()})});var Dn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.deliveryModesZodSchema=gt.DeliveryModes=void 0;var Ku=j(),qi;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(qi||(gt.DeliveryModes=qi={}));gt.deliveryModesZodSchema=Ku.z.enum(["normal","notification","expectReplies","ephemeral"])});var zn=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.inputHintsZodSchema=_t.InputHints=void 0;var Gu=j(),Fi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Fi||(_t.InputHints=Fi={}));_t.inputHintsZodSchema=Gu.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var Ln=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.messageReactionTypesZodSchema=bt.MessageReactionTypes=void 0;var Ju=j(),Vi;(function(t){t.Like="like",t.PlusOne="plusOne"})(Vi||(bt.MessageReactionTypes=Vi={}));bt.messageReactionTypesZodSchema=Ju.z.enum(["like","plusOne"])});var $i=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.messageReactionZodSchema=void 0;var qn=j(),Yu=Ln();jr.messageReactionZodSchema=qn.z.object({type:qn.z.union([Yu.messageReactionTypesZodSchema,qn.z.string().min(1)])})});var Fn=y(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.textFormatTypesZodSchema=xt.TextFormatTypes=void 0;var Xu=j(),Wi;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Wi||(xt.TextFormatTypes=Wi={}));xt.textFormatTypesZodSchema=Xu.z.enum(["markdown","plain","xml"])});var Hi=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.textHighlightZodSchema=void 0;var Vn=j();kr.textHighlightZodSchema=Vn.z.object({text:Vn.z.string().min(1),occurrence:Vn.z.number()})});var Xi=y(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.Activity=Be.activityZodSchema=void 0;var Qu=Pi(),b=j(),ed=ji(),td=Ei(),Yi=En(),rd=Un(),Ur=Rn(),nd=Ni(),od=sn(),Bi=Di(),Er=Mn(),Ki=an(),id=Nn(),sd=Li(),ad=cn(),cd=Dn(),ud=kn(),dd=zn(),Gi=$i(),ld=Fn(),fd=Hi(),Ji=Ft();Be.activityZodSchema=b.z.object({type:b.z.union([Ur.activityTypesZodSchema,b.z.string().min(1)]),text:b.z.string().optional(),id:b.z.string().min(1).optional(),channelId:b.z.string().min(1).optional(),from:Er.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).datetime().optional(),b.z.string().min(1).transform(t=>new Date(t)).optional()]),localTimestamp:b.z.string().min(1).transform(t=>new Date(t)).optional().or(b.z.date()).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:id.conversationAccountZodSchema.optional(),recipient:Er.channelAccountZodSchema.optional(),textFormat:b.z.union([ld.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([od.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(Er.channelAccountZodSchema).optional(),membersRemoved:b.z.array(Er.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Gi.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Gi.messageReactionZodSchema).optional(),topicName:b.z.string().min(1).optional(),historyDisclosed:b.z.boolean().optional(),locale:b.z.string().min(1).optional(),speak:b.z.string().min(1).optional(),inputHint:b.z.union([dd.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:td.suggestedActionsZodSchema.optional(),attachments:b.z.array(nd.attachmentZodSchema).optional(),entities:b.z.array(ud.entityZodSchema.passthrough()).optional(),channelData:b.z.any().optional(),action:b.z.string().min(1).optional(),replyToId:b.z.string().min(1).optional(),label:b.z.string().min(1).optional(),valueType:b.z.string().min(1).optional(),value:b.z.unknown().optional(),name:b.z.union([Yi.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:sd.conversationReferenceZodSchema.optional(),code:b.z.union([ad.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.string().min(1).datetime().optional(),importance:b.z.union([rd.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([cd.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(fd.textHighlightZodSchema).optional(),semanticAction:ed.semanticActionZodSchema.optional()});var $n=class t{constructor(e){if(e===void 0)throw new Error("Invalid ActivityType: undefined");if(e===null)throw new Error("Invalid ActivityType: null");if(typeof e=="string"&&e.length===0)throw new Error("Invalid ActivityType: empty string");this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Be.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw new Error(`Invalid channelId ${e}. Found subChannel but no main channel.`);this._channelId=r,n?(0,Bi.addProductInfoToActivity)(this,n):(0,Bi.clearProductInfoFromActivity)(this)}set channelIdChannel(e){this._channelId=e}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var e,r;return(r=(e=this.entities)===null||e===void 0?void 0:e.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(e){if(!this._channelId)throw new Error("Primary channel must be set before setting subChannel");this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){let r={type:Ur.ActivityTypes.Event,name:Yi.ActivityEventNames.ContinueConversation,id:(0,Qu.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(r)}getAppropriateReplyToId(){if(this.type!==Ur.ActivityTypes.ConversationUpdate||this.channelId!==Ki.Channels.Directline&&this.channelId!==Ki.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw new Error("Activity Recipient undefined");if(this.conversation===null||this.conversation===void 0)throw new Error("Activity Conversation undefined");if(this.channelId===null||this.channelId===void 0)throw new Error("Activity ChannelId undefined");return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===Ur.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(){let e={...this};return e.channelId=e._channelId,delete e._channelId,JSON.stringify(e)}isAgenticRequest(){var e,r;return((e=this.recipient)===null||e===void 0?void 0:e.role)===Ji.RoleTypes.AgenticUser||((r=this.recipient)===null||r===void 0?void 0:r.role)===Ji.RoleTypes.AgenticIdentity}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Be.Activity=$n});var Qi=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.CallerIdConstants=void 0;Rr.CallerIdConstants={PublicAzureChannel:"urn:botframework:azure",USGovChannel:"urn:botframework:azureusgov",AgentPrefix:"urn:botframework:aadappid:"}});var es=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.activityTreatments=wt.ActivityTreatments=void 0;var pd=j(),Wn;(function(t){t.Targeted="targeted"})(Wn||(wt.ActivityTreatments=Wn={}));wt.activityTreatments=pd.z.nativeEnum(Wn)});var Hn=y(x=>{"use strict";var hd=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ts=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hd(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.Logger=x.debug=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.CallerIdConstants=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var md=nn();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return md.ActionTypes}});var yd=on();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return yd.SemanticActionStateTypes}});var vd=sn();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return vd.AttachmentLayoutTypes}});var gd=an();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return gd.Channels}});var _d=cn();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return _d.EndOfConversationCodes}});var bd=Yo();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return bd.MembershipSourceTypes}});var xd=Qo();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return xd.MembershipTypes}});var wd=Ft();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return wd.RoleTypes}});ts(ti(),x);ts(ri(),x);var rs=Xi();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return rs.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return rs.activityZodSchema}});var Cd=En();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return Cd.ActivityEventNames}});var Id=Un();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Id.ActivityImportance}});var Td=Rn();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Td.ActivityTypes}});var Sd=Qi();Object.defineProperty(x,"CallerIdConstants",{enumerable:!0,get:function(){return Sd.CallerIdConstants}});var Ad=Dn();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return Ad.DeliveryModes}});var Od=zn();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return Od.InputHints}});var Pd=Ln();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return Pd.MessageReactionTypes}});var Zd=Fn();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Zd.TextFormatTypes}});var jd=es();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return jd.ActivityTreatments}});var ns=Mt();Object.defineProperty(x,"debug",{enumerable:!0,get:function(){return ns.debug}});Object.defineProperty(x,"Logger",{enumerable:!0,get:function(){return ns.Logger}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Rt=(A=>(A.Unknown="Unknown",A.Exp="Exp",A.Dev="Dev",A.Test="Test",A.Preprod="Preprod",A.FirstRelease="FirstRelease",A.Prod="Prod",A.Gov="Gov",A.High="High",A.DoD="DoD",A.Mooncake="Mooncake",A.Ex="Ex",A.Rx="Rx",A.Prv="Prv",A.Local="Local",A.GovFR="GovFR",A.Other="Other",A))(Rt||{});var Wr=class{constructor(){this.appClientId="";this.tenantId="";this.authority="";this.environmentId="";this.agentIdentifier="";this.useExperimentalEndpoint=!1}},Hr=class extends Wr{constructor(e){var i,s;if(super(),!e)return;let r=(i=e.cloud)!=null?i:"Prod",n=(s=e.copilotAgentType)!=null?s:"Published",o=e.authority&&e.authority.trim()!==""?e.authority:"https://login.microsoftonline.com";if(!Object.values(Rt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Rt).join(", ")}`);if(!Object.values(Ut).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(Ut).join(", ")}`);Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Jd=()=>{var t,e,r,n,o,i;return new Hr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((i=process.env.useExperimentalEndpoint)==null?void 0:i.toLowerCase())==="true"})};var tr=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Br(t){}function lo(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Br,onError:r=Br,onRetry:n=Br,onComment:o}=t,i="",s=!0,a,d="",l="";function f(g){let S=s?g.replace(/^\xEF\xBB\xBF/,""):g,[A,q]=Us(`${i}${S}`);for(let te of A)m(te);i=q,s=!1}function m(g){if(g===""){T();return}if(g.startsWith(":")){o&&o(g.slice(g.startsWith(": ")?2:1));return}let S=g.indexOf(":");if(S!==-1){let A=g.slice(0,S),q=g[S+1]===" "?2:1,te=g.slice(S+q);_(A,te,g);return}_(g,"",g)}function _(g,S,A){switch(g){case"event":l=S;break;case"data":d=`${d}${S}
|
|
2
|
+
`;break;case"id":a=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new tr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:A}));break;default:r(new tr(`Unknown field "${g.length>20?`${g.slice(0,20)}\u2026`:g}"`,{type:"unknown-field",field:g,value:S,line:A}));break}}function T(){d.length>0&&e({id:a,event:l||void 0,data:d.endsWith(`
|
|
3
|
+
`)?d.slice(0,-1):d}),a=void 0,d="",l=""}function O(g={}){i&&g.consume&&m(i),s=!0,a=void 0,d="",l="",i=""}return{feed:f,reset:O}}function Us(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
|
|
4
|
+
`,n),s=-1;if(o!==-1&&i!==-1?s=Math.min(o,i):o!==-1?o===t.length-1?s=-1:s=o:i!==-1&&(s=i),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
5
|
+
`&&n++}}return[e,r]}var fo="connecting",Rs="open",Kr="closed",rr=()=>{};function Ms(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=rr,onConnect:i=rr,onDisconnect:s=rr,onScheduleReconnect:a=rr}=r,{fetch:d,url:l,initialLastEventId:f}=Ns(r),m={...r.headers},_=[],T=n?[n]:[],O=E=>T.forEach(ne=>ne(E)),g=lo({onEvent:Ts,onRetry:Ss,onComment:o}),S,A=l.toString(),q=new AbortController,te=f,ye=2e3,Vr,re=Kr;return Pt(),{close:Zt,connect:Pt,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:$r,get lastEventId(){return te},get url(){return A},get readyState(){return re}};function Pt(){S||(re=fo,q=new AbortController,S=d(l,As()).then(Is).catch(E=>{S=null,!(E.name==="AbortError"||E.type==="aborted"||q.signal.aborted)&&so()}))}function Zt(){re=Kr,q.abort(),g.reset(),clearTimeout(Vr),_.forEach(E=>E())}function $r(){let E=[],ne=[];function jt(){return new Promise(F=>{let oe=ne.shift();oe?F({value:oe,done:!1}):E.push(F)})}let Ge=function(F){let oe=E.shift();oe?oe({value:F,done:!1}):ne.push(F)};function Ie(){for(T.splice(T.indexOf(Ge),1);E.shift(););for(;ne.shift(););}function kt(){let F=E.shift();F&&(F({done:!0,value:void 0}),Ie())}return _.push(kt),T.push(Ge),{next(){return re===Kr?this.return():jt()},return(){return Ie(),Promise.resolve({done:!0,value:void 0})},throw(F){return Ie(),Promise.reject(F)},[Symbol.asyncIterator](){return this}}}function so(){a({delay:ye}),!q.signal.aborted&&(re=fo,Vr=setTimeout(Pt,ye))}async function Is(E){i(),g.reset();let{body:ne,redirected:jt,status:Ge}=E;if(Ge===204){s(),Zt();return}if(!ne)throw new Error("Missing response body");jt&&(A=E.url);let Ie=e(ne),kt=new TextDecoder,F=Ie.getReader(),oe=!0;re=Rs;do{let{done:ao,value:co}=await F.read();co&&g.feed(kt.decode(co,{stream:!ao})),ao&&(oe=!1,S=null,g.reset(),so(),s())}while(oe)}function Ts(E){typeof E.id=="string"&&(te=E.id),O(E)}function Ss(E){ye=E}function As(){let{mode:E,credentials:ne,body:jt,method:Ge,redirect:Ie,referrer:kt,referrerPolicy:F}=r,oe={Accept:"text/event-stream",...m,...te?{"Last-Event-ID":te}:void 0};return{mode:E,credentials:ne,body:jt,method:Ge,redirect:Ie,referrer:kt,referrerPolicy:F,headers:oe,cache:"no-store",signal:q.signal}}}function Ns(t){let e=t.fetch||globalThis.fetch;if(!Ds(e))throw new Error("No fetch implementation provided, and one was not found on the global object.");if(typeof AbortController!="function")throw new Error("Missing AbortController implementation");let{url:r,initialLastEventId:n}=t;if(typeof r!="string"&&!(r instanceof URL))throw new Error("Invalid URL provided - must be string or URL instance");if(typeof n!="string"&&n!==void 0)throw new Error("Invalid initialLastEventId provided - must be string or undefined");return{fetch:e,url:r,initialLastEventId:n}}function Ds(t){return typeof t=="function"}var zs={getStream:Ls};function po(t){return Ms(t,zs)}function Ls(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var bo=Et(Mt());var sr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{identifier:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var ar=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var Qe=(0,bo.debug)("copilot-studio:power-platform");function ur(t,e){var a,d,l,f,m,_;if((a=t.directConnectUrl)!=null&&a.trim()){if(Qe.debug(`Using direct connection: ${t.directConnectUrl}`),!Nt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return t.directConnectUrl.toLowerCase().includes("tenants/00000000-0000-0000-0000-000000000000")?(Qe.debug(`Direct connection cannot be used, forcing default settings flow. Tenant ID is missing in the URL: ${t.directConnectUrl}`),ur({...t,directConnectUrl:""},e)):na(t.directConnectUrl,e).href}let r=(d=t.cloud)!=null?d:"Prod",n=(l=t.copilotAgentType)!=null?l:"Published";if(Qe.debug(`Using cloud setting: ${r}`),Qe.debug(`Using agent type: ${n}`),!((f=t.environmentId)!=null&&f.trim()))throw new Error("EnvironmentId must be provided");if(!((m=t.agentIdentifier)!=null&&m.trim()))throw new Error("AgentIdentifier must be provided");if(r==="Other")if((_=t.customPowerPlatformCloud)!=null&&_.trim())if(Nt(t.customPowerPlatformCloud))Qe.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let o=oa(r,t.environmentId,t.customPowerPlatformCloud),s={Published:()=>new ar({host:o,schema:t.agentIdentifier}),Prebuilt:()=>new sr({host:o,identifier:t.agentIdentifier})}[n]().getConversationUrl(e);return Qe.debug(`Generated Copilot Studio connection URL: ${s}`),s}function xo(t,e="Unknown",r="",n=""){var o,i;if(!n&&!(t!=null&&t.directConnectUrl)){if(e==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!t&&e==="Unknown")throw new Error("Either settings or cloud must be provided");if(t&&t.cloud&&t.cloud!=="Unknown"&&(e=t.cloud),e==="Other")if(r&&Nt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Nt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${cr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Nt(n)){if(_o(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${cr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${cr(_o(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Nt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function na(t,e){let r=new URL(t);return r.searchParams.has("api-version")||r.searchParams.append("api-version","2022-03-01-preview"),r.pathname.endsWith("/")&&(r.pathname=r.pathname.slice(0,-1)),r.pathname.includes("/conversations")&&(r.pathname=r.pathname.substring(0,r.pathname.indexOf("/conversations"))),r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r}function oa(t,e,r){if(t==="Other"&&(!r||!r.trim()))throw new Error("cloudBaseAddress must be provided when PowerPlatformCloud is Other");r=r!=null?r:"api.unknown.powerplatform.com";let n=e.toLowerCase().replaceAll("-",""),o=ia(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${cr(t,r)}`)}function cr(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function ia(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function _o(t){switch(t.host.toLowerCase()){case"api.powerplatform.localhost":return"Local";case"api.exp.powerplatform.com":return"Exp";case"api.dev.powerplatform.com":return"Dev";case"api.prv.powerplatform.com":return"Prv";case"api.test.powerplatform.com":return"Test";case"api.preprod.powerplatform.com":return"Preprod";case"api.powerplatform.com":return"Prod";case"api.gov.powerplatform.microsoft.us":return"GovFR";case"api.high.powerplatform.microsoft.us":return"High";case"api.appsplatform.us":return"DoD";case"api.powerplatform.partner.microsoftonline.cn":return"Mooncake";default:return"Unknown"}}var Xt=Et(Hn());var Mr=class{constructor(e){this.activity=e}};var ss=Et(Mt());var os="1.1.0-alpha.75";var Nr={};var J=(0,ss.debug)("copilot-studio:client"),he=class he{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}async*postRequestAsync(e,r,n="POST"){var i,s;J.debug(`>>> SEND TO ${e}`);let o=po({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":he.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(a,d)=>{let l=await fetch(a,d);return this.processResponseHeaders(l.headers),l}});try{for await(let{data:a,event:d}of o){if(a&&d==="activity")try{let l=Xt.Activity.fromJson(a);switch(l.type){case Xt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(i=l.conversation)==null?void 0:i.id)!=null?s:"",J.debug(`Conversation ID: ${this.conversationId}`)),yield l;break;default:J.debug(`Activity type: ${l.type}`),yield l;break}}catch(l){J.error("Failed to parse activity:",l)}else if(d==="end"){J.debug("Stream complete");break}if(o.readyState==="closed"){J.debug("Connection closed");break}}}finally{o.close()}}static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${os}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Nr.platform()}-${Nr.arch()}/${Nr.release()}`,J.debug(`User-Agent: ${r}`),r}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(he.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,J.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(he.conversationIdHeaderKey))!=null?o:"",this.conversationId&&J.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==he.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),J.debug("Headers received:",r)}async*startConversationAsync(e=!0){let r=ur(this.settings),n={emitStartConversationEvent:e};J.info("Starting conversation ..."),yield*this.postRequestAsync(r,n,"POST")}async*askQuestionAsync(e,r=this.conversationId){let o={type:"message",text:e,conversation:{id:r}},i=Xt.Activity.fromObject(o);yield*this.sendActivity(i)}async*sendActivity(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=ur(this.settings,n),i=new Mr(e);J.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}};he.conversationIdHeaderKey="x-ms-conversationid",he.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",he.scopeFromSettings=xo;var is=he;var R=[];for(let t=0;t<256;++t)R.push((t+256).toString(16).slice(1));function as(t,e=0){return(R[t[e+0]]+R[t[e+1]]+R[t[e+2]]+R[t[e+3]]+"-"+R[t[e+4]]+R[t[e+5]]+"-"+R[t[e+6]]+R[t[e+7]]+"-"+R[t[e+8]]+R[t[e+9]]+"-"+R[t[e+10]]+R[t[e+11]]+R[t[e+12]]+R[t[e+13]]+R[t[e+14]]+R[t[e+15]]).toLowerCase()}var Bn,Ed=new Uint8Array(16);function Kn(){if(!Bn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bn=crypto.getRandomValues.bind(crypto)}return Bn(Ed)}var Ud=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gn={randomUUID:Ud};function Rd(t,e,r){var o,i,s;if(Gn.randomUUID&&!e&&!t)return Gn.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:Kn();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return as(n)}var Jn=Rd;var ws=Et(Hn());var Yn=function(t,e){return Yn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Yn(t,e)};function Ce(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Yn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Qt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ct(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function It(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Y(t){return typeof t=="function"}function Dr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var zr=Dr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
8
6
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
9
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function br(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Dt=(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=vr(s),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(v){e={error:v}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var d=this.initialTeardown;if(ie(d))try{d()}catch(v){i=v instanceof Cn?v.errors:[v]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var b=vr(m),C=b.next();!C.done;C=b.next()){var y=C.value;try{Na(y)}catch(v){i=i!=null?i:[],v instanceof Cn?i=Nt(Nt([],Ut(i)),Ut(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{C&&!C.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(i)throw new Cn(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Na(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)&&br(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&br(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var ri=Dt.EMPTY;function Tn(t){return t instanceof Dt||t&&"closed"in t&&ie(t.remove)&&ie(t.add)&&ie(t.unsubscribe)}function Na(t){ie(t)?t():t.unsubscribe()}var ue={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Lt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Lt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Nt([t,e],Ut(r))):setTimeout.apply(void 0,Nt([t,e],Ut(r)))},clearTimeout:function(t){var e=Lt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Da(t){Lt.setTimeout(function(){var e=ue.onUnhandledError;if(e)e(t);else throw t})}function ni(){}var La=(function(){return oi("C",void 0,void 0)})();function Ma(t){return oi("E",void 0,t)}function Fa(t){return oi("N",t,void 0)}function oi(t,e,r){return{kind:t,value:e,error:r}}var nt=null;function Mt(t){if(ue.useDeprecatedSynchronousErrorHandling){var e=!nt;if(e&&(nt={errorThrown:!1,error:null}),t(),e){var r=nt,n=r.errorThrown,o=r.error;if(nt=null,n)throw o}}else t()}function za(t){ue.useDeprecatedSynchronousErrorHandling&&nt&&(nt.errorThrown=!0,nt.error=t)}var ai=(function(t){Pe(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Tn(r)&&r.add(n)):n.destination=lp,n}return e.create=function(r,n,o){return new In(r,n,o)},e.prototype.next=function(r){this.isStopped?si(Fa(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?si(Ma(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?si(La,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})(Dt);var cp=Function.prototype.bind;function ii(t,e){return cp.call(t,e)}var up=(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){Sn(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Sn(n)}else Sn(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Sn(r)}},t})(),In=(function(t){Pe(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(ie(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&&ue.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ii(r.next,a),error:r.error&&ii(r.error,a),complete:r.complete&&ii(r.complete,a)}):s=r}return i.destination=new up(s),i}return e})(ai);function Sn(t){ue.useDeprecatedSynchronousErrorHandling?za(t):Da(t)}function dp(t){throw t}function si(t,e){var r=ue.onStoppedNotification;r&&Lt.setTimeout(function(){return r(t,e)})}var lp={closed:!0,next:ni,error:dp,complete:ni};var qa=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Va(t){return t}function $a(t){return t.length===0?Va:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ft=(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=pp(e)?e:new In(e,r,n);return Mt(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?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=Ba(r),new r(function(o,i){var s=new In({next:function(a){try{e(a)}catch(c){i(c),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[qa]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return $a(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Ba(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 Ba(t){var e;return(e=t!=null?t:ue.Promise)!==null&&e!==void 0?e:Promise}function fp(t){return t&&ie(t.next)&&ie(t.error)&&ie(t.complete)}function pp(t){return t&&t instanceof ai||fp(t)&&Tn(t)}var Ha=wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var ci=(function(t){Pe(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 Wa(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Ha},e.prototype.next=function(r){var n=this;Mt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=vr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.next(r)}}catch(u){o={error:u}}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;Mt(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;Mt(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?ri:(this.currentObservers=null,a.push(r),new Dt(function(){n.currentObservers=null,br(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 Ft;return r.source=this,r},e.create=function(r,n){return new Wa(r,n)},e})(Ft);var Wa=(function(t){Pe(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:ri},e})(ci);var ui=(function(t){Pe(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})(ci);var Ga=xr(rr()),Re=(0,Ga.debug)("copilot-studio:webchat"),Ja=class{static createConnection(e,r){Re.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new ui(0),a=Ka(async d=>{if(o=d,s.value<2){s.next(2);return}Re.debug("--> Connection established."),u();let m=await e.startConversationAsync();i=m.conversation,n=0,c(m)}),c=d=>{let m={...d,timestamp:new Date().toISOString(),channelData:{...d.channelData,"webchat:sequence-id":n++}};Re.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},u=()=>{if(!(r!=null&&r.showTyping))return;let d=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};c({type:"typing",from:d})};return{connectionStatus$:s,activity$:a,postActivity(d){if(Re.info("--> Preparing to send activity to Copilot Studio ..."),!d)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return Ka(async m=>{try{let b=ei();Re.info("--> Sending activity to Copilot Studio ..."),c({...d,id:b}),u();let C=await e.sendActivity(d);for(let y of C)c(y);m.next(b),m.complete(),Re.info("--> Activity received correctly from Copilot Studio.")}catch(b){Re.error("Error sending Activity to Copilot Studio:",b),m.error(b)}})},end(){Re.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};function Ka(t){return new Ft(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{zt as AgentType,En as ConnectionSettings,ka as CopilotStudioClient,Ja as CopilotStudioWebChat,_n as ExecuteTurnRequest,qt as PowerPlatformCloud,Br as getCopilotStudioConnectionUrl,ts as getTokenAudience,bp as loadCopilotStudioConnectionSettingsFromEnv};
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function er(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Tt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Qt(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(g){e={error:g}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(Y(f))try{f()}catch(g){i=g instanceof zr?g.errors:[g]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var _=Qt(m),T=_.next();!T.done;T=_.next()){var O=T.value;try{cs(O)}catch(g){i=i!=null?i:[],g instanceof zr?i=It(It([],Ct(i)),Ct(g.errors)):i.push(g)}}}catch(g){n={error:g}}finally{try{T&&!T.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(i)throw new zr(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)cs(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&er(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&er(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Xn=Tt.EMPTY;function Lr(t){return t instanceof Tt||t&&"closed"in t&&Y(t.remove)&&Y(t.add)&&Y(t.unsubscribe)}function cs(t){Y(t)?t():t.unsubscribe()}var ee={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var St={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=St.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,It([t,e],Ct(r))):setTimeout.apply(void 0,It([t,e],Ct(r)))},clearTimeout:function(t){var e=St.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function us(t){St.setTimeout(function(){var e=ee.onUnhandledError;if(e)e(t);else throw t})}function Qn(){}var ds=(function(){return eo("C",void 0,void 0)})();function ls(t){return eo("E",void 0,t)}function fs(t){return eo("N",t,void 0)}function eo(t,e,r){return{kind:t,value:e,error:r}}var Ke=null;function At(t){if(ee.useDeprecatedSynchronousErrorHandling){var e=!Ke;if(e&&(Ke={errorThrown:!1,error:null}),t(),e){var r=Ke,n=r.errorThrown,o=r.error;if(Ke=null,n)throw o}}else t()}function ps(t){ee.useDeprecatedSynchronousErrorHandling&&Ke&&(Ke.errorThrown=!0,Ke.error=t)}var no=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Lr(r)&&r.add(n)):n.destination=zd,n}return e.create=function(r,n,o){return new Fr(r,n,o)},e.prototype.next=function(r){this.isStopped?ro(fs(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?ro(ls(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?ro(ds,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Tt);var Md=Function.prototype.bind;function to(t,e){return Md.call(t,e)}var Nd=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){qr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){qr(n)}else qr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){qr(r)}},t})(),Fr=(function(t){Ce(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(Y(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&ee.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&to(r.next,a),error:r.error&&to(r.error,a),complete:r.complete&&to(r.complete,a)}):s=r}return i.destination=new Nd(s),i}return e})(no);function qr(t){ee.useDeprecatedSynchronousErrorHandling?ps(t):us(t)}function Dd(t){throw t}function ro(t,e){var r=ee.onStoppedNotification;r&&St.setTimeout(function(){return r(t,e)})}var zd={closed:!0,next:Qn,error:Dd,complete:Qn};var hs=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ms(t){return t}function ys(t){return t.length===0?ms:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Ot=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,i=qd(e)?e:new Fr(e,r,n);return At(function(){var s=o,a=s.operator,d=s.source;i.add(a?a.call(i,d):d?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=vs(r),new r(function(o,i){var s=new Fr({next:function(a){try{e(a)}catch(d){i(d),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[hs]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ys(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=vs(e),new e(function(n,o){var i;r.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function vs(t){var e;return(e=t!=null?t:ee.Promise)!==null&&e!==void 0?e:Promise}function Ld(t){return t&&Y(t.next)&&Y(t.error)&&Y(t.complete)}function qd(t){return t&&t instanceof no||Ld(t)&&Lr(t)}var gs=Dr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var oo=(function(t){Ce(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new _s(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new gs},e.prototype.next=function(r){var n=this;At(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Qt(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;At(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;At(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Xn:(this.currentObservers=null,a.push(r),new Tt(function(){n.currentObservers=null,er(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Ot;return r.source=this,r},e.create=function(r,n){return new _s(r,n)},e})(Ot);var _s=(function(t){Ce(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Xn},e})(oo);var io=(function(t){Ce(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(oo);var Cs=Et(Mt()),me=(0,Cs.debug)("copilot-studio:webchat"),bs=class{static createConnection(e,r){me.info("--> Creating connection between Copilot Studio and WebChat ...");let n=0,o,i,s=new io(0),a=xs(async f=>{if(o=f,s.value<2){s.next(2);return}me.debug("--> Connection established."),l();for await(let m of e.startConversationAsync())delete m.replyToId,i=m.conversation,d(m)}),d=f=>{let m={...f,timestamp:new Date().toISOString(),channelData:{...f.channelData,"webchat:sequence-id":n}};n++,me.debug(`Notify '${m.type}' activity to WebChat:`,m),o==null||o.next(m)},l=()=>{if(!(r!=null&&r.showTyping))return;let f=i?{id:i.id,name:i.name}:{id:"agent",name:"Agent"};d({type:"typing",from:f})};return{connectionStatus$:s,activity$:a,postActivity(f){if(me.info("--> Preparing to send activity to Copilot Studio ..."),!f)throw new Error("Activity cannot be null.");if(!o)throw new Error("Activity subscriber is not initialized.");return xs(async m=>{try{me.info("--> Sending activity to Copilot Studio ...");let _=ws.Activity.fromObject({...f,id:Jn(),attachments:await Fd(f)});d(_),l(),m.next(_.id);for await(let T of e.sendActivity(_))d(T),me.info("<-- Activity received correctly from Copilot Studio.");m.complete()}catch(_){me.error("Error sending Activity to Copilot Studio:",_),m.error(_)}})},end(){me.info("--> Ending connection between Copilot Studio and WebChat ..."),s.complete(),o&&(o.complete(),o=void 0)}}}};async function Fd(t){var r;if(t.type!=="message"||!((r=t.attachments)!=null&&r.length))return t.attachments||[];let e=[];for(let n of t.attachments){let o=await Vd(n);e.push(o)}return e}async function Vd(t){let e=t.contentUrl;if(!(e!=null&&e.startsWith("blob:")))return t;try{let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch blob URL: ${r.status} ${r.statusText}`);let n=await r.blob(),o=await n.arrayBuffer(),i=$d(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,me.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function $d(t){let e=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(e&&typeof e.from=="function")return e.from(t).toString("base64");let r="";for(let n of new Uint8Array(t))r+=String.fromCharCode(n);return btoa(r)}function xs(t){return new Ot(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}export{Ut as AgentType,Hr as ConnectionSettings,is as CopilotStudioClient,bs as CopilotStudioWebChat,Mr as ExecuteTurnRequest,Rt as PowerPlatformCloud,ur as getCopilotStudioConnectionUrl,xo as getTokenAudience,Jd as loadCopilotStudioConnectionSettingsFromEnv};
|
|
10
8
|
//# sourceMappingURL=browser.mjs.map
|