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