@on-panda/serve 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/bin/serve.js +65 -0
- package/package.json +23 -0
- package/server/bypassCorsProxyPlugin.js +120 -0
- package/server/runtimeImportPlugin.js +46 -0
- package/server/safeProxyMiddleware.js +18 -0
- package/server/urlVerification.js +8 -0
- package/server/usingServerProxyPlugin.js +123 -0
- package/server/webConfigPlugin.js +41 -0
- package/web/assets/AudioPlugin-B9D2vg7i.js +73 -0
- package/web/assets/AudioPlugin-Ctg1swNk.css +1 -0
- package/web/assets/ImagePlugin-B55vjXoR.css +1 -0
- package/web/assets/ImagePlugin-D-lN3l8G.js +1 -0
- package/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/web/assets/VideoPlugin-Bzko1Oof.css +1 -0
- package/web/assets/VideoPlugin-CwcxLwKM.js +1 -0
- package/web/assets/browserAgentMcp-Dpy7F3rj.js +35 -0
- package/web/assets/defaultCustom-FmFgRqLi.js +1 -0
- package/web/assets/index-6pA5bJ5o.css +10 -0
- package/web/assets/index-BWq4H1Vs.js +8 -0
- package/web/assets/index-VDofnkb1.js +701 -0
- package/web/assets/streamableHttp-P4toeGJI.js +5 -0
- package/web/assets/types-JPNfEfAJ.js +26 -0
- package/web/img/on-panda-demo-candidate-continue-generating-cn.mp4 +0 -0
- package/web/img/on-panda-logo-256x256.png +0 -0
- package/web/index.html +22 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{s as qa,C as Aa,P as Da,a as za,G as Va,M,E as z,b as Fa,L as Ha,c as La,i as ut,d as Ua,e as as,f as Ka,R as Ae,g as Ga,h as er,j as Ja,k as Qa,l as Wa,T as ns,m as Cs,n as Ba,o as Ya,p as Za,q as Xa,I as xa,S as en,r as lt,t as tn,u as rn,v as sn,w as an,x as nn,y as on,z as cn,A as un,B as ln,D as dn,F as fn,H as hn,J as mn}from"./types-JPNfEfAJ.js";import{i as js}from"./index-VDofnkb1.js";function Rt(t){return!!t._zod}function ke(t,e){return Rt(t)?qa(t,e):t.safeParse(e)}function Ms(t){var r,s;if(!t)return;let e;if(Rt(t)?e=(s=(r=t._zod)==null?void 0:r.def)==null?void 0:s.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function pn(t){var a;if(Rt(t)){const o=(a=t._zod)==null?void 0:a.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}const r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const s=t.value;if(s!==void 0)return s}function Re(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function os(t){const e=Ms(t),r=e==null?void 0:e.method;if(!r)throw new Error("Schema is missing a method literal");const s=pn(r);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function is(t,e){const r=ke(t,e);if(!r.success)throw r.error;return r.data}const yn=6e4;class _n{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._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Aa,r=>{this._oncancel(r)}),this.setNotificationHandler(Da,r=>{this._onprogress(r)}),this.setRequestHandler(za,r=>({})),this._taskStore=e==null?void 0:e.taskStore,this._taskMessageQueue=e==null?void 0:e.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Va,async(r,s)=>{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new M(z.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(Fa,async(r,s)=>{const a=async()=>{var u;const n=r.params.taskId;if(this._taskMessageQueue){let c;for(;c=await this._taskMessageQueue.dequeue(n,s.sessionId);){if(c.type==="response"||c.type==="error"){const l=c.message,d=l.id,h=this._requestResolvers.get(d);if(h)if(this._requestResolvers.delete(d),c.type==="response")h(l);else{const g=l,b=new M(g.error.code,g.error.message,g.error.data);h(b)}else{const g=c.type==="response"?"Response":"Error";this._onerror(new Error(`${g} handler missing for request ${d}`))}continue}await((u=this._transport)==null?void 0:u.send(c.message,{relatedRequestId:s.requestId}))}}const o=await this._taskStore.getTask(n,s.sessionId);if(!o)throw new M(z.InvalidParams,`Task not found: ${n}`);if(!Re(o.status))return await this._waitForTaskUpdate(n,s.signal),await a();if(Re(o.status)){const c=await this._taskStore.getTaskResult(n,s.sessionId);return this._clearTaskQueue(n),{...c,_meta:{...c._meta,[Ae]:{taskId:n}}}}return await a()};return await a()}),this.setRequestHandler(Ha,async(r,s)=>{var a;try{const{tasks:n,nextCursor:o}=await this._taskStore.listTasks((a=r.params)==null?void 0:a.cursor,s.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new M(z.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(La,async(r,s)=>{try{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new M(z.InvalidParams,`Task not found: ${r.params.taskId}`);if(Re(a.status))throw new M(z.InvalidParams,`Cannot cancel task in terminal status: ${a.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(r.params.taskId);const n=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!n)throw new M(z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...n}}catch(a){throw a instanceof M?a:new M(z.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;const r=this._requestHandlerAbortControllers.get(e.params.requestId);r==null||r.abort(e.params.reason)}_setupTimeout(e,r,s,a,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,r),startTime:Date.now(),timeout:r,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:a})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const s=Date.now()-r.startTime;if(r.maxTotalTimeout&&s>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),M.fromError(z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:s});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var n,o,u;if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const r=(n=this.transport)==null?void 0:n.onclose;this._transport.onclose=()=>{r==null||r(),this._onclose()};const s=(o=this.transport)==null?void 0:o.onerror;this._transport.onerror=c=>{s==null||s(c),this._onerror(c)};const a=(u=this._transport)==null?void 0:u.onmessage;this._transport.onmessage=(c,l)=>{a==null||a(c,l),ut(c)||Ua(c)?this._onresponse(c):as(c)?this._onrequest(c,l):Ka(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var s;const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const a of this._requestHandlerAbortControllers.values())a.abort();this._requestHandlerAbortControllers.clear();const r=M.fromError(z.ConnectionClosed,"Connection closed");this._transport=void 0,(s=this.onclose)==null||s.call(this);for(const a of e.values())a(r)}_onerror(e){var r;(r=this.onerror)==null||r.call(this,e)}_onnotification(e){const r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var d,h,g,b;const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,a=this._transport,n=(g=(h=(d=e.params)==null?void 0:d._meta)==null?void 0:h[Ae])==null?void 0:g.taskId;if(s===void 0){const y={jsonrpc:"2.0",id:e.id,error:{code:z.MethodNotFound,message:"Method not found"}};n&&this._taskMessageQueue?this._enqueueTaskMessage(n,{type:"error",message:y,timestamp:Date.now()},a==null?void 0:a.sessionId).catch($=>this._onerror(new Error(`Failed to enqueue error response: ${$}`))):a==null||a.send(y).catch($=>this._onerror(new Error(`Failed to send an error response: ${$}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const u=Ga(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,a==null?void 0:a.sessionId):void 0,l={signal:o.signal,sessionId:a==null?void 0:a.sessionId,_meta:(b=e.params)==null?void 0:b._meta,sendNotification:async y=>{if(o.signal.aborted)return;const $={relatedRequestId:e.id};n&&($.relatedTask={taskId:n}),await this.notification(y,$)},sendRequest:async(y,$,p)=>{var E;if(o.signal.aborted)throw new M(z.ConnectionClosed,"Request was cancelled");const f={...p,relatedRequestId:e.id};n&&!f.relatedTask&&(f.relatedTask={taskId:n});const v=((E=f.relatedTask)==null?void 0:E.taskId)??n;return v&&c&&await c.updateTaskStatus(v,"input_required"),await this.request(y,$,f)},authInfo:r==null?void 0:r.authInfo,requestId:e.id,requestInfo:r==null?void 0:r.requestInfo,taskId:n,taskStore:c,taskRequestedTtl:u==null?void 0:u.ttl,closeSSEStream:r==null?void 0:r.closeSSEStream,closeStandaloneSSEStream:r==null?void 0:r.closeStandaloneSSEStream};Promise.resolve().then(()=>{u&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,l)).then(async y=>{if(o.signal.aborted)return;const $={result:y,jsonrpc:"2.0",id:e.id};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"response",message:$,timestamp:Date.now()},a==null?void 0:a.sessionId):await(a==null?void 0:a.send($))},async y=>{if(o.signal.aborted)return;const $={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(y.code)?y.code:z.InternalError,message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"error",message:$,timestamp:Date.now()},a==null?void 0:a.sessionId):await(a==null?void 0:a.send($))}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...s}=e.params,a=Number(r),n=this._progressHandlers.get(a);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const o=this._responseHandlers.get(a),u=this._timeoutInfo.get(a);if(u&&o&&u.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(c){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),o(c);return}n(s)}_onresponse(e){const r=Number(e.id),s=this._requestResolvers.get(r);if(s){if(this._requestResolvers.delete(r),ut(e))s(e);else{const o=new M(e.error.code,e.error.message,e.error.data);s(o)}return}const a=this._responseHandlers.get(r);if(a===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let n=!1;if(ut(e)&&e.result&&typeof e.result=="object"){const o=e.result;if(o.task&&typeof o.task=="object"){const u=o.task;typeof u.taskId=="string"&&(n=!0,this._taskProgressTokens.set(u.taskId,r))}}if(n||this._progressHandlers.delete(r),ut(e))a(e);else{const o=M.fromError(e.error.code,e.error.message,e.error.data);a(o)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)==null?void 0:e.close())}async*requestStream(e,r,s){var o,u;const{task:a}=s??{};if(!a){try{yield{type:"result",result:await this.request(e,r,s)}}catch(c){yield{type:"error",error:c instanceof M?c:new M(z.InternalError,String(c))}}return}let n;try{const c=await this.request(e,er,s);if(c.task)n=c.task.taskId,yield{type:"taskCreated",task:c.task};else throw new M(z.InternalError,"Task creation did not return a task");for(;;){const l=await this.getTask({taskId:n},s);if(yield{type:"taskStatus",task:l},Re(l.status)){l.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)}:l.status==="failed"?yield{type:"error",error:new M(z.InternalError,`Task ${n} failed`)}:l.status==="cancelled"&&(yield{type:"error",error:new M(z.InternalError,`Task ${n} was cancelled`)});return}if(l.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)};return}const d=l.pollInterval??((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;await new Promise(h=>setTimeout(h,d)),(u=s==null?void 0:s.signal)==null||u.throwIfAborted()}}catch(c){yield{type:"error",error:c instanceof M?c:new M(z.InternalError,String(c))}}}request(e,r,s){const{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o,task:u,relatedTask:c}=s??{};return new Promise((l,d)=>{var v,E,P,R,U;const h=A=>{d(A)};if(!this._transport){h(new Error("Not connected"));return}if(((v=this._options)==null?void 0:v.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(e.method),u&&this.assertTaskCapability(e.method)}catch(A){h(A);return}(E=s==null?void 0:s.signal)==null||E.throwIfAborted();const g=this._requestMessageId++,b={...e,jsonrpc:"2.0",id:g};s!=null&&s.onprogress&&(this._progressHandlers.set(g,s.onprogress),b.params={...e.params,_meta:{...((P=e.params)==null?void 0:P._meta)||{},progressToken:g}}),u&&(b.params={...b.params,task:u}),c&&(b.params={...b.params,_meta:{...((R=b.params)==null?void 0:R._meta)||{},[Ae]:c}});const y=A=>{var B;this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),(B=this._transport)==null||B.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(A)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(ce=>this._onerror(new Error(`Failed to send cancellation: ${ce}`)));const Y=A instanceof M?A:new M(z.RequestTimeout,String(A));d(Y)};this._responseHandlers.set(g,A=>{var Y;if(!((Y=s==null?void 0:s.signal)!=null&&Y.aborted)){if(A instanceof Error)return d(A);try{const B=ke(r,A.result);B.success?l(B.data):d(B.error)}catch(B){d(B)}}}),(U=s==null?void 0:s.signal)==null||U.addEventListener("abort",()=>{var A;y((A=s==null?void 0:s.signal)==null?void 0:A.reason)});const $=(s==null?void 0:s.timeout)??yn,p=()=>y(M.fromError(z.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(g,$,s==null?void 0:s.maxTotalTimeout,p,(s==null?void 0:s.resetTimeoutOnProgress)??!1);const f=c==null?void 0:c.taskId;if(f){const A=Y=>{const B=this._responseHandlers.get(g);B?B(Y):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,A),this._enqueueTaskMessage(f,{type:"request",message:b,timestamp:Date.now()}).catch(Y=>{this._cleanupTimeout(g),d(Y)})}else this._transport.send(b,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:o}).catch(A=>{this._cleanupTimeout(g),d(A)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ja,r)}async getTaskResult(e,r,s){return this.request({method:"tasks/result",params:e},r,s)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Qa,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Wa,r)}async notification(e,r){var u,c,l,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=(u=r==null?void 0:r.relatedTask)==null?void 0:u.taskId;if(s){const h={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...((c=e.params)==null?void 0:c._meta)||{},[Ae]:r.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:h,timestamp:Date.now()});return}if((((l=this._options)==null?void 0:l.debouncedNotificationMethods)??[]).includes(e.method)&&!e.params&&!(r!=null&&r.relatedRequestId)&&!(r!=null&&r.relatedTask)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var g,b;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let h={...e,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(h={...h,params:{...h.params,_meta:{...((g=h.params)==null?void 0:g._meta)||{},[Ae]:r.relatedTask}}}),(b=this._transport)==null||b.send(h,r).catch(y=>this._onerror(y))});return}let o={...e,jsonrpc:"2.0"};r!=null&&r.relatedTask&&(o={...o,params:{...o.params,_meta:{...((d=o.params)==null?void 0:d._meta)||{},[Ae]:r.relatedTask}}}),await this._transport.send(o,r)}setRequestHandler(e,r){const s=os(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>{const o=is(e,a);return Promise.resolve(r(o,n))})}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,r){const s=os(e);this._notificationHandlers.set(s,a=>{const n=is(e,a);return Promise.resolve(r(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,s){var n;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const a=(n=this._options)==null?void 0:n.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,s,a)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,r);for(const a of s)if(a.type==="request"&&as(a.message)){const n=a.message.id,o=this._requestResolvers.get(n);o?(o(new M(z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n)):this._onerror(new Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){var a,n;let s=((a=this._options)==null?void 0:a.defaultTaskPollInterval)??1e3;try{const o=await((n=this._taskStore)==null?void 0:n.getTask(e));o!=null&&o.pollInterval&&(s=o.pollInterval)}catch{}return new Promise((o,u)=>{if(r.aborted){u(new M(z.InvalidRequest,"Request cancelled"));return}const c=setTimeout(o,s);r.addEventListener("abort",()=>{clearTimeout(c),u(new M(z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async a=>{if(!e)throw new Error("No request provided");return await s.createTask(a,e.id,{method:e.method,params:e.params},r)},getTask:async a=>{const n=await s.getTask(a,r);if(!n)throw new M(z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(a,n,o)=>{await s.storeTaskResult(a,n,o,r);const u=await s.getTask(a,r);if(u){const c=ns.parse({method:"notifications/tasks/status",params:u});await this.notification(c),Re(u.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>s.getTaskResult(a,r),updateTaskStatus:async(a,n,o)=>{const u=await s.getTask(a,r);if(!u)throw new M(z.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(Re(u.status))throw new M(z.InvalidParams,`Cannot update task "${a}" from terminal status "${u.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(a,n,o,r);const c=await s.getTask(a,r);if(c){const l=ns.parse({method:"notifications/tasks/status",params:c});await this.notification(l),Re(c.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>s.listTasks(a,r)}}}function cs(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function gn(t,e){const r={...t};for(const s in e){const a=s,n=e[a];if(n===void 0)continue;const o=r[a];cs(o)&&cs(n)?r[a]={...o,...n}:r[a]=n}return r}var tr={exports:{}},qs={},fe={},Ue={},ot={},V={},nt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends e{constructor(v){if(super(),!t.IDENTIFIER.test(v))throw new Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class s extends e{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((E,P)=>`${E}${P}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((E,P)=>(P instanceof r&&(E[P.str]=(E[P.str]||0)+1),E),{})}}t._Code=s,t.nil=new s("");function a(f,...v){const E=[f[0]];let P=0;for(;P<v.length;)u(E,v[P]),E.push(f[++P]);return new s(E)}t._=a;const n=new s("+");function o(f,...v){const E=[b(f[0])];let P=0;for(;P<v.length;)E.push(n),u(E,v[P]),E.push(n,b(f[++P]));return c(E),new s(E)}t.str=o;function u(f,v){v instanceof s?f.push(...v._items):v instanceof r?f.push(v):f.push(h(v))}t.addCodeArg=u;function c(f){let v=1;for(;v<f.length-1;){if(f[v]===n){const E=l(f[v-1],f[v+1]);if(E!==void 0){f.splice(v-1,3,E);continue}f[v++]="+"}v++}}function l(f,v){if(v==='""')return f;if(f==='""')return v;if(typeof f=="string")return v instanceof r||f[f.length-1]!=='"'?void 0:typeof v!="string"?`${f.slice(0,-1)}${v}"`:v[0]==='"'?f.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(f instanceof r))return`"${f}${v.slice(1)}`}function d(f,v){return v.emptyStr()?f:f.emptyStr()?v:o`${f}${v}`}t.strConcat=d;function h(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:b(Array.isArray(f)?f.join(","):f)}function g(f){return new s(b(f))}t.stringify=g;function b(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=b;function y(f){return typeof f=="string"&&t.IDENTIFIER.test(f)?new s(`.${f}`):a`[${f}]`}t.getProperty=y;function $(f){if(typeof f=="string"&&t.IDENTIFIER.test(f))return new s(`${f}`);throw new Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}t.getEsmExportName=$;function p(f){return new s(f.toString())}t.regexpCode=p})(nt);var rr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=nt;class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var s;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(s||(t.UsedValueState=s={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class a{constructor({prefixes:l,parent:d}={}){this._names={},this._prefixes=l,this._parent=d}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){const d=this._names[l]||this._nameGroup(l);return`${l}${d.index++}`}_nameGroup(l){var d,h;if(!((h=(d=this._parent)===null||d===void 0?void 0:d._prefixes)===null||h===void 0)&&h.has(l)||this._prefixes&&!this._prefixes.has(l))throw new Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=a;class n extends e.Name{constructor(l,d){super(d),this.prefix=l}setValue(l,{property:d,itemIndex:h}){this.value=l,this.scopePath=(0,e._)`.${new e.Name(d)}[${h}]`}}t.ValueScopeName=n;const o=(0,e._)`\n`;class u extends a{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?o:e.nil}}get(){return this._scope}name(l){return new n(l,this._newName(l))}value(l,d){var h;if(d.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(l),{prefix:b}=g,y=(h=d.key)!==null&&h!==void 0?h:d.ref;let $=this._values[b];if($){const v=$.get(y);if(v)return v}else $=this._values[b]=new Map;$.set(y,g);const p=this._scope[b]||(this._scope[b]=[]),f=p.length;return p[f]=d.ref,g.setValue(d,{property:b,itemIndex:f}),g}getValue(l,d){const h=this._values[l];if(h)return h.get(d)}scopeRefs(l,d=this._values){return this._reduceValues(d,h=>{if(h.scopePath===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return(0,e._)`${l}${h.scopePath}`})}scopeCode(l=this._values,d,h){return this._reduceValues(l,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},d,h)}_reduceValues(l,d,h={},g){let b=e.nil;for(const y in l){const $=l[y];if(!$)continue;const p=h[y]=h[y]||new Map;$.forEach(f=>{if(p.has(f))return;p.set(f,s.Started);let v=d(f);if(v){const E=this.opts.es5?t.varKinds.var:t.varKinds.const;b=(0,e._)`${b}${E} ${f} = ${v};${this.opts._n}`}else if(v=g==null?void 0:g(f))b=(0,e._)`${b}${v}${this.opts._n}`;else throw new r(f);p.set(f,s.Completed)})}return b}}t.ValueScope=u})(rr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=nt,r=rr;var s=nt;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var a=rr;Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return a.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return a.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return a.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return a.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class n{optimizeNodes(){return this}optimizeNames(i,m){return this}}class o extends n{constructor(i,m,S){super(),this.varKind=i,this.name=m,this.rhs=S}render({es5:i,_n:m}){const S=i?r.varKinds.var:this.varKind,O=this.rhs===void 0?"":` = ${this.rhs}`;return`${S} ${this.name}${O};`+m}optimizeNames(i,m){if(i[this.name.str])return this.rhs&&(this.rhs=L(this.rhs,i,m)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class u extends n{constructor(i,m,S){super(),this.lhs=i,this.rhs=m,this.sideEffects=S}render({_n:i}){return`${this.lhs} = ${this.rhs};`+i}optimizeNames(i,m){if(!(this.lhs instanceof e.Name&&!i[this.lhs.str]&&!this.sideEffects))return this.rhs=L(this.rhs,i,m),this}get names(){const i=this.lhs instanceof e.Name?{}:{...this.lhs.names};return W(i,this.rhs)}}class c extends u{constructor(i,m,S,O){super(i,S,O),this.op=m}render({_n:i}){return`${this.lhs} ${this.op}= ${this.rhs};`+i}}class l extends n{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`${this.label}:`+i}}class d extends n{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`break${this.label?` ${this.label}`:""};`+i}}class h extends n{constructor(i){super(),this.error=i}render({_n:i}){return`throw ${this.error};`+i}get names(){return this.error.names}}class g extends n{constructor(i){super(),this.code=i}render({_n:i}){return`${this.code};`+i}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(i,m){return this.code=L(this.code,i,m),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class b extends n{constructor(i=[]){super(),this.nodes=i}render(i){return this.nodes.reduce((m,S)=>m+S.render(i),"")}optimizeNodes(){const{nodes:i}=this;let m=i.length;for(;m--;){const S=i[m].optimizeNodes();Array.isArray(S)?i.splice(m,1,...S):S?i[m]=S:i.splice(m,1)}return i.length>0?this:void 0}optimizeNames(i,m){const{nodes:S}=this;let O=S.length;for(;O--;){const C=S[O];C.optimizeNames(i,m)||(ee(i,C.names),S.splice(O,1))}return S.length>0?this:void 0}get names(){return this.nodes.reduce((i,m)=>F(i,m.names),{})}}class y extends b{render(i){return"{"+i._n+super.render(i)+"}"+i._n}}class $ extends b{}class p extends y{}p.kind="else";class f extends y{constructor(i,m){super(m),this.condition=i}render(i){let m=`if(${this.condition})`+super.render(i);return this.else&&(m+="else "+this.else.render(i)),m}optimizeNodes(){super.optimizeNodes();const i=this.condition;if(i===!0)return this.nodes;let m=this.else;if(m){const S=m.optimizeNodes();m=this.else=Array.isArray(S)?new p(S):S}if(m)return i===!1?m instanceof f?m:m.nodes:this.nodes.length?this:new f(_e(i),m instanceof f?[m]:m.nodes);if(!(i===!1||!this.nodes.length))return this}optimizeNames(i,m){var S;if(this.else=(S=this.else)===null||S===void 0?void 0:S.optimizeNames(i,m),!!(super.optimizeNames(i,m)||this.else))return this.condition=L(this.condition,i,m),this}get names(){const i=super.names;return W(i,this.condition),this.else&&F(i,this.else.names),i}}f.kind="if";class v extends y{}v.kind="for";class E extends v{constructor(i){super(),this.iteration=i}render(i){return`for(${this.iteration})`+super.render(i)}optimizeNames(i,m){if(super.optimizeNames(i,m))return this.iteration=L(this.iteration,i,m),this}get names(){return F(super.names,this.iteration.names)}}class P extends v{constructor(i,m,S,O){super(),this.varKind=i,this.name=m,this.from=S,this.to=O}render(i){const m=i.es5?r.varKinds.var:this.varKind,{name:S,from:O,to:C}=this;return`for(${m} ${S}=${O}; ${S}<${C}; ${S}++)`+super.render(i)}get names(){const i=W(super.names,this.from);return W(i,this.to)}}class R extends v{constructor(i,m,S,O){super(),this.loop=i,this.varKind=m,this.name=S,this.iterable=O}render(i){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(i)}optimizeNames(i,m){if(super.optimizeNames(i,m))return this.iterable=L(this.iterable,i,m),this}get names(){return F(super.names,this.iterable.names)}}class U extends y{constructor(i,m,S){super(),this.name=i,this.args=m,this.async=S}render(i){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(i)}}U.kind="func";class A extends b{render(i){return"return "+super.render(i)}}A.kind="return";class Y extends y{render(i){let m="try"+super.render(i);return this.catch&&(m+=this.catch.render(i)),this.finally&&(m+=this.finally.render(i)),m}optimizeNodes(){var i,m;return super.optimizeNodes(),(i=this.catch)===null||i===void 0||i.optimizeNodes(),(m=this.finally)===null||m===void 0||m.optimizeNodes(),this}optimizeNames(i,m){var S,O;return super.optimizeNames(i,m),(S=this.catch)===null||S===void 0||S.optimizeNames(i,m),(O=this.finally)===null||O===void 0||O.optimizeNames(i,m),this}get names(){const i=super.names;return this.catch&&F(i,this.catch.names),this.finally&&F(i,this.finally.names),i}}class B extends y{constructor(i){super(),this.error=i}render(i){return`catch(${this.error})`+super.render(i)}}B.kind="catch";class ce extends y{render(i){return"finally"+super.render(i)}}ce.kind="finally";class j{constructor(i,m={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...m,_n:m.lines?`
|
|
2
|
+
`:""},this._extScope=i,this._scope=new r.Scope({parent:i}),this._nodes=[new $]}toString(){return this._root.render(this.opts)}name(i){return this._scope.name(i)}scopeName(i){return this._extScope.name(i)}scopeValue(i,m){const S=this._extScope.value(i,m);return(this._values[S.prefix]||(this._values[S.prefix]=new Set)).add(S),S}getScopeValue(i,m){return this._extScope.getValue(i,m)}scopeRefs(i){return this._extScope.scopeRefs(i,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(i,m,S,O){const C=this._scope.toName(m);return S!==void 0&&O&&(this._constants[C.str]=S),this._leafNode(new o(i,C,S)),C}const(i,m,S){return this._def(r.varKinds.const,i,m,S)}let(i,m,S){return this._def(r.varKinds.let,i,m,S)}var(i,m,S){return this._def(r.varKinds.var,i,m,S)}assign(i,m,S){return this._leafNode(new u(i,m,S))}add(i,m){return this._leafNode(new c(i,t.operators.ADD,m))}code(i){return typeof i=="function"?i():i!==e.nil&&this._leafNode(new g(i)),this}object(...i){const m=["{"];for(const[S,O]of i)m.length>1&&m.push(","),m.push(S),(S!==O||this.opts.es5)&&(m.push(":"),(0,e.addCodeArg)(m,O));return m.push("}"),new e._Code(m)}if(i,m,S){if(this._blockNode(new f(i)),m&&S)this.code(m).else().code(S).endIf();else if(m)this.code(m).endIf();else if(S)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(i){return this._elseNode(new f(i))}else(){return this._elseNode(new p)}endIf(){return this._endBlockNode(f,p)}_for(i,m){return this._blockNode(i),m&&this.code(m).endFor(),this}for(i,m){return this._for(new E(i),m)}forRange(i,m,S,O,C=this.opts.es5?r.varKinds.var:r.varKinds.let){const G=this._scope.toName(i);return this._for(new P(C,G,m,S),()=>O(G))}forOf(i,m,S,O=r.varKinds.const){const C=this._scope.toName(i);if(this.opts.es5){const G=m instanceof e.Name?m:this.var("_arr",m);return this.forRange("_i",0,(0,e._)`${G}.length`,K=>{this.var(C,(0,e._)`${G}[${K}]`),S(C)})}return this._for(new R("of",O,C,m),()=>S(C))}forIn(i,m,S,O=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(i,(0,e._)`Object.keys(${m})`,S);const C=this._scope.toName(i);return this._for(new R("in",O,C,m),()=>S(C))}endFor(){return this._endBlockNode(v)}label(i){return this._leafNode(new l(i))}break(i){return this._leafNode(new d(i))}return(i){const m=new A;if(this._blockNode(m),this.code(i),m.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(i,m,S){if(!m&&!S)throw new Error('CodeGen: "try" without "catch" and "finally"');const O=new Y;if(this._blockNode(O),this.code(i),m){const C=this.name("e");this._currNode=O.catch=new B(C),m(C)}return S&&(this._currNode=O.finally=new ce,this.code(S)),this._endBlockNode(B,ce)}throw(i){return this._leafNode(new h(i))}block(i,m){return this._blockStarts.push(this._nodes.length),i&&this.code(i).endBlock(m),this}endBlock(i){const m=this._blockStarts.pop();if(m===void 0)throw new Error("CodeGen: not in self-balancing block");const S=this._nodes.length-m;if(S<0||i!==void 0&&S!==i)throw new Error(`CodeGen: wrong number of nodes: ${S} vs ${i} expected`);return this._nodes.length=m,this}func(i,m=e.nil,S,O){return this._blockNode(new U(i,m,S)),O&&this.code(O).endFunc(),this}endFunc(){return this._endBlockNode(U)}optimize(i=1){for(;i-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(i){return this._currNode.nodes.push(i),this}_blockNode(i){this._currNode.nodes.push(i),this._nodes.push(i)}_endBlockNode(i,m){const S=this._currNode;if(S instanceof i||m&&S instanceof m)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${m?`${i.kind}/${m.kind}`:i.kind}"`)}_elseNode(i){const m=this._currNode;if(!(m instanceof f))throw new Error('CodeGen: "else" without "if"');return this._currNode=m.else=i,this}get _root(){return this._nodes[0]}get _currNode(){const i=this._nodes;return i[i.length-1]}set _currNode(i){const m=this._nodes;m[m.length-1]=i}}t.CodeGen=j;function F(w,i){for(const m in i)w[m]=(w[m]||0)+(i[m]||0);return w}function W(w,i){return i instanceof e._CodeOrName?F(w,i.names):w}function L(w,i,m){if(w instanceof e.Name)return S(w);if(!O(w))return w;return new e._Code(w._items.reduce((C,G)=>(G instanceof e.Name&&(G=S(G)),G instanceof e._Code?C.push(...G._items):C.push(G),C),[]));function S(C){const G=m[C.str];return G===void 0||i[C.str]!==1?C:(delete i[C.str],G)}function O(C){return C instanceof e._Code&&C._items.some(G=>G instanceof e.Name&&i[G.str]===1&&m[G.str]!==void 0)}}function ee(w,i){for(const m in i)w[m]=(w[m]||0)-(i[m]||0)}function _e(w){return typeof w=="boolean"||typeof w=="number"||w===null?!w:(0,e._)`!${k(w)}`}t.not=_e;const ge=_(t.operators.AND);function We(...w){return w.reduce(ge)}t.and=We;const Te=_(t.operators.OR);function T(...w){return w.reduce(Te)}t.or=T;function _(w){return(i,m)=>i===e.nil?m:m===e.nil?i:(0,e._)`${k(i)} ${w} ${k(m)}`}function k(w){return w instanceof e.Name?w:(0,e._)`(${w})`}})(V);var I={};Object.defineProperty(I,"__esModule",{value:!0});I.checkStrictMode=I.getErrorPath=I.Type=I.useFunc=I.setEvaluated=I.evaluatedPropsToName=I.mergeEvaluated=I.eachItem=I.unescapeJsonPointer=I.escapeJsonPointer=I.escapeFragment=I.unescapeFragment=I.schemaRefOrVal=I.schemaHasRulesButRef=I.schemaHasRules=I.checkUnknownRules=I.alwaysValidSchema=I.toHash=void 0;const J=V,$n=nt;function vn(t){const e={};for(const r of t)e[r]=!0;return e}I.toHash=vn;function wn(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(As(t,e),!Ds(e,t.self.RULES.all))}I.alwaysValidSchema=wn;function As(t,e=t.schema){const{opts:r,self:s}=t;if(!r.strictSchema||typeof e=="boolean")return;const a=s.RULES.keywords;for(const n in e)a[n]||Fs(t,`unknown keyword: "${n}"`)}I.checkUnknownRules=As;function Ds(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(e[r])return!0;return!1}I.schemaHasRules=Ds;function bn(t,e){if(typeof t=="boolean")return!t;for(const r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}I.schemaHasRulesButRef=bn;function Sn({topSchemaRef:t,schemaPath:e},r,s,a){if(!a){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${t}${e}${(0,J.getProperty)(s)}`}I.schemaRefOrVal=Sn;function kn(t){return zs(decodeURIComponent(t))}I.unescapeFragment=kn;function En(t){return encodeURIComponent(lr(t))}I.escapeFragment=En;function lr(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}I.escapeJsonPointer=lr;function zs(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}I.unescapeJsonPointer=zs;function Pn(t,e){if(Array.isArray(t))for(const r of t)e(r);else e(t)}I.eachItem=Pn;function us({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:s}){return(a,n,o,u)=>{const c=o===void 0?n:o instanceof J.Name?(n instanceof J.Name?t(a,n,o):e(a,n,o),o):n instanceof J.Name?(e(a,o,n),n):r(n,o);return u===J.Name&&!(c instanceof J.Name)?s(a,c):c}}I.mergeEvaluated={props:us({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,J._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,J._)`${r} || {}`),dr(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Vs}),items:us({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,J._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,J._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Vs(t,e){if(e===!0)return t.var("props",!0);const r=t.var("props",(0,J._)`{}`);return e!==void 0&&dr(t,r,e),r}I.evaluatedPropsToName=Vs;function dr(t,e,r){Object.keys(r).forEach(s=>t.assign((0,J._)`${e}${(0,J.getProperty)(s)}`,!0))}I.setEvaluated=dr;const ls={};function Tn(t,e){return t.scopeValue("func",{ref:e,code:ls[e.code]||(ls[e.code]=new $n._Code(e.code))})}I.useFunc=Tn;var sr;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(sr||(I.Type=sr={}));function Rn(t,e,r){if(t instanceof J.Name){const s=e===sr.Num;return r?s?(0,J._)`"[" + ${t} + "]"`:(0,J._)`"['" + ${t} + "']"`:s?(0,J._)`"/" + ${t}`:(0,J._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(t).toString():"/"+lr(t)}I.getErrorPath=Rn;function Fs(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}I.checkStrictMode=Fs;var ye={};Object.defineProperty(ye,"__esModule",{value:!0});const se=V,In={data:new se.Name("data"),valCxt:new se.Name("valCxt"),instancePath:new se.Name("instancePath"),parentData:new se.Name("parentData"),parentDataProperty:new se.Name("parentDataProperty"),rootData:new se.Name("rootData"),dynamicAnchors:new se.Name("dynamicAnchors"),vErrors:new se.Name("vErrors"),errors:new se.Name("errors"),this:new se.Name("this"),self:new se.Name("self"),scope:new se.Name("scope"),json:new se.Name("json"),jsonPos:new se.Name("jsonPos"),jsonLen:new se.Name("jsonLen"),jsonPart:new se.Name("jsonPart")};ye.default=In;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=V,r=I,s=ye;t.keywordError={message:({keyword:p})=>(0,e.str)`must pass "${p}" keyword validation`},t.keyword$DataError={message:({keyword:p,schemaType:f})=>f?(0,e.str)`"${p}" keyword must be ${f} ($data)`:(0,e.str)`"${p}" keyword is invalid ($data)`};function a(p,f=t.keywordError,v,E){const{it:P}=p,{gen:R,compositeRule:U,allErrors:A}=P,Y=h(p,f,v);E??(U||A)?c(R,Y):l(P,(0,e._)`[${Y}]`)}t.reportError=a;function n(p,f=t.keywordError,v){const{it:E}=p,{gen:P,compositeRule:R,allErrors:U}=E,A=h(p,f,v);c(P,A),R||U||l(E,s.default.vErrors)}t.reportExtraError=n;function o(p,f){p.assign(s.default.errors,f),p.if((0,e._)`${s.default.vErrors} !== null`,()=>p.if(f,()=>p.assign((0,e._)`${s.default.vErrors}.length`,f),()=>p.assign(s.default.vErrors,null)))}t.resetErrorsCount=o;function u({gen:p,keyword:f,schemaValue:v,data:E,errsCount:P,it:R}){if(P===void 0)throw new Error("ajv implementation error");const U=p.name("err");p.forRange("i",P,s.default.errors,A=>{p.const(U,(0,e._)`${s.default.vErrors}[${A}]`),p.if((0,e._)`${U}.instancePath === undefined`,()=>p.assign((0,e._)`${U}.instancePath`,(0,e.strConcat)(s.default.instancePath,R.errorPath))),p.assign((0,e._)`${U}.schemaPath`,(0,e.str)`${R.errSchemaPath}/${f}`),R.opts.verbose&&(p.assign((0,e._)`${U}.schema`,v),p.assign((0,e._)`${U}.data`,E))})}t.extendErrors=u;function c(p,f){const v=p.const("err",f);p.if((0,e._)`${s.default.vErrors} === null`,()=>p.assign(s.default.vErrors,(0,e._)`[${v}]`),(0,e._)`${s.default.vErrors}.push(${v})`),p.code((0,e._)`${s.default.errors}++`)}function l(p,f){const{gen:v,validateName:E,schemaEnv:P}=p;P.$async?v.throw((0,e._)`new ${p.ValidationError}(${f})`):(v.assign((0,e._)`${E}.errors`,f),v.return(!1))}const d={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function h(p,f,v){const{createErrors:E}=p.it;return E===!1?(0,e._)`{}`:g(p,f,v)}function g(p,f,v={}){const{gen:E,it:P}=p,R=[b(P,v),y(p,v)];return $(p,f,R),E.object(...R)}function b({errorPath:p},{instancePath:f}){const v=f?(0,e.str)`${p}${(0,r.getErrorPath)(f,r.Type.Str)}`:p;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,v)]}function y({keyword:p,it:{errSchemaPath:f}},{schemaPath:v,parentSchema:E}){let P=E?f:(0,e.str)`${f}/${p}`;return v&&(P=(0,e.str)`${P}${(0,r.getErrorPath)(v,r.Type.Str)}`),[d.schemaPath,P]}function $(p,{params:f,message:v},E){const{keyword:P,data:R,schemaValue:U,it:A}=p,{opts:Y,propertyName:B,topSchemaRef:ce,schemaPath:j}=A;E.push([d.keyword,P],[d.params,typeof f=="function"?f(p):f||(0,e._)`{}`]),Y.messages&&E.push([d.message,typeof v=="function"?v(p):v]),Y.verbose&&E.push([d.schema,U],[d.parentSchema,(0,e._)`${ce}${j}`],[s.default.data,R]),B&&E.push([d.propertyName,B])}})(ot);Object.defineProperty(Ue,"__esModule",{value:!0});Ue.boolOrEmptySchema=Ue.topBoolOrEmptySchema=void 0;const Nn=ot,On=V,Cn=ye,jn={message:"boolean schema is false"};function Mn(t){const{gen:e,schema:r,validateName:s}=t;r===!1?Hs(t,!1):typeof r=="object"&&r.$async===!0?e.return(Cn.default.data):(e.assign((0,On._)`${s}.errors`,null),e.return(!0))}Ue.topBoolOrEmptySchema=Mn;function qn(t,e){const{gen:r,schema:s}=t;s===!1?(r.var(e,!1),Hs(t)):r.var(e,!0)}Ue.boolOrEmptySchema=qn;function Hs(t,e){const{gen:r,data:s}=t,a={gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Nn.reportError)(a,jn,void 0,e)}var X={},je={};Object.defineProperty(je,"__esModule",{value:!0});je.getRules=je.isJSONType=void 0;const An=["string","number","integer","boolean","null","object","array"],Dn=new Set(An);function zn(t){return typeof t=="string"&&Dn.has(t)}je.isJSONType=zn;function Vn(){const t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}je.getRules=Vn;var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.shouldUseRule=$e.shouldUseGroup=$e.schemaHasRulesForType=void 0;function Fn({schema:t,self:e},r){const s=e.RULES.types[r];return s&&s!==!0&&Ls(t,s)}$e.schemaHasRulesForType=Fn;function Ls(t,e){return e.rules.some(r=>Us(t,r))}$e.shouldUseGroup=Ls;function Us(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(s=>t[s]!==void 0))}$e.shouldUseRule=Us;Object.defineProperty(X,"__esModule",{value:!0});X.reportTypeError=X.checkDataTypes=X.checkDataType=X.coerceAndCheckDataType=X.getJSONTypes=X.getSchemaTypes=X.DataType=void 0;const Hn=je,Ln=$e,Un=ot,D=V,Ks=I;var He;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(He||(X.DataType=He={}));function Kn(t){const e=Gs(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}X.getSchemaTypes=Kn;function Gs(t){const e=Array.isArray(t)?t:t?[t]:[];if(e.every(Hn.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}X.getJSONTypes=Gs;function Gn(t,e){const{gen:r,data:s,opts:a}=t,n=Jn(e,a.coerceTypes),o=e.length>0&&!(n.length===0&&e.length===1&&(0,Ln.schemaHasRulesForType)(t,e[0]));if(o){const u=fr(e,s,a.strictNumbers,He.Wrong);r.if(u,()=>{n.length?Qn(t,e,n):hr(t)})}return o}X.coerceAndCheckDataType=Gn;const Js=new Set(["string","number","integer","boolean","null"]);function Jn(t,e){return e?t.filter(r=>Js.has(r)||e==="array"&&r==="array"):[]}function Qn(t,e,r){const{gen:s,data:a,opts:n}=t,o=s.let("dataType",(0,D._)`typeof ${a}`),u=s.let("coerced",(0,D._)`undefined`);n.coerceTypes==="array"&&s.if((0,D._)`${o} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>s.assign(a,(0,D._)`${a}[0]`).assign(o,(0,D._)`typeof ${a}`).if(fr(e,a,n.strictNumbers),()=>s.assign(u,a))),s.if((0,D._)`${u} !== undefined`);for(const l of r)(Js.has(l)||l==="array"&&n.coerceTypes==="array")&&c(l);s.else(),hr(t),s.endIf(),s.if((0,D._)`${u} !== undefined`,()=>{s.assign(a,u),Wn(t,u)});function c(l){switch(l){case"string":s.elseIf((0,D._)`${o} == "number" || ${o} == "boolean"`).assign(u,(0,D._)`"" + ${a}`).elseIf((0,D._)`${a} === null`).assign(u,(0,D._)`""`);return;case"number":s.elseIf((0,D._)`${o} == "boolean" || ${a} === null
|
|
3
|
+
|| (${o} == "string" && ${a} && ${a} == +${a})`).assign(u,(0,D._)`+${a}`);return;case"integer":s.elseIf((0,D._)`${o} === "boolean" || ${a} === null
|
|
4
|
+
|| (${o} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(u,(0,D._)`+${a}`);return;case"boolean":s.elseIf((0,D._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(u,!1).elseIf((0,D._)`${a} === "true" || ${a} === 1`).assign(u,!0);return;case"null":s.elseIf((0,D._)`${a} === "" || ${a} === 0 || ${a} === false`),s.assign(u,null);return;case"array":s.elseIf((0,D._)`${o} === "string" || ${o} === "number"
|
|
5
|
+
|| ${o} === "boolean" || ${a} === null`).assign(u,(0,D._)`[${a}]`)}}}function Wn({gen:t,parentData:e,parentDataProperty:r},s){t.if((0,D._)`${e} !== undefined`,()=>t.assign((0,D._)`${e}[${r}]`,s))}function ar(t,e,r,s=He.Correct){const a=s===He.Correct?D.operators.EQ:D.operators.NEQ;let n;switch(t){case"null":return(0,D._)`${e} ${a} null`;case"array":n=(0,D._)`Array.isArray(${e})`;break;case"object":n=(0,D._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":n=o((0,D._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":n=o();break;default:return(0,D._)`typeof ${e} ${a} ${t}`}return s===He.Correct?n:(0,D.not)(n);function o(u=D.nil){return(0,D.and)((0,D._)`typeof ${e} == "number"`,u,r?(0,D._)`isFinite(${e})`:D.nil)}}X.checkDataType=ar;function fr(t,e,r,s){if(t.length===1)return ar(t[0],e,r,s);let a;const n=(0,Ks.toHash)(t);if(n.array&&n.object){const o=(0,D._)`typeof ${e} != "object"`;a=n.null?o:(0,D._)`!${e} || ${o}`,delete n.null,delete n.array,delete n.object}else a=D.nil;n.number&&delete n.integer;for(const o in n)a=(0,D.and)(a,ar(o,e,r,s));return a}X.checkDataTypes=fr;const Bn={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,D._)`{type: ${t}}`:(0,D._)`{type: ${e}}`};function hr(t){const e=Yn(t);(0,Un.reportError)(e,Bn)}X.reportTypeError=hr;function Yn(t){const{gen:e,data:r,schema:s}=t,a=(0,Ks.schemaRefOrVal)(t,s,"type");return{gen:e,keyword:"type",data:r,schema:s.type,schemaCode:a,schemaValue:a,parentSchema:s,params:{},it:t}}var It={};Object.defineProperty(It,"__esModule",{value:!0});It.assignDefaults=void 0;const De=V,Zn=I;function Xn(t,e){const{properties:r,items:s}=t.schema;if(e==="object"&&r)for(const a in r)ds(t,a,r[a].default);else e==="array"&&Array.isArray(s)&&s.forEach((a,n)=>ds(t,n,a.default))}It.assignDefaults=Xn;function ds(t,e,r){const{gen:s,compositeRule:a,data:n,opts:o}=t;if(r===void 0)return;const u=(0,De._)`${n}${(0,De.getProperty)(e)}`;if(a){(0,Zn.checkStrictMode)(t,`default is ignored for: ${u}`);return}let c=(0,De._)`${u} === undefined`;o.useDefaults==="empty"&&(c=(0,De._)`${c} || ${u} === null || ${u} === ""`),s.if(c,(0,De._)`${u} = ${(0,De.stringify)(r)}`)}var me={},H={};Object.defineProperty(H,"__esModule",{value:!0});H.validateUnion=H.validateArray=H.usePattern=H.callValidateCode=H.schemaProperties=H.allSchemaProperties=H.noPropertyInData=H.propertyInData=H.isOwnProperty=H.hasPropFunc=H.reportMissingProp=H.checkMissingProp=H.checkReportMissingProp=void 0;const Q=V,mr=I,be=ye,xn=I;function eo(t,e){const{gen:r,data:s,it:a}=t;r.if(yr(r,s,e,a.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Q._)`${e}`},!0),t.error()})}H.checkReportMissingProp=eo;function to({gen:t,data:e,it:{opts:r}},s,a){return(0,Q.or)(...s.map(n=>(0,Q.and)(yr(t,e,n,r.ownProperties),(0,Q._)`${a} = ${n}`)))}H.checkMissingProp=to;function ro(t,e){t.setParams({missingProperty:e},!0),t.error()}H.reportMissingProp=ro;function Qs(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Q._)`Object.prototype.hasOwnProperty`})}H.hasPropFunc=Qs;function pr(t,e,r){return(0,Q._)`${Qs(t)}.call(${e}, ${r})`}H.isOwnProperty=pr;function so(t,e,r,s){const a=(0,Q._)`${e}${(0,Q.getProperty)(r)} !== undefined`;return s?(0,Q._)`${a} && ${pr(t,e,r)}`:a}H.propertyInData=so;function yr(t,e,r,s){const a=(0,Q._)`${e}${(0,Q.getProperty)(r)} === undefined`;return s?(0,Q.or)(a,(0,Q.not)(pr(t,e,r))):a}H.noPropertyInData=yr;function Ws(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}H.allSchemaProperties=Ws;function ao(t,e){return Ws(e).filter(r=>!(0,mr.alwaysValidSchema)(t,e[r]))}H.schemaProperties=ao;function no({schemaCode:t,data:e,it:{gen:r,topSchemaRef:s,schemaPath:a,errorPath:n},it:o},u,c,l){const d=l?(0,Q._)`${t}, ${e}, ${s}${a}`:e,h=[[be.default.instancePath,(0,Q.strConcat)(be.default.instancePath,n)],[be.default.parentData,o.parentData],[be.default.parentDataProperty,o.parentDataProperty],[be.default.rootData,be.default.rootData]];o.opts.dynamicRef&&h.push([be.default.dynamicAnchors,be.default.dynamicAnchors]);const g=(0,Q._)`${d}, ${r.object(...h)}`;return c!==Q.nil?(0,Q._)`${u}.call(${c}, ${g})`:(0,Q._)`${u}(${g})`}H.callValidateCode=no;const oo=(0,Q._)`new RegExp`;function io({gen:t,it:{opts:e}},r){const s=e.unicodeRegExp?"u":"",{regExp:a}=e.code,n=a(r,s);return t.scopeValue("pattern",{key:n.toString(),ref:n,code:(0,Q._)`${a.code==="new RegExp"?oo:(0,xn.useFunc)(t,a)}(${r}, ${s})`})}H.usePattern=io;function co(t){const{gen:e,data:r,keyword:s,it:a}=t,n=e.name("valid");if(a.allErrors){const u=e.let("valid",!0);return o(()=>e.assign(u,!1)),u}return e.var(n,!0),o(()=>e.break()),n;function o(u){const c=e.const("len",(0,Q._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:mr.Type.Num},n),e.if((0,Q.not)(n),u)})}}H.validateArray=co;function uo(t){const{gen:e,schema:r,keyword:s,it:a}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,mr.alwaysValidSchema)(a,c))&&!a.opts.unevaluated)return;const o=e.let("valid",!1),u=e.name("_valid");e.block(()=>r.forEach((c,l)=>{const d=t.subschema({keyword:s,schemaProp:l,compositeRule:!0},u);e.assign(o,(0,Q._)`${o} || ${u}`),t.mergeValidEvaluated(d,u)||e.if((0,Q.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}H.validateUnion=uo;Object.defineProperty(me,"__esModule",{value:!0});me.validateKeywordUsage=me.validSchemaType=me.funcKeywordCode=me.macroKeywordCode=void 0;const ae=V,Ne=ye,lo=H,fo=ot;function ho(t,e){const{gen:r,keyword:s,schema:a,parentSchema:n,it:o}=t,u=e.macro.call(o.self,a,n,o),c=Bs(r,s,u);o.opts.validateSchema!==!1&&o.self.validateSchema(u,!0);const l=r.name("valid");t.subschema({schema:u,schemaPath:ae.nil,errSchemaPath:`${o.errSchemaPath}/${s}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}me.macroKeywordCode=ho;function mo(t,e){var r;const{gen:s,keyword:a,schema:n,parentSchema:o,$data:u,it:c}=t;yo(c,e);const l=!u&&e.compile?e.compile.call(c.self,n,o,c):e.validate,d=Bs(s,a,l),h=s.let("valid");t.block$data(h,g),t.ok((r=e.valid)!==null&&r!==void 0?r:h);function g(){if(e.errors===!1)$(),e.modifying&&fs(t),p(()=>t.error());else{const f=e.async?b():y();e.modifying&&fs(t),p(()=>po(t,f))}}function b(){const f=s.let("ruleErrs",null);return s.try(()=>$((0,ae._)`await `),v=>s.assign(h,!1).if((0,ae._)`${v} instanceof ${c.ValidationError}`,()=>s.assign(f,(0,ae._)`${v}.errors`),()=>s.throw(v))),f}function y(){const f=(0,ae._)`${d}.errors`;return s.assign(f,null),$(ae.nil),f}function $(f=e.async?(0,ae._)`await `:ae.nil){const v=c.opts.passContext?Ne.default.this:Ne.default.self,E=!("compile"in e&&!u||e.schema===!1);s.assign(h,(0,ae._)`${f}${(0,lo.callValidateCode)(t,d,v,E)}`,e.modifying)}function p(f){var v;s.if((0,ae.not)((v=e.valid)!==null&&v!==void 0?v:h),f)}}me.funcKeywordCode=mo;function fs(t){const{gen:e,data:r,it:s}=t;e.if(s.parentData,()=>e.assign(r,(0,ae._)`${s.parentData}[${s.parentDataProperty}]`))}function po(t,e){const{gen:r}=t;r.if((0,ae._)`Array.isArray(${e})`,()=>{r.assign(Ne.default.vErrors,(0,ae._)`${Ne.default.vErrors} === null ? ${e} : ${Ne.default.vErrors}.concat(${e})`).assign(Ne.default.errors,(0,ae._)`${Ne.default.vErrors}.length`),(0,fo.extendErrors)(t)},()=>t.error())}function yo({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Bs(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ae.stringify)(r)})}function _o(t,e,r=!1){return!e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||r&&typeof t>"u")}me.validSchemaType=_o;function go({schema:t,opts:e,self:r,errSchemaPath:s},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n)throw new Error("ajv implementation error");const o=a.dependencies;if(o!=null&&o.some(u=>!Object.prototype.hasOwnProperty.call(t,u)))throw new Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`);if(a.validateSchema&&!a.validateSchema(t[n])){const c=`keyword "${n}" value is invalid at path "${s}": `+r.errorsText(a.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}me.validateKeywordUsage=go;var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.extendSubschemaMode=Pe.extendSubschemaData=Pe.getSubschema=void 0;const he=V,Ys=I;function $o(t,{keyword:e,schemaProp:r,schema:s,schemaPath:a,errSchemaPath:n,topSchemaRef:o}){if(e!==void 0&&s!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){const u=t.schema[e];return r===void 0?{schema:u,schemaPath:(0,he._)`${t.schemaPath}${(0,he.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:u[r],schemaPath:(0,he._)`${t.schemaPath}${(0,he.getProperty)(e)}${(0,he.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ys.escapeFragment)(r)}`}}if(s!==void 0){if(a===void 0||n===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:o,errSchemaPath:n}}throw new Error('either "keyword" or "schema" must be passed')}Pe.getSubschema=$o;function vo(t,e,{dataProp:r,dataPropType:s,data:a,dataTypes:n,propertyName:o}){if(a!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=e;if(r!==void 0){const{errorPath:l,dataPathArr:d,opts:h}=e,g=u.let("data",(0,he._)`${e.data}${(0,he.getProperty)(r)}`,!0);c(g),t.errorPath=(0,he.str)`${l}${(0,Ys.getErrorPath)(r,s,h.jsPropertySyntax)}`,t.parentDataProperty=(0,he._)`${r}`,t.dataPathArr=[...d,t.parentDataProperty]}if(a!==void 0){const l=a instanceof he.Name?a:u.let("data",a,!0);c(l),o!==void 0&&(t.propertyName=o)}n&&(t.dataTypes=n);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}Pe.extendSubschemaData=vo;function wo(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:s,createErrors:a,allErrors:n}){s!==void 0&&(t.compositeRule=s),a!==void 0&&(t.createErrors=a),n!==void 0&&(t.allErrors=n),t.jtdDiscriminator=e,t.jtdMetadata=r}Pe.extendSubschemaMode=wo;var re={},Zs=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var s,a,n;if(Array.isArray(e)){if(s=e.length,s!=r.length)return!1;for(a=s;a--!==0;)if(!t(e[a],r[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(r).length)return!1;for(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(r,n[a]))return!1;for(a=s;a--!==0;){var o=n[a];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r},Xs={exports:{}},Ee=Xs.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},a=r.post||function(){};_t(e,s,a,t,"",t)};Ee.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ee.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ee.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ee.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};function _t(t,e,r,s,a,n,o,u,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,a,n,o,u,c,l);for(var d in s){var h=s[d];if(Array.isArray(h)){if(d in Ee.arrayKeywords)for(var g=0;g<h.length;g++)_t(t,e,r,h[g],a+"/"+d+"/"+g,n,a,d,s,g)}else if(d in Ee.propsKeywords){if(h&&typeof h=="object")for(var b in h)_t(t,e,r,h[b],a+"/"+d+"/"+bo(b),n,a,d,s,b)}else(d in Ee.keywords||t.allKeys&&!(d in Ee.skipKeywords))&&_t(t,e,r,h,a+"/"+d,n,a,d,s)}r(s,a,n,o,u,c,l)}}function bo(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var So=Xs.exports;Object.defineProperty(re,"__esModule",{value:!0});re.getSchemaRefs=re.resolveUrl=re.normalizeId=re._getFullPath=re.getFullPath=re.inlineRef=void 0;const ko=I,Eo=Zs,Po=So,To=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Ro(t,e=!0){return typeof t=="boolean"?!0:e===!0?!nr(t):e?xs(t)<=e:!1}re.inlineRef=Ro;const Io=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function nr(t){for(const e in t){if(Io.has(e))return!0;const r=t[e];if(Array.isArray(r)&&r.some(nr)||typeof r=="object"&&nr(r))return!0}return!1}function xs(t){let e=0;for(const r in t){if(r==="$ref")return 1/0;if(e++,!To.has(r)&&(typeof t[r]=="object"&&(0,ko.eachItem)(t[r],s=>e+=xs(s)),e===1/0))return 1/0}return e}function ea(t,e="",r){r!==!1&&(e=Le(e));const s=t.parse(e);return ta(t,s)}re.getFullPath=ea;function ta(t,e){return t.serialize(e).split("#")[0]+"#"}re._getFullPath=ta;const No=/#\/?$/;function Le(t){return t?t.replace(No,""):""}re.normalizeId=Le;function Oo(t,e,r){return r=Le(r),t.resolve(e,r)}re.resolveUrl=Oo;const Co=/^[a-z_][-a-z0-9._]*$/i;function jo(t,e){if(typeof t=="boolean")return{};const{schemaId:r,uriResolver:s}=this.opts,a=Le(t[r]||e),n={"":a},o=ea(s,a,!1),u={},c=new Set;return Po(t,{allKeys:!0},(h,g,b,y)=>{if(y===void 0)return;const $=o+g;let p=n[y];typeof h[r]=="string"&&(p=f.call(this,h[r])),v.call(this,h.$anchor),v.call(this,h.$dynamicAnchor),n[g]=p;function f(E){const P=this.opts.uriResolver.resolve;if(E=Le(p?P(p,E):E),c.has(E))throw d(E);c.add(E);let R=this.refs[E];return typeof R=="string"&&(R=this.refs[R]),typeof R=="object"?l(h,R.schema,E):E!==Le($)&&(E[0]==="#"?(l(h,u[E],E),u[E]=h):this.refs[E]=$),E}function v(E){if(typeof E=="string"){if(!Co.test(E))throw new Error(`invalid anchor "${E}"`);f.call(this,`#${E}`)}}}),u;function l(h,g,b){if(g!==void 0&&!Eo(h,g))throw d(b)}function d(h){return new Error(`reference "${h}" resolves to more than one schema`)}}re.getSchemaRefs=jo;Object.defineProperty(fe,"__esModule",{value:!0});fe.getData=fe.KeywordCxt=fe.validateFunctionCode=void 0;const ra=Ue,hs=X,_r=$e,St=X,Mo=It,et=me,Bt=Pe,N=V,q=ye,qo=re,ve=I,Ye=ot;function Ao(t){if(na(t)&&(oa(t),aa(t))){Vo(t);return}sa(t,()=>(0,ra.topBoolOrEmptySchema)(t))}fe.validateFunctionCode=Ao;function sa({gen:t,validateName:e,schema:r,schemaEnv:s,opts:a},n){a.code.es5?t.func(e,(0,N._)`${q.default.data}, ${q.default.valCxt}`,s.$async,()=>{t.code((0,N._)`"use strict"; ${ms(r,a)}`),zo(t,a),t.code(n)}):t.func(e,(0,N._)`${q.default.data}, ${Do(a)}`,s.$async,()=>t.code(ms(r,a)).code(n))}function Do(t){return(0,N._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${t.dynamicRef?(0,N._)`, ${q.default.dynamicAnchors}={}`:N.nil}}={}`}function zo(t,e){t.if(q.default.valCxt,()=>{t.var(q.default.instancePath,(0,N._)`${q.default.valCxt}.${q.default.instancePath}`),t.var(q.default.parentData,(0,N._)`${q.default.valCxt}.${q.default.parentData}`),t.var(q.default.parentDataProperty,(0,N._)`${q.default.valCxt}.${q.default.parentDataProperty}`),t.var(q.default.rootData,(0,N._)`${q.default.valCxt}.${q.default.rootData}`),e.dynamicRef&&t.var(q.default.dynamicAnchors,(0,N._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{t.var(q.default.instancePath,(0,N._)`""`),t.var(q.default.parentData,(0,N._)`undefined`),t.var(q.default.parentDataProperty,(0,N._)`undefined`),t.var(q.default.rootData,q.default.data),e.dynamicRef&&t.var(q.default.dynamicAnchors,(0,N._)`{}`)})}function Vo(t){const{schema:e,opts:r,gen:s}=t;sa(t,()=>{r.$comment&&e.$comment&&ca(t),Ko(t),s.let(q.default.vErrors,null),s.let(q.default.errors,0),r.unevaluated&&Fo(t),ia(t),Qo(t)})}function Fo(t){const{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,N._)`${r}.evaluated`),e.if((0,N._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,N._)`${t.evaluated}.props`,(0,N._)`undefined`)),e.if((0,N._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,N._)`${t.evaluated}.items`,(0,N._)`undefined`))}function ms(t,e){const r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,N._)`/*# sourceURL=${r} */`:N.nil}function Ho(t,e){if(na(t)&&(oa(t),aa(t))){Lo(t,e);return}(0,ra.boolOrEmptySchema)(t,e)}function aa({schema:t,self:e}){if(typeof t=="boolean")return!t;for(const r in t)if(e.RULES.all[r])return!0;return!1}function na(t){return typeof t.schema!="boolean"}function Lo(t,e){const{schema:r,gen:s,opts:a}=t;a.$comment&&r.$comment&&ca(t),Go(t),Jo(t);const n=s.const("_errs",q.default.errors);ia(t,n),s.var(e,(0,N._)`${n} === ${q.default.errors}`)}function oa(t){(0,ve.checkUnknownRules)(t),Uo(t)}function ia(t,e){if(t.opts.jtd)return ps(t,[],!1,e);const r=(0,hs.getSchemaTypes)(t.schema),s=(0,hs.coerceAndCheckDataType)(t,r);ps(t,r,!s,e)}function Uo(t){const{schema:e,errSchemaPath:r,opts:s,self:a}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0,ve.schemaHasRulesButRef)(e,a.RULES)&&a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Ko(t){const{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ve.checkStrictMode)(t,"default is ignored in the schema root")}function Go(t){const e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,qo.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Jo(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ca({gen:t,schemaEnv:e,schema:r,errSchemaPath:s,opts:a}){const n=r.$comment;if(a.$comment===!0)t.code((0,N._)`${q.default.self}.logger.log(${n})`);else if(typeof a.$comment=="function"){const o=(0,N.str)`${s}/$comment`,u=t.scopeValue("root",{ref:e.root});t.code((0,N._)`${q.default.self}.opts.$comment(${n}, ${o}, ${u}.schema)`)}}function Qo(t){const{gen:e,schemaEnv:r,validateName:s,ValidationError:a,opts:n}=t;r.$async?e.if((0,N._)`${q.default.errors} === 0`,()=>e.return(q.default.data),()=>e.throw((0,N._)`new ${a}(${q.default.vErrors})`)):(e.assign((0,N._)`${s}.errors`,q.default.vErrors),n.unevaluated&&Wo(t),e.return((0,N._)`${q.default.errors} === 0`))}function Wo({gen:t,evaluated:e,props:r,items:s}){r instanceof N.Name&&t.assign((0,N._)`${e}.props`,r),s instanceof N.Name&&t.assign((0,N._)`${e}.items`,s)}function ps(t,e,r,s){const{gen:a,schema:n,data:o,allErrors:u,opts:c,self:l}=t,{RULES:d}=l;if(n.$ref&&(c.ignoreKeywordsWithRef||!(0,ve.schemaHasRulesButRef)(n,d))){a.block(()=>da(t,"$ref",d.all.$ref.definition));return}c.jtd||Bo(t,e),a.block(()=>{for(const g of d.rules)h(g);h(d.post)});function h(g){(0,_r.shouldUseGroup)(n,g)&&(g.type?(a.if((0,St.checkDataType)(g.type,o,c.strictNumbers)),ys(t,g),e.length===1&&e[0]===g.type&&r&&(a.else(),(0,St.reportTypeError)(t)),a.endIf()):ys(t,g),u||a.if((0,N._)`${q.default.errors} === ${s||0}`))}}function ys(t,e){const{gen:r,schema:s,opts:{useDefaults:a}}=t;a&&(0,Mo.assignDefaults)(t,e.type),r.block(()=>{for(const n of e.rules)(0,_r.shouldUseRule)(s,n)&&da(t,n.keyword,n.definition,e.type)})}function Bo(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Yo(t,e),t.opts.allowUnionTypes||Zo(t,e),Xo(t,t.dataTypes))}function Yo(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{ua(t.dataTypes,r)||gr(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),ei(t,e)}}function Zo(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&gr(t,"use allowUnionTypes to allow union type keyword")}function Xo(t,e){const r=t.self.RULES.all;for(const s in r){const a=r[s];if(typeof a=="object"&&(0,_r.shouldUseRule)(t.schema,a)){const{type:n}=a.definition;n.length&&!n.some(o=>xo(e,o))&&gr(t,`missing type "${n.join(",")}" for keyword "${s}"`)}}}function xo(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function ua(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function ei(t,e){const r=[];for(const s of t.dataTypes)ua(e,s)?r.push(s):e.includes("integer")&&s==="number"&&r.push("integer");t.dataTypes=r}function gr(t,e){const r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ve.checkStrictMode)(t,e,t.opts.strictTypes)}class la{constructor(e,r,s){if((0,et.validateKeywordUsage)(e,r,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ve.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",fa(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,et.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",q.default.errors))}result(e,r,s){this.failResult((0,N.not)(e),r,s)}failResult(e,r,s){this.gen.if(e),s?s():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,N.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:r}=this;this.fail((0,N._)`${r} !== undefined && (${(0,N.or)(this.invalid$data(),e)})`)}error(e,r,s){if(r){this.setParams(r),this._error(e,s),this.setParams({});return}this._error(e,s)}_error(e,r){(e?Ye.reportExtraError:Ye.reportError)(this,this.def.error,r)}$dataError(){(0,Ye.reportError)(this,this.def.$dataError||Ye.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ye.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,s=N.nil){this.gen.block(()=>{this.check$data(e,s),r()})}check$data(e=N.nil,r=N.nil){if(!this.$data)return;const{gen:s,schemaCode:a,schemaType:n,def:o}=this;s.if((0,N.or)((0,N._)`${a} === undefined`,r)),e!==N.nil&&s.assign(e,!0),(n.length||o.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==N.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:r,schemaType:s,def:a,it:n}=this;return(0,N.or)(o(),u());function o(){if(s.length){if(!(r instanceof N.Name))throw new Error("ajv implementation error");const c=Array.isArray(s)?s:[s];return(0,N._)`${(0,St.checkDataTypes)(c,r,n.opts.strictNumbers,St.DataType.Wrong)}`}return N.nil}function u(){if(a.validateSchema){const c=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,N._)`!${c}(${r})`}return N.nil}}subschema(e,r){const s=(0,Bt.getSubschema)(this.it,e);(0,Bt.extendSubschemaData)(s,this.it,e),(0,Bt.extendSubschemaMode)(s,e);const a={...this.it,...s,items:void 0,props:void 0};return Ho(a,r),a}mergeEvaluated(e,r){const{it:s,gen:a}=this;s.opts.unevaluated&&(s.props!==!0&&e.props!==void 0&&(s.props=ve.mergeEvaluated.props(a,e.props,s.props,r)),s.items!==!0&&e.items!==void 0&&(s.items=ve.mergeEvaluated.items(a,e.items,s.items,r)))}mergeValidEvaluated(e,r){const{it:s,gen:a}=this;if(s.opts.unevaluated&&(s.props!==!0||s.items!==!0))return a.if(r,()=>this.mergeEvaluated(e,N.Name)),!0}}fe.KeywordCxt=la;function da(t,e,r,s){const a=new la(t,r,e);"code"in r?r.code(a,s):a.$data&&r.validate?(0,et.funcKeywordCode)(a,r):"macro"in r?(0,et.macroKeywordCode)(a,r):(r.compile||r.validate)&&(0,et.funcKeywordCode)(a,r)}const ti=/^\/(?:[^~]|~0|~1)*$/,ri=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fa(t,{dataLevel:e,dataNames:r,dataPathArr:s}){let a,n;if(t==="")return q.default.rootData;if(t[0]==="/"){if(!ti.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);a=t,n=q.default.rootData}else{const l=ri.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);const d=+l[1];if(a=l[2],a==="#"){if(d>=e)throw new Error(c("property/index",d));return s[e-d]}if(d>e)throw new Error(c("data",d));if(n=r[e-d],!a)return n}let o=n;const u=a.split("/");for(const l of u)l&&(n=(0,N._)`${n}${(0,N.getProperty)((0,ve.unescapeJsonPointer)(l))}`,o=(0,N._)`${o} && ${n}`);return o;function c(l,d){return`Cannot access ${l} ${d} levels up, current level is ${e}`}}fe.getData=fa;var it={};Object.defineProperty(it,"__esModule",{value:!0});class si extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}it.default=si;var Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});const Yt=re;class ai extends Error{constructor(e,r,s,a){super(a||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0,Yt.resolveUrl)(e,r,s),this.missingSchema=(0,Yt.normalizeId)((0,Yt.getFullPath)(e,this.missingRef))}}Ge.default=ai;var oe={};Object.defineProperty(oe,"__esModule",{value:!0});oe.resolveSchema=oe.getCompilingSchema=oe.resolveRef=oe.compileSchema=oe.SchemaEnv=void 0;const ue=V,ni=it,Ie=ye,de=re,_s=I,oi=fe;class Nt{constructor(e){var r;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,de.normalizeId)(s==null?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s==null?void 0:s.$async,this.refs={}}}oe.SchemaEnv=Nt;function $r(t){const e=ha.call(this,t);if(e)return e;const r=(0,de.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:a}=this.opts.code,{ownProperties:n}=this.opts,o=new ue.CodeGen(this.scope,{es5:s,lines:a,ownProperties:n});let u;t.$async&&(u=o.scopeValue("Error",{ref:ni.default,code:(0,ue._)`require("ajv/dist/runtime/validation_error").default`}));const c=o.scopeName("validate");t.validateName=c;const l={gen:o,allErrors:this.opts.allErrors,data:Ie.default.data,parentData:Ie.default.parentData,parentDataProperty:Ie.default.parentDataProperty,dataNames:[Ie.default.data],dataPathArr:[ue.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ue.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:u,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ue.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ue._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(t),(0,oi.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);const h=o.toString();d=`${o.scopeRefs(Ie.default.scope)}return ${h}`,this.opts.code.process&&(d=this.opts.code.process(d,t));const b=new Function(`${Ie.default.self}`,`${Ie.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:b}),b.errors=null,b.schema=t.schema,b.schemaEnv=t,t.$async&&(b.$async=!0),this.opts.code.source===!0&&(b.source={validateName:c,validateCode:h,scopeValues:o._values}),this.opts.unevaluated){const{props:y,items:$}=l;b.evaluated={props:y instanceof ue.Name?void 0:y,items:$ instanceof ue.Name?void 0:$,dynamicProps:y instanceof ue.Name,dynamicItems:$ instanceof ue.Name},b.source&&(b.source.evaluated=(0,ue.stringify)(b.evaluated))}return t.validate=b,t}catch(h){throw delete t.validate,delete t.validateName,d&&this.logger.error("Error compiling schema, function code:",d),h}finally{this._compilations.delete(t)}}oe.compileSchema=$r;function ii(t,e,r){var s;r=(0,de.resolveUrl)(this.opts.uriResolver,e,r);const a=t.refs[r];if(a)return a;let n=li.call(this,t,r);if(n===void 0){const o=(s=t.localRefs)===null||s===void 0?void 0:s[r],{schemaId:u}=this.opts;o&&(n=new Nt({schema:o,schemaId:u,root:t,baseId:e}))}if(n!==void 0)return t.refs[r]=ci.call(this,n)}oe.resolveRef=ii;function ci(t){return(0,de.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:$r.call(this,t)}function ha(t){for(const e of this._compilations)if(ui(e,t))return e}oe.getCompilingSchema=ha;function ui(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function li(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ot.call(this,t,e)}function Ot(t,e){const r=this.opts.uriResolver.parse(e),s=(0,de._getFullPath)(this.opts.uriResolver,r);let a=(0,de.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===a)return Zt.call(this,r,t);const n=(0,de.normalizeId)(s),o=this.refs[n]||this.schemas[n];if(typeof o=="string"){const u=Ot.call(this,t,o);return typeof(u==null?void 0:u.schema)!="object"?void 0:Zt.call(this,r,u)}if(typeof(o==null?void 0:o.schema)=="object"){if(o.validate||$r.call(this,o),n===(0,de.normalizeId)(e)){const{schema:u}=o,{schemaId:c}=this.opts,l=u[c];return l&&(a=(0,de.resolveUrl)(this.opts.uriResolver,a,l)),new Nt({schema:u,schemaId:c,root:t,baseId:a})}return Zt.call(this,r,o)}}oe.resolveSchema=Ot;const di=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zt(t,{baseId:e,schema:r,root:s}){var a;if(((a=t.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(const u of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;const c=r[(0,_s.unescapeFragment)(u)];if(c===void 0)return;r=c;const l=typeof r=="object"&&r[this.opts.schemaId];!di.has(u)&&l&&(e=(0,de.resolveUrl)(this.opts.uriResolver,e,l))}let n;if(typeof r!="boolean"&&r.$ref&&!(0,_s.schemaHasRulesButRef)(r,this.RULES)){const u=(0,de.resolveUrl)(this.opts.uriResolver,e,r.$ref);n=Ot.call(this,s,u)}const{schemaId:o}=this.opts;if(n=n||new Nt({schema:r,schemaId:o,root:s,baseId:e}),n.schema!==n.root.schema)return n}const fi="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",hi="Meta-schema for $data reference (JSON AnySchema extension proposal)",mi="object",pi=["$data"],yi={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},_i=!1,gi={$id:fi,description:hi,type:mi,required:pi,properties:yi,additionalProperties:_i};var vr={},Ct={exports:{}};const $i=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ma=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function wr(t){let e="",r=0,s=0;for(s=0;s<t.length;s++)if(r=t[s].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s];break}for(s+=1;s<t.length;s++){if(r=t[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[s]}return e}const vi=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function gs(t){return t.length=0,!0}function wi(t,e,r){if(t.length){const s=wr(t);if(s!=="")e.push(s);else return r.error=!0,!1;t.length=0}return!0}function bi(t){let e=0;const r={error:!1,address:"",zone:""},s=[],a=[];let n=!1,o=!1,u=wi;for(let c=0;c<t.length;c++){const l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(n===!0&&(o=!0),!u(a,s,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(n=!0),s.push(":");continue}else if(l==="%"){if(!u(a,s,r))break;u=gs}else{a.push(l);continue}}return a.length&&(u===gs?r.zone=a.join(""):o?s.push(a.join("")):s.push(wr(a))),r.address=s.join(""),r}function pa(t){if(Si(t,":")<2)return{host:t,isIPV6:!1};const e=bi(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,s=e.address;return e.zone&&(r+="%"+e.zone,s+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:s}}}function Si(t,e){let r=0;for(let s=0;s<t.length;s++)t[s]===e&&r++;return r}function ki(t){let e=t;const r=[];let s=-1,a=0;for(;a=e.length;){if(a===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(a===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(a===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((s=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,s)),e=e.slice(s)}return r.join("")}function Ei(t,e){const r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Pi(t){const e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!ma(r)){const s=pa(r);s.isIPV6===!0?r=`[${s.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}var ya={nonSimpleDomain:vi,recomposeAuthority:Pi,normalizeComponentEncoding:Ei,removeDotSegments:ki,isIPv4:ma,isUUID:$i,normalizeIPv6:pa,stringArrayToHexStripped:wr};const{isUUID:Ti}=ya,Ri=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Ii=["http","https","ws","wss","urn","urn:uuid"];function Ni(t){return Ii.indexOf(t)!==-1}function br(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function _a(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function ga(t){const e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function Oi(t){return t.secure=br(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Ci(t){if((t.port===(br(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){const[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function ji(t,e){if(!t.path)return t.error="URN can not be parsed",t;const r=t.path.match(Ri);if(r){const s=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];const a=`${s}:${e.nid||t.nid}`,n=Sr(a);t.path=void 0,n&&(t=n.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Mi(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");const r=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),a=`${r}:${e.nid||s}`,n=Sr(a);n&&(t=n.serialize(t,e));const o=t,u=t.nss;return o.path=`${s||e.nid}:${u}`,e.skipEscape=!0,o}function qi(t,e){const r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Ti(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Ai(t){const e=t;return e.nss=(t.uuid||"").toLowerCase(),e}const $a={scheme:"http",domainHost:!0,parse:_a,serialize:ga},Di={scheme:"https",domainHost:$a.domainHost,parse:_a,serialize:ga},gt={scheme:"ws",domainHost:!0,parse:Oi,serialize:Ci},zi={scheme:"wss",domainHost:gt.domainHost,parse:gt.parse,serialize:gt.serialize},Vi={scheme:"urn",parse:ji,serialize:Mi,skipNormalize:!0},Fi={scheme:"urn:uuid",parse:qi,serialize:Ai,skipNormalize:!0},kt={http:$a,https:Di,ws:gt,wss:zi,urn:Vi,"urn:uuid":Fi};Object.setPrototypeOf(kt,null);function Sr(t){return t&&(kt[t]||kt[t.toLowerCase()])||void 0}var Hi={wsIsSecure:br,SCHEMES:kt,isValidSchemeName:Ni,getSchemeHandler:Sr};const{normalizeIPv6:Li,removeDotSegments:Xe,recomposeAuthority:Ui,normalizeComponentEncoding:dt,isIPv4:Ki,nonSimpleDomain:Gi}=ya,{SCHEMES:Ji,getSchemeHandler:va}=Hi;function Qi(t,e){return typeof t=="string"?t=pe(we(t,e),e):typeof t=="object"&&(t=we(pe(t,e),e)),t}function Wi(t,e,r){const s=r?Object.assign({scheme:"null"},r):{scheme:"null"},a=wa(we(t,s),we(e,s),s,!0);return s.skipEscape=!0,pe(a,s)}function wa(t,e,r,s){const a={};return s||(t=we(pe(t,r),r),e=we(pe(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(a.scheme=e.scheme,a.userinfo=e.userinfo,a.host=e.host,a.port=e.port,a.path=Xe(e.path||""),a.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(a.userinfo=e.userinfo,a.host=e.host,a.port=e.port,a.path=Xe(e.path||""),a.query=e.query):(e.path?(e.path[0]==="/"?a.path=Xe(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?a.path="/"+e.path:t.path?a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:a.path=e.path,a.path=Xe(a.path)),a.query=e.query):(a.path=t.path,e.query!==void 0?a.query=e.query:a.query=t.query),a.userinfo=t.userinfo,a.host=t.host,a.port=t.port),a.scheme=t.scheme),a.fragment=e.fragment,a}function Bi(t,e,r){return typeof t=="string"?(t=unescape(t),t=pe(dt(we(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=pe(dt(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=pe(dt(we(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=pe(dt(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function pe(t,e){const r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},s=Object.assign({},e),a=[],n=va(s.scheme||r.scheme);n&&n.serialize&&n.serialize(r,s),r.path!==void 0&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),s.reference!=="suffix"&&r.scheme&&a.push(r.scheme,":");const o=Ui(r);if(o!==void 0&&(s.reference!=="suffix"&&a.push("//"),a.push(o),r.path&&r.path[0]!=="/"&&a.push("/")),r.path!==void 0){let u=r.path;!s.absolutePath&&(!n||!n.absolutePath)&&(u=Xe(u)),o===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),a.push(u)}return r.query!==void 0&&a.push("?",r.query),r.fragment!==void 0&&a.push("#",r.fragment),a.join("")}const Yi=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function we(t,e){const r=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let a=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);const n=t.match(Yi);if(n){if(s.scheme=n[1],s.userinfo=n[3],s.host=n[4],s.port=parseInt(n[5],10),s.path=n[6]||"",s.query=n[7],s.fragment=n[8],isNaN(s.port)&&(s.port=n[5]),s.host)if(Ki(s.host)===!1){const c=Li(s.host);s.host=c.host.toLowerCase(),a=c.isIPV6}else a=!0;s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==s.reference&&(s.error=s.error||"URI is not a "+r.reference+" reference.");const o=va(r.scheme||s.scheme);if(!r.unicodeSupport&&(!o||!o.unicodeSupport)&&s.host&&(r.domainHost||o&&o.domainHost)&&a===!1&&Gi(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(u){s.error=s.error||"Host's domain name can not be converted to ASCII: "+u}(!o||o&&!o.skipNormalize)&&(t.indexOf("%")!==-1&&(s.scheme!==void 0&&(s.scheme=unescape(s.scheme)),s.host!==void 0&&(s.host=unescape(s.host))),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),o&&o.parse&&o.parse(s,r)}else s.error=s.error||"URI can not be parsed.";return s}const kr={SCHEMES:Ji,normalize:Qi,resolve:Wi,resolveComponent:wa,equal:Bi,serialize:pe,parse:we};Ct.exports=kr;Ct.exports.default=kr;Ct.exports.fastUri=kr;var Zi=Ct.exports;Object.defineProperty(vr,"__esModule",{value:!0});const ba=Zi;ba.code='require("ajv/dist/runtime/uri").default';vr.default=ba;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=fe;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=V;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const s=it,a=Ge,n=je,o=oe,u=V,c=re,l=X,d=I,h=gi,g=vr,b=(T,_)=>new RegExp(T,_);b.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],$=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),p={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},f={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function E(T){var _,k,w,i,m,S,O,C,G,K,x,qe,qt,At,Dt,zt,Vt,Ft,Ht,Lt,Ut,Kt,Gt,Jt,Qt;const Be=T.strict,Wt=(_=T.code)===null||_===void 0?void 0:_.optimize,rs=Wt===!0||Wt===void 0?1:Wt||0,ss=(w=(k=T.code)===null||k===void 0?void 0:k.regExp)!==null&&w!==void 0?w:b,Ma=(i=T.uriResolver)!==null&&i!==void 0?i:g.default;return{strictSchema:(S=(m=T.strictSchema)!==null&&m!==void 0?m:Be)!==null&&S!==void 0?S:!0,strictNumbers:(C=(O=T.strictNumbers)!==null&&O!==void 0?O:Be)!==null&&C!==void 0?C:!0,strictTypes:(K=(G=T.strictTypes)!==null&&G!==void 0?G:Be)!==null&&K!==void 0?K:"log",strictTuples:(qe=(x=T.strictTuples)!==null&&x!==void 0?x:Be)!==null&&qe!==void 0?qe:"log",strictRequired:(At=(qt=T.strictRequired)!==null&&qt!==void 0?qt:Be)!==null&&At!==void 0?At:!1,code:T.code?{...T.code,optimize:rs,regExp:ss}:{optimize:rs,regExp:ss},loopRequired:(Dt=T.loopRequired)!==null&&Dt!==void 0?Dt:v,loopEnum:(zt=T.loopEnum)!==null&&zt!==void 0?zt:v,meta:(Vt=T.meta)!==null&&Vt!==void 0?Vt:!0,messages:(Ft=T.messages)!==null&&Ft!==void 0?Ft:!0,inlineRefs:(Ht=T.inlineRefs)!==null&&Ht!==void 0?Ht:!0,schemaId:(Lt=T.schemaId)!==null&&Lt!==void 0?Lt:"$id",addUsedSchema:(Ut=T.addUsedSchema)!==null&&Ut!==void 0?Ut:!0,validateSchema:(Kt=T.validateSchema)!==null&&Kt!==void 0?Kt:!0,validateFormats:(Gt=T.validateFormats)!==null&&Gt!==void 0?Gt:!0,unicodeRegExp:(Jt=T.unicodeRegExp)!==null&&Jt!==void 0?Jt:!0,int32range:(Qt=T.int32range)!==null&&Qt!==void 0?Qt:!0,uriResolver:Ma}}class P{constructor(_={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,_=this.opts={..._,...E(_)};const{es5:k,lines:w}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:$,es5:k,lines:w}),this.logger=F(_.logger);const i=_.validateFormats;_.validateFormats=!1,this.RULES=(0,n.getRules)(),R.call(this,p,_,"NOT SUPPORTED"),R.call(this,f,_,"DEPRECATED","warn"),this._metaOpts=ce.call(this),_.formats&&Y.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),_.keywords&&B.call(this,_.keywords),typeof _.meta=="object"&&this.addMetaSchema(_.meta),A.call(this),_.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:_,meta:k,schemaId:w}=this.opts;let i=h;w==="id"&&(i={...h},i.id=i.$id,delete i.$id),k&&_&&this.addMetaSchema(i,i[w],!1)}defaultMeta(){const{meta:_,schemaId:k}=this.opts;return this.opts.defaultMeta=typeof _=="object"?_[k]||_:void 0}validate(_,k){let w;if(typeof _=="string"){if(w=this.getSchema(_),!w)throw new Error(`no schema with key or ref "${_}"`)}else w=this.compile(_);const i=w(k);return"$async"in w||(this.errors=w.errors),i}compile(_,k){const w=this._addSchema(_,k);return w.validate||this._compileSchemaEnv(w)}compileAsync(_,k){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:w}=this.opts;return i.call(this,_,k);async function i(K,x){await m.call(this,K.$schema);const qe=this._addSchema(K,x);return qe.validate||S.call(this,qe)}async function m(K){K&&!this.getSchema(K)&&await i.call(this,{$ref:K},!0)}async function S(K){try{return this._compileSchemaEnv(K)}catch(x){if(!(x instanceof a.default))throw x;return O.call(this,x),await C.call(this,x.missingSchema),S.call(this,K)}}function O({missingSchema:K,missingRef:x}){if(this.refs[K])throw new Error(`AnySchema ${K} is loaded but ${x} cannot be resolved`)}async function C(K){const x=await G.call(this,K);this.refs[K]||await m.call(this,x.$schema),this.refs[K]||this.addSchema(x,K,k)}async function G(K){const x=this._loading[K];if(x)return x;try{return await(this._loading[K]=w(K))}finally{delete this._loading[K]}}}addSchema(_,k,w,i=this.opts.validateSchema){if(Array.isArray(_)){for(const S of _)this.addSchema(S,void 0,w,i);return this}let m;if(typeof _=="object"){const{schemaId:S}=this.opts;if(m=_[S],m!==void 0&&typeof m!="string")throw new Error(`schema ${S} must be string`)}return k=(0,c.normalizeId)(k||m),this._checkUnique(k),this.schemas[k]=this._addSchema(_,w,k,i,!0),this}addMetaSchema(_,k,w=this.opts.validateSchema){return this.addSchema(_,k,!0,w),this}validateSchema(_,k){if(typeof _=="boolean")return!0;let w;if(w=_.$schema,w!==void 0&&typeof w!="string")throw new Error("$schema must be a string");if(w=w||this.opts.defaultMeta||this.defaultMeta(),!w)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const i=this.validate(w,_);if(!i&&k){const m="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(m);else throw new Error(m)}return i}getSchema(_){let k;for(;typeof(k=U.call(this,_))=="string";)_=k;if(k===void 0){const{schemaId:w}=this.opts,i=new o.SchemaEnv({schema:{},schemaId:w});if(k=o.resolveSchema.call(this,i,_),!k)return;this.refs[_]=k}return k.validate||this._compileSchemaEnv(k)}removeSchema(_){if(_ instanceof RegExp)return this._removeAllSchemas(this.schemas,_),this._removeAllSchemas(this.refs,_),this;switch(typeof _){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const k=U.call(this,_);return typeof k=="object"&&this._cache.delete(k.schema),delete this.schemas[_],delete this.refs[_],this}case"object":{const k=_;this._cache.delete(k);let w=_[this.opts.schemaId];return w&&(w=(0,c.normalizeId)(w),delete this.schemas[w],delete this.refs[w]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(_){for(const k of _)this.addKeyword(k);return this}addKeyword(_,k){let w;if(typeof _=="string")w=_,typeof k=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),k.keyword=w);else if(typeof _=="object"&&k===void 0){if(k=_,w=k.keyword,Array.isArray(w)&&!w.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(L.call(this,w,k),!k)return(0,d.eachItem)(w,m=>ee.call(this,m)),this;ge.call(this,k);const i={...k,type:(0,l.getJSONTypes)(k.type),schemaType:(0,l.getJSONTypes)(k.schemaType)};return(0,d.eachItem)(w,i.type.length===0?m=>ee.call(this,m,i):m=>i.type.forEach(S=>ee.call(this,m,i,S))),this}getKeyword(_){const k=this.RULES.all[_];return typeof k=="object"?k.definition:!!k}removeKeyword(_){const{RULES:k}=this;delete k.keywords[_],delete k.all[_];for(const w of k.rules){const i=w.rules.findIndex(m=>m.keyword===_);i>=0&&w.rules.splice(i,1)}return this}addFormat(_,k){return typeof k=="string"&&(k=new RegExp(k)),this.formats[_]=k,this}errorsText(_=this.errors,{separator:k=", ",dataVar:w="data"}={}){return!_||_.length===0?"No errors":_.map(i=>`${w}${i.instancePath} ${i.message}`).reduce((i,m)=>i+k+m)}$dataMetaSchema(_,k){const w=this.RULES.all;_=JSON.parse(JSON.stringify(_));for(const i of k){const m=i.split("/").slice(1);let S=_;for(const O of m)S=S[O];for(const O in w){const C=w[O];if(typeof C!="object")continue;const{$data:G}=C.definition,K=S[O];G&&K&&(S[O]=Te(K))}}return _}_removeAllSchemas(_,k){for(const w in _){const i=_[w];(!k||k.test(w))&&(typeof i=="string"?delete _[w]:i&&!i.meta&&(this._cache.delete(i.schema),delete _[w]))}}_addSchema(_,k,w,i=this.opts.validateSchema,m=this.opts.addUsedSchema){let S;const{schemaId:O}=this.opts;if(typeof _=="object")S=_[O];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof _!="boolean")throw new Error("schema must be object or boolean")}let C=this._cache.get(_);if(C!==void 0)return C;w=(0,c.normalizeId)(S||w);const G=c.getSchemaRefs.call(this,_,w);return C=new o.SchemaEnv({schema:_,schemaId:O,meta:k,baseId:w,localRefs:G}),this._cache.set(C.schema,C),m&&!w.startsWith("#")&&(w&&this._checkUnique(w),this.refs[w]=C),i&&this.validateSchema(_,!0),C}_checkUnique(_){if(this.schemas[_]||this.refs[_])throw new Error(`schema with key or id "${_}" already exists`)}_compileSchemaEnv(_){if(_.meta?this._compileMetaSchema(_):o.compileSchema.call(this,_),!_.validate)throw new Error("ajv implementation error");return _.validate}_compileMetaSchema(_){const k=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,_)}finally{this.opts=k}}}P.ValidationError=s.default,P.MissingRefError=a.default,t.default=P;function R(T,_,k,w="error"){for(const i in T){const m=i;m in _&&this.logger[w](`${k}: option ${i}. ${T[m]}`)}}function U(T){return T=(0,c.normalizeId)(T),this.schemas[T]||this.refs[T]}function A(){const T=this.opts.schemas;if(T)if(Array.isArray(T))this.addSchema(T);else for(const _ in T)this.addSchema(T[_],_)}function Y(){for(const T in this.opts.formats){const _=this.opts.formats[T];_&&this.addFormat(T,_)}}function B(T){if(Array.isArray(T)){this.addVocabulary(T);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const _ in T){const k=T[_];k.keyword||(k.keyword=_),this.addKeyword(k)}}function ce(){const T={...this.opts};for(const _ of y)delete T[_];return T}const j={log(){},warn(){},error(){}};function F(T){if(T===!1)return j;if(T===void 0)return console;if(T.log&&T.warn&&T.error)return T;throw new Error("logger must implement log, warn and error methods")}const W=/^[a-z_$][a-z0-9_$:-]*$/i;function L(T,_){const{RULES:k}=this;if((0,d.eachItem)(T,w=>{if(k.keywords[w])throw new Error(`Keyword ${w} is already defined`);if(!W.test(w))throw new Error(`Keyword ${w} has invalid name`)}),!!_&&_.$data&&!("code"in _||"validate"in _))throw new Error('$data keyword must have "code" or "validate" function')}function ee(T,_,k){var w;const i=_==null?void 0:_.post;if(k&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:m}=this;let S=i?m.post:m.rules.find(({type:C})=>C===k);if(S||(S={type:k,rules:[]},m.rules.push(S)),m.keywords[T]=!0,!_)return;const O={keyword:T,definition:{..._,type:(0,l.getJSONTypes)(_.type),schemaType:(0,l.getJSONTypes)(_.schemaType)}};_.before?_e.call(this,S,O,_.before):S.rules.push(O),m.all[T]=O,(w=_.implements)===null||w===void 0||w.forEach(C=>this.addKeyword(C))}function _e(T,_,k){const w=T.rules.findIndex(i=>i.keyword===k);w>=0?T.rules.splice(w,0,_):(T.rules.push(_),this.logger.warn(`rule ${k} is not defined`))}function ge(T){let{metaSchema:_}=T;_!==void 0&&(T.$data&&this.opts.$data&&(_=Te(_)),T.validateSchema=this.compile(_,!0))}const We={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Te(T){return{anyOf:[T,We]}}})(qs);var Er={},Pr={},Tr={};Object.defineProperty(Tr,"__esModule",{value:!0});const Xi={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Tr.default=Xi;var Me={};Object.defineProperty(Me,"__esModule",{value:!0});Me.callRef=Me.getValidate=void 0;const xi=Ge,$s=H,ne=V,ze=ye,vs=oe,ft=I,ec={keyword:"$ref",schemaType:"string",code(t){const{gen:e,schema:r,it:s}=t,{baseId:a,schemaEnv:n,validateName:o,opts:u,self:c}=s,{root:l}=n;if((r==="#"||r==="#/")&&a===l.baseId)return h();const d=vs.resolveRef.call(c,l,a,r);if(d===void 0)throw new xi.default(s.opts.uriResolver,a,r);if(d instanceof vs.SchemaEnv)return g(d);return b(d);function h(){if(n===l)return $t(t,o,n,n.$async);const y=e.scopeValue("root",{ref:l});return $t(t,(0,ne._)`${y}.validate`,l,l.$async)}function g(y){const $=Sa(t,y);$t(t,$,y,y.$async)}function b(y){const $=e.scopeValue("schema",u.code.source===!0?{ref:y,code:(0,ne.stringify)(y)}:{ref:y}),p=e.name("valid"),f=t.subschema({schema:y,dataTypes:[],schemaPath:ne.nil,topSchemaRef:$,errSchemaPath:r},p);t.mergeEvaluated(f),t.ok(p)}}};function Sa(t,e){const{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,ne._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Me.getValidate=Sa;function $t(t,e,r,s){const{gen:a,it:n}=t,{allErrors:o,schemaEnv:u,opts:c}=n,l=c.passContext?ze.default.this:ne.nil;s?d():h();function d(){if(!u.$async)throw new Error("async schema referenced by sync schema");const y=a.let("valid");a.try(()=>{a.code((0,ne._)`await ${(0,$s.callValidateCode)(t,e,l)}`),b(e),o||a.assign(y,!0)},$=>{a.if((0,ne._)`!(${$} instanceof ${n.ValidationError})`,()=>a.throw($)),g($),o||a.assign(y,!1)}),t.ok(y)}function h(){t.result((0,$s.callValidateCode)(t,e,l),()=>b(e),()=>g(e))}function g(y){const $=(0,ne._)`${y}.errors`;a.assign(ze.default.vErrors,(0,ne._)`${ze.default.vErrors} === null ? ${$} : ${ze.default.vErrors}.concat(${$})`),a.assign(ze.default.errors,(0,ne._)`${ze.default.vErrors}.length`)}function b(y){var $;if(!n.opts.unevaluated)return;const p=($=r==null?void 0:r.validate)===null||$===void 0?void 0:$.evaluated;if(n.props!==!0)if(p&&!p.dynamicProps)p.props!==void 0&&(n.props=ft.mergeEvaluated.props(a,p.props,n.props));else{const f=a.var("props",(0,ne._)`${y}.evaluated.props`);n.props=ft.mergeEvaluated.props(a,f,n.props,ne.Name)}if(n.items!==!0)if(p&&!p.dynamicItems)p.items!==void 0&&(n.items=ft.mergeEvaluated.items(a,p.items,n.items));else{const f=a.var("items",(0,ne._)`${y}.evaluated.items`);n.items=ft.mergeEvaluated.items(a,f,n.items,ne.Name)}}}Me.callRef=$t;Me.default=ec;Object.defineProperty(Pr,"__esModule",{value:!0});const tc=Tr,rc=Me,sc=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tc.default,rc.default];Pr.default=sc;var Rr={},Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});const Et=V,Se=Et.operators,Pt={maximum:{okStr:"<=",ok:Se.LTE,fail:Se.GT},minimum:{okStr:">=",ok:Se.GTE,fail:Se.LT},exclusiveMaximum:{okStr:"<",ok:Se.LT,fail:Se.GTE},exclusiveMinimum:{okStr:">",ok:Se.GT,fail:Se.LTE}},ac={message:({keyword:t,schemaCode:e})=>(0,Et.str)`must be ${Pt[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Et._)`{comparison: ${Pt[t].okStr}, limit: ${e}}`},nc={keyword:Object.keys(Pt),type:"number",schemaType:"number",$data:!0,error:ac,code(t){const{keyword:e,data:r,schemaCode:s}=t;t.fail$data((0,Et._)`${r} ${Pt[e].fail} ${s} || isNaN(${r})`)}};Ir.default=nc;var Nr={};Object.defineProperty(Nr,"__esModule",{value:!0});const tt=V,oc={message:({schemaCode:t})=>(0,tt.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,tt._)`{multipleOf: ${t}}`},ic={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oc,code(t){const{gen:e,data:r,schemaCode:s,it:a}=t,n=a.opts.multipleOfPrecision,o=e.let("res"),u=n?(0,tt._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,tt._)`${o} !== parseInt(${o})`;t.fail$data((0,tt._)`(${s} === 0 || (${o} = ${r}/${s}, ${u}))`)}};Nr.default=ic;var Or={},Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});function ka(t){const e=t.length;let r=0,s=0,a;for(;s<e;)r++,a=t.charCodeAt(s++),a>=55296&&a<=56319&&s<e&&(a=t.charCodeAt(s),(a&64512)===56320&&s++);return r}Cr.default=ka;ka.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Or,"__esModule",{value:!0});const Oe=V,cc=I,uc=Cr,lc={message({keyword:t,schemaCode:e}){const r=t==="maxLength"?"more":"fewer";return(0,Oe.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Oe._)`{limit: ${t}}`},dc={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lc,code(t){const{keyword:e,data:r,schemaCode:s,it:a}=t,n=e==="maxLength"?Oe.operators.GT:Oe.operators.LT,o=a.opts.unicode===!1?(0,Oe._)`${r}.length`:(0,Oe._)`${(0,cc.useFunc)(t.gen,uc.default)}(${r})`;t.fail$data((0,Oe._)`${o} ${n} ${s}`)}};Or.default=dc;var jr={};Object.defineProperty(jr,"__esModule",{value:!0});const fc=H,hc=I,Fe=V,mc={message:({schemaCode:t})=>(0,Fe.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Fe._)`{pattern: ${t}}`},pc={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:mc,code(t){const{gen:e,data:r,$data:s,schema:a,schemaCode:n,it:o}=t,u=o.opts.unicodeRegExp?"u":"";if(s){const{regExp:c}=o.opts.code,l=c.code==="new RegExp"?(0,Fe._)`new RegExp`:(0,hc.useFunc)(e,c),d=e.let("valid");e.try(()=>e.assign(d,(0,Fe._)`${l}(${n}, ${u}).test(${r})`),()=>e.assign(d,!1)),t.fail$data((0,Fe._)`!${d}`)}else{const c=(0,fc.usePattern)(t,a);t.fail$data((0,Fe._)`!${c}.test(${r})`)}}};jr.default=pc;var Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});const rt=V,yc={message({keyword:t,schemaCode:e}){const r=t==="maxProperties"?"more":"fewer";return(0,rt.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,rt._)`{limit: ${t}}`},_c={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:yc,code(t){const{keyword:e,data:r,schemaCode:s}=t,a=e==="maxProperties"?rt.operators.GT:rt.operators.LT;t.fail$data((0,rt._)`Object.keys(${r}).length ${a} ${s}`)}};Mr.default=_c;var qr={};Object.defineProperty(qr,"__esModule",{value:!0});const Ze=H,st=V,gc=I,$c={message:({params:{missingProperty:t}})=>(0,st.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,st._)`{missingProperty: ${t}}`},vc={keyword:"required",type:"object",schemaType:"array",$data:!0,error:$c,code(t){const{gen:e,schema:r,schemaCode:s,data:a,$data:n,it:o}=t,{opts:u}=o;if(!n&&r.length===0)return;const c=r.length>=u.loopRequired;if(o.allErrors?l():d(),u.strictRequired){const b=t.parentSchema.properties,{definedProperties:y}=t.it;for(const $ of r)if((b==null?void 0:b[$])===void 0&&!y.has($)){const p=o.schemaEnv.baseId+o.errSchemaPath,f=`required property "${$}" is not defined at "${p}" (strictRequired)`;(0,gc.checkStrictMode)(o,f,o.opts.strictRequired)}}function l(){if(c||n)t.block$data(st.nil,h);else for(const b of r)(0,Ze.checkReportMissingProp)(t,b)}function d(){const b=e.let("missing");if(c||n){const y=e.let("valid",!0);t.block$data(y,()=>g(b,y)),t.ok(y)}else e.if((0,Ze.checkMissingProp)(t,r,b)),(0,Ze.reportMissingProp)(t,b),e.else()}function h(){e.forOf("prop",s,b=>{t.setParams({missingProperty:b}),e.if((0,Ze.noPropertyInData)(e,a,b,u.ownProperties),()=>t.error())})}function g(b,y){t.setParams({missingProperty:b}),e.forOf(b,s,()=>{e.assign(y,(0,Ze.propertyInData)(e,a,b,u.ownProperties)),e.if((0,st.not)(y),()=>{t.error(),e.break()})},st.nil)}}};qr.default=vc;var Ar={};Object.defineProperty(Ar,"__esModule",{value:!0});const at=V,wc={message({keyword:t,schemaCode:e}){const r=t==="maxItems"?"more":"fewer";return(0,at.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,at._)`{limit: ${t}}`},bc={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:wc,code(t){const{keyword:e,data:r,schemaCode:s}=t,a=e==="maxItems"?at.operators.GT:at.operators.LT;t.fail$data((0,at._)`${r}.length ${a} ${s}`)}};Ar.default=bc;var Dr={},ct={};Object.defineProperty(ct,"__esModule",{value:!0});const Ea=Zs;Ea.code='require("ajv/dist/runtime/equal").default';ct.default=Ea;Object.defineProperty(Dr,"__esModule",{value:!0});const Xt=X,te=V,Sc=I,kc=ct,Ec={message:({params:{i:t,j:e}})=>(0,te.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,te._)`{i: ${t}, j: ${e}}`},Pc={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Ec,code(t){const{gen:e,data:r,$data:s,schema:a,parentSchema:n,schemaCode:o,it:u}=t;if(!s&&!a)return;const c=e.let("valid"),l=n.items?(0,Xt.getSchemaTypes)(n.items):[];t.block$data(c,d,(0,te._)`${o} === false`),t.ok(c);function d(){const y=e.let("i",(0,te._)`${r}.length`),$=e.let("j");t.setParams({i:y,j:$}),e.assign(c,!0),e.if((0,te._)`${y} > 1`,()=>(h()?g:b)(y,$))}function h(){return l.length>0&&!l.some(y=>y==="object"||y==="array")}function g(y,$){const p=e.name("item"),f=(0,Xt.checkDataTypes)(l,p,u.opts.strictNumbers,Xt.DataType.Wrong),v=e.const("indices",(0,te._)`{}`);e.for((0,te._)`;${y}--;`,()=>{e.let(p,(0,te._)`${r}[${y}]`),e.if(f,(0,te._)`continue`),l.length>1&&e.if((0,te._)`typeof ${p} == "string"`,(0,te._)`${p} += "_"`),e.if((0,te._)`typeof ${v}[${p}] == "number"`,()=>{e.assign($,(0,te._)`${v}[${p}]`),t.error(),e.assign(c,!1).break()}).code((0,te._)`${v}[${p}] = ${y}`)})}function b(y,$){const p=(0,Sc.useFunc)(e,kc.default),f=e.name("outer");e.label(f).for((0,te._)`;${y}--;`,()=>e.for((0,te._)`${$} = ${y}; ${$}--;`,()=>e.if((0,te._)`${p}(${r}[${y}], ${r}[${$}])`,()=>{t.error(),e.assign(c,!1).break(f)})))}}};Dr.default=Pc;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});const or=V,Tc=I,Rc=ct,Ic={message:"must be equal to constant",params:({schemaCode:t})=>(0,or._)`{allowedValue: ${t}}`},Nc={keyword:"const",$data:!0,error:Ic,code(t){const{gen:e,data:r,$data:s,schemaCode:a,schema:n}=t;s||n&&typeof n=="object"?t.fail$data((0,or._)`!${(0,Tc.useFunc)(e,Rc.default)}(${r}, ${a})`):t.fail((0,or._)`${n} !== ${r}`)}};zr.default=Nc;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});const xe=V,Oc=I,Cc=ct,jc={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,xe._)`{allowedValues: ${t}}`},Mc={keyword:"enum",schemaType:"array",$data:!0,error:jc,code(t){const{gen:e,data:r,$data:s,schema:a,schemaCode:n,it:o}=t;if(!s&&a.length===0)throw new Error("enum must have non-empty array");const u=a.length>=o.opts.loopEnum;let c;const l=()=>c??(c=(0,Oc.useFunc)(e,Cc.default));let d;if(u||s)d=e.let("valid"),t.block$data(d,h);else{if(!Array.isArray(a))throw new Error("ajv implementation error");const b=e.const("vSchema",n);d=(0,xe.or)(...a.map((y,$)=>g(b,$)))}t.pass(d);function h(){e.assign(d,!1),e.forOf("v",n,b=>e.if((0,xe._)`${l()}(${r}, ${b})`,()=>e.assign(d,!0).break()))}function g(b,y){const $=a[y];return typeof $=="object"&&$!==null?(0,xe._)`${l()}(${r}, ${b}[${y}])`:(0,xe._)`${r} === ${$}`}}};Vr.default=Mc;Object.defineProperty(Rr,"__esModule",{value:!0});const qc=Ir,Ac=Nr,Dc=Or,zc=jr,Vc=Mr,Fc=qr,Hc=Ar,Lc=Dr,Uc=zr,Kc=Vr,Gc=[qc.default,Ac.default,Dc.default,zc.default,Vc.default,Fc.default,Hc.default,Lc.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Uc.default,Kc.default];Rr.default=Gc;var Fr={},Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.validateAdditionalItems=void 0;const Ce=V,ir=I,Jc={message:({params:{len:t}})=>(0,Ce.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ce._)`{limit: ${t}}`},Qc={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Jc,code(t){const{parentSchema:e,it:r}=t,{items:s}=e;if(!Array.isArray(s)){(0,ir.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Pa(t,s)}};function Pa(t,e){const{gen:r,schema:s,data:a,keyword:n,it:o}=t;o.items=!0;const u=r.const("len",(0,Ce._)`${a}.length`);if(s===!1)t.setParams({len:e.length}),t.pass((0,Ce._)`${u} <= ${e.length}`);else if(typeof s=="object"&&!(0,ir.alwaysValidSchema)(o,s)){const l=r.var("valid",(0,Ce._)`${u} <= ${e.length}`);r.if((0,Ce.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,u,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:ir.Type.Num},l),o.allErrors||r.if((0,Ce.not)(l),()=>r.break())})}}Je.validateAdditionalItems=Pa;Je.default=Qc;var Hr={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.validateTuple=void 0;const ws=V,vt=I,Wc=H,Bc={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:e,it:r}=t;if(Array.isArray(e))return Ta(t,"additionalItems",e);r.items=!0,!(0,vt.alwaysValidSchema)(r,e)&&t.ok((0,Wc.validateArray)(t))}};function Ta(t,e,r=t.schema){const{gen:s,parentSchema:a,data:n,keyword:o,it:u}=t;d(a),u.opts.unevaluated&&r.length&&u.items!==!0&&(u.items=vt.mergeEvaluated.items(s,r.length,u.items));const c=s.name("valid"),l=s.const("len",(0,ws._)`${n}.length`);r.forEach((h,g)=>{(0,vt.alwaysValidSchema)(u,h)||(s.if((0,ws._)`${l} > ${g}`,()=>t.subschema({keyword:o,schemaProp:g,dataProp:g},c)),t.ok(c))});function d(h){const{opts:g,errSchemaPath:b}=u,y=r.length,$=y===h.minItems&&(y===h.maxItems||h[e]===!1);if(g.strictTuples&&!$){const p=`"${o}" is ${y}-tuple, but minItems or maxItems/${e} are not specified or different at path "${b}"`;(0,vt.checkStrictMode)(u,p,g.strictTuples)}}}Qe.validateTuple=Ta;Qe.default=Bc;Object.defineProperty(Hr,"__esModule",{value:!0});const Yc=Qe,Zc={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Yc.validateTuple)(t,"items")};Hr.default=Zc;var Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});const bs=V,Xc=I,xc=H,eu=Je,tu={message:({params:{len:t}})=>(0,bs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,bs._)`{limit: ${t}}`},ru={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tu,code(t){const{schema:e,parentSchema:r,it:s}=t,{prefixItems:a}=r;s.items=!0,!(0,Xc.alwaysValidSchema)(s,e)&&(a?(0,eu.validateAdditionalItems)(t,a):t.ok((0,xc.validateArray)(t)))}};Lr.default=ru;var Ur={};Object.defineProperty(Ur,"__esModule",{value:!0});const ie=V,ht=I,su={message:({params:{min:t,max:e}})=>e===void 0?(0,ie.str)`must contain at least ${t} valid item(s)`:(0,ie.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ie._)`{minContains: ${t}}`:(0,ie._)`{minContains: ${t}, maxContains: ${e}}`},au={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:su,code(t){const{gen:e,schema:r,parentSchema:s,data:a,it:n}=t;let o,u;const{minContains:c,maxContains:l}=s;n.opts.next?(o=c===void 0?1:c,u=l):o=1;const d=e.const("len",(0,ie._)`${a}.length`);if(t.setParams({min:o,max:u}),u===void 0&&o===0){(0,ht.checkStrictMode)(n,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(u!==void 0&&o>u){(0,ht.checkStrictMode)(n,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ht.alwaysValidSchema)(n,r)){let $=(0,ie._)`${d} >= ${o}`;u!==void 0&&($=(0,ie._)`${$} && ${d} <= ${u}`),t.pass($);return}n.items=!0;const h=e.name("valid");u===void 0&&o===1?b(h,()=>e.if(h,()=>e.break())):o===0?(e.let(h,!0),u!==void 0&&e.if((0,ie._)`${a}.length > 0`,g)):(e.let(h,!1),g()),t.result(h,()=>t.reset());function g(){const $=e.name("_valid"),p=e.let("count",0);b($,()=>e.if($,()=>y(p)))}function b($,p){e.forRange("i",0,d,f=>{t.subschema({keyword:"contains",dataProp:f,dataPropType:ht.Type.Num,compositeRule:!0},$),p()})}function y($){e.code((0,ie._)`${$}++`),u===void 0?e.if((0,ie._)`${$} >= ${o}`,()=>e.assign(h,!0).break()):(e.if((0,ie._)`${$} > ${u}`,()=>e.assign(h,!1).break()),o===1?e.assign(h,!0):e.if((0,ie._)`${$} >= ${o}`,()=>e.assign(h,!0)))}}};Ur.default=au;var Ra={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=V,r=I,s=H;t.error={message:({params:{property:c,depsCount:l,deps:d}})=>{const h=l===1?"property":"properties";return(0,e.str)`must have ${h} ${d} when property ${c} is present`},params:({params:{property:c,depsCount:l,deps:d,missingProperty:h}})=>(0,e._)`{property: ${c},
|
|
6
|
+
missingProperty: ${h},
|
|
7
|
+
depsCount: ${l},
|
|
8
|
+
deps: ${d}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[l,d]=n(c);o(c,l),u(c,d)}};function n({schema:c}){const l={},d={};for(const h in c){if(h==="__proto__")continue;const g=Array.isArray(c[h])?l:d;g[h]=c[h]}return[l,d]}function o(c,l=c.schema){const{gen:d,data:h,it:g}=c;if(Object.keys(l).length===0)return;const b=d.let("missing");for(const y in l){const $=l[y];if($.length===0)continue;const p=(0,s.propertyInData)(d,h,y,g.opts.ownProperties);c.setParams({property:y,depsCount:$.length,deps:$.join(", ")}),g.allErrors?d.if(p,()=>{for(const f of $)(0,s.checkReportMissingProp)(c,f)}):(d.if((0,e._)`${p} && (${(0,s.checkMissingProp)(c,$,b)})`),(0,s.reportMissingProp)(c,b),d.else())}}t.validatePropertyDeps=o;function u(c,l=c.schema){const{gen:d,data:h,keyword:g,it:b}=c,y=d.name("valid");for(const $ in l)(0,r.alwaysValidSchema)(b,l[$])||(d.if((0,s.propertyInData)(d,h,$,b.opts.ownProperties),()=>{const p=c.subschema({keyword:g,schemaProp:$},y);c.mergeValidEvaluated(p,y)},()=>d.var(y,!0)),c.ok(y))}t.validateSchemaDeps=u,t.default=a})(Ra);var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});const Ia=V,nu=I,ou={message:"property name must be valid",params:({params:t})=>(0,Ia._)`{propertyName: ${t.propertyName}}`},iu={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ou,code(t){const{gen:e,schema:r,data:s,it:a}=t;if((0,nu.alwaysValidSchema)(a,r))return;const n=e.name("valid");e.forIn("key",s,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},n),e.if((0,Ia.not)(n),()=>{t.error(!0),a.allErrors||e.break()})}),t.ok(n)}};Kr.default=iu;var jt={};Object.defineProperty(jt,"__esModule",{value:!0});const mt=H,le=V,cu=ye,pt=I,uu={message:"must NOT have additional properties",params:({params:t})=>(0,le._)`{additionalProperty: ${t.additionalProperty}}`},lu={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:uu,code(t){const{gen:e,schema:r,parentSchema:s,data:a,errsCount:n,it:o}=t;if(!n)throw new Error("ajv implementation error");const{allErrors:u,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,pt.alwaysValidSchema)(o,r))return;const l=(0,mt.allSchemaProperties)(s.properties),d=(0,mt.allSchemaProperties)(s.patternProperties);h(),t.ok((0,le._)`${n} === ${cu.default.errors}`);function h(){e.forIn("key",a,p=>{!l.length&&!d.length?y(p):e.if(g(p),()=>y(p))})}function g(p){let f;if(l.length>8){const v=(0,pt.schemaRefOrVal)(o,s.properties,"properties");f=(0,mt.isOwnProperty)(e,v,p)}else l.length?f=(0,le.or)(...l.map(v=>(0,le._)`${p} === ${v}`)):f=le.nil;return d.length&&(f=(0,le.or)(f,...d.map(v=>(0,le._)`${(0,mt.usePattern)(t,v)}.test(${p})`))),(0,le.not)(f)}function b(p){e.code((0,le._)`delete ${a}[${p}]`)}function y(p){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){b(p);return}if(r===!1){t.setParams({additionalProperty:p}),t.error(),u||e.break();return}if(typeof r=="object"&&!(0,pt.alwaysValidSchema)(o,r)){const f=e.name("valid");c.removeAdditional==="failing"?($(p,f,!1),e.if((0,le.not)(f),()=>{t.reset(),b(p)})):($(p,f),u||e.if((0,le.not)(f),()=>e.break()))}}function $(p,f,v){const E={keyword:"additionalProperties",dataProp:p,dataPropType:pt.Type.Str};v===!1&&Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(E,f)}}};jt.default=lu;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});const du=fe,Ss=H,xt=I,ks=jt,fu={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,parentSchema:s,data:a,it:n}=t;n.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&ks.default.code(new du.KeywordCxt(n,ks.default,"additionalProperties"));const o=(0,Ss.allSchemaProperties)(r);for(const h of o)n.definedProperties.add(h);n.opts.unevaluated&&o.length&&n.props!==!0&&(n.props=xt.mergeEvaluated.props(e,(0,xt.toHash)(o),n.props));const u=o.filter(h=>!(0,xt.alwaysValidSchema)(n,r[h]));if(u.length===0)return;const c=e.name("valid");for(const h of u)l(h)?d(h):(e.if((0,Ss.propertyInData)(e,a,h,n.opts.ownProperties)),d(h),n.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(h),t.ok(c);function l(h){return n.opts.useDefaults&&!n.compositeRule&&r[h].default!==void 0}function d(h){t.subschema({keyword:"properties",schemaProp:h,dataProp:h},c)}}};Gr.default=fu;var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});const Es=H,yt=V,Ps=I,Ts=I,hu={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:e,schema:r,data:s,parentSchema:a,it:n}=t,{opts:o}=n,u=(0,Es.allSchemaProperties)(r),c=u.filter($=>(0,Ps.alwaysValidSchema)(n,r[$]));if(u.length===0||c.length===u.length&&(!n.opts.unevaluated||n.props===!0))return;const l=o.strictSchema&&!o.allowMatchingProperties&&a.properties,d=e.name("valid");n.props!==!0&&!(n.props instanceof yt.Name)&&(n.props=(0,Ts.evaluatedPropsToName)(e,n.props));const{props:h}=n;g();function g(){for(const $ of u)l&&b($),n.allErrors?y($):(e.var(d,!0),y($),e.if(d))}function b($){for(const p in l)new RegExp($).test(p)&&(0,Ps.checkStrictMode)(n,`property ${p} matches pattern ${$} (use allowMatchingProperties)`)}function y($){e.forIn("key",s,p=>{e.if((0,yt._)`${(0,Es.usePattern)(t,$)}.test(${p})`,()=>{const f=c.includes($);f||t.subschema({keyword:"patternProperties",schemaProp:$,dataProp:p,dataPropType:Ts.Type.Str},d),n.opts.unevaluated&&h!==!0?e.assign((0,yt._)`${h}[${p}]`,!0):!f&&!n.allErrors&&e.if((0,yt.not)(d),()=>e.break())})})}}};Jr.default=hu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});const mu=I,pu={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:e,schema:r,it:s}=t;if((0,mu.alwaysValidSchema)(s,r)){t.fail();return}const a=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),t.failResult(a,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Qr.default=pu;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});const yu=H,_u={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yu.validateUnion,error:{message:"must match a schema in anyOf"}};Wr.default=_u;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});const wt=V,gu=I,$u={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,wt._)`{passingSchemas: ${t.passing}}`},vu={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:$u,code(t){const{gen:e,schema:r,parentSchema:s,it:a}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;const n=r,o=e.let("valid",!1),u=e.let("passing",null),c=e.name("_valid");t.setParams({passing:u}),e.block(l),t.result(o,()=>t.reset(),()=>t.error(!0));function l(){n.forEach((d,h)=>{let g;(0,gu.alwaysValidSchema)(a,d)?e.var(c,!0):g=t.subschema({keyword:"oneOf",schemaProp:h,compositeRule:!0},c),h>0&&e.if((0,wt._)`${c} && ${o}`).assign(o,!1).assign(u,(0,wt._)`[${u}, ${h}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(u,h),g&&t.mergeEvaluated(g,wt.Name)})})}}};Br.default=vu;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});const wu=I,bu={keyword:"allOf",schemaType:"array",code(t){const{gen:e,schema:r,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");const a=e.name("valid");r.forEach((n,o)=>{if((0,wu.alwaysValidSchema)(s,n))return;const u=t.subschema({keyword:"allOf",schemaProp:o},a);t.ok(a),t.mergeEvaluated(u)})}};Yr.default=bu;var Zr={};Object.defineProperty(Zr,"__esModule",{value:!0});const Tt=V,Na=I,Su={message:({params:t})=>(0,Tt.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Tt._)`{failingKeyword: ${t.ifClause}}`},ku={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Su,code(t){const{gen:e,parentSchema:r,it:s}=t;r.then===void 0&&r.else===void 0&&(0,Na.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=Rs(s,"then"),n=Rs(s,"else");if(!a&&!n)return;const o=e.let("valid",!0),u=e.name("_valid");if(c(),t.reset(),a&&n){const d=e.let("ifClause");t.setParams({ifClause:d}),e.if(u,l("then",d),l("else",d))}else a?e.if(u,l("then")):e.if((0,Tt.not)(u),l("else"));t.pass(o,()=>t.error(!0));function c(){const d=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);t.mergeEvaluated(d)}function l(d,h){return()=>{const g=t.subschema({keyword:d},u);e.assign(o,u),t.mergeValidEvaluated(g,o),h?e.assign(h,(0,Tt._)`${d}`):t.setParams({ifClause:d})}}}};function Rs(t,e){const r=t.schema[e];return r!==void 0&&!(0,Na.alwaysValidSchema)(t,r)}Zr.default=ku;var Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});const Eu=I,Pu={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Eu.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Xr.default=Pu;Object.defineProperty(Fr,"__esModule",{value:!0});const Tu=Je,Ru=Hr,Iu=Qe,Nu=Lr,Ou=Ur,Cu=Ra,ju=Kr,Mu=jt,qu=Gr,Au=Jr,Du=Qr,zu=Wr,Vu=Br,Fu=Yr,Hu=Zr,Lu=Xr;function Uu(t=!1){const e=[Du.default,zu.default,Vu.default,Fu.default,Hu.default,Lu.default,ju.default,Mu.default,Cu.default,qu.default,Au.default];return t?e.push(Ru.default,Nu.default):e.push(Tu.default,Iu.default),e.push(Ou.default),e}Fr.default=Uu;var xr={},es={};Object.defineProperty(es,"__esModule",{value:!0});const Z=V,Ku={message:({schemaCode:t})=>(0,Z.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Z._)`{format: ${t}}`},Gu={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Ku,code(t,e){const{gen:r,data:s,$data:a,schema:n,schemaCode:o,it:u}=t,{opts:c,errSchemaPath:l,schemaEnv:d,self:h}=u;if(!c.validateFormats)return;a?g():b();function g(){const y=r.scopeValue("formats",{ref:h.formats,code:c.code.formats}),$=r.const("fDef",(0,Z._)`${y}[${o}]`),p=r.let("fType"),f=r.let("format");r.if((0,Z._)`typeof ${$} == "object" && !(${$} instanceof RegExp)`,()=>r.assign(p,(0,Z._)`${$}.type || "string"`).assign(f,(0,Z._)`${$}.validate`),()=>r.assign(p,(0,Z._)`"string"`).assign(f,$)),t.fail$data((0,Z.or)(v(),E()));function v(){return c.strictSchema===!1?Z.nil:(0,Z._)`${o} && !${f}`}function E(){const P=d.$async?(0,Z._)`(${$}.async ? await ${f}(${s}) : ${f}(${s}))`:(0,Z._)`${f}(${s})`,R=(0,Z._)`(typeof ${f} == "function" ? ${P} : ${f}.test(${s}))`;return(0,Z._)`${f} && ${f} !== true && ${p} === ${e} && !${R}`}}function b(){const y=h.formats[n];if(!y){v();return}if(y===!0)return;const[$,p,f]=E(y);$===e&&t.pass(P());function v(){if(c.strictSchema===!1){h.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${n}" ignored in schema at path "${l}"`}}function E(R){const U=R instanceof RegExp?(0,Z.regexpCode)(R):c.code.formats?(0,Z._)`${c.code.formats}${(0,Z.getProperty)(n)}`:void 0,A=r.scopeValue("formats",{key:n,ref:R,code:U});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,Z._)`${A}.validate`]:["string",R,A]}function P(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw new Error("async format in sync schema");return(0,Z._)`await ${f}(${s})`}return typeof p=="function"?(0,Z._)`${f}(${s})`:(0,Z._)`${f}.test(${s})`}}}};es.default=Gu;Object.defineProperty(xr,"__esModule",{value:!0});const Ju=es,Qu=[Ju.default];xr.default=Qu;var Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.contentVocabulary=Ke.metadataVocabulary=void 0;Ke.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ke.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Er,"__esModule",{value:!0});const Wu=Pr,Bu=Rr,Yu=Fr,Zu=xr,Is=Ke,Xu=[Wu.default,Bu.default,(0,Yu.default)(),Zu.default,Is.metadataVocabulary,Is.contentVocabulary];Er.default=Xu;var ts={},Mt={};Object.defineProperty(Mt,"__esModule",{value:!0});Mt.DiscrError=void 0;var Ns;(function(t){t.Tag="tag",t.Mapping="mapping"})(Ns||(Mt.DiscrError=Ns={}));Object.defineProperty(ts,"__esModule",{value:!0});const Ve=V,cr=Mt,Os=oe,xu=Ge,el=I,tl={message:({params:{discrError:t,tagName:e}})=>t===cr.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Ve._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},rl={keyword:"discriminator",type:"object",schemaType:"object",error:tl,code(t){const{gen:e,data:r,schema:s,parentSchema:a,it:n}=t,{oneOf:o}=a;if(!n.opts.discriminator)throw new Error("discriminator: requires discriminator option");const u=s.propertyName;if(typeof u!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");const c=e.let("valid",!1),l=e.const("tag",(0,Ve._)`${r}${(0,Ve.getProperty)(u)}`);e.if((0,Ve._)`typeof ${l} == "string"`,()=>d(),()=>t.error(!1,{discrError:cr.DiscrError.Tag,tag:l,tagName:u})),t.ok(c);function d(){const b=g();e.if(!1);for(const y in b)e.elseIf((0,Ve._)`${l} === ${y}`),e.assign(c,h(b[y]));e.else(),t.error(!1,{discrError:cr.DiscrError.Mapping,tag:l,tagName:u}),e.endIf()}function h(b){const y=e.name("valid"),$=t.subschema({keyword:"oneOf",schemaProp:b},y);return t.mergeEvaluated($,Ve.Name),y}function g(){var b;const y={},$=f(a);let p=!0;for(let P=0;P<o.length;P++){let R=o[P];if(R!=null&&R.$ref&&!(0,el.schemaHasRulesButRef)(R,n.self.RULES)){const A=R.$ref;if(R=Os.resolveRef.call(n.self,n.schemaEnv.root,n.baseId,A),R instanceof Os.SchemaEnv&&(R=R.schema),R===void 0)throw new xu.default(n.opts.uriResolver,n.baseId,A)}const U=(b=R==null?void 0:R.properties)===null||b===void 0?void 0:b[u];if(typeof U!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${u}"`);p=p&&($||f(R)),v(U,P)}if(!p)throw new Error(`discriminator: "${u}" must be required`);return y;function f({required:P}){return Array.isArray(P)&&P.includes(u)}function v(P,R){if(P.const)E(P.const,R);else if(P.enum)for(const U of P.enum)E(U,R);else throw new Error(`discriminator: "properties/${u}" must have "const" or "enum"`)}function E(P,R){if(typeof P!="string"||P in y)throw new Error(`discriminator: "${u}" values must be unique strings`);y[P]=R}}}};ts.default=rl;const sl="http://json-schema.org/draft-07/schema#",al="http://json-schema.org/draft-07/schema#",nl="Core schema meta-schema",ol={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},il=["object","boolean"],cl={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},ul={$schema:sl,$id:al,title:nl,definitions:ol,type:il,properties:cl,default:!0};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const r=qs,s=Er,a=ts,n=ul,o=["/properties"],u="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(y,u,!1),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=fe;Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var d=V;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var h=it;Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return h.default}});var g=Ge;Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(tr,tr.exports);var Oa=tr.exports;const ll=js(Oa);var ur={exports:{}},Ca={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(j,F){return{validate:j,compare:F}}t.fullFormats={date:e(n,o),time:e(c(!0),l),"date-time":e(g(!0),b),"iso-time":e(c(),d),"iso-date-time":e(g(),y),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:f,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ce,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:E,int32:{type:"number",validate:U},int64:{type:"number",validate:A},float:{type:"number",validate:Y},double:{type:"number",validate:Y},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,b),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,y),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function r(j){return j%4===0&&(j%100!==0||j%400===0)}const s=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n(j){const F=s.exec(j);if(!F)return!1;const W=+F[1],L=+F[2],ee=+F[3];return L>=1&&L<=12&&ee>=1&&ee<=(L===2&&r(W)?29:a[L])}function o(j,F){if(j&&F)return j>F?1:j<F?-1:0}const u=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(j){return function(W){const L=u.exec(W);if(!L)return!1;const ee=+L[1],_e=+L[2],ge=+L[3],We=L[4],Te=L[5]==="-"?-1:1,T=+(L[6]||0),_=+(L[7]||0);if(T>23||_>59||j&&!We)return!1;if(ee<=23&&_e<=59&&ge<60)return!0;const k=_e-_*Te,w=ee-T*Te-(k<0?1:0);return(w===23||w===-1)&&(k===59||k===-1)&&ge<61}}function l(j,F){if(!(j&&F))return;const W=new Date("2020-01-01T"+j).valueOf(),L=new Date("2020-01-01T"+F).valueOf();if(W&&L)return W-L}function d(j,F){if(!(j&&F))return;const W=u.exec(j),L=u.exec(F);if(W&&L)return j=W[1]+W[2]+W[3],F=L[1]+L[2]+L[3],j>F?1:j<F?-1:0}const h=/t|\s/i;function g(j){const F=c(j);return function(L){const ee=L.split(h);return ee.length===2&&n(ee[0])&&F(ee[1])}}function b(j,F){if(!(j&&F))return;const W=new Date(j).valueOf(),L=new Date(F).valueOf();if(W&&L)return W-L}function y(j,F){if(!(j&&F))return;const[W,L]=j.split(h),[ee,_e]=F.split(h),ge=o(W,ee);if(ge!==void 0)return ge||l(L,_e)}const $=/\/|:/,p=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function f(j){return $.test(j)&&p.test(j)}const v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function E(j){return v.lastIndex=0,v.test(j)}const P=-(2**31),R=2**31-1;function U(j){return Number.isInteger(j)&&j<=R&&j>=P}function A(j){return Number.isInteger(j)}function Y(){return!0}const B=/[^\\]\\Z/;function ce(j){if(B.test(j))return!1;try{return new RegExp(j),!0}catch{return!1}}})(Ca);var ja={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Oa,r=V,s=r.operators,a={formatMaximum:{okStr:"<=",ok:s.LTE,fail:s.GT},formatMinimum:{okStr:">=",ok:s.GTE,fail:s.LT},formatExclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},formatExclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}},n={message:({keyword:u,schemaCode:c})=>(0,r.str)`should be ${a[u].okStr} ${c}`,params:({keyword:u,schemaCode:c})=>(0,r._)`{comparison: ${a[u].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:n,code(u){const{gen:c,data:l,schemaCode:d,keyword:h,it:g}=u,{opts:b,self:y}=g;if(!b.validateFormats)return;const $=new e.KeywordCxt(g,y.RULES.all.format.definition,"format");$.$data?p():f();function p(){const E=c.scopeValue("formats",{ref:y.formats,code:b.code.formats}),P=c.const("fmt",(0,r._)`${E}[${$.schemaCode}]`);u.fail$data((0,r.or)((0,r._)`typeof ${P} != "object"`,(0,r._)`${P} instanceof RegExp`,(0,r._)`typeof ${P}.compare != "function"`,v(P)))}function f(){const E=$.schema,P=y.formats[E];if(!P||P===!0)return;if(typeof P!="object"||P instanceof RegExp||typeof P.compare!="function")throw new Error(`"${h}": format "${E}" does not define "compare" function`);const R=c.scopeValue("formats",{key:E,ref:P,code:b.code.formats?(0,r._)`${b.code.formats}${(0,r.getProperty)(E)}`:void 0});u.fail$data(v(R))}function v(E){return(0,r._)`${E}.compare(${l}, ${d}) ${a[h].fail} 0`}},dependencies:["format"]};const o=u=>(u.addKeyword(t.formatLimitDefinition),u);t.default=o})(ja);(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Ca,s=ja,a=V,n=new a.Name("fullFormats"),o=new a.Name("fastFormats"),u=(l,d={keywords:!0})=>{if(Array.isArray(d))return c(l,d,r.fullFormats,n),l;const[h,g]=d.mode==="fast"?[r.fastFormats,o]:[r.fullFormats,n],b=d.formats||r.formatNames;return c(l,b,h,g),d.keywords&&(0,s.default)(l),l};u.get=(l,d="full")=>{const g=(d==="fast"?r.fastFormats:r.fullFormats)[l];if(!g)throw new Error(`Unknown format "${l}"`);return g};function c(l,d,h,g){var b,y;(b=(y=l.opts.code).formats)!==null&&b!==void 0||(y.formats=(0,a._)`require("ajv-formats/dist/formats").${g}`);for(const $ of d)l.addFormat($,h[$])}t.exports=e=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u})(ur,ur.exports);var dl=ur.exports;const fl=js(dl);function hl(){const t=new ll({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return fl(t),t}class ml{constructor(e){this._ajv=e??hl()}getValidator(e){const r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>r(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}class pl{constructor(e){this._client=e}async*callToolStream(e,r=Cs,s){const a=this._client,n={...s,task:(s==null?void 0:s.task)??(a.isToolTask(e.name)?{}:void 0)},o=a.requestStream({method:"tools/call",params:e},r,n),u=a.getToolOutputValidator(e.name);for await(const c of o){if(c.type==="result"&&u){const l=c.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new M(z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{const d=u(l.structuredContent);if(!d.valid){yield{type:"error",error:new M(z.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof M){yield{type:"error",error:d};return}yield{type:"error",error:new M(z.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,s){return this._client.getTaskResult({taskId:e},r,s)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,s){return this._client.requestStream(e,r,s)}}function yl(t,e,r){var s;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!((s=t.tools)!=null&&s.call))throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break}}function _l(t,e,r){var s,a;if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!((s=t.sampling)!=null&&s.createMessage))throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!((a=t.elicitation)!=null&&a.create))throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break}}function bt(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){const r=e,s=t.properties;for(const a of Object.keys(s)){const n=s[a];r[a]===void 0&&Object.prototype.hasOwnProperty.call(n,"default")&&(r[a]=n.default),r[a]!==void 0&&bt(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&bt(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&bt(r,e)}}function gl(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};const e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}class wl extends _n{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(r==null?void 0:r.capabilities)??{},this._jsonSchemaValidator=(r==null?void 0:r.jsonSchemaValidator)??new ml,r!=null&&r.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){var r,s,a,n,o,u;e.tools&&((s=(r=this._serverCapabilities)==null?void 0:r.tools)!=null&&s.listChanged)&&this._setupListChangedHandler("tools",Ba,e.tools,async()=>(await this.listTools()).tools),e.prompts&&((n=(a=this._serverCapabilities)==null?void 0:a.prompts)!=null&&n.listChanged)&&this._setupListChangedHandler("prompts",Ya,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&((u=(o=this._serverCapabilities)==null?void 0:o.resources)!=null&&u.listChanged)&&this._setupListChangedHandler("resources",Za,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new pl(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=gn(this._capabilities,e)}setRequestHandler(e,r){var u;const s=Ms(e),a=s==null?void 0:s.method;if(!a)throw new Error("Schema is missing a method literal");let n;if(Rt(a)){const c=a,l=(u=c._zod)==null?void 0:u.def;n=(l==null?void 0:l.value)??c.value}else{const c=a,l=c._def;n=(l==null?void 0:l.value)??c.value}if(typeof n!="string")throw new Error("Schema method literal must be a string");const o=n;if(o==="elicitation/create"){const c=async(l,d)=>{var E,P;const h=ke(ln,l);if(!h.success){const R=h.error instanceof Error?h.error.message:String(h.error);throw new M(z.InvalidParams,`Invalid elicitation request: ${R}`)}const{params:g}=h.data;g.mode=g.mode??"form";const{supportsFormMode:b,supportsUrlMode:y}=gl(this._capabilities.elicitation);if(g.mode==="form"&&!b)throw new M(z.InvalidParams,"Client does not support form-mode elicitation requests");if(g.mode==="url"&&!y)throw new M(z.InvalidParams,"Client does not support URL-mode elicitation requests");const $=await Promise.resolve(r(l,d));if(g.task){const R=ke(er,$);if(!R.success){const U=R.error instanceof Error?R.error.message:String(R.error);throw new M(z.InvalidParams,`Invalid task creation result: ${U}`)}return R.data}const p=ke(dn,$);if(!p.success){const R=p.error instanceof Error?p.error.message:String(p.error);throw new M(z.InvalidParams,`Invalid elicitation result: ${R}`)}const f=p.data,v=g.mode==="form"?g.requestedSchema:void 0;if(g.mode==="form"&&f.action==="accept"&&f.content&&v&&(P=(E=this._capabilities.elicitation)==null?void 0:E.form)!=null&&P.applyDefaults)try{bt(v,f.content)}catch{}return f};return super.setRequestHandler(e,c)}if(o==="sampling/createMessage"){const c=async(l,d)=>{const h=ke(fn,l);if(!h.success){const f=h.error instanceof Error?h.error.message:String(h.error);throw new M(z.InvalidParams,`Invalid sampling request: ${f}`)}const{params:g}=h.data,b=await Promise.resolve(r(l,d));if(g.task){const f=ke(er,b);if(!f.success){const v=f.error instanceof Error?f.error.message:String(f.error);throw new M(z.InvalidParams,`Invalid task creation result: ${v}`)}return f.data}const $=g.tools||g.toolChoice?hn:mn,p=ke($,b);if(!p.success){const f=p.error instanceof Error?p.error.message:String(p.error);throw new M(z.InvalidParams,`Invalid sampling result: ${f}`)}return p.data};return super.setRequestHandler(e,c)}return super.setRequestHandler(e,r)}assertCapability(e,r){var s;if(!((s=this._serverCapabilities)!=null&&s[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:Xa,capabilities:this._capabilities,clientInfo:this._clientInfo}},xa,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!en.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,s,a,n,o;switch(e){case"logging/setLevel":if(!((r=this._serverCapabilities)!=null&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!((s=this._serverCapabilities)!=null&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!((a=this._serverCapabilities)!=null&&a.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!((n=this._serverCapabilities)!=null&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!((o=this._serverCapabilities)!=null&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!((r=this._capabilities.roots)!=null&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){var r,s;yl((s=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:s.requests,e,"Server")}assertTaskHandlerCapability(e){var r;this._capabilities&&_l((r=this._capabilities.tasks)==null?void 0:r.requests,e,"Client")}async ping(e){return this.request({method:"ping"},lt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},tn,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},lt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},rn,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},sn,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},an,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},nn,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},on,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},lt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},lt,r)}async callTool(e,r=Cs,s){if(this.isToolTaskRequired(e.name))throw new M(z.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const a=await this.request({method:"tools/call",params:e},r,s),n=this.getToolOutputValidator(e.name);if(n){if(!a.structuredContent&&!a.isError)throw new M(z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const o=n(a.structuredContent);if(!o.valid)throw new M(z.InvalidParams,`Structured content does not match the tool's output schema: ${o.errorMessage}`)}catch(o){throw o instanceof M?o:new M(z.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return a}isToolTask(e){var r,s,a,n;return(n=(a=(s=(r=this._serverCapabilities)==null?void 0:r.tasks)==null?void 0:s.requests)==null?void 0:a.tools)!=null&&n.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){var r;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const s of e){if(s.outputSchema){const n=this._jsonSchemaValidator.getValidator(s.outputSchema);this._cachedToolOutputValidators.set(s.name,n)}const a=(r=s.execution)==null?void 0:r.taskSupport;(a==="required"||a==="optional")&&this._cachedKnownTaskTools.add(s.name),a==="required"&&this._cachedRequiredTaskTools.add(s.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},cn,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=un.safeParse(s);if(!n.success)throw new Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:o,debounceMs:u}=n.data,{onChanged:c}=s,l=async()=>{if(!o){c(null,null);return}try{const h=await a();c(null,h)}catch(h){const g=h instanceof Error?h:new Error(String(h));c(g,null)}},d=()=>{if(u){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const g=setTimeout(l,u);this._listChangedDebounceTimers.set(e,g)}else l()};this.setNotificationHandler(r,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}export{wl as Client,gl as getSupportedElicitationModes};
|