@microsoft/agents-copilotstudio-client 1.6.0-beta.9.gce9d8facd2 → 1.6.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 +4 -5
- package/dist/src/browser/crypto.d.ts +5 -0
- package/dist/src/browser/crypto.js +11 -0
- package/dist/src/browser/crypto.js.map +1 -0
- package/dist/src/browser.mjs +6 -6
- package/dist/src/browser.mjs.map +4 -4
- package/dist/src/connectionSettings.js +13 -1
- package/dist/src/connectionSettings.js.map +1 -1
- package/dist/src/copilotStudioWebChat.js +9 -2
- package/dist/src/copilotStudioWebChat.js.map +1 -1
- package/dist/src/userAgentHelper.js +5 -9
- package/dist/src/userAgentHelper.js.map +1 -1
- package/package.json +4 -5
- package/src/browser/crypto.ts +8 -0
- package/src/connectionSettings.ts +14 -0
- package/src/copilotStudioWebChat.ts +11 -3
- package/src/userAgentHelper.ts +9 -8
package/dist/src/browser.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Id=Object.create;var Br=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Sd=Object.getOwnPropertyNames;var Ad=Object.getPrototypeOf,wd=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),Od=(e,t)=>{for(var r in t)Br(e,r,{get:t[r],enumerable:!0})},Pa=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sd(t))!wd.call(e,o)&&o!==r&&Br(e,o,{get:()=>t[o],enumerable:!(n=Ed(t,o))||n.enumerable});return e};var De=(e,t,r)=>(r=e!=null?Id(Ad(e)):{},Pa(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e)),Pd=e=>Pa(Br({},"__esModule",{value:!0}),e);var So=p(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isPromise=Eo;Kr.attempt=Ld;function Eo(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function Ld(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 ka=p((Ig,ja)=>{var Et=1e3,St=Et*60,At=St*60,Ye=At*24,Md=Ye*7,Vd=Ye*365.25;ja.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return qd(e);if(r==="number"&&isFinite(e))return t.long?Fd(e):zd(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function qd(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*Vd;case"weeks":case"week":case"w":return r*Md;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 zd(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 Fd(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 Da=p((Eg,Ua)=>{function Gd(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=o,r.enabled=s,r.humanize=ka(),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 T=y,N=Number(new Date),O=N-(g||N);T.diff=O,T.prev=g,T.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(T,ur),S.splice(k,1),k--}return L}),r.formatArgs.call(T,S),(T.log||r.log).apply(T,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}Ua.exports=Gd});var Za=p((Q,Jr)=>{Q.formatArgs=Bd;Q.save=Hd;Q.load=Wd;Q.useColors=$d;Q.storage=Kd();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 $d(){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 Bd(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 Hd(e){try{e?Q.storage.setItem("debug",e):Q.storage.removeItem("debug")}catch{}}function Wd(){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 Kd(){try{return localStorage}catch{}}Jr.exports=Da()(Q);var{formatters:Yd}=Jr.exports;Yd.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 La=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 Xd=wt&&wt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wt,"__esModule",{value:!0});wt.createDebugLogger=tl;wt.link=rl;var Jd=Xd(Za()),Qd=Ao(),el=La();function tl(e){return{info:tn(e,"info"),warn:tn(e,"warn"),error:tn(e,"error"),debug:tn(e,"debug")}}var Ma={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,Jd.default)(`${e}:${t}`);return Qd.isBrowser?r.color=Ma.browser[t]:r.color=Ma.node[t],r}function rl(e,...t){return el.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 Va=p(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.getSetting=ol;var nl=Ao();function ol(e){var t,r;if(nl.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 za=p(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.isSpanDisabled=sl;var mr=Yr(),il=wo(),al=Va(),Po=(0,il.createDebugLogger)("agents:telemetry"),qa=(()=>{let e=(0,al.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 sl(e){if(qa.length===0)return!1;let t=qa.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=cl;Xe.noopContext=Fa;var hr=()=>{};Xe.noopTrace=function(e,t){return Fa(t)};Xe.noopTrace.define=e=>e;function cl(){return{histogram:()=>({record:hr}),counter:()=>({add:hr})}}function Fa(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 Ba=p(jo=>{"use strict";Object.defineProperty(jo,"__esModule",{value:!0});jo.traceFactory=pl;var ul=So(),dl=za(),ll=Yr(),fl=No();function pl(e){let t=new Set(Object.values(ll.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,dl.isSpanDisabled)(i.name))return(0,fl.noopContext)(a);let s=ml(i);if(!a){let c=r.startSpan(i.name),d=Ga(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=Ga(e,i,c,s);return(0,ul.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 ml(e){let t=e.record?{...e.record}:{};return{set(r){Object.assign(t,r)},get(){return t}}}function Ga(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}):$a(e,r,c);try{t.end({span:r,record:n.get(),duration:performance.now()-a,error:c})}catch(d){$a(e,r,d)}finally{r.end()}}}}}function $a(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 Ha=p(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.metricFactory=hl;function hl(e){let t=e.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:t.createHistogram.bind(t),counter:t.createCounter.bind(t)}}});var Wa=p(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.createOTelLogger=gl;function gl(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:yl(c,d),attributes:{"log.namespace":t,"log.level":i}})}}function yl(e,t){if(t.length===0)return e;let r=t.map(n=>vl(n)).join(" ");return`${e} ${r}`}function vl(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 Qa=p(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});Do.index=xl;var _l=Ba(),bl=Ha(),on=wo(),Tl=Wa(),nn=So(),Ka=Yr(),Ya=No(),Xa=(0,on.createDebugLogger)("agents:telemetry");function xl(e){let t=(0,nn.attempt)({try:()=>e.otel(),catch:()=>Xa.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,nn.attempt)({try:()=>e.logs(),catch:()=>Xa.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])=>Ja(n,o)):Ja(t,r)}function Ja(e,t){return{SpanNames:Ka.SpanNames,MetricNames:Ka.MetricNames,debug:t?r=>(0,on.link)((0,on.createDebugLogger)(r),(0,Tl.createOTelLogger)(t,r)):on.createDebugLogger,trace:e?(0,_l.traceFactory)(e):Ya.noopTrace,metric:e?(0,bl.metricFactory)(e):(0,Ya.noopMetric)()}}});var es,ts=E(()=>{es=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var rs=E(()=>{ts()});var Ae,Zo=E(()=>{Ae="1.9.0"});function Cl(e){var t=new Set([e]),r=new Set,n=e.match(ns);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(ns);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 ns,os,is=E(()=>{Zo();ns=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;os=Cl(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||!os(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 Il,gr,yr,Je=E(()=>{rs();Zo();is();Il=Ae.split(".")[0],gr=Symbol.for("opentelemetry.js.api."+Il),yr=es});function vr(e,t,r){var n=ne("diag");if(n)return r.unshift(t),n[e].apply(n,Sl([],El(r),!1))}var El,Sl,as,ss=E(()=>{Je();El=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},Sl=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))},as=(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 cs(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 us=E(()=>{an()});var Al,wl,Ol,$,Qe=E(()=>{ss();us();an();Je();Al=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},wl=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))},Ol="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,wl([],Al(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=cs((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(Ol,r)},r.createComponentLogger=function(o){return new as(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 Pl,Rl,ds,ls=E(()=>{Pl=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},Rl=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.")},ds=(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=Pl(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=Rl(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 fs,ps=E(()=>{fs=Symbol("BaggageEntryMetadata")});function ms(e){return e===void 0&&(e={}),new ds(new Map(Object.entries(e)))}function hs(e){return typeof e!="string"&&(Nl.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:fs,toString:function(){return e}}}var Nl,Lo=E(()=>{Qe();ls();ps();Nl=$.instance()});function Ot(e){return Symbol.for(e)}var jl,sn,_r=E(()=>{jl=(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 jl});var Mo,gs,ys=E(()=>{Mo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],gs=(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 vs(){return qo}var et,kl,cn,Ul,Dl,Zl,Ll,Vo,Ml,Vl,ql,qo,zl,Fl,Gl,$l,Bl,Hl,Wl,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)}})(),kl=(function(){function e(){}return e.prototype.createGauge=function(t,r){return Fl},e.prototype.createHistogram=function(t,r){return Gl},e.prototype.createCounter=function(t,r){return zl},e.prototype.createUpDownCounter=function(t,r){return $l},e.prototype.createObservableGauge=function(t,r){return Hl},e.prototype.createObservableCounter=function(t,r){return Bl},e.prototype.createObservableUpDownCounter=function(t,r){return Wl},e.prototype.addBatchObservableCallback=function(t,r){},e.prototype.removeBatchObservableCallback=function(t){},e})(),cn=(function(){function e(){}return e})(),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.add=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),Ll=(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})(),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),ql=(function(e){et(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Vo),qo=new kl,zl=new Ul,Fl=new Zl,Gl=new Ll,$l=new Dl,Bl=new Ml,Hl=new Vl,Wl=new ql});var un,_s=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 Kl,Yl,bs,Ts=E(()=>{_r();Kl=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},Yl=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))},bs=(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,Yl([n],Kl(o),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})()});var Xl,Jl,Go,Ql,Ze,br=E(()=>{Ts();Je();Qe();Xl=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},Jl=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",Ql=new bs,Ze=(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,Jl([t,r,n],Xl(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return ne(Go)||Ql},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 Tr,xr,fn,pn=E(()=>{$o();Tr="0000000000000000",xr="00000000000000000000000000000000",fn={traceId:xr,spanId:Tr,traceFlags:Pt.NONE}});var Le,mn=E(()=>{pn();Le=(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(Ze.getInstance().active())}function Cr(e,t){return e.setValue(Bo,t)}function Cs(e){return e.deleteValue(Bo)}function Is(e,t){return Cr(e,new Le(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 ef.test(e)&&e!==xr}function Ko(e){return tf.test(e)&&e!==Tr}function Rt(e){return Wo(e.traceId)&&Ko(e.spanId)}function Es(e){return new Le(e)}var ef,tf,yn=E(()=>{pn();mn();ef=/^([0-9a-f]{32})$/i,tf=/^[0-9a-f]{16}$/i});function rf(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=Ze.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 Le;var i=n&&gn(n);return rf(i)&&Rt(i)?new Le(i):new Le},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 nf,_n,Jo=E(()=>{Xo();nf=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):nf},e})()});var Ss,As=E(()=>{Xo();Ss=(function(){function e(){}return e.prototype.getTracer=function(t,r,n){return new vn},e})()});var of,Ir,Qo=E(()=>{Jo();As();of=new Ss,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:of},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,ws=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 Tn,Os=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"})(Tn||(Tn={}))});var xn,Ps=E(()=>{(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(xn||(xn={}))});function Rs(e){return cf.test(e)}function Ns(e){return uf.test(e)&&!df.test(e)}var ei,af,sf,cf,uf,df,js=E(()=>{ei="[_0-9a-z-*/]",af="[a-z]"+ei+"{0,255}",sf="[a-z0-9]"+ei+"{0,240}@[a-z]"+ei+"{0,13}",cf=new RegExp("^(?:"+af+"|"+sf+")$"),uf=/^[ -~]{0,255}[!-~]$/,df=/,|=/});var ks,lf,Us,Ds,Zs,Ls=E(()=>{js();ks=32,lf=512,Us=",",Ds="=",Zs=(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+Ds+t.get(n)),r},[]).join(Us)},e.prototype._parse=function(t){t.length>lf||(this._internalState=t.split(Us).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Ds);if(i!==-1){var a=o.slice(0,i),s=o.slice(i+1,n.length);Rs(a)&&Ns(s)&&r.set(a,s)}return r},new Map),this._internalState.size>ks&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,ks))))},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 Ms(e){return new Zs(e)}var Vs=E(()=>{Ls()});var ti,qs=E(()=>{br();ti=Ze.getInstance()});var ri,zs=E(()=>{Qe();ri=$.instance()});var ff,Fs,Gs=E(()=>{zo();ff=(function(){function e(){}return e.prototype.getMeter=function(t,r,n){return qo},e})(),Fs=new ff});var ni,$s,Bs=E(()=>{Gs();Je();Qe();ni="metrics",$s=(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)||Fs},e.prototype.getMeter=function(t,r,n){return this.getMeterProvider().getMeter(t,r,n)},e.prototype.disable=function(){_e(ni,$.instance())},e})()});var oi,Hs=E(()=>{Bs();oi=$s.getInstance()});var Ws,Ks=E(()=>{Ws=(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 Ys(){return ai(Ze.getInstance().active())}function Xs(e,t){return e.setValue(ii,t)}function Js(e){return e.deleteValue(ii)}var ii,Qs=E(()=>{br();_r();ii=Ot("OpenTelemetry Baggage Key")});var si,pf,ec,tc=E(()=>{Je();Ks();Fo();Qs();Lo();Qe();si="propagation",pf=new Ws,ec=(function(){function e(){this.createBaggage=ms,this.getBaggage=ai,this.getActiveBaggage=Ys,this.setBaggage=Xs,this.deleteBaggage=Js}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)||pf},e})()});var ci,rc=E(()=>{tc();ci=ec.getInstance()});var ui,nc,oc=E(()=>{Je();Qo();yn();Ho();Qe();ui="trace",nc=(function(){function e(){this._proxyTracerProvider=new Ir,this.wrapSpanContext=Es,this.isSpanContextValid=Rt,this.deleteSpan=Cs,this.getSpan=hn,this.getActiveSpan=xs,this.getSpanContext=gn,this.setSpan=Cr,this.setSpanContext=Is}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,ic=E(()=>{oc();di=nc.getInstance()});var ac={};Od(ac,{DiagConsoleLogger:()=>gs,DiagLogLevel:()=>z,INVALID_SPANID:()=>Tr,INVALID_SPAN_CONTEXT:()=>fn,INVALID_TRACEID:()=>xr,ProxyTracer:()=>_n,ProxyTracerProvider:()=>Ir,ROOT_CONTEXT:()=>sn,SamplingDecision:()=>bn,SpanKind:()=>Tn,SpanStatusCode:()=>xn,TraceFlags:()=>Pt,ValueType:()=>un,baggageEntryMetadataFromString:()=>hs,context:()=>ti,createContextKey:()=>Ot,createNoopMeter:()=>vs,createTraceState:()=>Ms,default:()=>mf,defaultTextMapGetter:()=>dn,defaultTextMapSetter:()=>ln,diag:()=>ri,isSpanContextValid:()=>Rt,isValidSpanId:()=>Ko,isValidTraceId:()=>Wo,metrics:()=>oi,propagation:()=>ci,trace:()=>di});var mf,sc=E(()=>{Lo();_r();ys();an();zo();_s();Fo();Jo();Qo();ws();Os();Ps();$o();Vs();yn();pn();qs();zs();Hs();rc();ic();mf={context:ti,diag:ri,metrics:oi,propagation:ci,trace:di}});var cc=p(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.SeverityNumber=void 0;var hf;(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"})(hf=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 uc=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 gf(e,t,r){return n=>n===e?t:r}be.makeGetter=gf;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 yf=In(),En=class{getLogger(t,r,n){return new yf.NoopLogger}};jt.NoopLoggerProvider=En;jt.NOOP_LOGGER_PROVIDER=new En});var dc=p(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ProxyLogger=void 0;var vf=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):vf.NOOP_LOGGER}};Sn.ProxyLogger=fi});var lc=p(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.ProxyLoggerProvider=void 0;var _f=li(),bf=dc(),pi=class{getLogger(t,r,n){var o;return(o=this._getDelegateLogger(t,r,n))!==null&&o!==void 0?o:new bf.ProxyLogger(this,t,r,n)}_getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:_f.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 pc=p(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.LogsAPI=void 0;var ae=uc(),Tf=li(),fc=lc(),mi=class e{constructor(){this._proxyLoggerProvider=new fc.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,Tf.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 fc.ProxyLoggerProvider}};wn.LogsAPI=mi});var hc=p(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.logs=Te.NoopLogger=Te.NOOP_LOGGER=Te.SeverityNumber=void 0;var xf=cc();Object.defineProperty(Te,"SeverityNumber",{enumerable:!0,get:function(){return xf.SeverityNumber}});var mc=In();Object.defineProperty(Te,"NOOP_LOGGER",{enumerable:!0,get:function(){return mc.NOOP_LOGGER}});Object.defineProperty(Te,"NoopLogger",{enumerable:!0,get:function(){return mc.NoopLogger}});var Cf=pc();Te.logs=Cf.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 If=Qa();kt=(0,If.index)({otel:()=>(sc(),Pd(ac)),logs:()=>hc()}),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 bc;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bc||(U.objectUtil=bc={}));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 wf=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=wf});var Nn=p(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.ZodError=Me.quotelessJson=Me.ZodIssueCode=void 0;var Tc=wr();Me.ZodIssueCode=Tc.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 Of=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");Me.quotelessJson=Of;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,Tc.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()}};Me.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(),Pf=(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=Pf});var jn=p(Ve=>{"use strict";var Rf=Ve&&Ve.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.defaultErrorMap=void 0;Ve.setErrorMap=Nf;Ve.getErrorMap=jf;var xc=Rf(yi());Ve.defaultErrorMap=xc.default;var Cc=xc.default;function Nf(e){Cc=e}function jf(){return Cc}});var _i=p(j=>{"use strict";var kf=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=Zf;var Uf=jn(),Ic=kf(yi()),Df=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=Df;j.EMPTY_PATH=[];function Zf(e,t){let r=(0,Uf.getErrorMap)(),n=(0,j.makeIssue)({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ic.default?void 0:Ic.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 Lf=e=>({status:"dirty",value:e});j.DIRTY=Lf;var Mf=e=>({status:"valid",value:e});j.OK=Mf;var Vf=e=>e.status==="aborted";j.isAborted=Vf;var qf=e=>e.status==="dirty";j.isDirty=qf;var zf=e=>e.status==="valid";j.isValid=zf;var Ff=e=>typeof Promise!="undefined"&&e instanceof Promise;j.isAsync=Ff});var Sc=p(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0})});var wc=p(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.errorUtil=void 0;var Ac;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ac||(kn.errorUtil=Ac={}))});var Vc=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=jc;u.custom=Uc;var m=Nn(),Un=jn(),v=wc(),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}},Oc=(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 Oc(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 Oc(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:x.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 Fe.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:x.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:x.ZodDefault})}brand(){return new Pr({typeName:x.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:x.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 Gf=/^c[^\s-]{8,}$/i,$f=/^[0-9a-z]+$/,Bf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hf=/^[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,Wf=/^[a-z0-9_-]{21}$/i,Kf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yf=/^[-+]?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)?)??$/,Xf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bi,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])$/,ep=/^(?:(?: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])$/,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]))$/,rp=/^(([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])$/,np=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,op=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rc="((\\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])))",ip=new RegExp(`^${Rc}$`);function Nc(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 ap(e){return new RegExp(`^${Nc(e)}$`)}function jc(e){let t=`${Rc}T${Nc(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 sp(e,t){return!!((t==="v4"||!t)&&Qf.test(e)||(t==="v6"||!t)&&tp.test(e))}function cp(e,t){if(!Kf.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 up(e,t){return!!((t==="v4"||!t)&&ep.test(e)||(t==="v6"||!t)&&rp.test(e))}var qe=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")Xf.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(Jf,"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")Hf.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")Wf.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")Gf.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")$f.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")Bf.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"?jc(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"?ip.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"?ap(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"?Yf.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"?sp(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"?cp(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"?up(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"?np.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"?op.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=qe;qe.create=e=>{var t;return new qe({checks:[],typeName:x.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1,...A(e)})};function dp(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"?dp(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:x.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:x.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:x.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:x.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:x.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:x.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:x.ZodNull,...A(e)});var ze=class extends w{constructor(){super(...arguments),this._any=!0}_parse(t){return(0,l.OK)(t.data)}};u.ZodAny=ze;ze.create=e=>new ze({typeName:x.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:x.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:x.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:x.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:x.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 xe?xe.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:x.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 kc(h.util.objectKeys(this.shape))}};u.ZodObject=ee;ee.create=(e,t)=>new ee({shape:()=>e,unknownKeys:"strip",catchall:fe.create(),typeName:x.ZodObject,...A(t)});ee.strictCreate=(e,t)=>new ee({shape:()=>e,unknownKeys:"strict",catchall:fe.create(),typeName:x.ZodObject,...A(t)});ee.lazycreate=(e,t)=>new ee({shape:e,unknownKeys:"strip",catchall:fe.create(),typeName:x.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:x.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:x.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...A(n)})}};u.ZodDiscriminatedUnion=Dn;function Ti(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=Ti(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=Ti(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=Ti(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:x.ZodIntersection,...A(r)});var xe=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=xe;xe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:e,typeName:x.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:x.ZodRecord,...A(n)}):new e({keyType:qe.create(),valueType:t,typeName:x.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:x.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:x.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 Fe){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:xe.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||xe.create([]).rest(Oe.create()),returns:r||Oe.create(),typeName:x.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:x.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:x.ZodLiteral,...A(t)});function kc(e,t){return new ft({values:e,typeName:x.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=kc;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:x.ZodNativeEnum,...A(t)});var Fe=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=Fe;Fe.create=(e,t)=>new Fe({type:e,typeName:x.ZodPromise,...A(t)});var oe=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.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:x.ZodEffects,effect:t,...A(r)});oe.createWithPreprocess=(e,t,r)=>new oe({schema:t,effect:{type:"preprocess",transform:e},typeName:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.ZodReadonly,...A(t)});function Pc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Uc(e,t={},r){return e?ze.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=Pc(t,n),_=(f=(d=g.fatal)!=null?d:r)!=null?f:!0;o.addIssue({code:"custom",...g,fatal:_})}});if(!i){let c=Pc(t,n),d=(s=(a=c.fatal)!=null?a:r)!=null?s:!0;o.addIssue({code:"custom",...c,fatal:d})}}):ze.create()}u.late={object:ee.lazycreate};var x;(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"})(x||(u.ZodFirstPartyTypeKind=x={}));var lp=(e,t={message:`Input not instance of ${e.name}`})=>Uc(r=>r instanceof e,t);u.instanceof=lp;var Dc=qe.create;u.string=Dc;var Zc=rt.create;u.number=Zc;var fp=zt.create;u.nan=fp;var pp=nt.create;u.bigint=pp;var Lc=ot.create;u.boolean=Lc;var mp=it.create;u.date=mp;var hp=Lt.create;u.symbol=hp;var gp=at.create;u.undefined=gp;var yp=st.create;u.null=yp;var vp=ze.create;u.any=vp;var _p=Oe.create;u.unknown=_p;var bp=fe.create;u.never=bp;var Tp=Mt.create;u.void=Tp;var xp=Pe.create;u.array=xp;var Cp=ee.create;u.object=Cp;var Ip=ee.strictCreate;u.strictObject=Ip;var Ep=ct.create;u.union=Ep;var Sp=Dn.create;u.discriminatedUnion=Sp;var Ap=ut.create;u.intersection=Ap;var wp=xe.create;u.tuple=wp;var Op=Zn.create;u.record=Op;var Pp=Vt.create;u.map=Pp;var Rp=qt.create;u.set=Rp;var Np=Ln.create;u.function=Np;var jp=dt.create;u.lazy=jp;var kp=lt.create;u.literal=kp;var Up=ft.create;u.enum=Up;var Dp=pt.create;u.nativeEnum=Dp;var Zp=Fe.create;u.promise=Zp;var Mc=oe.create;u.effect=Mc;u.transformer=Mc;var Lp=ce.create;u.optional=Lp;var Mp=Ce.create;u.nullable=Mp;var Vp=oe.createWithPreprocess;u.preprocess=Vp;var qp=Rr.create;u.pipeline=qp;var zp=()=>Dc().optional();u.ostring=zp;var Fp=()=>Zc().optional();u.onumber=Fp;var Gp=()=>Lc().optional();u.oboolean=Gp;u.coerce={string:(e=>qe.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 xi=p(de=>{"use strict";var $p=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)&&$p(t,e,r)};Object.defineProperty(de,"__esModule",{value:!0});Ft(jn(),de);Ft(_i(),de);Ft(Sc(),de);Ft(wr(),de);Ft(Vc(),de);Ft(Nn(),de)});var D=p(te=>{"use strict";var qc=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]})),Bp=te&&te.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Hp=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)&&qc(t,e,r);return Bp(t,e),t},Wp=te&&te.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&qc(t,e,r)};Object.defineProperty(te,"__esModule",{value:!0});te.z=void 0;var zc=Hp(xi());te.z=zc;Wp(xi(),te);te.default=zc});var Ci=p(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.actionTypesZodSchema=Gt.ActionTypes=void 0;var Kp=D(),Fc;(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"})(Fc||(Gt.ActionTypes=Fc={}));Gt.actionTypesZodSchema=Kp.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 Yp=D(),Gc;(function(e){e.Start="start",e.Continue="continue",e.Done="done"})(Gc||($t.SemanticActionStateTypes=Gc={}));$t.semanticActionStateTypesZodSchema=Yp.z.enum(["start","continue","done"])});var Ei=p(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.attachmentLayoutTypesZodSchema=Bt.AttachmentLayoutTypes=void 0;var Xp=D(),$c;(function(e){e.List="list",e.Carousel="carousel"})($c||(Bt.AttachmentLayoutTypes=$c={}));Bt.attachmentLayoutTypesZodSchema=Xp.z.enum(["list","carousel"])});var Si=p(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.Channels=void 0;var Bc;(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"})(Bc||(Mn.Channels=Bc={}))});var Ai=p(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.endOfConversationCodesZodSchema=Ht.EndOfConversationCodes=void 0;var Jp=D(),Hc;(function(e){e.Unknown="unknown",e.CompletedSuccessfully="completedSuccessfully",e.UserCancelled="userCancelled",e.AgentTimedOut="agentTimedOut",e.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",e.ChannelFailed="channelFailed"})(Hc||(Ht.EndOfConversationCodes=Hc={}));Ht.endOfConversationCodesZodSchema=Jp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var Kc=p(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.MembershipSourceTypes=void 0;var Wc;(function(e){e.Channel="channel",e.Team="team"})(Wc||(Vn.MembershipSourceTypes=Wc={}))});var Xc=p(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.MembershipTypes=void 0;var Yc;(function(e){e.Direct="direct",e.Transitive="transitive"})(Yc||(qn.MembershipTypes=Yc={}))});var Nr=p(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.roleTypeZodSchema=Wt.RoleTypes=void 0;var Qp=D(),Jc;(function(e){e.User="user",e.Agent="bot",e.Skill="skill",e.AgenticIdentity="agenticAppInstance",e.AgenticUser="agenticUser"})(Jc||(Wt.RoleTypes=Jc={}));Wt.roleTypeZodSchema=Qp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var Qc=p(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.addAIToActivity=void 0;var em=(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=em});var eu=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 tu=p(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var ru=p(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});Oi.default="00000000-0000-0000-0000-000000000000"});var nu=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 tm=nu();function rm(e){return typeof e=="string"&&tm.default.test(e)}Ri.default=rm});var kr=p(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var nm=jr();function om(e){if(!(0,nm.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=om});var Re=p(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.unsafeStringify=void 0;var im=jr(),F=[];for(let e=0;e<256;++e)F.push((e+256).toString(16).slice(1));function ou(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=ou;function am(e,t=0){let r=ou(e,t);if(!(0,im.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ur.default=am});var Gn=p(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var ji,sm=new Uint8Array(16);function cm(){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(sm)}ki.default=cm});var Ui=p(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.updateV1State=void 0;var iu=Gn(),um=Re(),Dr={};function dm(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=au((c=(s=e.random)!=null?s:(a=e.rng)==null?void 0:a.call(e))!=null?c:(0,iu.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let d=Date.now(),f=(0,iu.default)();su(Dr,d,f),n=au(f,Dr.msecs,Dr.nsecs,o?void 0:Dr.clockseq,o?void 0:Dr.node,t,r)}return t!=null?t:(0,um.unsafeStringify)(n)}function su(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=su;function au(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=dm});var Zi=p(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});var lm=kr(),fm=Re();function pm(e){let t=typeof e=="string"?(0,lm.default)(e):e,r=mm(t);return typeof e=="string"?(0,fm.unsafeStringify)(r):r}Di.default=pm;function mm(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 uu=p(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});function hm(e){let t=vm(e),r=ym(t,e.length*8);return gm(r)}function gm(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 cu(e){return(e+64>>>9<<4)+14+1}function ym(e,t){let r=new Uint32Array(cu(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=Ge(n,c),o=Ge(o,d),i=Ge(i,f),a=Ge(a,g)}return Uint32Array.of(n,o,i,a)}function vm(e){if(e.length===0)return new Uint32Array;let t=new Uint32Array(cu(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 Ge(e,t){let r=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(r>>16)<<16|r&65535}function _m(e,t){return e<<t|e>>>32-t}function $n(e,t,r,n,o,i){return Ge(_m(Ge(Ge(t,e),Ge(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=hm});var Lr=p(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.URL=Ne.DNS=Ne.stringToBytes=void 0;var du=kr(),bm=Re();function lu(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=lu;Ne.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Ne.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Tm(e,t,r,n,o,i){let a=typeof r=="string"?lu(r):r,s=typeof n=="string"?(0,du.default)(n):n;if(typeof n=="string"&&(n=(0,du.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,bm.unsafeStringify)(c)}Ne.default=Tm});var pu=p(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.URL=vt.DNS=void 0;var xm=uu(),Mi=Lr(),fu=Lr();Object.defineProperty(vt,"DNS",{enumerable:!0,get:function(){return fu.DNS}});Object.defineProperty(vt,"URL",{enumerable:!0,get:function(){return fu.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 mu=p(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Cm=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);qi.default={randomUUID:Cm}});var gu=p(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});var hu=mu(),Im=Gn(),Em=Re();function Sm(e,t,r){var o,i,a;if(hu.default.randomUUID&&!t&&!e)return hu.default.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:(0,Im.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,Em.unsafeStringify)(n)}zi.default=Sm});var yu=p(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});function Am(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 wm(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)+Am(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=wm});var _u=p(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.URL=_t.DNS=void 0;var Om=yu(),$i=Lr(),vu=Lr();Object.defineProperty(_t,"DNS",{enumerable:!0,get:function(){return vu.DNS}});Object.defineProperty(_t,"URL",{enumerable:!0,get:function(){return vu.URL}});function Bi(e,t,r,n){return(0,$i.default)(80,Om.default,e,t,r,n)}Bi.DNS=$i.DNS;Bi.URL=$i.URL;_t.default=Bi});var bu=p(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Pm=Re(),Rm=Ui(),Nm=Zi();function jm(e,t,r){e!=null||(e={}),r!=null||(r=0);let n=(0,Rm.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,Nm.default)(n),t){for(let o=0;o<16;o++)t[r+o]=n[o];return t}return(0,Pm.unsafeStringify)(n)}Hi.default=jm});var Tu=p(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var km=kr(),Um=Re();function Dm(e){let t=typeof e=="string"?(0,km.default)(e):e,r=Zm(t);return typeof e=="string"?(0,Um.unsafeStringify)(r):r}Wi.default=Dm;function Zm(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 Eu=p(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.updateV7State=void 0;var xu=Gn(),Lm=Re(),Ki={};function Mm(e,t,r){var o,i,a;let n;if(e)n=Cu((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)();Iu(Ki,s,c),n=Cu(c,Ki.msecs,Ki.seq,t,r)}return t!=null?t:(0,Lm.unsafeStringify)(n)}function Iu(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=Iu;function Cu(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=Mm});var Su=p(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Vm=jr();function qm(e){if(!(0,Vm.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Yi.default=qm});var Au=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 zm=tu();Object.defineProperty(R,"MAX",{enumerable:!0,get:function(){return zm.default}});var Fm=ru();Object.defineProperty(R,"NIL",{enumerable:!0,get:function(){return Fm.default}});var Gm=kr();Object.defineProperty(R,"parse",{enumerable:!0,get:function(){return Gm.default}});var $m=Re();Object.defineProperty(R,"stringify",{enumerable:!0,get:function(){return $m.default}});var Bm=Ui();Object.defineProperty(R,"v1",{enumerable:!0,get:function(){return Bm.default}});var Hm=Zi();Object.defineProperty(R,"v1ToV6",{enumerable:!0,get:function(){return Hm.default}});var Wm=pu();Object.defineProperty(R,"v3",{enumerable:!0,get:function(){return Wm.default}});var Km=gu();Object.defineProperty(R,"v4",{enumerable:!0,get:function(){return Km.default}});var Ym=_u();Object.defineProperty(R,"v5",{enumerable:!0,get:function(){return Ym.default}});var Xm=bu();Object.defineProperty(R,"v6",{enumerable:!0,get:function(){return Xm.default}});var Jm=Tu();Object.defineProperty(R,"v6ToV1",{enumerable:!0,get:function(){return Jm.default}});var Qm=Eu();Object.defineProperty(R,"v7",{enumerable:!0,get:function(){return Qm.default}});var eh=jr();Object.defineProperty(R,"validate",{enumerable:!0,get:function(){return eh.default}});var th=Su();Object.defineProperty(R,"version",{enumerable:!0,get:function(){return th.default}})});var Xi=p(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.entityZodSchema=void 0;var wu=D();Bn.entityZodSchema=wu.z.object({type:wu.z.string().min(1)}).passthrough()});var Ou=p(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.semanticActionZodSchema=void 0;var Vr=D(),rh=Xi(),nh=Ii();Hn.semanticActionZodSchema=Vr.z.object({id:Vr.z.string().min(1),state:Vr.z.union([nh.semanticActionStateTypesZodSchema,Vr.z.string().min(1)]),entities:Vr.z.record(rh.entityZodSchema)})});var Pu=p(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.cardActionZodSchema=void 0;var Ie=D(),oh=Ci();Wn.cardActionZodSchema=Ie.z.object({type:Ie.z.union([oh.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 Ru=p(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.suggestedActionsZodSchema=void 0;var Kn=D(),ih=Pu();Yn.suggestedActionsZodSchema=Kn.z.object({to:Kn.z.array(Kn.z.string().min(1)),actions:Kn.z.array(ih.cardActionZodSchema)})});var Ji=p(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.activityEventNamesZodSchema=Kt.ActivityEventNames=void 0;var ah=D(),Nu;(function(e){e.ContinueConversation="ContinueConversation",e.CreateConversation="CreateConversation"})(Nu||(Kt.ActivityEventNames=Nu={}));Kt.activityEventNamesZodSchema=ah.z.enum(["ContinueConversation","CreateConversation"])});var Qi=p(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.activityImportanceZodSchema=Yt.ActivityImportance=void 0;var sh=D(),ju;(function(e){e.Low="low",e.Normal="normal",e.High="high"})(ju||(Yt.ActivityImportance=ju={}));Yt.activityImportanceZodSchema=sh.z.enum(["low","normal","high"])});var ea=p(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.activityTypesZodSchema=Xt.ActivityTypes=void 0;var ch=D(),ku;(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"})(ku||(Xt.ActivityTypes=ku={}));Xt.activityTypesZodSchema=ch.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Uu=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 Du=p(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.addProductInfoToActivity=bt.clearProductInfoFromActivity=void 0;var uh=e=>{e&&e.entities&&e.entities.length&&(e.entities=e.entities.filter(t=>t.type!=="ProductInfo"))};bt.clearProductInfoFromActivity=uh;var dh=(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=dh});var ta=p(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.channelAccountZodSchema=void 0;var pe=D(),lh=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([lh.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(),fh=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([fh.roleTypeZodSchema,Ee.z.string().min(1)]).optional(),properties:Ee.z.unknown().optional()})});var Lu=p(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.conversationReferenceZodSchema=void 0;var qr=D(),Zu=ta(),ph=ra();eo.conversationReferenceZodSchema=qr.z.object({activityId:qr.z.string().min(1).optional(),user:Zu.channelAccountZodSchema.optional(),locale:qr.z.string().min(1).optional(),agent:Zu.channelAccountZodSchema.optional().nullable(),conversation:ph.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 mh=D(),Mu;(function(e){e.Normal="normal",e.Notification="notification",e.ExpectReplies="expectReplies",e.Ephemeral="ephemeral"})(Mu||(Qt.DeliveryModes=Mu={}));Qt.deliveryModesZodSchema=mh.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 hh=D(),Vu;(function(e){e.AcceptingInput="acceptingInput",e.IgnoringInput="ignoringInput",e.ExpectingInput="expectingInput"})(Vu||(er.InputHints=Vu={}));er.inputHintsZodSchema=hh.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var ia=p(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.messageReactionTypesZodSchema=tr.MessageReactionTypes=void 0;var gh=D(),qu;(function(e){e.Like="like",e.PlusOne="plusOne"})(qu||(tr.MessageReactionTypes=qu={}));tr.messageReactionTypesZodSchema=gh.z.enum(["like","plusOne"])});var zu=p(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.messageReactionZodSchema=void 0;var aa=D(),yh=ia();to.messageReactionZodSchema=aa.z.object({type:aa.z.union([yh.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 vh=D(),Fu;(function(e){e.Markdown="markdown",e.Plain="plain",e.Xml="xml"})(Fu||(rr.TextFormatTypes=Fu={}));rr.textFormatTypesZodSchema=vh.z.enum(["markdown","plain","xml"])});var Gu=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"},TargetedActivityIsGroupOnly:{code:-110008,description:"Targeted activities can only be sent in a group chat or channel."}}});var la=p(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.ActivityTreatments=void 0;var $u;(function(e){e.Targeted="targeted"})($u||(ao.ActivityTreatments=$u={}))});var Ju=p(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.Activity=Tt.activityZodSchema=void 0;var _h=Au(),b=D(),bh=Ou(),Th=Ru(),Xu=Ji(),xh=Qi(),co=ea(),Ch=Uu(),Ih=Ei(),Bu=Du(),so=ta(),Hu=Si(),Eh=ra(),Sh=Lu(),Ah=Ai(),wh=na(),Oh=Xi(),Ph=oa(),Wu=zu(),Rh=sa(),Nh=Gu(),Ku=Nr(),je=ua(),ke=da(),Yu=la();Tt.activityZodSchema=b.z.object({type:b.z.union([co.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:so.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:Eh.conversationAccountZodSchema.optional(),recipient:so.channelAccountZodSchema.optional(),textFormat:b.z.union([Rh.textFormatTypesZodSchema,b.z.string().min(1)]).optional(),attachmentLayout:b.z.union([Ih.attachmentLayoutTypesZodSchema,b.z.string().min(1)]).optional(),membersAdded:b.z.array(so.channelAccountZodSchema).optional(),membersRemoved:b.z.array(so.channelAccountZodSchema).optional(),reactionsAdded:b.z.array(Wu.messageReactionZodSchema).optional(),reactionsRemoved:b.z.array(Wu.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([Ph.inputHintsZodSchema,b.z.string().min(1)]).optional(),summary:b.z.string().min(1).optional(),suggestedActions:Th.suggestedActionsZodSchema.optional(),attachments:b.z.array(Ch.attachmentZodSchema).optional(),entities:b.z.array(Oh.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([Xu.activityEventNamesZodSchema,b.z.string().min(1)]).optional(),relatesTo:Sh.conversationReferenceZodSchema.optional(),code:b.z.union([Ah.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([wh.deliveryModesZodSchema,b.z.string().min(1)]).optional(),listenFor:b.z.array(b.z.string().min(1)).optional(),textHighlights:b.z.array(Nh.textHighlightZodSchema).optional(),semanticAction:bh.semanticActionZodSchema.optional()});var fa=class e{constructor(t){if(t===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeUndefined);if(t===null)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeNull);if(typeof t=="string"&&t.length===0)throw je.ExceptionHelper.generateException(Error,ke.Errors.InvalidActivityTypeEmptyString);this.type=t}static fromJson(t){return this.fromObject(JSON.parse(t))}static fromObject(t){let r=Tt.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 je.ExceptionHelper.generateException(Error,ke.Errors.InvalidChannelIdFormat,void 0,{channelId:t});this._channelId=r,n?(0,Bu.addProductInfoToActivity)(this,n):(0,Bu.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 je.ExceptionHelper.generateException(Error,ke.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${t?`:${t}`:""}`}static getContinuationActivity(t){var r;let n={type:co.ActivityTypes.Event,name:Xu.ActivityEventNames.ContinueConversation,id:(r=t.activityId)!==null&&r!==void 0?r:(0,_h.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!==co.ActivityTypes.ConversationUpdate||this.channelId!==Hu.Channels.Directline&&this.channelId!==Hu.Channels.Webchat)return this.id}getConversationReference(){if(this.recipient===null||this.recipient===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw je.ExceptionHelper.generateException(Error,ke.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw je.ExceptionHelper.generateException(Error,ke.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===co.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):""}isTargetedActivity(){var t;return!((t=this.entities)===null||t===void 0)&&t.length?this.entities.some(r=>r.type==="activityTreatment"&&r.treatment===Yu.ActivityTreatments.Targeted):!1}makeTargetedActivity(){var t,r;if(!(!((t=this.conversation)===null||t===void 0)&&t.isGroup))throw je.ExceptionHelper.generateException(Error,ke.Errors.TargetedActivityIsGroupOnly);this.isTargetedActivity()||((r=this.entities)!==null&&r!==void 0||(this.entities=[]),this.entities.push({type:"activityTreatment",treatment:Yu.ActivityTreatments.Targeted}))}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()===Ku.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Ku.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}};Tt.Activity=fa});var uo=p(C=>{"use strict";var jh=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]})),Qu=C&&C.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&jh(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 kh=Ci();Object.defineProperty(C,"ActionTypes",{enumerable:!0,get:function(){return kh.ActionTypes}});var Uh=Ii();Object.defineProperty(C,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Uh.SemanticActionStateTypes}});var Dh=Ei();Object.defineProperty(C,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Dh.AttachmentLayoutTypes}});var Zh=Si();Object.defineProperty(C,"Channels",{enumerable:!0,get:function(){return Zh.Channels}});var Lh=Ai();Object.defineProperty(C,"EndOfConversationCodes",{enumerable:!0,get:function(){return Lh.EndOfConversationCodes}});var Mh=Kc();Object.defineProperty(C,"MembershipSourceTypes",{enumerable:!0,get:function(){return Mh.MembershipSourceTypes}});var Vh=Xc();Object.defineProperty(C,"MembershipTypes",{enumerable:!0,get:function(){return Vh.MembershipTypes}});var qh=Nr();Object.defineProperty(C,"RoleTypes",{enumerable:!0,get:function(){return qh.RoleTypes}});Qu(Qc(),C);Qu(eu(),C);var ed=Ju();Object.defineProperty(C,"Activity",{enumerable:!0,get:function(){return ed.Activity}});Object.defineProperty(C,"activityZodSchema",{enumerable:!0,get:function(){return ed.activityZodSchema}});var zh=Ji();Object.defineProperty(C,"ActivityEventNames",{enumerable:!0,get:function(){return zh.ActivityEventNames}});var Fh=Qi();Object.defineProperty(C,"ActivityImportance",{enumerable:!0,get:function(){return Fh.ActivityImportance}});var Gh=ea();Object.defineProperty(C,"ActivityTypes",{enumerable:!0,get:function(){return Gh.ActivityTypes}});var $h=na();Object.defineProperty(C,"DeliveryModes",{enumerable:!0,get:function(){return $h.DeliveryModes}});var Bh=oa();Object.defineProperty(C,"InputHints",{enumerable:!0,get:function(){return Bh.InputHints}});var Hh=ia();Object.defineProperty(C,"MessageReactionTypes",{enumerable:!0,get:function(){return Hh.MessageReactionTypes}});var Wh=sa();Object.defineProperty(C,"TextFormatTypes",{enumerable:!0,get:function(){return Wh.TextFormatTypes}});var Kh=la();Object.defineProperty(C,"ActivityTreatments",{enumerable:!0,get:function(){return Kh.ActivityTreatments}});var Yh=ua();Object.defineProperty(C,"ExceptionHelper",{enumerable:!0,get:function(){return Yh.ExceptionHelper}});var Xh=da();Object.defineProperty(C,"ActivityErrors",{enumerable:!0,get:function(){return Xh.Errors}})});var fr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(fr||{});var pr=(T=>(T.Unknown="Unknown",T.Exp="Exp",T.Dev="Dev",T.Test="Test",T.Preprod="Preprod",T.FirstRelease="FirstRelease",T.Prod="Prod",T.Gov="Gov",T.High="High",T.DoD="DoD",T.Mooncake="Mooncake",T.Ex="Ex",T.Rx="Rx",T.Prv="Prv",T.Local="Local",T.GovFR="GovFR",T.Other="Other",T))(pr||{});var bo=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},To=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})}},yg=()=>{var e,t,r,n,o,i,a,s;return new To({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 xo(e){}function Ra(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=xo,onError:r=xo,onRetry:n=xo,onComment:o}=e,i="",a=!0,s,c="",d="";function f(y){let S=a?y.replace(/^\xEF\xBB\xBF/,""):y,[T,N]=Rd(`${i}${S}`);for(let O of T)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 T=y.slice(0,S),N=y[S+1]===" "?2:1,O=y.slice(S+N);_(T,O,y);return}_(y,"",y)}function _(y,S,T){switch(y){case"event":d=S;break;case"data":c=`${c}${S}
|
|
2
|
-
`;break;case"id":
|
|
3
|
-
`)?c.slice(0,-1):c}),
|
|
4
|
-
`,n),
|
|
5
|
-
`&&n++}}return[t,r]}var Na="connecting",Nd="open",Co="closed",Wr=()=>{};function jd(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}=kd(r),g={...r.headers},_=[],I=n?[n]:[],P=M=>I.forEach(he=>he(M)),y=Ra({onEvent:Td,onRetry:xd,onComment:o}),S,T=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 T},get readyState(){return L}};function Se(){S||(L=Na,N=new AbortController,S=c(d,Cd()).then(bd).catch(M=>{S=null,!(M.name==="AbortError"||M.type==="aborted"||N.signal.aborted)&&Aa()}))}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 Aa(){s({delay:k}),!N.signal.aborted&&(L=Na,V=setTimeout(Se,k))}async function bd(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&&(T=M.url);let Ke=t(he),lr=new TextDecoder,J=Ke.getReader(),ge=!0;L=Nd;do{let{done:wa,value:Oa}=await J.read();Oa&&y.feed(lr.decode(Oa,{stream:!wa})),wa&&(ge=!1,S=null,y.reset(),Aa(),a())}while(ge)}function Td(M){typeof M.id=="string"&&(O=M.id),P(M)}function xd(M){k=M}function Cd(){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 kd(e){let t=e.fetch||globalThis.fetch;if(!Ud(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 Ud(e){return typeof e=="function"}var Dd={getStream:Zd};function Io(e){return jd(e,Dd)}function Zd(e){if(!(e instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return e}var yc=De(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,yc.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 Ef(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=Sf(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 vc(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 _c(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(gc(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(gc(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 Ef(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 Sf(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=Af(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 Af(e){switch(e){case"FirstRelease":case"Prod":return 2;default:return 1}}function gc(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 xt=De(uo());var zr=class{constructor(t,r){this.activity=t,this.conversationId=r}};var He=De(Ut());var lo="1.6.0-beta.9.gce9d8facd2";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 _c(t)}};function td(e,t){return{activities:e,conversationId:t,isNewConversation:!0}}function rd(e,t){return{activities:e,conversationId:t,activityCount:e.length}}var Z=De(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 pa=De(uo()),re=De(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:pa.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:pa.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(T,N)=>{let O=await fetch(T,N);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:T,event:N}of S){if(T&&N==="activity")try{let O=xt.Activity.fromJson(T);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 xt.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 xt.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=xt.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,td(r,n)}async executeWithResponse(t,r){let n=[];for await(let o of this.executeStreaming(t,r))n.push(o);return rd(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=vc(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=xt.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 nd=Be;var G=[];for(let e=0;e<256;++e)G.push((e+256).toString(16).slice(1));function od(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 ma,Qh=new Uint8Array(16);function ha(){if(!ma){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ma=crypto.getRandomValues.bind(crypto)}return ma(Qh)}var eg=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ga={randomUUID:eg};function tg(e,t,r){var o,i,a;if(ga.randomUUID&&!t&&!e)return ga.randomUUID();e=e||{};let n=(a=(i=e.random)!=null?i:(o=e.rng)==null?void 0:o.call(e))!=null?a:ha();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 od(n)}var ya=tg;var _d=De(uo());var va=function(e,t){return va=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])},va(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");va(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:
|
|
1
|
+
var fu=Object.create;var Nr=Object.defineProperty;var mu=Object.getOwnPropertyDescriptor;var hu=Object.getOwnPropertyNames;var gu=Object.getPrototypeOf,yu=Object.prototype.hasOwnProperty;var E=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var g=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},zi=(t,e)=>{for(var r in e)Nr(t,r,{get:e[r],enumerable:!0})},qi=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of hu(e))!yu.call(t,o)&&o!==r&&Nr(t,o,{get:()=>e[o],enumerable:!(n=mu(e,o))||n.enumerable});return t};var Te=(t,e,r)=>(r=t!=null?fu(gu(t)):{},qi(e||!t||!t.__esModule?Nr(r,"default",{value:t,enumerable:!0}):r,t)),Fi=t=>qi(Nr({},"__esModule",{value:!0}),t);var ro=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.isPromise=to;kr.attempt=vu;function to(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"then"in t&&typeof t.then=="function"}function vu(t){var e;let r=!1;try{let n=t.try();return to(n)?(r=!0,n.catch(o=>{var i;if(!t.catch)throw o;let s=(i=t.catch)===null||i===void 0?void 0:i.call(t,o);if(to(s))return s.then(()=>{})}).finally(t.finally)):n}catch(n){if(!t.catch)throw n;t.catch(n);return}finally{!r&&((e=t.finally)===null||e===void 0||e.call(t))}}});var Dr=g(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.MetricNames=de.SpanNames=de.SpanCategories=de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES=void 0;de.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES="AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES";de.SpanCategories={STORAGE:["STORAGE_"],AUTHORIZATION:["AUTHORIZATION_","USER_TOKEN_CLIENT_"],AUTHENTICATION:["AUTHENTICATION_"],DIALOGS:["DIALOGS_"]};de.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",NAMED_PIPE_CONNECT:"agents.named_pipe.connect",NAMED_PIPE_DISPATCH:"agents.named_pipe.dispatch",NAMED_PIPE_SEND:"agents.named_pipe.send"};de.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",NAMED_PIPE_CONNECTIONS:"agents.named_pipe.connection.count",NAMED_PIPE_DISPATCHES:"agents.named_pipe.dispatch.count",NAMED_PIPE_DISPATCH_DURATION:"agents.named_pipe.dispatch.duration",NAMED_PIPE_DISPATCH_ERRORS:"agents.named_pipe.dispatch.error.count",NAMED_PIPE_SENDS:"agents.named_pipe.send.count",NAMED_PIPE_SEND_DURATION:"agents.named_pipe.send.duration"}});var $i=g((im,Gi)=>{var mt=1e3,ht=mt*60,gt=ht*60,Ve=gt*24,_u=Ve*7,bu=Ve*365.25;Gi.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Tu(t);if(r==="number"&&isFinite(t))return e.long?xu(t):Cu(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Tu(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*bu;case"weeks":case"week":case"w":return r*_u;case"days":case"day":case"d":return r*Ve;case"hours":case"hour":case"hrs":case"hr":case"h":return r*gt;case"minutes":case"minute":case"mins":case"min":case"m":return r*ht;case"seconds":case"second":case"secs":case"sec":case"s":return r*mt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Cu(t){var e=Math.abs(t);return e>=Ve?Math.round(t/Ve)+"d":e>=gt?Math.round(t/gt)+"h":e>=ht?Math.round(t/ht)+"m":e>=mt?Math.round(t/mt)+"s":t+"ms"}function xu(t){var e=Math.abs(t);return e>=Ve?Ur(t,e,Ve,"day"):e>=gt?Ur(t,e,gt,"hour"):e>=ht?Ur(t,e,ht,"minute"):e>=mt?Ur(t,e,mt,"second"):t+" ms"}function Ur(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Hi=g((sm,Bi)=>{function Eu(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=a,r.humanize=$i(),r.destroy=l,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let y=0;for(let T=0;T<p.length;T++)y=(y<<5)-y+p.charCodeAt(T),y|=0;return r.colors[Math.abs(y)%r.colors.length]}r.selectColor=e;function r(p){let y,T=null,I,M;function h(...w){if(!h.enabled)return;let b=h,P=Number(new Date),O=P-(y||P);b.diff=O,b.prev=y,b.curr=P,y=P,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let N=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(Z,be)=>{if(Z==="%%")return"%";N++;let Q=r.formatters[be];if(typeof Q=="function"){let Qt=w[N];Z=Q.call(b,Qt),w.splice(N,1),N--}return Z}),r.formatArgs.call(b,w),(b.log||r.log).apply(b,w)}return h.namespace=p,h.useColors=r.useColors(),h.color=r.selectColor(p),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(I!==r.namespaces&&(I=r.namespaces,M=r.enabled(p)),M),set:w=>{T=w}}),typeof r.init=="function"&&r.init(h),h}function n(p,y){let T=r(this.namespace+(typeof y=="undefined"?":":y)+p);return T.log=this.log,T}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let y=(typeof p=="string"?p:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let T of y)T[0]==="-"?r.skips.push(T.slice(1)):r.names.push(T)}function i(p,y){let T=0,I=0,M=-1,h=0;for(;T<p.length;)if(I<y.length&&(y[I]===p[T]||y[I]==="*"))y[I]==="*"?(M=I,h=T,I++):(T++,I++);else if(M!==-1)I=M+1,h++,T=h;else return!1;for(;I<y.length&&y[I]==="*";)I++;return I===y.length}function s(){let p=[...r.names,...r.skips.map(y=>"-"+y)].join(",");return r.enable(""),p}function a(p){for(let y of r.skips)if(i(p,y))return!1;for(let y of r.names)if(i(p,y))return!0;return!1}function c(p){return p instanceof Error?p.stack||p.message:p}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}Bi.exports=Eu});var Wi=g((H,Zr)=>{H.formatArgs=Su;H.save=Au;H.load=wu;H.useColors=Iu;H.storage=Ou();H.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`."))}})();H.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 Iu(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Su(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Zr.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)}H.log=console.debug||console.log||(()=>{});function Au(t){try{t?H.storage.setItem("debug",t):H.storage.removeItem("debug")}catch{}}function wu(){let t;try{t=H.storage.getItem("debug")||H.storage.getItem("DEBUG")}catch{}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function Ou(){try{return localStorage}catch{}}Zr.exports=Hi()(H);var{formatters:Pu}=Zr.exports;Pu.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var no=g(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.isBrowser=void 0;jr.isBrowser=typeof window!="undefined"&&typeof window.document!="undefined"});var Ki=g(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.levels=void 0;Mr.levels=["info","warn","error","debug"]});var oo=g(yt=>{"use strict";var Ru=yt&&yt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yt,"__esModule",{value:!0});yt.createDebugLogger=Uu;yt.link=Zu;var Nu=Ru(Wi()),ku=no(),Du=Ki();function Uu(t){return{info:Lr(t,"info"),warn:Lr(t,"warn"),error:Lr(t,"error"),debug:Lr(t,"debug")}}var Yi={node:{info:"2",warn:"3",error:"1",debug:"4"},browser:{info:"#33CC99",warn:"#CCCC33",error:"#CC3366",debug:"#0066FF"}};function Lr(t,e){let r=(0,Nu.default)(`${t}:${e}`);return ku.isBrowser?r.color=Yi.browser[e]:r.color=Yi.node[e],r}function Zu(t,...e){return Du.levels.reduce((r,n)=>(r[n]=(o,...i)=>{if(t[n].enabled){t[n](o,...i);for(let s of e)s[n](o,...i)}},r),{})}});var Xi=g(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.getSetting=Mu;var ju=no();function Mu(t){var e,r;if(ju.isBrowser)try{return(e=window.localStorage.getItem(t))!==null&&e!==void 0?e:""}catch{}else return(r=process.env[t])!==null&&r!==void 0?r:"";return""}});var Qi=g(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.isSpanDisabled=zu;var or=Dr(),Lu=oo(),Vu=Xi(),so=(0,Lu.createDebugLogger)("agents:telemetry"),Ji=(()=>{let t=(0,Vu.getSetting)(or.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES).trim().toUpperCase();if(!t)return[];let e=t.split(/[\s,]+/).map(i=>i.trim()).filter(Boolean),r=Object.entries(or.SpanNames),n=new Set,o=[];for(let i of e){let s=or.SpanCategories[i];if(!s){so.warn(`Invalid span category "${i}" in ${or.AGENTS_TELEMETRY_DISABLED_SPAN_CATEGORIES}. Valid categories are: ${Object.keys(or.SpanCategories).join(", ")}`);continue}for(let a of s)if(!n.has(a)){n.add(a);for(let[c,l]of r)c.startsWith(a)&&o.push(l)}}return o.length>0&&so.debug("Disabled Span names:",o),o})();function zu(t){if(Ji.length===0)return!1;let e=Ji.includes(t);return so.debug(`Span "${t}" disabled:`,e),e}});var co=g(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.noopTrace=void 0;ze.noopMetric=qu;ze.noopContext=es;var ir=()=>{};ze.noopTrace=function(t,e){return es(e)};ze.noopTrace.define=t=>t;function qu(){return{histogram:()=>({record:ir}),counter:()=>({add:ir})}}function es(t){let e=new Proxy({},{get:()=>ir}),r={record:ir,actions:e};return t?t(r):{record:r.record,actions:r.actions,end:ir,fail(o){return o}}}});var ns=g(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.traceFactory=Hu;var Fu=ro(),Gu=Qi(),$u=Dr(),Bu=co();function Hu(t){let e=new Set(Object.values($u.SpanNames)),r=t.trace.getTracer("@microsoft/agents-telemetry"),n=function(i,s){if(!i)throw new Error("Trace definition is required");if(!e.has(i.name))throw new Error(`Unrecognized span name "${i.name}". See SpanNames constants.`);if((0,Gu.isSpanDisabled)(i.name))return(0,Bu.noopContext)(s);let a=Wu(i);if(!s){let c=r.startSpan(i.name),l=ts(t,i,c,a);return{record:l.record,actions:l.actions,fail:l.fail,end:l.end}}return r.startActiveSpan(i.name,c=>{let l=ts(t,i,c,a);return(0,Fu.attempt)({try:()=>s({record:l.record,actions:l.actions}),catch:p=>{throw l.fail(p)},finally:l.end})})};return n.define=o=>o,n}function Wu(t){let e=t.record?{...t.record}:{};return{set(r){Object.assign(e,r)},get(){return e}}}function ts(t,e,r,n){var o,i;let s=performance.now(),a=!1,c;return{record:n.set,actions:(i=(o=e.actions)===null||o===void 0?void 0:o.call(e,{span:r}))!==null&&i!==void 0?i:{},fail(l){return c=l,l},end(){if(!(a||!t)){a=!0,c===void 0?r.setStatus({code:t.SpanStatusCode.OK}):rs(t,r,c);try{e.end({span:r,record:n.get(),duration:performance.now()-s,error:c})}catch(l){rs(t,r,l)}finally{r.end()}}}}}function rs(t,e,r){let n;r instanceof Error?(n=r.message,e.recordException(r)):(n=String(r),e.recordException({name:typeof r,message:n})),e.setStatus({code:t.SpanStatusCode.ERROR,message:n})}});var os=g(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.metricFactory=Ku;function Ku(t){let e=t.metrics.getMeter("@microsoft/agents-telemetry");return{histogram:e.createHistogram.bind(e),counter:e.createCounter.bind(e)}}});var is=g(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.createOTelLogger=Yu;function Yu(t,e){return{info:Vr(t,e,"info"),warn:Vr(t,e,"warn"),error:Vr(t,e,"error"),debug:Vr(t,e,"debug")}}function Vr(t,e,r){var n;let o=t.logs.getLogger(e),i=(n=r==null?void 0:r.toLowerCase())!==null&&n!==void 0?n:"debug",s={debug:t.SeverityNumber.DEBUG,info:t.SeverityNumber.INFO,warn:t.SeverityNumber.WARN,error:t.SeverityNumber.ERROR}[i];return function(c,...l){o.emit({severityNumber:s,severityText:i.toUpperCase(),body:Xu(c,l),attributes:{"log.namespace":e,"log.level":i}})}}function Xu(t,e){if(e.length===0)return t;let r=e.map(n=>Ju(n)).join(" ");return`${t} ${r}`}function Ju(t){if(t instanceof Error)return`${t.name}: ${t.message}`;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);try{return JSON.stringify(t)}catch{return String(t)}}});var us=g(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.index=rd;var Qu=ns(),ed=os(),qr=oo(),td=is(),zr=ro(),ss=Dr(),as=co(),fo=(0,qr.createDebugLogger)("agents:telemetry");function rd(t){let e=(0,zr.attempt)({try:()=>t.otel(),catch:()=>fo.warn("OpenTelemetry API not found. Install @opentelemetry/api as a dependency to enable tracing and metrics.")}),r=(0,zr.attempt)({try:()=>t.logs(),catch:()=>fo.warn("OpenTelemetry API Logs not found. Install @opentelemetry/api-logs as a dependency to enable OTel logging.")});return(0,zr.isPromise)(e)||(0,zr.isPromise)(r)?Promise.all([e,r]).then(([n,o])=>cs(n,o)):cs(e,r)}function cs(t,e){return fo.info("Telemetry settings loaded",{traceEnabled:t!==void 0,logsEnabled:e!==void 0}),{SpanNames:ss.SpanNames,MetricNames:ss.MetricNames,debug:e?r=>(0,qr.link)((0,qr.createDebugLogger)(r),(0,td.createOTelLogger)(e,r)):qr.createDebugLogger,trace:t?(0,Qu.traceFactory)(t):as.noopTrace,metric:t?(0,ed.metricFactory)(t):(0,as.noopMetric)()}}});var ls=g(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.redactString=nd;ar.redactUrl=od;ar.redactScopes=id;var sr="<redacted>",ds=2;function nd(t,e=!1){if(t!==void 0)return e&&t.length>ds+6?`${t.slice(0,ds)}${sr}`:sr}function od(t){if(t!=null&&t.trim())try{let e=new URL(t),r=e.pathname.split("/").filter(Boolean);return r.length===0?e.origin:`${e.origin}/${sr} (${r.length} segments)`}catch{return sr}}function id(t){if(t===void 0)return;let e=t.length;return`${sr} (${e} ${e===1?"scope":"scopes"})`}});var ps,fs=E(()=>{ps=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});var ms=E(()=>{fs()});var Ce,ho=E(()=>{Ce="1.9.0"});function sd(t){var e=new Set([t]),r=new Set,n=t.match(hs);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===t};function i(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;var l=c.match(hs);if(!l)return i(c);var p={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return p.prerelease!=null||o.major!==p.major?i(c):o.major===0?o.minor===p.minor&&o.patch<=p.patch?s(c):i(c):o.minor<=p.minor?s(c):i(c)}}var hs,gs,ys=E(()=>{ho();hs=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;gs=sd(Ce)});function le(t,e,r,n){var o;n===void 0&&(n=!1);var i=ur[cr]=(o=ur[cr])!==null&&o!==void 0?o:{version:Ce};if(!n&&i[t]){var s=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(s.stack||s.message),!1}if(i.version!==Ce){var s=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+t+" does not match previously registered API v"+Ce);return r.error(s.stack||s.message),!1}return i[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+Ce+"."),!0}function X(t){var e,r,n=(e=ur[cr])===null||e===void 0?void 0:e.version;if(!(!n||!gs(n)))return(r=ur[cr])===null||r===void 0?void 0:r[t]}function pe(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+Ce+".");var r=ur[cr];r&&delete r[t]}var ad,cr,ur,qe=E(()=>{ms();ho();ys();ad=Ce.split(".")[0],cr=Symbol.for("opentelemetry.js.api."+ad),ur=ps});function dr(t,e,r){var n=X("diag");if(n)return r.unshift(e),n[t].apply(n,ud([],cd(r),!1))}var cd,ud,vs,_s=E(()=>{qe();cd=function(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},ud=function(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))},vs=(function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return dr("verbose",this._namespace,e)},t})()});var q,Fr=E(()=>{(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(q||(q={}))});function bs(t,e){t<q.NONE?t=q.NONE:t>q.ALL&&(t=q.ALL),e=e||{};function r(n,o){var i=e[n];return typeof i=="function"&&t>=o?i.bind(e):function(){}}return{error:r("error",q.ERROR),warn:r("warn",q.WARN),info:r("info",q.INFO),debug:r("debug",q.DEBUG),verbose:r("verbose",q.VERBOSE)}}var Ts=E(()=>{Fr()});var dd,ld,pd,F,Fe=E(()=>{_s();Ts();Fr();qe();dd=function(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},ld=function(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))},pd="diag",F=(function(){function t(){function e(o){return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var a=X("diag");if(a)return a[o].apply(a,ld([],dd(i),!1))}}var r=this,n=function(o,i){var s,a,c;if(i===void 0&&(i={logLevel:q.INFO}),o===r){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=l.stack)!==null&&s!==void 0?s:l.message),!1}typeof i=="number"&&(i={logLevel:i});var p=X("diag"),y=bs((a=i.logLevel)!==null&&a!==void 0?a:q.INFO,o);if(p&&!i.suppressOverrideMessage){var T=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";p.warn("Current logger will be overwritten from "+T),y.warn("Current logger will overwrite one already registered from "+T)}return le("diag",y,r,!0)};r.setLogger=n,r.disable=function(){pe(pd,r)},r.createComponentLogger=function(o){return new vs(o)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t})()});var fd,md,Cs,xs=E(()=>{fd=function(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},md=function(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.")},Cs=(function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=fd(e,2),n=r[0],o=r[1];return[n,o]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=new t(this._entries);try{for(var s=md(n),a=s.next();!a.done;a=s.next()){var c=a.value;i._entries.delete(c)}}catch(l){e={error:l}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return i},t.prototype.clear=function(){return new t},t})()});var Es,Is=E(()=>{Es=Symbol("BaggageEntryMetadata")});function Ss(t){return t===void 0&&(t={}),new Cs(new Map(Object.entries(t)))}function As(t){return typeof t!="string"&&(hd.error("Cannot create baggage metadata from unknown type: "+typeof t),t=""),{__TYPE__:Es,toString:function(){return t}}}var hd,go=E(()=>{Fe();xs();Is();hd=F.instance()});function vt(t){return Symbol.for(t)}var gd,Gr,lr=E(()=>{gd=(function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,o){var i=new t(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=function(n){var o=new t(r._currentContext);return o._currentContext.delete(n),o}}return t})(),Gr=new gd});var yo,ws,Os=E(()=>{yo=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],ws=(function(){function t(){function e(n){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];if(console){var s=console[n];if(typeof s!="function"&&(s=console.log),typeof s=="function")return s.apply(console,o)}}}for(var r=0;r<yo.length;r++)this[yo[r].n]=e(yo[r].c)}return t})()});function Ps(){return _o}var Ge,yd,$r,vd,_d,bd,Td,vo,Cd,xd,Ed,_o,Id,Sd,Ad,wd,Od,Pd,Rd,bo=E(()=>{Ge=(function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),yd=(function(){function t(){}return t.prototype.createGauge=function(e,r){return Sd},t.prototype.createHistogram=function(e,r){return Ad},t.prototype.createCounter=function(e,r){return Id},t.prototype.createUpDownCounter=function(e,r){return wd},t.prototype.createObservableGauge=function(e,r){return Pd},t.prototype.createObservableCounter=function(e,r){return Od},t.prototype.createObservableUpDownCounter=function(e,r){return Rd},t.prototype.addBatchObservableCallback=function(e,r){},t.prototype.removeBatchObservableCallback=function(e){},t})(),$r=(function(){function t(){}return t})(),vd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})($r),_d=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.add=function(r,n){},e})($r),bd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})($r),Td=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.record=function(r,n){},e})($r),vo=(function(){function t(){}return t.prototype.addCallback=function(e){},t.prototype.removeCallback=function(e){},t})(),Cd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),xd=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),Ed=(function(t){Ge(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(vo),_o=new yd,Id=new vd,Sd=new bd,Ad=new Td,wd=new _d,Od=new Cd,Pd=new xd,Rd=new Ed});var Br,Rs=E(()=>{(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Br||(Br={}))});var Hr,Wr,To=E(()=>{Hr={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},Wr={set:function(t,e,r){t!=null&&(t[e]=r)}}});var Nd,kd,Ns,ks=E(()=>{lr();Nd=function(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},kd=function(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))},Ns=(function(){function t(){}return t.prototype.active=function(){return Gr},t.prototype.with=function(e,r,n){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return r.call.apply(r,kd([n],Nd(o),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t})()});var Dd,Ud,Co,Zd,we,pr=E(()=>{ks();qe();Fe();Dd=function(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},Ud=function(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))},Co="context",Zd=new Ns,we=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return le(Co,e,F.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var o,i=[],s=3;s<arguments.length;s++)i[s-3]=arguments[s];return(o=this._getContextManager()).with.apply(o,Ud([e,r,n],Dd(i),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return X(Co)||Zd},t.prototype.disable=function(){this._getContextManager().disable(),pe(Co,F.instance())},t})()});var _t,xo=E(()=>{(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(_t||(_t={}))});var fr,mr,Kr,Yr=E(()=>{xo();fr="0000000000000000",mr="00000000000000000000000000000000",Kr={traceId:mr,spanId:fr,traceFlags:_t.NONE}});var Oe,Xr=E(()=>{Yr();Oe=(function(){function t(e){e===void 0&&(e=Kr),this._spanContext=e}return t.prototype.spanContext=function(){return this._spanContext},t.prototype.setAttribute=function(e,r){return this},t.prototype.setAttributes=function(e){return this},t.prototype.addEvent=function(e,r){return this},t.prototype.addLink=function(e){return this},t.prototype.addLinks=function(e){return this},t.prototype.setStatus=function(e){return this},t.prototype.updateName=function(e){return this},t.prototype.end=function(e){},t.prototype.isRecording=function(){return!1},t.prototype.recordException=function(e,r){},t})()});function Jr(t){return t.getValue(Eo)||void 0}function Ds(){return Jr(we.getInstance().active())}function hr(t,e){return t.setValue(Eo,e)}function Us(t){return t.deleteValue(Eo)}function Zs(t,e){return hr(t,new Oe(e))}function Qr(t){var e;return(e=Jr(t))===null||e===void 0?void 0:e.spanContext()}var Eo,Io=E(()=>{lr();Xr();pr();Eo=vt("OpenTelemetry Context Key SPAN")});function So(t){return jd.test(t)&&t!==mr}function Ao(t){return Md.test(t)&&t!==fr}function bt(t){return So(t.traceId)&&Ao(t.spanId)}function js(t){return new Oe(t)}var jd,Md,en=E(()=>{Yr();Xr();jd=/^([0-9a-f]{32})$/i,Md=/^[0-9a-f]{16}$/i});function Ld(t){return typeof t=="object"&&typeof t.spanId=="string"&&typeof t.traceId=="string"&&typeof t.traceFlags=="number"}var wo,tn,Oo=E(()=>{pr();Io();Xr();en();wo=we.getInstance(),tn=(function(){function t(){}return t.prototype.startSpan=function(e,r,n){n===void 0&&(n=wo.active());var o=!!(r!=null&&r.root);if(o)return new Oe;var i=n&&Qr(n);return Ld(i)&&bt(i)?new Oe(i):new Oe},t.prototype.startActiveSpan=function(e,r,n,o){var i,s,a;if(!(arguments.length<2)){arguments.length===2?a=r:arguments.length===3?(i=r,a=n):(i=r,s=n,a=o);var c=s!=null?s:wo.active(),l=this.startSpan(e,i,c),p=hr(c,l);return wo.with(p,a,void 0,l)}},t})()});var Vd,rn,Po=E(()=>{Oo();Vd=new tn,rn=(function(){function t(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}return t.prototype.startSpan=function(e,r,n){return this._getTracer().startSpan(e,r,n)},t.prototype.startActiveSpan=function(e,r,n,o){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},t.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vd},t})()});var Ms,Ls=E(()=>{Oo();Ms=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){return new tn},t})()});var zd,gr,Ro=E(()=>{Po();Ls();zd=new Ms,gr=(function(){function t(){}return t.prototype.getTracer=function(e,r,n){var o;return(o=this.getDelegateTracer(e,r,n))!==null&&o!==void 0?o:new rn(this,e,r,n)},t.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:zd},t.prototype.setDelegate=function(e){this._delegate=e},t.prototype.getDelegateTracer=function(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,r,n)},t})()});var nn,Vs=E(()=>{(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(nn||(nn={}))});var on,zs=E(()=>{(function(t){t[t.INTERNAL=0]="INTERNAL",t[t.SERVER=1]="SERVER",t[t.CLIENT=2]="CLIENT",t[t.PRODUCER=3]="PRODUCER",t[t.CONSUMER=4]="CONSUMER"})(on||(on={}))});var sn,qs=E(()=>{(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(sn||(sn={}))});function Fs(t){return Gd.test(t)}function Gs(t){return $d.test(t)&&!Bd.test(t)}var No,qd,Fd,Gd,$d,Bd,$s=E(()=>{No="[_0-9a-z-*/]",qd="[a-z]"+No+"{0,255}",Fd="[a-z0-9]"+No+"{0,240}@[a-z]"+No+"{0,13}",Gd=new RegExp("^(?:"+qd+"|"+Fd+")$"),$d=/^[ -~]{0,255}[!-~]$/,Bd=/,|=/});var Bs,Hd,Hs,Ws,Ks,Ys=E(()=>{$s();Bs=32,Hd=512,Hs=",",Ws="=",Ks=(function(){function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,r){var n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n},t.prototype.unset=function(e){var r=this._clone();return r._internalState.delete(e),r},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var e=this;return this._keys().reduce(function(r,n){return r.push(n+Ws+e.get(n)),r},[]).join(Hs)},t.prototype._parse=function(e){e.length>Hd||(this._internalState=e.split(Hs).reverse().reduce(function(r,n){var o=n.trim(),i=o.indexOf(Ws);if(i!==-1){var s=o.slice(0,i),a=o.slice(i+1,n.length);Fs(s)&&Gs(a)&&r.set(s,a)}return r},new Map),this._internalState.size>Bs&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Bs))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})()});function Xs(t){return new Ks(t)}var Js=E(()=>{Ys()});var ko,Qs=E(()=>{pr();ko=we.getInstance()});var Do,ea=E(()=>{Fe();Do=F.instance()});var Wd,ta,ra=E(()=>{bo();Wd=(function(){function t(){}return t.prototype.getMeter=function(e,r,n){return _o},t})(),ta=new Wd});var Uo,na,oa=E(()=>{ra();qe();Fe();Uo="metrics",na=(function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalMeterProvider=function(e){return le(Uo,e,F.instance())},t.prototype.getMeterProvider=function(){return X(Uo)||ta},t.prototype.getMeter=function(e,r,n){return this.getMeterProvider().getMeter(e,r,n)},t.prototype.disable=function(){pe(Uo,F.instance())},t})()});var Zo,ia=E(()=>{oa();Zo=na.getInstance()});var sa,aa=E(()=>{sa=(function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t})()});function Mo(t){return t.getValue(jo)||void 0}function ca(){return Mo(we.getInstance().active())}function ua(t,e){return t.setValue(jo,e)}function da(t){return t.deleteValue(jo)}var jo,la=E(()=>{pr();lr();jo=vt("OpenTelemetry Baggage Key")});var Lo,Kd,pa,fa=E(()=>{qe();aa();To();la();go();Fe();Lo="propagation",Kd=new sa,pa=(function(){function t(){this.createBaggage=Ss,this.getBaggage=Mo,this.getActiveBaggage=ca,this.setBaggage=ua,this.deleteBaggage=da}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return le(Lo,e,F.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=Wr),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=Hr),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){pe(Lo,F.instance())},t.prototype._getGlobalPropagator=function(){return X(Lo)||Kd},t})()});var Vo,ma=E(()=>{fa();Vo=pa.getInstance()});var zo,ha,ga=E(()=>{qe();Ro();en();Io();Fe();zo="trace",ha=(function(){function t(){this._proxyTracerProvider=new gr,this.wrapSpanContext=js,this.isSpanContextValid=bt,this.deleteSpan=Us,this.getSpan=Jr,this.getActiveSpan=Ds,this.getSpanContext=Qr,this.setSpan=hr,this.setSpanContext=Zs}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalTracerProvider=function(e){var r=le(zo,this._proxyTracerProvider,F.instance());return r&&this._proxyTracerProvider.setDelegate(e),r},t.prototype.getTracerProvider=function(){return X(zo)||this._proxyTracerProvider},t.prototype.getTracer=function(e,r){return this.getTracerProvider().getTracer(e,r)},t.prototype.disable=function(){pe(zo,F.instance()),this._proxyTracerProvider=new gr},t})()});var qo,ya=E(()=>{ga();qo=ha.getInstance()});var va={};zi(va,{DiagConsoleLogger:()=>ws,DiagLogLevel:()=>q,INVALID_SPANID:()=>fr,INVALID_SPAN_CONTEXT:()=>Kr,INVALID_TRACEID:()=>mr,ProxyTracer:()=>rn,ProxyTracerProvider:()=>gr,ROOT_CONTEXT:()=>Gr,SamplingDecision:()=>nn,SpanKind:()=>on,SpanStatusCode:()=>sn,TraceFlags:()=>_t,ValueType:()=>Br,baggageEntryMetadataFromString:()=>As,context:()=>ko,createContextKey:()=>vt,createNoopMeter:()=>Ps,createTraceState:()=>Xs,default:()=>Yd,defaultTextMapGetter:()=>Hr,defaultTextMapSetter:()=>Wr,diag:()=>Do,isSpanContextValid:()=>bt,isValidSpanId:()=>Ao,isValidTraceId:()=>So,metrics:()=>Zo,propagation:()=>Vo,trace:()=>qo});var Yd,_a=E(()=>{go();lr();Os();Fr();bo();Rs();To();Po();Ro();Vs();zs();qs();xo();Js();en();Yr();Qs();ea();ia();ma();ya();Yd={context:ko,diag:Do,metrics:Zo,propagation:Vo,trace:qo}});var ba=g(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.SeverityNumber=void 0;var Xd;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TRACE=1]="TRACE",t[t.TRACE2=2]="TRACE2",t[t.TRACE3=3]="TRACE3",t[t.TRACE4=4]="TRACE4",t[t.DEBUG=5]="DEBUG",t[t.DEBUG2=6]="DEBUG2",t[t.DEBUG3=7]="DEBUG3",t[t.DEBUG4=8]="DEBUG4",t[t.INFO=9]="INFO",t[t.INFO2=10]="INFO2",t[t.INFO3=11]="INFO3",t[t.INFO4=12]="INFO4",t[t.WARN=13]="WARN",t[t.WARN2=14]="WARN2",t[t.WARN3=15]="WARN3",t[t.WARN4=16]="WARN4",t[t.ERROR=17]="ERROR",t[t.ERROR2=18]="ERROR2",t[t.ERROR3=19]="ERROR3",t[t.ERROR4=20]="ERROR4",t[t.FATAL=21]="FATAL",t[t.FATAL2=22]="FATAL2",t[t.FATAL3=23]="FATAL3",t[t.FATAL4=24]="FATAL4"})(Xd=yr.SeverityNumber||(yr.SeverityNumber={}))});var cn=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.NOOP_LOGGER=Tt.NoopLogger=void 0;var an=class{emit(e){}};Tt.NoopLogger=an;Tt.NOOP_LOGGER=new an});var Ta=g(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.API_BACKWARDS_COMPATIBILITY_VERSION=fe.makeGetter=fe._global=fe.GLOBAL_LOGS_API_KEY=void 0;fe.GLOBAL_LOGS_API_KEY=Symbol.for("io.opentelemetry.js.api.logs");fe._global=globalThis;function Jd(t,e,r){return n=>n===t?e:r}fe.makeGetter=Jd;fe.API_BACKWARDS_COMPATIBILITY_VERSION=1});var Fo=g(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.NOOP_LOGGER_PROVIDER=Ct.NoopLoggerProvider=void 0;var Qd=cn(),un=class{getLogger(e,r,n){return new Qd.NoopLogger}};Ct.NoopLoggerProvider=un;Ct.NOOP_LOGGER_PROVIDER=new un});var Ca=g(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.ProxyLogger=void 0;var el=cn(),Go=class{constructor(e,r,n,o){this._provider=e,this.name=r,this.version=n,this.options=o}emit(e){this._getLogger().emit(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):el.NOOP_LOGGER}};dn.ProxyLogger=Go});var xa=g(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ProxyLoggerProvider=void 0;var tl=Fo(),rl=Ca(),$o=class{getLogger(e,r,n){var o;return(o=this._getDelegateLogger(e,r,n))!==null&&o!==void 0?o:new rl.ProxyLogger(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:tl.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,n)}};ln.ProxyLoggerProvider=$o});var Ia=g(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.LogsAPI=void 0;var ee=Ta(),nl=Fo(),Ea=xa(),Bo=class t{constructor(){this._proxyLoggerProvider=new Ea.ProxyLoggerProvider}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return ee._global[ee.GLOBAL_LOGS_API_KEY]?this.getLoggerProvider():(ee._global[ee.GLOBAL_LOGS_API_KEY]=(0,ee.makeGetter)(ee.API_BACKWARDS_COMPATIBILITY_VERSION,e,nl.NOOP_LOGGER_PROVIDER),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=ee._global[ee.GLOBAL_LOGS_API_KEY])===null||e===void 0?void 0:e.call(ee._global,ee.API_BACKWARDS_COMPATIBILITY_VERSION))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete ee._global[ee.GLOBAL_LOGS_API_KEY],this._proxyLoggerProvider=new Ea.ProxyLoggerProvider}};pn.LogsAPI=Bo});var Aa=g(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.logs=me.NoopLogger=me.NOOP_LOGGER=me.SeverityNumber=void 0;var ol=ba();Object.defineProperty(me,"SeverityNumber",{enumerable:!0,get:function(){return ol.SeverityNumber}});var Sa=cn();Object.defineProperty(me,"NOOP_LOGGER",{enumerable:!0,get:function(){return Sa.NOOP_LOGGER}});Object.defineProperty(me,"NoopLogger",{enumerable:!0,get:function(){return Sa.NoopLogger}});var il=Ia();me.logs=il.LogsAPI.getInstance()});var $e=g(V=>{"use strict";var xt;Object.defineProperty(V,"__esModule",{value:!0});V.metric=V.trace=V.debug=V.MetricNames=V.SpanNames=V.redactScopes=V.redactUrl=V.redactString=void 0;var sl=us(),Ho=ls();Object.defineProperty(V,"redactString",{enumerable:!0,get:function(){return Ho.redactString}});Object.defineProperty(V,"redactUrl",{enumerable:!0,get:function(){return Ho.redactUrl}});Object.defineProperty(V,"redactScopes",{enumerable:!0,get:function(){return Ho.redactScopes}});xt=(0,sl.index)({otel:()=>(_a(),Fi(va)),logs:()=>Aa()}),V.SpanNames=xt.SpanNames,V.MetricNames=xt.MetricNames,V.debug=xt.debug,V.trace=xt.trace,V.metric=xt.metric});var Tr=g(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var Qo;(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})(Qo||(k.util=Qo={}));var Da;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Da||(k.objectUtil=Da={}));k.ZodParsedType=Qo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var vl=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=vl});var vn=g(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ZodError=Pe.quotelessJson=Pe.ZodIssueCode=void 0;var Ua=Tr();Pe.ZodIssueCode=Ua.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 _l=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Pe.quotelessJson=_l;var Cr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ua.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()}};Pe.ZodError=Cr;Cr.create=t=>new Cr(t)});var ti=g(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var G=vn(),Be=Tr(),bl=(t,e)=>{let r;switch(t.code){case G.ZodIssueCode.invalid_type:t.received===Be.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case G.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Be.util.jsonStringifyReplacer)}`;break;case G.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Be.util.joinValues(t.keys,", ")}`;break;case G.ZodIssueCode.invalid_union:r="Invalid input";break;case G.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Be.util.joinValues(t.options)}`;break;case G.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Be.util.joinValues(t.options)}, received '${t.received}'`;break;case G.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case G.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case G.ZodIssueCode.invalid_date:r="Invalid date";break;case G.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}"`:Be.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case G.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 G.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 G.ZodIssueCode.custom:r="Invalid input";break;case G.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case G.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case G.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Be.util.assertNever(t)}return{message:r}};ei.default=bl});var _n=g(Re=>{"use strict";var Tl=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.defaultErrorMap=void 0;Re.setErrorMap=Cl;Re.getErrorMap=xl;var Za=Tl(ti());Re.defaultErrorMap=Za.default;var ja=Za.default;function Cl(t){ja=t}function xl(){return ja}});var ni=g(R=>{"use strict";var El=R&&R.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0});R.isAsync=R.isValid=R.isDirty=R.isAborted=R.OK=R.DIRTY=R.INVALID=R.ParseStatus=R.EMPTY_PATH=R.makeIssue=void 0;R.addIssueToContext=Al;var Il=_n(),Ma=El(ti()),Sl=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}};R.makeIssue=Sl;R.EMPTY_PATH=[];function Al(t,e){let r=(0,Il.getErrorMap)(),n=(0,R.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ma.default?void 0:Ma.default].filter(o=>!!o)});t.common.issues.push(n)}var ri=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 R.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 R.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}}};R.ParseStatus=ri;R.INVALID=Object.freeze({status:"aborted"});var wl=t=>({status:"dirty",value:t});R.DIRTY=wl;var Ol=t=>({status:"valid",value:t});R.OK=Ol;var Pl=t=>t.status==="aborted";R.isAborted=Pl;var Rl=t=>t.status==="dirty";R.isDirty=Rl;var Nl=t=>t.status==="valid";R.isValid=Nl;var kl=t=>typeof Promise!="undefined"&&t instanceof Promise;R.isAsync=kl});var Va=g(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0})});var qa=g(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.errorUtil=void 0;var za;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(za||(bn.errorUtil=za={}))});var ec=g(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=Ha;u.custom=Ka;var f=vn(),Tn=_n(),v=qa(),d=ni(),m=Tr(),re=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}},Fa=(t,e)=>{if((0,d.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 f.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,p;let{message:c}=t;return s.code==="invalid_enum_value"?{message:c!=null?c:a.defaultError}:typeof a.data=="undefined"?{message:(l=c!=null?c:n)!=null?l:a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:(p=c!=null?c:r)!=null?p: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 d.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,d.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 Fa(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,d.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,d.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,d.isAsync)(o)?o:Promise.resolve(o));return Fa(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:f.ZodIssueCode.custom,...n(o)});return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new J({schema:this,typeName:C.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 te.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return De.create(this,this._def)}or(e){return Qe.create([this,e],this._def)}and(e){return et.create(this,e,this._def)}transform(e){return new J({...S(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new it({...S(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new xr({typeName:C.ZodBranded,type:this,...S(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new st({...S(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Er.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u.ZodType=A;u.Schema=A;u.ZodSchema=A;var Dl=/^c[^\s-]{8,}$/i,Ul=/^[0-9a-z]+$/,Zl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jl=/^[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,Ml=/^[a-z0-9_-]{21}$/i,Ll=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vl=/^[-+]?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)?)??$/,zl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ql="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",oi,Fl=/^(?:(?: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])$/,Gl=/^(?:(?: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])$/,$l=/^(([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]))$/,Bl=/^(([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])$/,Hl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$a="((\\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])))",Kl=new RegExp(`^${$a}$`);function Ba(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 Yl(t){return new RegExp(`^${Ba(t)}$`)}function Ha(t){let e=`${$a}T${Ba(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 Xl(t,e){return!!((e==="v4"||!e)&&Fl.test(t)||(e==="v6"||!e)&&$l.test(t))}function Jl(t,e){if(!Ll.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 Ql(t,e){return!!((e==="v4"||!e)&&Gl.test(t)||(e==="v6"||!e)&&Bl.test(t))}var Ne=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,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.string,received:i.parsedType}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.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,d.addIssueToContext)(o,{code:f.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,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")zl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"email",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")oi||(oi=new RegExp(ql,"u")),oi.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"emoji",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")jl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"uuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ml.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"nanoid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Dl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Ul.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cuid2",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Zl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ulid",code:f.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,d.addIssueToContext)(o,{validation:"url",code:f.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,d.addIssueToContext)(o,{validation:"regex",code:f.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,d.addIssueToContext)(o,{code:f.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,d.addIssueToContext)(o,{code:f.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,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Ha(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Kl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Yl(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Vl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"duration",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Xl(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"ip",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Jl(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"jwt",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Ql(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"cidr",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Hl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64",code:f.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Wl.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{validation:"base64url",code:f.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:f.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(e)})}datetime(e){var r,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(n=e==null?void 0:e.local)!=null?n:!1,...v.errorUtil.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...v.errorUtil.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...v.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...v.errorUtil.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...v.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...v.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...v.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...v.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...v.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,v.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodString=Ne;Ne.create=t=>{var e;return new Ne({checks:[],typeName:C.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};function ep(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 He=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,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.number,received:i.parsedType}),d.INVALID}let n,o=new d.ParseStatus;for(let i of this._def.checks)i.kind==="int"?m.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ep(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.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,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:v.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&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)}};u.ZodNumber=He;He.create=t=>new He({checks:[],typeName:C.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var We=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 d.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,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.bigint,received:r.parsedType}),d.INVALID}gte(e,r){return this.setLimit("min",e,!0,v.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,v.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,v.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,v.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:v.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:v.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};u.ZodBigInt=We;We.create=t=>{var e;return new We({checks:[],typeName:C.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1,...S(t)})};var Ke=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,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.boolean,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodBoolean=Ke;Ke.create=t=>new Ke({typeName:C.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...S(t)});var Ye=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,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.date,received:i.parsedType}),d.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(i,{code:f.ZodIssueCode.invalid_date}),d.INVALID}let n=new d.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,d.addIssueToContext)(o,{code:f.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,d.addIssueToContext)(o,{code:f.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:v.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:v.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};u.ZodDate=Ye;Ye.create=t=>new Ye({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:C.ZodDate,...S(t)});var St=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.symbol,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodSymbol=St;St.create=t=>new St({typeName:C.ZodSymbol,...S(t)});var Xe=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.undefined,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodUndefined=Xe;Xe.create=t=>new Xe({typeName:C.ZodUndefined,...S(t)});var Je=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.null,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodNull=Je;Je.create=t=>new Je({typeName:C.ZodNull,...S(t)});var ke=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodAny=ke;ke.create=t=>new ke({typeName:C.ZodAny,...S(t)});var Ee=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,d.OK)(e.data)}};u.ZodUnknown=Ee;Ee.create=t=>new Ee({typeName:C.ZodUnknown,...S(t)});var ie=class extends A{_parse(e){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.never,received:r.parsedType}),d.INVALID}};u.ZodNever=ie;ie.create=t=>new ie({typeName:C.ZodNever,...S(t)});var At=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.void,received:n.parsedType}),d.INVALID}return(0,d.OK)(e.data)}};u.ZodVoid=At;At.create=t=>new At({typeName:C.ZodVoid,...S(t)});var Ie=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,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:r.parsedType}),d.INVALID;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&((0,d.addIssueToContext)(r,{code:s?f.ZodIssueCode.too_big:f.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,d.addIssueToContext)(r,{code:f.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,d.addIssueToContext)(r,{code:f.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 re(r,s,r.path,a)))).then(s=>d.ParseStatus.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new re(r,s,r.path,a)));return d.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:v.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:v.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};u.ZodArray=Ie;Ie.create=(t,e)=>new Ie({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...S(e)});function It(t){if(t instanceof W){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=te.create(It(n))}return new W({...t._def,shape:()=>e})}else return t instanceof Ie?new Ie({...t._def,type:It(t.element)}):t instanceof te?te.create(It(t.unwrap())):t instanceof ge?ge.create(It(t.unwrap())):t instanceof he?he.create(t.items.map(e=>It(e))):t}var W=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,d.addIssueToContext)(l,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:l.parsedType}),d.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let c=[];for(let l of s){let p=i[l],y=o.data[l];c.push({key:{status:"valid",value:l},value:p._parse(new re(o,y,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof ie){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of a)c.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(l==="strict")a.length>0&&((0,d.addIssueToContext)(o,{code:f.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 p of a){let y=o.data[p];c.push({key:{status:"valid",value:p},value:l._parse(new re(o,y,o.path,p)),alwaysSet:p in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of c){let y=await p.key,T=await p.value;l.push({key:y,value:T,alwaysSet:p.alwaysSet})}return l}).then(l=>d.ParseStatus.mergeObjectSync(n,l)):d.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return v.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s,a,c;let o=(a=(s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)!=null?a:n.defaultError;return r.code==="unrecognized_keys"?{message:(c=v.errorUtil.errToObj(e).message)!=null?c:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.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 It(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 te;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Wa(m.util.objectKeys(this.shape))}};u.ZodObject=W;W.create=(t,e)=>new W({shape:()=>t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...S(e)});W.strictCreate=(t,e)=>new W({shape:()=>t,unknownKeys:"strict",catchall:ie.create(),typeName:C.ZodObject,...S(e)});W.lazycreate=(t,e)=>new W({shape:t,unknownKeys:"strip",catchall:ie.create(),typeName:C.ZodObject,...S(e)});var Qe=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 f.ZodError(a.ctx.common.issues));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:s}),d.INVALID}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},p=c._parseSync({data:r.data,path:r.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,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(c=>new f.ZodError(c));return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union,unionErrors:a}),d.INVALID}}get options(){return this._def.options}};u.ZodUnion=Qe;Qe.create=(t,e)=>new Qe({options:t,typeName:C.ZodUnion,...S(e)});var xe=t=>t instanceof tt?xe(t.schema):t instanceof J?xe(t.innerType()):t instanceof rt?[t.value]:t instanceof nt?t.options:t instanceof ot?m.util.objectValues(t.enum):t instanceof it?xe(t._def.innerType):t instanceof Xe?[void 0]:t instanceof Je?[null]:t instanceof te?[void 0,...xe(t.unwrap())]:t instanceof ge?[null,...xe(t.unwrap())]:t instanceof xr||t instanceof at?xe(t.unwrap()):t instanceof st?xe(t._def.innerType):[],Cn=class t extends A{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==m.ZodParsedType.object)return(0,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:r.parsedType}),d.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,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),d.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=xe(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:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...S(n)})}};u.ZodDiscriminatedUnion=Cn;function ii(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 c=ii(t[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.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],c=ii(s,a);if(!c.valid)return{valid:!1};o.push(c.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 et=class extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,s)=>{if((0,d.isAborted)(i)||(0,d.isAborted)(s))return d.INVALID;let a=ii(i.value,s.value);return a.valid?(((0,d.isDirty)(i)||(0,d.isDirty)(s))&&r.dirty(),{status:r.value,value:a.data}):((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_intersection_types}),d.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}))}};u.ZodIntersection=et;et.create=(t,e,r)=>new et({left:t,right:e,typeName:C.ZodIntersection,...S(r)});var he=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.array)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.array,received:n.parsedType}),d.INVALID;if(n.data.length<this._def.items.length)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),d.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new re(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>d.ParseStatus.mergeArray(r,s)):d.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};u.ZodTuple=he;he.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new he({items:t,typeName:C.ZodTuple,rest:null,...S(e)})};var xn=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,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.object,received:n.parsedType}),d.INVALID;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new re(n,a,n.path,a)),value:s._parse(new re(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?d.ParseStatus.mergeObjectAsync(r,o):d.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:C.ZodRecord,...S(n)}):new t({keyType:Ne.create(),valueType:e,typeName:C.ZodRecord,...S(r)})}};u.ZodRecord=xn;var wt=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,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.map,received:n.parsedType}),d.INVALID;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],l)=>({key:o._parse(new re(n,a,n.path,[l,"key"])),value:i._parse(new re(n,c,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let l=await c.key,p=await c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let l=c.key,p=c.value;if(l.status==="aborted"||p.status==="aborted")return d.INVALID;(l.status==="dirty"||p.status==="dirty")&&r.dirty(),a.set(l.value,p.value)}return{status:r.value,value:a}}}};u.ZodMap=wt;wt.create=(t,e,r)=>new wt({valueType:e,keyType:t,typeName:C.ZodMap,...S(r)});var Ot=class t extends A{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.ZodParsedType.set)return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.set,received:n.parsedType}),d.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,d.addIssueToContext)(n,{code:f.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,d.addIssueToContext)(n,{code:f.ZodIssueCode.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let l=new Set;for(let p of c){if(p.status==="aborted")return d.INVALID;p.status==="dirty"&&r.dirty(),l.add(p.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((c,l)=>i._parse(new re(n,c,n.path,l)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:v.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:v.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};u.ZodSet=Ot;Ot.create=(t,e)=>new Ot({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...S(e)});var En=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,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.function,received:r.parsedType}),d.INVALID;function n(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Tn.getErrorMap)(),Tn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_arguments,argumentsError:c}})}function o(a,c){return(0,d.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,Tn.getErrorMap)(),Tn.defaultErrorMap].filter(l=>!!l),issueData:{code:f.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof De){let a=this;return(0,d.OK)(async function(...c){let l=new f.ZodError([]),p=await a._def.args.parseAsync(c,i).catch(I=>{throw l.addIssue(n(c,I)),l}),y=await Reflect.apply(s,this,p);return await a._def.returns._def.type.parseAsync(y,i).catch(I=>{throw l.addIssue(o(y,I)),l})})}else{let a=this;return(0,d.OK)(function(...c){let l=a._def.args.safeParse(c,i);if(!l.success)throw new f.ZodError([n(c,l.error)]);let p=Reflect.apply(s,this,l.data),y=a._def.returns.safeParse(p,i);if(!y.success)throw new f.ZodError([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:he.create(e).rest(Ee.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||he.create([]).rest(Ee.create()),returns:r||Ee.create(),typeName:C.ZodFunction,...S(n)})}};u.ZodFunction=En;var tt=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})}};u.ZodLazy=tt;tt.create=(t,e)=>new tt({getter:t,typeName:C.ZodLazy,...S(e)});var rt=class extends A{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_literal,expected:this._def.value}),d.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};u.ZodLiteral=rt;rt.create=(t,e)=>new rt({value:t,typeName:C.ZodLiteral,...S(e)});function Wa(t,e){return new nt({values:t,typeName:C.ZodEnum,...S(e)})}var nt=class t extends A{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,d.addIssueToContext)(r,{expected:m.util.joinValues(n),received:r.parsedType,code:f.ZodIssueCode.invalid_type}),d.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,d.addIssueToContext)(r,{received:r.data,code:f.ZodIssueCode.invalid_enum_value,options:n}),d.INVALID}return(0,d.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})}};u.ZodEnum=nt;nt.create=Wa;var ot=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,d.addIssueToContext)(n,{expected:m.util.joinValues(o),received:n.parsedType,code:f.ZodIssueCode.invalid_type}),d.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,d.addIssueToContext)(n,{received:n.data,code:f.ZodIssueCode.invalid_enum_value,options:o}),d.INVALID}return(0,d.OK)(e.data)}get enum(){return this._def.values}};u.ZodNativeEnum=ot;ot.create=(t,e)=>new ot({values:t,typeName:C.ZodNativeEnum,...S(e)});var De=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,d.addIssueToContext)(r,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.promise,received:r.parsedType}),d.INVALID;let n=r.parsedType===m.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,d.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};u.ZodPromise=De;De.create=(t,e)=>new De({type:t,typeName:C.ZodPromise,...S(e)});var J=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.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,d.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 d.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?d.INVALID:c.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(c.value):c});{if(r.value==="aborted")return d.INVALID;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?d.INVALID:a.status==="dirty"||r.value==="dirty"?(0,d.DIRTY)(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?d.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"?d.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,d.isValid)(s))return d.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,d.isValid)(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):d.INVALID);m.util.assertNever(o)}};u.ZodEffects=J;u.ZodTransformer=J;J.create=(t,e,r)=>new J({schema:t,typeName:C.ZodEffects,effect:e,...S(r)});J.createWithPreprocess=(t,e,r)=>new J({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...S(r)});var te=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.undefined?(0,d.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodOptional=te;te.create=(t,e)=>new te({innerType:t,typeName:C.ZodOptional,...S(e)});var ge=class extends A{_parse(e){return this._getType(e)===m.ZodParsedType.null?(0,d.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u.ZodNullable=ge;ge.create=(t,e)=>new ge({innerType:t,typeName:C.ZodNullable,...S(e)});var it=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}};u.ZodDefault=it;it.create=(t,e)=>new it({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});var st=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,d.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new f.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};u.ZodCatch=st;st.create=(t,e)=>new st({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});var Pt=class extends A{_parse(e){if(this._getType(e)!==m.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,d.addIssueToContext)(n,{code:f.ZodIssueCode.invalid_type,expected:m.ZodParsedType.nan,received:n.parsedType}),d.INVALID}return{status:"valid",value:e.data}}};u.ZodNaN=Pt;Pt.create=t=>new Pt({typeName:C.ZodNaN,...S(t)});u.BRAND=Symbol("zod_brand");var xr=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}};u.ZodBranded=xr;var Er=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"?d.INVALID:i.status==="dirty"?(r.dirty(),(0,d.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"?d.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:C.ZodPipeline})}};u.ZodPipeline=Er;var at=class extends A{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,d.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,d.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};u.ZodReadonly=at;at.create=(t,e)=>new at({innerType:t,typeName:C.ZodReadonly,...S(e)});function Ga(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Ka(t,e={},r){return t?ke.create().superRefine((n,o)=>{var s,a;let i=t(n);if(i instanceof Promise)return i.then(c=>{var l,p;if(!c){let y=Ga(e,n),T=(p=(l=y.fatal)!=null?l:r)!=null?p:!0;o.addIssue({code:"custom",...y,fatal:T})}});if(!i){let c=Ga(e,n),l=(a=(s=c.fatal)!=null?s:r)!=null?a:!0;o.addIssue({code:"custom",...c,fatal:l})}}):ke.create()}u.late={object:W.lazycreate};var C;(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"})(C||(u.ZodFirstPartyTypeKind=C={}));var tp=(t,e={message:`Input not instance of ${t.name}`})=>Ka(r=>r instanceof t,e);u.instanceof=tp;var Ya=Ne.create;u.string=Ya;var Xa=He.create;u.number=Xa;var rp=Pt.create;u.nan=rp;var np=We.create;u.bigint=np;var Ja=Ke.create;u.boolean=Ja;var op=Ye.create;u.date=op;var ip=St.create;u.symbol=ip;var sp=Xe.create;u.undefined=sp;var ap=Je.create;u.null=ap;var cp=ke.create;u.any=cp;var up=Ee.create;u.unknown=up;var dp=ie.create;u.never=dp;var lp=At.create;u.void=lp;var pp=Ie.create;u.array=pp;var fp=W.create;u.object=fp;var mp=W.strictCreate;u.strictObject=mp;var hp=Qe.create;u.union=hp;var gp=Cn.create;u.discriminatedUnion=gp;var yp=et.create;u.intersection=yp;var vp=he.create;u.tuple=vp;var _p=xn.create;u.record=_p;var bp=wt.create;u.map=bp;var Tp=Ot.create;u.set=Tp;var Cp=En.create;u.function=Cp;var xp=tt.create;u.lazy=xp;var Ep=rt.create;u.literal=Ep;var Ip=nt.create;u.enum=Ip;var Sp=ot.create;u.nativeEnum=Sp;var Ap=De.create;u.promise=Ap;var Qa=J.create;u.effect=Qa;u.transformer=Qa;var wp=te.create;u.optional=wp;var Op=ge.create;u.nullable=Op;var Pp=J.createWithPreprocess;u.preprocess=Pp;var Rp=Er.create;u.pipeline=Rp;var Np=()=>Ya().optional();u.ostring=Np;var kp=()=>Xa().optional();u.onumber=kp;var Dp=()=>Ja().optional();u.oboolean=Dp;u.coerce={string:(t=>Ne.create({...t,coerce:!0})),number:(t=>He.create({...t,coerce:!0})),boolean:(t=>Ke.create({...t,coerce:!0})),bigint:(t=>We.create({...t,coerce:!0})),date:(t=>Ye.create({...t,coerce:!0}))};u.NEVER=d.INVALID});var si=g(ne=>{"use strict";var Up=ne&&ne.__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]})),Rt=ne&&ne.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Up(e,t,r)};Object.defineProperty(ne,"__esModule",{value:!0});Rt(_n(),ne);Rt(ni(),ne);Rt(Va(),ne);Rt(Tr(),ne);Rt(ec(),ne);Rt(vn(),ne)});var D=g(K=>{"use strict";var tc=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]})),Zp=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),jp=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)&&tc(e,t,r);return Zp(e,t),e},Mp=K&&K.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tc(e,t,r)};Object.defineProperty(K,"__esModule",{value:!0});K.z=void 0;var rc=jp(si());K.z=rc;Mp(si(),K);K.default=rc});var ai=g(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.actionTypesZodSchema=Nt.ActionTypes=void 0;var Lp=D(),nc;(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"})(nc||(Nt.ActionTypes=nc={}));Nt.actionTypesZodSchema=Lp.z.enum(["openUrl","imBack","postBack","playAudio","showImage","downloadFile","signin","call","messageBack","openApp"])});var ci=g(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.semanticActionStateTypesZodSchema=kt.SemanticActionStateTypes=void 0;var Vp=D(),oc;(function(t){t.Start="start",t.Continue="continue",t.Done="done"})(oc||(kt.SemanticActionStateTypes=oc={}));kt.semanticActionStateTypesZodSchema=Vp.z.enum(["start","continue","done"])});var ui=g(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.attachmentLayoutTypesZodSchema=Dt.AttachmentLayoutTypes=void 0;var zp=D(),ic;(function(t){t.List="list",t.Carousel="carousel"})(ic||(Dt.AttachmentLayoutTypes=ic={}));Dt.attachmentLayoutTypesZodSchema=zp.z.enum(["list","carousel"])});var di=g(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.Channels=void 0;var sc;(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"})(sc||(In.Channels=sc={}))});var li=g(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.endOfConversationCodesZodSchema=Ut.EndOfConversationCodes=void 0;var qp=D(),ac;(function(t){t.Unknown="unknown",t.CompletedSuccessfully="completedSuccessfully",t.UserCancelled="userCancelled",t.AgentTimedOut="agentTimedOut",t.AgentIssuedInvalidMessage="agentIssuedInvalidMessage",t.ChannelFailed="channelFailed"})(ac||(Ut.EndOfConversationCodes=ac={}));Ut.endOfConversationCodesZodSchema=qp.z.enum(["unknown","completedSuccessfully","userCancelled","agentTimedOut","agentIssuedInvalidMessage","channelFailed"])});var uc=g(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.MembershipSourceTypes=void 0;var cc;(function(t){t.Channel="channel",t.Team="team"})(cc||(Sn.MembershipSourceTypes=cc={}))});var lc=g(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.MembershipTypes=void 0;var dc;(function(t){t.Direct="direct",t.Transitive="transitive"})(dc||(An.MembershipTypes=dc={}))});var Ir=g(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.roleTypeZodSchema=Zt.RoleTypes=void 0;var Fp=D(),pc;(function(t){t.User="user",t.Agent="bot",t.Skill="skill",t.AgenticIdentity="agenticAppInstance",t.AgenticUser="agenticUser"})(pc||(Zt.RoleTypes=pc={}));Zt.roleTypeZodSchema=Fp.z.enum(["user","bot","skill","agenticAppInstance","agenticUser"])});var fc=g(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.addAIToActivity=jt.ClientCitationIconName=void 0;jt.ClientCitationIconName={MicrosoftWord:"Microsoft Word",MicrosoftExcel:"Microsoft Excel",MicrosoftPowerPoint:"Microsoft PowerPoint",MicrosoftOneNote:"Microsoft OneNote",MicrosoftSharePoint:"Microsoft SharePoint",MicrosoftVisio:"Microsoft Visio",MicrosoftLoop:"Microsoft Loop",MicrosoftWhiteboard:"Microsoft Whiteboard",AdobeIllustrator:"Adobe Illustrator",AdobePhotoshop:"Adobe Photoshop",AdobeInDesign:"Adobe InDesign",AdobeFlash:"Adobe Flash",Sketch:"Sketch",SourceCode:"Source Code",Image:"Image",GIF:"GIF",Video:"Video",Sound:"Sound",ZIP:"ZIP",Text:"Text",PDF:"PDF"};var Gp=(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)};jt.addAIToActivity=Gp});var mc=g(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.adaptiveCardInvokeActionZodSchema=void 0;var ct=D();wn.adaptiveCardInvokeActionZodSchema=ct.z.object({type:ct.z.string().min(1),id:ct.z.string().optional(),verb:ct.z.string().min(1),data:ct.z.record(ct.z.string().min(1),ct.z.any())})});var hc={};zi(hc,{randomUUID:()=>$p});function $p(){return globalThis.crypto.randomUUID()}var gc=E(()=>{"use strict"});var pi=g(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.entityZodSchema=void 0;var yc=D();On.entityZodSchema=yc.z.object({type:yc.z.string().min(1)}).passthrough()});var vc=g(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.semanticActionZodSchema=void 0;var Sr=D(),Bp=pi(),Hp=ci();Pn.semanticActionZodSchema=Sr.z.object({id:Sr.z.string().min(1),state:Sr.z.union([Hp.semanticActionStateTypesZodSchema,Sr.z.string().min(1)]),entities:Sr.z.record(Bp.entityZodSchema)})});var _c=g(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.cardActionZodSchema=void 0;var ye=D(),Wp=ai();Rn.cardActionZodSchema=ye.z.object({type:ye.z.union([Wp.actionTypesZodSchema,ye.z.string().min(1)]),title:ye.z.string().min(1),image:ye.z.string().min(1).optional(),text:ye.z.string().min(1).optional(),displayText:ye.z.string().min(1).optional(),value:ye.z.any().optional(),channelData:ye.z.unknown().optional(),imageAltText:ye.z.string().min(1).optional()})});var bc=g(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.suggestedActionsZodSchema=void 0;var Nn=D(),Kp=_c();kn.suggestedActionsZodSchema=Nn.z.object({to:Nn.z.array(Nn.z.string().min(1)),actions:Nn.z.array(Kp.cardActionZodSchema)})});var fi=g(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.activityEventNamesZodSchema=Mt.ActivityEventNames=void 0;var Yp=D(),Tc;(function(t){t.ContinueConversation="ContinueConversation",t.CreateConversation="CreateConversation"})(Tc||(Mt.ActivityEventNames=Tc={}));Mt.activityEventNamesZodSchema=Yp.z.enum(["ContinueConversation","CreateConversation"])});var mi=g(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.activityImportanceZodSchema=Lt.ActivityImportance=void 0;var Xp=D(),Cc;(function(t){t.Low="low",t.Normal="normal",t.High="high"})(Cc||(Lt.ActivityImportance=Cc={}));Lt.activityImportanceZodSchema=Xp.z.enum(["low","normal","high"])});var hi=g(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.activityTypesZodSchema=Vt.ActivityTypes=void 0;var Jp=D(),xc;(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"})(xc||(Vt.ActivityTypes=xc={}));Vt.activityTypesZodSchema=Jp.z.enum(["message","contactRelationUpdate","conversationUpdate","typing","endOfConversation","event","invoke","invokeResponse","deleteUserData","messageUpdate","messageDelete","installationUpdate","messageReaction","suggestion","trace","handoff","command","commandResult"])});var Ec=g(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.attachmentZodSchema=void 0;var zt=D();Dn.attachmentZodSchema=zt.z.object({contentType:zt.z.string().min(1),contentUrl:zt.z.string().min(1).optional(),content:zt.z.unknown().optional(),name:zt.z.string().min(1).optional(),thumbnailUrl:zt.z.string().min(1).optional()})});var Ic=g(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.addProductInfoToActivity=ut.clearProductInfoFromActivity=void 0;var Qp=t=>{t&&t.entities&&t.entities.length&&(t.entities=t.entities.filter(e=>e.type!=="ProductInfo"))};ut.clearProductInfoFromActivity=Qp;var ef=(t,e)=>{var r,n;let o={type:"ProductInfo",id:e};(r=t.entities)!==null&&r!==void 0||(t.entities=[]),(0,ut.clearProductInfoFromActivity)(t),(n=t.entities)===null||n===void 0||n.push(o)};ut.addProductInfoToActivity=ef});var gi=g(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.channelAccountZodSchema=void 0;var se=D(),tf=Ir();Un.channelAccountZodSchema=se.z.object({id:se.z.string().min(1).optional(),name:se.z.string().optional(),aadObjectId:se.z.string().min(1).optional(),tenantId:se.z.string().min(1).optional(),agenticUserId:se.z.string().min(1).optional(),agenticAppId:se.z.string().min(1).optional(),agenticAppBlueprintId:se.z.string().min(1).optional(),role:se.z.union([tf.roleTypeZodSchema,se.z.string().min(1)]).optional(),properties:se.z.unknown().optional()})});var yi=g(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.conversationAccountZodSchema=void 0;var ve=D(),rf=Ir();Zn.conversationAccountZodSchema=ve.z.object({isGroup:ve.z.boolean().optional(),conversationType:ve.z.string().min(1).optional(),tenantId:ve.z.string().min(1).optional(),id:ve.z.string().min(1),name:ve.z.string().min(1).optional(),aadObjectId:ve.z.string().min(1).optional(),role:ve.z.union([rf.roleTypeZodSchema,ve.z.string().min(1)]).optional(),properties:ve.z.unknown().optional()})});var Ac=g(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.conversationReferenceZodSchema=void 0;var Ar=D(),Sc=gi(),nf=yi();jn.conversationReferenceZodSchema=Ar.z.object({activityId:Ar.z.string().min(1).optional(),user:Sc.channelAccountZodSchema.optional(),locale:Ar.z.string().min(1).optional(),agent:Sc.channelAccountZodSchema.optional().nullable(),conversation:nf.conversationAccountZodSchema,channelId:Ar.z.string().min(1),serviceUrl:Ar.z.string().min(1).optional()})});var vi=g(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.deliveryModesZodSchema=qt.DeliveryModes=void 0;var of=D(),wc;(function(t){t.Normal="normal",t.Notification="notification",t.ExpectReplies="expectReplies",t.Ephemeral="ephemeral"})(wc||(qt.DeliveryModes=wc={}));qt.deliveryModesZodSchema=of.z.enum(["normal","notification","expectReplies","ephemeral"])});var _i=g(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.inputHintsZodSchema=Ft.InputHints=void 0;var sf=D(),Oc;(function(t){t.AcceptingInput="acceptingInput",t.IgnoringInput="ignoringInput",t.ExpectingInput="expectingInput"})(Oc||(Ft.InputHints=Oc={}));Ft.inputHintsZodSchema=sf.z.enum(["acceptingInput","ignoringInput","expectingInput"])});var bi=g(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.messageReactionTypesZodSchema=Gt.MessageReactionTypes=void 0;var af=D(),Pc;(function(t){t.Like="like",t.PlusOne="plusOne"})(Pc||(Gt.MessageReactionTypes=Pc={}));Gt.messageReactionTypesZodSchema=af.z.enum(["like","plusOne"])});var Rc=g(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.messageReactionZodSchema=void 0;var Ti=D(),cf=bi();Mn.messageReactionZodSchema=Ti.z.object({type:Ti.z.union([cf.messageReactionTypesZodSchema,Ti.z.string().min(1)])})});var Ci=g($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.textFormatTypesZodSchema=$t.TextFormatTypes=void 0;var uf=D(),Nc;(function(t){t.Markdown="markdown",t.Plain="plain",t.Xml="xml"})(Nc||($t.TextFormatTypes=Nc={}));$t.textFormatTypesZodSchema=uf.z.enum(["markdown","plain","xml"])});var kc=g(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.textHighlightZodSchema=void 0;var xi=D();Ln.textHighlightZodSchema=xi.z.object({text:xi.z.string().min(1),occurrence:xi.z.number()})});var Ei=g(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.ExceptionHelper=void 0;var Vn=class t{static generateException(e,r,n,o){var i;let s=r.description;o&&Object.keys(o).forEach(y=>{s=s.replace(`{${y}}`,o[y])});let c=((i=r.helplink)!==null&&i!==void 0?i:t.DEFAULT_HELPLINK).replace("{errorCode}",r.code.toString()),l=`[${r.code}] - ${s} - ${c}`,p=new e(l);return p.code=r.code,p.helpLink=c,n&&(p.innerException=n),p}};zn.ExceptionHelper=Vn;Vn.DEFAULT_HELPLINK="https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"});var Ii=g(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.Errors=void 0;qn.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"},TargetedActivityIsGroupOnly:{code:-110008,description:"Targeted activities can only be sent in a group chat or channel."}}});var Si=g(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ActivityTreatments=void 0;var Dc;(function(t){t.Targeted="targeted"})(Dc||(Fn.ActivityTreatments=Dc={}))});var zc=g(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.Activity=dt.activityZodSchema=void 0;var df=(gc(),Fi(hc)),_=D(),lf=vc(),pf=bc(),Vc=fi(),ff=mi(),$n=hi(),mf=Ec(),hf=ui(),Uc=Ic(),Gn=gi(),Zc=di(),gf=yi(),yf=Ac(),vf=li(),_f=vi(),bf=pi(),Tf=_i(),jc=Rc(),Cf=Ci(),xf=kc(),Mc=Ir(),Se=Ei(),Ae=Ii(),Lc=Si();dt.activityZodSchema=_.z.object({type:_.z.union([$n.activityTypesZodSchema,_.z.string().min(1)]),text:_.z.string().optional(),id:_.z.string().min(1).optional(),channelId:_.z.string().min(1).optional(),from:Gn.channelAccountZodSchema.optional(),timestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimestamp:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),localTimezone:_.z.string().min(1).optional(),callerId:_.z.string().min(1).optional(),serviceUrl:_.z.string().min(1).optional(),conversation:gf.conversationAccountZodSchema.optional(),recipient:Gn.channelAccountZodSchema.optional(),textFormat:_.z.union([Cf.textFormatTypesZodSchema,_.z.string().min(1)]).optional(),attachmentLayout:_.z.union([hf.attachmentLayoutTypesZodSchema,_.z.string().min(1)]).optional(),membersAdded:_.z.array(Gn.channelAccountZodSchema).optional(),membersRemoved:_.z.array(Gn.channelAccountZodSchema).optional(),reactionsAdded:_.z.array(jc.messageReactionZodSchema).optional(),reactionsRemoved:_.z.array(jc.messageReactionZodSchema).optional(),topicName:_.z.string().min(1).optional(),historyDisclosed:_.z.boolean().optional(),locale:_.z.string().min(1).optional(),speak:_.z.string().min(1).optional(),inputHint:_.z.union([Tf.inputHintsZodSchema,_.z.string().min(1)]).optional(),summary:_.z.string().min(1).optional(),suggestedActions:pf.suggestedActionsZodSchema.optional(),attachments:_.z.array(mf.attachmentZodSchema).optional(),entities:_.z.array(bf.entityZodSchema.passthrough()).optional(),channelData:_.z.any().optional(),action:_.z.string().min(1).optional(),replyToId:_.z.string().min(1).optional(),label:_.z.string().min(1).optional(),valueType:_.z.string().min(1).optional(),value:_.z.unknown().optional(),name:_.z.union([Vc.activityEventNamesZodSchema,_.z.string().min(1)]).optional(),relatesTo:yf.conversationReferenceZodSchema.optional(),code:_.z.union([vf.endOfConversationCodesZodSchema,_.z.string().min(1)]).optional(),expiration:_.z.union([_.z.date(),_.z.string().min(1).transform(t=>new Date(t))]).optional(),importance:_.z.union([ff.activityImportanceZodSchema,_.z.string().min(1)]).optional(),deliveryMode:_.z.union([_f.deliveryModesZodSchema,_.z.string().min(1)]).optional(),listenFor:_.z.array(_.z.string().min(1)).optional(),textHighlights:_.z.array(xf.textHighlightZodSchema).optional(),semanticAction:lf.semanticActionZodSchema.optional()});var Ai=class t{constructor(e){if(e===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeUndefined);if(e===null)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeNull);if(typeof e=="string"&&e.length===0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidActivityTypeEmptyString);this.type=e}static fromJson(e){return this.fromObject(JSON.parse(e))}static fromObject(e){let r=dt.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 Se.ExceptionHelper.generateException(Error,Ae.Errors.InvalidChannelIdFormat,void 0,{channelId:e});this._channelId=r,n?(0,Uc.addProductInfoToActivity)(this,n):(0,Uc.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 Se.ExceptionHelper.generateException(Error,Ae.Errors.PrimaryChannelNotSet);this.channelId=`${this._channelId}${e?`:${e}`:""}`}static getContinuationActivity(e){var r;let n={type:$n.ActivityTypes.Event,name:Vc.ActivityEventNames.ContinueConversation,id:(r=e.activityId)!==null&&r!==void 0?r:(0,df.randomUUID)(),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!==$n.ActivityTypes.ConversationUpdate||this.channelId!==Zc.Channels.Directline&&this.channelId!==Zc.Channels.Webchat)return this.id}getConversationReference(e){var r;if(this.recipient===null||this.recipient===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityRecipientUndefined);if(this.conversation===null||this.conversation===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityConversationUndefined);if(this.channelId===null||this.channelId===void 0)throw Se.ExceptionHelper.generateException(Error,Ae.Errors.ActivityChannelIdUndefined);let n=e!=null&&e.forceBaseChannel?(r=this.channelIdChannel)!==null&&r!==void 0?r:this.channelId:this.channelId;return{activityId:this.getAppropriateReplyToId(),user:this.from,agent:this.recipient,conversation:this.conversation,channelId:n,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===$n.ActivityTypes.Message&&(e&&(this.removeRecipientMention(),this.entities!==void 0&&(!((r=this.recipient)===null||r===void 0)&&r.id)&&(this.entities=this.entities.filter(o=>{var i;return o.type.toLowerCase()==="mention"?o.mentioned.id!==((i=this.recipient)===null||i===void 0?void 0:i.id):!0}))),this.text&&(this.text=t.removeAt(this.text)),this.entities!==void 0)){let o=this.getMentions(this);for(let i of o)i.text&&(i.text=(n=t.removeAt(i.text))===null||n===void 0?void 0:n.trim())}}static removeAt(e){if(!e)return e;let r;do{r=!1;let n=e.toLowerCase().indexOf("<at");if(n>=0){let o=e.indexOf(">",n);if(o>0){let i=e.toLowerCase().indexOf("</at>",o);if(i>0){let s=e.substring(i+5);s.length>0&&!/\s/.test(s[0])&&(s=` ${s}`),e=e.substring(0,i)+s;let a=e.substring(o+1,i),c=e.substring(0,n);c.length>0&&!/\s$/.test(c)&&(c+=" "),e=c+a+s,r=!0}}}}while(r);return e}removeMentionText(e){let n=this.getMentions(this).filter(o=>o.mentioned.id===e);return n.length>0&&this.text&&(this.text=this.text.replace(n[0].text,"").trim()),this.text||""}removeRecipientMention(){return this.recipient!=null&&this.recipient.id?this.removeMentionText(this.recipient.id):""}isTargetedActivity(){var e;return!((e=this.entities)===null||e===void 0)&&e.length?this.entities.some(r=>r.type==="activityTreatment"&&r.treatment===Lc.ActivityTreatments.Targeted):!1}makeTargetedActivity(){var e,r;if(!(!((e=this.conversation)===null||e===void 0)&&e.isGroup))throw Se.ExceptionHelper.generateException(Error,Ae.Errors.TargetedActivityIsGroupOnly);this.isTargetedActivity()||((r=this.entities)!==null&&r!==void 0||(this.entities=[]),this.entities.push({type:"activityTreatment",treatment:Lc.ActivityTreatments.Targeted}))}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()===Mc.RoleTypes.AgenticUser.toLowerCase()||this.recipient.role.toLowerCase()===Mc.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}};dt.Activity=Ai});var Bn=g(x=>{"use strict";var Ef=x&&x.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),qc=x&&x.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ef(e,t,r)};Object.defineProperty(x,"__esModule",{value:!0});x.ActivityErrors=x.ExceptionHelper=x.ActivityTreatments=x.TextFormatTypes=x.MessageReactionTypes=x.InputHints=x.DeliveryModes=x.ActivityTypes=x.ActivityImportance=x.ActivityEventNames=x.activityZodSchema=x.Activity=x.RoleTypes=x.MembershipTypes=x.MembershipSourceTypes=x.EndOfConversationCodes=x.Channels=x.AttachmentLayoutTypes=x.SemanticActionStateTypes=x.ActionTypes=void 0;var If=ai();Object.defineProperty(x,"ActionTypes",{enumerable:!0,get:function(){return If.ActionTypes}});var Sf=ci();Object.defineProperty(x,"SemanticActionStateTypes",{enumerable:!0,get:function(){return Sf.SemanticActionStateTypes}});var Af=ui();Object.defineProperty(x,"AttachmentLayoutTypes",{enumerable:!0,get:function(){return Af.AttachmentLayoutTypes}});var wf=di();Object.defineProperty(x,"Channels",{enumerable:!0,get:function(){return wf.Channels}});var Of=li();Object.defineProperty(x,"EndOfConversationCodes",{enumerable:!0,get:function(){return Of.EndOfConversationCodes}});var Pf=uc();Object.defineProperty(x,"MembershipSourceTypes",{enumerable:!0,get:function(){return Pf.MembershipSourceTypes}});var Rf=lc();Object.defineProperty(x,"MembershipTypes",{enumerable:!0,get:function(){return Rf.MembershipTypes}});var Nf=Ir();Object.defineProperty(x,"RoleTypes",{enumerable:!0,get:function(){return Nf.RoleTypes}});qc(fc(),x);qc(mc(),x);var Fc=zc();Object.defineProperty(x,"Activity",{enumerable:!0,get:function(){return Fc.Activity}});Object.defineProperty(x,"activityZodSchema",{enumerable:!0,get:function(){return Fc.activityZodSchema}});var kf=fi();Object.defineProperty(x,"ActivityEventNames",{enumerable:!0,get:function(){return kf.ActivityEventNames}});var Df=mi();Object.defineProperty(x,"ActivityImportance",{enumerable:!0,get:function(){return Df.ActivityImportance}});var Uf=hi();Object.defineProperty(x,"ActivityTypes",{enumerable:!0,get:function(){return Uf.ActivityTypes}});var Zf=vi();Object.defineProperty(x,"DeliveryModes",{enumerable:!0,get:function(){return Zf.DeliveryModes}});var jf=_i();Object.defineProperty(x,"InputHints",{enumerable:!0,get:function(){return jf.InputHints}});var Mf=bi();Object.defineProperty(x,"MessageReactionTypes",{enumerable:!0,get:function(){return Mf.MessageReactionTypes}});var Lf=Ci();Object.defineProperty(x,"TextFormatTypes",{enumerable:!0,get:function(){return Lf.TextFormatTypes}});var Vf=Si();Object.defineProperty(x,"ActivityTreatments",{enumerable:!0,get:function(){return Vf.ActivityTreatments}});var zf=Ei();Object.defineProperty(x,"ExceptionHelper",{enumerable:!0,get:function(){return zf.ExceptionHelper}});var qf=Ii();Object.defineProperty(x,"ActivityErrors",{enumerable:!0,get:function(){return qf.Errors}})});var rr=(r=>(r.Published="Published",r.Prebuilt="Prebuilt",r))(rr||{});var nr=(b=>(b.Unknown="Unknown",b.Exp="Exp",b.Dev="Dev",b.Test="Test",b.Preprod="Preprod",b.FirstRelease="FirstRelease",b.Prod="Prod",b.Gov="Gov",b.High="High",b.DoD="DoD",b.Mooncake="Mooncake",b.Ex="Ex",b.Rx="Rx",b.Prv="Prv",b.Local="Local",b.GovFR="GovFR",b.Other="Other",b))(nr||{});var vr=Te($e()),al=(0,vr.debug)("copilot-studio:settings"),Wo=class{constructor(){this.useExperimentalEndpoint=!1;this.enableDiagnostics=!1}},Ko=class extends Wo{constructor(e){var i,s,a,c;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(nr).includes(r))throw new Error(`Invalid PowerPlatformCloud: '${r}'. Supported values: ${Object.values(nr).join(", ")}`);if(!Object.values(rr).includes(n))throw new Error(`Invalid AgentType: '${n}'. Supported values: ${Object.values(rr).join(", ")}`);al.info("Copilot Studio connection settings loaded",{schemaName:(c=e.schemaName)!=null?c:e.agentIdentifier,cloud:r,environmentId:e.environmentId,customPowerPlatformCloud:(0,vr.redactUrl)(e.customPowerPlatformCloud),copilotAgentType:n,directConnectUrl:(0,vr.redactUrl)(e.directConnectUrl),useExperimentalEndpoint:e.useExperimentalEndpoint,enableDiagnostics:e.enableDiagnostics}),Object.assign(this,{...e,cloud:r,copilotAgentType:n,authority:o})}},Gg=()=>{var t,e,r,n,o,i,s,a;return new Ko({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 fn=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 Yo(t){}function wa(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=Yo,onError:r=Yo,onRetry:n=Yo,onComment:o}=t,i="",s=!0,a,c="",l="";function p(h){let w=s?h.replace(/^\xEF\xBB\xBF/,""):h,[b,P]=cl(`${i}${w}`);for(let O of b)y(O);i=P,s=!1}function y(h){if(h===""){I();return}if(h.startsWith(":")){o&&o(h.slice(h.startsWith(": ")?2:1));return}let w=h.indexOf(":");if(w!==-1){let b=h.slice(0,w),P=h[w+1]===" "?2:1,O=h.slice(w+P);T(b,O,h);return}T(h,"",h)}function T(h,w,b){switch(h){case"event":l=w;break;case"data":c=`${c}${w}
|
|
2
|
+
`;break;case"id":a=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?n(parseInt(w,10)):r(new fn(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:b}));break;default:r(new fn(`Unknown field "${h.length>20?`${h.slice(0,20)}\u2026`:h}"`,{type:"unknown-field",field:h,value:w,line:b}));break}}function I(){c.length>0&&e({id:a,event:l||void 0,data:c.endsWith(`
|
|
3
|
+
`)?c.slice(0,-1):c}),a=void 0,c="",l=""}function M(h={}){i&&h.consume&&y(i),s=!0,a=void 0,c="",l="",i=""}return{feed:p,reset:M}}function cl(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
|
|
4
|
+
`,n),s=-1;if(o!==-1&&i!==-1?s=Math.min(o,i):o!==-1?o===t.length-1?s=-1:s=o:i!==-1&&(s=i),s===-1){r=t.slice(n);break}else{let a=t.slice(n,s);e.push(a),n=s+1,t[n-1]==="\r"&&t[n]===`
|
|
5
|
+
`&&n++}}return[e,r]}var Oa="connecting",ul="open",Xo="closed",mn=()=>{};function dl(t,{getStream:e}){let r=typeof t=="string"||t instanceof URL?{url:t}:t,{onMessage:n,onComment:o=mn,onConnect:i=mn,onDisconnect:s=mn,onScheduleReconnect:a=mn}=r,{fetch:c,url:l,initialLastEventId:p}=ll(r),y={...r.headers},T=[],I=n?[n]:[],M=j=>I.forEach(ce=>ce(j)),h=wa({onEvent:du,onRetry:lu,onComment:o}),w,b=l.toString(),P=new AbortController,O=p,N=2e3,L,Z=Xo;return be(),{close:Q,connect:be,[Symbol.iterator]:()=>{throw new Error("EventSource does not support synchronous iteration. Use `for await` instead.")},[Symbol.asyncIterator]:Qt,get lastEventId(){return O},get url(){return b},get readyState(){return Z}};function be(){w||(Z=Oa,P=new AbortController,w=c(l,pu()).then(uu).catch(j=>{w=null,!(j.name==="AbortError"||j.type==="aborted"||P.signal.aborted)&&Mi()}))}function Q(){Z=Xo,P.abort(),h.reset(),clearTimeout(L),T.forEach(j=>j())}function Qt(){let j=[],ce=[];function er(){return new Promise(B=>{let ue=ce.shift();ue?B({value:ue,done:!1}):j.push(B)})}let ft=function(B){let ue=j.shift();ue?ue({value:B,done:!1}):ce.push(B)};function Le(){for(I.splice(I.indexOf(ft),1);j.shift(););for(;ce.shift(););}function tr(){let B=j.shift();B&&(B({done:!0,value:void 0}),Le())}return T.push(tr),I.push(ft),{next(){return Z===Xo?this.return():er()},return(){return Le(),Promise.resolve({done:!0,value:void 0})},throw(B){return Le(),Promise.reject(B)},[Symbol.asyncIterator](){return this}}}function Mi(){a({delay:N}),!P.signal.aborted&&(Z=Oa,L=setTimeout(be,N))}async function uu(j){i(),h.reset();let{body:ce,redirected:er,status:ft}=j;if(ft===204){s(),Q();return}if(!ce)throw new Error("Missing response body");er&&(b=j.url);let Le=e(ce),tr=new TextDecoder,B=Le.getReader(),ue=!0;Z=ul;do{let{done:Li,value:Vi}=await B.read();Vi&&h.feed(tr.decode(Vi,{stream:!Li})),Li&&(ue=!1,w=null,h.reset(),Mi(),s())}while(ue)}function du(j){typeof j.id=="string"&&(O=j.id),M(j)}function lu(j){N=j}function pu(){let{mode:j,credentials:ce,body:er,method:ft,redirect:Le,referrer:tr,referrerPolicy:B}=r,ue={Accept:"text/event-stream",...y,...O?{"Last-Event-ID":O}:void 0};return{mode:j,credentials:ce,body:er,method:ft,redirect:Le,referrer:tr,referrerPolicy:B,headers:ue,cache:"no-store",signal:P.signal}}}function ll(t){let e=t.fetch||globalThis.fetch;if(!pl(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 pl(t){return typeof t=="function"}var fl={getStream:ml};function Jo(t){return dl(t,fl)}function ml(t){if(!(t instanceof ReadableStream))throw new Error("Invalid stream, expected a web ReadableStream");return t}var Ra=Te($e());var hn=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 gn=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 Et=(0,Ra.debug)("copilot-studio:power-platform");function br(t,e){var c,l,p,y,T,I,M,h;let r=((c=t.schemaName)==null?void 0:c.trim())||((l=t.agentIdentifier)==null?void 0:l.trim());if(!((p=t.directConnectUrl)!=null&&p.trim())&&(!((y=t.environmentId)!=null&&y.trim())||!(r!=null&&r.trim())))throw new Error("Either directConnectUrl OR both environmentId and schemaName/agentIdentifier must be provided");if((T=t.directConnectUrl)!=null&&T.trim()){if(Et.debug(`Using direct connection: ${t.directConnectUrl}`),!_r(t.directConnectUrl))throw new Error("directConnectUrl must be a valid URL");return hl(t.directConnectUrl,e).href}let n=(I=t.cloud)!=null?I:"Prod",o=(M=t.copilotAgentType)!=null?M:"Published";if(Et.debug(`Using cloud setting: ${n}`),Et.debug(`Using agent type: ${o}`),n==="Other")if((h=t.customPowerPlatformCloud)!=null&&h.trim())if(_r(t.customPowerPlatformCloud))Et.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=gl(n,t.environmentId,t.customPowerPlatformCloud),a={Published:()=>new gn({host:i,schema:r}),Prebuilt:()=>new hn({host:i,schema:r})}[o]().getConversationUrl(e);return Et.debug(`Generated Copilot Studio connection URL: ${a}`),a}function Na(t,e){if(!e||!e.trim())throw new Error("conversationId is required for subscribe URL");let r=br(t,e),n=new URL(r);n.pathname=n.pathname.endsWith("/")?`${n.pathname}subscribe`:`${n.pathname}/subscribe`;let o=n.href;return Et.debug(`Generated Copilot Studio subscribe URL: ${o}`),o}function ka(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&&_r(r))e="Other";else if(t!=null&&t.customPowerPlatformCloud&&_r(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://${yn(e,r)}/.default`}else if(n||(n=(o=t==null?void 0:t.directConnectUrl)!=null?o:""),n&&_r(n)){if(Pa(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://${yn(s,"")}/.default`;throw new Error("Unable to resolve the PowerPlatform Cloud from DirectConnectUrl. The Token Audience resolver requires a specific PowerPlatformCloudCategory.")}return`https://${yn(Pa(new URL(n)),"")}/.default`}else throw new Error("DirectConnectUrl must be provided when DirectConnectUrl is set")}function _r(t){try{let e=t.startsWith("http")?t:`https://${t}`;return!!new URL(e)}catch{return!1}}function hl(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 gl(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=yl(t),i=n.substring(0,n.length-o),s=n.substring(n.length-o);return new URL(`https://${i}.${s}.environment.${yn(t,r)}`)}function yn(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 yl(t){switch(t){case"FirstRelease":case"Prod":return 2;default:return 1}}function Pa(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 lt=Te(Bn());var wr=class{constructor(e,r){this.activity=e,this.conversationId=r}};var je=Te($e());var Hn="1.6.1";var Wn={};var Or=class{static getProductInfo(){var n;let e=`CopilotStudioClient.agents-sdk-js/${Hn}`,r=globalThis;return typeof r.document!="undefined"&&typeof((n=r.navigator)==null?void 0:n.userAgent)=="string"?`${e} ${r.navigator.userAgent}`:`${e} nodejs/${process.version} ${Wn.platform()}-${Wn.arch()}/${Wn.release()}`}static getVersionString(){return`CopilotStudioClient.agents-sdk-js/${Hn}`}static getVersion(){return Hn}};var Kn=class{static getScopeFromSettings(e){return ka(e)}};function Gc(t,e){return{activities:t,conversationId:e,isNewConversation:!0}}function $c(t,e){return{activities:t,conversationId:e,activityCount:t.length}}var U=Te($e()),$={activitiesReceivedCounter:U.metric.counter(U.MetricNames.CSC_ACTIVITIES_RECEIVED,{unit:"activities",description:"Total number of activities received by the Copilot Studio client"}),activitiesSentCounter:U.metric.counter(U.MetricNames.CSC_ACTIVITIES_SENT,{unit:"activities",description:"Total number of activities sent to Copilot Studio"}),conversationsStartedCounter:U.metric.counter(U.MetricNames.CSC_CONVERSATIONS_STARTED,{unit:"conversations",description:"Total number of conversations started with Copilot Studio"}),webchatConnectionsCounter:U.metric.counter(U.MetricNames.CSC_WEBCHAT_CONNECTIONS,{unit:"connections",description:"Total number of webchat connections created with Copilot Studio"}),requestsCounter:U.metric.counter(U.MetricNames.CSC_REQUEST_COUNT,{unit:"requests",description:"Total number of HTTP/SSE requests made to Copilot Studio"}),requestsErrorCounter:U.metric.counter(U.MetricNames.CSC_REQUEST_ERRORS,{unit:"requests",description:"Total number of failed requests to Copilot Studio"}),executeStreamingCounter:U.metric.counter(U.MetricNames.CSC_EXECUTE_STREAMING,{unit:"operations",description:"Total number of execute streaming operations"}),subscribeAsyncCounter:U.metric.counter(U.MetricNames.CSC_SUBSCRIBE_ASYNC,{unit:"operations",description:"Total number of subscribeAsync operations"}),subscribeEventCounter:U.metric.counter(U.MetricNames.CSC_SUBSCRIBE_EVENT,{unit:"events",description:"Total number of events received via subscribeAsync"}),streamDuration:U.metric.histogram(U.MetricNames.CSC_STREAM_DURATION,{unit:"ms",description:"Duration of SSE stream sessions in milliseconds"}),requestDuration:U.metric.histogram(U.MetricNames.CSC_REQUEST_DURATION,{unit:"ms",description:"Duration of requests to Copilot Studio in milliseconds"})};var wi=Te(Bn()),Y=Te($e());var Ue={createConnection:Y.trace.define({name:Y.SpanNames.COPILOT_CREATE_CONNECTION,record:{showTyping:!1},actions:({span:t})=>({receivedFromCopilot(e){var r,n,o;t.addEvent("activity.received.from.copilot.studio",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})},sentToWebChat(e){var r,n,o;t.addEvent("activity.sent.to.webchat",{"copilot.webchat.activity.type":(r=e.type)!=null?r:"unknown","copilot.webchat.activity.conversation_id":(o=(n=e.conversation)==null?void 0:n.id)!=null?o:"unknown"})}}),end({span:t,record:e}){var n;let r={"copilot.webchat.show_typing":(n=e.showTyping)!=null?n:"unknown"};t.setAttributes(r),$.webchatConnectionsCounter.add(1,r)}}),postRequest:Y.trace.define({name:Y.SpanNames.COPILOT_POST_REQUEST,record:{url:"",method:""},actions:({span:t})=>({receivedFromCopilot(e){var n,o,i;let r={"copilot.activity.type":(n=e.type)!=null?n:"unknown","copilot.activity.conversation_id":(i=(o=e.conversation)==null?void 0:o.id)!=null?i:"unknown"};t.addEvent("activity.received",{"copilot.post_request.activity.type":r["copilot.activity.type"],"copilot.post_request.activity.conversation_id":r["copilot.activity.conversation_id"]}),$.activitiesReceivedCounter.add(1,r)}}),end({span:t,record:e,duration:r,error:n}){var s,a;let o={"copilot.post_request.url":(s=e.url)!=null?s:"unknown","copilot.post_request.method":(a=e.method)!=null?a:"unknown"},i={operation:"postRequestAsync","copilot.post_request.url":o["copilot.post_request.url"],"copilot.post_request.method":o["copilot.post_request.method"]};t.setAttributes(o),$.requestsCounter.add(1,i),$.streamDuration.record(r,i),n&&$.requestsErrorCounter.add(1,{...i,"error.type":n instanceof Error?n.name:typeof n})}}),startConversation:Y.trace.define({name:Y.SpanNames.COPILOT_START_CONVERSATION,record:{shouldEmitStartEvent:!1},end({span:t,record:e,duration:r}){let n=e.shouldEmitStartEvent?{"copilot.emit_start_event":!0}:{"copilot.request":!0},o={operation:"startConversationStreaming",...n};t.setAttributes(n),$.conversationsStartedCounter.add(1,o),$.requestDuration.record(r,o)}}),sendActivity:Y.trace.define({name:Y.SpanNames.COPILOT_SEND_ACTIVITY,record:{activity:wi.Activity.fromObject({type:"unknown"})},end({span:t,record:e,duration:r}){var i,s,a;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(a=(s=e.activity.conversation)==null?void 0:s.id)!=null?a:"unknown"},o={operation:"sendActivityStreaming",...n};t.setAttributes(n),$.activitiesSentCounter.add(1,n),$.requestDuration.record(r,o)}}),executeStreaming:Y.trace.define({name:Y.SpanNames.COPILOT_EXECUTE_STREAMING,record:{activity:wi.Activity.fromObject({type:"unknown"}),conversationId:"unknown"},end({span:t,record:e,duration:r}){var i,s;let n={"copilot.activity.type":(i=e.activity.type)!=null?i:"unknown","copilot.activity.conversation_id":(s=e.conversationId)!=null?s:"unknown"},o={operation:"executeStreaming",...n};t.setAttributes(n),$.executeStreamingCounter.add(1,n),$.requestDuration.record(r,o)}}),subscribeAsync:Y.trace.define({name:Y.SpanNames.COPILOT_SUBSCRIBE_ASYNC,record:{conversationId:"unknown",lastReceivedEventId:"unknown"},actions:({span:t})=>({eventReceivedFromCopilot(e){var n,o;let r={"copilot.subscribe_async.event.id":(n=e.eventId)!=null?n:"unknown","copilot.subscribe_async.event.activity.type":(o=e.activity.type)!=null?o:"unknown"};t.addEvent("event.received",r),$.subscribeEventCounter.add(1,r)}}),end({span:t,record:e,duration:r}){var i,s;let n={"copilot.subscribe_async.conversation_id":(i=e.conversationId)!=null?i:"unknown","copilot.subscribe_async.last_received_event_id":(s=e.lastReceivedEventId)!=null?s:"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"]};t.setAttributes(n),$.subscribeAsyncCounter.add(1,o),$.streamDuration.record(r,o)}})};var z=(0,je.debug)("copilot-studio:client"),Ze=class Ze{constructor(e,r){this.conversationId="";this.settings=e,this.token=r}logDiagnostic(e,...r){this.settings.enableDiagnostics&&z.info(`[DIAGNOSTICS] ${e}`,...r)}async*postRequestAsync(e,r,n="POST"){var i,s,a,c,l,p,y,T,I,M;let o=(0,je.trace)(Ue.postRequest);o.record({url:e,method:n});try{this.logDiagnostic(`Request URL: ${e}`),this.logDiagnostic(`Request Method: ${n}`),this.logDiagnostic("Request Body:",r?JSON.stringify(r,null,2):"none"),z.debug(`>>> SEND TO ${e}`);let h=new Map,w=Jo({url:e,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Or.getProductInfo(),"Content-Type":"application/json",Accept:"text/event-stream"},body:r?JSON.stringify(r):void 0,method:n,fetch:async(b,P)=>{let O=await fetch(b,P);return this.processResponseHeaders(O.headers),O}});try{for await(let{data:b,event:P}of w){if(b&&P==="activity")try{let O=lt.Activity.fromJson(b);o.actions.receivedFromCopilot(O);let N=(i=O.entities)==null?void 0:i.find(L=>L.type==="streaminfo"&&L.streamType==="streaming");switch(O.type){case lt.ActivityTypes.Message:this.conversationId.trim()||(this.conversationId=(a=(s=O.conversation)==null?void 0:s.id)!=null?a:"",z.debug(`Conversation ID: ${this.conversationId}`)),yield O;break;case lt.ActivityTypes.Typing:if(z.debug(`Activity type: ${O.type}`),N||((c=O.channelData)==null?void 0:c.streamType)==="streaming"){let L=(l=O.text)!=null?l:"",Z=(y=N==null?void 0:N.streamId)!=null?y:(p=O.channelData)==null?void 0:p.streamId,be=(I=N==null?void 0:N.streamSequence)!=null?I:(T=O.channelData)==null?void 0:T.streamSequence;if(Z&&be){if(h.has(Z)){let Q=h.get(Z);Q.push({text:L,sequence:be}),h.set(Z,Q)}else h.set(Z,[{text:L,sequence:be}]);O.text=((M=h.get(Z))==null?void 0:M.sort((Q,Qt)=>Q.sequence-Qt.sequence).map(Q=>Q.text).join(""))||""}}yield O;break;default:z.debug(`Activity type: ${O.type}`),yield O;break}}catch(O){z.error("Failed to parse activity:",O)}else if(P==="end"){z.debug("Stream complete");break}if(w.readyState==="closed"){z.debug("Connection closed");break}}}finally{w.close()}}catch(h){throw o.fail(h)}finally{o.end()}}processResponseHeaders(e){var n,o;if(this.settings.useExperimentalEndpoint&&!((n=this.settings.directConnectUrl)!=null&&n.trim())){let i=e==null?void 0:e.get(Ze.islandExperimentalUrlHeaderKey);i&&(this.settings.directConnectUrl=i,z.debug(`Island Experimental URL: ${i}`))}this.conversationId=(o=e==null?void 0:e.get(Ze.conversationIdHeaderKey))!=null?o:"",this.conversationId&&z.debug(`Conversation ID: ${this.conversationId}`);let r=new Headers;e.forEach((i,s)=>{s.toLowerCase()!=="authorization"&&s.toLowerCase()!==Ze.conversationIdHeaderKey.toLowerCase()&&r.set(s,i)}),this.logDiagnostic("Response Headers:",r)}async*startConversationStreaming(e){var n,o;let r=(0,je.trace)(Ue.startConversation);try{let i;typeof e=="boolean"||e===void 0?(r.record({shouldEmitStartEvent:e!=null?e:!0}),i={emitStartConversationEvent:e!=null?e:!0}):(i=e,r.record({shouldEmitStartEvent:(n=i.emitStartConversationEvent)!=null?n:!0}));let s=br(this.settings,i.conversationId),a={emitStartConversationEvent:(o=i.emitStartConversationEvent)!=null?o:!0};i.locale&&(a.locale=i.locale),z.info("Starting conversation ...",i),this.logDiagnostic("Start conversation request:",a),yield*this.postRequestAsync(s,a,"POST")}catch(i){throw r.fail(i)}finally{r.end()}}async*sendActivityStreaming(e,r=this.conversationId){var o,i;let n=(0,je.trace)(Ue.sendActivity);n.record({activity:e});try{let s=(i=(o=e.conversation)==null?void 0:o.id)!=null?i:r,a=br(this.settings,s),c=new wr(e);z.info("Sending activity...",e),yield*this.postRequestAsync(a,c,"POST")}catch(s){throw n.fail(s)}finally{n.end()}}async*executeStreaming(e,r){let n=(0,je.trace)(Ue.executeStreaming);n.record({activity:e,conversationId:r});try{if(!r||!r.trim())throw new Error("conversationId is required for executeStreaming");let o=br(this.settings,r),i=new wr(e,r);z.info("Executing turn with conversation ID:",r),this.logDiagnostic("Execute turn request:",{conversationId:r,activityType:e.type,activityText:e.text}),yield*this.postRequestAsync(o,i,"POST")}catch(o){throw n.fail(o)}finally{n.end()}}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=lt.Activity.fromObject(i),a=[];for await(let c of this.sendActivityStreaming(s,r))a.push(c);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,Gc(r,n)}async executeWithResponse(e,r){let n=[];for await(let o of this.executeStreaming(e,r))n.push(o);return $c(n,r)}async*subscribeAsync(e,r){let n=(0,je.trace)(Ue.subscribeAsync);n.record({conversationId:e,lastReceivedEventId:r});try{if(!e||!e.trim())throw new Error("conversationId is required for subscribeAsync");let o=Na(this.settings,e);z.info("Subscribing to conversation:",e),this.logDiagnostic("Subscribe request:",{conversationId:e,lastReceivedEventId:r,url:o});let i=Jo({url:o,headers:{Authorization:`Bearer ${this.token}`,"User-Agent":Or.getProductInfo(),Accept:"text/event-stream",...r&&{"Last-Event-ID":r}},method:"GET",fetch:async(s,a)=>{let c=await fetch(s,a);return this.processResponseHeaders(c.headers),c}});try{for await(let{data:s,event:a,id:c}of i){if(s&&a==="activity")try{let l=lt.Activity.fromJson(s),p={activity:l,eventId:c};n.actions.eventReceivedFromCopilot(p),z.debug(`Received activity via subscription, event ID: ${c}`),this.logDiagnostic("Subscribe event received:",{eventId:c,activityType:l.type}),yield p}catch(l){z.error("Failed to parse activity in subscription:",l)}else if(a==="end"){z.debug("Subscription stream complete");break}if(i.readyState==="closed"){z.debug("Subscription connection closed");break}}}finally{i.close()}}catch(o){throw n.fail(o)}finally{n.end()}}};Ze.conversationIdHeaderKey="x-ms-conversationid",Ze.islandExperimentalUrlHeaderKey="x-ms-d2e-experimental",Ze.scopeFromSettings=Kn.getScopeFromSettings;var Bc=Ze;function Hc(){return globalThis.crypto.randomUUID()}var cu=Te(Bn());var Oi=function(t,e){return Oi=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])},Oi(t,e)};function Me(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Oi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Pr(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 Bt(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 Ht(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 oe(t){return typeof t=="function"}function Yn(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 Xn=Yn(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
6
6
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
7
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function $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{id(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)id(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 _a=ir.EMPTY;function go(e){return e instanceof ir||e&&"closed"in e&&le(e.remove)&&le(e.add)&&le(e.unsubscribe)}function id(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 ad(e){ar.setTimeout(function(){var t=me.onUnhandledError;if(t)t(e);else throw e})}function ba(){}var sd=(function(){return Ta("C",void 0,void 0)})();function cd(e){return Ta("E",void 0,e)}function ud(e){return Ta("N",e,void 0)}function Ta(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 dd(e){me.useDeprecatedSynchronousErrorHandling&&Ct&&(Ct.errorThrown=!0,Ct.error=e)}var Ia=(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=ig,n}return t.create=function(r,n,o){return new vo(r,n,o)},t.prototype.next=function(r){this.isStopped?Ca(ud(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Ca(cd(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Ca(sd,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 rg=Function.prototype.bind;function xa(e,t){return rg.call(e,t)}var ng=(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 ng(a),i}return t})(Ia);function yo(e){me.useDeprecatedSynchronousErrorHandling?dd(e):ad(e)}function og(e){throw e}function Ca(e,t){var r=me.onStoppedNotification;r&&ar.setTimeout(function(){return r(e,t)})}var ig={closed:!0,next:ba,error:og,complete:ba};var ld=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function fd(e){return e}function pd(e){return e.length===0?fd: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=sg(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=md(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[ld]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return pd(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=md(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 md(e){var t;return(t=e!=null?e:me.Promise)!==null&&t!==void 0?t:Promise}function ag(e){return e&&le(e.next)&&le(e.error)&&le(e.complete)}function sg(e){return e&&e instanceof Ia||ag(e)&&go(e)}var hd=mo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Ea=(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 gd(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new hd},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?_a:(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 gd(r,n)},t})(cr);var gd=(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:_a},t})(Ea);var Sa=(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})(Ea);var _o=De(Ut());var Ue=(0,_o.debug)("copilot-studio:webchat");function cg(e){let t=!1;return r=>{if(!t)return t=!0,e(r)}}var yd=class{static createConnection(t,r){var o;let n=(0,_o.trace)($e.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{Ue.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 Sa(0),P=vd(async T=>{var N;try{c=T;let O=cg(async()=>{I.next(2),await Promise.resolve()});if(!a||_){await O();return}_=!0,Ue.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=T=>{let N={...T,timestamp:new Date().toISOString(),channelData:{...T.channelData,"webchat:sequence-id":s}};s++,Ue.debug(`Notify '${N.type}' activity to WebChat:`,N),c==null||c.next(N)},S=()=>{if(!(r!=null&&r.showTyping))return;let T=d?{id:d.id,name:d.name}:{id:"agent",name:"Agent"};y({type:"typing",from:T})};return{connectionStatus$:I,activity$:P,get conversationId(){return f},postActivity(T){try{if(Ue.info("--> Preparing to send activity to Copilot Studio ..."),!T)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 vd(async O=>{var k;try{Ue.info("--> Sending activity to Copilot Studio ...");let V=_d.Activity.fromObject({...T,id:ya(),attachments:await ug(T)});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),Ue.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(V){Ue.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(){Ue.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 ug(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 dg(n);t.push(o)}return t}async function dg(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=lg(o);t=`data:${n.type};base64,${i}`}catch(r){t=e.contentUrl,Ue.error("Error processing blob attachment:",t,r)}return{...e,contentUrl:t}}function lg(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 vd(e){return new cr(t=>{Promise.resolve(e(t)).catch(r=>t.error(r))})}function gT(e=!0,t,r){return{emitStartConversationEvent:e,locale:t,conversationId:r}}export{fr as AgentType,To as ConnectionSettings,nd as CopilotStudioClient,yd as CopilotStudioWebChat,zr as ExecuteTurnRequest,pr as PowerPlatformCloud,po as ScopeHelper,Fr as UserAgentHelper,rd as createExecuteTurnResponse,gT as createStartRequest,td as createStartResponse,Ar as getCopilotStudioConnectionUrl,vc as getCopilotStudioSubscribeUrl,_c as getTokenAudience,yg as loadCopilotStudioConnectionSettingsFromEnv};
|
|
7
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function Rr(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Wt=(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=Pr(s),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else s.remove(this);var p=this.initialTeardown;if(oe(p))try{p()}catch(h){i=h instanceof Xn?h.errors:[h]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var T=Pr(y),I=T.next();!I.done;I=T.next()){var M=I.value;try{Wc(M)}catch(h){i=i!=null?i:[],h instanceof Xn?i=Ht(Ht([],Bt(i)),Bt(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{I&&!I.done&&(o=T.return)&&o.call(T)}finally{if(n)throw n.error}}}if(i)throw new Xn(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Wc(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)&&Rr(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Rr(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})();var Pi=Wt.EMPTY;function Jn(t){return t instanceof Wt||t&&"closed"in t&&oe(t.remove)&&oe(t.add)&&oe(t.unsubscribe)}function Wc(t){oe(t)?t():t.unsubscribe()}var ae={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Kt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Kt.delegate;return o!=null&&o.setTimeout?o.setTimeout.apply(o,Ht([t,e],Bt(r))):setTimeout.apply(void 0,Ht([t,e],Bt(r)))},clearTimeout:function(t){var e=Kt.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Kc(t){Kt.setTimeout(function(){var e=ae.onUnhandledError;if(e)e(t);else throw t})}function Ri(){}var Yc=(function(){return Ni("C",void 0,void 0)})();function Xc(t){return Ni("E",void 0,t)}function Jc(t){return Ni("N",t,void 0)}function Ni(t,e,r){return{kind:t,value:e,error:r}}var pt=null;function Yt(t){if(ae.useDeprecatedSynchronousErrorHandling){var e=!pt;if(e&&(pt={errorThrown:!1,error:null}),t(),e){var r=pt,n=r.errorThrown,o=r.error;if(pt=null,n)throw o}}else t()}function Qc(t){ae.useDeprecatedSynchronousErrorHandling&&pt&&(pt.errorThrown=!0,pt.error=t)}var Ui=(function(t){Me(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Jn(r)&&r.add(n)):n.destination=Hf,n}return e.create=function(r,n,o){return new eo(r,n,o)},e.prototype.next=function(r){this.isStopped?Di(Jc(r),this):this._next(r)},e.prototype.error=function(r){this.isStopped?Di(Xc(r),this):(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped?Di(Yc,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})(Wt);var Gf=Function.prototype.bind;function ki(t,e){return Gf.call(t,e)}var $f=(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){Qn(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Qn(n)}else Qn(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Qn(r)}},t})(),eo=(function(t){Me(e,t);function e(r,n,o){var i=t.call(this)||this,s;if(oe(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&&ae.useDeprecatedNextContext?(a=Object.create(r),a.unsubscribe=function(){return i.unsubscribe()},s={next:r.next&&ki(r.next,a),error:r.error&&ki(r.error,a),complete:r.complete&&ki(r.complete,a)}):s=r}return i.destination=new $f(s),i}return e})(Ui);function Qn(t){ae.useDeprecatedSynchronousErrorHandling?Qc(t):Kc(t)}function Bf(t){throw t}function Di(t,e){var r=ae.onStoppedNotification;r&&Kt.setTimeout(function(){return r(t,e)})}var Hf={closed:!0,next:Ri,error:Bf,complete:Ri};var eu=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function tu(t){return t}function ru(t){return t.length===0?tu:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var Xt=(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=Kf(e)?e:new eo(e,r,n);return Yt(function(){var s=o,a=s.operator,c=s.source;i.add(a?a.call(i,c):c?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=nu(r),new r(function(o,i){var s=new eo({next:function(a){try{e(a)}catch(c){i(c),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[eu]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ru(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=nu(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 nu(t){var e;return(e=t!=null?t:ae.Promise)!==null&&e!==void 0?e:Promise}function Wf(t){return t&&oe(t.next)&&oe(t.error)&&oe(t.complete)}function Kf(t){return t&&t instanceof Ui||Wf(t)&&Jn(t)}var ou=Yn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var Zi=(function(t){Me(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 iu(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new ou},e.prototype.next=function(r){var n=this;Yt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Pr(n.currentObservers),a=s.next();!a.done;a=s.next()){var c=a.value;c.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;Yt(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;Yt(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?Pi:(this.currentObservers=null,a.push(r),new Wt(function(){n.currentObservers=null,Rr(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 Xt;return r.source=this,r},e.create=function(r,n){return new iu(r,n)},e})(Xt);var iu=(function(t){Me(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:Pi},e})(Zi);var ji=(function(t){Me(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})(Zi);var Jt=Te($e());var _e=(0,Jt.debug)("copilot-studio:webchat");function Yf(t){let e=!1;return r=>{if(!e)return e=!0,t(r)}}var su=class{static createConnection(e,r){var o;let n=(0,Jt.trace)(Ue.createConnection);n.record({showTyping:r==null?void 0:r.showTyping});try{_e.info("--> Creating connection between Copilot Studio and WebChat ...");let i=r!=null&&r.conversationId&&r.conversationId.trim()!==""?r.conversationId.trim():void 0,s=(o=r==null?void 0:r.startConversation)!=null?o:!i;_e.info("Copilot Studio WebChat settings loaded",{showTyping:r==null?void 0:r.showTyping,conversationId:(0,Jt.redactString)(i,!0),startConversation:r==null?void 0:r.startConversation,connectionMode:i?"resume":"new",acknowledgementMode:s?"startConversationStreaming":"resumeWithoutStart"});let a=0,c,l,p=i,y=!1,T=!1,I=new ji(0),M=au(async b=>{var P;try{c=b;let O=Yf(async()=>{I.next(2),await Promise.resolve()});if(!s||T){await O();return}T=!0,_e.debug("--> Connection established."),w();for await(let N of e.startConversationStreaming())delete N.replyToId,!l&&N.conversation&&(l=N.conversation),(P=N.conversation)!=null&&P.id&&(p=N.conversation.id),await O(),h(N),n.actions.receivedFromCopilot(N);await O()}catch(O){throw n.fail(O)}finally{n.end()}}),h=b=>{let P={...b,timestamp:new Date().toISOString(),channelData:{...b.channelData,"webchat:sequence-id":a}};a++,_e.debug(`Notify '${P.type}' activity to WebChat:`,P),c==null||c.next(P)},w=()=>{if(!(r!=null&&r.showTyping))return;let b=l?{id:l.id,name:l.name}:{id:"agent",name:"Agent"};h({type:"typing",from:b})};return{connectionStatus$:I,activity$:M,get conversationId(){return p},postActivity(b){try{if(_e.info("--> Preparing to send activity to Copilot Studio ..."),!b)throw new Error("Activity cannot be null.");if(y)throw new Error("Connection has been ended.");if(!c)throw new Error("Activity subscriber is not initialized.");return au(async O=>{var N;try{_e.info("--> Sending activity to Copilot Studio ...");let L=cu.Activity.fromObject({...b,id:Hc(),attachments:await Xf(b)});h(L),n.actions.sentToWebChat(L),w(),O.next(L.id);for await(let Z of e.sendActivityStreaming(L,p))!p&&((N=Z.conversation)!=null&&N.id)&&(p=Z.conversation.id),h(Z),n.actions.receivedFromCopilot(Z),_e.info("<-- Activity received correctly from Copilot Studio.");O.complete()}catch(L){_e.error("Error sending Activity to Copilot Studio:",L),O.error(L),n.fail(L)}finally{n.end()}})}catch(P){throw n.fail(P)}finally{n.end()}},end(){_e.info("--> Ending connection between Copilot Studio and WebChat ..."),y=!0,I.complete(),c&&(c.complete(),c=void 0),n.end()}}}catch(i){throw n.fail(i)}finally{n.end()}}};async function Xf(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 Jf(n);e.push(o)}return e}async function Jf(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=Qf(o);e=`data:${n.type};base64,${i}`}catch(r){e=t.contentUrl,_e.error("Error processing blob attachment:",e,r)}return{...t,contentUrl:e}}function Qf(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 au(t){return new Xt(e=>{Promise.resolve(t(e)).catch(r=>e.error(r))})}function P_(t=!0,e,r){return{emitStartConversationEvent:t,locale:e,conversationId:r}}export{rr as AgentType,Ko as ConnectionSettings,Bc as CopilotStudioClient,su as CopilotStudioWebChat,wr as ExecuteTurnRequest,nr as PowerPlatformCloud,Kn as ScopeHelper,Or as UserAgentHelper,$c as createExecuteTurnResponse,P_ as createStartRequest,Gc as createStartResponse,br as getCopilotStudioConnectionUrl,Na as getCopilotStudioSubscribeUrl,ka as getTokenAudience,Gg as loadCopilotStudioConnectionSettingsFromEnv};
|
|
8
8
|
//# sourceMappingURL=browser.mjs.map
|