@mondaydotcomorg/agent-toolkit
Version:
monday.com agent toolkit
2 lines • 1.15 MB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zod"),t=require("zod-to-json-schema"),a=require("@mondaydotcomorg/api"),i=require("util"),n=require("stream"),o=require("path"),r=require("http"),s=require("https"),p=require("url"),d=require("fs"),l=require("crypto"),c=require("assert"),u=require("tty"),m=require("os"),h=require("zlib"),f=require("events"),v=require("buffer"),g=require("punycode");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function b(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var _=y(i),w=y(n),E=y(o),T=y(r),x=y(s),I=b(s),S=y(p),N=y(d),A=y(l),D=b(l),O=y(c),R=y(u),k=y(m),C=y(h),P=y(v),$=y(g);const L="2025-06-18",F=[L,"2025-03-26","2024-11-05","2024-10-07"],j="2.0",U=e.z.union([e.z.string(),e.z.number().int()]),V=e.z.string(),z=e.z.object({progressToken:e.z.optional(U)}).passthrough(),B=e.z.object({_meta:e.z.optional(z)}).passthrough(),M=e.z.object({method:e.z.string(),params:e.z.optional(B)}),q=e.z.object({_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),H=e.z.object({method:e.z.string(),params:e.z.optional(q)}),G=e.z.object({_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),W=e.z.union([e.z.string(),e.z.number().int()]),K=e.z.object({jsonrpc:e.z.literal(j),id:W}).merge(M).strict(),Y=e.z.object({jsonrpc:e.z.literal(j)}).merge(H).strict(),Q=e.z.object({jsonrpc:e.z.literal(j),id:W,result:G}).strict(),J=e=>Q.safeParse(e).success;var X;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(X||(X={}));const Z=e.z.object({jsonrpc:e.z.literal(j),id:W,error:e.z.object({code:e.z.number().int(),message:e.z.string(),data:e.z.optional(e.z.unknown())})}).strict();e.z.union([K,Y,Q,Z]);const ee=G.strict(),te=H.extend({method:e.z.literal("notifications/cancelled"),params:q.extend({requestId:W,reason:e.z.string().optional()})}),ae=e.z.object({name:e.z.string(),title:e.z.optional(e.z.string())}).passthrough(),ie=ae.extend({version:e.z.string()}),ne=e.z.object({experimental:e.z.optional(e.z.object({}).passthrough()),sampling:e.z.optional(e.z.object({}).passthrough()),elicitation:e.z.optional(e.z.object({}).passthrough()),roots:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough())}).passthrough(),oe=M.extend({method:e.z.literal("initialize"),params:B.extend({protocolVersion:e.z.string(),capabilities:ne,clientInfo:ie})}),re=e.z.object({experimental:e.z.optional(e.z.object({}).passthrough()),logging:e.z.optional(e.z.object({}).passthrough()),completions:e.z.optional(e.z.object({}).passthrough()),prompts:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough()),resources:e.z.optional(e.z.object({subscribe:e.z.optional(e.z.boolean()),listChanged:e.z.optional(e.z.boolean())}).passthrough()),tools:e.z.optional(e.z.object({listChanged:e.z.optional(e.z.boolean())}).passthrough())}).passthrough(),se=G.extend({protocolVersion:e.z.string(),capabilities:re,serverInfo:ie,instructions:e.z.optional(e.z.string())}),pe=H.extend({method:e.z.literal("notifications/initialized")}),de=M.extend({method:e.z.literal("ping")}),le=e.z.object({progress:e.z.number(),total:e.z.optional(e.z.number()),message:e.z.optional(e.z.string())}).passthrough(),ce=H.extend({method:e.z.literal("notifications/progress"),params:q.merge(le).extend({progressToken:U})}),ue=M.extend({params:B.extend({cursor:e.z.optional(V)}).optional()}),me=G.extend({nextCursor:e.z.optional(V)}),he=e.z.object({uri:e.z.string(),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),fe=he.extend({text:e.z.string()}),ve=he.extend({blob:e.z.string().base64()}),ge=ae.extend({uri:e.z.string(),description:e.z.optional(e.z.string()),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}),ye=ae.extend({uriTemplate:e.z.string(),description:e.z.optional(e.z.string()),mimeType:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}),be=ue.extend({method:e.z.literal("resources/list")}),_e=me.extend({resources:e.z.array(ge)}),we=ue.extend({method:e.z.literal("resources/templates/list")}),Ee=me.extend({resourceTemplates:e.z.array(ye)}),Te=M.extend({method:e.z.literal("resources/read"),params:B.extend({uri:e.z.string()})}),xe=G.extend({contents:e.z.array(e.z.union([fe,ve]))}),Ie=H.extend({method:e.z.literal("notifications/resources/list_changed")}),Se=M.extend({method:e.z.literal("resources/subscribe"),params:B.extend({uri:e.z.string()})}),Ne=M.extend({method:e.z.literal("resources/unsubscribe"),params:B.extend({uri:e.z.string()})}),Ae=H.extend({method:e.z.literal("notifications/resources/updated"),params:q.extend({uri:e.z.string()})}),De=e.z.object({name:e.z.string(),description:e.z.optional(e.z.string()),required:e.z.optional(e.z.boolean())}).passthrough(),Oe=ae.extend({description:e.z.optional(e.z.string()),arguments:e.z.optional(e.z.array(De)),_meta:e.z.optional(e.z.object({}).passthrough())}),Re=ue.extend({method:e.z.literal("prompts/list")}),ke=me.extend({prompts:e.z.array(Oe)}),Ce=M.extend({method:e.z.literal("prompts/get"),params:B.extend({name:e.z.string(),arguments:e.z.optional(e.z.record(e.z.string()))})}),Pe=e.z.object({type:e.z.literal("text"),text:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),$e=e.z.object({type:e.z.literal("image"),data:e.z.string().base64(),mimeType:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),Le=e.z.object({type:e.z.literal("audio"),data:e.z.string().base64(),mimeType:e.z.string(),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),Fe=e.z.object({type:e.z.literal("resource"),resource:e.z.union([fe,ve]),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),je=ge.extend({type:e.z.literal("resource_link")}),Ue=e.z.union([Pe,$e,Le,je,Fe]),Ve=e.z.object({role:e.z.enum(["user","assistant"]),content:Ue}).passthrough(),ze=G.extend({description:e.z.optional(e.z.string()),messages:e.z.array(Ve)}),Be=H.extend({method:e.z.literal("notifications/prompts/list_changed")}),Me=e.z.object({title:e.z.optional(e.z.string()),readOnlyHint:e.z.optional(e.z.boolean()),destructiveHint:e.z.optional(e.z.boolean()),idempotentHint:e.z.optional(e.z.boolean()),openWorldHint:e.z.optional(e.z.boolean())}).passthrough(),qe=ae.extend({description:e.z.optional(e.z.string()),inputSchema:e.z.object({type:e.z.literal("object"),properties:e.z.optional(e.z.object({}).passthrough()),required:e.z.optional(e.z.array(e.z.string()))}).passthrough(),outputSchema:e.z.optional(e.z.object({type:e.z.literal("object"),properties:e.z.optional(e.z.object({}).passthrough()),required:e.z.optional(e.z.array(e.z.string()))}).passthrough()),annotations:e.z.optional(Me),_meta:e.z.optional(e.z.object({}).passthrough())}),He=ue.extend({method:e.z.literal("tools/list")}),Ge=me.extend({tools:e.z.array(qe)}),We=G.extend({content:e.z.array(Ue).default([]),structuredContent:e.z.object({}).passthrough().optional(),isError:e.z.optional(e.z.boolean())});We.or(G.extend({toolResult:e.z.unknown()}));const Ke=M.extend({method:e.z.literal("tools/call"),params:B.extend({name:e.z.string(),arguments:e.z.optional(e.z.record(e.z.unknown()))})}),Ye=H.extend({method:e.z.literal("notifications/tools/list_changed")}),Qe=e.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Je=M.extend({method:e.z.literal("logging/setLevel"),params:B.extend({level:Qe})}),Xe=H.extend({method:e.z.literal("notifications/message"),params:q.extend({level:Qe,logger:e.z.optional(e.z.string()),data:e.z.unknown()})}),Ze=e.z.object({name:e.z.string().optional()}).passthrough(),et=e.z.object({hints:e.z.optional(e.z.array(Ze)),costPriority:e.z.optional(e.z.number().min(0).max(1)),speedPriority:e.z.optional(e.z.number().min(0).max(1)),intelligencePriority:e.z.optional(e.z.number().min(0).max(1))}).passthrough(),tt=e.z.object({role:e.z.enum(["user","assistant"]),content:e.z.union([Pe,$e,Le])}).passthrough(),at=M.extend({method:e.z.literal("sampling/createMessage"),params:B.extend({messages:e.z.array(tt),systemPrompt:e.z.optional(e.z.string()),includeContext:e.z.optional(e.z.enum(["none","thisServer","allServers"])),temperature:e.z.optional(e.z.number()),maxTokens:e.z.number().int(),stopSequences:e.z.optional(e.z.array(e.z.string())),metadata:e.z.optional(e.z.object({}).passthrough()),modelPreferences:e.z.optional(et)})}),it=G.extend({model:e.z.string(),stopReason:e.z.optional(e.z.enum(["endTurn","stopSequence","maxTokens"]).or(e.z.string())),role:e.z.enum(["user","assistant"]),content:e.z.discriminatedUnion("type",[Pe,$e,Le])}),nt=e.z.object({type:e.z.literal("boolean"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),default:e.z.optional(e.z.boolean())}).passthrough(),ot=e.z.object({type:e.z.literal("string"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),minLength:e.z.optional(e.z.number()),maxLength:e.z.optional(e.z.number()),format:e.z.optional(e.z.enum(["email","uri","date","date-time"]))}).passthrough(),rt=e.z.object({type:e.z.enum(["number","integer"]),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),minimum:e.z.optional(e.z.number()),maximum:e.z.optional(e.z.number())}).passthrough(),st=e.z.object({type:e.z.literal("string"),title:e.z.optional(e.z.string()),description:e.z.optional(e.z.string()),enum:e.z.array(e.z.string()),enumNames:e.z.optional(e.z.array(e.z.string()))}).passthrough(),pt=e.z.union([nt,ot,rt,st]),dt=M.extend({method:e.z.literal("elicitation/create"),params:B.extend({message:e.z.string(),requestedSchema:e.z.object({type:e.z.literal("object"),properties:e.z.record(e.z.string(),pt),required:e.z.optional(e.z.array(e.z.string()))}).passthrough()})}),lt=G.extend({action:e.z.enum(["accept","reject","cancel"]),content:e.z.optional(e.z.record(e.z.string(),e.z.unknown()))}),ct=e.z.object({type:e.z.literal("ref/resource"),uri:e.z.string()}).passthrough(),ut=e.z.object({type:e.z.literal("ref/prompt"),name:e.z.string()}).passthrough(),mt=M.extend({method:e.z.literal("completion/complete"),params:B.extend({ref:e.z.union([ut,ct]),argument:e.z.object({name:e.z.string(),value:e.z.string()}).passthrough(),context:e.z.optional(e.z.object({arguments:e.z.optional(e.z.record(e.z.string(),e.z.string()))}))})}),ht=G.extend({completion:e.z.object({values:e.z.array(e.z.string()).max(100),total:e.z.optional(e.z.number().int()),hasMore:e.z.optional(e.z.boolean())}).passthrough()}),ft=e.z.object({uri:e.z.string().startsWith("file://"),name:e.z.optional(e.z.string()),_meta:e.z.optional(e.z.object({}).passthrough())}).passthrough(),vt=M.extend({method:e.z.literal("roots/list")}),gt=G.extend({roots:e.z.array(ft)}),yt=H.extend({method:e.z.literal("notifications/roots/list_changed")});e.z.union([de,oe,mt,Je,Ce,Re,be,we,Te,Se,Ne,Ke,He]),e.z.union([te,ce,pe,yt]),e.z.union([ee,it,lt,gt]),e.z.union([de,at,dt,vt]),e.z.union([te,ce,Xe,Ae,Ie,Ye,Be]),e.z.union([ee,se,ht,ze,ke,_e,Ee,xe,We,Ge]);class bt extends Error{constructor(e,t,a){super(`MCP error ${e}: ${t}`),this.code=e,this.data=a,this.name="McpError"}}class _t{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(te,(e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)})),this.setNotificationHandler(ce,(e=>{this._onprogress(e)})),this.setRequestHandler(de,(e=>({})))}_setupTimeout(e,t,a,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:a,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const a=Date.now()-t.startTime;if(t.maxTotalTimeout&&a>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new bt(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:a});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,a,i;this._transport=e;const n=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==n||n(),this._onclose()};const o=null===(a=this.transport)||void 0===a?void 0:a.onerror;this._transport.onerror=e=>{null==o||o(e),this._onerror(e)};const r=null===(i=this._transport)||void 0===i?void 0:i.onmessage;this._transport.onmessage=(e,t)=>{var a;null==r||r(e,t),J(e)||(a=e,Z.safeParse(a).success)?this._onresponse(e):(e=>K.safeParse(e).success)(e)?this._onrequest(e,t):(e=>Y.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const a=new bt(X.ConnectionClosed,"Connection closed");for(const e of t.values())e(a)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const a=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==a&&Promise.resolve().then((()=>a(e))).catch((e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`))))}_onrequest(e,t){var a,i,n,o;const r=null!==(a=this._requestHandlers.get(e.method))&&void 0!==a?a:this.fallbackRequestHandler;if(void 0===r)return void(null===(i=this._transport)||void 0===i||i.send({jsonrpc:"2.0",id:e.id,error:{code:X.MethodNotFound,message:"Method not found"}}).catch((e=>this._onerror(new Error(`Failed to send an error response: ${e}`)))));const s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);const p={signal:s.signal,sessionId:null===(n=this._transport)||void 0===n?void 0:n.sessionId,_meta:null===(o=e.params)||void 0===o?void 0:o._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,a,i)=>this.request(t,a,{...i,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo};Promise.resolve().then((()=>r(e,p))).then((t=>{var a;if(!s.signal.aborted)return null===(a=this._transport)||void 0===a?void 0:a.send({result:t,jsonrpc:"2.0",id:e.id})}),(t=>{var a,i;if(!s.signal.aborted)return null===(a=this._transport)||void 0===a?void 0:a.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:X.InternalError,message:null!==(i=t.message)&&void 0!==i?i:"Internal error"}})})).catch((e=>this._onerror(new Error(`Failed to send response: ${e}`)))).finally((()=>{this._requestHandlerAbortControllers.delete(e.id)}))}_onprogress(e){const{progressToken:t,...a}=e.params,i=Number(t),n=this._progressHandlers.get(i);if(!n)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const o=this._responseHandlers.get(i),r=this._timeoutInfo.get(i);if(r&&o&&r.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(e){return void o(e)}n(a)}_onresponse(e){const t=Number(e.id),a=this._responseHandlers.get(t);if(void 0!==a)if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),J(e))a(e);else{a(new bt(e.error.code,e.error.message,e.error.data))}else this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,a){const{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}=null!=a?a:{};return new Promise(((r,s)=>{var p,d,l,c,u,m;if(!this._transport)return void s(new Error("Not connected"));!0===(null===(p=this._options)||void 0===p?void 0:p.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(d=null==a?void 0:a.signal)||void 0===d||d.throwIfAborted();const h=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:h};(null==a?void 0:a.onprogress)&&(this._progressHandlers.set(h,a.onprogress),f.params={...e.params,_meta:{...(null===(l=e.params)||void 0===l?void 0:l._meta)||{},progressToken:h}});const v=e=>{var t;this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(e)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)))),s(e)};this._responseHandlers.set(h,(e=>{var i;if(!(null===(i=null==a?void 0:a.signal)||void 0===i?void 0:i.aborted)){if(e instanceof Error)return s(e);try{const a=t.parse(e.result);r(a)}catch(e){s(e)}}})),null===(c=null==a?void 0:a.signal)||void 0===c||c.addEventListener("abort",(()=>{var e;v(null===(e=null==a?void 0:a.signal)||void 0===e?void 0:e.reason)}));const g=null!==(u=null==a?void 0:a.timeout)&&void 0!==u?u:6e4;this._setupTimeout(h,g,null==a?void 0:a.maxTotalTimeout,(()=>v(new bt(X.RequestTimeout,"Request timed out",{timeout:g}))),null!==(m=null==a?void 0:a.resetTimeoutOnProgress)&&void 0!==m&&m),this._transport.send(f,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((e=>{this._cleanupTimeout(h),s(e)}))}))}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const a={...e,jsonrpc:"2.0"};await this._transport.send(a,t)}setRequestHandler(e,t){const a=e.shape.method.value;this.assertRequestHandlerCapability(a),this._requestHandlers.set(a,((a,i)=>Promise.resolve(t(e.parse(a),i))))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,(a=>Promise.resolve(t(e.parse(a)))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Et(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var a=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};a.prototype=t.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),a}var Tt={exports:{}};
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */!function(e){function t(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];if(t.length>1){t[0]=t[0].slice(0,-1);for(var i=t.length-1,n=1;n<i;++n)t[n]=t[n].slice(1,-1);return t[i]=t[i].slice(1),t.join("")}return t[0]}function a(e){return"(?:"+e+")"}function i(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function n(e){return e.toUpperCase()}function o(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function r(e,t){var a=e;if(t)for(var i in t)a[i]=t[i];return a}function s(e){var i="[A-Za-z]",n="[0-9]",o=t(n,"[A-Fa-f]"),r=a(a("%[EFef]"+o+"%"+o+o+"%"+o+o)+"|"+a("%[89A-Fa-f]"+o+"%"+o+o)+"|"+a("%"+o+o)),s="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",p=t("[\\:\\/\\?\\#\\[\\]\\@]",s),d=e?"[\\uE000-\\uF8FF]":"[]",l=t(i,n,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");a(i+t(i,n,"[\\+\\-\\.]")+"*"),a(a(r+"|"+t(l,s,"[\\:]"))+"*");var c=a(a("25[0-5]")+"|"+a("2[0-4]"+n)+"|"+a("1"+n+n)+"|"+a("0?[1-9]"+n)+"|0?0?"+n),u=a(c+"\\."+c+"\\."+c+"\\."+c),m=a(o+"{1,4}"),h=a(a(m+"\\:"+m)+"|"+u),f=a(a(m+"\\:")+"{6}"+h),v=a("\\:\\:"+a(m+"\\:")+"{5}"+h),g=a(a(m)+"?\\:\\:"+a(m+"\\:")+"{4}"+h),y=a(a(a(m+"\\:")+"{0,1}"+m)+"?\\:\\:"+a(m+"\\:")+"{3}"+h),b=a(a(a(m+"\\:")+"{0,2}"+m)+"?\\:\\:"+a(m+"\\:")+"{2}"+h),_=a(a(a(m+"\\:")+"{0,3}"+m)+"?\\:\\:"+m+"\\:"+h),w=a(a(a(m+"\\:")+"{0,4}"+m)+"?\\:\\:"+h),E=a(a(a(m+"\\:")+"{0,5}"+m)+"?\\:\\:"+m),T=a(a(a(m+"\\:")+"{0,6}"+m)+"?\\:\\:"),x=a([f,v,g,y,b,_,w,E,T].join("|")),I=a(a(l+"|"+r)+"+");a("[vV]"+o+"+\\."+t(l,s,"[\\:]")+"+"),a(a(r+"|"+t(l,s))+"*");var S=a(r+"|"+t(l,s,"[\\:\\@]"));return a(a(r+"|"+t(l,s,"[\\@]"))+"+"),a(a(S+"|"+t("[\\/\\?]",d))+"*"),{NOT_SCHEME:new RegExp(t("[^]",i,n,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",l,s),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",l,s),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",l,s),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",l,s),"g"),NOT_QUERY:new RegExp(t("[^\\%]",l,s,"[\\:\\@\\/\\?]",d),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",l,s,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",l,s),"g"),UNRESERVED:new RegExp(l,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",l,p),"g"),PCT_ENCODED:new RegExp(r,"g"),IPV4ADDRESS:new RegExp("^("+u+")$"),IPV6ADDRESS:new RegExp("^\\[?("+x+")"+a(a("\\%25|\\%(?!"+o+"{2})")+"("+I+")")+"?\\]?$")}}var p=s(!1),d=s(!0),l=function(){function e(e,t){var a=[],i=!0,n=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(i=(r=s.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){n=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(n)throw o}}return a}return function(t,a){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)},u=2147483647,m=36,h=1,f=26,v=38,g=700,y=72,b=128,_="-",w=/^xn--/,E=/[^\0-\x7E]/,T=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=m-h,S=Math.floor,N=String.fromCharCode;function A(e){throw new RangeError(x[e])}function D(e,t){for(var a=[],i=e.length;i--;)a[i]=t(e[i]);return a}function O(e,t){var a=e.split("@"),i="";return a.length>1&&(i=a[0]+"@",e=a[1]),i+D((e=e.replace(T,".")).split("."),t).join(".")}function R(e){for(var t=[],a=0,i=e.length;a<i;){var n=e.charCodeAt(a++);if(n>=55296&&n<=56319&&a<i){var o=e.charCodeAt(a++);56320==(64512&o)?t.push(((1023&n)<<10)+(1023&o)+65536):(t.push(n),a--)}else t.push(n)}return t}var k=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:m},C=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},P=function(e,t,a){var i=0;for(e=a?S(e/g):e>>1,e+=S(e/t);e>I*f>>1;i+=m)e=S(e/I);return S(i+(I+1)*e/(e+v))},$=function(e){var t=[],a=e.length,i=0,n=b,o=y,r=e.lastIndexOf(_);r<0&&(r=0);for(var s=0;s<r;++s)e.charCodeAt(s)>=128&&A("not-basic"),t.push(e.charCodeAt(s));for(var p=r>0?r+1:0;p<a;){for(var d=i,l=1,c=m;;c+=m){p>=a&&A("invalid-input");var v=k(e.charCodeAt(p++));(v>=m||v>S((u-i)/l))&&A("overflow"),i+=v*l;var g=c<=o?h:c>=o+f?f:c-o;if(v<g)break;var w=m-g;l>S(u/w)&&A("overflow"),l*=w}var E=t.length+1;o=P(i-d,E,0==d),S(i/E)>u-n&&A("overflow"),n+=S(i/E),i%=E,t.splice(i++,0,n)}return String.fromCodePoint.apply(String,t)},L=function(e){var t=[],a=(e=R(e)).length,i=b,n=0,o=y,r=!0,s=!1,p=void 0;try{for(var d,l=e[Symbol.iterator]();!(r=(d=l.next()).done);r=!0){var c=d.value;c<128&&t.push(N(c))}}catch(e){s=!0,p=e}finally{try{!r&&l.return&&l.return()}finally{if(s)throw p}}var v=t.length,g=v;for(v&&t.push(_);g<a;){var w=u,E=!0,T=!1,x=void 0;try{for(var I,D=e[Symbol.iterator]();!(E=(I=D.next()).done);E=!0){var O=I.value;O>=i&&O<w&&(w=O)}}catch(e){T=!0,x=e}finally{try{!E&&D.return&&D.return()}finally{if(T)throw x}}var k=g+1;w-i>S((u-n)/k)&&A("overflow"),n+=(w-i)*k,i=w;var $=!0,L=!1,F=void 0;try{for(var j,U=e[Symbol.iterator]();!($=(j=U.next()).done);$=!0){var V=j.value;if(V<i&&++n>u&&A("overflow"),V==i){for(var z=n,B=m;;B+=m){var M=B<=o?h:B>=o+f?f:B-o;if(z<M)break;var q=z-M,H=m-M;t.push(N(C(M+q%H,0))),z=S(q/H)}t.push(N(C(z,0))),o=P(n,k,g==v),n=0,++g}}}catch(e){L=!0,F=e}finally{try{!$&&U.return&&U.return()}finally{if(L)throw F}}++n,++i}return t.join("")},F=function(e){return O(e,(function(e){return w.test(e)?$(e.slice(4).toLowerCase()):e}))},j=function(e){return O(e,(function(e){return E.test(e)?"xn--"+L(e):e}))},U={version:"2.1.0",ucs2:{decode:R,encode:function(e){return String.fromCodePoint.apply(String,c(e))}},decode:$,encode:L,toASCII:j,toUnicode:F},V={};function z(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function B(e){for(var t="",a=0,i=e.length;a<i;){var n=parseInt(e.substr(a+1,2),16);if(n<128)t+=String.fromCharCode(n),a+=3;else if(n>=194&&n<224){if(i-a>=6){var o=parseInt(e.substr(a+4,2),16);t+=String.fromCharCode((31&n)<<6|63&o)}else t+=e.substr(a,6);a+=6}else if(n>=224){if(i-a>=9){var r=parseInt(e.substr(a+4,2),16),s=parseInt(e.substr(a+7,2),16);t+=String.fromCharCode((15&n)<<12|(63&r)<<6|63&s)}else t+=e.substr(a,9);a+=9}else t+=e.substr(a,3),a+=3}return t}function M(e,t){function a(e){var a=B(e);return a.match(t.UNRESERVED)?a:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,a).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,a).replace(t.NOT_USERINFO,z).replace(t.PCT_ENCODED,n)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,a).toLowerCase().replace(t.NOT_HOST,z).replace(t.PCT_ENCODED,n)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,a).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,z).replace(t.PCT_ENCODED,n)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,a).replace(t.NOT_QUERY,z).replace(t.PCT_ENCODED,n)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,a).replace(t.NOT_FRAGMENT,z).replace(t.PCT_ENCODED,n)),e}function q(e){return e.replace(/^0*(.*)/,"$1")||"0"}function H(e,t){var a=e.match(t.IPV4ADDRESS)||[],i=l(a,2)[1];return i?i.split(".").map(q).join("."):e}function G(e,t){var a=e.match(t.IPV6ADDRESS)||[],i=l(a,3),n=i[1],o=i[2];if(n){for(var r=n.toLowerCase().split("::").reverse(),s=l(r,2),p=s[0],d=s[1],c=d?d.split(":").map(q):[],u=p.split(":").map(q),m=t.IPV4ADDRESS.test(u[u.length-1]),h=m?7:8,f=u.length-h,v=Array(h),g=0;g<h;++g)v[g]=c[g]||u[f+g]||"";m&&(v[h-1]=H(v[h-1],t));var y=v.reduce((function(e,t,a){if(!t||"0"===t){var i=e[e.length-1];i&&i.index+i.length===a?i.length++:e.push({index:a,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(y&&y.length>1){var _=v.slice(0,y.index),w=v.slice(y.index+y.length);b=_.join(":")+"::"+w.join(":")}else b=v.join(":");return o&&(b+="%"+o),b}return e}var W=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,K=void 0==="".match(/(){0}/)[1];function Y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a={},i=!1!==t.iri?d:p;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var n=e.match(W);if(n){K?(a.scheme=n[1],a.userinfo=n[3],a.host=n[4],a.port=parseInt(n[5],10),a.path=n[6]||"",a.query=n[7],a.fragment=n[8],isNaN(a.port)&&(a.port=n[5])):(a.scheme=n[1]||void 0,a.userinfo=-1!==e.indexOf("@")?n[3]:void 0,a.host=-1!==e.indexOf("//")?n[4]:void 0,a.port=parseInt(n[5],10),a.path=n[6]||"",a.query=-1!==e.indexOf("?")?n[7]:void 0,a.fragment=-1!==e.indexOf("#")?n[8]:void 0,isNaN(a.port)&&(a.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?n[4]:void 0)),a.host&&(a.host=G(H(a.host,i),i)),void 0!==a.scheme||void 0!==a.userinfo||void 0!==a.host||void 0!==a.port||a.path||void 0!==a.query?void 0===a.scheme?a.reference="relative":void 0===a.fragment?a.reference="absolute":a.reference="uri":a.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==a.reference&&(a.error=a.error||"URI is not a "+t.reference+" reference.");var o=V[(t.scheme||a.scheme||"").toLowerCase()];if(t.unicodeSupport||o&&o.unicodeSupport)M(a,i);else{if(a.host&&(t.domainHost||o&&o.domainHost))try{a.host=U.toASCII(a.host.replace(i.PCT_ENCODED,B).toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII via punycode: "+e}M(a,p)}o&&o.parse&&o.parse(a,t)}else a.error=a.error||"URI can not be parsed.";return a}function Q(e,t){var a=!1!==t.iri?d:p,i=[];return void 0!==e.userinfo&&(i.push(e.userinfo),i.push("@")),void 0!==e.host&&i.push(G(H(String(e.host),a),a).replace(a.IPV6ADDRESS,(function(e,t,a){return"["+t+(a?"%25"+a:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(i.push(":"),i.push(String(e.port))),i.length?i.join(""):void 0}var J=/^\.\.?\//,X=/^\/\.(\/|$)/,Z=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(J))e=e.replace(J,"");else if(e.match(X))e=e.replace(X,"/");else if(e.match(Z))e=e.replace(Z,"/"),t.pop();else if("."===e||".."===e)e="";else{var a=e.match(ee);if(!a)throw new Error("Unexpected dot segment condition");var i=a[0];e=e.slice(i.length),t.push(i)}return t.join("")}function ae(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=t.iri?d:p,i=[],n=V[(t.scheme||e.scheme||"").toLowerCase()];if(n&&n.serialize&&n.serialize(e,t),e.host)if(a.IPV6ADDRESS.test(e.host));else if(t.domainHost||n&&n.domainHost)try{e.host=t.iri?U.toUnicode(e.host):U.toASCII(e.host.replace(a.PCT_ENCODED,B).toLowerCase())}catch(a){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+a}M(e,a),"suffix"!==t.reference&&e.scheme&&(i.push(e.scheme),i.push(":"));var o=Q(e,t);if(void 0!==o&&("suffix"!==t.reference&&i.push("//"),i.push(o),e.path&&"/"!==e.path.charAt(0)&&i.push("/")),void 0!==e.path){var r=e.path;t.absolutePath||n&&n.absolutePath||(r=te(r)),void 0===o&&(r=r.replace(/^\/\//,"/%2F")),i.push(r)}return void 0!==e.query&&(i.push("?"),i.push(e.query)),void 0!==e.fragment&&(i.push("#"),i.push(e.fragment)),i.join("")}function ie(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i={};return arguments[3]||(e=Y(ae(e,a),a),t=Y(ae(t,a),a)),!(a=a||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=te(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=te(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function ne(e,t,a){var i=r({scheme:"null"},a);return ae(ie(Y(e,i),Y(t,i),i,!0),i)}function oe(e,t){return"string"==typeof e?e=ae(Y(e,t),t):"object"===i(e)&&(e=Y(ae(e,t),t)),e}function re(e,t,a){return"string"==typeof e?e=ae(Y(e,a),a):"object"===i(e)&&(e=ae(e,a)),"string"==typeof t?t=ae(Y(t,a),a):"object"===i(t)&&(t=ae(t,a)),e===t}function se(e,t){return e&&e.toString().replace(t&&t.iri?d.ESCAPE:p.ESCAPE,z)}function pe(e,t){return e&&e.toString().replace(t&&t.iri?d.PCT_ENCODED:p.PCT_ENCODED,B)}var de={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var a="https"===String(e.scheme).toLowerCase();return e.port!==(a?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},le={scheme:"https",domainHost:de.domainHost,parse:de.parse,serialize:de.serialize};function ce(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var ue={scheme:"ws",domainHost:!0,parse:function(e,t){var a=e;return a.secure=ce(a),a.resourceName=(a.path||"/")+(a.query?"?"+a.query:""),a.path=void 0,a.query=void 0,a},serialize:function(e,t){if(e.port!==(ce(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var a=e.resourceName.split("?"),i=l(a,2),n=i[0],o=i[1];e.path=n&&"/"!==n?n:void 0,e.query=o,e.resourceName=void 0}return e.fragment=void 0,e}},me={scheme:"wss",domainHost:ue.domainHost,parse:ue.parse,serialize:ue.serialize},he={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ve="[0-9A-Fa-f]",ge=a(a("%[EFef]"+ve+"%"+ve+ve+"%"+ve+ve)+"|"+a("%[89A-Fa-f]"+ve+"%"+ve+ve)+"|"+a("%"+ve+ve)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",be=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),_e="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",we=new RegExp(fe,"g"),Ee=new RegExp(ge,"g"),Te=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',be),"g"),xe=new RegExp(t("[^]",fe,_e),"g"),Ie=xe;function Se(e){var t=B(e);return t.match(we)?t:e}var Ne={scheme:"mailto",parse:function(e,t){var a=e,i=a.to=a.path?a.path.split(","):[];if(a.path=void 0,a.query){for(var n=!1,o={},r=a.query.split("&"),s=0,p=r.length;s<p;++s){var d=r[s].split("=");switch(d[0]){case"to":for(var l=d[1].split(","),c=0,u=l.length;c<u;++c)i.push(l[c]);break;case"subject":a.subject=pe(d[1],t);break;case"body":a.body=pe(d[1],t);break;default:n=!0,o[pe(d[0],t)]=pe(d[1],t)}}n&&(a.headers=o)}a.query=void 0;for(var m=0,h=i.length;m<h;++m){var f=i[m].split("@");if(f[0]=pe(f[0]),t.unicodeSupport)f[1]=pe(f[1],t).toLowerCase();else try{f[1]=U.toASCII(pe(f[1],t).toLowerCase())}catch(e){a.error=a.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}i[m]=f.join("@")}return a},serialize:function(e,t){var a=e,i=o(e.to);if(i){for(var r=0,s=i.length;r<s;++r){var p=String(i[r]),d=p.lastIndexOf("@"),l=p.slice(0,d).replace(Ee,Se).replace(Ee,n).replace(Te,z),c=p.slice(d+1);try{c=t.iri?U.toUnicode(c):U.toASCII(pe(c,t).toLowerCase())}catch(e){a.error=a.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[r]=l+"@"+c}a.path=i.join(",")}var u=e.headers=e.headers||{};e.subject&&(u.subject=e.subject),e.body&&(u.body=e.body);var m=[];for(var h in u)u[h]!==he[h]&&m.push(h.replace(Ee,Se).replace(Ee,n).replace(xe,z)+"="+u[h].replace(Ee,Se).replace(Ee,n).replace(Ie,z));return m.length&&(a.query=m.join("&")),a}},Ae=/^([^\:]+)\:(.*)/,De={scheme:"urn",parse:function(e,t){var a=e.path&&e.path.match(Ae),i=e;if(a){var n=t.scheme||i.scheme||"urn",o=a[1].toLowerCase(),r=a[2],s=n+":"+(t.nid||o),p=V[s];i.nid=o,i.nss=r,i.path=void 0,p&&(i=p.parse(i,t))}else i.error=i.error||"URN can not be parsed.";return i},serialize:function(e,t){var a=t.scheme||e.scheme||"urn",i=e.nid,n=a+":"+(t.nid||i),o=V[n];o&&(e=o.serialize(e,t));var r=e,s=e.nss;return r.path=(i||t.nid)+":"+s,r}},Oe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Re={scheme:"urn:uuid",parse:function(e,t){var a=e;return a.uuid=a.nss,a.nss=void 0,t.tolerant||a.uuid&&a.uuid.match(Oe)||(a.error=a.error||"UUID is not valid."),a},serialize:function(e,t){var a=e;return a.nss=(e.uuid||"").toLowerCase(),a}};V[de.scheme]=de,V[le.scheme]=le,V[ue.scheme]=ue,V[me.scheme]=me,V[Ne.scheme]=Ne,V[De.scheme]=De,V[Re.scheme]=Re,e.SCHEMES=V,e.pctEncChar=z,e.pctDecChars=B,e.parse=Y,e.removeDotSegments=te,e.serialize=ae,e.resolveComponents=ie,e.resolve=ne,e.normalize=oe,e.equal=re,e.escapeComponent=se,e.unescapeComponent=pe,Object.defineProperty(e,"__esModule",{value:!0})}(Tt.exports);var xt=Tt.exports,It=function e(t,a){if(t===a)return!0;if(t&&a&&"object"==typeof t&&"object"==typeof a){if(t.constructor!==a.constructor)return!1;var i,n,o;if(Array.isArray(t)){if((i=t.length)!=a.length)return!1;for(n=i;0!=n--;)if(!e(t[n],a[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===a.source&&t.flags===a.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===a.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===a.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(a).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(a,o[n]))return!1;for(n=i;0!=n--;){var r=o[n];if(!e(t[r],a[r]))return!1}return!0}return t!=t&&a!=a},St={copy:function(e,t){for(var a in t=t||{},e)t[a]=e[a];return t},checkDataType:Nt,checkDataTypes:function(e,t,a){if(1===e.length)return Nt(e[0],t,a,!0);var i="",n=Dt(e);for(var o in n.array&&n.object&&(i=n.null?"(":"(!"+t+" || ",i+="typeof "+t+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer,n)i+=(i?" && ":"")+Nt(o,t,a,!0);return i},coerceToTypes:function(e,t){if(Array.isArray(t)){for(var a=[],i=0;i<t.length;i++){var n=t[i];(At[n]||"array"===e&&"array"===n)&&(a[a.length]=n)}if(a.length)return a}else{if(At[t])return[t];if("array"===e&&"array"===t)return["array"]}},toHash:Dt,getProperty:kt,escapeQuotes:Ct,equal:It,ucs2length:function(e){for(var t,a=0,i=e.length,n=0;n<i;)a++,(t=e.charCodeAt(n++))>=55296&&t<=56319&&n<i&&56320==(64512&(t=e.charCodeAt(n)))&&n++;return a},varOccurences:function(e,t){t+="[^0-9]";var a=e.match(new RegExp(t,"g"));return a?a.length:0},varReplace:function(e,t,a){return t+="([^0-9])",a=a.replace(/\$/g,"$$$$"),e.replace(new RegExp(t,"g"),a+"$1")},schemaHasRules:function(e,t){if("boolean"==typeof e)return!e;for(var a in e)if(t[a])return!0},schemaHasRulesExcept:function(e,t,a){if("boolean"==typeof e)return!e&&"not"!=a;for(var i in e)if(i!=a&&t[i])return!0},schemaUnknownRules:function(e,t){if("boolean"==typeof e)return;for(var a in e)if(!t[a])return a},toQuotedString:Pt,getPathExpr:function(e,t,a,i){var n=a?"'/' + "+t+(i?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):i?"'[' + "+t+" + ']'":"'[\\'' + "+t+" + '\\']'";return Ft(e,n)},getPath:function(e,t,a){var i=Pt(a?"/"+jt(t):kt(t));return Ft(e,i)},getData:function(e,t,a){var i,n,o,r;if(""===e)return"rootData";if("/"==e[0]){if(!$t.test(e))throw new Error("Invalid JSON-pointer: "+e);n=e,o="rootData"}else{if(!(r=e.match(Lt)))throw new Error("Invalid JSON-pointer: "+e);if(i=+r[1],"#"==(n=r[2])){if(i>=t)throw new Error("Cannot access property/index "+i+" levels up, current level is "+t);return a[t-i]}if(i>t)throw new Error("Cannot access data "+i+" levels up, current level is "+t);if(o="data"+(t-i||""),!n)return o}for(var s=o,p=n.split("/"),d=0;d<p.length;d++){var l=p[d];l&&(s+=" && "+(o+=kt(Ut(l))))}return s},unescapeFragment:function(e){return Ut(decodeURIComponent(e))},unescapeJsonPointer:Ut,escapeFragment:function(e){return encodeURIComponent(jt(e))},escapeJsonPointer:jt};function Nt(e,t,a,i){var n=i?" !== ":" === ",o=i?" || ":" && ",r=i?"!":"",s=i?"":"!";switch(e){case"null":return t+n+"null";case"array":return r+"Array.isArray("+t+")";case"object":return"("+r+t+o+"typeof "+t+n+'"object"'+o+s+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+n+'"number"'+o+s+"("+t+" % 1)"+o+t+n+t+(a?o+r+"isFinite("+t+")":"")+")";case"number":return"(typeof "+t+n+'"'+e+'"'+(a?o+r+"isFinite("+t+")":"")+")";default:return"typeof "+t+n+'"'+e+'"'}}var At=Dt(["string","number","integer","boolean","null"]);function Dt(e){for(var t={},a=0;a<e.length;a++)t[e[a]]=!0;return t}var Ot=/^[a-z$_][a-z$_0-9]*$/i,Rt=/'|\\/g;function kt(e){return"number"==typeof e?"["+e+"]":Ot.test(e)?"."+e:"['"+Ct(e)+"']"}function Ct(e){return e.replace(Rt,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Pt(e){return"'"+Ct(e)+"'"}var $t=/^\/(?:[^~]|~0|~1)*$/,Lt=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ft(e,t){return'""'==e?t:(e+" + "+t).replace(/([^\\])' \+ '/g,"$1")}function jt(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ut(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var Vt=St,zt=function(e){Vt.copy(e,this)};var Bt={exports:{}},Mt=Bt.exports=function(e,t,a){"function"==typeof t&&(a=t,t={}),qt(t,"function"==typeof(a=t.cb||a)?a:a.pre||function(){},a.post||function(){},e,"",e)};function qt(e,t,a,i,n,o,r,s,p,d){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var l in t(i,n,o,r,s,p,d),i){var c=i[l];if(Array.isArray(c)){if(l in Mt.arrayKeywords)for(var u=0;u<c.length;u++)qt(e,t,a,c[u],n+"/"+l+"/"+u,o,n,l,i,u)}else if(l in Mt.propsKeywords){if(c&&"object"==typeof c)for(var m in c)qt(e,t,a,c[m],n+"/"+l+"/"+m.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,l,i,m)}else(l in Mt.keywords||e.allKeys&&!(l in Mt.skipKeywords))&&qt(e,t,a,c,n+"/"+l,o,n,l,i)}a(i,n,o,r,s,p,d)}}Mt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},Mt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Mt.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Mt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};var Ht=Bt.exports,Gt=xt,Wt=It,Kt=St,Yt=zt,Qt=Ht,Jt=Xt;function Xt(e,t,a){var i=this._refs[a];if("string"==typeof i){if(!this._refs[i])return Xt.call(this,e,t,i);i=this._refs[i]}if((i=i||this._schemas[a])instanceof Yt)return na(i.schema,this._opts.inlineRefs)?i.schema:i.validate||this._compile(i);var n,o,r,s=Zt.call(this,t,a);return s&&(n=s.schema,t=s.root,r=s.baseId),n instanceof Yt?o=n.validate||e.call(this,n.schema,t,void 0,r):void 0!==n&&(o=na(n,this._opts.inlineRefs)?n:e.call(this,n,t,void 0,r)),o}function Zt(e,t){var a=Gt.parse(t),i=pa(a),n=sa(this._getId(e.schema));if(0===Object.keys(e.schema).length||i!==n){var o=la(i),r=this._refs[o];if("string"==typeof r)return ea.call(this,e,r,a);if(r instanceof Yt)r.validate||this._compile(r),e=r;else{if(!((r=this._schemas[o])instanceof Yt))return;if(r.validate||this._compile(r),o==la(t))return{schema:r,root:e,baseId:n};e=r}if(!e.schema)return;n=sa(this._getId(e.schema))}return aa.call(this,a,n,e.schema,e)}function ea(e,t,a){var i=Zt.call(this,e,t);if(i){var n=i.schema,o=i.baseId;e=i.root;var r=this._getId(n);return r&&(o=ca(o,r)),aa.call(this,a,o,n,e)}}Xt.normalizeId=la,Xt.fullPath=sa,Xt.url=ca,Xt.ids=function(e){var t=la(this._getId(e)),a={"":t},i={"":sa(t,!1)},n={},o=this;return Qt(e,{allKeys:!0},(function(e,t,r,s,p,d,l){if(""!==t){var c=o._getId(e),u=a[s],m=i[s]+"/"+p;if(void 0!==l&&(m+="/"+("number"==typeof l?l:Kt.escapeFragment(l))),"string"==typeof c){c=u=la(u?Gt.resolve(u,c):c);var h=o._refs[c];if("string"==typeof h&&(h=o._refs[h]),h&&h.schema){if(!Wt(e,h.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=la(m))if("#"==c[0]){if(n[c]&&!Wt(e,n[c]))throw new Error('id "'+c+'" resolves to more than one schema');n[c]=e}else o._refs[c]=m}a[t]=u,i[t]=m}})),n},Xt.inlineRef=na,Xt.schema=Zt;var ta=Kt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function aa(e,t,a,i){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var n=e.fragment.split("/"),o=1;o<n.length;o++){var r=n[o];if(r){if(void 0===(a=a[r=Kt.unescapeFragment(r)]))break;var s;if(!ta[r]&&((s=this._getId(a))&&(t=ca(t,s)),a.$ref)){var p=ca(t,a.$ref),d=Zt.call(this,i,p);d&&(a=d.schema,i=d.root,t=d.baseId)}}}return void 0!==a&&a!==i.schema?{schema:a,root:i,baseId:t}:void 0}}var ia=Kt.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function na(e,t){return!1!==t&&(void 0===t||!0===t?oa(e):t?ra(e)<=t:void 0)}function oa(e){var t;if(Array.isArray(e)){for(var a=0;a<e.length;a++)if("object"==typeof(t=e[a])&&!oa(t))return!1}else for(var i in e){if("$ref"==i)return!1;if("object"==typeof(t=e[i])&&!oa(t))return!1}return!0}function ra(e){var t,a=0;if(Array.isArray(e)){for(var i=0;i<e.length;i++)if("object"==typeof(t=e[i])&&(a+=ra(t)),a==1/0)return 1/0}else for(var n in e){if("$ref"==n)return 1/0;if(ia[n])a++;else if("object"==typeof(t=e[n])&&(a+=ra(t)+1),a==1/0)return 1/0}return a}function sa(e,t){return!1!==t&&(e=la(e)),pa(Gt.parse(e))}function pa(e){return Gt.serialize(e).split("#")[0]+"#"}var da=/#\/?$/;function la(e){return e?e.replace(da,""):""}function ca(e,t){return t=la(t),Gt.resolve(e,t)}var ua=Jt,ma={Validation:fa((function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0})),MissingRef:fa(ha)};function ha(e,t,a){this.message=a||ha.message(e,t),this.missingRef=ua.url(e,t),this.missingSchema=ua.normalizeId(ua.fullPath(this.missingRef))}function fa(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}ha.message=function(e,t){return"can't resolve reference "+t+" from id "+e};var va=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var a,i="boolean"==typeof t.cycles&&t.cycles,n=t.cmp&&(a=t.cmp,function(e){return function(t,i){var n={key:t,value:e[t]},o={key:i,value:e[i]};return a(n,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var a,r;if(Array.isArray(t)){for(r="[",a=0;a<t.length;a++)a&&(r+=","),r+=e(t[a])||"null";return r+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=o.push(t)-1,p=Object.keys(t).sort(n&&n(t));for(r="",a=0;a<p.length;a++){var d=p[a],l=e(t[d]);l&&(r&&(r+=","),r+=JSON.stringify(d)+":"+l)}return o.splice(s,1),"{"+r+"}"}}(e)},ga=function(e,t,a){var i="",n=!0===e.schema.$async,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),r=e.self._getId(e.schema);if(e.opts.strictKeywords){var s=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(s){var p="unknown keyword: "+s;if("log"!==e.opts.strictKeywords)throw new Error(p);e.logger.warn(p)}}if(e.isTop&&(i+=" var validate = ",n&&(e.async=!0,i+="async "),i+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",r&&(e.opts.sourceCode||e.opts.processCode)&&(i+=" /*# sourceURL="+r+" */ ")),"boolean"==typeof e.schema||!o&&!e.schema.$ref){t="false schema";var d=e.level,l=e.dataLevel,c=e.schema[t],u=e.schemaPath+e.util.getProperty(t),m=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(l||""),v="valid"+d;if(!1===e.schema){e.isTop?h=!0:i+=" var "+v+" = false; ",(Q=Q||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(m)+" , params: {} ",!1!==e.opts.messages&&(i+=" , message: 'boolean schema is false' "),e.opts.verbose&&(i+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),i+=" } "):i+=" {} ";var g=i;i=Q.pop(),!e.compositeRule&&h?e.async?i+=" throw new ValidationError(["+g+"]); ":i+=" validate.errors = ["+g+"]; return false; ":i+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?i+=n?" return data; ":" validate.errors = null; return true; ":i+=" var "+v+" = true; ";return e.isTop&&(i+=" }; return validate; "),i}if(e.isTop){var y=e.isTop;d=e.level=0,l=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var b="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(b);e.logger.warn(b)}i+=" var vErrors = null; ",i+=" var errors = 0; ",i+=" if (rootData === undefined) rootData = data; "}else{d=e.level,f="data"+((l=e.dataLevel)||"");if(r&&(e.baseId=e.resolve.url(e.baseId,r)),n&&!e.async)throw new Error("async schema in sync schema");i+=" var errs_"+d+" = errors;"}v="valid"+d,h=!e.opts.allErrors;var _="",w="",E=e.schema.type,T=Array.isArray(E);if(E&&e.opts.nullable&&!0===e.schema.nullable&&(T?-1==E.indexOf("null")&&(E=E.concat("null")):"null"!=E&&(E=[E,"null"],T=!0)),T&&1==E.length&&(E=E[0],T=!1),e.schema.$ref&&o){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(i+=" "+e.RULES.all.$comment.code(e,"$comment")),E){if(e.opts.coerceTypes)var x=e.util.coerceToTypes(e.opts.coerceTypes,E);var I=e.RULES.types[E];if(x||T||!0===I||I&&!J(I)){u=e.schemaPath+".type",m=e.errSchemaPath+"/type",u=e.schemaPath+".type",m=e.errSchemaPath+"/type";var S=T?"checkDataTypes":"checkDataType";if(i+=" if ("+e.util[S](E,f,e.opts.strictNumbers,!0)+") { ",x){var N="dataType"+d,A="coerced"+d;i+=" var "+N+" = typeof "+f+"; var "+A+" = undefined; ","array"==e.opts.coerceTypes&&(i+=" if ("+N+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+N+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+A+" = "+f+"; } "),i+=" if ("+A+" !== undefined) ; ";var D=x;if(D)for(var O,R=-1,k=D.length-1;R<k;)"string"==(O=D[R+=1])?i+=" else if ("+N+" == 'number' || "+N+" == 'boolean') "+A