@microsoft/agents-copilotstudio-client 1.5.0-beta.6.ga236d9a19c → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +5 -4
- package/dist/src/browser.mjs +6 -6
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/copilotStudioClient.js +206 -152
- package/dist/src/copilotStudioClient.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +149 -112
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/dist/src/observability/index.d.ts +2 -0
- package/dist/src/observability/index.js +21 -0
- package/dist/src/observability/index.js.map +1 -0
- package/dist/src/observability/metrics.d.ts +13 -0
- package/dist/src/observability/metrics.js +55 -0
- package/dist/src/observability/metrics.js.map +1 -0
- package/dist/src/observability/traces.d.ts +32 -0
- package/dist/src/observability/traces.js +173 -0
- package/dist/src/observability/traces.js.map +1 -0
- package/dist/src/powerPlatformEnvironment.js +2 -2
- package/dist/src/powerPlatformEnvironment.js.map +1 -1
- package/package.json +5 -4
- package/src/copilotStudioClient.ts +205 -160
- package/src/copilotStudioWebChat.ts +149 -117
- package/src/observability/index.ts +5 -0
- package/src/observability/metrics.ts +63 -0
- package/src/observability/traces.ts +171 -0
- package/src/powerPlatformEnvironment.ts +1 -1
package/dist/src/browser.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Ds=Object.create;var bo=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var zs=Object.getOwnPropertyNames;var qs=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var $s=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zs(e))!Fs.call(t,o)&&o!==r&&bo(t,o,{get:()=>e[o],enumerable:!(n=Ls(e,o))||n.enumerable});return t};var Rt=(t,e,r)=>(r=t!=null?Ds(qs(t)):{},$s(e||!t||!t.__esModule?bo(r,"default",{value:t,enumerable:!0}):r,t));var Co=y((dl,wo)=>{var rt=1e3,nt=rt*60,ot=nt*60,Ee=ot*24,Ys=Ee*7,Xs=Ee*365.25;wo.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Qs(t);if(r==="number"&&isFinite(t))return e.long?ta(t):ea(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Qs(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*Xs;case"weeks":case"week":case"w":return r*Ys;case"days":case"day":case"d":return r*Ee;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ot;case"minutes":case"minute":case"mins":case"min":case"m":return r*nt;case"seconds":case"second":case"secs":case"sec":case"s":return r*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function ea(t){var e=Math.abs(t);return e>=Ee?Math.round(t/Ee)+"d":e>=ot?Math.round(t/ot)+"h":e>=nt?Math.round(t/nt)+"m":e>=rt?Math.round(t/rt)+"s":t+"ms"}function ta(t){var e=Math.abs(t);return e>=Ee?sr(t,e,Ee,"day"):e>=ot?sr(t,e,ot,"hour"):e>=nt?sr(t,e,nt,"minute"):e>=rt?sr(t,e,rt,"second"):t+" ms"}function sr(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var To=y((ll,Io)=>{function ra(t){r.debug=r,r.default=r,r.coerce=d,r.disable=s,r.enable=o,r.enabled=a,r.humanize=Co(),r.destroy=l,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let h=0;for(let C=0;C<f.length;C++)h=(h<<5)-h+f.charCodeAt(C),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(f){let h,C=null,T,P;function v(...b){if(!v.enabled)return;let _=v,O=Number(new Date),E=O-(h||O);_.diff=E,_.prev=h,_.curr=O,h=O,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let N=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(H,Y)=>{if(H==="%%")return"%";N++;let Pe=r.formatters[Y];if(typeof Pe=="function"){let Yr=b[N];H=Pe.call(_,Yr),b.splice(N,1),N--}return H}),r.formatArgs.call(_,b),(_.log||r.log).apply(_,b)}return v.namespace=f,v.useColors=r.useColors(),v.color=r.selectColor(f),v.extend=n,v.destroy=r.destroy,Object.defineProperty(v,"enabled",{enumerable:!0,configurable:!1,get:()=>C!==null?C:(T!==r.namespaces&&(T=r.namespaces,P=r.enabled(f)),P),set:b=>{C=b}}),typeof r.init=="function"&&r.init(v),v}function n(f,h){let C=r(this.namespace+(typeof h=="undefined"?":":h)+f);return C.log=this.log,C}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let h=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let C of h)C[0]==="-"?r.skips.push(C.slice(1)):r.names.push(C)}function i(f,h){let C=0,T=0,P=-1,v=0;for(;C<f.length;)if(T<h.length&&(h[T]===f[C]||h[T]==="*"))h[T]==="*"?(P=T,v=C,T++):(C++,T++);else if(P!==-1)T=P+1,v++,C=v;else return!1;for(;T<h.length&&h[T]==="*";)T++;return T===h.length}function s(){let f=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),f}function a(f){for(let h of r.skips)if(i(f,h))return!1;for(let h of r.names)if(i(f,h))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}Io.exports=ra});var So=y((B,ar)=>{B.formatArgs=oa;B.save=ia;B.load=sa;B.useColors=na;B.storage=aa();B.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`."))}})();B.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 na(){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 oa(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ar.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}B.log=console.debug||console.log||(()=>{});function ia(t){try{t?B.storage.setItem("debug",t):B.storage.removeItem("debug")}catch{}}function sa(){let t;try{t=B.storage.getItem("debug")||B.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function aa(){try{return localStorage}catch{}}ar.exports=To()(B);var{formatters:ca}=ar.exports;ca.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Mt=y(je=>{"use strict";var ua=je&&je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(je,"__esModule",{value:!0});je.Logger=void 0;je.debug=fa;var da=ua(So()),la=["info","warn","error","debug"],cr=class{constructor(e=""){this.loggers={},this.initializeLoggers(e)}initializeLoggers(e){for(let r of la){let n=(0,da.default)(`${e}:${r}`);n.color=this.getPlatformColor(r),this.loggers[r]=n}}getPlatformColor(e){return{node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}}[typeof window!="undefined"?"browser":"node"][e]}info(e,...r){this.loggers.info(e,...r)}warn(e,...r){this.loggers.warn(e,...r)}error(e,...r){this.loggers.error(e,...r)}debug(e,...r){this.loggers.debug(e,...r)}};je.Logger=cr;function fa(t){return new cr(t)}});var zt=y(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var nn;(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})(nn||(k.util=nn={}));var jo;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jo||(k.objectUtil=jo={}));k.ZodParsedType=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var ya=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=ya});var fr=y(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.ZodError=ge.quotelessJson=ge.ZodIssueCode=void 0;var Zo=zt();ge.ZodIssueCode=Zo.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 va=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");ge.quotelessJson=va;var qt=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,Zo.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()}};ge.ZodError=qt;qt.create=t=>new qt(t)});var sn=y(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});var z=fr(),Ze=zt(),ga=(t,e)=>{let r;switch(t.code){case z.ZodIssueCode.invalid_type:t.received===Ze.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case z.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.util.jsonStringifyReplacer)}`;break;case z.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.util.joinValues(t.keys,", ")}`;break;case z.ZodIssueCode.invalid_union:r="Invalid input";break;case z.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.util.joinValues(t.options)}`;break;case z.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.util.joinValues(t.options)}, received '${t.received}'`;break;case z.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case z.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case z.ZodIssueCode.invalid_date:r="Invalid date";break;case z.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ze.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case z.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 z.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 z.ZodIssueCode.custom:r="Invalid input";break;case z.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case z.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case z.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.util.assertNever(t)}return{message:r}};on.default=ga});var pr=y(be=>{"use strict";var ba=be&&be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(be,"__esModule",{value:!0});be.defaultErrorMap=void 0;be.setErrorMap=_a;be.getErrorMap=xa;var ko=ba(sn());be.defaultErrorMap=ko.default;var Ro=ko.default;function _a(t){Ro=t}function xa(){return Ro}});var cn=y(Z=>{"use strict";var wa=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=Ta;var Ca=pr(),Uo=wa(sn()),Ia=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=Ia;Z.EMPTY_PATH=[];function Ta(t,e){let r=(0,Ca.getErrorMap)(),n=(0,Z.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Uo.default?void 0:Uo.default].filter(o=>!!o)});t.common.issues.push(n)}var an=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=an;Z.INVALID=Object.freeze({status:"aborted"});var Sa=t=>({status:"dirty",value:t});Z.DIRTY=Sa;var Aa=t=>({status:"valid",value:t});Z.OK=Aa;var Pa=t=>t.status==="aborted";Z.isAborted=Pa;var Oa=t=>t.status==="dirty";Z.isDirty=Oa;var Ea=t=>t.status==="valid";Z.isValid=Ea;var ja=t=>typeof Promise!="undefined"&&t instanceof Promise;Z.isAsync=ja});var Mo=y(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0})});var Lo=y(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.errorUtil=void 0;var Do;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Do||(mr.errorUtil=Do={}))});var Yo=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=Vo;c.custom=Wo;var p=fr(),hr=pr(),g=Lo(),u=cn(),m=zt(),Q=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zo=(t,e)=>{if((0,u.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new p.ZodError(t.common.issues);return this._error=r,this._error}}};function S(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 A=class{get description(){return this._def.description}_getType(e){return(0,m.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,m.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,m.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,m.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return zo(n,o)}"~validate"(e){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,m.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,m.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,u.isAsync)(o)?o:Promise.resolve(o));return zo(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(d=>d?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new J({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 X.create(this,this._def)}nullable(){return ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return we.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return ze.create(this,e,this._def)}transform(e){return new J({...S(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new He({...S(this._def),innerType:this,defaultValue:r,typeName:I.ZodDefault})}brand(){return new Ft({typeName:I.ZodBranded,type:this,...S(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new We({...S(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 $t.create(this,e)}readonly(){return Be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c.ZodType=A;c.Schema=A;c.ZodSchema=A;var Za=/^c[^\s-]{8,}$/i,ka=/^[0-9a-z]+$/,Ra=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ua=/^[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,Na=/^[a-z0-9_-]{21}$/i,Ma=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Da=/^[-+]?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)?)??$/,La=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,za="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",un,qa=/^(?:(?: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])$/,Fa=/^(?:(?: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])$/,$a=/^(([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]))$/,Va=/^(([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])$/,Ha=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Fo="((\\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])))",Ba=new RegExp(`^${Fo}$`);function $o(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 Ga(t){return new RegExp(`^${$o(t)}$`)}function Vo(t){let e=`${Fo}T${$o(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 Ka(t,e){return!!((e==="v4"||!e)&&qa.test(t)||(e==="v6"||!e)&&$a.test(t))}function Ja(t,e){if(!Ma.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 Ya(t,e){return!!((e==="v4"||!e)&&Fa.test(t)||(e==="v6"||!e)&&Va.test(t))}var _e=class t extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.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")La.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")un||(un=new RegExp(za,"u")),un.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")Ua.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")Na.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")Za.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")ka.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")Ra.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"?Vo(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"?Ba.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"?Ga(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"?Da.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"?Ka(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"?Ja(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"?Ya(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"?Ha.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"?Wa.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,u.addIssueToContext)(o,{validation:"base64url",code:p.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):m.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,...g.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...g.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...g.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...g.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...g.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...g.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...g.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...g.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,g.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:I.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};function Xa(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var ke=class t extends A{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)!==m.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:i.parsedType}),u.INVALID}let n,o=new u.ParseStatus;for(let i of this._def.checks)i.kind==="int"?m.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"?Xa(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()):m.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,g.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,g.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,g.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,g.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:g.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:g.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:g.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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"&&m.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};c.ZodNumber=ke;ke.create=t=>new ke({checks:[],typeName:I.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Re=class t extends A{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)!==m.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()):m.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:m.ZodParsedType.bigint,received:r.parsedType}),u.INVALID}gte(e,r){return this.setLimit("min",e,!0,g.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,g.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,g.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,g.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:g.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:g.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:g.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=Re;Re.create=t=>{var e;return new Re({checks:[],typeName:I.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};var Ue=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodBoolean=Ue;Ue.create=t=>new Ue({typeName:I.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Ne=class t extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(i,{code:p.ZodIssueCode.invalid_type,expected:m.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()):m.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:g.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:g.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};c.ZodDate=Ne;Ne.create=t=>new Ne({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:I.ZodDate,...S(t)});var at=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodSymbol=at;at.create=t=>new at({typeName:I.ZodSymbol,...S(t)});var Me=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodUndefined=Me;Me.create=t=>new Me({typeName:I.ZodUndefined,...S(t)});var De=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodNull=De;De.create=t=>new De({typeName:I.ZodNull,...S(t)});var xe=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodAny=xe;xe.create=t=>new xe({typeName:I.ZodAny,...S(t)});var pe=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,u.OK)(e.data)}};c.ZodUnknown=pe;pe.create=t=>new pe({typeName:I.ZodUnknown,...S(t)});var re=class extends A{_parse(e){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:r.parsedType}),u.INVALID}};c.ZodNever=re;re.create=t=>new re({typeName:I.ZodNever,...S(t)});var ct=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),u.INVALID}return(0,u.OK)(e.data)}};c.ZodVoid=ct;ct.create=t=>new ct({typeName:I.ZodVoid,...S(t)});var me=class t extends A{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==m.ZodParsedType.array)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:r.parsedType}),u.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,u.addIssueToContext)(r,{code:s?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Q(r,s,r.path,a)))).then(s=>u.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Q(r,s,r.path,a)));return u.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:g.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:g.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:g.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};c.ZodArray=me;me.create=(t,e)=>new me({type:t,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...S(e)});function st(t){if(t instanceof G){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=X.create(st(n))}return new G({...t._def,shape:()=>e})}else return t instanceof me?new me({...t._def,type:st(t.element)}):t instanceof X?X.create(st(t.unwrap())):t instanceof ue?ue.create(st(t.unwrap())):t instanceof ce?ce.create(t.items.map(e=>st(e))):t}var G=class t extends A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=m.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==m.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(l,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:l.parsedType}),u.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof re&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let d=[];for(let l of s){let f=i[l],h=o.data[l];d.push({key:{status:"valid",value:l},value:f._parse(new Q(o,h,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof re){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)d.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(l==="strict")a.length>0&&((0,u.addIssueToContext)(o,{code:p.ZodIssueCode.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let f of a){let h=o.data[f];d.push({key:{status:"valid",value:f},value:l._parse(new Q(o,h,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of d){let h=await f.key,C=await f.value;l.push({key:h,value:C,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 g.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=g.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: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 m.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 m.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return st(this)}partial(e){let r={};for(let n of m.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 m.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof X;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Ho(m.util.objectKeys(this.shape))}};c.ZodObject=G;G.create=(t,e)=>new G({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:I.ZodObject,...S(e)});G.strictCreate=(t,e)=>new G({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:I.ZodObject,...S(e)});G.lazycreate=(t,e)=>new G({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:I.ZodObject,...S(e)});var Le=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new p.ZodError(a.ctx.common.issues));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:s}),u.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let d of n){let l={...r,common:{...r.common,issues:[]},parent:null},f=d._parseSync({data:r.data,path:r.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(d=>new p.ZodError(d));return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union,unionErrors:a}),u.INVALID}}get options(){return this._def.options}};c.ZodUnion=Le;Le.create=(t,e)=>new Le({options:t,typeName:I.ZodUnion,...S(e)});var fe=t=>t instanceof qe?fe(t.schema):t instanceof J?fe(t.innerType()):t instanceof Fe?[t.value]:t instanceof $e?t.options:t instanceof Ve?m.util.objectValues(t.enum):t instanceof He?fe(t._def.innerType):t instanceof Me?[void 0]:t instanceof De?[null]:t instanceof X?[void 0,...fe(t.unwrap())]:t instanceof ue?[null,...fe(t.unwrap())]:t instanceof Ft||t instanceof Be?fe(t.unwrap()):t instanceof We?fe(t._def.innerType):[],yr=class t extends A{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.object)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:r.parsedType}),u.INVALID;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):((0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),u.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let s=fe(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new t({typeName:I.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...S(n)})}};c.ZodDiscriminatedUnion=yr;function dn(t,e){let r=(0,m.getParsedType)(t),n=(0,m.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===m.ZodParsedType.object&&n===m.ZodParsedType.object){let o=m.util.objectKeys(e),i=m.util.objectKeys(t).filter(a=>o.indexOf(a)!==-1),s={...t,...e};for(let a of i){let d=dn(t[a],e[a]);if(!d.valid)return{valid:!1};s[a]=d.data}return{valid:!0,data:s}}else if(r===m.ZodParsedType.array&&n===m.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=dn(s,a);if(!d.valid)return{valid:!1};o.push(d.data)}return{valid:!0,data:o}}else return r===m.ZodParsedType.date&&n===m.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ze=class extends A{_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=dn(i.value,s.value);return a.valid?(((0,u.isDirty)(i)||(0,u.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),u.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c.ZodIntersection=ze;ze.create=(t,e,r)=>new ze({left:t,right:e,typeName:I.ZodIntersection,...S(r)});var ce=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),u.INVALID;if(n.data.length<this._def.items.length)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),u.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let d=this._def.items[a]||this._def.rest;return d?d._parse(new Q(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>u.ParseStatus.mergeArray(r,s)):u.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};c.ZodTuple=ce;ce.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:t,typeName:I.ZodTuple,rest:null,...S(e)})};var vr=class t extends A{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!==m.ZodParsedType.object)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),u.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Q(n,a,n.path,a)),value:s._parse(new Q(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?u.ParseStatus.mergeObjectAsync(r,o):u.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof A?new t({keyType:e,valueType:r,typeName:I.ZodRecord,...S(n)}):new t({keyType:_e.create(),valueType:e,typeName:I.ZodRecord,...S(r)})}};c.ZodRecord=vr;var ut=class extends A{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!==m.ZodParsedType.map)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),u.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,d],l)=>({key:o._parse(new Q(n,a,n.path,[l,"key"])),value:i._parse(new Q(n,d,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let d of s){let l=await d.key,f=await d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let d of s){let l=d.key,f=d.value;if(l.status==="aborted"||f.status==="aborted")return u.INVALID;(l.status==="dirty"||f.status==="dirty")&&r.dirty(),a.set(l.value,f.value)}return{status:r.value,value:a}}}};c.ZodMap=ut;ut.create=(t,e,r)=>new ut({valueType:e,keyType:t,typeName:I.ZodMap,...S(r)});var dt=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),u.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&((0,u.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(d){let l=new Set;for(let f of d){if(f.status==="aborted")return u.INVALID;f.status==="dirty"&&r.dirty(),l.add(f.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((d,l)=>i._parse(new Q(n,d,n.path,l)));return n.common.async?Promise.all(a).then(d=>s(d)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:g.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:g.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};c.ZodSet=dt;dt.create=(t,e)=>new dt({valueType:t,minSize:null,maxSize:null,typeName:I.ZodSet,...S(e)});var gr=class t extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.function)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.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,hr.getErrorMap)(),hr.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,hr.getErrorMap)(),hr.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 we){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}),h=await Reflect.apply(s,this,f);return await a._def.returns._def.type.parseAsync(h,i).catch(T=>{throw l.addIssue(o(h,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),h=a._def.returns.safeParse(f,i);if(!h.success)throw new p.ZodError([o(f,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ce.create(e).rest(pe.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||ce.create([]).rest(pe.create()),returns:r||pe.create(),typeName:I.ZodFunction,...S(n)})}};c.ZodFunction=gr;var qe=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};c.ZodLazy=qe;qe.create=(t,e)=>new qe({getter:t,typeName:I.ZodLazy,...S(e)});var Fe=class extends A{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(r,{received:r.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),u.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};c.ZodLiteral=Fe;Fe.create=(t,e)=>new Fe({value:t,typeName:I.ZodLiteral,...S(e)});function Ho(t,e){return new $e({values:t,typeName:I.ZodEnum,...S(e)})}var $e=class t extends A{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,u.addIssueToContext)(r,{expected:m.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=$e;$e.create=Ho;var Ve=class extends A{_parse(e){let r=m.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.ZodParsedType.string&&n.parsedType!==m.ZodParsedType.number){let o=m.util.objectValues(r);return(0,u.addIssueToContext)(n,{expected:m.util.joinValues(o),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),u.INVALID}if(this._cache||(this._cache=new Set(m.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=m.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=Ve;Ve.create=(t,e)=>new Ve({values:t,typeName:I.ZodNativeEnum,...S(e)});var we=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.promise&&r.common.async===!1)return(0,u.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:r.parsedType}),u.INVALID;let n=r.parsedType===m.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=we;we.create=(t,e)=>new we({type:t,typeName:I.ZodPromise,...S(e)});var J=class extends A{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,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);m.util.assertNever(o)}};c.ZodEffects=J;c.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:I.ZodEffects,effect:e,...S(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:I.ZodEffects,...S(r)});var X=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0,u.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodOptional=X;X.create=(t,e)=>new X({innerType:t,typeName:I.ZodOptional,...S(e)});var ue=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0,u.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c.ZodNullable=ue;ue.create=(t,e)=>new ue({innerType:t,typeName:I.ZodNullable,...S(e)});var He=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===m.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};c.ZodDefault=He;He.create=(t,e)=>new He({innerType:t,typeName:I.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var We=class extends A{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,u.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c.ZodCatch=We;We.create=(t,e)=>new We({innerType:t,typeName:I.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var lt=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,u.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),u.INVALID}return{status:"valid",value:e.data}}};c.ZodNaN=lt;lt.create=t=>new lt({typeName:I.ZodNaN,...S(t)});c.BRAND=Symbol("zod_brand");var Ft=class extends A{_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=Ft;var $t=class t extends A{_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:I.ZodPipeline})}};c.ZodPipeline=$t;var Be=class extends A{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,u.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,u.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};c.ZodReadonly=Be;Be.create=(t,e)=>new Be({innerType:t,typeName:I.ZodReadonly,...S(e)});function qo(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Wo(t,e={},r){return t?xe.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 h=qo(e,n),C=(f=(l=h.fatal)!=null?l:r)!=null?f:!0;o.addIssue({code:"custom",...h,fatal:C})}});if(!i){let d=qo(e,n),l=(a=(s=d.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...d,fatal:l})}}):xe.create()}c.late={object:G.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||(c.ZodFirstPartyTypeKind=I={}));var Qa=(t,e={message:`Input not instance of ${t.name}`})=>Wo(r=>r instanceof t,e);c.instanceof=Qa;var Bo=_e.create;c.string=Bo;var Go=ke.create;c.number=Go;var ec=lt.create;c.nan=ec;var tc=Re.create;c.bigint=tc;var Ko=Ue.create;c.boolean=Ko;var rc=Ne.create;c.date=rc;var nc=at.create;c.symbol=nc;var oc=Me.create;c.undefined=oc;var ic=De.create;c.null=ic;var sc=xe.create;c.any=sc;var ac=pe.create;c.unknown=ac;var cc=re.create;c.never=cc;var uc=ct.create;c.void=uc;var dc=me.create;c.array=dc;var lc=G.create;c.object=lc;var fc=G.strictCreate;c.strictObject=fc;var pc=Le.create;c.union=pc;var mc=yr.create;c.discriminatedUnion=mc;var hc=ze.create;c.intersection=hc;var yc=ce.create;c.tuple=yc;var vc=vr.create;c.record=vc;var gc=ut.create;c.map=gc;var bc=dt.create;c.set=bc;var _c=gr.create;c.function=_c;var xc=qe.create;c.lazy=xc;var wc=Fe.create;c.literal=wc;var Cc=$e.create;c.enum=Cc;var Ic=Ve.create;c.nativeEnum=Ic;var Tc=we.create;c.promise=Tc;var Jo=J.create;c.effect=Jo;c.transformer=Jo;var Sc=X.create;c.optional=Sc;var Ac=ue.create;c.nullable=Ac;var Pc=J.createWithPreprocess;c.preprocess=Pc;var Oc=$t.create;c.pipeline=Oc;var Ec=()=>Bo().optional();c.ostring=Ec;var jc=()=>Go().optional();c.onumber=jc;var Zc=()=>Ko().optional();c.oboolean=Zc;c.coerce={string:(t=>_e.create({...t,coerce:!0})),number:(t=>ke.create({...t,coerce:!0})),boolean:(t=>Ue.create({...t,coerce:!0})),bigint:(t=>Re.create({...t,coerce:!0})),date:(t=>Ne.create({...t,coerce:!0}))};c.NEVER=u.INVALID});var ln=y(ee=>{"use strict";var kc=ee&&ee.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),ft=ee&&ee.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kc(e,t,r)};Object.defineProperty(ee,"__esModule",{value:!0});ft(pr(),ee);ft(cn(),ee);ft(Mo(),ee);ft(zt(),ee);ft(Yo(),ee);ft(fr(),ee)});var R=y(K=>{"use strict";var Xo=K&&K.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Rc=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Uc=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xo(e,t,r);return Rc(e,t),e},Nc=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xo(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var Qo=Uc(ln());K.z=Qo;Nc(ln(),K);K.default=Qo});var fn=y(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.actionTypesZodSchema=pt.ActionTypes=void 0;var Mc=R(),ei;(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"})(ei||(pt.ActionTypes=ei={}));pt.actionTypesZodSchema=Mc.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var pn=y(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.semanticActionStateTypesZodSchema=mt.SemanticActionStateTypes=void 0;var Dc=R(),ti;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(ti||(mt.SemanticActionStateTypes=ti={}));mt.semanticActionStateTypesZodSchema=Dc.z.enum(["start","continue","done"])});var mn=y(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.attachmentLayoutTypesZodSchema=ht.AttachmentLayoutTypes=void 0;var Lc=R(),ri;(function(t){t.List="list",t.Carousel="carousel"})(ri||(ht.AttachmentLayoutTypes=ri={}));ht.attachmentLayoutTypesZodSchema=Lc.z.enum(["list","carousel"])});var hn=y(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.Channels=void 0;var ni;(function(t){t.Agents="agents",t.Alexa="alexa",t.Console="console",t.Directline="directline",t.DirectlineSpeech="directlinespeech",t.Email="email",t.Emulator="emulator",t.Facebook="facebook",t.Groupme="groupme",t.Line="line",t.Msteams="msteams",t.M365CopilotSubChannel="COPILOT",t.M365Copilot="msteams:COPILOT",t.Omni="omnichannel",t.Outlook="outlook",t.Skype="skype",t.Slack="slack",t.Sms="sms",t.Telegram="telegram",t.Telephony="telephony",t.Test="test",t.Webchat="webchat"})(ni||(br.Channels=ni={}))});var yn=y(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.endOfConversationCodesZodSchema=yt.EndOfConversationCodes=void 0;var zc=R(),oi;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(oi||(yt.EndOfConversationCodes=oi={}));yt.endOfConversationCodesZodSchema=zc.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var si=y(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.MembershipSourceTypes=void 0;var ii;(function(t){t.Channel="channel",t.Team="team"})(ii||(_r.MembershipSourceTypes=ii={}))});var ci=y(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.MembershipTypes=void 0;var ai;(function(t){t.Direct="direct",t.Transitive="transitive"})(ai||(xr.MembershipTypes=ai={}))});var Vt=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.roleTypeZodSchema=vt.RoleTypes=void 0;var qc=R(),ui;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(ui||(vt.RoleTypes=ui={}));vt.roleTypeZodSchema=qc.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var di=y(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.addAIToActivity=void 0;var Fc=(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)};wr.addAIToActivity=Fc});var li=y(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.adaptiveCardInvokeActionZodSchema=void 0;var Ge=R();Cr.adaptiveCardInvokeActionZodSchema=Ge.z.object({type:Ge.z.string().min(1),id:Ge.z.string().optional(),verb:Ge.z.string().min(1),data:Ge.z.record(Ge.z.string().min(1),Ge.z.any())})});var fi=y(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var pi=y(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.default="00000000-0000-0000-0000-000000000000"});var mi=y(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.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 Ht=y(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});var $c=mi();function Vc(t){return typeof t=="string"&&$c.default.test(t)}_n.default=Vc});var Wt=y(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});var Hc=Ht();function Wc(t){if(!(0,Hc.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)}xn.default=Wc});var he=y(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.unsafeStringify=void 0;var Bc=Ht(),D=[];for(let t=0;t<256;++t)D.push((t+256).toString(16).slice(1));function hi(t,e=0){return(D[t[e+0]]+D[t[e+1]]+D[t[e+2]]+D[t[e+3]]+"-"+D[t[e+4]]+D[t[e+5]]+"-"+D[t[e+6]]+D[t[e+7]]+"-"+D[t[e+8]]+D[t[e+9]]+"-"+D[t[e+10]]+D[t[e+11]]+D[t[e+12]]+D[t[e+13]]+D[t[e+14]]+D[t[e+15]]).toLowerCase()}Bt.unsafeStringify=hi;function Gc(t,e=0){let r=hi(t,e);if(!(0,Bc.default)(r))throw TypeError("Stringified UUID is invalid");return r}Bt.default=Gc});var Ir=y(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var wn,Kc=new Uint8Array(16);function Jc(){if(!wn){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");wn=crypto.getRandomValues.bind(crypto)}return wn(Kc)}Cn.default=Jc});var In=y(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.updateV1State=void 0;var yi=Ir(),Yc=he(),Gt={};function Xc(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=vi((d=(a=t.random)!=null?a:(s=t.rng)==null?void 0:s.call(t))!=null?d:(0,yi.default)(),t.msecs,t.nsecs,t.clockseq,t.node,e,r);else{let l=Date.now(),f=(0,yi.default)();gi(Gt,l,f),n=vi(f,Gt.msecs,Gt.nsecs,o?void 0:Gt.clockseq,o?void 0:Gt.node,e,r)}return e!=null?e:(0,Yc.unsafeStringify)(n)}function gi(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}Kt.updateV1State=gi;function vi(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}Kt.default=Xc});var Sn=y(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});var Qc=Wt(),eu=he();function tu(t){let e=typeof t=="string"?(0,Qc.default)(t):t,r=ru(e);return typeof t=="string"?(0,eu.unsafeStringify)(r):r}Tn.default=tu;function ru(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 _i=y(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});function nu(t){let e=su(t),r=iu(e,t.length*8);return ou(r)}function ou(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 bi(t){return(t+64>>>9<<4)+14+1}function iu(t,e){let r=new Uint32Array(bi(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,h=s;n=q(n,o,i,s,t[a],7,-680876936),s=q(s,n,o,i,t[a+1],12,-389564586),i=q(i,s,n,o,t[a+2],17,606105819),o=q(o,i,s,n,t[a+3],22,-1044525330),n=q(n,o,i,s,t[a+4],7,-176418897),s=q(s,n,o,i,t[a+5],12,1200080426),i=q(i,s,n,o,t[a+6],17,-1473231341),o=q(o,i,s,n,t[a+7],22,-45705983),n=q(n,o,i,s,t[a+8],7,1770035416),s=q(s,n,o,i,t[a+9],12,-1958414417),i=q(i,s,n,o,t[a+10],17,-42063),o=q(o,i,s,n,t[a+11],22,-1990404162),n=q(n,o,i,s,t[a+12],7,1804603682),s=q(s,n,o,i,t[a+13],12,-40341101),i=q(i,s,n,o,t[a+14],17,-1502002290),o=q(o,i,s,n,t[a+15],22,1236535329),n=F(n,o,i,s,t[a+1],5,-165796510),s=F(s,n,o,i,t[a+6],9,-1069501632),i=F(i,s,n,o,t[a+11],14,643717713),o=F(o,i,s,n,t[a],20,-373897302),n=F(n,o,i,s,t[a+5],5,-701558691),s=F(s,n,o,i,t[a+10],9,38016083),i=F(i,s,n,o,t[a+15],14,-660478335),o=F(o,i,s,n,t[a+4],20,-405537848),n=F(n,o,i,s,t[a+9],5,568446438),s=F(s,n,o,i,t[a+14],9,-1019803690),i=F(i,s,n,o,t[a+3],14,-187363961),o=F(o,i,s,n,t[a+8],20,1163531501),n=F(n,o,i,s,t[a+13],5,-1444681467),s=F(s,n,o,i,t[a+2],9,-51403784),i=F(i,s,n,o,t[a+7],14,1735328473),o=F(o,i,s,n,t[a+12],20,-1926607734),n=$(n,o,i,s,t[a+5],4,-378558),s=$(s,n,o,i,t[a+8],11,-2022574463),i=$(i,s,n,o,t[a+11],16,1839030562),o=$(o,i,s,n,t[a+14],23,-35309556),n=$(n,o,i,s,t[a+1],4,-1530992060),s=$(s,n,o,i,t[a+4],11,1272893353),i=$(i,s,n,o,t[a+7],16,-155497632),o=$(o,i,s,n,t[a+10],23,-1094730640),n=$(n,o,i,s,t[a+13],4,681279174),s=$(s,n,o,i,t[a],11,-358537222),i=$(i,s,n,o,t[a+3],16,-722521979),o=$(o,i,s,n,t[a+6],23,76029189),n=$(n,o,i,s,t[a+9],4,-640364487),s=$(s,n,o,i,t[a+12],11,-421815835),i=$(i,s,n,o,t[a+15],16,530742520),o=$(o,i,s,n,t[a+2],23,-995338651),n=V(n,o,i,s,t[a],6,-198630844),s=V(s,n,o,i,t[a+7],10,1126891415),i=V(i,s,n,o,t[a+14],15,-1416354905),o=V(o,i,s,n,t[a+5],21,-57434055),n=V(n,o,i,s,t[a+12],6,1700485571),s=V(s,n,o,i,t[a+3],10,-1894986606),i=V(i,s,n,o,t[a+10],15,-1051523),o=V(o,i,s,n,t[a+1],21,-2054922799),n=V(n,o,i,s,t[a+8],6,1873313359),s=V(s,n,o,i,t[a+15],10,-30611744),i=V(i,s,n,o,t[a+6],15,-1560198380),o=V(o,i,s,n,t[a+13],21,1309151649),n=V(n,o,i,s,t[a+4],6,-145523070),s=V(s,n,o,i,t[a+11],10,-1120210379),i=V(i,s,n,o,t[a+2],15,718787259),o=V(o,i,s,n,t[a+9],21,-343485551),n=Ce(n,d),o=Ce(o,l),i=Ce(i,f),s=Ce(s,h)}return Uint32Array.of(n,o,i,s)}function su(t){if(t.length===0)return new Uint32Array;let e=new Uint32Array(bi(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 Ce(t,e){let r=(t&65535)+(e&65535);return(t>>16)+(e>>16)+(r>>16)<<16|r&65535}function au(t,e){return t<<e|t>>>32-e}function Tr(t,e,r,n,o,i){return Ce(au(Ce(Ce(e,t),Ce(n,i)),o),r)}function q(t,e,r,n,o,i,s){return Tr(e&r|~e&n,t,e,o,i,s)}function F(t,e,r,n,o,i,s){return Tr(e&n|r&~n,t,e,o,i,s)}function $(t,e,r,n,o,i,s){return Tr(e^r^n,t,e,o,i,s)}function V(t,e,r,n,o,i,s){return Tr(r^(e|~n),t,e,o,i,s)}An.default=nu});var Jt=y(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.URL=ye.DNS=ye.stringToBytes=void 0;var xi=Wt(),cu=he();function wi(t){t=unescape(encodeURIComponent(t));let e=new Uint8Array(t.length);for(let r=0;r<t.length;++r)e[r]=t.charCodeAt(r);return e}ye.stringToBytes=wi;ye.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";ye.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function uu(t,e,r,n,o,i){let s=typeof r=="string"?wi(r):r,a=typeof n=="string"?(0,xi.default)(n):n;if(typeof n=="string"&&(n=(0,xi.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,cu.unsafeStringify)(d)}ye.default=uu});var Ii=y(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.URL=Ke.DNS=void 0;var du=_i(),Pn=Jt(),Ci=Jt();Object.defineProperty(Ke,"DNS",{enumerable:!0,get:function(){return Ci.DNS}});Object.defineProperty(Ke,"URL",{enumerable:!0,get:function(){return Ci.URL}});function On(t,e,r,n){return(0,Pn.default)(48,du.default,t,e,r,n)}On.DNS=Pn.DNS;On.URL=Pn.URL;Ke.default=On});var Ti=y(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});var lu=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);En.default={randomUUID:lu}});var Ai=y(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var Si=Ti(),fu=Ir(),pu=he();function mu(t,e,r){var o,i,s;if(Si.default.randomUUID&&!e&&!t)return Si.default.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,fu.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,pu.unsafeStringify)(n)}jn.default=mu});var Pi=y(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});function hu(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 Zn(t,e){return t<<e|t>>>32-e}function yu(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 P=0;P<16;++P)d[P]=s[a][P];for(let P=16;P<80;++P)d[P]=Zn(d[P-3]^d[P-8]^d[P-14]^d[P-16],1);let l=r[0],f=r[1],h=r[2],C=r[3],T=r[4];for(let P=0;P<80;++P){let v=Math.floor(P/20),b=Zn(l,5)+hu(v,f,h,C)+T+e[v]+d[P]>>>0;T=C,C=h,h=Zn(f,30)>>>0,f=l,l=b}r[0]=r[0]+l>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+h>>>0,r[3]=r[3]+C>>>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])}kn.default=yu});var Ei=y(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.URL=Je.DNS=void 0;var vu=Pi(),Rn=Jt(),Oi=Jt();Object.defineProperty(Je,"DNS",{enumerable:!0,get:function(){return Oi.DNS}});Object.defineProperty(Je,"URL",{enumerable:!0,get:function(){return Oi.URL}});function Un(t,e,r,n){return(0,Rn.default)(80,vu.default,t,e,r,n)}Un.DNS=Rn.DNS;Un.URL=Rn.URL;Je.default=Un});var ji=y(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});var gu=he(),bu=In(),_u=Sn();function xu(t,e,r){t!=null||(t={}),r!=null||(r=0);let n=(0,bu.default)({...t,_v6:!0},new Uint8Array(16));if(n=(0,_u.default)(n),e){for(let o=0;o<16;o++)e[r+o]=n[o];return e}return(0,gu.unsafeStringify)(n)}Nn.default=xu});var Zi=y(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});var wu=Wt(),Cu=he();function Iu(t){let e=typeof t=="string"?(0,wu.default)(t):t,r=Tu(e);return typeof t=="string"?(0,Cu.unsafeStringify)(r):r}Mn.default=Iu;function Tu(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 Ni=y(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.updateV7State=void 0;var ki=Ir(),Su=he(),Dn={};function Au(t,e,r){var o,i,s;let n;if(t)n=Ri((s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:(0,ki.default)(),t.msecs,t.seq,e,r);else{let a=Date.now(),d=(0,ki.default)();Ui(Dn,a,d),n=Ri(d,Dn.msecs,Dn.seq,e,r)}return e!=null?e:(0,Su.unsafeStringify)(n)}function Ui(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}Yt.updateV7State=Ui;function Ri(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}Yt.default=Au});var Mi=y(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});var Pu=Ht();function Ou(t){if(!(0,Pu.default)(t))throw TypeError("Invalid UUID");return parseInt(t.slice(14,15),16)}Ln.default=Ou});var Di=y(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 Eu=fi();Object.defineProperty(j,"MAX",{enumerable:!0,get:function(){return Eu.default}});var ju=pi();Object.defineProperty(j,"NIL",{enumerable:!0,get:function(){return ju.default}});var Zu=Wt();Object.defineProperty(j,"parse",{enumerable:!0,get:function(){return Zu.default}});var ku=he();Object.defineProperty(j,"stringify",{enumerable:!0,get:function(){return ku.default}});var Ru=In();Object.defineProperty(j,"v1",{enumerable:!0,get:function(){return Ru.default}});var Uu=Sn();Object.defineProperty(j,"v1ToV6",{enumerable:!0,get:function(){return Uu.default}});var Nu=Ii();Object.defineProperty(j,"v3",{enumerable:!0,get:function(){return Nu.default}});var Mu=Ai();Object.defineProperty(j,"v4",{enumerable:!0,get:function(){return Mu.default}});var Du=Ei();Object.defineProperty(j,"v5",{enumerable:!0,get:function(){return Du.default}});var Lu=ji();Object.defineProperty(j,"v6",{enumerable:!0,get:function(){return Lu.default}});var zu=Zi();Object.defineProperty(j,"v6ToV1",{enumerable:!0,get:function(){return zu.default}});var qu=Ni();Object.defineProperty(j,"v7",{enumerable:!0,get:function(){return qu.default}});var Fu=Ht();Object.defineProperty(j,"validate",{enumerable:!0,get:function(){return Fu.default}});var $u=Mi();Object.defineProperty(j,"version",{enumerable:!0,get:function(){return $u.default}})});var zn=y(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.entityZodSchema=void 0;var Li=R();Sr.entityZodSchema=Li.z.object({type:Li.z.string().min(1)}).passthrough()});var zi=y(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.semanticActionZodSchema=void 0;var Xt=R(),Vu=zn(),Hu=pn();Ar.semanticActionZodSchema=Xt.z.object({id:Xt.z.string().min(1),state:Xt.z.union([Hu.semanticActionStateTypesZodSchema,Xt.z.string().min(1)]),entities:Xt.z.record(Vu.entityZodSchema)})});var qi=y(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.cardActionZodSchema=void 0;var de=R(),Wu=fn();Pr.cardActionZodSchema=de.z.object({type:de.z.union([Wu.actionTypesZodSchema,de.z.string().min(1)]),title:de.z.string().min(1),image:de.z.string().min(1).optional(),text:de.z.string().min(1).optional(),displayText:de.z.string().min(1).optional(),value:de.z.any().optional(),channelData:de.z.unknown().optional(),imageAltText:de.z.string().min(1).optional()})});var Fi=y(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.suggestedActionsZodSchema=void 0;var Or=R(),Bu=qi();Er.suggestedActionsZodSchema=Or.z.object({to:Or.z.array(Or.z.string().min(1)),actions:Or.z.array(Bu.cardActionZodSchema)})});var qn=y(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.activityEventNamesZodSchema=gt.ActivityEventNames=void 0;var Gu=R(),$i;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})($i||(gt.ActivityEventNames=$i={}));gt.activityEventNamesZodSchema=Gu.z.enum(["ContinueConversation","CreateConversation"])});var Fn=y(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.activityImportanceZodSchema=bt.ActivityImportance=void 0;var Ku=R(),Vi;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Vi||(bt.ActivityImportance=Vi={}));bt.activityImportanceZodSchema=Ku.z.enum(["low","normal","high"])});var $n=y(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.activityTypesZodSchema=_t.ActivityTypes=void 0;var Ju=R(),Hi;(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"})(Hi||(_t.ActivityTypes=Hi={}));_t.activityTypesZodSchema=Ju.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Wi=y(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.attachmentZodSchema=void 0;var xt=R();jr.attachmentZodSchema=xt.z.object({contentType:xt.z.string().min(1),contentUrl:xt.z.string().min(1).optional(),content:xt.z.unknown().optional(),name:xt.z.string().min(1).optional(),thumbnailUrl:xt.z.string().min(1).optional()})});var Bi=y(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.addProductInfoToActivity=Ye.clearProductInfoFromActivity=void 0;var Yu=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};Ye.clearProductInfoFromActivity=Yu;var Xu=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,Ye.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};Ye.addProductInfoToActivity=Xu});var Vn=y(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.channelAccountZodSchema=void 0;var ne=R(),Qu=Vt();Zr.channelAccountZodSchema=ne.z.object({id:ne.z.string().min(1).optional(),name:ne.z.string().optional(),aadObjectId:ne.z.string().min(1).optional(),tenantId:ne.z.string().min(1).optional(),agenticUserId:ne.z.string().min(1).optional(),agenticAppId:ne.z.string().min(1).optional(),agenticAppBlueprintId:ne.z.string().min(1).optional(),role:ne.z.union([Qu.roleTypeZodSchema,ne.z.string().min(1)]).optional(),properties:ne.z.unknown().optional()})});var Hn=y(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.conversationAccountZodSchema=void 0;var le=R(),ed=Vt();kr.conversationAccountZodSchema=le.z.object({isGroup:le.z.boolean().optional(),conversationType:le.z.string().min(1).optional(),tenantId:le.z.string().min(1).optional(),id:le.z.string().min(1),name:le.z.string().min(1).optional(),aadObjectId:le.z.string().min(1).optional(),role:le.z.union([ed.roleTypeZodSchema,le.z.string().min(1)]).optional(),properties:le.z.unknown().optional()})});var Ki=y(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.conversationReferenceZodSchema=void 0;var Qt=R(),Gi=Vn(),td=Hn();Rr.conversationReferenceZodSchema=Qt.z.object({activityId:Qt.z.string().min(1).optional(),user:Gi.channelAccountZodSchema.optional(),locale:Qt.z.string().min(1).optional(),agent:Gi.channelAccountZodSchema.optional().nullable(),conversation:td.conversationAccountZodSchema,channelId:Qt.z.string().min(1),serviceUrl:Qt.z.string().min(1).optional()})});var Wn=y(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.deliveryModesZodSchema=wt.DeliveryModes=void 0;var rd=R(),Ji;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(Ji||(wt.DeliveryModes=Ji={}));wt.deliveryModesZodSchema=rd.z.enum(["normal","notification","expectReplies","ephemeral"])});var Bn=y(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.inputHintsZodSchema=Ct.InputHints=void 0;var nd=R(),Yi;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Yi||(Ct.InputHints=Yi={}));Ct.inputHintsZodSchema=nd.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var Gn=y(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.messageReactionTypesZodSchema=It.MessageReactionTypes=void 0;var od=R(),Xi;(function(t){t.Like="like",t.PlusOne="plusOne"})(Xi||(It.MessageReactionTypes=Xi={}));It.messageReactionTypesZodSchema=od.z.enum(["like","plusOne"])});var Qi=y(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.messageReactionZodSchema=void 0;var Kn=R(),id=Gn();Ur.messageReactionZodSchema=Kn.z.object({type:Kn.z.union([id.messageReactionTypesZodSchema,Kn.z.string().min(1)])})});var Jn=y(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.textFormatTypesZodSchema=Tt.TextFormatTypes=void 0;var sd=R(),es;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(es||(Tt.TextFormatTypes=es={}));Tt.textFormatTypesZodSchema=sd.z.enum(["markdown","plain","xml"])});var ts=y(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.textHighlightZodSchema=void 0;var Yn=R();Nr.textHighlightZodSchema=Yn.z.object({text:Yn.z.string().min(1),occurrence:Yn.z.number()})});var Xn=y(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.ExceptionHelper=void 0;var Mr=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(h=>{s=s.replace(`{${h}}`,o[h])});let d=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${d}`,f=new e(l);return f.code=r.code,f.helpLink=d,n&&(f.innerException=n),f}};Dr.ExceptionHelper=Mr;Mr.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Qn=y(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.Errors=void 0;Lr.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var as=y(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Activity=Xe.activityZodSchema=void 0;var ad=Di(),x=R(),cd=zi(),ud=Fi(),ss=qn(),dd=Fn(),qr=$n(),ld=Wi(),fd=mn(),rs=Bi(),zr=Vn(),ns=hn(),pd=Hn(),md=Ki(),hd=yn(),yd=Wn(),vd=zn(),gd=Bn(),os=Qi(),bd=Jn(),_d=ts(),is=Vt(),Ie=Xn(),Te=Qn();Xe.activityZodSchema=x.z.object({type:x.z.union([qr.activityTypesZodSchema,x.z.string().min(1)]),text:x.z.string().optional(),id:x.z.string().min(1).optional(),channelId:x.z.string().min(1).optional(),from:zr.channelAccountZodSchema.optional(),timestamp:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:x.z.string().min(1).optional(),callerId:x.z.string().min(1).optional(),serviceUrl:x.z.string().min(1).optional(),conversation:pd.conversationAccountZodSchema.optional(),recipient:zr.channelAccountZodSchema.optional(),textFormat:x.z.union([bd.textFormatTypesZodSchema,x.z.string().min(1)]).optional(),attachmentLayout:x.z.union([fd.attachmentLayoutTypesZodSchema,x.z.string().min(1)]).optional(),membersAdded:x.z.array(zr.channelAccountZodSchema).optional(),membersRemoved:x.z.array(zr.channelAccountZodSchema).optional(),reactionsAdded:x.z.array(os.messageReactionZodSchema).optional(),reactionsRemoved:x.z.array(os.messageReactionZodSchema).optional(),topicName:x.z.string().min(1).optional(),historyDisclosed:x.z.boolean().optional(),locale:x.z.string().min(1).optional(),speak:x.z.string().min(1).optional(),inputHint:x.z.union([gd.inputHintsZodSchema,x.z.string().min(1)]).optional(),summary:x.z.string().min(1).optional(),suggestedActions:ud.suggestedActionsZodSchema.optional(),attachments:x.z.array(ld.attachmentZodSchema).optional(),entities:x.z.array(vd.entityZodSchema.passthrough()).optional(),channelData:x.z.any().optional(),action:x.z.string().min(1).optional(),replyToId:x.z.string().min(1).optional(),label:x.z.string().min(1).optional(),valueType:x.z.string().min(1).optional(),value:x.z.unknown().optional(),name:x.z.union([ss.activityEventNamesZodSchema,x.z.string().min(1)]).optional(),relatesTo:md.conversationReferenceZodSchema.optional(),code:x.z.union([hd.endOfConversationCodesZodSchema,x.z.string().min(1)]).optional(),expiration:x.z.union([x.z.date(),x.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:x.z.union([dd.activityImportanceZodSchema,x.z.string().min(1)]).optional(),deliveryMode:x.z.union([yd.deliveryModesZodSchema,x.z.string().min(1)]).optional(),listenFor:x.z.array(x.z.string().min(1)).optional(),textHighlights:x.z.array(_d.textHighlightZodSchema).optional(),semanticAction:cd.semanticActionZodSchema.optional()});var eo=class t{constructor(e){if(e===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeUndefined);if(e===null)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=Xe.activityZodSchema.passthrough().parse(e),n=new t(r.type);return Object.assign(n,r),n}get channelId(){var e;return(e=this._channelId)===null||e===void 0?void 0:e.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(e){let r,n;return e&&e.indexOf(":")!==-1?(r=e.substring(0,e.indexOf(":")),n=e.substring(e.indexOf(":")+1)):r=e,[r,n]}set channelId(e){let[r,n]=t.parseChannelId(e);if(e&&!r)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,rs.addProductInfoToActivity)(this,n):(0,rs.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 Ie.ExceptionHelper.generateException(Error,Te.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:qr.ActivityTypes.Event,name:ss.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,ad.v4)(),channelId:e.channelId,locale:e.locale,serviceUrl:e.serviceUrl,conversation:e.conversation,recipient:e.agent,from:e.user,relatesTo:e};return t.fromObject(n)}getAppropriateReplyToId(){if(this.type!==qr.ActivityTypes.ConversationUpdate||this.channelId!==ns.Channels.Directline&&this.channelId!==ns.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Ie.ExceptionHelper.generateException(Error,Te.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(e,r=!1){var n,o,i;return this.channelId=e.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=e.locale),this.serviceUrl=e.serviceUrl,this.conversation=e.conversation,r?(this.from=e.user,this.recipient=(o=e.agent)!==null&&o!==void 0?o:void 0,e.activityId&&(this.id=e.activityId)):(this.from=(i=e.agent)!==null&&i!==void 0?i:void 0,this.recipient=e.user,e.activityId&&(this.replyToId=e.activityId)),this}clone(){let e=JSON.parse(JSON.stringify(this));for(let r in e)typeof e[r]=="string"&&!isNaN(Date.parse(e[r]))&&(e[r]=new Date(e[r]));return Object.setPrototypeOf(e,t.prototype),e}getMentions(e){let r=[];if(e.entities!==void 0)for(let n=0;n<e.entities.length;n++)e.entities[n].type.toLowerCase()==="mention"&&r.push(e.entities[n]);return r}normalizeMentions(e=!1){var r,n;if(this.type===qr.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),d=e.substring(0,n);d.length>0&&!/\s$/.test(d)&&(d+=" "),e=d+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}getReplyConversationReference(e){let r=this.getConversationReference();return r.activityId=e,r}toJsonString(e,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,e,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===is.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===is.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var e,r,n;return(r=(e=this.recipient)===null||e===void 0?void 0:e.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticAppId}getAgenticUser(){var e;if(this.isAgenticRequest())return(e=this.recipient)===null||e===void 0?void 0:e.agenticUserId}};Xe.Activity=eo});var us=y(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.ActivityTreatments=void 0;var cs;(function(t){t.Targeted="targeted"})(cs||(Fr.ActivityTreatments=cs={}))});var to=y(w=>{"use strict";var xd=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]})),ds=w&&w.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xd(e,t,r)};Object.defineProperty(w,"__esModule",{value:!0});w.ActivityErrors=w.ExceptionHelper=w.Logger=w.debug=w.ActivityTreatments=w.TextFormatTypes=w.MessageReactionTypes=w.InputHints=w.DeliveryModes=w.ActivityTypes=w.ActivityImportance=w.ActivityEventNames=w.activityZodSchema=w.Activity=w.RoleTypes=w.MembershipTypes=w.MembershipSourceTypes=w.EndOfConversationCodes=w.Channels=w.AttachmentLayoutTypes=w.SemanticActionStateTypes=w.ActionTypes=void 0;var wd=fn();Object.defineProperty(w,"ActionTypes",{enumerable:!0,get:function(){return wd.ActionTypes}});var Cd=pn();Object.defineProperty(w,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Cd.SemanticActionStateTypes}});var Id=mn();Object.defineProperty(w,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Id.AttachmentLayoutTypes}});var Td=hn();Object.defineProperty(w,"Channels",{enumerable:!0,get:function(){return Td.Channels}});var Sd=yn();Object.defineProperty(w,"EndOfConversationCodes",{enumerable:!0,get:function(){return Sd.EndOfConversationCodes}});var Ad=si();Object.defineProperty(w,"MembershipSourceTypes",{enumerable:!0,get:function(){return Ad.MembershipSourceTypes}});var Pd=ci();Object.defineProperty(w,"MembershipTypes",{enumerable:!0,get:function(){return Pd.MembershipTypes}});var Od=Vt();Object.defineProperty(w,"RoleTypes",{enumerable:!0,get:function(){return Od.RoleTypes}});ds(di(),w);ds(li(),w);var ls=as();Object.defineProperty(w,"Activity",{enumerable:!0,get:function(){return ls.Activity}});Object.defineProperty(w,"activityZodSchema",{enumerable:!0,get:function(){return ls.activityZodSchema}});var Ed=qn();Object.defineProperty(w,"ActivityEventNames",{enumerable:!0,get:function(){return Ed.ActivityEventNames}});var jd=Fn();Object.defineProperty(w,"ActivityImportance",{enumerable:!0,get:function(){return jd.ActivityImportance}});var Zd=$n();Object.defineProperty(w,"ActivityTypes",{enumerable:!0,get:function(){return Zd.ActivityTypes}});var kd=Wn();Object.defineProperty(w,"DeliveryModes",{enumerable:!0,get:function(){return kd.DeliveryModes}});var Rd=Bn();Object.defineProperty(w,"InputHints",{enumerable:!0,get:function(){return Rd.InputHints}});var Ud=Gn();Object.defineProperty(w,"MessageReactionTypes",{enumerable:!0,get:function(){return Ud.MessageReactionTypes}});var Nd=Jn();Object.defineProperty(w,"TextFormatTypes",{enumerable:!0,get:function(){return Nd.TextFormatTypes}});var Md=us();Object.defineProperty(w,"ActivityTreatments",{enumerable:!0,get:function(){return Md.ActivityTreatments}});var fs=Mt();Object.defineProperty(w,"debug",{enumerable:!0,get:function(){return fs.debug}});Object.defineProperty(w,"Logger",{enumerable:!0,get:function(){return fs.Logger}});var Dd=Xn();Object.defineProperty(w,"ExceptionHelper",{enumerable:!0,get:function(){return Dd.ExceptionHelper}});var Ld=Qn();Object.defineProperty(w,"ActivityErrors",{enumerable:!0,get:function(){return Ld.Errors}})});var Ut=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(Ut||{});var Nt=(_=>(_.Unknown="Unknown",_.Exp="Exp",_.Dev="Dev",_.Test="Test",_.Preprod="Preprod",_.FirstRelease="FirstRelease",_.Prod="Prod",_.Gov="Gov",_.High="High",_.DoD="DoD",_.Mooncake="Mooncake",_.Ex="Ex",_.Rx="Rx",_.Prv="Prv",_.Local="Local",_.GovFR="GovFR",_.Other="Other",_))(Nt||{});var Xr=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},Qr=class extends Xr{constructor(e){var i,s,a;if(super(),!e)return;let r=((i=e.cloud)==null?void 0:i.trim())||"Prod",n=((s=e.copilotAgentType)==null?void 0:s.trim())||"Published",o=((a=e.authority)==null?void 0:a.trim())||"https://login.microsoftonline.com";if(!Object.values(Nt).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(Nt).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})}},il=()=>{var t,e,r,n,o,i,s,a;return new Qr({appClientId:(t=process.env.appClientId)!=null?t:"",tenantId:(e=process.env.tenantId)!=null?e:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((s=process.env.useExperimentalEndpoint)==null?void 0:s.toLowerCase())==="true",enableDiagnostics:((a=process.env.enableDiagnostics)==null?void 0:a.toLowerCase())==="true"})};var or=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function en(t){}function _o(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=en,onError:r=en,onRetry:n=en,onComment:o}=t,i="",s=!0,a,d="",l="";function f(v){let b=s?v.replace(/^\xEF\xBB\xBF/,""):v,[_,O]=Vs(`${i}${b}`);for(let E of _)h(E);i=O,s=!1}function h(v){if(v===""){T();return}if(v.startsWith(":")){o&&o(v.slice(v.startsWith(": ")?2:1));return}let b=v.indexOf(":");if(b!==-1){let _=v.slice(0,b),O=v[b+1]===" "?2:1,E=v.slice(b+O);C(_,E,v);return}C(v,"",v)}function C(v,b,_){switch(v){case"event":l=b;break;case"data":d=`${d}${b}
|
|
2
|
-
`;break;case"id":
|
|
3
|
-
`)?
|
|
4
|
-
`,n),
|
|
5
|
-
`&&n++}}return[e,r]}var xo="connecting",Hs="open",tn="closed",ir=()=>{};function Ws(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=ir,onConnect:i=ir,onDisconnect:s=ir,onScheduleReconnect:a=ir}=r,{fetch:d,url:l,initialLastEventId:f}=Bs(r),h={...r.headers},C=[],T=n?[n]:[],P=U=>T.forEach(se=>se(U)),v=_o({onEvent:Us,onRetry:Ns,onComment:o}),b,_=l.toString(),O=new AbortController,E=f,N=2e3,ie,H=tn;return Y(),{close:Pe,connect:Y,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Yr,get lastEventId(){return E},get url(){return _},get readyState(){return H}};function Y(){b||(H=xo,O=new AbortController,b=d(l,Ms()).then(Rs).catch(U=>{b=null,!(U.name==="AbortError"||U.type==="aborted"||O.signal.aborted)&&yo()}))}function Pe(){H=tn,O.abort(),v.reset(),clearTimeout(ie),C.forEach(U=>U())}function Yr(){let U=[],se=[];function Zt(){return new Promise(W=>{let ae=se.shift();ae?W({value:ae,done:!1}):U.push(W)})}let tt=function(W){let ae=U.shift();ae?ae({value:W,done:!1}):se.push(W)};function Oe(){for(T.splice(T.indexOf(tt),1);U.shift(););for(;se.shift(););}function kt(){let W=U.shift();W&&(W({done:!0,value:void 0}),Oe())}return C.push(kt),T.push(tt),{next(){return H===tn?this.return():Zt()},return(){return Oe(),Promise.resolve({done:!0,value:void 0})},throw(W){return Oe(),Promise.reject(W)},[Symbol.asyncIterator](){return this}}}function yo(){a({delay:N}),!O.signal.aborted&&(H=xo,ie=setTimeout(Y,N))}async function Rs(U){i(),v.reset();let{body:se,redirected:Zt,status:tt}=U;if(tt===204){s(),Pe();return}if(!se)throw new Error("Missing response body");Zt&&(_=U.url);let Oe=e(se),kt=new TextDecoder,W=Oe.getReader(),ae=!0;H=Hs;do{let{done:vo,value:go}=await W.read();go&&v.feed(kt.decode(go,{stream:!vo})),vo&&(ae=!1,b=null,v.reset(),yo(),s())}while(ae)}function Us(U){typeof U.id=="string"&&(E=U.id),P(U)}function Ns(U){N=U}function Ms(){let{mode:U,credentials:se,body:Zt,method:tt,redirect:Oe,referrer:kt,referrerPolicy:W}=r,ae={Accept:"text/event-stream",...h,...E?{"Last-Event-ID":E}:void 0};return{mode:U,credentials:se,body:Zt,method:tt,redirect:Oe,referrer:kt,referrerPolicy:W,headers:ae,cache:"no-store",signal:O.signal}}}function Bs(t){let e=t.fetch||globalThis.fetch;if(!Gs(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 Gs(t){return typeof t=="function"}var Ks={getStream:Js};function rn(t){return Ws(t,Ks)}function Js(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var Po=Rt(Mt());var ur=class{constructor(e){this.API_VERSION="2022-03-01-preview";let r="schema"in e?e.schema:e.identifier,n=e.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var dr=class{constructor(e){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=e;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(e){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,e&&(r.pathname=`${r.pathname}/${e}`),r.href}};var it=(0,Po.debug)("copilot-studio:power-platform");function Lt(t,e){var d,l,f,h,C,T,P,v;let r=((d=t.schemaName)==null?void 0:d.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((f=t.directConnectUrl)!=null&&f.trim())&&(!((h=t.environmentId)!=null&&h.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((C=t.directConnectUrl)!=null&&C.trim()){if(it.debug(`Using direct connection: ${t.directConnectUrl}`),!Dt(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return pa(t.directConnectUrl,e).href}let n=(T=t.cloud)!=null?T:"Prod",o=(P=t.copilotAgentType)!=null?P:"Published";if(it.debug(`Using cloud setting: ${n}`),it.debug(`Using agent type: ${o}`),n==="Other")if((v=t.customPowerPlatformCloud)!=null&&v.trim())if(Dt(t.customPowerPlatformCloud))it.debug(`Using custom Power Platform cloud: ${t.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=ma(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new dr({host:i,schema:r}),Prebuilt:()=>new ur({host:i,schema:r})}[o]().getConversationUrl(e);return it.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Oo(t,e){if(!e||!e.trim())throw new Error("conversationId is required for subscribe URL");let r=Lt(t,e),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return it.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function Eo(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&&Dt(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&Dt(t.customPowerPlatformCloud))e="Other",r=t.customPowerPlatformCloud;else throw new Error("Either CustomPowerPlatformCloud or cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");return r!=null||(r="api.unknown.powerplatform.com"),`https://${lr(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&Dt(n)){if(Ao(new URL(n))==="Unknown"){let s=(i=t==null?void 0:t.cloud)!=null?i:e;if(s==="Other"||s==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(s!=="Unknown")return`https://${lr(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${lr(Ao(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Dt(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function pa(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 ma(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=ha(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${lr(t,r)}`)}function lr(t,e){switch(t){case"Local":return"api.powerplatform.localhost";case"Exp":return"api.exp.powerplatform.com";case"Dev":return"api.dev.powerplatform.com";case"Prv":return"api.prv.powerplatform.com";case"Test":return"api.test.powerplatform.com";case"Preprod":return"api.preprod.powerplatform.com";case"FirstRelease":case"Prod":return"api.powerplatform.com";case"GovFR":return"api.gov.powerplatform.microsoft.us";case"Gov":return"api.gov.powerplatform.microsoft.us";case"High":return"api.high.powerplatform.microsoft.us";case"DoD":return"api.appsplatform.us";case"Mooncake":return"api.powerplatform.partner.microsoftonline.cn";case"Ex":return"api.powerplatform.eaglex.ic.gov";case"Rx":return"api.powerplatform.microsoft.scloud";case"Other":return e;default:throw new Error(`Invalid cluster category value: ${t}`)}}function ha(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Ao(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 Qe=Rt(to());var er=class{constructor(e,r){this.activity=e,this.conversationId=r}};var ys=Rt(Mt());var $r="1.5.0-beta.6.ga236d9a19c";var Vr={};var tr=class{static getProductInfo(){let e=`CopilotStudioClient.agents-sdk-js/${$r}`,r;return typeof window!="undefined"&&window.navigator?r=`${e} ${navigator.userAgent}`:r=`${e} nodejs/${process.version} ${Vr.platform()}-${Vr.arch()}/${Vr.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${$r}`}static getVersion(){return $r}};var Hr=class{static getScopeFromSettings(e){return Eo(e)}};function ps(t,e){return{activities:t,conversationId:e,isNewConversation:!0}}function ms(t,e){return{activities:t,conversationId:e,activityCount:t.length}}var M=(0,ys.debug)("copilot-studio:client"),Se=class Se{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}logDiagnostic(e,...r){this.settings.enableDiagnostics&&M.info(`[DIAGNOSTICS] ${e}`,...r)}async*postRequestAsync(e,r,n="POST"){var s,a,d,l,f,h,C,T,P,v;this.logDiagnostic(`Request URL: ${e}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),M.debug(`>>> SEND TO ${e}`);let o=new Map,i=rn({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":tr.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(b,_)=>{let O=await fetch(b,_);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:b,event:_}of i){if(b&&_==="activity")try{let O=Qe.Activity.fromJson(b),E=(s=O.entities)==null?void 0:s.find(N=>N.type==="streaminfo"&&N.streamType==="streaming");switch(O.type){case Qe.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(d=(a=O.conversation)==null?void 0:a.id)!=null?d:"",M.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case Qe.ActivityTypes.Typing:if(M.debug(`Activity type: ${O.type}`),E||((l=O.channelData)==null?void 0:l.streamType)==="streaming"){let N=(f=O.text)!=null?f:"",ie=(C=E==null?void 0:E.streamId)!=null?C:(h=O.channelData)==null?void 0:h.streamId,H=(P=E==null?void 0:E.streamSequence)!=null?P:(T=O.channelData)==null?void 0:T.streamSequence;if(ie&&H){if(o.has(ie)){let Y=o.get(ie);Y.push({text:N,sequence:H}),o.set(ie,Y)}else o.set(ie,[{text:N,sequence:H}]);O.text=((v=o.get(ie))==null?void 0:v.sort((Y,Pe)=>Y.sequence-Pe.sequence).map(Y=>Y.text).join(""))||""}}yield O;break;default:M.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){M.error("Failed to parse activity:",O)}else if(_==="end"){M.debug("Stream complete");break}if(i.readyState==="closed"){M.debug("Connection closed");break}}}finally{i.close()}}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(Se.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,M.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(Se.conversationIdHeaderKey))!=null?o:"",this.conversationId&&M.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==Se.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(e){var i;let r;typeof e=="boolean"||e===void 0?r={emitStartConversationEvent:e!=null?e:!0}:r=e;let n=Lt(this.settings,r.conversationId),o={emitStartConversationEvent:(i=r.emitStartConversationEvent)!=null?i:!0};r.locale&&(o.locale=r.locale),M.info("Starting conversation ...",r),this.logDiagnostic("Start conversation request:",o),yield*this.postRequestAsync(n,o,"POST")}async*sendActivityStreaming(e,r=this.conversationId){var s,a;let n=(a=(s=e.conversation)==null?void 0:s.id)!=null?a:r,o=Lt(this.settings,n),i=new er(e);M.info("Sending activity...",e),yield*this.postRequestAsync(o,i,"POST")}async*executeStreaming(e,r){if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let n=Lt(this.settings,r),o=new er(e,r);M.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:e.type,activityText:e.text}),yield*this.postRequestAsync(n,o,"POST")}async execute(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return n}async startConversationAsync(e){let r=[];for await(let n of this.startConversationStreaming(e))r.push(n);return r}async askQuestionAsync(e,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:e,conversation:o},s=Qe.Activity.fromObject(i),a=[];for await(let d of this.sendActivityStreaming(s,r))a.push(d);return a}async sendActivity(e,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(e,r))n.push(o);return n}async startConversationWithResponse(e){var o;let r=[],n="";for await(let i of this.startConversationStreaming(e))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,ps(r,n)}async executeWithResponse(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return ms(n,r)}async*subscribeAsync(e,r){if(!e||!e.trim())throw new Error("conversationId is required for subscribeAsync");let n=Oo(this.settings,e);M.info("Subscribing to conversation:",e),this.logDiagnostic("Subscribe request:",{conversationId:e,lastReceivedEventId:r,url:n});let o=rn({url:n,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":tr.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(i,s)=>{let a=await fetch(i,s);return this.processResponseHeaders(a.headers),a}});try{for await(let{data:i,event:s,id:a}of o){if(i&&s==="activity")try{let d=Qe.Activity.fromJson(i),l={activity:d,eventId:a};M.debug(`Received activity via subscription, event ID: ${a}`),this.logDiagnostic("Subscribe event received:",{eventId:a,activityType:d.type}),yield l}catch(d){M.error("Failed to parse activity in subscription:",d)}else if(s==="end"){M.debug("Subscription stream complete");break}if(o.readyState==="closed"){M.debug("Subscription connection closed");break}}}finally{o.close()}}};Se.conversationIdHeaderKey="x-ms-conversationid",Se.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Se.scopeFromSettings=Hr.getScopeFromSettings;var hs=Se;var L=[];for(let t=0;t<256;++t)L.push((t+256).toString(16).slice(1));function vs(t,e=0){return(L[t[e+0]]+L[t[e+1]]+L[t[e+2]]+L[t[e+3]]+"-"+L[t[e+4]]+L[t[e+5]]+"-"+L[t[e+6]]+L[t[e+7]]+"-"+L[t[e+8]]+L[t[e+9]]+"-"+L[t[e+10]]+L[t[e+11]]+L[t[e+12]]+L[t[e+13]]+L[t[e+14]]+L[t[e+15]]).toLowerCase()}var ro,qd=new Uint8Array(16);function no(){if(!ro){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ro=crypto.getRandomValues.bind(crypto)}return ro(qd)}var Fd=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oo={randomUUID:Fd};function $d(t,e,r){var o,i,s;if(oo.randomUUID&&!e&&!t)return oo.randomUUID();t=t||{};let n=(s=(i=t.random)!=null?i:(o=t.rng)==null?void 0:o.call(t))!=null?s:no();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 vs(n)}var io=$d;var Zs=Rt(to());var so=function(t,e){return so=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])},so(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");so(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function rr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(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 At(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function te(t){return typeof t=="function"}function Wr(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 Br=Wr(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
1
|
+
var Cd=Object.create;var Br=Object.defineProperty;var Id=Object.getOwnPropertyDescriptor;var Ed=Object.getOwnPropertyNames;var Sd=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>(e&&(t=e(e=0)),t);var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wd=(e,t)=>{for(var r in t)Br(e,r,{get:t[r],enumerable:!0})},Oa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ed(t))!Ad.call(e,o)&&o!==r&&Br(e,o,{get:()=>t[o],enumerable:!(n=Id(t,o))||n.enumerable});return e};var ke=(e,t,r)=>(r=e!=null?Cd(Sd(e)):{},Oa(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e)),Od=e=>Oa(Br({},"__esModule",{value:!0}),e);var So=p(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isPromise=Eo;Kr.attempt=Zd;function Eo(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function Zd(e){var t;let r=!1;try{let n=e.try();return Eo(n)?(r=!0,n.catch(o=>{var i;if(!e.catch)throw o;let a=(i=e.catch)===null||i===void 0?void 0:i.call(e,o);if(Eo(a))return a.then(()=>{})}).finally(e.finally)):n}catch(n){if(!e.catch)throw n;e.catch(n);return}finally{!r&&((t=e.finally)===null||t===void 0||t.call(e))}}});var Yr=p(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MetricNames=ye.SpanNames=ye.SpanCategories=ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;ye.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";ye.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};ye.SpanNames={ADAPTER_PROCESS:"agents.adapter.process",ADAPTER_SEND_ACTIVITIES:"agents.adapter.send_activities",ADAPTER_UPDATE_ACTIVITY:"agents.adapter.update_activity",ADAPTER_DELETE_ACTIVITY:"agents.adapter.delete_activity",ADAPTER_CONTINUE_CONVERSATION:"agents.adapter.continue_conversation",ADAPTER_CREATE_CONNECTOR_CLIENT:"agents.adapter.create_connector_client",ADAPTER_CREATE_USER_TOKEN_CLIENT:"agents.adapter.create_user_token_client",AGENTS_APP_RUN:"agents.app.run",AGENTS_APP_ROUTE_HANDLER:"agents.app.route_handler",AGENTS_APP_BEFORE_TURN:"agents.app.before_turn",AGENTS_APP_AFTER_TURN:"agents.app.after_turn",AGENTS_APP_DOWNLOAD_FILES:"agents.app.download_files",CONNECTOR_SEND_TO_CONVERSATION:"agents.connector.send_to_conversation",CONNECTOR_REPLY_TO_ACTIVITY:"agents.connector.reply_to_activity",CONNECTOR_UPDATE_ACTIVITY:"agents.connector.update_activity",CONNECTOR_DELETE_ACTIVITY:"agents.connector.delete_activity",CONNECTOR_CREATE_CONVERSATION:"agents.connector.create_conversation",CONNECTOR_GET_CONVERSATIONS:"agents.connector.get_conversations",CONNECTOR_GET_CONVERSATION_MEMBER:"agents.connector.get_conversation_member",CONNECTOR_UPLOAD_ATTACHMENT:"agents.connector.upload_attachment",CONNECTOR_GET_ATTACHMENT:"agents.connector.get_attachment",CONNECTOR_GET_ATTACHMENT_INFO:"agents.connector.get_attachment_info",STORAGE_READ:"agents.storage.read",STORAGE_WRITE:"agents.storage.write",STORAGE_DELETE:"agents.storage.delete",AGENT_CLIENT_POST_ACTIVITY:"agents.agent_client.post_activity",AUTHENTICATION_GET_ACCESS_TOKEN:"agents.authentication.get_access_token",AUTHENTICATION_ACQUIRE_TOKEN_ON_BEHALF_OF:"agents.authentication.acquire_token_on_behalf_of",AUTHENTICATION_GET_AGENTIC_INSTANCE_TOKEN:"agents.authentication.get_agentic_instance_token",AUTHENTICATION_GET_AGENTIC_USER_TOKEN:"agents.authentication.get_agentic_user_token",AUTHORIZATION_AGENTIC_TOKEN:"agents.authorization.agentic_token",AUTHORIZATION_AZURE_BOT_TOKEN:"agents.authorization.azure_bot_token",AUTHORIZATION_AZURE_BOT_OBO_TOKEN:"agents.authorization.azure_bot_obo_token",AUTHORIZATION_AZURE_BOT_SIGNIN:"agents.authorization.azure_bot_signin",AUTHORIZATION_AZURE_BOT_SIGNOUT:"agents.authorization.azure_bot_signout",USER_TOKEN_CLIENT_GET_USER_TOKEN:"agents.user_token_client.get_user_token",USER_TOKEN_CLIENT_SIGN_OUT:"agents.user_token_client.sign_out",USER_TOKEN_CLIENT_GET_SIGN_IN_RESOURCE:"agents.user_token_client.get_sign_in_resource",USER_TOKEN_CLIENT_EXCHANGE_TOKEN:"agents.user_token_client.exchange_token",USER_TOKEN_CLIENT_GET_TOKEN_OR_SIGN_IN_RESOURCE:"agents.user_token_client.get_token_or_sign_in_resource",USER_TOKEN_CLIENT_GET_TOKEN_STATUS:"agents.user_token_client.get_token_status",USER_TOKEN_CLIENT_GET_AAD_TOKENS:"agents.user_token_client.get_aad_tokens",PROACTIVE_STORE_CONVERSATION:"agents.proactive.store_conversation",PROACTIVE_GET_CONVERSATION:"agents.proactive.get_conversation",PROACTIVE_GET_CONVERSATION_OR_THROW:"agents.proactive.get_conversation_or_throw",PROACTIVE_DELETE_CONVERSATION:"agents.proactive.delete_conversation",PROACTIVE_SEND_ACTIVITY:"agents.proactive.send_activity",PROACTIVE_CONTINUE_CONVERSATION:"agents.proactive.continue_conversation",PROACTIVE_CREATE_CONVERSATION:"agents.proactive.create_conversation",TURN_SEND_ACTIVITIES:"agents.turn.send_activities",DIALOGS_RUN:"agents.dialogs.run",DIALOGS_CONTEXT_BEGIN:"agents.dialogs.context.begin",DIALOGS_CONTEXT_CONTINUE:"agents.dialogs.context.continue",DIALOGS_CONTEXT_END:"agents.dialogs.context.end",DIALOGS_CONTEXT_REPLACE:"agents.dialogs.context.replace",DIALOGS_CONTEXT_CANCEL_ALL:"agents.dialogs.context.cancel_all",COPILOT_START_CONVERSATION:"agents.copilot_client.start_conversation",COPILOT_SEND_ACTIVITY:"agents.copilot_client.send_activity",COPILOT_POST_REQUEST:"agents.copilot_client.post_request",COPILOT_CREATE_CONNECTION:"agents.copilot_client.webchat.create_connection",COPILOT_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming",COPILOT_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async"};ye.MetricNames={ADAPTER_PROCESS_DURATION:"agents.adapter.process.duration",ACTIVITIES_RECEIVED:"agents.activities.received",ACTIVITIES_SENT:"agents.activities.sent",ACTIVITIES_UPDATED:"agents.activities.updated",ACTIVITIES_DELETED:"agents.activities.deleted",CONNECTOR_REQUESTS:"agents.connector.request.count",CONNECTOR_REQUEST_DURATION:"agents.connector.request.duration",AGENT_CLIENT_REQUESTS:"agents.agent_client.request.count",AGENT_CLIENT_REQUEST_DURATION:"agents.agent_client.request.duration",TURNS_COUNT:"agents.turn.count",TURNS_ERRORS:"agents.turn.error.count",TURN_DURATION:"agents.turn.duration",DIALOGS_CONTEXT_COUNT:"agents.dialogs.context.count",DIALOGS_CONTEXT_DURATION:"agents.dialogs.context.duration",STORAGE_OPERATION_DURATION:"agents.storage.operation.duration",AUTH_TOKEN_REQUEST_COUNT:"agents.auth.token.request.count",AUTH_TOKEN_DURATION:"agents.auth.token.duration",USER_TOKEN_CLIENT_REQUESTS:"agents.user_token_client.request.count",USER_TOKEN_CLIENT_REQUEST_DURATION:"agents.user_token_client.request.duration",PROACTIVE_OPERATION_COUNT:"agents.proactive.operation.count",PROACTIVE_OPERATION_DURATION:"agents.proactive.operation.duration",CSC_ACTIVITIES_RECEIVED:"agents.copilot_client.activities.received",CSC_ACTIVITIES_SENT:"agents.copilot_client.activities.sent",CSC_CONVERSATIONS_STARTED:"agents.copilot_client.conversations.started",CSC_WEBCHAT_CONNECTIONS:"agents.copilot_client.webchat.connection.count",CSC_REQUEST_COUNT:"agents.copilot_client.request.count",CSC_REQUEST_ERRORS:"agents.copilot_client.request.error.count",CSC_STREAM_DURATION:"agents.copilot_client.stream.duration",CSC_REQUEST_DURATION:"agents.copilot_client.request.duration",CSC_EXECUTE_STREAMING:"agents.copilot_client.execute_streaming.count",CSC_SUBSCRIBE_ASYNC:"agents.copilot_client.subscribe_async.count",CSC_SUBSCRIBE_EVENT:"agents.copilot_client.subscribe_event.count"}});var ja=p((Cg,Na)=>{var Et=1e3,St=Et*60,At=St*60,Ye=At*24,Ld=Ye*7,Md=Ye*365.25;Na.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Vd(e);if(r==="number"&&isFinite(e))return t.long?zd(e):qd(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Vd(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Md;case"weeks":case"week":case"w":return r*Ld;case"days":case"day":case"d":return r*Ye;case"hours":case"hour":case"hrs":case"hr":case"h":return r*At;case"minutes":case"minute":case"mins":case"min":case"m":return r*St;case"seconds":case"second":case"secs":case"sec":case"s":return r*Et;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function qd(e){var t=Math.abs(e);return t>=Ye?Math.round(e/Ye)+"d":t>=At?Math.round(e/At)+"h":t>=St?Math.round(e/St)+"m":t>=Et?Math.round(e/Et)+"s":e+"ms"}function zd(e){var t=Math.abs(e);return t>=Ye?Xr(e,t,Ye,"day"):t>=At?Xr(e,t,At,"hour"):t>=St?Xr(e,t,St,"minute"):t>=Et?Xr(e,t,Et,"second"):e+" ms"}function Xr(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var Ua=p((Ig,ka)=>{function Fd(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=o,r.enabled=s,r.humanize=ja(),r.destroy=d,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let g=0;for(let _=0;_<f.length;_++)g=(g<<5)-g+f.charCodeAt(_),g|=0;return r.colors[Math.abs(g)%r.colors.length]}r.selectColor=t;function r(f){let g,_=null,I,P;function y(...S){if(!y.enabled)return;let x=y,N=Number(new Date),O=N-(g||N);x.diff=O,x.prev=g,x.curr=N,g=N,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let k=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(L,Se)=>{if(L==="%%")return"%";k++;let ie=r.formatters[Se];if(typeof ie=="function"){let ur=S[k];L=ie.call(x,ur),S.splice(k,1),k--}return L}),r.formatArgs.call(x,S),(x.log||r.log).apply(x,S)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(I!==r.namespaces&&(I=r.namespaces,P=r.enabled(f)),P),set:S=>{_=S}}),typeof r.init=="function"&&r.init(y),y}function n(f,g){let _=r(this.namespace+(typeof g=="undefined"?":":g)+f);return _.log=this.log,_}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let g=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of g)_[0]==="-"?r.skips.push(_.slice(1)):r.names.push(_)}function i(f,g){let _=0,I=0,P=-1,y=0;for(;_<f.length;)if(I<g.length&&(g[I]===f[_]||g[I]==="*"))g[I]==="*"?(P=I,y=_,I++):(_++,I++);else if(P!==-1)I=P+1,y++,_=y;else return!1;for(;I<g.length&&g[I]==="*";)I++;return I===g.length}function a(){let f=[...r.names,...r.skips.map(g=>"-"+g)].join(",");return r.enable(""),f}function s(f){for(let g of r.skips)if(i(f,g))return!1;for(let g of r.names)if(i(f,g))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function d(){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}ka.exports=Fd});var Da=p((Q,Jr)=>{Q.formatArgs=$d;Q.save=Bd;Q.load=Hd;Q.useColors=Gd;Q.storage=Wd();Q.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();Q.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 Gd(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function $d(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Jr.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}Q.log=console.debug||console.log||(()=>{});function Bd(e){try{e?Q.storage.setItem("debug",e):Q.storage.removeItem("debug")}catch{}}function Hd(){let e;try{e=Q.storage.getItem("debug")||Q.storage.getItem("DEBUG")}catch{}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}function Wd(){try{return localStorage}catch{}}Jr.exports=Ua()(Q);var{formatters:Kd}=Jr.exports;Kd.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Ao=p(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.isBrowser=void 0;Qr.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var Za=p(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.levels=void 0;en.levels=["info","warn","error","debug"]});var wo=p(wt=>{"use strict";var Yd=wt&&wt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});wt.createDebugLogger=el;wt.link=tl;var Xd=Yd(Da()),Jd=Ao(),Qd=Za();function el(e){return{info:tn(e,"info"),warn:tn(e,"warn"),error:tn(e,"error"),debug:tn(e,"debug")}}var La={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function tn(e,t){let r=(0,Xd.default)(`${e}:${t}`);return Jd.isBrowser?r.color=La.browser[t]:r.color=La.node[t],r}function tl(e,...t){return Qd.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(e[n].enabled){e[n](o,...i);for(let a of t)a[n](o,...i)}},r),{})}});var Ma=p(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.getSetting=nl;var rl=Ao();function nl(e){var t,r;if(rl.isBrowser)try{return(t=window.localStorage.getItem(e))!==null&&t!==void 0?t:""}catch{}else return(r=process.env[e])!==null&&r!==void 0?r:"";return""}});var qa=p(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.isSpanDisabled=al;var mr=Yr(),ol=wo(),il=Ma(),Po=(0,ol.createDebugLogger)("agents:telemetry"),Va=(()=>{let e=(0,il.getSetting)(mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!e)return[];let t=e.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(mr.SpanNames),n=new Set,o=[];for(let i of t){let a=mr.SpanCategories[i];if(!a){Po.warn(`Invalid span category "${i}" in ${mr.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(mr.SpanCategories).join(", ")}`);continue}for(let s of a)if(!n.has(s)){n.add(s);for(let[c,d]of r)c.startsWith(s)&&o.push(d)}}return o.length>0&&Po.debug("Disabled Span names:",o),o})();function al(e){if(Va.length===0)return!1;let t=Va.includes(e);return Po.debug(`Span "${e}" disabled:`,t),t}});var No=p(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.noopTrace=void 0;Xe.noopMetric=sl;Xe.noopContext=za;var hr=()=>{};Xe.noopTrace=function(e,t){return za(t)};Xe.noopTrace.define=e=>e;function sl(){return{histogram:()=>({record:hr}),counter:()=>({add:hr})}}function za(e){let t=new Proxy({},{get:()=>hr}),r={record:hr,actions:t};return e?e(r):{record:r.record,actions:r.actions,end:hr,fail(o){return o}}}});var $a=p(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.traceFactory=fl;var cl=So(),ul=qa(),dl=Yr(),ll=No();function fl(e){let t=new Set(Object.values(dl.SpanNames)),r=e.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,a){if(!i)throw new Error("Trace definition is required");if(!t.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,ul.isSpanDisabled)(i.name))return(0,ll.noopContext)(a);let s=pl(i);if(!a){let c=r.startSpan(i.name),d=Fa(e,i,c,s);return{record:d.record,actions:d.actions,fail:d.fail,end:d.end}}return r.startActiveSpan(i.name,c=>{let d=Fa(e,i,c,s);return(0,cl.attempt)({try:()=>a({record:d.record,actions:d.actions}),catch:f=>{throw d.fail(f)},finally:d.end})})};return n.define=o=>o,n}function pl(e){let t=e.record?{...e.record}:{};return{set(r){Object.assign(t,r)},get(){return t}}}function Fa(e,t,r,n){var o,i;let a=performance.now(),s=!1,c;return{record:n.set,actions:(i=(o=t.actions)===null||o===void 0?void 0:o.call(t,{span:r}))!==null&&i!==void 0?i:{},fail(d){return c=d,d},end(){if(!(s||!e)){s=!0,c===void 0?r.setStatus({code:e.SpanStatusCode.OK}):Ga(e,r,c);try{t.end({span:r,record:n.get(),duration:performance.now()-a,error:c})}catch(d){Ga(e,r,d)}finally{r.end()}}}}}function Ga(e,t,r){let n;r instanceof Error?(n=r.message,t.recordException(r)):(n=String(r),t.recordException({name:typeof r,message:n})),t.setStatus({code:e.SpanStatusCode.ERROR,message:n})}});var Ba=p(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.metricFactory=ml;function ml(e){let t=e.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:t.createHistogram.bind(t),counter:t.createCounter.bind(t)}}});var Ha=p(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createOTelLogger=hl;function hl(e,t){return{info:rn(e,t,"info"),warn:rn(e,t,"warn"),error:rn(e,t,"error"),debug:rn(e,t,"debug")}}function rn(e,t,r){var n;let o=e.logs.getLogger(t),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",a={debug:e.SeverityNumber.DEBUG,info:e.SeverityNumber.INFO,warn:e.SeverityNumber.WARN,error:e.SeverityNumber.ERROR}[i];return function(c,...d){o.emit({severityNumber:a,severityText:i.toUpperCase(),body:gl(c,d),attributes:{"log.namespace":t,"log.level":i}})}}function gl(e,t){if(t.length===0)return e;let r=t.map(n=>yl(n)).join(" ");return`${e} ${r}`}function yl(e){if(e instanceof Error)return`${e.name}: ${e.message}`;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"||e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}});var Ja=p(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.index=xl;var vl=$a(),_l=Ba(),on=wo(),bl=Ha(),nn=So(),Wa=Yr(),Ka=No(),Ya=(0,on.createDebugLogger)("agents:telemetry");function xl(e){let t=(0,nn.attempt)({try:()=>e.otel(),catch:()=>Ya.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,nn.attempt)({try:()=>e.logs(),catch:()=>Ya.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,nn.isPromise)(t)||(0,nn.isPromise)(r)?Promise.all([t,r]).then(([n,o])=>Xa(n,o)):Xa(t,r)}function Xa(e,t){return{SpanNames:Wa.SpanNames,MetricNames:Wa.MetricNames,debug:t?r=>(0,on.link)((0,on.createDebugLogger)(r),(0,bl.createOTelLogger)(t,r)):on.createDebugLogger,trace:e?(0,vl.traceFactory)(e):Ka.noopTrace,metric:e?(0,_l.metricFactory)(e):(0,Ka.noopMetric)()}}});var Qa,es=E(()=>{Qa=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var ts=E(()=>{es()});var Ae,Zo=E(()=>{Ae="1.9.0"});function Tl(e){var t=new Set([e]),r=new Set,n=e.match(rs);if(!n)return function(){return!1};var o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(c){return c===e};function i(s){return r.add(s),!1}function a(s){return t.add(s),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var d=c.match(rs);if(!d)return i(c);var f={major:+d[1],minor:+d[2],patch:+d[3],prerelease:d[4]};return f.prerelease!=null||o.major!==f.major?i(c):o.major===0?o.minor===f.minor&&o.patch<=f.patch?a(c):i(c):o.minor<=f.minor?a(c):i(c)}}var rs,ns,os=E(()=>{Zo();rs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;ns=Tl(Ae)});function ve(e,t,r,n){var o;n===void 0&&(n=!1);var i=yr[gr]=(o=yr[gr])!==null&&o!==void 0?o:{version:Ae};if(!n&&i[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(i.version!==Ae){var a=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+Ae);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+Ae+"."),!0}function ne(e){var t,r,n=(t=yr[gr])===null||t===void 0?void 0:t.version;if(!(!n||!ns(n)))return(r=yr[gr])===null||r===void 0?void 0:r[e]}function _e(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+Ae+".");var r=yr[gr];r&&delete r[e]}var Cl,gr,yr,Je=E(()=>{ts();Zo();os();Cl=Ae.split(".")[0],gr=Symbol.for("opentelemetry.js.api."+Cl),yr=Qa});function vr(e,t,r){var n=ne("diag");if(n)return r.unshift(t),n[e].apply(n,El([],Il(r),!1))}var Il,El,is,as=E(()=>{Je();Il=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},El=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},is=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vr("verbose",this._namespace,t)},e})()});var z,an=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(z||(z={}))});function ss(e,t){e<z.NONE?e=z.NONE:e>z.ALL&&(e=z.ALL),t=t||{};function r(n,o){var i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",z.ERROR),warn:r("warn",z.WARN),info:r("info",z.INFO),debug:r("debug",z.DEBUG),verbose:r("verbose",z.VERBOSE)}}var cs=E(()=>{an()});var Sl,Al,wl,$,Qe=E(()=>{as();cs();an();Je();Sl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Al=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},wl="diag",$=(function(){function e(){function t(o){return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=ne("diag");if(s)return s[o].apply(s,Al([],Sl(i),!1))}}var r=this,n=function(o,i){var a,s,c;if(i===void 0&&(i={logLevel:z.INFO}),o===r){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=d.stack)!==null&&a!==void 0?a:d.message),!1}typeof i=="number"&&(i={logLevel:i});var f=ne("diag"),g=ss((s=i.logLevel)!==null&&s!==void 0?s:z.INFO,o);if(f&&!i.suppressOverrideMessage){var _=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+_),g.warn("Current logger will overwrite one already registered from "+_)}return ve("diag",g,r,!0)};r.setLogger=n,r.disable=function(){_e(wl,r)},r.createComponentLogger=function(o){return new is(o)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})()});var Ol,Pl,us,ds=E(()=>{Ol=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Pl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},us=(function(){function e(t){this._entries=t?new Map(t):new Map}return e.prototype.getEntry=function(t){var r=this._entries.get(t);if(r)return Object.assign({},r)},e.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(t){var r=Ol(t,2),n=r[0],o=r[1];return[n,o]})},e.prototype.setEntry=function(t,r){var n=new e(this._entries);return n._entries.set(t,r),n},e.prototype.removeEntry=function(t){var r=new e(this._entries);return r._entries.delete(t),r},e.prototype.removeEntries=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new e(this._entries);try{for(var a=Pl(n),s=a.next();!s.done;s=a.next()){var c=s.value;i._entries.delete(c)}}catch(d){t={error:d}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},e.prototype.clear=function(){return new e},e})()});var ls,fs=E(()=>{ls=Symbol("BaggageEntryMetadata")});function ps(e){return e===void 0&&(e={}),new us(new Map(Object.entries(e)))}function ms(e){return typeof e!="string"&&(Rl.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:ls,toString:function(){return e}}}var Rl,Lo=E(()=>{Qe();ds();fs();Rl=$.instance()});function Ot(e){return Symbol.for(e)}var Nl,sn,_r=E(()=>{Nl=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new e(r._currentContext);return o._currentContext.delete(n),o}}return e})(),sn=new Nl});var Mo,hs,gs=E(()=>{Mo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],hs=(function(){function e(){function t(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var a=console[n];if(typeof a!="function"&&(a=console.log),typeof a=="function")return a.apply(console,o)}}}for(var r=0;r<Mo.length;r++)this[Mo[r].n]=t(Mo[r].c)}return e})()});function ys(){return qo}var et,jl,cn,kl,Ul,Dl,Zl,Vo,Ll,Ml,Vl,qo,ql,zl,Fl,Gl,$l,Bl,Hl,zo=E(()=>{et=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),jl=(function(){function e(){}return e.prototype.createGauge=function(t,r){return zl},e.prototype.createHistogram=function(t,r){return Fl},e.prototype.createCounter=function(t,r){return ql},e.prototype.createUpDownCounter=function(t,r){return Gl},e.prototype.createObservableGauge=function(t,r){return Bl},e.prototype.createObservableCounter=function(t,r){return $l},e.prototype.createObservableUpDownCounter=function(t,r){return Hl},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})(),cn=(function(){function e(){}return e})(),kl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Ul=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n){},t})(cn),Dl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Zl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n){},t})(cn),Vo=(function(){function e(){}return e.prototype.addCallback=function(t){},e.prototype.removeCallback=function(t){},e})(),Ll=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),Ml=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),Vl=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),qo=new jl,ql=new kl,zl=new Dl,Fl=new Zl,Gl=new Ul,$l=new Ll,Bl=new Ml,Hl=new Vl});var un,vs=E(()=>{(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(un||(un={}))});var dn,ln,Fo=E(()=>{dn={get:function(e,t){if(e!=null)return e[t]},keys:function(e){return e==null?[]:Object.keys(e)}},ln={set:function(e,t,r){e!=null&&(e[t]=r)}}});var Wl,Kl,_s,bs=E(()=>{_r();Wl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Kl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},_s=(function(){function e(){}return e.prototype.active=function(){return sn},e.prototype.with=function(t,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,Kl([n],Wl(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})()});var Yl,Xl,Go,Jl,Ue,br=E(()=>{bs();Je();Qe();Yl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i},Xl=function(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},Go="context",Jl=new _s,Ue=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return ve(Go,t,$.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,n){for(var o,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(o=this._getContextManager()).with.apply(o,Xl([t,r,n],Yl(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return ne(Go)||Jl},e.prototype.disable=function(){this._getContextManager().disable(),_e(Go,$.instance())},e})()});var Pt,$o=E(()=>{(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Pt||(Pt={}))});var xr,Tr,fn,pn=E(()=>{$o();xr="0000000000000000",Tr="00000000000000000000000000000000",fn={traceId:Tr,spanId:xr,traceFlags:Pt.NONE}});var De,mn=E(()=>{pn();De=(function(){function e(t){t===void 0&&(t=fn),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})()});function hn(e){return e.getValue(Bo)||void 0}function xs(){return hn(Ue.getInstance().active())}function Cr(e,t){return e.setValue(Bo,t)}function Ts(e){return e.deleteValue(Bo)}function Cs(e,t){return Cr(e,new De(t))}function gn(e){var t;return(t=hn(e))===null||t===void 0?void 0:t.spanContext()}var Bo,Ho=E(()=>{_r();mn();br();Bo=Ot("OpenTelemetry Context Key SPAN")});function Wo(e){return Ql.test(e)&&e!==Tr}function Ko(e){return ef.test(e)&&e!==xr}function Rt(e){return Wo(e.traceId)&&Ko(e.spanId)}function Is(e){return new De(e)}var Ql,ef,yn=E(()=>{pn();mn();Ql=/^([0-9a-f]{32})$/i,ef=/^[0-9a-f]{16}$/i});function tf(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var Yo,vn,Xo=E(()=>{br();Ho();mn();yn();Yo=Ue.getInstance(),vn=(function(){function e(){}return e.prototype.startSpan=function(t,r,n){n===void 0&&(n=Yo.active());var o=!!(r!=null&&r.root);if(o)return new De;var i=n&&gn(n);return tf(i)&&Rt(i)?new De(i):new De},e.prototype.startActiveSpan=function(t,r,n,o){var i,a,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(i=r,s=n):(i=r,a=n,s=o);var c=a!=null?a:Yo.active(),d=this.startSpan(t,i,c),f=Cr(c,d);return Yo.with(f,s,void 0,d)}},e})()});var rf,_n,Jo=E(()=>{Xo();rf=new vn,_n=(function(){function e(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}return e.prototype.startSpan=function(t,r,n){return this._getTracer().startSpan(t,r,n)},e.prototype.startActiveSpan=function(t,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):rf},e})()});var Es,Ss=E(()=>{Xo();Es=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new vn},e})()});var nf,Ir,Qo=E(()=>{Jo();Ss();nf=new Es,Ir=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new _n(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:nf},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)},e})()});var bn,As=E(()=>{(function(e){e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(bn||(bn={}))});var xn,ws=E(()=>{(function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(xn||(xn={}))});var Tn,Os=E(()=>{(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Tn||(Tn={}))});function Ps(e){return sf.test(e)}function Rs(e){return cf.test(e)&&!uf.test(e)}var ei,of,af,sf,cf,uf,Ns=E(()=>{ei="[_0-9a-z-*/]",of="[a-z]"+ei+"{0,255}",af="[a-z0-9]"+ei+"{0,240}@[a-z]"+ei+"{0,13}",sf=new RegExp("^(?:"+of+"|"+af+")$"),cf=/^[ -~]{0,255}[!-~]$/,uf=/,|=/});var js,df,ks,Us,Ds,Zs=E(()=>{Ns();js=32,df=512,ks=",",Us="=",Ds=(function(){function e(t){this._internalState=new Map,t&&this._parse(t)}return e.prototype.set=function(t,r){var n=this._clone();return n._internalState.has(t)&&n._internalState.delete(t),n._internalState.set(t,r),n},e.prototype.unset=function(t){var r=this._clone();return r._internalState.delete(t),r},e.prototype.get=function(t){return this._internalState.get(t)},e.prototype.serialize=function(){var t=this;return this._keys().reduce(function(r,n){return r.push(n+Us+t.get(n)),r},[]).join(ks)},e.prototype._parse=function(t){t.length>df||(this._internalState=t.split(ks).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Us);if(i!==-1){var a=o.slice(0,i),s=o.slice(i+1,n.length);Ps(a)&&Rs(s)&&r.set(a,s)}return r},new Map),this._internalState.size>js&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,js))))},e.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},e.prototype._clone=function(){var t=new e;return t._internalState=new Map(this._internalState),t},e})()});function Ls(e){return new Ds(e)}var Ms=E(()=>{Zs()});var ti,Vs=E(()=>{br();ti=Ue.getInstance()});var ri,qs=E(()=>{Qe();ri=$.instance()});var lf,zs,Fs=E(()=>{zo();lf=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return qo},e})(),zs=new lf});var ni,Gs,$s=E(()=>{Fs();Je();Qe();ni="metrics",Gs=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(t){return ve(ni,t,$.instance())},e.prototype.getMeterProvider=function(){return ne(ni)||zs},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){_e(ni,$.instance())},e})()});var oi,Bs=E(()=>{$s();oi=Gs.getInstance()});var Hs,Ws=E(()=>{Hs=(function(){function e(){}return e.prototype.inject=function(t,r){},e.prototype.extract=function(t,r){return t},e.prototype.fields=function(){return[]},e})()});function ai(e){return e.getValue(ii)||void 0}function Ks(){return ai(Ue.getInstance().active())}function Ys(e,t){return e.setValue(ii,t)}function Xs(e){return e.deleteValue(ii)}var ii,Js=E(()=>{br();_r();ii=Ot("OpenTelemetry Baggage Key")});var si,ff,Qs,ec=E(()=>{Je();Ws();Fo();Js();Lo();Qe();si="propagation",ff=new Hs,Qs=(function(){function e(){this.createBaggage=ps,this.getBaggage=ai,this.getActiveBaggage=Ks,this.setBaggage=Ys,this.deleteBaggage=Xs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(t){return ve(si,t,$.instance())},e.prototype.inject=function(t,r,n){return n===void 0&&(n=ln),this._getGlobalPropagator().inject(t,r,n)},e.prototype.extract=function(t,r,n){return n===void 0&&(n=dn),this._getGlobalPropagator().extract(t,r,n)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){_e(si,$.instance())},e.prototype._getGlobalPropagator=function(){return ne(si)||ff},e})()});var ci,tc=E(()=>{ec();ci=Qs.getInstance()});var ui,rc,nc=E(()=>{Je();Qo();yn();Ho();Qe();ui="trace",rc=(function(){function e(){this._proxyTracerProvider=new Ir,this.wrapSpanContext=Is,this.isSpanContextValid=Rt,this.deleteSpan=Ts,this.getSpan=hn,this.getActiveSpan=xs,this.getSpanContext=gn,this.setSpan=Cr,this.setSpanContext=Cs}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=ve(ui,this._proxyTracerProvider,$.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return ne(ui)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){_e(ui,$.instance()),this._proxyTracerProvider=new Ir},e})()});var di,oc=E(()=>{nc();di=rc.getInstance()});var ic={};wd(ic,{DiagConsoleLogger:()=>hs,DiagLogLevel:()=>z,INVALID_SPANID:()=>xr,INVALID_SPAN_CONTEXT:()=>fn,INVALID_TRACEID:()=>Tr,ProxyTracer:()=>_n,ProxyTracerProvider:()=>Ir,ROOT_CONTEXT:()=>sn,SamplingDecision:()=>bn,SpanKind:()=>xn,SpanStatusCode:()=>Tn,TraceFlags:()=>Pt,ValueType:()=>un,baggageEntryMetadataFromString:()=>ms,context:()=>ti,createContextKey:()=>Ot,createNoopMeter:()=>ys,createTraceState:()=>Ls,default:()=>pf,defaultTextMapGetter:()=>dn,defaultTextMapSetter:()=>ln,diag:()=>ri,isSpanContextValid:()=>Rt,isValidSpanId:()=>Ko,isValidTraceId:()=>Wo,metrics:()=>oi,propagation:()=>ci,trace:()=>di});var pf,ac=E(()=>{Lo();_r();gs();an();zo();vs();Fo();Jo();Qo();As();ws();Os();$o();Ms();yn();pn();Vs();qs();Bs();tc();oc();pf={context:ti,diag:ri,metrics:oi,propagation:ci,trace:di}});var sc=p(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.SeverityNumber=void 0;var mf;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(mf=Er.SeverityNumber||(Er.SeverityNumber={}))});var In=p(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.NOOP_LOGGER=Nt.NoopLogger=void 0;var Cn=class{emit(t){}};Nt.NoopLogger=Cn;Nt.NOOP_LOGGER=new Cn});var cc=p(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.API_BACKWARDS_COMPATIBILITY_VERSION=be.makeGetter=be._global=be.GLOBAL_LOGS_API_KEY=void 0;be.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");be._global=globalThis;function hf(e,t,r){return n=>n===e?t:r}be.makeGetter=hf;be.API_BACKWARDS_COMPATIBILITY_VERSION=1});var li=p(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.NOOP_LOGGER_PROVIDER=jt.NoopLoggerProvider=void 0;var gf=In(),En=class{getLogger(t,r,n){return new gf.NoopLogger}};jt.NoopLoggerProvider=En;jt.NOOP_LOGGER_PROVIDER=new En});var uc=p(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ProxyLogger=void 0;var yf=In(),fi=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}emit(t){this._getLogger().emit(t)}_getLogger(){if(this._delegate)return this._delegate;let t=this._provider._getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):yf.NOOP_LOGGER}};Sn.ProxyLogger=fi});var dc=p(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.ProxyLoggerProvider=void 0;var vf=li(),_f=uc(),pi=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new _f.ProxyLogger(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:vf.NOOP_LOGGER_PROVIDER}_setDelegate(t){this._delegate=t}_getDelegateLogger(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(t,r,n)}};An.ProxyLoggerProvider=pi});var fc=p(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.LogsAPI=void 0;var ae=cc(),bf=li(),lc=dc(),mi=class e{constructor(){this._proxyLoggerProvider=new lc.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(t){return ae._global[ae.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ae._global[ae.GLOBAL_LOGS_API_KEY]=(0,ae.makeGetter)(ae.API_BACKWARDS_COMPATIBILITY_VERSION,t,bf.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(t),t)}getLoggerProvider(){var t,r;return(r=(t=ae._global[ae.GLOBAL_LOGS_API_KEY])===null||t===void 0?void 0:t.call(ae._global,ae.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)}disable(){delete ae._global[ae.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new lc.ProxyLoggerProvider}};wn.LogsAPI=mi});var mc=p(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.logs=xe.NoopLogger=xe.NOOP_LOGGER=xe.SeverityNumber=void 0;var xf=sc();Object.defineProperty(xe,"SeverityNumber",{enumerable:!0,get:function(){return xf.SeverityNumber}});var pc=In();Object.defineProperty(xe,"NOOP_LOGGER",{enumerable:!0,get:function(){return pc.NOOP_LOGGER}});Object.defineProperty(xe,"NoopLogger",{enumerable:!0,get:function(){return pc.NoopLogger}});var Tf=fc();xe.logs=Tf.LogsAPI.getInstance()});var Ut=p(se=>{"use strict";var kt;Object.defineProperty(se,"__esModule",{value:!0});se.metric=se.trace=se.debug=se.MetricNames=se.SpanNames=void 0;var Cf=Ja();kt=(0,Cf.index)({otel:()=>(ac(),Od(ic)),logs:()=>mc()}),se.SpanNames=kt.SpanNames,se.MetricNames=kt.MetricNames,se.debug=kt.debug,se.trace=kt.trace,se.metric=kt.metric});var wr=p(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getParsedType=U.ZodParsedType=U.objectUtil=U.util=void 0;var hi;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(hi||(U.util=hi={}));var _c;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_c||(U.objectUtil=_c={}));U.ZodParsedType=hi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Af=e=>{switch(typeof e){case"undefined":return U.ZodParsedType.undefined;case"string":return U.ZodParsedType.string;case"number":return Number.isNaN(e)?U.ZodParsedType.nan:U.ZodParsedType.number;case"boolean":return U.ZodParsedType.boolean;case"function":return U.ZodParsedType.function;case"bigint":return U.ZodParsedType.bigint;case"symbol":return U.ZodParsedType.symbol;case"object":return Array.isArray(e)?U.ZodParsedType.array:e===null?U.ZodParsedType.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?U.ZodParsedType.promise:typeof Map!="undefined"&&e instanceof Map?U.ZodParsedType.map:typeof Set!="undefined"&&e instanceof Set?U.ZodParsedType.set:typeof Date!="undefined"&&e instanceof Date?U.ZodParsedType.date:U.ZodParsedType.object;default:return U.ZodParsedType.unknown}};U.getParsedType=Af});var Nn=p(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ZodError=Ze.quotelessJson=Ze.ZodIssueCode=void 0;var bc=wr();Ze.ZodIssueCode=bc.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 wf=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");Ze.quotelessJson=wf;var Or=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let d=a.path[c];c===a.path.length-1?(s[d]=s[d]||{_errors:[]},s[d]._errors.push(r(a))):s[d]=s[d]||{_errors:[]},s=s[d],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,bc.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ze.ZodError=Or;Or.create=e=>new Or(e)});var yi=p(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var B=Nn(),tt=wr(),Of=(e,t)=>{let r;switch(e.code){case B.ZodIssueCode.invalid_type:e.received===tt.ZodParsedType.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case B.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tt.util.jsonStringifyReplacer)}`;break;case B.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${tt.util.joinValues(e.keys,", ")}`;break;case B.ZodIssueCode.invalid_union:r="Invalid input";break;case B.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tt.util.joinValues(e.options)}`;break;case B.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${tt.util.joinValues(e.options)}, received '${e.received}'`;break;case B.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case B.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case B.ZodIssueCode.invalid_date:r="Invalid date";break;case B.ZodIssueCode.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tt.util.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case B.ZodIssueCode.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case B.ZodIssueCode.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case B.ZodIssueCode.custom:r="Invalid input";break;case B.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case B.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case B.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,tt.util.assertNever(e)}return{message:r}};gi.default=Of});var jn=p(Le=>{"use strict";var Pf=Le&&Le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Le,"__esModule",{value:!0});Le.defaultErrorMap=void 0;Le.setErrorMap=Rf;Le.getErrorMap=Nf;var xc=Pf(yi());Le.defaultErrorMap=xc.default;var Tc=xc.default;function Rf(e){Tc=e}function Nf(){return Tc}});var _i=p(j=>{"use strict";var jf=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.isAsync=j.isValid=j.isDirty=j.isAborted=j.OK=j.DIRTY=j.INVALID=j.ParseStatus=j.EMPTY_PATH=j.makeIssue=void 0;j.addIssueToContext=Df;var kf=jn(),Cc=jf(yi()),Uf=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(d=>!!d).slice().reverse();for(let d of c)s=d(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};j.makeIssue=Uf;j.EMPTY_PATH=[];function Df(e,t){let r=(0,kf.getErrorMap)(),n=(0,j.makeIssue)({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Cc.default?void 0:Cc.default].filter(o=>!!o)});e.common.issues.push(n)}var vi=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return j.INVALID;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return j.INVALID;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value!="undefined"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}};j.ParseStatus=vi;j.INVALID=Object.freeze({status:"aborted"});var Zf=e=>({status:"dirty",value:e});j.DIRTY=Zf;var Lf=e=>({status:"valid",value:e});j.OK=Lf;var Mf=e=>e.status==="aborted";j.isAborted=Mf;var Vf=e=>e.status==="dirty";j.isDirty=Vf;var qf=e=>e.status==="valid";j.isValid=qf;var zf=e=>typeof Promise!="undefined"&&e instanceof Promise;j.isAsync=zf});var Ec=p(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0})});var Ac=p(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.errorUtil=void 0;var Sc;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Sc||(kn.errorUtil=Sc={}))});var Mc=p(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.discriminatedUnion=u.date=u.boolean=u.bigint=u.array=u.any=u.coerce=u.ZodFirstPartyTypeKind=u.late=u.ZodSchema=u.Schema=u.ZodReadonly=u.ZodPipeline=u.ZodBranded=u.BRAND=u.ZodNaN=u.ZodCatch=u.ZodDefault=u.ZodNullable=u.ZodOptional=u.ZodTransformer=u.ZodEffects=u.ZodPromise=u.ZodNativeEnum=u.ZodEnum=u.ZodLiteral=u.ZodLazy=u.ZodFunction=u.ZodSet=u.ZodMap=u.ZodRecord=u.ZodTuple=u.ZodIntersection=u.ZodDiscriminatedUnion=u.ZodUnion=u.ZodObject=u.ZodArray=u.ZodVoid=u.ZodNever=u.ZodUnknown=u.ZodAny=u.ZodNull=u.ZodUndefined=u.ZodSymbol=u.ZodDate=u.ZodBoolean=u.ZodBigInt=u.ZodNumber=u.ZodString=u.ZodType=void 0;u.NEVER=u.void=u.unknown=u.union=u.undefined=u.tuple=u.transformer=u.symbol=u.string=u.strictObject=u.set=u.record=u.promise=u.preprocess=u.pipeline=u.ostring=u.optional=u.onumber=u.oboolean=u.object=u.number=u.nullable=u.null=u.never=u.nativeEnum=u.nan=u.map=u.literal=u.lazy=u.intersection=u.instanceof=u.function=u.enum=u.effect=void 0;u.datetimeRegex=Nc;u.custom=kc;var m=Nn(),Un=jn(),v=Ac(),l=_i(),h=wr(),ue=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},wc=(e,t)=>{if((0,l.isValid)(t))return{success:!0,data:t.value};if(!e.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 m.ZodError(e.common.issues);return this._error=r,this._error}}};function A(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{var d,f;let{message:c}=e;return a.code==="invalid_enum_value"?{message:c!=null?c:s.defaultError}:typeof s.data=="undefined"?{message:(d=c!=null?c:n)!=null?d:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(f=c!=null?c:r)!=null?f:s.defaultError}},description:o}}var w=class{get description(){return this._def.description}_getType(t){return(0,h.getParsedType)(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new l.ParseStatus,ctx:{common:t.parent.common,data:t.data,parsedType:(0,h.getParsedType)(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if((0,l.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parseSync({data:t,path:n.path,parent:n});return wc(n,o)}"~validate"(t){var n,o;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:(0,h.getParsedType)(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return(0,l.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:t,path:[],parent:r}).then(i=>(0,l.isValid)(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,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:t,parsedType:(0,h.getParsedType)(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await((0,l.isAsync)(o)?o:Promise.resolve(o));return wc(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:m.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new oe({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 ce.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pe.create(this)}promise(){return qe.create(this,this._def)}or(t){return ct.create([this,t],this._def)}and(t){return ut.create(this,t,this._def)}transform(t){return new oe({...A(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new mt({...A(this._def),innerType:this,defaultValue:r,typeName:T.ZodDefault})}brand(){return new Pr({typeName:T.ZodBranded,type:this,...A(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ht({...A(this._def),innerType:this,catchValue:r,typeName:T.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Rr.create(this,t)}readonly(){return gt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=w;u.Schema=w;u.ZodSchema=w;var Ff=/^c[^\s-]{8,}$/i,Gf=/^[0-9a-z]+$/,$f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bf=/^[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,Hf=/^[a-z0-9_-]{21}$/i,Wf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Kf=/^[-+]?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)?)??$/,Yf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bi,Jf=/^(?:(?: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])$/,Qf=/^(?:(?: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])$/,ep=/^(([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]))$/,tp=/^(([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])$/,rp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,np=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pc="((\\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])))",op=new RegExp(`^${Pc}$`);function Rc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ip(e){return new RegExp(`^${Rc(e)}$`)}function Nc(e){let t=`${Pc}T${Rc(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ap(e,t){return!!((t==="v4"||!t)&&Jf.test(e)||(t==="v6"||!t)&&ep.test(e))}function sp(e,t){if(!Wf.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function cp(e,t){return!!((t==="v4"||!t)&&Qf.test(e)||(t==="v6"||!t)&&tp.test(e))}var Me=class e extends w{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==h.ZodParsedType.string){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:i.parsedType}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Yf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"email",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bi||(bi=new RegExp(Xf,"u")),bi.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"emoji",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Bf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"uuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Hf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"nanoid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Ff.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Gf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cuid2",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$f.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ulid",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"regex",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Nc(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?op.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ip(i).test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Kf.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"duration",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ap(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"ip",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?sp(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"jwt",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?cp(t.data,i.version)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"cidr",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?rp.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?np.test(t.data)||(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{validation:"base64url",code:m.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):h.util.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:m.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...v.errorUtil.errToObj(t)})}url(t){return this._addCheck({kind:"url",...v.errorUtil.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!=null?r:!1,local:(n=t==null?void 0:t.local)!=null?n:!1,...v.errorUtil.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,...v.errorUtil.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...v.errorUtil.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...v.errorUtil.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...v.errorUtil.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...v.errorUtil.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...v.errorUtil.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...v.errorUtil.errToObj(r)})}nonempty(t){return this.min(1,v.errorUtil.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodString=Me;Me.create=e=>{var t;return new Me({checks:[],typeName:T.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};function up(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var rt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==h.ZodParsedType.number){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:i.parsedType}),l.INVALID}let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="int"?h.util.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?up(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_finite,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:v.errorUtil.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:v.errorUtil.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&h.util.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};u.ZodNumber=rt;rt.create=e=>new rt({checks:[],typeName:T.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var nt=class e extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==h.ZodParsedType.bigint)return this._getInvalidInput(t);let n,o=new l.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):h.util.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:r.parsedType}),l.INVALID}gte(t,r){return this.setLimit("min",t,!0,v.errorUtil.toString(r))}gt(t,r){return this.setLimit("min",t,!1,v.errorUtil.toString(r))}lte(t,r){return this.setLimit("max",t,!0,v.errorUtil.toString(r))}lt(t,r){return this.setLimit("max",t,!1,v.errorUtil.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:v.errorUtil.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};u.ZodBigInt=nt;nt.create=e=>{var t;return new nt({checks:[],typeName:T.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};var ot=class extends w{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodBoolean=ot;ot.create=e=>new ot({typeName:T.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...A(e)});var it=class e extends w{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==h.ZodParsedType.date){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:i.parsedType}),l.INVALID}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(i,{code:m.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),(0,l.addIssueToContext)(o,{code:m.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(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:v.errorUtil.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};u.ZodDate=it;it.create=e=>new it({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:T.ZodDate,...A(e)});var Lt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodSymbol=Lt;Lt.create=e=>new Lt({typeName:T.ZodSymbol,...A(e)});var at=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodUndefined=at;at.create=e=>new at({typeName:T.ZodUndefined,...A(e)});var st=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodNull=st;st.create=e=>new st({typeName:T.ZodNull,...A(e)});var Ve=class extends w{constructor(){super(...arguments),this._any=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodAny=Ve;Ve.create=e=>new Ve({typeName:T.ZodAny,...A(e)});var Oe=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodUnknown=Oe;Oe.create=e=>new Oe({typeName:T.ZodUnknown,...A(e)});var fe=class extends w{_parse(t){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:r.parsedType}),l.INVALID}};u.ZodNever=fe;fe.create=e=>new fe({typeName:T.ZodNever,...A(e)});var Mt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),l.INVALID}return(0,l.OK)(t.data)}};u.ZodVoid=Mt;Mt.create=e=>new Mt({typeName:T.ZodVoid,...A(e)});var Pe=class e extends w{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:r.parsedType}),l.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,l.addIssueToContext)(r,{code:a?m.ZodIssueCode.too_big:m.ZodIssueCode.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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,l.addIssueToContext)(r,{code:m.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,l.addIssueToContext)(r,{code:m.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((a,s)=>o.type._parseAsync(new ue(r,a,r.path,s)))).then(a=>l.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ue(r,a,r.path,s)));return l.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:v.errorUtil.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:v.errorUtil.toString(r)}})}nonempty(t){return this.min(1,t)}};u.ZodArray=Pe;Pe.create=(e,t)=>new Pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...A(t)});function Zt(e){if(e instanceof ee){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ce.create(Zt(n))}return new ee({...e._def,shape:()=>t})}else return e instanceof Pe?new Pe({...e._def,type:Zt(e.element)}):e instanceof ce?ce.create(Zt(e.unwrap())):e instanceof Ce?Ce.create(Zt(e.unwrap())):e instanceof Te?Te.create(e.items.map(t=>Zt(t))):e}var ee=class e extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=h.util.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==h.ZodParsedType.object){let d=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(d,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:d.parsedType}),l.INVALID}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof fe&&this._def.unknownKeys==="strip"))for(let d in o.data)a.includes(d)||s.push(d);let c=[];for(let d of a){let f=i[d],g=o.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new ue(o,g,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof fe){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of s)c.push({key:{status:"valid",value:f},value:{status:"valid",value:o.data[f]}});else if(d==="strict")s.length>0&&((0,l.addIssueToContext)(o,{code:m.ZodIssueCode.unrecognized_keys,keys:s}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of s){let g=o.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new ue(o,g,o.path,f)),alwaysSet:f in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of c){let g=await f.key,_=await f.value;d.push({key:g,value:_,alwaysSet:f.alwaysSet})}return d}).then(d=>l.ParseStatus.mergeObjectSync(n,d)):l.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return v.errorUtil.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var i,a,s,c;let o=(s=(a=(i=this._def).errorMap)==null?void 0:a.call(i,r,n).message)!=null?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(t).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:T.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of h.util.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of h.util.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zt(this)}partial(t){let r={};for(let n of h.util.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of h.util.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ce;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return jc(h.util.objectKeys(this.shape))}};u.ZodObject=ee;ee.create=(e,t)=>new ee({shape:()=>e,unknownKeys:"strip",catchall:fe.create(),typeName:T.ZodObject,...A(t)});ee.strictCreate=(e,t)=>new ee({shape:()=>e,unknownKeys:"strict",catchall:fe.create(),typeName:T.ZodObject,...A(t)});ee.lazycreate=(e,t)=>new ee({shape:e,unknownKeys:"strip",catchall:fe.create(),typeName:T.ZodObject,...A(t)});var ct=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new m.ZodError(s.ctx.common.issues));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:a}),l.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new m.ZodError(c));return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union,unionErrors:s}),l.INVALID}}get options(){return this._def.options}};u.ZodUnion=ct;ct.create=(e,t)=>new ct({options:e,typeName:T.ZodUnion,...A(t)});var we=e=>e instanceof dt?we(e.schema):e instanceof oe?we(e.innerType()):e instanceof lt?[e.value]:e instanceof ft?e.options:e instanceof pt?h.util.objectValues(e.enum):e instanceof mt?we(e._def.innerType):e instanceof at?[void 0]:e instanceof st?[null]:e instanceof ce?[void 0,...we(e.unwrap())]:e instanceof Ce?[null,...we(e.unwrap())]:e instanceof Pr||e instanceof gt?we(e.unwrap()):e instanceof ht?we(e._def.innerType):[],Dn=class e extends w{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:r.parsedType}),l.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,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=we(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:T.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...A(n)})}};u.ZodDiscriminatedUnion=Dn;function xi(e,t){let r=(0,h.getParsedType)(e),n=(0,h.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(r===h.ZodParsedType.object&&n===h.ZodParsedType.object){let o=h.util.objectKeys(t),i=h.util.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=xi(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=xi(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ut=class extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if((0,l.isAborted)(i)||(0,l.isAborted)(a))return l.INVALID;let s=xi(i.value,a.value);return s.valid?(((0,l.isDirty)(i)||(0,l.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_intersection_types}),l.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,a])=>o(i,a)):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}))}};u.ZodIntersection=ut;ut.create=(e,t,r)=>new ut({left:e,right:t,typeName:T.ZodIntersection,...A(r)});var Te=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.array)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,l.addIssueToContext)(n,{code:m.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ue(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>l.ParseStatus.mergeArray(r,a)):l.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};u.ZodTuple=Te;Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:T.ZodTuple,rest:null,...A(t)})};var Zn=class e extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.object)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),l.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new ue(n,s,n.path,s)),value:a._parse(new ue(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(r,o):l.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof w?new e({keyType:t,valueType:r,typeName:T.ZodRecord,...A(n)}):new e({keyType:Me.create(),valueType:t,typeName:T.ZodRecord,...A(r)})}};u.ZodRecord=Zn;var Vt=class extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.map)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),l.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],d)=>({key:o._parse(new ue(n,s,n.path,[d,"key"])),value:i._parse(new ue(n,c,n.path,[d,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let d=await c.key,f=await c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return l.INVALID;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),s.set(d.value,f.value)}return{status:r.value,value:s}}}};u.ZodMap=Vt;Vt.create=(e,t,r)=>new Vt({valueType:t,keyType:e,typeName:T.ZodMap,...A(r)});var qt=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==h.ZodParsedType.set)return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),l.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,l.addIssueToContext)(n,{code:m.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,l.addIssueToContext)(n,{code:m.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 a(c){let d=new Set;for(let f of c){if(f.status==="aborted")return l.INVALID;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let s=[...n.data.values()].map((c,d)=>i._parse(new ue(n,c,n.path,d)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:v.errorUtil.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:v.errorUtil.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};u.ZodSet=qt;qt.create=(e,t)=>new qt({valueType:e,minSize:null,maxSize:null,typeName:T.ZodSet,...A(t)});var Ln=class e extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.function)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:r.parsedType}),l.INVALID;function n(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(s,c){return(0,l.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Un.getErrorMap)(),Un.defaultErrorMap].filter(d=>!!d),issueData:{code:m.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof qe){let s=this;return(0,l.OK)(async function(...c){let d=new m.ZodError([]),f=await s._def.args.parseAsync(c,i).catch(I=>{throw d.addIssue(n(c,I)),d}),g=await Reflect.apply(a,this,f);return await s._def.returns._def.type.parseAsync(g,i).catch(I=>{throw d.addIssue(o(g,I)),d})})}else{let s=this;return(0,l.OK)(function(...c){let d=s._def.args.safeParse(c,i);if(!d.success)throw new m.ZodError([n(c,d.error)]);let f=Reflect.apply(a,this,d.data),g=s._def.returns.safeParse(f,i);if(!g.success)throw new m.ZodError([o(f,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Te.create(t).rest(Oe.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Te.create([]).rest(Oe.create()),returns:r||Oe.create(),typeName:T.ZodFunction,...A(n)})}};u.ZodFunction=Ln;var dt=class extends w{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};u.ZodLazy=dt;dt.create=(e,t)=>new dt({getter:e,typeName:T.ZodLazy,...A(t)});var lt=class extends w{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return{status:"valid",value:t.data}}get value(){return this._def.value}};u.ZodLiteral=lt;lt.create=(e,t)=>new lt({value:e,typeName:T.ZodLiteral,...A(t)});function jc(e,t){return new ft({values:e,typeName:T.ZodEnum,...A(t)})}var ft=class e extends w{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{expected:h.util.joinValues(n),received:r.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return(0,l.addIssueToContext)(r,{received:r.data,code:m.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return(0,l.OK)(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};u.ZodEnum=ft;ft.create=jc;var pt=class extends w{_parse(t){let r=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{expected:h.util.joinValues(o),received:n.parsedType,code:m.ZodIssueCode.invalid_type}),l.INVALID}if(this._cache||(this._cache=new Set(h.util.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=h.util.objectValues(r);return(0,l.addIssueToContext)(n,{received:n.data,code:m.ZodIssueCode.invalid_enum_value,options:o}),l.INVALID}return(0,l.OK)(t.data)}get enum(){return this._def.values}};u.ZodNativeEnum=pt;pt.create=(e,t)=>new pt({values:e,typeName:T.ZodNativeEnum,...A(t)});var qe=class extends w{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==h.ZodParsedType.promise&&r.common.async===!1)return(0,l.addIssueToContext)(r,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:r.parsedType}),l.INVALID;let n=r.parsedType===h.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,l.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=qe;qe.create=(e,t)=>new qe({type:e,typeName:T.ZodPromise,...A(t)});var oe=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{(0,l.addIssueToContext)(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return l.INVALID;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?l.INVALID:c.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(c.value):c});{if(r.value==="aborted")return l.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"||r.value==="dirty"?(0,l.DIRTY)(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?l.INVALID:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,l.isValid)(a))return l.INVALID;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,l.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):l.INVALID);h.util.assertNever(o)}};u.ZodEffects=oe;u.ZodTransformer=oe;oe.create=(e,t,r)=>new oe({schema:e,typeName:T.ZodEffects,effect:t,...A(r)});oe.createWithPreprocess=(e,t,r)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:T.ZodEffects,...A(r)});var ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.undefined?(0,l.OK)(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodOptional=ce;ce.create=(e,t)=>new ce({innerType:e,typeName:T.ZodOptional,...A(t)});var Ce=class extends w{_parse(t){return this._getType(t)===h.ZodParsedType.null?(0,l.OK)(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};u.ZodNullable=Ce;Ce.create=(e,t)=>new Ce({innerType:e,typeName:T.ZodNullable,...A(t)});var mt=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),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}};u.ZodDefault=mt;mt.create=(e,t)=>new mt({innerType:e,typeName:T.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...A(t)});var ht=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,l.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new m.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=ht;ht.create=(e,t)=>new ht({innerType:e,typeName:T.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...A(t)});var zt=class extends w{_parse(t){if(this._getType(t)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(t);return(0,l.addIssueToContext)(n,{code:m.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return{status:"valid",value:t.data}}};u.ZodNaN=zt;zt.create=e=>new zt({typeName:T.ZodNaN,...A(e)});u.BRAND=Symbol("zod_brand");var Pr=class extends w{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};u.ZodBranded=Pr;var Rr=class e extends w{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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"?l.INVALID:i.status==="dirty"?(r.dirty(),(0,l.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"?l.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(t,r){return new e({in:t,out:r,typeName:T.ZodPipeline})}};u.ZodPipeline=Rr;var gt=class extends w{_parse(t){let r=this._def.innerType._parse(t),n=o=>((0,l.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,l.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=gt;gt.create=(e,t)=>new gt({innerType:e,typeName:T.ZodReadonly,...A(t)});function Oc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function kc(e,t={},r){return e?Ve.create().superRefine((n,o)=>{var a,s;let i=e(n);if(i instanceof Promise)return i.then(c=>{var d,f;if(!c){let g=Oc(t,n),_=(f=(d=g.fatal)!=null?d:r)!=null?f:!0;o.addIssue({code:"custom",...g,fatal:_})}});if(!i){let c=Oc(t,n),d=(s=(a=c.fatal)!=null?a:r)!=null?s:!0;o.addIssue({code:"custom",...c,fatal:d})}}):Ve.create()}u.late={object:ee.lazycreate};var T;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(T||(u.ZodFirstPartyTypeKind=T={}));var dp=(e,t={message:`Input not instance of ${e.name}`})=>kc(r=>r instanceof e,t);u.instanceof=dp;var Uc=Me.create;u.string=Uc;var Dc=rt.create;u.number=Dc;var lp=zt.create;u.nan=lp;var fp=nt.create;u.bigint=fp;var Zc=ot.create;u.boolean=Zc;var pp=it.create;u.date=pp;var mp=Lt.create;u.symbol=mp;var hp=at.create;u.undefined=hp;var gp=st.create;u.null=gp;var yp=Ve.create;u.any=yp;var vp=Oe.create;u.unknown=vp;var _p=fe.create;u.never=_p;var bp=Mt.create;u.void=bp;var xp=Pe.create;u.array=xp;var Tp=ee.create;u.object=Tp;var Cp=ee.strictCreate;u.strictObject=Cp;var Ip=ct.create;u.union=Ip;var Ep=Dn.create;u.discriminatedUnion=Ep;var Sp=ut.create;u.intersection=Sp;var Ap=Te.create;u.tuple=Ap;var wp=Zn.create;u.record=wp;var Op=Vt.create;u.map=Op;var Pp=qt.create;u.set=Pp;var Rp=Ln.create;u.function=Rp;var Np=dt.create;u.lazy=Np;var jp=lt.create;u.literal=jp;var kp=ft.create;u.enum=kp;var Up=pt.create;u.nativeEnum=Up;var Dp=qe.create;u.promise=Dp;var Lc=oe.create;u.effect=Lc;u.transformer=Lc;var Zp=ce.create;u.optional=Zp;var Lp=Ce.create;u.nullable=Lp;var Mp=oe.createWithPreprocess;u.preprocess=Mp;var Vp=Rr.create;u.pipeline=Vp;var qp=()=>Uc().optional();u.ostring=qp;var zp=()=>Dc().optional();u.onumber=zp;var Fp=()=>Zc().optional();u.oboolean=Fp;u.coerce={string:(e=>Me.create({...e,coerce:!0})),number:(e=>rt.create({...e,coerce:!0})),boolean:(e=>ot.create({...e,coerce:!0})),bigint:(e=>nt.create({...e,coerce:!0})),date:(e=>it.create({...e,coerce:!0}))};u.NEVER=l.INVALID});var Ti=p(de=>{"use strict";var Gp=de&&de.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ft=de&&de.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Gp(t,e,r)};Object.defineProperty(de,"__esModule",{value:!0});Ft(jn(),de);Ft(_i(),de);Ft(Ec(),de);Ft(wr(),de);Ft(Mc(),de);Ft(Nn(),de)});var D=p(te=>{"use strict";var Vc=te&&te.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),$p=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Bp=te&&te.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Vc(t,e,r);return $p(t,e),t},Hp=te&&te.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Vc(t,e,r)};Object.defineProperty(te,"__esModule",{value:!0});te.z=void 0;var qc=Bp(Ti());te.z=qc;Hp(Ti(),te);te.default=qc});var Ci=p(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.actionTypesZodSchema=Gt.ActionTypes=void 0;var Wp=D(),zc;(function(e){e.OpenUrl="openUrl",e.ImBack="imBack",e.PostBack="postBack",e.PlayAudio="playAudio",e.PlayVideo="playVideo",e.ShowImage="showImage",e.DownloadFile="downloadFile",e.Signin="signin",e.Call="call",e.MessageBack="messageBack",e.OpenApp="openApp"})(zc||(Gt.ActionTypes=zc={}));Gt.actionTypesZodSchema=Wp.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var Ii=p($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.semanticActionStateTypesZodSchema=$t.SemanticActionStateTypes=void 0;var Kp=D(),Fc;(function(e){e.Start="start",e.Continue="continue",e.Done="done"})(Fc||($t.SemanticActionStateTypes=Fc={}));$t.semanticActionStateTypesZodSchema=Kp.z.enum(["start","continue","done"])});var Ei=p(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.attachmentLayoutTypesZodSchema=Bt.AttachmentLayoutTypes=void 0;var Yp=D(),Gc;(function(e){e.List="list",e.Carousel="carousel"})(Gc||(Bt.AttachmentLayoutTypes=Gc={}));Bt.attachmentLayoutTypesZodSchema=Yp.z.enum(["list","carousel"])});var Si=p(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Channels=void 0;var $c;(function(e){e.Agents="agents",e.Alexa="alexa",e.Console="console",e.Directline="directline",e.DirectlineSpeech="directlinespeech",e.Email="email",e.Emulator="emulator",e.Facebook="facebook",e.Groupme="groupme",e.Line="line",e.Msteams="msteams",e.M365CopilotSubChannel="COPILOT",e.M365Copilot="msteams:COPILOT",e.Omni="omnichannel",e.Outlook="outlook",e.Skype="skype",e.Slack="slack",e.Sms="sms",e.Telegram="telegram",e.Telephony="telephony",e.Test="test",e.Webchat="webchat"})($c||(Mn.Channels=$c={}))});var Ai=p(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.endOfConversationCodesZodSchema=Ht.EndOfConversationCodes=void 0;var Xp=D(),Bc;(function(e){e.Unknown="unknown",e.CompletedSuccessfully="completedSuccessfully",e.UserCancelled="userCancelled",e.AgentTimedOut="agentTimedOut",e.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",e.ChannelFailed="channelFailed"})(Bc||(Ht.EndOfConversationCodes=Bc={}));Ht.endOfConversationCodesZodSchema=Xp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Wc=p(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.MembershipSourceTypes=void 0;var Hc;(function(e){e.Channel="channel",e.Team="team"})(Hc||(Vn.MembershipSourceTypes=Hc={}))});var Yc=p(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.MembershipTypes=void 0;var Kc;(function(e){e.Direct="direct",e.Transitive="transitive"})(Kc||(qn.MembershipTypes=Kc={}))});var Nr=p(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.roleTypeZodSchema=Wt.RoleTypes=void 0;var Jp=D(),Xc;(function(e){e.User="user",e.Agent="bot",e.Skill="skill",e.AgenticIdentity="agenticAppInstance",e.AgenticUser="agenticUser"})(Xc||(Wt.RoleTypes=Xc={}));Wt.roleTypeZodSchema=Jp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var Jc=p(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.addAIToActivity=void 0;var Qp=(e,t,r)=>{var n;let o={type:"https://schema.org/Message","@type":"Message","@context":"https://schema.org","@id":"",additionalType:["AIGeneratedContent"],citation:t,usageInfo:r};(n=e.entities)!==null&&n!==void 0||(e.entities=[]),e.entities.push(o)};zn.addAIToActivity=Qp});var Qc=p(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.adaptiveCardInvokeActionZodSchema=void 0;var yt=D();Fn.adaptiveCardInvokeActionZodSchema=yt.z.object({type:yt.z.string().min(1),id:yt.z.string().optional(),verb:yt.z.string().min(1),data:yt.z.record(yt.z.string().min(1),yt.z.any())})});var eu=p(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var tu=p(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.default="00000000-0000-0000-0000-000000000000"});var ru=p(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.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 jr=p(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var em=ru();function tm(e){return typeof e=="string"&&em.default.test(e)}Ri.default=tm});var kr=p(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var rm=jr();function nm(e){if(!(0,rm.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Ni.default=nm});var Re=p(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.unsafeStringify=void 0;var om=jr(),F=[];for(let e=0;e<256;++e)F.push((e+256).toString(16).slice(1));function nu(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}Ur.unsafeStringify=nu;function im(e,t=0){let r=nu(e,t);if(!(0,om.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ur.default=im});var Gn=p(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var ji,am=new Uint8Array(16);function sm(){if(!ji){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ji=crypto.getRandomValues.bind(crypto)}return ji(am)}ki.default=sm});var Ui=p(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.updateV1State=void 0;var ou=Gn(),cm=Re(),Dr={};function um(e,t,r){var i,a,s,c;let n,o=(i=e==null?void 0:e._v6)!=null?i:!1;if(e){let d=Object.keys(e);d.length===1&&d[0]==="_v6"&&(e=void 0)}if(e)n=iu((c=(s=e.random)!=null?s:(a=e.rng)==null?void 0:a.call(e))!=null?c:(0,ou.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let d=Date.now(),f=(0,ou.default)();au(Dr,d,f),n=iu(f,Dr.msecs,Dr.nsecs,o?void 0:Dr.clockseq,o?void 0:Dr.node,t,r)}return t!=null?t:(0,cm.unsafeStringify)(n)}function au(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.nsecs)!=null||(e.nsecs=0),t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}Zr.updateV1State=au;function iu(e,t,r,n,o,i,a=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!i)i=new Uint8Array(16),a=0;else if(a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);t!=null||(t=Date.now()),r!=null||(r=0),n!=null||(n=(e[8]<<8|e[9])&16383),o!=null||(o=e.slice(10,16)),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;i[a++]=s>>>24&255,i[a++]=s>>>16&255,i[a++]=s>>>8&255,i[a++]=s&255;let c=t/4294967296*1e4&268435455;i[a++]=c>>>8&255,i[a++]=c&255,i[a++]=c>>>24&15|16,i[a++]=c>>>16&255,i[a++]=n>>>8|128,i[a++]=n&255;for(let d=0;d<6;++d)i[a++]=o[d];return i}Zr.default=um});var Zi=p(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});var dm=kr(),lm=Re();function fm(e){let t=typeof e=="string"?(0,dm.default)(e):e,r=pm(t);return typeof e=="string"?(0,lm.unsafeStringify)(r):r}Di.default=fm;function pm(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var cu=p(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});function mm(e){let t=ym(e),r=gm(t,e.length*8);return hm(r)}function hm(e){let t=new Uint8Array(e.length*4);for(let r=0;r<e.length*4;r++)t[r]=e[r>>2]>>>r%4*8&255;return t}function su(e){return(e+64>>>9<<4)+14+1}function gm(e,t){let r=new Uint32Array(su(t)).fill(0);r.set(e),r[t>>5]|=128<<t%32,r[r.length-1]=t,e=r;let n=1732584193,o=-271733879,i=-1732584194,a=271733878;for(let s=0;s<e.length;s+=16){let c=n,d=o,f=i,g=a;n=H(n,o,i,a,e[s],7,-680876936),a=H(a,n,o,i,e[s+1],12,-389564586),i=H(i,a,n,o,e[s+2],17,606105819),o=H(o,i,a,n,e[s+3],22,-1044525330),n=H(n,o,i,a,e[s+4],7,-176418897),a=H(a,n,o,i,e[s+5],12,1200080426),i=H(i,a,n,o,e[s+6],17,-1473231341),o=H(o,i,a,n,e[s+7],22,-45705983),n=H(n,o,i,a,e[s+8],7,1770035416),a=H(a,n,o,i,e[s+9],12,-1958414417),i=H(i,a,n,o,e[s+10],17,-42063),o=H(o,i,a,n,e[s+11],22,-1990404162),n=H(n,o,i,a,e[s+12],7,1804603682),a=H(a,n,o,i,e[s+13],12,-40341101),i=H(i,a,n,o,e[s+14],17,-1502002290),o=H(o,i,a,n,e[s+15],22,1236535329),n=W(n,o,i,a,e[s+1],5,-165796510),a=W(a,n,o,i,e[s+6],9,-1069501632),i=W(i,a,n,o,e[s+11],14,643717713),o=W(o,i,a,n,e[s],20,-373897302),n=W(n,o,i,a,e[s+5],5,-701558691),a=W(a,n,o,i,e[s+10],9,38016083),i=W(i,a,n,o,e[s+15],14,-660478335),o=W(o,i,a,n,e[s+4],20,-405537848),n=W(n,o,i,a,e[s+9],5,568446438),a=W(a,n,o,i,e[s+14],9,-1019803690),i=W(i,a,n,o,e[s+3],14,-187363961),o=W(o,i,a,n,e[s+8],20,1163531501),n=W(n,o,i,a,e[s+13],5,-1444681467),a=W(a,n,o,i,e[s+2],9,-51403784),i=W(i,a,n,o,e[s+7],14,1735328473),o=W(o,i,a,n,e[s+12],20,-1926607734),n=K(n,o,i,a,e[s+5],4,-378558),a=K(a,n,o,i,e[s+8],11,-2022574463),i=K(i,a,n,o,e[s+11],16,1839030562),o=K(o,i,a,n,e[s+14],23,-35309556),n=K(n,o,i,a,e[s+1],4,-1530992060),a=K(a,n,o,i,e[s+4],11,1272893353),i=K(i,a,n,o,e[s+7],16,-155497632),o=K(o,i,a,n,e[s+10],23,-1094730640),n=K(n,o,i,a,e[s+13],4,681279174),a=K(a,n,o,i,e[s],11,-358537222),i=K(i,a,n,o,e[s+3],16,-722521979),o=K(o,i,a,n,e[s+6],23,76029189),n=K(n,o,i,a,e[s+9],4,-640364487),a=K(a,n,o,i,e[s+12],11,-421815835),i=K(i,a,n,o,e[s+15],16,530742520),o=K(o,i,a,n,e[s+2],23,-995338651),n=Y(n,o,i,a,e[s],6,-198630844),a=Y(a,n,o,i,e[s+7],10,1126891415),i=Y(i,a,n,o,e[s+14],15,-1416354905),o=Y(o,i,a,n,e[s+5],21,-57434055),n=Y(n,o,i,a,e[s+12],6,1700485571),a=Y(a,n,o,i,e[s+3],10,-1894986606),i=Y(i,a,n,o,e[s+10],15,-1051523),o=Y(o,i,a,n,e[s+1],21,-2054922799),n=Y(n,o,i,a,e[s+8],6,1873313359),a=Y(a,n,o,i,e[s+15],10,-30611744),i=Y(i,a,n,o,e[s+6],15,-1560198380),o=Y(o,i,a,n,e[s+13],21,1309151649),n=Y(n,o,i,a,e[s+4],6,-145523070),a=Y(a,n,o,i,e[s+11],10,-1120210379),i=Y(i,a,n,o,e[s+2],15,718787259),o=Y(o,i,a,n,e[s+9],21,-343485551),n=ze(n,c),o=ze(o,d),i=ze(i,f),a=ze(a,g)}return Uint32Array.of(n,o,i,a)}function ym(e){if(e.length===0)return new Uint32Array;let t=new Uint32Array(su(e.length*8)).fill(0);for(let r=0;r<e.length;r++)t[r>>2]|=(e[r]&255)<<r%4*8;return t}function ze(e,t){let r=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(r>>16)<<16|r&65535}function vm(e,t){return e<<t|e>>>32-t}function $n(e,t,r,n,o,i){return ze(vm(ze(ze(t,e),ze(n,i)),o),r)}function H(e,t,r,n,o,i,a){return $n(t&r|~t&n,e,t,o,i,a)}function W(e,t,r,n,o,i,a){return $n(t&n|r&~n,e,t,o,i,a)}function K(e,t,r,n,o,i,a){return $n(t^r^n,e,t,o,i,a)}function Y(e,t,r,n,o,i,a){return $n(r^(t|~n),e,t,o,i,a)}Li.default=mm});var Lr=p(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.URL=Ne.DNS=Ne.stringToBytes=void 0;var uu=kr(),_m=Re();function du(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}Ne.stringToBytes=du;Ne.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ne.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function bm(e,t,r,n,o,i){let a=typeof r=="string"?du(r):r,s=typeof n=="string"?(0,uu.default)(n):n;if(typeof n=="string"&&(n=(0,uu.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+a.length);if(c.set(s),c.set(a,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,o){i=i||0;for(let d=0;d<16;++d)o[i+d]=c[d];return o}return(0,_m.unsafeStringify)(c)}Ne.default=bm});var fu=p(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.URL=vt.DNS=void 0;var xm=cu(),Mi=Lr(),lu=Lr();Object.defineProperty(vt,"DNS",{enumerable:!0,get:function(){return lu.DNS}});Object.defineProperty(vt,"URL",{enumerable:!0,get:function(){return lu.URL}});function Vi(e,t,r,n){return(0,Mi.default)(48,xm.default,e,t,r,n)}Vi.DNS=Mi.DNS;Vi.URL=Mi.URL;vt.default=Vi});var pu=p(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Tm=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);qi.default={randomUUID:Tm}});var hu=p(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var mu=pu(),Cm=Gn(),Im=Re();function Em(e,t,r){var o,i,a;if(mu.default.randomUUID&&!t&&!e)return mu.default.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,Cm.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,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return(0,Im.unsafeStringify)(n)}zi.default=Em});var gu=p(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});function Sm(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function Fi(e,t){return e<<t|e>>>32-t}function Am(e){let t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128,e=n;let o=e.length/4+2,i=Math.ceil(o/16),a=new Array(i);for(let s=0;s<i;++s){let c=new Uint32Array(16);for(let d=0;d<16;++d)c[d]=e[s*64+d*4]<<24|e[s*64+d*4+1]<<16|e[s*64+d*4+2]<<8|e[s*64+d*4+3];a[s]=c}a[i-1][14]=(e.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let c=new Uint32Array(80);for(let P=0;P<16;++P)c[P]=a[s][P];for(let P=16;P<80;++P)c[P]=Fi(c[P-3]^c[P-8]^c[P-14]^c[P-16],1);let d=r[0],f=r[1],g=r[2],_=r[3],I=r[4];for(let P=0;P<80;++P){let y=Math.floor(P/20),S=Fi(d,5)+Sm(y,f,g,_)+I+t[y]+c[P]>>>0;I=_,_=g,g=Fi(f,30)>>>0,f=d,d=S}r[0]=r[0]+d>>>0,r[1]=r[1]+f>>>0,r[2]=r[2]+g>>>0,r[3]=r[3]+_>>>0,r[4]=r[4]+I>>>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])}Gi.default=Am});var vu=p(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.URL=_t.DNS=void 0;var wm=gu(),$i=Lr(),yu=Lr();Object.defineProperty(_t,"DNS",{enumerable:!0,get:function(){return yu.DNS}});Object.defineProperty(_t,"URL",{enumerable:!0,get:function(){return yu.URL}});function Bi(e,t,r,n){return(0,$i.default)(80,wm.default,e,t,r,n)}Bi.DNS=$i.DNS;Bi.URL=$i.URL;_t.default=Bi});var _u=p(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Om=Re(),Pm=Ui(),Rm=Zi();function Nm(e,t,r){e!=null||(e={}),r!=null||(r=0);let n=(0,Pm.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,Rm.default)(n),t){for(let o=0;o<16;o++)t[r+o]=n[o];return t}return(0,Om.unsafeStringify)(n)}Hi.default=Nm});var bu=p(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var jm=kr(),km=Re();function Um(e){let t=typeof e=="string"?(0,jm.default)(e):e,r=Dm(t);return typeof e=="string"?(0,km.unsafeStringify)(r):r}Wi.default=Um;function Dm(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Iu=p(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.updateV7State=void 0;var xu=Gn(),Zm=Re(),Ki={};function Lm(e,t,r){var o,i,a;let n;if(e)n=Tu((a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,xu.default)(),e.msecs,e.seq,t,r);else{let s=Date.now(),c=(0,xu.default)();Cu(Ki,s,c),n=Tu(c,Ki.msecs,Ki.seq,t,r)}return t!=null?t:(0,Zm.unsafeStringify)(n)}function Cu(e,t,r){var n,o;return(n=e.msecs)!=null||(e.msecs=-1/0),(o=e.seq)!=null||(e.seq=0),t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}Mr.updateV7State=Cu;function Tu(e,t,r,n,o=0){if(e.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 t!=null||(t=Date.now()),r!=null||(r=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9]),n[o++]=t/1099511627776&255,n[o++]=t/4294967296&255,n[o++]=t/16777216&255,n[o++]=t/65536&255,n[o++]=t/256&255,n[o++]=t&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|e[10]&3,n[o++]=e[11],n[o++]=e[12],n[o++]=e[13],n[o++]=e[14],n[o++]=e[15],n}Mr.default=Lm});var Eu=p(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Mm=jr();function Vm(e){if(!(0,Mm.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Yi.default=Vm});var Su=p(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.version=R.validate=R.v7=R.v6ToV1=R.v6=R.v5=R.v4=R.v3=R.v1ToV6=R.v1=R.stringify=R.parse=R.NIL=R.MAX=void 0;var qm=eu();Object.defineProperty(R,"MAX",{enumerable:!0,get:function(){return qm.default}});var zm=tu();Object.defineProperty(R,"NIL",{enumerable:!0,get:function(){return zm.default}});var Fm=kr();Object.defineProperty(R,"parse",{enumerable:!0,get:function(){return Fm.default}});var Gm=Re();Object.defineProperty(R,"stringify",{enumerable:!0,get:function(){return Gm.default}});var $m=Ui();Object.defineProperty(R,"v1",{enumerable:!0,get:function(){return $m.default}});var Bm=Zi();Object.defineProperty(R,"v1ToV6",{enumerable:!0,get:function(){return Bm.default}});var Hm=fu();Object.defineProperty(R,"v3",{enumerable:!0,get:function(){return Hm.default}});var Wm=hu();Object.defineProperty(R,"v4",{enumerable:!0,get:function(){return Wm.default}});var Km=vu();Object.defineProperty(R,"v5",{enumerable:!0,get:function(){return Km.default}});var Ym=_u();Object.defineProperty(R,"v6",{enumerable:!0,get:function(){return Ym.default}});var Xm=bu();Object.defineProperty(R,"v6ToV1",{enumerable:!0,get:function(){return Xm.default}});var Jm=Iu();Object.defineProperty(R,"v7",{enumerable:!0,get:function(){return Jm.default}});var Qm=jr();Object.defineProperty(R,"validate",{enumerable:!0,get:function(){return Qm.default}});var eh=Eu();Object.defineProperty(R,"version",{enumerable:!0,get:function(){return eh.default}})});var Xi=p(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.entityZodSchema=void 0;var Au=D();Bn.entityZodSchema=Au.z.object({type:Au.z.string().min(1)}).passthrough()});var wu=p(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.semanticActionZodSchema=void 0;var Vr=D(),th=Xi(),rh=Ii();Hn.semanticActionZodSchema=Vr.z.object({id:Vr.z.string().min(1),state:Vr.z.union([rh.semanticActionStateTypesZodSchema,Vr.z.string().min(1)]),entities:Vr.z.record(th.entityZodSchema)})});var Ou=p(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.cardActionZodSchema=void 0;var Ie=D(),nh=Ci();Wn.cardActionZodSchema=Ie.z.object({type:Ie.z.union([nh.actionTypesZodSchema,Ie.z.string().min(1)]),title:Ie.z.string().min(1),image:Ie.z.string().min(1).optional(),text:Ie.z.string().min(1).optional(),displayText:Ie.z.string().min(1).optional(),value:Ie.z.any().optional(),channelData:Ie.z.unknown().optional(),imageAltText:Ie.z.string().min(1).optional()})});var Pu=p(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.suggestedActionsZodSchema=void 0;var Kn=D(),oh=Ou();Yn.suggestedActionsZodSchema=Kn.z.object({to:Kn.z.array(Kn.z.string().min(1)),actions:Kn.z.array(oh.cardActionZodSchema)})});var Ji=p(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.activityEventNamesZodSchema=Kt.ActivityEventNames=void 0;var ih=D(),Ru;(function(e){e.ContinueConversation="ContinueConversation",e.CreateConversation="CreateConversation"})(Ru||(Kt.ActivityEventNames=Ru={}));Kt.activityEventNamesZodSchema=ih.z.enum(["ContinueConversation","CreateConversation"])});var Qi=p(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.activityImportanceZodSchema=Yt.ActivityImportance=void 0;var ah=D(),Nu;(function(e){e.Low="low",e.Normal="normal",e.High="high"})(Nu||(Yt.ActivityImportance=Nu={}));Yt.activityImportanceZodSchema=ah.z.enum(["low","normal","high"])});var ea=p(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.activityTypesZodSchema=Xt.ActivityTypes=void 0;var sh=D(),ju;(function(e){e.Message="message",e.ContactRelationUpdate="contactRelationUpdate",e.ConversationUpdate="conversationUpdate",e.Typing="typing",e.EndOfConversation="endOfConversation",e.Event="event",e.Invoke="invoke",e.InvokeResponse="invokeResponse",e.DeleteUserData="deleteUserData",e.MessageUpdate="messageUpdate",e.MessageDelete="messageDelete",e.InstallationUpdate="installationUpdate",e.MessageReaction="messageReaction",e.Suggestion="suggestion",e.Trace="trace",e.Handoff="handoff",e.Command="command",e.CommandResult="commandResult"})(ju||(Xt.ActivityTypes=ju={}));Xt.activityTypesZodSchema=sh.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var ku=p(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.attachmentZodSchema=void 0;var Jt=D();Xn.attachmentZodSchema=Jt.z.object({contentType:Jt.z.string().min(1),contentUrl:Jt.z.string().min(1).optional(),content:Jt.z.unknown().optional(),name:Jt.z.string().min(1).optional(),thumbnailUrl:Jt.z.string().min(1).optional()})});var Uu=p(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.addProductInfoToActivity=bt.clearProductInfoFromActivity=void 0;var ch=e=>{e&&e.entities&&e.entities.length&&(e.entities=e.entities.filter(t=>t.type!=="ProductInfo"))};bt.clearProductInfoFromActivity=ch;var uh=(e,t)=>{var r,n;let o={type:"ProductInfo",id:t};(r=e.entities)!==null&&r!==void 0||(e.entities=[]),(0,bt.clearProductInfoFromActivity)(e),(n=e.entities)===null||n===void 0||n.push(o)};bt.addProductInfoToActivity=uh});var ta=p(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.channelAccountZodSchema=void 0;var pe=D(),dh=Nr();Jn.channelAccountZodSchema=pe.z.object({id:pe.z.string().min(1).optional(),name:pe.z.string().optional(),aadObjectId:pe.z.string().min(1).optional(),tenantId:pe.z.string().min(1).optional(),agenticUserId:pe.z.string().min(1).optional(),agenticAppId:pe.z.string().min(1).optional(),agenticAppBlueprintId:pe.z.string().min(1).optional(),role:pe.z.union([dh.roleTypeZodSchema,pe.z.string().min(1)]).optional(),properties:pe.z.unknown().optional()})});var ra=p(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.conversationAccountZodSchema=void 0;var Ee=D(),lh=Nr();Qn.conversationAccountZodSchema=Ee.z.object({isGroup:Ee.z.boolean().optional(),conversationType:Ee.z.string().min(1).optional(),tenantId:Ee.z.string().min(1).optional(),id:Ee.z.string().min(1),name:Ee.z.string().min(1).optional(),aadObjectId:Ee.z.string().min(1).optional(),role:Ee.z.union([lh.roleTypeZodSchema,Ee.z.string().min(1)]).optional(),properties:Ee.z.unknown().optional()})});var Zu=p(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.conversationReferenceZodSchema=void 0;var qr=D(),Du=ta(),fh=ra();eo.conversationReferenceZodSchema=qr.z.object({activityId:qr.z.string().min(1).optional(),user:Du.channelAccountZodSchema.optional(),locale:qr.z.string().min(1).optional(),agent:Du.channelAccountZodSchema.optional().nullable(),conversation:fh.conversationAccountZodSchema,channelId:qr.z.string().min(1),serviceUrl:qr.z.string().min(1).optional()})});var na=p(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.deliveryModesZodSchema=Qt.DeliveryModes=void 0;var ph=D(),Lu;(function(e){e.Normal="normal",e.Notification="notification",e.ExpectReplies="expectReplies",e.Ephemeral="ephemeral"})(Lu||(Qt.DeliveryModes=Lu={}));Qt.deliveryModesZodSchema=ph.z.enum(["normal","notification","expectReplies","ephemeral"])});var oa=p(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.inputHintsZodSchema=er.InputHints=void 0;var mh=D(),Mu;(function(e){e.AcceptingInput="acceptingInput",e.IgnoringInput="ignoringInput",e.ExpectingInput="expectingInput"})(Mu||(er.InputHints=Mu={}));er.inputHintsZodSchema=mh.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var ia=p(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.messageReactionTypesZodSchema=tr.MessageReactionTypes=void 0;var hh=D(),Vu;(function(e){e.Like="like",e.PlusOne="plusOne"})(Vu||(tr.MessageReactionTypes=Vu={}));tr.messageReactionTypesZodSchema=hh.z.enum(["like","plusOne"])});var qu=p(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.messageReactionZodSchema=void 0;var aa=D(),gh=ia();to.messageReactionZodSchema=aa.z.object({type:aa.z.union([gh.messageReactionTypesZodSchema,aa.z.string().min(1)])})});var sa=p(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.textFormatTypesZodSchema=rr.TextFormatTypes=void 0;var yh=D(),zu;(function(e){e.Markdown="markdown",e.Plain="plain",e.Xml="xml"})(zu||(rr.TextFormatTypes=zu={}));rr.textFormatTypesZodSchema=yh.z.enum(["markdown","plain","xml"])});var Fu=p(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.textHighlightZodSchema=void 0;var ca=D();ro.textHighlightZodSchema=ca.z.object({text:ca.z.string().min(1),occurrence:ca.z.number()})});var ua=p(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.ExceptionHelper=void 0;var no=class e{static generateException(t,r,n,o){var i;let a=r.description;o&&Object.keys(o).forEach(g=>{a=a.replace(`{${g}}`,o[g])});let c=((i=r.helplink)!==null&&i!==void 0?i:e.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),d=`[${r.code}] - ${a} - ${c}`,f=new t(d);return f.code=r.code,f.helpLink=c,n&&(f.innerException=n),f}};oo.ExceptionHelper=no;no.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var da=p(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.Errors=void 0;io.Errors={InvalidActivityTypeUndefined:{code:-11e4,description:"Invalid ActivityType: undefined"},InvalidActivityTypeNull:{code:-110001,description:"Invalid ActivityType: null"},InvalidActivityTypeEmptyString:{code:-110002,description:"Invalid ActivityType: empty string"},InvalidChannelIdFormat:{code:-110003,description:"Invalid channelId {channelId}. Found subChannel but no main channel."},PrimaryChannelNotSet:{code:-110004,description:"Primary channel must be set before setting subChannel"},ActivityRecipientUndefined:{code:-110005,description:"Activity Recipient undefined"},ActivityConversationUndefined:{code:-110006,description:"Activity Conversation undefined"},ActivityChannelIdUndefined:{code:-110007,description:"Activity ChannelId undefined"}}});var Ku=p(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.Activity=xt.activityZodSchema=void 0;var vh=Su(),b=D(),_h=wu(),bh=Pu(),Wu=Ji(),xh=Qi(),so=ea(),Th=ku(),Ch=Ei(),Gu=Uu(),ao=ta(),$u=Si(),Ih=ra(),Eh=Zu(),Sh=Ai(),Ah=na(),wh=Xi(),Oh=oa(),Bu=qu(),Ph=sa(),Rh=Fu(),Hu=Nr(),Fe=ua(),Ge=da();xt.activityZodSchema=b.z.object({type:b.z.union([so.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:ao.channelAccountZodSchema.optional(),timestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimestamp:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),localTimezone:b.z.string().min(1).optional(),callerId:b.z.string().min(1).optional(),serviceUrl:b.z.string().min(1).optional(),conversation:Ih.conversationAccountZodSchema.optional(),recipient:ao.channelAccountZodSchema.optional(),textFormat:b.z.union([Ph.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([Ch.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(ao.channelAccountZodSchema).optional(),membersRemoved:b.z.array(ao.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Bu.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Bu.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([Oh.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:bh.suggestedActionsZodSchema.optional(),attachments:b.z.array(Th.attachmentZodSchema).optional(),entities:b.z.array(wh.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([Wu.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:Eh.conversationReferenceZodSchema.optional(),code:b.z.union([Sh.endOfConversationCodesZodSchema,b.z.string().min(1)]).optional(),expiration:b.z.union([b.z.date(),b.z.string().min(1).transform(e=>new Date(e))]).optional(),importance:b.z.union([xh.activityImportanceZodSchema,b.z.string().min(1)]).optional(),deliveryMode:b.z.union([Ah.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(Rh.textHighlightZodSchema).optional(),semanticAction:_h.semanticActionZodSchema.optional()});var la=class e{constructor(t){if(t===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeUndefined);if(t===null)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeNull);if(typeof t=="string"&&t.length===0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidActivityTypeEmptyString);this.type=t}static fromJson(t){return this.fromObject(JSON.parse(t))}static fromObject(t){let r=xt.activityZodSchema.passthrough().parse(t),n=new e(r.type);return Object.assign(n,r),n}get channelId(){var t;return(t=this._channelId)===null||t===void 0?void 0:t.concat(this.channelIdSubChannel?`:${this.channelIdSubChannel}`:"")}static parseChannelId(t){let r,n;return t&&t.indexOf(":")!==-1?(r=t.substring(0,t.indexOf(":")),n=t.substring(t.indexOf(":")+1)):r=t,[r,n]}set channelId(t){let[r,n]=e.parseChannelId(t);if(t&&!r)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.InvalidChannelIdFormat,void 0,{channelId:t});this._channelId=r,n?(0,Gu.addProductInfoToActivity)(this,n):(0,Gu.clearProductInfoFromActivity)(this)}set channelIdChannel(t){this._channelId=t}get channelIdChannel(){return this._channelId}get channelIdSubChannel(){var t,r;return(r=(t=this.entities)===null||t===void 0?void 0:t.find(n=>n.type==="ProductInfo"))===null||r===void 0?void 0:r.id}set channelIdSubChannel(t){if(!this._channelId)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${t?`:${t}`:""}`}static getContinuationActivity(t){var r;let n={type:so.ActivityTypes.Event,name:Wu.ActivityEventNames.ContinueConversation,id:(r=t.activityId)!==null&&r!==void 0?r:(0,vh.v4)(),channelId:t.channelId,locale:t.locale,serviceUrl:t.serviceUrl,conversation:t.conversation,recipient:t.agent,from:t.user,relatesTo:t};return e.fromObject(n)}getAppropriateReplyToId(){if(this.type!==so.ActivityTypes.ConversationUpdate||this.channelId!==$u.Channels.Directline&&this.channelId!==$u.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Fe.ExceptionHelper.generateException(Error,Ge.Errors.ActivityChannelIdUndefined);return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:this.channelId,locale:this.locale,serviceUrl:this.serviceUrl}}applyConversationReference(t,r=!1){var n,o,i;return this.channelId=t.channelId,(n=this.locale)!==null&&n!==void 0||(this.locale=t.locale),this.serviceUrl=t.serviceUrl,this.conversation=t.conversation,r?(this.from=t.user,this.recipient=(o=t.agent)!==null&&o!==void 0?o:void 0,t.activityId&&(this.id=t.activityId)):(this.from=(i=t.agent)!==null&&i!==void 0?i:void 0,this.recipient=t.user,t.activityId&&(this.replyToId=t.activityId)),this}clone(){let t=JSON.parse(JSON.stringify(this));for(let r in t)typeof t[r]=="string"&&!isNaN(Date.parse(t[r]))&&(t[r]=new Date(t[r]));return Object.setPrototypeOf(t,e.prototype),t}getMentions(t){let r=[];if(t.entities!==void 0)for(let n=0;n<t.entities.length;n++)t.entities[n].type.toLowerCase()==="mention"&&r.push(t.entities[n]);return r}normalizeMentions(t=!1){var r,n;if(this.type===so.ActivityTypes.Message&&(t&&(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=e.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=e.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(t){if(!t)return t;let r;do{r=!1;let n=t.toLowerCase().indexOf("<at");if(n>=0){let o=t.indexOf(">",n);if(o>0){let i=t.toLowerCase().indexOf("</at>",o);if(i>0){let a=t.substring(i+5);a.length>0&&!/\s/.test(a[0])&&(a=` ${a}`),t=t.substring(0,i)+a;let s=t.substring(o+1,i),c=t.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),t=c+s+a,r=!0}}}}while(r);return t}removeMentionText(t){let n=this.getMentions(this).filter(o=>o.mentioned.id===t);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(t){let r=this.getConversationReference();return r.activityId=t,r}toJsonString(t,r){let n={...this};return n.channelId=n._channelId,delete n._channelId,JSON.stringify(n,t,r)}isAgenticRequest(){return!this.recipient||!this.recipient.role?!1:this.recipient.role.toLowerCase()===Hu.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Hu.RoleTypes.AgenticIdentity.toLowerCase()}getAgenticTenantId(){var t,r,n;return(r=(t=this.recipient)===null||t===void 0?void 0:t.tenantId)!==null&&r!==void 0?r:(n=this.conversation)===null||n===void 0?void 0:n.tenantId}getAgenticInstanceId(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticAppId}getAgenticUser(){var t;if(this.isAgenticRequest())return(t=this.recipient)===null||t===void 0?void 0:t.agenticUserId}};xt.Activity=la});var Xu=p(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.ActivityTreatments=void 0;var Yu;(function(e){e.Targeted="targeted"})(Yu||(co.ActivityTreatments=Yu={}))});var uo=p(C=>{"use strict";var Nh=C&&C.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ju=C&&C.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Nh(t,e,r)};Object.defineProperty(C,"__esModule",{value:!0});C.ActivityErrors=C.ExceptionHelper=C.ActivityTreatments=C.TextFormatTypes=C.MessageReactionTypes=C.InputHints=C.DeliveryModes=C.ActivityTypes=C.ActivityImportance=C.ActivityEventNames=C.activityZodSchema=C.Activity=C.RoleTypes=C.MembershipTypes=C.MembershipSourceTypes=C.EndOfConversationCodes=C.Channels=C.AttachmentLayoutTypes=C.SemanticActionStateTypes=C.ActionTypes=void 0;var jh=Ci();Object.defineProperty(C,"ActionTypes",{enumerable:!0,get:function(){return jh.ActionTypes}});var kh=Ii();Object.defineProperty(C,"SemanticActionStateTypes",{enumerable:!0,get:function(){return kh.SemanticActionStateTypes}});var Uh=Ei();Object.defineProperty(C,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Uh.AttachmentLayoutTypes}});var Dh=Si();Object.defineProperty(C,"Channels",{enumerable:!0,get:function(){return Dh.Channels}});var Zh=Ai();Object.defineProperty(C,"EndOfConversationCodes",{enumerable:!0,get:function(){return Zh.EndOfConversationCodes}});var Lh=Wc();Object.defineProperty(C,"MembershipSourceTypes",{enumerable:!0,get:function(){return Lh.MembershipSourceTypes}});var Mh=Yc();Object.defineProperty(C,"MembershipTypes",{enumerable:!0,get:function(){return Mh.MembershipTypes}});var Vh=Nr();Object.defineProperty(C,"RoleTypes",{enumerable:!0,get:function(){return Vh.RoleTypes}});Ju(Jc(),C);Ju(Qc(),C);var Qu=Ku();Object.defineProperty(C,"Activity",{enumerable:!0,get:function(){return Qu.Activity}});Object.defineProperty(C,"activityZodSchema",{enumerable:!0,get:function(){return Qu.activityZodSchema}});var qh=Ji();Object.defineProperty(C,"ActivityEventNames",{enumerable:!0,get:function(){return qh.ActivityEventNames}});var zh=Qi();Object.defineProperty(C,"ActivityImportance",{enumerable:!0,get:function(){return zh.ActivityImportance}});var Fh=ea();Object.defineProperty(C,"ActivityTypes",{enumerable:!0,get:function(){return Fh.ActivityTypes}});var Gh=na();Object.defineProperty(C,"DeliveryModes",{enumerable:!0,get:function(){return Gh.DeliveryModes}});var $h=oa();Object.defineProperty(C,"InputHints",{enumerable:!0,get:function(){return $h.InputHints}});var Bh=ia();Object.defineProperty(C,"MessageReactionTypes",{enumerable:!0,get:function(){return Bh.MessageReactionTypes}});var Hh=sa();Object.defineProperty(C,"TextFormatTypes",{enumerable:!0,get:function(){return Hh.TextFormatTypes}});var Wh=Xu();Object.defineProperty(C,"ActivityTreatments",{enumerable:!0,get:function(){return Wh.ActivityTreatments}});var Kh=ua();Object.defineProperty(C,"ExceptionHelper",{enumerable:!0,get:function(){return Kh.ExceptionHelper}});var Yh=da();Object.defineProperty(C,"ActivityErrors",{enumerable:!0,get:function(){return Yh.Errors}})});var fr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(fr||{});var pr=(x=>(x.Unknown="Unknown",x.Exp="Exp",x.Dev="Dev",x.Test="Test",x.Preprod="Preprod",x.FirstRelease="FirstRelease",x.Prod="Prod",x.Gov="Gov",x.High="High",x.DoD="DoD",x.Mooncake="Mooncake",x.Ex="Ex",x.Rx="Rx",x.Prv="Prv",x.Local="Local",x.GovFR="GovFR",x.Other="Other",x))(pr||{});var bo=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},xo=class extends bo{constructor(t){var i,a,s;if(super(),!t)return;let r=((i=t.cloud)==null?void 0:i.trim())||"Prod",n=((a=t.copilotAgentType)==null?void 0:a.trim())||"Published",o=((s=t.authority)==null?void 0:s.trim())||"https://login.microsoftonline.com";if(!Object.values(pr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(pr).join(", ")}`);if(!Object.values(fr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(fr).join(", ")}`);Object.assign(this,{...t,cloud:r,copilotAgentType:n,authority:o})}},gg=()=>{var e,t,r,n,o,i,a,s;return new xo({appClientId:(e=process.env.appClientId)!=null?e:"",tenantId:(t=process.env.tenantId)!=null?t:"",authority:(r=process.env.authorityEndpoint)!=null?r:"https://login.microsoftonline.com",environmentId:(n=process.env.environmentId)!=null?n:"",agentIdentifier:(o=process.env.agentIdentifier)!=null?o:"",schemaName:(i=process.env.schemaName)!=null?i:"",cloud:process.env.cloud,customPowerPlatformCloud:process.env.customPowerPlatformCloud,copilotAgentType:process.env.copilotAgentType,directConnectUrl:process.env.directConnectUrl,useExperimentalEndpoint:((a=process.env.useExperimentalEndpoint)==null?void 0:a.toLowerCase())==="true",enableDiagnostics:((s=process.env.enableDiagnostics)==null?void 0:s.toLowerCase())==="true"})};var Hr=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function To(e){}function Pa(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=To,onError:r=To,onRetry:n=To,onComment:o}=e,i="",a=!0,s,c="",d="";function f(y){let S=a?y.replace(/^\xEF\xBB\xBF/,""):y,[x,N]=Pd(`${i}${S}`);for(let O of x)g(O);i=N,a=!1}function g(y){if(y===""){I();return}if(y.startsWith(":")){o&&o(y.slice(y.startsWith(": ")?2:1));return}let S=y.indexOf(":");if(S!==-1){let x=y.slice(0,S),N=y[S+1]===" "?2:1,O=y.slice(S+N);_(x,O,y);return}_(y,"",y)}function _(y,S,x){switch(y){case"event":d=S;break;case"data":c=`${c}${S}
|
|
2
|
+
`;break;case"id":s=S.includes("\0")?void 0:S;break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new Hr(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:x}));break;default:r(new Hr(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:S,line:x}));break}}function I(){c.length>0&&t({id:s,event:d||void 0,data:c.endsWith(`
|
|
3
|
+
`)?c.slice(0,-1):c}),s=void 0,c="",d=""}function P(y={}){i&&y.consume&&g(i),a=!0,s=void 0,c="",d="",i=""}return{feed:f,reset:P}}function Pd(e){let t=[],r="",n=0;for(;n<e.length;){let o=e.indexOf("\r",n),i=e.indexOf(`
|
|
4
|
+
`,n),a=-1;if(o!==-1&&i!==-1?a=Math.min(o,i):o!==-1?o===e.length-1?a=-1:a=o:i!==-1&&(a=i),a===-1){r=e.slice(n);break}else{let s=e.slice(n,a);t.push(s),n=a+1,e[n-1]==="\r"&&e[n]===`
|
|
5
|
+
`&&n++}}return[t,r]}var Ra="connecting",Rd="open",Co="closed",Wr=()=>{};function Nd(e,{getStream:t}){let r=typeof e=="string"||e instanceof URL?{url:e}:e,{onMessage:n,onComment:o=Wr,onConnect:i=Wr,onDisconnect:a=Wr,onScheduleReconnect:s=Wr}=r,{fetch:c,url:d,initialLastEventId:f}=jd(r),g={...r.headers},_=[],I=n?[n]:[],P=M=>I.forEach(he=>he(M)),y=Pa({onEvent:bd,onRetry:xd,onComment:o}),S,x=d.toString(),N=new AbortController,O=f,k=2e3,V,L=Co;return Se(),{close:ie,connect:Se,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:ur,get lastEventId(){return O},get url(){return x},get readyState(){return L}};function Se(){S||(L=Ra,N=new AbortController,S=c(d,Td()).then(_d).catch(M=>{S=null,!(M.name==="AbortError"||M.type==="aborted"||N.signal.aborted)&&Sa()}))}function ie(){L=Co,N.abort(),y.reset(),clearTimeout(V),_.forEach(M=>M())}function ur(){let M=[],he=[];function dr(){return new Promise(J=>{let ge=he.shift();ge?J({value:ge,done:!1}):M.push(J)})}let It=function(J){let ge=M.shift();ge?ge({value:J,done:!1}):he.push(J)};function Ke(){for(I.splice(I.indexOf(It),1);M.shift(););for(;he.shift(););}function lr(){let J=M.shift();J&&(J({done:!0,value:void 0}),Ke())}return _.push(lr),I.push(It),{next(){return L===Co?this.return():dr()},return(){return Ke(),Promise.resolve({done:!0,value:void 0})},throw(J){return Ke(),Promise.reject(J)},[Symbol.asyncIterator](){return this}}}function Sa(){s({delay:k}),!N.signal.aborted&&(L=Ra,V=setTimeout(Se,k))}async function _d(M){i(),y.reset();let{body:he,redirected:dr,status:It}=M;if(It===204){a(),ie();return}if(!he)throw new Error("Missing response body");dr&&(x=M.url);let Ke=t(he),lr=new TextDecoder,J=Ke.getReader(),ge=!0;L=Rd;do{let{done:Aa,value:wa}=await J.read();wa&&y.feed(lr.decode(wa,{stream:!Aa})),Aa&&(ge=!1,S=null,y.reset(),Sa(),a())}while(ge)}function bd(M){typeof M.id=="string"&&(O=M.id),P(M)}function xd(M){k=M}function Td(){let{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J}=r,ge={Accept:"text/event-stream",...g,...O?{"Last-Event-ID":O}:void 0};return{mode:M,credentials:he,body:dr,method:It,redirect:Ke,referrer:lr,referrerPolicy:J,headers:ge,cache:"no-store",signal:N.signal}}}function jd(e){let t=e.fetch||globalThis.fetch;if(!kd(t))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}=e;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:t,url:r,initialLastEventId:n}}function kd(e){return typeof e=="function"}var Ud={getStream:Dd};function Io(e){return Nd(e,Ud)}function Dd(e){if(!(e instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return e}var gc=ke(Ut());var On=class{constructor(t){this.API_VERSION="2022-03-01-preview";let r="schema"in t?t.schema:t.identifier,n=t.host;this.baseURL=new URL(`/copilotstudio/prebuilt/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Pn=class{constructor(t){this.API_VERSION="2022-03-01-preview";let{schema:r,host:n}=t;this.baseURL=new URL(`/copilotstudio/dataverse-backed/authenticated/bots/${r}`,n),this.baseURL.searchParams.append("api-version",this.API_VERSION)}getConversationUrl(t){let r=new URL(this.baseURL.href);return r.pathname=`${r.pathname}/conversations`,t&&(r.pathname=`${r.pathname}/${t}`),r.href}};var Dt=(0,gc.debug)("copilot-studio:power-platform");function Ar(e,t){var c,d,f,g,_,I,P,y;let r=((c=e.schemaName)==null?void 0:c.trim())||((d=e.agentIdentifier)==null?void 0:d.trim());if(!((f=e.directConnectUrl)!=null&&f.trim())&&(!((g=e.environmentId)!=null&&g.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((_=e.directConnectUrl)!=null&&_.trim()){if(Dt.debug(`Using direct connection: ${e.directConnectUrl}`),!Sr(e.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return If(e.directConnectUrl,t).href}let n=(I=e.cloud)!=null?I:"Prod",o=(P=e.copilotAgentType)!=null?P:"Published";if(Dt.debug(`Using cloud setting: ${n}`),Dt.debug(`Using agent type: ${o}`),n==="Other")if((y=e.customPowerPlatformCloud)!=null&&y.trim())if(Sr(e.customPowerPlatformCloud))Dt.debug(`Using custom Power Platform cloud: ${e.customPowerPlatformCloud}`);else throw new Error("customPowerPlatformCloud must be a valid URL");else throw new Error("customPowerPlatformCloud must be provided when PowerPlatformCloud is Other");let i=Ef(n,e.environmentId,e.customPowerPlatformCloud),s={Published:()=>new Pn({host:i,schema:r}),Prebuilt:()=>new On({host:i,schema:r})}[o]().getConversationUrl(t);return Dt.debug(`Generated Copilot Studio connection URL: ${s}`),s}function yc(e,t){if(!t||!t.trim())throw new Error("conversationId is required for subscribe URL");let r=Ar(e,t),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return Dt.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function vc(e,t="Unknown",r="",n=""){var o,i;if(!n&&!(e!=null&&e.directConnectUrl)){if(t==="Other"&&!r)throw new Error("cloudBaseAddress must be provided when PowerPlatformCloudCategory is Other");if(!e&&t==="Unknown")throw new Error("Either settings or cloud must be provided");if(e&&e.cloud&&e.cloud!=="Unknown"&&(t=e.cloud),t==="Other")if(r&&Sr(r))t="Other";else if(e!=null&&e.customPowerPlatformCloud&&Sr(e.customPowerPlatformCloud))t="Other",r=e.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://${Rn(t,r)}/.default`}else if(n||(n=(o=e==null?void 0:e.directConnectUrl)!=null?o:""),n&&Sr(n)){if(hc(new URL(n))==="Unknown"){let a=(i=e==null?void 0:e.cloud)!=null?i:t;if(a==="Other"||a==="Unknown")throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.");if(a!=="Unknown")return`https://${Rn(a,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${Rn(hc(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function Sr(e){try{let t=e.startsWith("http")?e:`https://${e}`;return!!new URL(t)}catch{return!1}}function If(e,t){let r=new URL(e);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`,t&&(r.pathname=`${r.pathname}/${t}`),r}function Ef(e,t,r){if(e==="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=t.toLowerCase().replaceAll("-",""),o=Sf(e),i=n.substring(0,n.length-o),a=n.substring(n.length-o);return new URL(`https://${i}.${a}.environment.${Rn(e,r)}`)}function Rn(e,t){switch(e){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 t;default:throw new Error(`Invalid cluster category value: ${e}`)}}function Sf(e){switch(e){case"FirstRelease":case"Prod":return 2;default:return 1}}function hc(e){switch(e.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 Tt=ke(uo());var zr=class{constructor(t,r){this.activity=t,this.conversationId=r}};var He=ke(Ut());var lo="1.5.1";var fo={};var Fr=class{static getProductInfo(){let t=`CopilotStudioClient.agents-sdk-js/${lo}`,r;return typeof window!="undefined"&&window.navigator?r=`${t} ${navigator.userAgent}`:r=`${t} nodejs/${process.version} ${fo.platform()}-${fo.arch()}/${fo.release()}`,r}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${lo}`}static getVersion(){return lo}};var po=class{static getScopeFromSettings(t){return vc(t)}};function ed(e,t){return{activities:e,conversationId:t,isNewConversation:!0}}function td(e,t){return{activities:e,conversationId:t,activityCount:e.length}}var Z=ke(Ut()),X={activitiesReceivedCounter:Z.metric.counter(Z.MetricNames.CSC_ACTIVITIES_RECEIVED,{unit:"activities",description:"Total number of activities received by the Copilot Studio client"}),activitiesSentCounter:Z.metric.counter(Z.MetricNames.CSC_ACTIVITIES_SENT,{unit:"activities",description:"Total number of activities sent to Copilot Studio"}),conversationsStartedCounter:Z.metric.counter(Z.MetricNames.CSC_CONVERSATIONS_STARTED,{unit:"conversations",description:"Total number of conversations started with Copilot Studio"}),webchatConnectionsCounter:Z.metric.counter(Z.MetricNames.CSC_WEBCHAT_CONNECTIONS,{unit:"connections",description:"Total number of webchat connections created with Copilot Studio"}),requestsCounter:Z.metric.counter(Z.MetricNames.CSC_REQUEST_COUNT,{unit:"requests",description:"Total number of HTTP/SSE requests made to Copilot Studio"}),requestsErrorCounter:Z.metric.counter(Z.MetricNames.CSC_REQUEST_ERRORS,{unit:"requests",description:"Total number of failed requests to Copilot Studio"}),executeStreamingCounter:Z.metric.counter(Z.MetricNames.CSC_EXECUTE_STREAMING,{unit:"operations",description:"Total number of execute streaming operations"}),subscribeAsyncCounter:Z.metric.counter(Z.MetricNames.CSC_SUBSCRIBE_ASYNC,{unit:"operations",description:"Total number of subscribeAsync operations"}),subscribeEventCounter:Z.metric.counter(Z.MetricNames.CSC_SUBSCRIBE_EVENT,{unit:"events",description:"Total number of events received via subscribeAsync"}),streamDuration:Z.metric.histogram(Z.MetricNames.CSC_STREAM_DURATION,{unit:"ms",description:"Duration of SSE stream sessions in milliseconds"}),requestDuration:Z.metric.histogram(Z.MetricNames.CSC_REQUEST_DURATION,{unit:"ms",description:"Duration of requests to Copilot Studio in milliseconds"})};var fa=ke(uo()),re=ke(Ut());var $e={createConnection:re.trace.define({name:re.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:e})=>({receivedFromCopilot(t){var r,n,o;e.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(t){var r,n,o;e.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=t.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=t.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:e,record:t}){var n;let r={"copilot.webchat.show_typing":(n=t.showTyping)!=null?n:"unknown"};e.setAttributes(r),X.webchatConnectionsCounter.add(1,r)}}),postRequest:re.trace.define({name:re.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:e})=>({receivedFromCopilot(t){var n,o,i;let r={"copilot.activity.type":(n=t.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=t.conversation)==null?void 0:o.id)!=null?i:"unknown"};e.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),X.activitiesReceivedCounter.add(1,r)}}),end({span:e,record:t,duration:r,error:n}){var a,s;let o={"copilot.post_request.url":(a=t.url)!=null?a:"unknown","copilot.post_request.method":(s=t.method)!=null?s:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};e.setAttributes(o),X.requestsCounter.add(1,i),X.streamDuration.record(r,i),n&&X.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:re.trace.define({name:re.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:e,record:t,duration:r}){let n=t.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};e.setAttributes(n),X.conversationsStartedCounter.add(1,o),X.requestDuration.record(r,o)}}),sendActivity:re.trace.define({name:re.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:fa.Activity.fromObject({type:"unknown"})},end({span:e,record:t,duration:r}){var i,a,s;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=(a=t.activity.conversation)==null?void 0:a.id)!=null?s:"unknown"},o={operation:"sendActivityStreaming",...n};e.setAttributes(n),X.activitiesSentCounter.add(1,n),X.requestDuration.record(r,o)}}),executeStreaming:re.trace.define({name:re.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:fa.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:e,record:t,duration:r}){var i,a;let n={"copilot.activity.type":(i=t.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=t.conversationId)!=null?a:"unknown"},o={operation:"executeStreaming",...n};e.setAttributes(n),X.executeStreamingCounter.add(1,n),X.requestDuration.record(r,o)}}),subscribeAsync:re.trace.define({name:re.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:e})=>({eventReceivedFromCopilot(t){var n,o;let r={"copilot.subscribe_async.event.id":(n=t.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=t.activity.type)!=null?o:"unknown"};e.addEvent("event.received",r),X.subscribeEventCounter.add(1,r)}}),end({span:e,record:t,duration:r}){var i,a;let n={"copilot.subscribe_async.conversation_id":(i=t.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(a=t.lastReceivedEventId)!=null?a:"unknown"},o={operation:"subscribeAsync","copilot.conversation_id":n["copilot.subscribe_async.conversation_id"],"copilot.last_received_event_id":n["copilot.subscribe_async.last_received_event_id"]};e.setAttributes(n),X.subscribeAsyncCounter.add(1,o),X.streamDuration.record(r,o)}})};var q=(0,He.debug)("copilot-studio:client"),Be=class Be{constructor(t,r){this.conversationId="";this.settings=t,this.token=r}logDiagnostic(t,...r){this.settings.enableDiagnostics&&q.info(`[DIAGNOSTICS] ${t}`,...r)}async*postRequestAsync(t,r,n="POST"){var i,a,s,c,d,f,g,_,I,P;let o=(0,He.trace)($e.postRequest);o.record({url:t,method:n});try{this.logDiagnostic(`Request URL: ${t}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),q.debug(`>>> SEND TO ${t}`);let y=new Map,S=Io({url:t,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(x,N)=>{let O=await fetch(x,N);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:x,event:N}of S){if(x&&N==="activity")try{let O=Tt.Activity.fromJson(x);o.actions.receivedFromCopilot(O);let k=(i=O.entities)==null?void 0:i.find(V=>V.type==="streaminfo"&&V.streamType==="streaming");switch(O.type){case Tt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(s=(a=O.conversation)==null?void 0:a.id)!=null?s:"",q.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case Tt.ActivityTypes.Typing:if(q.debug(`Activity type: ${O.type}`),k||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let V=(d=O.text)!=null?d:"",L=(g=k==null?void 0:k.streamId)!=null?g:(f=O.channelData)==null?void 0:f.streamId,Se=(I=k==null?void 0:k.streamSequence)!=null?I:(_=O.channelData)==null?void 0:_.streamSequence;if(L&&Se){if(y.has(L)){let ie=y.get(L);ie.push({text:V,sequence:Se}),y.set(L,ie)}else y.set(L,[{text:V,sequence:Se}]);O.text=((P=y.get(L))==null?void 0:P.sort((ie,ur)=>ie.sequence-ur.sequence).map(ie=>ie.text).join(""))||""}}yield O;break;default:q.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){q.error("Failed to parse activity:",O)}else if(N==="end"){q.debug("Stream complete");break}if(S.readyState==="closed"){q.debug("Connection closed");break}}}finally{S.close()}}catch(y){throw o.fail(y)}finally{o.end()}}processResponseHeaders(t){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=t==null?void 0:t.get(Be.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,q.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=t==null?void 0:t.get(Be.conversationIdHeaderKey))!=null?o:"",this.conversationId&&q.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;t.forEach((i,a)=>{a.toLowerCase()!=="authorization"&&a.toLowerCase()!==Be.conversationIdHeaderKey.toLowerCase()&&r.set(a,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(t){var n,o;let r=(0,He.trace)($e.startConversation);try{let i;typeof t=="boolean"||t===void 0?(r.record({shouldEmitStartEvent:t!=null?t:!0}),i={emitStartConversationEvent:t!=null?t:!0}):(i=t,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let a=Ar(this.settings,i.conversationId),s={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(s.locale=i.locale),q.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",s),yield*this.postRequestAsync(a,s,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(t,r=this.conversationId){var o,i;let n=(0,He.trace)($e.sendActivity);n.record({activity:t});try{let a=(i=(o=t.conversation)==null?void 0:o.id)!=null?i:r,s=Ar(this.settings,a),c=new zr(t);q.info("Sending activity...",t),yield*this.postRequestAsync(s,c,"POST")}catch(a){throw n.fail(a)}finally{n.end()}}async*executeStreaming(t,r){let n=(0,He.trace)($e.executeStreaming);n.record({activity:t,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=Ar(this.settings,r),i=new zr(t,r);q.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:t.type,activityText:t.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}async execute(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return n}async startConversationAsync(t){let r=[];for await(let n of this.startConversationStreaming(t))r.push(n);return r}async askQuestionAsync(t,r){let o={id:r!=null&&r.trim()?r:this.conversationId},i={type:"message",text:t,conversation:o},a=Tt.Activity.fromObject(i),s=[];for await(let c of this.sendActivityStreaming(a,r))s.push(c);return s}async sendActivity(t,r=this.conversationId){let n=[];for await(let o of this.sendActivityStreaming(t,r))n.push(o);return n}async startConversationWithResponse(t){var o;let r=[],n="";for await(let i of this.startConversationStreaming(t))r.push(i),(o=i.conversation)!=null&&o.id&&(n=i.conversation.id);return n=n||this.conversationId,ed(r,n)}async executeWithResponse(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return td(n,r)}async*subscribeAsync(t,r){let n=(0,He.trace)($e.subscribeAsync);n.record({conversationId:t,lastReceivedEventId:r});try{if(!t||!t.trim())throw new Error("conversationId is required for subscribeAsync");let o=yc(this.settings,t);q.info("Subscribing to conversation:",t),this.logDiagnostic("Subscribe request:",{conversationId:t,lastReceivedEventId:r,url:o});let i=Io({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Fr.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(a,s)=>{let c=await fetch(a,s);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:a,event:s,id:c}of i){if(a&&s==="activity")try{let d=Tt.Activity.fromJson(a),f={activity:d,eventId:c};n.actions.eventReceivedFromCopilot(f),q.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:d.type}),yield f}catch(d){q.error("Failed to parse activity in subscription:",d)}else if(s==="end"){q.debug("Subscription stream complete");break}if(i.readyState==="closed"){q.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};Be.conversationIdHeaderKey="x-ms-conversationid",Be.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Be.scopeFromSettings=po.getScopeFromSettings;var rd=Be;var G=[];for(let e=0;e<256;++e)G.push((e+256).toString(16).slice(1));function nd(e,t=0){return(G[e[t+0]]+G[e[t+1]]+G[e[t+2]]+G[e[t+3]]+"-"+G[e[t+4]]+G[e[t+5]]+"-"+G[e[t+6]]+G[e[t+7]]+"-"+G[e[t+8]]+G[e[t+9]]+"-"+G[e[t+10]]+G[e[t+11]]+G[e[t+12]]+G[e[t+13]]+G[e[t+14]]+G[e[t+15]]).toLowerCase()}var pa,Jh=new Uint8Array(16);function ma(){if(!pa){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");pa=crypto.getRandomValues.bind(crypto)}return pa(Jh)}var Qh=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ha={randomUUID:Qh};function eg(e,t,r){var o,i,a;if(ha.randomUUID&&!t&&!e)return ha.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:ma();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,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return nd(n)}var ga=eg;var vd=ke(uo());var ya=function(e,t){return ya=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])},ya(e,t)};function We(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ya(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Gr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nr(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function or(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function le(e){return typeof e=="function"}function mo(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var ho=mo(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
6
6
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function nr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Pt=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=rr(s),d=a.next();!d.done;d=a.next()){var l=d.value;l.remove(this)}}catch(v){e={error:v}}finally{try{d&&!d.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;if(te(f))try{f()}catch(v){i=v instanceof Br?v.errors:[v]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var C=rr(h),T=C.next();!T.done;T=C.next()){var P=T.value;try{gs(P)}catch(v){i=i!=null?i:[],v instanceof Br?i=At(At([],St(i)),St(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{T&&!T.done&&(o=C.return)&&o.call(C)}finally{if(n)throw n.error}}}if(i)throw new Br(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)gs(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&nr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&nr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var ao=Pt.EMPTY;function Gr(t){return t instanceof Pt||t&&"closed"in t&&te(t.remove)&&te(t.add)&&te(t.unsubscribe)}function gs(t){te(t)?t():t.unsubscribe()}var oe={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Ot={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Ot.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,At([t,e],St(r))):setTimeout.apply(void 0,At([t,e],St(r)))},clearTimeout:function(t){var e=Ot.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function bs(t){Ot.setTimeout(function(){var e=oe.onUnhandledError;if(e)e(t);else throw t})}function co(){}var _s=(function(){return uo("C",void 0,void 0)})();function xs(t){return uo("E",void 0,t)}function ws(t){return uo("N",t,void 0)}function uo(t,e,r){return{kind:t,value:e,error:r}}var et=null;function Et(t){if(oe.useDeprecatedSynchronousErrorHandling){var e=!et;if(e&&(et={errorThrown:!1,error:null}),t(),e){var r=et,n=r.errorThrown,o=r.error;if(et=null,n)throw o}}else t()}function Cs(t){oe.useDeprecatedSynchronousErrorHandling&&et&&(et.errorThrown=!0,et.error=t)}var po=(function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Gr(r)&&r.add(n)):n.destination=Bd,n}return e.create=function(r,n,o){return new Jr(r,n,o)},e.prototype.next=function(r){this.isStopped?fo(ws(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?fo(xs(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?fo(_s,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})(Pt);var Vd=Function.prototype.bind;function lo(t,e){return Vd.call(t,e)}var Hd=(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){Kr(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Kr(n)}else Kr(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Kr(r)}},t})(),Jr=(function(t){Ae(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(te(r)||!r)s={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var a;i&&oe.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&lo(r.next,a),error:r.error&&lo(r.error,a),complete:r.complete&&lo(r.complete,a)}):s=r}return i.destination=new Hd(s),i}return e})(po);function Kr(t){oe.useDeprecatedSynchronousErrorHandling?Cs(t):bs(t)}function Wd(t){throw t}function fo(t,e){var r=oe.onStoppedNotification;r&&Ot.setTimeout(function(){return r(t,e)})}var Bd={closed:!0,next:co,error:Wd,complete:co};var Is=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Ts(t){return t}function Ss(t){return t.length===0?Ts:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var jt=(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=Kd(e)?e:new Jr(e,r,n);return Et(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=As(r),new r(function(o,i){var s=new Jr({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[Is]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Ss(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=As(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 As(t){var e;return(e=t!=null?t:oe.Promise)!==null&&e!==void 0?e:Promise}function Gd(t){return t&&te(t.next)&&te(t.error)&&te(t.complete)}function Kd(t){return t&&t instanceof po||Gd(t)&&Gr(t)}var Ps=Wr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var mo=(function(t){Ae(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new Os(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Ps},e.prototype.next=function(r){var n=this;Et(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=rr(n.currentObservers),a=s.next();!a.done;a=s.next()){var d=a.value;d.next(r)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;Et(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;Et(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?ao:(this.currentObservers=null,a.push(r),new Pt(function(){n.currentObservers=null,nr(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new jt;return r.source=this,r},e.create=function(r,n){return new Os(r,n)},e})(jt);var Os=(function(t){Ae(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:ao},e})(mo);var ho=(function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(mo);var ks=Rt(Mt()),ve=(0,ks.debug)("copilot-studio:webchat");function Jd(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var Es=class{static createConnection(e,r){var v;ve.info("--> Creating connection between Copilot Studio and WebChat ...");let n=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,o=(v=r==null?void 0:r.startConversation)!=null?v:!n,i=0,s,a,d=n,l=!1,f=!1,h=new ho(0),C=js(async b=>{var O;s=b;let _=Jd(async()=>{h.next(2),await Promise.resolve()});if(!o||f){await _();return}f=!0,ve.debug("--> Connection established."),P();for await(let E of e.startConversationStreaming())delete E.replyToId,!a&&E.conversation&&(a=E.conversation),(O=E.conversation)!=null&&O.id&&(d=E.conversation.id),await _(),T(E);await _()}),T=b=>{let _={...b,timestamp:new Date().toISOString(),channelData:{...b.channelData,"webchat:sequence-id":i}};i++,ve.debug(`Notify '${_.type}' activity to WebChat:`,_),s==null||s.next(_)},P=()=>{if(!(r!=null&&r.showTyping))return;let b=a?{id:a.id,name:a.name}:{id:"agent",name:"Agent"};T({type:"typing",from:b})};return{connectionStatus$:h,activity$:C,get conversationId(){return d},postActivity(b){if(ve.info("--> Preparing to send activity to Copilot Studio ..."),!b)throw new Error("Activity cannot be null.");if(l)throw new Error("Connection has been ended.");if(!s)throw new Error("Activity subscriber is not initialized.");return js(async _=>{var O;try{ve.info("--> Sending activity to Copilot Studio ...");let E=Zs.Activity.fromObject({...b,id:io(),attachments:await Yd(b)});T(E),P(),_.next(E.id);for await(let N of e.sendActivityStreaming(E,d))!d&&((O=N.conversation)!=null&&O.id)&&(d=N.conversation.id),T(N),ve.info("<-- Activity received correctly from Copilot Studio.");_.complete()}catch(E){ve.error("Error sending Activity to Copilot Studio:",E),_.error(E)}})},end(){ve.info("--> Ending connection between Copilot Studio and WebChat ..."),l=!0,h.complete(),s&&(s.complete(),s=void 0)}}}};async function Yd(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 Xd(n);e.push(o)}return e}async function Xd(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=Qd(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,ve.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Qd(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 js(t){return new jt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}function ym(t=!0,e,r){return{emitStartConversationEvent:t,locale:e,conversationId:r}}export{Ut as AgentType,Qr as ConnectionSettings,hs as CopilotStudioClient,Es as CopilotStudioWebChat,er as ExecuteTurnRequest,Nt as PowerPlatformCloud,Hr as ScopeHelper,tr as UserAgentHelper,ms as createExecuteTurnResponse,ym as createStartRequest,ps as createStartResponse,Lt as getCopilotStudioConnectionUrl,Oo as getCopilotStudioSubscribeUrl,Eo as getTokenAudience,il as loadCopilotStudioConnectionSettingsFromEnv};
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function $r(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var ir=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=Gr(a),c=s.next();!c.done;c=s.next()){var d=c.value;d.remove(this)}}catch(y){t={error:y}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}else a.remove(this);var f=this.initialTeardown;if(le(f))try{f()}catch(y){i=y instanceof ho?y.errors:[y]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var _=Gr(g),I=_.next();!I.done;I=_.next()){var P=I.value;try{od(P)}catch(y){i=i!=null?i:[],y instanceof ho?i=or(or([],nr(i)),nr(y.errors)):i.push(y)}}}catch(y){n={error:y}}finally{try{I&&!I.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(i)throw new ho(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)od(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&$r(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&$r(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})();var va=ir.EMPTY;function go(e){return e instanceof ir||e&&"closed"in e&&le(e.remove)&&le(e.add)&&le(e.unsubscribe)}function od(e){le(e)?e():e.unsubscribe()}var me={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ar={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=ar.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,or([e,t],nr(r))):setTimeout.apply(void 0,or([e,t],nr(r)))},clearTimeout:function(e){var t=ar.delegate;return((t==null?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function id(e){ar.setTimeout(function(){var t=me.onUnhandledError;if(t)t(e);else throw e})}function _a(){}var ad=(function(){return ba("C",void 0,void 0)})();function sd(e){return ba("E",void 0,e)}function cd(e){return ba("N",e,void 0)}function ba(e,t,r){return{kind:e,value:t,error:r}}var Ct=null;function sr(e){if(me.useDeprecatedSynchronousErrorHandling){var t=!Ct;if(t&&(Ct={errorThrown:!1,error:null}),e(),t){var r=Ct,n=r.errorThrown,o=r.error;if(Ct=null,n)throw o}}else e()}function ud(e){me.useDeprecatedSynchronousErrorHandling&&Ct&&(Ct.errorThrown=!0,Ct.error=e)}var Ca=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,go(r)&&r.add(n)):n.destination=og,n}return t.create=function(r,n,o){return new vo(r,n,o)},t.prototype.next=function(r){this.isStopped?Ta(cd(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ta(sd(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ta(ad,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(ir);var tg=Function.prototype.bind;function xa(e,t){return tg.call(e,t)}var rg=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){yo(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){yo(n)}else yo(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){yo(r)}},e})(),vo=(function(e){We(t,e);function t(r,n,o){var i=e.call(this)||this,a;if(le(r)||!r)a={next:r!=null?r:void 0,error:n!=null?n:void 0,complete:o!=null?o:void 0};else{var s;i&&me.useDeprecatedNextContext?(s=Object.create(r),s.unsubscribe=function(){return i.unsubscribe()},a={next:r.next&&xa(r.next,s),error:r.error&&xa(r.error,s),complete:r.complete&&xa(r.complete,s)}):a=r}return i.destination=new rg(a),i}return t})(Ca);function yo(e){me.useDeprecatedSynchronousErrorHandling?ud(e):id(e)}function ng(e){throw e}function Ta(e,t){var r=me.onStoppedNotification;r&&ar.setTimeout(function(){return r(e,t)})}var og={closed:!0,next:_a,error:ng,complete:_a};var dd=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ld(e){return e}function fd(e){return e.length===0?ld:e.length===1?e[0]:function(r){return e.reduce(function(n,o){return o(n)},r)}}var cr=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var o=this,i=ag(t)?t:new vo(t,r,n);return sr(function(){var a=o,s=a.operator,c=a.source;i.add(s?s.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=pd(r),new r(function(o,i){var a=new vo({next:function(s){try{t(s)}catch(c){i(c),a.unsubscribe()}},error:i,complete:o});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[dd]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return fd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=pd(t),new t(function(n,o){var i;r.subscribe(function(a){return i=a},function(a){return o(a)},function(){return n(i)})})},e.create=function(t){return new e(t)},e})();function pd(e){var t;return(t=e!=null?e:me.Promise)!==null&&t!==void 0?t:Promise}function ig(e){return e&&le(e.next)&&le(e.error)&&le(e.complete)}function ag(e){return e&&e instanceof Ca||ig(e)&&go(e)}var md=mo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Ia=(function(e){We(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new hd(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new md},t.prototype.next=function(r){var n=this;sr(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Gr(n.currentObservers),s=a.next();!s.done;s=a.next()){var c=s.value;c.next(r)}}catch(d){o={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;sr(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)}})},t.prototype.complete=function(){var r=this;sr(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?va:(this.currentObservers=null,s.push(r),new ir(function(){n.currentObservers=null,$r(s,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?r.error(i):a&&r.complete()},t.prototype.asObservable=function(){var r=new cr;return r.source=this,r},t.create=function(r,n){return new hd(r,n)},t})(cr);var hd=(function(e){We(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.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)},t.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)},t.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)},t.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:va},t})(Ia);var Ea=(function(e){We(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,i=r._value;if(n)throw o;return this._throwIfClosed(),i},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t})(Ia);var _o=ke(Ut());var je=(0,_o.debug)("copilot-studio:webchat");function sg(e){let t=!1;return r=>{if(!t)return t=!0,e(r)}}var gd=class{static createConnection(t,r){var o;let n=(0,_o.trace)($e.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{je.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,a=(o=r==null?void 0:r.startConversation)!=null?o:!i,s=0,c,d,f=i,g=!1,_=!1,I=new Ea(0),P=yd(async x=>{var N;try{c=x;let O=sg(async()=>{I.next(2),await Promise.resolve()});if(!a||_){await O();return}_=!0,je.debug("--> Connection established."),S();for await(let k of t.startConversationStreaming())delete k.replyToId,!d&&k.conversation&&(d=k.conversation),(N=k.conversation)!=null&&N.id&&(f=k.conversation.id),await O(),y(k),n.actions.receivedFromCopilot(k);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),y=x=>{let N={...x,timestamp:new Date().toISOString(),channelData:{...x.channelData,"webchat:sequence-id":s}};s++,je.debug(`Notify '${N.type}' activity to WebChat:`,N),c==null||c.next(N)},S=()=>{if(!(r!=null&&r.showTyping))return;let x=d?{id:d.id,name:d.name}:{id:"agent",name:"Agent"};y({type:"typing",from:x})};return{connectionStatus$:I,activity$:P,get conversationId(){return f},postActivity(x){try{if(je.info("--> Preparing to send activity to Copilot Studio ..."),!x)throw new Error("Activity cannot be null.");if(g)throw new Error("Connection has been ended.");if(!c)throw new Error("Activity subscriber is not initialized.");return yd(async O=>{var k;try{je.info("--> Sending activity to Copilot Studio ...");let V=vd.Activity.fromObject({...x,id:ga(),attachments:await cg(x)});y(V),n.actions.sentToWebChat(V),S(),O.next(V.id);for await(let L of t.sendActivityStreaming(V,f))!f&&((k=L.conversation)!=null&&k.id)&&(f=L.conversation.id),y(L),n.actions.receivedFromCopilot(L),je.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(V){je.error("Error sending Activity to Copilot Studio:",V),O.error(V),n.fail(V)}finally{n.end()}})}catch(N){throw n.fail(N)}finally{n.end()}},end(){je.info("--> Ending connection between Copilot Studio and WebChat ..."),g=!0,I.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function cg(e){var r;if(e.type!=="message"||!((r=e.attachments)!=null&&r.length))return e.attachments||[];let t=[];for(let n of e.attachments){let o=await ug(n);t.push(o)}return t}async function ug(e){let t=e.contentUrl;if(!(t!=null&&t.startsWith("blob:")))return e;try{let r=await fetch(t);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=dg(o);t=`data:${n.type};base64,${i}`}catch(r){t=e.contentUrl,je.error("Error processing blob attachment:",t,r)}return{...e,contentUrl:t}}function dg(e){let t=typeof globalThis.Buffer=="function"?globalThis.Buffer:void 0;if(t&&typeof t.from=="function")return t.from(e).toString("base64");let r="";for(let n of new Uint8Array(e))r+=String.fromCharCode(n);return btoa(r)}function yd(e){return new cr(t=>{Promise.resolve(e(t)).catch(r=>t.error(r))})}function hx(e=!0,t,r){return{emitStartConversationEvent:e,locale:t,conversationId:r}}export{fr as AgentType,xo as ConnectionSettings,rd as CopilotStudioClient,gd as CopilotStudioWebChat,zr as ExecuteTurnRequest,pr as PowerPlatformCloud,po as ScopeHelper,Fr as UserAgentHelper,td as createExecuteTurnResponse,hx as createStartRequest,ed as createStartResponse,Ar as getCopilotStudioConnectionUrl,yc as getCopilotStudioSubscribeUrl,vc as getTokenAudience,gg as loadCopilotStudioConnectionSettingsFromEnv};
|
|
8
8
|
//# sourceMappingURL=browser.mjs.map
|