@decocms/mesh 2.4.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-BZ4bvRfi.js → AlertCircle-CZPV4eTQ.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CoE0Hi8I.js → ArrowLeft-DQOG1GuJ.js} +1 -1
- package/dist/client/assets/{ChevronDown-Bd6n8txO.js → ChevronDown-Cdy__m-8.js} +1 -1
- package/dist/client/assets/{ChevronRight-Bc43l_p6.js → ChevronRight-SzPzGSNO.js} +1 -1
- package/dist/client/assets/{Copy01-BTTTCefb.js → Copy01-DS49wIzW.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-Dh410BM1.js → DotsHorizontal-BSoB0mo2.js} +1 -1
- package/dist/client/assets/{DotsVertical-C-Nfqo18.js → DotsVertical-eZBspOrA.js} +1 -1
- package/dist/client/assets/{File06-td5gmARz.js → File06-CUqAuIUq.js} +1 -1
- package/dist/client/assets/{FilterLines-nczF4lnr.js → FilterLines-BTBF9JAn.js} +1 -1
- package/dist/client/assets/{FlipBackward-BLl0wh4k.js → FlipBackward-BRcPqCms.js} +1 -1
- package/dist/client/assets/{GitBranch01-38L6KUpt.js → GitBranch01-DovnqKJf.js} +1 -1
- package/dist/client/assets/{Grid01-Dl_1kAd5.js → Grid01-R-k411L-.js} +1 -1
- package/dist/client/assets/{Inbox01-CDma1les.js → Inbox01-bvdCozgs.js} +1 -1
- package/dist/client/assets/{InfoCircle-D8z5_ZlN.js → InfoCircle-r2yyYHHv.js} +1 -1
- package/dist/client/assets/{Key01-Cn9byqjY.js → Key01-BWe_1dg2.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BP_6WzCI.js → LinkExternal01-BklnopGx.js} +1 -1
- package/dist/client/assets/{Loading01-5lHx4rM1.js → Loading01-C0_l8AxO.js} +1 -1
- package/dist/client/assets/{Lock01-S5DjMaRE.js → Lock01-C7_8eECJ.js} +1 -1
- package/dist/client/assets/{Play-DIUg73qU.js → Play-CWJY4nY_.js} +1 -1
- package/dist/client/assets/{Plus-wptRVGuY.js → Plus-KTlOMNSY.js} +1 -1
- package/dist/client/assets/{Terminal-BC7AwEkQ.js → Terminal-DDfP4x2i.js} +1 -1
- package/dist/client/assets/{Trash01-DMq1QD3Y.js → Trash01-BMJLKtdF.js} +1 -1
- package/dist/client/assets/{X-C6XvUpZP.js → X-BFdZnqth.js} +1 -1
- package/dist/client/assets/{XClose-Cb-zeLTZ.js → XClose-DTyQuBBY.js} +1 -1
- package/dist/client/assets/{alert-dialog-BJHrUd_j.js → alert-dialog-Dz8Vs8_m.js} +1 -1
- package/dist/client/assets/{auth-BIu7r9Ac.js → auth-CJNQiaii.js} +1 -1
- package/dist/client/assets/{auth-catchall-DC241-OB.js → auth-catchall-qU76xBKm.js} +1 -1
- package/dist/client/assets/{avatar-CLQivMfK.js → avatar-D4SXwEgs.js} +1 -1
- package/dist/client/assets/{badge-DQeqBGBY.js → badge-99kEJDtp.js} +1 -1
- package/dist/client/assets/{card-DCkJD1G_.js → card-DZuxbKf1.js} +1 -1
- package/dist/client/assets/{checkbox-BPcJKnx2.js → checkbox-Bp9oZUjM.js} +1 -1
- package/dist/client/assets/{collection-detail-BUFgqbfO.js → collection-detail-BB7cjHq1.js} +1 -1
- package/dist/client/assets/{collection-display-button-BT-sOTV4.js → collection-display-button-CqzsQ6A1.js} +1 -1
- package/dist/client/assets/{collection-header-Bf2EdT32.js → collection-header-BQqQNO9q.js} +1 -1
- package/dist/client/assets/{collection-page-C8XZ4WVW.js → collection-page-DlOERJnr.js} +1 -1
- package/dist/client/assets/{collection-search-UsqkgDWW.js → collection-search-CIs95Rnw.js} +1 -1
- package/dist/client/assets/{collection-tab-BOGtz91v.js → collection-tab-BPPicFWO.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DXxcxGiG.js → collection-table-wrapper-D1OlmFUL.js} +1 -1
- package/dist/client/assets/{connection-card-uFFVVLla.js → connection-card-Dm43-Wul.js} +1 -1
- package/dist/client/assets/{connection-detail-C1_qwCFU.js → connection-detail-DXNZMYLL.js} +1 -1
- package/dist/client/assets/{connections-DK3N1G3E.js → connections-BB4IEP_5.js} +1 -1
- package/dist/client/assets/constants-BSLIcG1u.js +1 -0
- package/dist/client/assets/{create-organization-dialog-D5-XNsnx.js → create-organization-dialog-miyo8zQR.js} +1 -1
- package/dist/client/assets/{dialog-Ib7U8pHy.js → dialog-DK6VaggX.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BiS4AW--.js → dropdown-menu-DTGJCwi0.js} +1 -1
- package/dist/client/assets/{empty-state-DClJbSUV.js → empty-state-DVGQ1BWZ.js} +1 -1
- package/dist/client/assets/{env-vars-editor-BoJcH29X.js → env-vars-editor-BG99RDNZ.js} +1 -1
- package/dist/client/assets/error-boundary-9rVpFVah.js +1 -0
- package/dist/client/assets/{extract-connection-data-jQgimjIZ.js → extract-connection-data-E0zDRO9-.js} +1 -1
- package/dist/client/assets/{form-BuxbGg5N.js → form-BGufVhpJ.js} +1 -1
- package/dist/client/assets/{gateway-detail-Dc2FefpC.js → gateway-detail-IUdVxLB4.js} +1 -1
- package/dist/client/assets/{gateway-selector-D3Qx1Iib.js → gateway-selector-CuwGVcxw.js} +1 -1
- package/dist/client/assets/{gateways-DpUjszQm.js → gateways-BA7lpBES.js} +1 -1
- package/dist/client/assets/{home-DNXIjorG.js → home-B5o9i0BD.js} +1 -1
- package/dist/client/assets/{index-B8j3yBaa.js → index-CaBiIG-r.js} +1 -1
- package/dist/client/assets/{index-DZBFXaT_.js → index-DHr9tFb0.js} +26 -26
- package/dist/client/assets/{index-Ci11bImk.js → index-Rcp5vvtf.js} +1 -1
- package/dist/client/assets/{input-KWjuSjzn.js → input-C4WvdKkR.js} +1 -1
- package/dist/client/assets/{layout-B02TxUA9.js → layout-9R3rtCy3.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-BVbwM6hf.js → lazy-highlighter-rNRrmjMV.js} +1 -1
- package/dist/client/assets/{localstorage-keys-ziXXhpvN.js → localstorage-keys-DrIZl-Oa.js} +1 -1
- package/dist/client/assets/{login-B5NkbJv_.js → login-CaUUYoaL.js} +1 -1
- package/dist/client/assets/{mcp-oauth-C-LpRTvB.js → mcp-oauth-BPterAhB.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-CFf8gW0D.js → mcp-server-detail-BmtUegeN.js} +1 -1
- package/dist/client/assets/{members-ZCeYH7ZZ.js → members-Dha-TTi3.js} +1 -1
- package/dist/client/assets/{monaco-editor-BmgaGs_i.js → monaco-editor-fWj67pSD.js} +1 -1
- package/dist/client/assets/{monitoring-Ct3-0i82.js → monitoring-BHqKCRpc.js} +1 -1
- package/dist/client/assets/{oauth-callback-BvCvOyK1.js → oauth-callback-C8SrcUYM.js} +1 -1
- package/dist/client/assets/page-CB2Kbqif.js +35 -0
- package/dist/client/assets/{page-CLwNDLuV.js → page-D_pWRusE.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-CeunWdra.js → pin-to-sidebar-button-Bau5uIKK.js} +1 -1
- package/dist/client/assets/{popover-CYHZWxlr.js → popover-B1hj_ypq.js} +1 -1
- package/dist/client/assets/{project-context-provider-6vMfUBpq.js → project-context-provider-SYQQWwHt.js} +1 -1
- package/dist/client/assets/{resizable-DSb7rXgM.js → resizable-oOXY1Kb2.js} +1 -1
- package/dist/client/assets/{resource-tabs-ChCUbmUR.js → resource-tabs-DXcOsIua.js} +1 -1
- package/dist/client/assets/{select-bHRpmvzh.js → select-58kzPmSH.js} +1 -1
- package/dist/client/assets/{settings-Czh6I7v0.js → settings-C8uZUL9P.js} +1 -1
- package/dist/client/assets/{shell-layout-DYtHZc0q.js → shell-layout-BXan9A9l.js} +1 -1
- package/dist/client/assets/{spinner-A1jsF1CN.js → spinner-BmiYLJkt.js} +1 -1
- package/dist/client/assets/{switch-RYFLASzA.js → switch-D3qS-cJT.js} +1 -1
- package/dist/client/assets/{textarea-_Mx18lUV.js → textarea-KpHZNzGY.js} +1 -1
- package/dist/client/assets/{thread-history-popover-CbjIrBTu.js → thread-history-popover-DrZ24omE.js} +4 -4
- package/dist/client/assets/{tools-list-DqY4kR2l.js → tools-list-BQ6I_zS0.js} +1 -1
- package/dist/client/assets/{use-binding-Dh7eSguQ.js → use-binding-DxCldqD_.js} +9 -9
- package/dist/client/assets/{use-connection-BVMsW9fR.js → use-connection-gZqQ1FAI.js} +1 -1
- package/dist/client/assets/{use-connection-resources-Cp6HGagD.js → use-connection-resources-CBnleHDw.js} +1 -1
- package/dist/client/assets/{use-gateway-DJ2wz6GD.js → use-gateway-BAeublLm.js} +1 -1
- package/dist/client/assets/{use-gateway-system-prompt-FrFSJufL.js → use-gateway-system-prompt-DcPNvMKK.js} +1 -1
- package/dist/client/assets/{use-list-state-2Noltein.js → use-list-state-_DXZxdCV.js} +1 -1
- package/dist/client/assets/{use-mcp-DbxIdwzm.js → use-mcp-DVQixgJB.js} +1 -1
- package/dist/client/assets/{use-members-CvEmo-Qp.js → use-members-Ba-WS8jO.js} +1 -1
- package/dist/client/assets/{use-mobile-Cj5IONVM.js → use-mobile-CXfyAVoY.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Bz3g4Zpi.js → use-organization-settings-g1OUF8Uc.js} +1 -1
- package/dist/client/assets/{use-tool-call-VY44CqK6.js → use-tool-call-DYbV_cs9.js} +1 -1
- package/dist/client/assets/{useQueries-BiKtsYpJ.js → useQueries-DAJGlQiv.js} +1 -1
- package/dist/client/assets/useQuery--jXLy0yb.js +1 -0
- package/dist/client/assets/{value-BXXW8rnd.js → value-DqDh9HyF.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CYuFxr7p.js → view-mode-toggle-DAKbBF5Z.js} +1 -1
- package/dist/client/assets/{workflow-RTyKsxRT.js → workflow-BO9cHs1L.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +122 -122
- package/dist/server/migrate.js +2 -2
- package/dist/server/server.js +126 -126
- package/package.json +1 -1
- package/dist/client/assets/constants-Bx_FLkPa.js +0 -1
- package/dist/client/assets/error-boundary-C3biDnWK.js +0 -1
- package/dist/client/assets/page-C9ZDngiM.js +0 -35
- package/dist/client/assets/useQuery-DW8RlKsd.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{bj as oe,bk as ss,v as P,M as J,Q as he,L as gr,W as B,I as na,H as de,X as te,a0 as Pe,bl as it,bm as aa,s as A,bn as Br,bo as ns,bp as oa,bq as qn,br as ia,bs as ca,bt as ua,a1 as Mn,J as Qr,Y as ge,V as we,bu as lr,bv as la,bw as da}from"./index-DZBFXaT_.js";import{C as fa,P as ha,a as pa,G as ma,M as G,E as Z,b as ya,L as ga,c as _a,i as ft,d as va,e as Ur,f as ba,R as Ye,g as wa,h as Hr,j as Sa,k as $a,l as Ea,T as as,m as jn,n as Ta,o as ka,p as Pa,q as Ia,I as Oa,S as Ra,r as bt,s as Ca,t as Na,u as qa,v as Ma,w as ja,x as Aa,y as An,z as Da,A as La,B as Ua,D as Ha,F as Va,U as Ne,H as Je,J as dr,K as mt,N as Fa}from"./auth-BIu7r9Ac.js";var xa=class{apply(t,e){if(!e.type)return;const r=Array.isArray(e.type)?e.type:[e.type],s=new Set(r);if(s.has("string")||(t.string=!1),!s.has("number")&&!s.has("integer")&&(t.number=!1),s.has("boolean")||(t.boolean=!1),s.has("null")||(t.null=!1),s.has("array")||(t.array=!1),s.has("object")||(t.object=!1),s.has("integer")&&t.number!==!1){const a=t.number||J();a instanceof it&&(t.number=a.int())}}},za=class{apply(t,e){if(e.const===void 0)return;const r=e.const;t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1,typeof r=="string"?t.string=te(r):typeof r=="number"?t.number=te(r):typeof r=="boolean"?t.boolean=te(r):r===null?t.null=gr():Array.isArray(r)?t.array=void 0:typeof r=="object"&&(t.object=void 0)}},Ka=class{apply(t,e){if(!e.enum)return;if(e.enum.length===0){e.type||(t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1);return}const r={string:e.enum.filter(s=>typeof s=="string"),number:e.enum.filter(s=>typeof s=="number"),boolean:e.enum.filter(s=>typeof s=="boolean"),null:e.enum.filter(s=>s===null),array:e.enum.filter(s=>Array.isArray(s)),object:e.enum.filter(s=>typeof s=="object"&&s!==null&&!Array.isArray(s))};t.string=this.createTypeSchema(r.string,"string"),t.number=this.createTypeSchema(r.number,"number"),t.boolean=this.createTypeSchema(r.boolean,"boolean"),t.null=r.null.length>0?gr():!1,t.array=r.array.length>0?void 0:!1,t.object=r.object.length>0?void 0:!1}createTypeSchema(t,e){if(t.length===0)return!1;if(t.length===1)return te(t[0]);if(e==="string")return Pe(t);if(e==="number"){const[r,s,...a]=t;return de([te(r),te(s),...a.map(n=>te(n))])}return e==="boolean"?de([te(!0),te(!1)]):!1}},Wa=class{apply(t,e){const r=e;if(r.type==="string"&&r.format==="binary"&&r.contentEncoding==="binary"){let s=aa();r.minLength!==void 0&&(s=s.min(r.minLength)),r.maxLength!==void 0&&(s=s.max(r.maxLength)),r.contentMediaType!==void 0&&(s=s.mime(r.contentMediaType)),t.file=s,t.string=!1}}},Ga=class{apply(t,e){const r=e;e.type===void 0&&(r.minLength!==void 0||r.maxLength!==void 0||r.pattern!==void 0)&&t.string===void 0&&(t.string=P())}},Ja=class{apply(t,e){const r=e;if(r.minLength!==void 0&&t.string!==!1){const s=t.string||P();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length>=r.minLength,{message:`String must be at least ${r.minLength} characters long`}))}}},Ba=class{apply(t,e){const r=e;if(r.maxLength!==void 0&&t.string!==!1){const s=t.string||P();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length<=r.maxLength,{message:`String must be at most ${r.maxLength} characters long`}))}}},Qa=class{apply(t,e){const r=e;if(r.pattern&&t.string!==!1){const s=t.string||P();if(s instanceof Br){const a=new RegExp(r.pattern);t.string=s.regex(a)}}}},Za=class{apply(t,e){const r=e;if(r.minimum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.min(r.minimum))}}},Ya=class{apply(t,e){const r=e;if(r.maximum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.max(r.maximum))}}},Xa=class{apply(t,e){const r=e;if(r.exclusiveMinimum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(typeof r.exclusiveMinimum=="number"?t.number=s.gt(r.exclusiveMinimum):t.number=!1)}}},eo=class{apply(t,e){const r=e;if(r.exclusiveMaximum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(typeof r.exclusiveMaximum=="number"?t.number=s.lt(r.exclusiveMaximum):t.number=!1)}}},to=class{apply(t,e){const r=e;if(r.multipleOf!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.refine(a=>{if(r.multipleOf===0)return!1;const n=a/r.multipleOf,i=Math.round(n),o=Math.min(Math.abs(a)*Number.EPSILON*10,Math.abs(r.multipleOf)*Number.EPSILON*10);return Math.abs(n-i)<=o/Math.abs(r.multipleOf)},{message:`Must be a multiple of ${r.multipleOf}`}))}}},ro=class{apply(t,e){const r=e;e.type===void 0&&(r.minItems!==void 0||r.maxItems!==void 0||r.items!==void 0||r.prefixItems!==void 0)&&t.array===void 0&&(t.array=B(oe()))}},so=class{apply(t,e){const r=e;r.minItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(oe())).min(r.minItems))}},no=class{apply(t,e){const r=e;r.maxItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(oe())).max(r.maxItems))}},ao=class{apply(t,e){const r=e;if(t.array!==!1)if(Array.isArray(r.items))t.array=t.array||B(oe());else if(r.items&&typeof r.items!="boolean"&&!r.prefixItems){const s=fe(r.items);let a=B(s);if(t.array&&t.array instanceof oa){const n=t.array._def;n.checks&&n.checks.forEach(i=>{if(i._zod&&i._zod.def){const o=i._zod.def;o.check==="min_length"&&o.minimum!==void 0?a=a.min(o.minimum):o.check==="max_length"&&o.maximum!==void 0&&(a=a.max(o.maximum))}})}t.array=a}else typeof r.items=="boolean"&&r.items===!1?r.prefixItems?t.array=t.array||B(oe()):t.array=B(oe()).max(0):typeof r.items=="boolean"&&r.items===!0?t.array=t.array||B(oe()):r.prefixItems&&(t.array=t.array||B(oe()))}},oo=class{apply(t,e){if(e.type!=="array")return;const r=e;if(!Array.isArray(r.items)||t.array===!1)return;const s=r.items.map(n=>fe(n));let a;s.length===0?a=ns([]):a=ns(s),r.minItems!==void 0&&r.minItems>s.length&&(a=!1),r.maxItems!==void 0&&r.maxItems<s.length&&(a=!1),t.tuple=a,t.array=!1}},io=class{apply(t,e){const r=e;t.object!==!1&&(r.properties||r.required||r.additionalProperties!==void 0)&&(t.object=t.object||A({}).passthrough())}},co=class{apply(t,e){const r=e;e.type===void 0&&(r.maxProperties!==void 0||r.minProperties!==void 0)&&t.object===void 0&&(t.object=A({}).passthrough())}},uo=class{apply(t,e){const r=e;if(r.maxProperties!==void 0&&t.object!==!1){const s=t.object||A({}).passthrough();t.object=s.refine(a=>Object.keys(a).length<=r.maxProperties,{message:`Object must have at most ${r.maxProperties} properties`})}}},lo=class{apply(t,e){const r=e;if(r.minProperties!==void 0&&t.object!==!1){const s=t.object||A({}).passthrough();t.object=s.refine(a=>Object.keys(a).length>=r.minProperties,{message:`Object must have at least ${r.minProperties} properties`})}}};function _t(t,e){if(t===e)return!0;if(t==null||e==null)return t===e;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((r,s)=>_t(r,e[s]));if(typeof t=="object"&&typeof e=="object"){const r=Object.keys(t),s=Object.keys(e);return r.length!==s.length?!1:r.every(a=>s.includes(a)&&_t(t[a],e[a]))}return!1}function fo(){return t=>{if(!Array.isArray(t))return!0;const e=[];return t.every(r=>e.some(a=>_t(r,a))?!1:(e.push(r),!0))}}function fr(t,e){return t.safeParse(e).success}var ho=class{apply(t,e){if(!e.not)return t;const r=fe(e.not);return t.refine(s=>!fr(r,s),{message:"Value must not match the 'not' schema"})}},po=class{apply(t,e){return e.uniqueItems!==!0?t:t.refine(fo(),{message:"Array items must be unique"})}},mo=class{apply(t,e){return!e.allOf||e.allOf.length===0?t:e.allOf.map(s=>fe(s)).reduce((s,a)=>qn(s,a),t)}},yo=class{apply(t,e){if(!e.anyOf||e.anyOf.length===0)return t;const r=e.anyOf.length===1?fe(e.anyOf[0]):de([fe(e.anyOf[0]),fe(e.anyOf[1]),...e.anyOf.slice(2).map(s=>fe(s))]);return qn(t,r)}},go=class{apply(t,e){if(!e.oneOf||e.oneOf.length===0)return t;const r=e.oneOf.map(s=>fe(s));return t.refine(s=>{let a=0;for(const n of r)if(n.safeParse(s).success&&(a++,a>1))return!1;return a===1},{message:"Value must match exactly one of the oneOf schemas"})}},_o=class{apply(t,e){const r=e;if(r.prefixItems&&Array.isArray(r.prefixItems)){const a=r.prefixItems.map(n=>fe(n));return t.refine(n=>{if(!Array.isArray(n))return!0;for(let i=0;i<Math.min(n.length,a.length);i++)if(!fr(a[i],n[i]))return!1;if(n.length>a.length){if(typeof r.items=="boolean"&&r.items===!1)return!1;if(r.items&&typeof r.items=="object"&&!Array.isArray(r.items)){const i=fe(r.items);for(let o=a.length;o<n.length;o++)if(!fr(i,n[o]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return t}},vo=class{apply(t,e){const r=e;if(!r.properties&&!r.required&&r.additionalProperties!==!1)return t;if(t instanceof ia||t instanceof ca){const s={};if(r.properties)for(const[a,n]of Object.entries(r.properties))n!==void 0&&(s[a]=fe(n));if(r.required&&Array.isArray(r.required)){const a=new Set(r.required);for(const n of Object.keys(s))a.has(n)||(s[n]=s[n].optional())}else for(const a of Object.keys(s))s[a]=s[a].optional();return r.additionalProperties===!1?A(s):A(s).passthrough()}return t.refine(s=>{if(typeof s!="object"||s===null||Array.isArray(s))return!0;if(r.properties){for(const[a,n]of Object.entries(r.properties))if(n!==void 0&&Object.getOwnPropertyDescriptor(s,a)!==void 0&&!fe(n).safeParse(s[a]).success)return!1}if(r.required&&Array.isArray(r.required)){for(const a of r.required)if(!(Object.getOwnPropertyDescriptor(s,a)!==void 0))return!1}if(r.additionalProperties===!1&&r.properties){const a=new Set(Object.keys(r.properties));for(const n in s)if(!a.has(n))return!1}return!0},{message:"Object constraints validation failed"})}},bo=class{apply(t,e){if(!e.enum||e.enum.length===0)return t;const r=e.enum.filter(s=>Array.isArray(s)||typeof s=="object"&&s!==null);return r.length===0?t:t.refine(s=>typeof s!="object"||s===null?!0:r.some(a=>_t(s,a)),{message:"Value must match one of the enum values"})}},wo=class{apply(t,e){if(e.const===void 0)return t;const r=e.const;return typeof r!="object"||r===null?t:t.refine(s=>_t(s,r),{message:"Value must equal the const value"})}},So=class{apply(t,e){return e.description&&(t=t.describe(e.description)),t}},$o=class{apply(t,e){var r;const s=e;return!((r=s.required)!=null&&r.includes("__proto__"))||e.type!==void 0?t:oe().refine(a=>this.validateRequired(a,s.required),{message:"Missing required properties"})}validateRequired(t,e){return typeof t!="object"||t===null||Array.isArray(t)?!0:e.every(r=>Object.prototype.hasOwnProperty.call(t,r))}},Eo=class{apply(t,e){var r;const s=e;if(s.contains===void 0)return t;const a=fe(s.contains),n=(r=s.minContains)!=null?r:1,i=s.maxContains;return t.refine(o=>{if(!Array.isArray(o))return!0;let u=0;for(const m of o)fr(a,m)&&u++;return!(u<n||i!==void 0&&u>i)},{message:"Array must contain required items matching the schema"})}},To=class{apply(t,e){const{default:r}=e;return r===void 0||!t.safeParse(r).success?t:t.default(r)}},ko=[new za,new Ka,new xa,new Wa,new Ga,new ro,new co,new Ja,new Ba,new Qa,new Za,new Ya,new Xa,new eo,new to,new oo,new so,new no,new ao,new uo,new lo,new io],Po=[new $o,new bo,new wo,new mo,new yo,new go,new _o,new vo,new Eo,new ho,new po,new To,new So];function fe(t){if(typeof t=="boolean")return t?oe():ss();const e={};for(const a of ko)a.apply(e,t);const r=[];if(e.string!==!1&&r.push(e.string||P()),e.number!==!1&&r.push(e.number||J()),e.boolean!==!1&&r.push(e.boolean||he()),e.null!==!1&&r.push(e.null||gr()),e.array!==!1&&r.push(e.array||B(oe())),e.tuple!==!1&&e.tuple!==void 0&&r.push(e.tuple),e.object!==!1)if(e.object)r.push(e.object);else{const a=na(n=>typeof n=="object"&&n!==null&&!Array.isArray(n),"Must be an object, not an array");r.push(a)}e.file!==!1&&e.file!==void 0&&r.push(e.file);let s;r.length===0?s=ss():r.length===1?s=r[0]:Object.keys(t).some(n=>n!=="$schema"&&n!=="title"&&n!=="description")?s=de(r):s=oe();for(const a of Po)s=a.apply(s,t);return s}function _r(t){return!!t._zod}function He(t,e){return _r(t)?ua(t,e):t.safeParse(e)}function Dn(t){if(!t)return;let e;if(_r(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Io(t){if(_r(t)){const n=t._zod?.def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.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 xe(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function os(t){const r=Dn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");const s=Io(r);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function is(t,e){const r=He(t,e);if(!r.success)throw r.error;return r.data}const Oo=6e4;class Ro{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(fa,r=>{this._oncancel(r)}),this.setNotificationHandler(ha,r=>{this._onprogress(r)}),this.setRequestHandler(pa,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ma,async(r,s)=>{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new G(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(ya,async(r,s)=>{const a=async()=>{const n=r.params.taskId;if(this._taskMessageQueue){let o;for(;o=await this._taskMessageQueue.dequeue(n,s.sessionId);){if(o.type==="response"||o.type==="error"){const u=o.message,m=u.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),o.type==="response")h(u);else{const $=u,g=new G($.error.code,$.error.message,$.error.data);h(g)}else{const $=o.type==="response"?"Response":"Error";this._onerror(new Error(`${$} handler missing for request ${m}`))}continue}await this._transport?.send(o.message,{relatedRequestId:s.requestId})}}const i=await this._taskStore.getTask(n,s.sessionId);if(!i)throw new G(Z.InvalidParams,`Task not found: ${n}`);if(!xe(i.status))return await this._waitForTaskUpdate(n,s.signal),await a();if(xe(i.status)){const o=await this._taskStore.getTaskResult(n,s.sessionId);return this._clearTaskQueue(n),{...o,_meta:{...o._meta,[Ye]:{taskId:n}}}}return await a()};return await a()}),this.setRequestHandler(ga,async(r,s)=>{try{const{tasks:a,nextCursor:n}=await this._taskStore.listTasks(r.params?.cursor,s.sessionId);return{tasks:a,nextCursor:n,_meta:{}}}catch(a){throw new G(Z.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(_a,async(r,s)=>{try{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new G(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(xe(a.status))throw new G(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 G(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...n}}catch(a){throw a instanceof G?a:new G(Z.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.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),G.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){this._transport=e;const r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=n=>{s?.(n),this._onerror(n)};const a=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{a?.(n,i),ft(n)||va(n)?this._onresponse(n):Ur(n)?this._onrequest(n,i):ba(n)?this._onnotification(n):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const r=G.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(r)}_onerror(e){this.onerror?.(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){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,a=this._transport,n=e.params?._meta?.[Ye]?.taskId;if(s===void 0){const h={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};n&&this._taskMessageQueue?this._enqueueTaskMessage(n,{type:"error",message:h,timestamp:Date.now()},a?.sessionId).catch($=>this._onerror(new Error(`Failed to enqueue error response: ${$}`))):a?.send(h).catch($=>this._onerror(new Error(`Failed to send an error response: ${$}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const o=wa(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,a?.sessionId):void 0,m={signal:i.signal,sessionId:a?.sessionId,_meta:e.params?._meta,sendNotification:async h=>{const $={relatedRequestId:e.id};n&&($.relatedTask={taskId:n}),await this.notification(h,$)},sendRequest:async(h,$,g)=>{const y={...g,relatedRequestId:e.id};n&&!y.relatedTask&&(y.relatedTask={taskId:n});const v=y.relatedTask?.taskId??n;return v&&u&&await u.updateTaskStatus(v,"input_required"),await this.request(h,$,y)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:n,taskStore:u,taskRequestedTtl:o?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,m)).then(async h=>{if(i.signal.aborted)return;const $={result:h,jsonrpc:"2.0",id:e.id};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"response",message:$,timestamp:Date.now()},a?.sessionId):await a?.send($)},async h=>{if(i.signal.aborted)return;const $={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(h.code)?h.code:Z.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"error",message:$,timestamp:Date.now()},a?.sessionId):await a?.send($)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).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 i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(u){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(u);return}n(s)}_onresponse(e){const r=Number(e.id),s=this._requestResolvers.get(r);if(s){if(this._requestResolvers.delete(r),ft(e))s(e);else{const i=new G(e.error.code,e.error.message,e.error.data);s(i)}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(ft(e)&&e.result&&typeof e.result=="object"){const i=e.result;if(i.task&&typeof i.task=="object"){const o=i.task;typeof o.taskId=="string"&&(n=!0,this._taskProgressTokens.set(o.taskId,r))}}if(n||this._progressHandlers.delete(r),ft(e))a(e);else{const i=G.fromError(e.error.code,e.error.message,e.error.data);a(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,s){const{task:a}=s??{};if(!a){try{yield{type:"result",result:await this.request(e,r,s)}}catch(i){yield{type:"error",error:i instanceof G?i:new G(Z.InternalError,String(i))}}return}let n;try{const i=await this.request(e,Hr,s);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new G(Z.InternalError,"Task creation did not return a task");for(;;){const o=await this.getTask({taskId:n},s);if(yield{type:"taskStatus",task:o},xe(o.status)){o.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)}:o.status==="failed"?yield{type:"error",error:new G(Z.InternalError,`Task ${n} failed`)}:o.status==="cancelled"&&(yield{type:"error",error:new G(Z.InternalError,`Task ${n} was cancelled`)});return}if(o.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)};return}const u=o.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(m=>setTimeout(m,u)),s?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof G?i:new G(Z.InternalError,String(i))}}}request(e,r,s){const{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i,task:o,relatedTask:u}=s??{};return new Promise((m,h)=>{const $=c=>{h(c)};if(!this._transport){$(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(c){$(c);return}s?.signal?.throwIfAborted();const g=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:g};s?.onprogress&&(this._progressHandlers.set(g,s.onprogress),y.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}}),o&&(y.params={...y.params,task:o}),u&&(y.params={...y.params,_meta:{...y.params?._meta||{},[Ye]:u}});const v=c=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(c)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));const d=c instanceof G?c:new G(Z.RequestTimeout,String(c));h(d)};this._responseHandlers.set(g,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return h(c);try{const d=He(r,c.result);d.success?m(d.data):h(d.error)}catch(d){h(d)}}}),s?.signal?.addEventListener("abort",()=>{v(s?.signal?.reason)});const w=s?.timeout??Oo,l=()=>v(G.fromError(Z.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,s?.maxTotalTimeout,l,s?.resetTimeoutOnProgress??!1);const p=u?.taskId;if(p){const c=d=>{const S=this._responseHandlers.get(g);S?S(d):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,c),this._enqueueTaskMessage(p,{type:"request",message:y,timestamp:Date.now()}).catch(d=>{this._cleanupTimeout(g),h(d)})}else this._transport.send(y,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(c=>{this._cleanupTimeout(g),h(c)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Sa,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},$a,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Ea,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=r?.relatedTask?.taskId;if(s){const o={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ye]:r.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:o,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let o={...e,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Ye]:r.relatedTask}}}),this._transport?.send(o,r).catch(u=>this._onerror(u))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Ye]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){const s=os(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>{const i=is(e,a);return Promise.resolve(r(i,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){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const a=this._options?.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"&&Ur(a.message)){const n=a.message.id,i=this._requestResolvers.get(n);i?(i(new G(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){let s=this._options?.defaultTaskPollInterval??1e3;try{const a=await this._taskStore?.getTask(e);a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,n)=>{if(r.aborted){n(new G(Z.InvalidRequest,"Request cancelled"));return}const i=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(i),n(new G(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 G(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(a,n,i)=>{await s.storeTaskResult(a,n,i,r);const o=await s.getTask(a,r);if(o){const u=as.parse({method:"notifications/tasks/status",params:o});await this.notification(u),xe(o.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>s.getTaskResult(a,r),updateTaskStatus:async(a,n,i)=>{const o=await s.getTask(a,r);if(!o)throw new G(Z.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(xe(o.status))throw new G(Z.InvalidParams,`Cannot update task "${a}" from terminal status "${o.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(a,n,i,r);const u=await s.getTask(a,r);if(u){const m=as.parse({method:"notifications/tasks/status",params:u});await this.notification(m),xe(u.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>s.listTasks(a,r)}}}function cs(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Co(t,e){const r={...t};for(const s in e){const a=s,n=e[a];if(n===void 0)continue;const i=r[a];cs(i)&&cs(n)?r[a]={...i,...n}:r[a]=n}return r}var wt={exports:{}},kr={},Me={},ze={},Pr={},Ir={},Or={},us;function hr(){return us||(us=1,(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(c){if(super(),!t.IDENTIFIER.test(c))throw new Error("CodeGen: name must be a valid identifier");this.str=c}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class s extends e{constructor(c){super(),this._items=typeof c=="string"?[c]:c}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const c=this._items[0];return c===""||c==='""'}get str(){var c;return(c=this._str)!==null&&c!==void 0?c:this._str=this._items.reduce((d,S)=>`${d}${S}`,"")}get names(){var c;return(c=this._names)!==null&&c!==void 0?c:this._names=this._items.reduce((d,S)=>(S instanceof r&&(d[S.str]=(d[S.str]||0)+1),d),{})}}t._Code=s,t.nil=new s("");function a(p,...c){const d=[p[0]];let S=0;for(;S<c.length;)o(d,c[S]),d.push(p[++S]);return new s(d)}t._=a;const n=new s("+");function i(p,...c){const d=[y(p[0])];let S=0;for(;S<c.length;)d.push(n),o(d,c[S]),d.push(n,y(p[++S]));return u(d),new s(d)}t.str=i;function o(p,c){c instanceof s?p.push(...c._items):c instanceof r?p.push(c):p.push($(c))}t.addCodeArg=o;function u(p){let c=1;for(;c<p.length-1;){if(p[c]===n){const d=m(p[c-1],p[c+1]);if(d!==void 0){p.splice(c-1,3,d);continue}p[c++]="+"}c++}}function m(p,c){if(c==='""')return p;if(p==='""')return c;if(typeof p=="string")return c instanceof r||p[p.length-1]!=='"'?void 0:typeof c!="string"?`${p.slice(0,-1)}${c}"`:c[0]==='"'?p.slice(0,-1)+c.slice(1):void 0;if(typeof c=="string"&&c[0]==='"'&&!(p instanceof r))return`"${p}${c.slice(1)}`}function h(p,c){return c.emptyStr()?p:p.emptyStr()?c:i`${p}${c}`}t.strConcat=h;function $(p){return typeof p=="number"||typeof p=="boolean"||p===null?p:y(Array.isArray(p)?p.join(","):p)}function g(p){return new s(y(p))}t.stringify=g;function y(p){return JSON.stringify(p).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=y;function v(p){return typeof p=="string"&&t.IDENTIFIER.test(p)?new s(`.${p}`):a`[${p}]`}t.getProperty=v;function w(p){if(typeof p=="string"&&t.IDENTIFIER.test(p))return new s(`${p}`);throw new Error(`CodeGen: invalid export name: ${p}, use explicit $id name mapping`)}t.getEsmExportName=w;function l(p){return new s(p.toString())}t.regexpCode=l})(Or)),Or}var Rr={},ls;function ds(){return ls||(ls=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=hr();class r extends Error{constructor(m){super(`CodeGen: "code" for ${m} not defined`),this.value=m.value}}var s;(function(u){u[u.Started=0]="Started",u[u.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:m,parent:h}={}){this._names={},this._prefixes=m,this._parent=h}toName(m){return m instanceof e.Name?m:this.name(m)}name(m){return new e.Name(this._newName(m))}_newName(m){const h=this._names[m]||this._nameGroup(m);return`${m}${h.index++}`}_nameGroup(m){var h,$;if(!(($=(h=this._parent)===null||h===void 0?void 0:h._prefixes)===null||$===void 0)&&$.has(m)||this._prefixes&&!this._prefixes.has(m))throw new Error(`CodeGen: prefix "${m}" is not allowed in this scope`);return this._names[m]={prefix:m,index:0}}}t.Scope=a;class n extends e.Name{constructor(m,h){super(h),this.prefix=m}setValue(m,{property:h,itemIndex:$}){this.value=m,this.scopePath=(0,e._)`.${new e.Name(h)}[${$}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends a{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?i:e.nil}}get(){return this._scope}name(m){return new n(m,this._newName(m))}value(m,h){var $;if(h.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(m),{prefix:y}=g,v=($=h.key)!==null&&$!==void 0?$:h.ref;let w=this._values[y];if(w){const c=w.get(v);if(c)return c}else w=this._values[y]=new Map;w.set(v,g);const l=this._scope[y]||(this._scope[y]=[]),p=l.length;return l[p]=h.ref,g.setValue(h,{property:y,itemIndex:p}),g}getValue(m,h){const $=this._values[m];if($)return $.get(h)}scopeRefs(m,h=this._values){return this._reduceValues(h,$=>{if($.scopePath===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return(0,e._)`${m}${$.scopePath}`})}scopeCode(m=this._values,h,$){return this._reduceValues(m,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},h,$)}_reduceValues(m,h,$={},g){let y=e.nil;for(const v in m){const w=m[v];if(!w)continue;const l=$[v]=$[v]||new Map;w.forEach(p=>{if(l.has(p))return;l.set(p,s.Started);let c=h(p);if(c){const d=this.opts.es5?t.varKinds.var:t.varKinds.const;y=(0,e._)`${y}${d} ${p} = ${c};${this.opts._n}`}else if(c=g?.(p))y=(0,e._)`${y}${c}${this.opts._n}`;else throw new r(p);l.set(p,s.Completed)})}return y}}t.ValueScope=o})(Rr)),Rr}var fs;function Y(){return fs||(fs=1,(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=hr(),r=ds();var s=hr();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=ds();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(_,T){return this}}class i extends n{constructor(_,T,N){super(),this.varKind=_,this.name=T,this.rhs=N}render({es5:_,_n:T}){const N=_?r.varKinds.var:this.varKind,z=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${z};`+T}optimizeNames(_,T){if(_[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,_,T)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(_,T,N){super(),this.lhs=_,this.rhs=T,this.sideEffects=N}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,T){if(!(this.lhs instanceof e.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=x(this.rhs,_,T),this}get names(){const _=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(_,this.rhs)}}class u extends o{constructor(_,T,N,z){super(_,N,z),this.op=T}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class m extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class h extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class $ extends n{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class g extends n{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,T){return this.code=x(this.code,_,T),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class y extends n{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((T,N)=>T+N.render(_),"")}optimizeNodes(){const{nodes:_}=this;let T=_.length;for(;T--;){const N=_[T].optimizeNodes();Array.isArray(N)?_.splice(T,1,...N):N?_[T]=N:_.splice(T,1)}return _.length>0?this:void 0}optimizeNames(_,T){const{nodes:N}=this;let z=N.length;for(;z--;){const W=N[z];W.optimizeNames(_,T)||(ae(_,W.names),N.splice(z,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((_,T)=>H(_,T.names),{})}}class v extends y{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class w extends y{}class l extends v{}l.kind="else";class p extends v{constructor(_,T){super(T),this.condition=_}render(_){let T=`if(${this.condition})`+super.render(_);return this.else&&(T+="else "+this.else.render(_)),T}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let T=this.else;if(T){const N=T.optimizeNodes();T=this.else=Array.isArray(N)?new l(N):N}if(T)return _===!1?T instanceof p?T:T.nodes:this.nodes.length?this:new p(_e(_),T instanceof p?[T]:T.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,T){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(_,T),!!(super.optimizeNames(_,T)||this.else))return this.condition=x(this.condition,_,T),this}get names(){const _=super.names;return F(_,this.condition),this.else&&H(_,this.else.names),_}}p.kind="if";class c extends v{}c.kind="for";class d extends c{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,T){if(super.optimizeNames(_,T))return this.iteration=x(this.iteration,_,T),this}get names(){return H(super.names,this.iteration.names)}}class S extends c{constructor(_,T,N,z){super(),this.varKind=_,this.name=T,this.from=N,this.to=z}render(_){const T=_.es5?r.varKinds.var:this.varKind,{name:N,from:z,to:W}=this;return`for(${T} ${N}=${z}; ${N}<${W}; ${N}++)`+super.render(_)}get names(){const _=F(super.names,this.from);return F(_,this.to)}}class f extends c{constructor(_,T,N,z){super(),this.loop=_,this.varKind=T,this.name=N,this.iterable=z}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,T){if(super.optimizeNames(_,T))return this.iterable=x(this.iterable,_,T),this}get names(){return H(super.names,this.iterable.names)}}class b extends v{constructor(_,T,N){super(),this.name=_,this.args=T,this.async=N}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}b.kind="func";class E extends y{render(_){return"return "+super.render(_)}}E.kind="return";class C extends v{render(_){let T="try"+super.render(_);return this.catch&&(T+=this.catch.render(_)),this.finally&&(T+=this.finally.render(_)),T}optimizeNodes(){var _,T;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(_,T){var N,z;return super.optimizeNames(_,T),(N=this.catch)===null||N===void 0||N.optimizeNames(_,T),(z=this.finally)===null||z===void 0||z.optimizeNames(_,T),this}get names(){const _=super.names;return this.catch&&H(_,this.catch.names),this.finally&&H(_,this.finally.names),_}}class D extends v{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}D.kind="catch";class V extends v{render(_){return"finally"+super.render(_)}}V.kind="finally";class q{constructor(_,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
|
|
2
|
-
`:""},this._extScope=_,this._scope=new r.Scope({parent:_}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,T){const N=this._extScope.value(_,T);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(_,T){return this._extScope.getValue(_,T)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,T,N,z){const W=this._scope.toName(T);return N!==void 0&&z&&(this._constants[W.str]=N),this._leafNode(new i(_,W,N)),W}const(_,T,N){return this._def(r.varKinds.const,_,T,N)}let(_,T,N){return this._def(r.varKinds.let,_,T,N)}var(_,T,N){return this._def(r.varKinds.var,_,T,N)}assign(_,T,N){return this._leafNode(new o(_,T,N))}add(_,T){return this._leafNode(new u(_,t.operators.ADD,T))}code(_){return typeof _=="function"?_():_!==e.nil&&this._leafNode(new g(_)),this}object(..._){const T=["{"];for(const[N,z]of _)T.length>1&&T.push(","),T.push(N),(N!==z||this.opts.es5)&&(T.push(":"),(0,e.addCodeArg)(T,z));return T.push("}"),new e._Code(T)}if(_,T,N){if(this._blockNode(new p(_)),T&&N)this.code(T).else().code(N).endIf();else if(T)this.code(T).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new p(_))}else(){return this._elseNode(new l)}endIf(){return this._endBlockNode(p,l)}_for(_,T){return this._blockNode(_),T&&this.code(T).endFor(),this}for(_,T){return this._for(new d(_),T)}forRange(_,T,N,z,W=this.opts.es5?r.varKinds.var:r.varKinds.let){const ne=this._scope.toName(_);return this._for(new S(W,ne,T,N),()=>z(ne))}forOf(_,T,N,z=r.varKinds.const){const W=this._scope.toName(_);if(this.opts.es5){const ne=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${ne}.length`,re=>{this.var(W,(0,e._)`${ne}[${re}]`),N(W)})}return this._for(new f("of",z,W,T),()=>N(W))}forIn(_,T,N,z=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,e._)`Object.keys(${T})`,N);const W=this._scope.toName(_);return this._for(new f("in",z,W,T),()=>N(W))}endFor(){return this._endBlockNode(c)}label(_){return this._leafNode(new m(_))}break(_){return this._leafNode(new h(_))}return(_){const T=new E;if(this._blockNode(T),this.code(_),T.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(_,T,N){if(!T&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const z=new C;if(this._blockNode(z),this.code(_),T){const W=this.name("e");this._currNode=z.catch=new D(W),T(W)}return N&&(this._currNode=z.finally=new V,this.code(N)),this._endBlockNode(D,V)}throw(_){return this._leafNode(new $(_))}block(_,T){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(T),this}endBlock(_){const T=this._blockStarts.pop();if(T===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-T;if(N<0||_!==void 0&&N!==_)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${_} expected`);return this._nodes.length=T,this}func(_,T=e.nil,N,z){return this._blockNode(new b(_,T,N)),z&&this.code(z).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,T){const N=this._currNode;if(N instanceof _||T&&N instanceof T)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${T?`${_.kind}/${T.kind}`:_.kind}"`)}_elseNode(_){const T=this._currNode;if(!(T instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=T.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const T=this._nodes;T[T.length-1]=_}}t.CodeGen=q;function H(R,_){for(const T in _)R[T]=(R[T]||0)+(_[T]||0);return R}function F(R,_){return _ instanceof e._CodeOrName?H(R,_.names):R}function x(R,_,T){if(R instanceof e.Name)return N(R);if(!z(R))return R;return new e._Code(R._items.reduce((W,ne)=>(ne instanceof e.Name&&(ne=N(ne)),ne instanceof e._Code?W.push(...ne._items):W.push(ne),W),[]));function N(W){const ne=T[W.str];return ne===void 0||_[W.str]!==1?W:(delete _[W.str],ne)}function z(W){return W instanceof e._Code&&W._items.some(ne=>ne instanceof e.Name&&_[ne.str]===1&&T[ne.str]!==void 0)}}function ae(R,_){for(const T in _)R[T]=(R[T]||0)-(_[T]||0)}function _e(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:(0,e._)`!${j(R)}`}t.not=_e;const ve=I(t.operators.AND);function ce(...R){return R.reduce(ve)}t.and=ce;const Ie=I(t.operators.OR);function L(...R){return R.reduce(Ie)}t.or=L;function I(R){return(_,T)=>_===e.nil?T:T===e.nil?_:(0,e._)`${j(_)} ${R} ${j(T)}`}function j(R){return R instanceof e.Name?R:(0,e._)`(${R})`}})(Ir)),Ir}var Q={},hs;function se(){if(hs)return Q;hs=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;const t=Y(),e=hr();function r(f){const b={};for(const E of f)b[E]=!0;return b}Q.toHash=r;function s(f,b){return typeof b=="boolean"?b:Object.keys(b).length===0?!0:(a(f,b),!n(b,f.self.RULES.all))}Q.alwaysValidSchema=s;function a(f,b=f.schema){const{opts:E,self:C}=f;if(!E.strictSchema||typeof b=="boolean")return;const D=C.RULES.keywords;for(const V in b)D[V]||S(f,`unknown keyword: "${V}"`)}Q.checkUnknownRules=a;function n(f,b){if(typeof f=="boolean")return!f;for(const E in f)if(b[E])return!0;return!1}Q.schemaHasRules=n;function i(f,b){if(typeof f=="boolean")return!f;for(const E in f)if(E!=="$ref"&&b.all[E])return!0;return!1}Q.schemaHasRulesButRef=i;function o({topSchemaRef:f,schemaPath:b},E,C,D){if(!D){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${f}${b}${(0,t.getProperty)(C)}`}Q.schemaRefOrVal=o;function u(f){return $(decodeURIComponent(f))}Q.unescapeFragment=u;function m(f){return encodeURIComponent(h(f))}Q.escapeFragment=m;function h(f){return typeof f=="number"?`${f}`:f.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=h;function $(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=$;function g(f,b){if(Array.isArray(f))for(const E of f)b(E);else b(f)}Q.eachItem=g;function y({mergeNames:f,mergeToName:b,mergeValues:E,resultToName:C}){return(D,V,q,H)=>{const F=q===void 0?V:q instanceof t.Name?(V instanceof t.Name?f(D,V,q):b(D,V,q),q):V instanceof t.Name?(b(D,q,V),V):E(V,q);return H===t.Name&&!(F instanceof t.Name)?C(D,F):F}}Q.mergeEvaluated={props:y({mergeNames:(f,b,E)=>f.if((0,t._)`${E} !== true && ${b} !== undefined`,()=>{f.if((0,t._)`${b} === true`,()=>f.assign(E,!0),()=>f.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${b})`))}),mergeToName:(f,b,E)=>f.if((0,t._)`${E} !== true`,()=>{b===!0?f.assign(E,!0):(f.assign(E,(0,t._)`${E} || {}`),w(f,E,b))}),mergeValues:(f,b)=>f===!0?!0:{...f,...b},resultToName:v}),items:y({mergeNames:(f,b,E)=>f.if((0,t._)`${E} !== true && ${b} !== undefined`,()=>f.assign(E,(0,t._)`${b} === true ? true : ${E} > ${b} ? ${E} : ${b}`)),mergeToName:(f,b,E)=>f.if((0,t._)`${E} !== true`,()=>f.assign(E,b===!0?!0:(0,t._)`${E} > ${b} ? ${E} : ${b}`)),mergeValues:(f,b)=>f===!0?!0:Math.max(f,b),resultToName:(f,b)=>f.var("items",b)})};function v(f,b){if(b===!0)return f.var("props",!0);const E=f.var("props",(0,t._)`{}`);return b!==void 0&&w(f,E,b),E}Q.evaluatedPropsToName=v;function w(f,b,E){Object.keys(E).forEach(C=>f.assign((0,t._)`${b}${(0,t.getProperty)(C)}`,!0))}Q.setEvaluated=w;const l={};function p(f,b){return f.scopeValue("func",{ref:b,code:l[b.code]||(l[b.code]=new e._Code(b.code))})}Q.useFunc=p;var c;(function(f){f[f.Num=0]="Num",f[f.Str=1]="Str"})(c||(Q.Type=c={}));function d(f,b,E){if(f instanceof t.Name){const C=b===c.Num;return E?C?(0,t._)`"[" + ${f} + "]"`:(0,t._)`"['" + ${f} + "']"`:C?(0,t._)`"/" + ${f}`:(0,t._)`"/" + ${f}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(f).toString():"/"+h(f)}Q.getErrorPath=d;function S(f,b,E=f.opts.strictSchema){if(E){if(b=`strict mode: ${b}`,E===!0)throw new Error(b);f.self.logger.warn(b)}}return Q.checkStrictMode=S,Q}var St={},ps;function Fe(){if(ps)return St;ps=1,Object.defineProperty(St,"__esModule",{value:!0});const t=Y(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return St.default=e,St}var ms;function vr(){return ms||(ms=1,(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=Y(),r=se(),s=Fe();t.keywordError={message:({keyword:l})=>(0,e.str)`must pass "${l}" keyword validation`},t.keyword$DataError={message:({keyword:l,schemaType:p})=>p?(0,e.str)`"${l}" keyword must be ${p} ($data)`:(0,e.str)`"${l}" keyword is invalid ($data)`};function a(l,p=t.keywordError,c,d){const{it:S}=l,{gen:f,compositeRule:b,allErrors:E}=S,C=$(l,p,c);d??(b||E)?u(f,C):m(S,(0,e._)`[${C}]`)}t.reportError=a;function n(l,p=t.keywordError,c){const{it:d}=l,{gen:S,compositeRule:f,allErrors:b}=d,E=$(l,p,c);u(S,E),f||b||m(d,s.default.vErrors)}t.reportExtraError=n;function i(l,p){l.assign(s.default.errors,p),l.if((0,e._)`${s.default.vErrors} !== null`,()=>l.if(p,()=>l.assign((0,e._)`${s.default.vErrors}.length`,p),()=>l.assign(s.default.vErrors,null)))}t.resetErrorsCount=i;function o({gen:l,keyword:p,schemaValue:c,data:d,errsCount:S,it:f}){if(S===void 0)throw new Error("ajv implementation error");const b=l.name("err");l.forRange("i",S,s.default.errors,E=>{l.const(b,(0,e._)`${s.default.vErrors}[${E}]`),l.if((0,e._)`${b}.instancePath === undefined`,()=>l.assign((0,e._)`${b}.instancePath`,(0,e.strConcat)(s.default.instancePath,f.errorPath))),l.assign((0,e._)`${b}.schemaPath`,(0,e.str)`${f.errSchemaPath}/${p}`),f.opts.verbose&&(l.assign((0,e._)`${b}.schema`,c),l.assign((0,e._)`${b}.data`,d))})}t.extendErrors=o;function u(l,p){const c=l.const("err",p);l.if((0,e._)`${s.default.vErrors} === null`,()=>l.assign(s.default.vErrors,(0,e._)`[${c}]`),(0,e._)`${s.default.vErrors}.push(${c})`),l.code((0,e._)`${s.default.errors}++`)}function m(l,p){const{gen:c,validateName:d,schemaEnv:S}=l;S.$async?c.throw((0,e._)`new ${l.ValidationError}(${p})`):(c.assign((0,e._)`${d}.errors`,p),c.return(!1))}const h={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 $(l,p,c){const{createErrors:d}=l.it;return d===!1?(0,e._)`{}`:g(l,p,c)}function g(l,p,c={}){const{gen:d,it:S}=l,f=[y(S,c),v(l,c)];return w(l,p,f),d.object(...f)}function y({errorPath:l},{instancePath:p}){const c=p?(0,e.str)`${l}${(0,r.getErrorPath)(p,r.Type.Str)}`:l;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,c)]}function v({keyword:l,it:{errSchemaPath:p}},{schemaPath:c,parentSchema:d}){let S=d?p:(0,e.str)`${p}/${l}`;return c&&(S=(0,e.str)`${S}${(0,r.getErrorPath)(c,r.Type.Str)}`),[h.schemaPath,S]}function w(l,{params:p,message:c},d){const{keyword:S,data:f,schemaValue:b,it:E}=l,{opts:C,propertyName:D,topSchemaRef:V,schemaPath:q}=E;d.push([h.keyword,S],[h.params,typeof p=="function"?p(l):p||(0,e._)`{}`]),C.messages&&d.push([h.message,typeof c=="function"?c(l):c]),C.verbose&&d.push([h.schema,b],[h.parentSchema,(0,e._)`${V}${q}`],[s.default.data,f]),D&&d.push([h.propertyName,D])}})(Pr)),Pr}var ys;function No(){if(ys)return ze;ys=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.boolOrEmptySchema=ze.topBoolOrEmptySchema=void 0;const t=vr(),e=Y(),r=Fe(),s={message:"boolean schema is false"};function a(o){const{gen:u,schema:m,validateName:h}=o;m===!1?i(o,!1):typeof m=="object"&&m.$async===!0?u.return(r.default.data):(u.assign((0,e._)`${h}.errors`,null),u.return(!0))}ze.topBoolOrEmptySchema=a;function n(o,u){const{gen:m,schema:h}=o;h===!1?(m.var(u,!1),i(o)):m.var(u,!0)}ze.boolOrEmptySchema=n;function i(o,u){const{gen:m,data:h}=o,$={gen:m,keyword:"false schema",data:h,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)($,s,void 0,u)}return ze}var ye={},Ke={},gs;function Ln(){if(gs)return Ke;gs=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.getRules=Ke.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function r(a){return typeof a=="string"&&e.has(a)}Ke.isJSONType=r;function s(){const a={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...a,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},a.number,a.string,a.array,a.object],post:{rules:[]},all:{},keywords:{}}}return Ke.getRules=s,Ke}var je={},_s;function Un(){if(_s)return je;_s=1,Object.defineProperty(je,"__esModule",{value:!0}),je.shouldUseRule=je.shouldUseGroup=je.schemaHasRulesForType=void 0;function t({schema:s,self:a},n){const i=a.RULES.types[n];return i&&i!==!0&&e(s,i)}je.schemaHasRulesForType=t;function e(s,a){return a.rules.some(n=>r(s,n))}je.shouldUseGroup=e;function r(s,a){var n;return s[a.keyword]!==void 0||((n=a.definition.implements)===null||n===void 0?void 0:n.some(i=>s[i]!==void 0))}return je.shouldUseRule=r,je}var vs;function pr(){if(vs)return ye;vs=1,Object.defineProperty(ye,"__esModule",{value:!0}),ye.reportTypeError=ye.checkDataTypes=ye.checkDataType=ye.coerceAndCheckDataType=ye.getJSONTypes=ye.getSchemaTypes=ye.DataType=void 0;const t=Ln(),e=Un(),r=vr(),s=Y(),a=se();var n;(function(c){c[c.Correct=0]="Correct",c[c.Wrong=1]="Wrong"})(n||(ye.DataType=n={}));function i(c){const d=o(c.type);if(d.includes("null")){if(c.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!d.length&&c.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');c.nullable===!0&&d.push("null")}return d}ye.getSchemaTypes=i;function o(c){const d=Array.isArray(c)?c:c?[c]:[];if(d.every(t.isJSONType))return d;throw new Error("type must be JSONType or JSONType[]: "+d.join(","))}ye.getJSONTypes=o;function u(c,d){const{gen:S,data:f,opts:b}=c,E=h(d,b.coerceTypes),C=d.length>0&&!(E.length===0&&d.length===1&&(0,e.schemaHasRulesForType)(c,d[0]));if(C){const D=v(d,f,b.strictNumbers,n.Wrong);S.if(D,()=>{E.length?$(c,d,E):l(c)})}return C}ye.coerceAndCheckDataType=u;const m=new Set(["string","number","integer","boolean","null"]);function h(c,d){return d?c.filter(S=>m.has(S)||d==="array"&&S==="array"):[]}function $(c,d,S){const{gen:f,data:b,opts:E}=c,C=f.let("dataType",(0,s._)`typeof ${b}`),D=f.let("coerced",(0,s._)`undefined`);E.coerceTypes==="array"&&f.if((0,s._)`${C} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>f.assign(b,(0,s._)`${b}[0]`).assign(C,(0,s._)`typeof ${b}`).if(v(d,b,E.strictNumbers),()=>f.assign(D,b))),f.if((0,s._)`${D} !== undefined`);for(const q of S)(m.has(q)||q==="array"&&E.coerceTypes==="array")&&V(q);f.else(),l(c),f.endIf(),f.if((0,s._)`${D} !== undefined`,()=>{f.assign(b,D),g(c,D)});function V(q){switch(q){case"string":f.elseIf((0,s._)`${C} == "number" || ${C} == "boolean"`).assign(D,(0,s._)`"" + ${b}`).elseIf((0,s._)`${b} === null`).assign(D,(0,s._)`""`);return;case"number":f.elseIf((0,s._)`${C} == "boolean" || ${b} === null
|
|
1
|
+
import{bj as oe,bk as rs,v as P,M as J,Q as fe,L as yr,W as B,I as sa,H as be,X as te,a0 as Pe,bl as it,bm as na,s as A,bn as Jr,bo as ss,bp as aa,bq as Nn,br as oa,bs as ia,bt as ca,a1 as qn,J as Br,Y as ye,V as we,bu as ua,bv as la}from"./index-DHr9tFb0.js";import{C as da,P as fa,a as ha,G as pa,M as G,E as Z,b as ma,L as ya,c as ga,i as ft,d as _a,e as Lr,f as va,R as Ye,g as ba,h as Ur,j as wa,k as Sa,l as $a,T as ns,m as Mn,n as Ea,o as Ta,p as ka,q as Pa,I as Ia,S as Oa,r as bt,s as Ra,t as Ca,u as Na,v as qa,w as Ma,x as ja,y as jn,z as Aa,A as Da,B as La,D as Ua,F as Ha,U as Ne,H as Je,J as lr,K as mt,N as Va}from"./auth-CJNQiaii.js";var Fa=class{apply(t,e){if(!e.type)return;const r=Array.isArray(e.type)?e.type:[e.type],s=new Set(r);if(s.has("string")||(t.string=!1),!s.has("number")&&!s.has("integer")&&(t.number=!1),s.has("boolean")||(t.boolean=!1),s.has("null")||(t.null=!1),s.has("array")||(t.array=!1),s.has("object")||(t.object=!1),s.has("integer")&&t.number!==!1){const a=t.number||J();a instanceof it&&(t.number=a.int())}}},xa=class{apply(t,e){if(e.const===void 0)return;const r=e.const;t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1,typeof r=="string"?t.string=te(r):typeof r=="number"?t.number=te(r):typeof r=="boolean"?t.boolean=te(r):r===null?t.null=yr():Array.isArray(r)?t.array=void 0:typeof r=="object"&&(t.object=void 0)}},za=class{apply(t,e){if(!e.enum)return;if(e.enum.length===0){e.type||(t.string=!1,t.number=!1,t.boolean=!1,t.null=!1,t.array=!1,t.object=!1);return}const r={string:e.enum.filter(s=>typeof s=="string"),number:e.enum.filter(s=>typeof s=="number"),boolean:e.enum.filter(s=>typeof s=="boolean"),null:e.enum.filter(s=>s===null),array:e.enum.filter(s=>Array.isArray(s)),object:e.enum.filter(s=>typeof s=="object"&&s!==null&&!Array.isArray(s))};t.string=this.createTypeSchema(r.string,"string"),t.number=this.createTypeSchema(r.number,"number"),t.boolean=this.createTypeSchema(r.boolean,"boolean"),t.null=r.null.length>0?yr():!1,t.array=r.array.length>0?void 0:!1,t.object=r.object.length>0?void 0:!1}createTypeSchema(t,e){if(t.length===0)return!1;if(t.length===1)return te(t[0]);if(e==="string")return Pe(t);if(e==="number"){const[r,s,...a]=t;return be([te(r),te(s),...a.map(n=>te(n))])}return e==="boolean"?be([te(!0),te(!1)]):!1}},Ka=class{apply(t,e){const r=e;if(r.type==="string"&&r.format==="binary"&&r.contentEncoding==="binary"){let s=na();r.minLength!==void 0&&(s=s.min(r.minLength)),r.maxLength!==void 0&&(s=s.max(r.maxLength)),r.contentMediaType!==void 0&&(s=s.mime(r.contentMediaType)),t.file=s,t.string=!1}}},Wa=class{apply(t,e){const r=e;e.type===void 0&&(r.minLength!==void 0||r.maxLength!==void 0||r.pattern!==void 0)&&t.string===void 0&&(t.string=P())}},Ga=class{apply(t,e){const r=e;if(r.minLength!==void 0&&t.string!==!1){const s=t.string||P();s instanceof Jr&&(t.string=s.refine(a=>Array.from(a).length>=r.minLength,{message:`String must be at least ${r.minLength} characters long`}))}}},Ja=class{apply(t,e){const r=e;if(r.maxLength!==void 0&&t.string!==!1){const s=t.string||P();s instanceof Jr&&(t.string=s.refine(a=>Array.from(a).length<=r.maxLength,{message:`String must be at most ${r.maxLength} characters long`}))}}},Ba=class{apply(t,e){const r=e;if(r.pattern&&t.string!==!1){const s=t.string||P();if(s instanceof Jr){const a=new RegExp(r.pattern);t.string=s.regex(a)}}}},Qa=class{apply(t,e){const r=e;if(r.minimum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.min(r.minimum))}}},Za=class{apply(t,e){const r=e;if(r.maximum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.max(r.maximum))}}},Ya=class{apply(t,e){const r=e;if(r.exclusiveMinimum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(typeof r.exclusiveMinimum=="number"?t.number=s.gt(r.exclusiveMinimum):t.number=!1)}}},Xa=class{apply(t,e){const r=e;if(r.exclusiveMaximum!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(typeof r.exclusiveMaximum=="number"?t.number=s.lt(r.exclusiveMaximum):t.number=!1)}}},eo=class{apply(t,e){const r=e;if(r.multipleOf!==void 0&&t.number!==!1){const s=t.number||J();s instanceof it&&(t.number=s.refine(a=>{if(r.multipleOf===0)return!1;const n=a/r.multipleOf,i=Math.round(n),o=Math.min(Math.abs(a)*Number.EPSILON*10,Math.abs(r.multipleOf)*Number.EPSILON*10);return Math.abs(n-i)<=o/Math.abs(r.multipleOf)},{message:`Must be a multiple of ${r.multipleOf}`}))}}},to=class{apply(t,e){const r=e;e.type===void 0&&(r.minItems!==void 0||r.maxItems!==void 0||r.items!==void 0||r.prefixItems!==void 0)&&t.array===void 0&&(t.array=B(oe()))}},ro=class{apply(t,e){const r=e;r.minItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(oe())).min(r.minItems))}},so=class{apply(t,e){const r=e;r.maxItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(oe())).max(r.maxItems))}},no=class{apply(t,e){const r=e;if(t.array!==!1)if(Array.isArray(r.items))t.array=t.array||B(oe());else if(r.items&&typeof r.items!="boolean"&&!r.prefixItems){const s=de(r.items);let a=B(s);if(t.array&&t.array instanceof aa){const n=t.array._def;n.checks&&n.checks.forEach(i=>{if(i._zod&&i._zod.def){const o=i._zod.def;o.check==="min_length"&&o.minimum!==void 0?a=a.min(o.minimum):o.check==="max_length"&&o.maximum!==void 0&&(a=a.max(o.maximum))}})}t.array=a}else typeof r.items=="boolean"&&r.items===!1?r.prefixItems?t.array=t.array||B(oe()):t.array=B(oe()).max(0):typeof r.items=="boolean"&&r.items===!0?t.array=t.array||B(oe()):r.prefixItems&&(t.array=t.array||B(oe()))}},ao=class{apply(t,e){if(e.type!=="array")return;const r=e;if(!Array.isArray(r.items)||t.array===!1)return;const s=r.items.map(n=>de(n));let a;s.length===0?a=ss([]):a=ss(s),r.minItems!==void 0&&r.minItems>s.length&&(a=!1),r.maxItems!==void 0&&r.maxItems<s.length&&(a=!1),t.tuple=a,t.array=!1}},oo=class{apply(t,e){const r=e;t.object!==!1&&(r.properties||r.required||r.additionalProperties!==void 0)&&(t.object=t.object||A({}).passthrough())}},io=class{apply(t,e){const r=e;e.type===void 0&&(r.maxProperties!==void 0||r.minProperties!==void 0)&&t.object===void 0&&(t.object=A({}).passthrough())}},co=class{apply(t,e){const r=e;if(r.maxProperties!==void 0&&t.object!==!1){const s=t.object||A({}).passthrough();t.object=s.refine(a=>Object.keys(a).length<=r.maxProperties,{message:`Object must have at most ${r.maxProperties} properties`})}}},uo=class{apply(t,e){const r=e;if(r.minProperties!==void 0&&t.object!==!1){const s=t.object||A({}).passthrough();t.object=s.refine(a=>Object.keys(a).length>=r.minProperties,{message:`Object must have at least ${r.minProperties} properties`})}}};function _t(t,e){if(t===e)return!0;if(t==null||e==null)return t===e;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((r,s)=>_t(r,e[s]));if(typeof t=="object"&&typeof e=="object"){const r=Object.keys(t),s=Object.keys(e);return r.length!==s.length?!1:r.every(a=>s.includes(a)&&_t(t[a],e[a]))}return!1}function lo(){return t=>{if(!Array.isArray(t))return!0;const e=[];return t.every(r=>e.some(a=>_t(r,a))?!1:(e.push(r),!0))}}function dr(t,e){return t.safeParse(e).success}var fo=class{apply(t,e){if(!e.not)return t;const r=de(e.not);return t.refine(s=>!dr(r,s),{message:"Value must not match the 'not' schema"})}},ho=class{apply(t,e){return e.uniqueItems!==!0?t:t.refine(lo(),{message:"Array items must be unique"})}},po=class{apply(t,e){return!e.allOf||e.allOf.length===0?t:e.allOf.map(s=>de(s)).reduce((s,a)=>Nn(s,a),t)}},mo=class{apply(t,e){if(!e.anyOf||e.anyOf.length===0)return t;const r=e.anyOf.length===1?de(e.anyOf[0]):be([de(e.anyOf[0]),de(e.anyOf[1]),...e.anyOf.slice(2).map(s=>de(s))]);return Nn(t,r)}},yo=class{apply(t,e){if(!e.oneOf||e.oneOf.length===0)return t;const r=e.oneOf.map(s=>de(s));return t.refine(s=>{let a=0;for(const n of r)if(n.safeParse(s).success&&(a++,a>1))return!1;return a===1},{message:"Value must match exactly one of the oneOf schemas"})}},go=class{apply(t,e){const r=e;if(r.prefixItems&&Array.isArray(r.prefixItems)){const a=r.prefixItems.map(n=>de(n));return t.refine(n=>{if(!Array.isArray(n))return!0;for(let i=0;i<Math.min(n.length,a.length);i++)if(!dr(a[i],n[i]))return!1;if(n.length>a.length){if(typeof r.items=="boolean"&&r.items===!1)return!1;if(r.items&&typeof r.items=="object"&&!Array.isArray(r.items)){const i=de(r.items);for(let o=a.length;o<n.length;o++)if(!dr(i,n[o]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return t}},_o=class{apply(t,e){const r=e;if(!r.properties&&!r.required&&r.additionalProperties!==!1)return t;if(t instanceof oa||t instanceof ia){const s={};if(r.properties)for(const[a,n]of Object.entries(r.properties))n!==void 0&&(s[a]=de(n));if(r.required&&Array.isArray(r.required)){const a=new Set(r.required);for(const n of Object.keys(s))a.has(n)||(s[n]=s[n].optional())}else for(const a of Object.keys(s))s[a]=s[a].optional();return r.additionalProperties===!1?A(s):A(s).passthrough()}return t.refine(s=>{if(typeof s!="object"||s===null||Array.isArray(s))return!0;if(r.properties){for(const[a,n]of Object.entries(r.properties))if(n!==void 0&&Object.getOwnPropertyDescriptor(s,a)!==void 0&&!de(n).safeParse(s[a]).success)return!1}if(r.required&&Array.isArray(r.required)){for(const a of r.required)if(!(Object.getOwnPropertyDescriptor(s,a)!==void 0))return!1}if(r.additionalProperties===!1&&r.properties){const a=new Set(Object.keys(r.properties));for(const n in s)if(!a.has(n))return!1}return!0},{message:"Object constraints validation failed"})}},vo=class{apply(t,e){if(!e.enum||e.enum.length===0)return t;const r=e.enum.filter(s=>Array.isArray(s)||typeof s=="object"&&s!==null);return r.length===0?t:t.refine(s=>typeof s!="object"||s===null?!0:r.some(a=>_t(s,a)),{message:"Value must match one of the enum values"})}},bo=class{apply(t,e){if(e.const===void 0)return t;const r=e.const;return typeof r!="object"||r===null?t:t.refine(s=>_t(s,r),{message:"Value must equal the const value"})}},wo=class{apply(t,e){return e.description&&(t=t.describe(e.description)),t}},So=class{apply(t,e){var r;const s=e;return!((r=s.required)!=null&&r.includes("__proto__"))||e.type!==void 0?t:oe().refine(a=>this.validateRequired(a,s.required),{message:"Missing required properties"})}validateRequired(t,e){return typeof t!="object"||t===null||Array.isArray(t)?!0:e.every(r=>Object.prototype.hasOwnProperty.call(t,r))}},$o=class{apply(t,e){var r;const s=e;if(s.contains===void 0)return t;const a=de(s.contains),n=(r=s.minContains)!=null?r:1,i=s.maxContains;return t.refine(o=>{if(!Array.isArray(o))return!0;let u=0;for(const m of o)dr(a,m)&&u++;return!(u<n||i!==void 0&&u>i)},{message:"Array must contain required items matching the schema"})}},Eo=class{apply(t,e){const{default:r}=e;return r===void 0||!t.safeParse(r).success?t:t.default(r)}},To=[new xa,new za,new Fa,new Ka,new Wa,new to,new io,new Ga,new Ja,new Ba,new Qa,new Za,new Ya,new Xa,new eo,new ao,new ro,new so,new no,new co,new uo,new oo],ko=[new So,new vo,new bo,new po,new mo,new yo,new go,new _o,new $o,new fo,new ho,new Eo,new wo];function de(t){if(typeof t=="boolean")return t?oe():rs();const e={};for(const a of To)a.apply(e,t);const r=[];if(e.string!==!1&&r.push(e.string||P()),e.number!==!1&&r.push(e.number||J()),e.boolean!==!1&&r.push(e.boolean||fe()),e.null!==!1&&r.push(e.null||yr()),e.array!==!1&&r.push(e.array||B(oe())),e.tuple!==!1&&e.tuple!==void 0&&r.push(e.tuple),e.object!==!1)if(e.object)r.push(e.object);else{const a=sa(n=>typeof n=="object"&&n!==null&&!Array.isArray(n),"Must be an object, not an array");r.push(a)}e.file!==!1&&e.file!==void 0&&r.push(e.file);let s;r.length===0?s=rs():r.length===1?s=r[0]:Object.keys(t).some(n=>n!=="$schema"&&n!=="title"&&n!=="description")?s=be(r):s=oe();for(const a of ko)s=a.apply(s,t);return s}function gr(t){return!!t._zod}function He(t,e){return gr(t)?ca(t,e):t.safeParse(e)}function An(t){if(!t)return;let e;if(gr(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Po(t){if(gr(t)){const n=t._zod?.def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.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 xe(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function as(t){const r=An(t)?.method;if(!r)throw new Error("Schema is missing a method literal");const s=Po(r);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function os(t,e){const r=He(t,e);if(!r.success)throw r.error;return r.data}const Io=6e4;class Oo{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(da,r=>{this._oncancel(r)}),this.setNotificationHandler(fa,r=>{this._onprogress(r)}),this.setRequestHandler(ha,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(pa,async(r,s)=>{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new G(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...a}}),this.setRequestHandler(ma,async(r,s)=>{const a=async()=>{const n=r.params.taskId;if(this._taskMessageQueue){let o;for(;o=await this._taskMessageQueue.dequeue(n,s.sessionId);){if(o.type==="response"||o.type==="error"){const u=o.message,m=u.id,h=this._requestResolvers.get(m);if(h)if(this._requestResolvers.delete(m),o.type==="response")h(u);else{const $=u,g=new G($.error.code,$.error.message,$.error.data);h(g)}else{const $=o.type==="response"?"Response":"Error";this._onerror(new Error(`${$} handler missing for request ${m}`))}continue}await this._transport?.send(o.message,{relatedRequestId:s.requestId})}}const i=await this._taskStore.getTask(n,s.sessionId);if(!i)throw new G(Z.InvalidParams,`Task not found: ${n}`);if(!xe(i.status))return await this._waitForTaskUpdate(n,s.signal),await a();if(xe(i.status)){const o=await this._taskStore.getTaskResult(n,s.sessionId);return this._clearTaskQueue(n),{...o,_meta:{...o._meta,[Ye]:{taskId:n}}}}return await a()};return await a()}),this.setRequestHandler(ya,async(r,s)=>{try{const{tasks:a,nextCursor:n}=await this._taskStore.listTasks(r.params?.cursor,s.sessionId);return{tasks:a,nextCursor:n,_meta:{}}}catch(a){throw new G(Z.InvalidParams,`Failed to list tasks: ${a instanceof Error?a.message:String(a)}`)}}),this.setRequestHandler(ga,async(r,s)=>{try{const a=await this._taskStore.getTask(r.params.taskId,s.sessionId);if(!a)throw new G(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(xe(a.status))throw new G(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 G(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...n}}catch(a){throw a instanceof G?a:new G(Z.InvalidRequest,`Failed to cancel task: ${a instanceof Error?a.message:String(a)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.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),G.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){this._transport=e;const r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=n=>{s?.(n),this._onerror(n)};const a=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{a?.(n,i),ft(n)||_a(n)?this._onresponse(n):Lr(n)?this._onrequest(n,i):va(n)?this._onnotification(n):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();const r=G.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(r)}_onerror(e){this.onerror?.(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){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,a=this._transport,n=e.params?._meta?.[Ye]?.taskId;if(s===void 0){const h={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};n&&this._taskMessageQueue?this._enqueueTaskMessage(n,{type:"error",message:h,timestamp:Date.now()},a?.sessionId).catch($=>this._onerror(new Error(`Failed to enqueue error response: ${$}`))):a?.send(h).catch($=>this._onerror(new Error(`Failed to send an error response: ${$}`)));return}const i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);const o=ba(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,a?.sessionId):void 0,m={signal:i.signal,sessionId:a?.sessionId,_meta:e.params?._meta,sendNotification:async h=>{const $={relatedRequestId:e.id};n&&($.relatedTask={taskId:n}),await this.notification(h,$)},sendRequest:async(h,$,g)=>{const y={...g,relatedRequestId:e.id};n&&!y.relatedTask&&(y.relatedTask={taskId:n});const v=y.relatedTask?.taskId??n;return v&&u&&await u.updateTaskStatus(v,"input_required"),await this.request(h,$,y)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:n,taskStore:u,taskRequestedTtl:o?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,m)).then(async h=>{if(i.signal.aborted)return;const $={result:h,jsonrpc:"2.0",id:e.id};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"response",message:$,timestamp:Date.now()},a?.sessionId):await a?.send($)},async h=>{if(i.signal.aborted)return;const $={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(h.code)?h.code:Z.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"error",message:$,timestamp:Date.now()},a?.sessionId):await a?.send($)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).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 i=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(u){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(u);return}n(s)}_onresponse(e){const r=Number(e.id),s=this._requestResolvers.get(r);if(s){if(this._requestResolvers.delete(r),ft(e))s(e);else{const i=new G(e.error.code,e.error.message,e.error.data);s(i)}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(ft(e)&&e.result&&typeof e.result=="object"){const i=e.result;if(i.task&&typeof i.task=="object"){const o=i.task;typeof o.taskId=="string"&&(n=!0,this._taskProgressTokens.set(o.taskId,r))}}if(n||this._progressHandlers.delete(r),ft(e))a(e);else{const i=G.fromError(e.error.code,e.error.message,e.error.data);a(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,s){const{task:a}=s??{};if(!a){try{yield{type:"result",result:await this.request(e,r,s)}}catch(i){yield{type:"error",error:i instanceof G?i:new G(Z.InternalError,String(i))}}return}let n;try{const i=await this.request(e,Ur,s);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new G(Z.InternalError,"Task creation did not return a task");for(;;){const o=await this.getTask({taskId:n},s);if(yield{type:"taskStatus",task:o},xe(o.status)){o.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)}:o.status==="failed"?yield{type:"error",error:new G(Z.InternalError,`Task ${n} failed`)}:o.status==="cancelled"&&(yield{type:"error",error:new G(Z.InternalError,`Task ${n} was cancelled`)});return}if(o.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},r,s)};return}const u=o.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(m=>setTimeout(m,u)),s?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof G?i:new G(Z.InternalError,String(i))}}}request(e,r,s){const{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i,task:o,relatedTask:u}=s??{};return new Promise((m,h)=>{const $=c=>{h(c)};if(!this._transport){$(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(c){$(c);return}s?.signal?.throwIfAborted();const g=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:g};s?.onprogress&&(this._progressHandlers.set(g,s.onprogress),y.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}}),o&&(y.params={...y.params,task:o}),u&&(y.params={...y.params,_meta:{...y.params?._meta||{},[Ye]:u}});const v=c=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(c)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));const d=c instanceof G?c:new G(Z.RequestTimeout,String(c));h(d)};this._responseHandlers.set(g,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return h(c);try{const d=He(r,c.result);d.success?m(d.data):h(d.error)}catch(d){h(d)}}}),s?.signal?.addEventListener("abort",()=>{v(s?.signal?.reason)});const w=s?.timeout??Io,l=()=>v(G.fromError(Z.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,s?.maxTotalTimeout,l,s?.resetTimeoutOnProgress??!1);const p=u?.taskId;if(p){const c=d=>{const S=this._responseHandlers.get(g);S?S(d):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,c),this._enqueueTaskMessage(p,{type:"request",message:y,timestamp:Date.now()}).catch(d=>{this._cleanupTimeout(g),h(d)})}else this._transport.send(y,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:i}).catch(c=>{this._cleanupTimeout(g),h(c)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},wa,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},Sa,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},$a,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=r?.relatedTask?.taskId;if(s){const o={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ye]:r.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:o,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let o={...e,jsonrpc:"2.0"};r?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Ye]:r.relatedTask}}}),this._transport?.send(o,r).catch(u=>this._onerror(u))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Ye]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){const s=as(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>{const i=os(e,a);return Promise.resolve(r(i,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=as(e);this._notificationHandlers.set(s,a=>{const n=os(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){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const a=this._options?.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"&&Lr(a.message)){const n=a.message.id,i=this._requestResolvers.get(n);i?(i(new G(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){let s=this._options?.defaultTaskPollInterval??1e3;try{const a=await this._taskStore?.getTask(e);a?.pollInterval&&(s=a.pollInterval)}catch{}return new Promise((a,n)=>{if(r.aborted){n(new G(Z.InvalidRequest,"Request cancelled"));return}const i=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(i),n(new G(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 G(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(a,n,i)=>{await s.storeTaskResult(a,n,i,r);const o=await s.getTask(a,r);if(o){const u=ns.parse({method:"notifications/tasks/status",params:o});await this.notification(u),xe(o.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>s.getTaskResult(a,r),updateTaskStatus:async(a,n,i)=>{const o=await s.getTask(a,r);if(!o)throw new G(Z.InvalidParams,`Task "${a}" not found - it may have been cleaned up`);if(xe(o.status))throw new G(Z.InvalidParams,`Cannot update task "${a}" from terminal status "${o.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(a,n,i,r);const u=await s.getTask(a,r);if(u){const m=ns.parse({method:"notifications/tasks/status",params:u});await this.notification(m),xe(u.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>s.listTasks(a,r)}}}function is(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ro(t,e){const r={...t};for(const s in e){const a=s,n=e[a];if(n===void 0)continue;const i=r[a];is(i)&&is(n)?r[a]={...i,...n}:r[a]=n}return r}var wt={exports:{}},Tr={},Me={},ze={},kr={},Pr={},Ir={},cs;function fr(){return cs||(cs=1,(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(c){if(super(),!t.IDENTIFIER.test(c))throw new Error("CodeGen: name must be a valid identifier");this.str=c}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class s extends e{constructor(c){super(),this._items=typeof c=="string"?[c]:c}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const c=this._items[0];return c===""||c==='""'}get str(){var c;return(c=this._str)!==null&&c!==void 0?c:this._str=this._items.reduce((d,S)=>`${d}${S}`,"")}get names(){var c;return(c=this._names)!==null&&c!==void 0?c:this._names=this._items.reduce((d,S)=>(S instanceof r&&(d[S.str]=(d[S.str]||0)+1),d),{})}}t._Code=s,t.nil=new s("");function a(p,...c){const d=[p[0]];let S=0;for(;S<c.length;)o(d,c[S]),d.push(p[++S]);return new s(d)}t._=a;const n=new s("+");function i(p,...c){const d=[y(p[0])];let S=0;for(;S<c.length;)d.push(n),o(d,c[S]),d.push(n,y(p[++S]));return u(d),new s(d)}t.str=i;function o(p,c){c instanceof s?p.push(...c._items):c instanceof r?p.push(c):p.push($(c))}t.addCodeArg=o;function u(p){let c=1;for(;c<p.length-1;){if(p[c]===n){const d=m(p[c-1],p[c+1]);if(d!==void 0){p.splice(c-1,3,d);continue}p[c++]="+"}c++}}function m(p,c){if(c==='""')return p;if(p==='""')return c;if(typeof p=="string")return c instanceof r||p[p.length-1]!=='"'?void 0:typeof c!="string"?`${p.slice(0,-1)}${c}"`:c[0]==='"'?p.slice(0,-1)+c.slice(1):void 0;if(typeof c=="string"&&c[0]==='"'&&!(p instanceof r))return`"${p}${c.slice(1)}`}function h(p,c){return c.emptyStr()?p:p.emptyStr()?c:i`${p}${c}`}t.strConcat=h;function $(p){return typeof p=="number"||typeof p=="boolean"||p===null?p:y(Array.isArray(p)?p.join(","):p)}function g(p){return new s(y(p))}t.stringify=g;function y(p){return JSON.stringify(p).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=y;function v(p){return typeof p=="string"&&t.IDENTIFIER.test(p)?new s(`.${p}`):a`[${p}]`}t.getProperty=v;function w(p){if(typeof p=="string"&&t.IDENTIFIER.test(p))return new s(`${p}`);throw new Error(`CodeGen: invalid export name: ${p}, use explicit $id name mapping`)}t.getEsmExportName=w;function l(p){return new s(p.toString())}t.regexpCode=l})(Ir)),Ir}var Or={},us;function ls(){return us||(us=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=fr();class r extends Error{constructor(m){super(`CodeGen: "code" for ${m} not defined`),this.value=m.value}}var s;(function(u){u[u.Started=0]="Started",u[u.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:m,parent:h}={}){this._names={},this._prefixes=m,this._parent=h}toName(m){return m instanceof e.Name?m:this.name(m)}name(m){return new e.Name(this._newName(m))}_newName(m){const h=this._names[m]||this._nameGroup(m);return`${m}${h.index++}`}_nameGroup(m){var h,$;if(!(($=(h=this._parent)===null||h===void 0?void 0:h._prefixes)===null||$===void 0)&&$.has(m)||this._prefixes&&!this._prefixes.has(m))throw new Error(`CodeGen: prefix "${m}" is not allowed in this scope`);return this._names[m]={prefix:m,index:0}}}t.Scope=a;class n extends e.Name{constructor(m,h){super(h),this.prefix=m}setValue(m,{property:h,itemIndex:$}){this.value=m,this.scopePath=(0,e._)`.${new e.Name(h)}[${$}]`}}t.ValueScopeName=n;const i=(0,e._)`\n`;class o extends a{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?i:e.nil}}get(){return this._scope}name(m){return new n(m,this._newName(m))}value(m,h){var $;if(h.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const g=this.toName(m),{prefix:y}=g,v=($=h.key)!==null&&$!==void 0?$:h.ref;let w=this._values[y];if(w){const c=w.get(v);if(c)return c}else w=this._values[y]=new Map;w.set(v,g);const l=this._scope[y]||(this._scope[y]=[]),p=l.length;return l[p]=h.ref,g.setValue(h,{property:y,itemIndex:p}),g}getValue(m,h){const $=this._values[m];if($)return $.get(h)}scopeRefs(m,h=this._values){return this._reduceValues(h,$=>{if($.scopePath===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return(0,e._)`${m}${$.scopePath}`})}scopeCode(m=this._values,h,$){return this._reduceValues(m,g=>{if(g.value===void 0)throw new Error(`CodeGen: name "${g}" has no value`);return g.value.code},h,$)}_reduceValues(m,h,$={},g){let y=e.nil;for(const v in m){const w=m[v];if(!w)continue;const l=$[v]=$[v]||new Map;w.forEach(p=>{if(l.has(p))return;l.set(p,s.Started);let c=h(p);if(c){const d=this.opts.es5?t.varKinds.var:t.varKinds.const;y=(0,e._)`${y}${d} ${p} = ${c};${this.opts._n}`}else if(c=g?.(p))y=(0,e._)`${y}${c}${this.opts._n}`;else throw new r(p);l.set(p,s.Completed)})}return y}}t.ValueScope=o})(Or)),Or}var ds;function Y(){return ds||(ds=1,(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=fr(),r=ls();var s=fr();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=ls();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(_,T){return this}}class i extends n{constructor(_,T,N){super(),this.varKind=_,this.name=T,this.rhs=N}render({es5:_,_n:T}){const N=_?r.varKinds.var:this.varKind,z=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${z};`+T}optimizeNames(_,T){if(_[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,_,T)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(_,T,N){super(),this.lhs=_,this.rhs=T,this.sideEffects=N}render({_n:_}){return`${this.lhs} = ${this.rhs};`+_}optimizeNames(_,T){if(!(this.lhs instanceof e.Name&&!_[this.lhs.str]&&!this.sideEffects))return this.rhs=x(this.rhs,_,T),this}get names(){const _=this.lhs instanceof e.Name?{}:{...this.lhs.names};return F(_,this.rhs)}}class u extends o{constructor(_,T,N,z){super(_,N,z),this.op=T}render({_n:_}){return`${this.lhs} ${this.op}= ${this.rhs};`+_}}class m extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`${this.label}:`+_}}class h extends n{constructor(_){super(),this.label=_,this.names={}}render({_n:_}){return`break${this.label?` ${this.label}`:""};`+_}}class $ extends n{constructor(_){super(),this.error=_}render({_n:_}){return`throw ${this.error};`+_}get names(){return this.error.names}}class g extends n{constructor(_){super(),this.code=_}render({_n:_}){return`${this.code};`+_}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(_,T){return this.code=x(this.code,_,T),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class y extends n{constructor(_=[]){super(),this.nodes=_}render(_){return this.nodes.reduce((T,N)=>T+N.render(_),"")}optimizeNodes(){const{nodes:_}=this;let T=_.length;for(;T--;){const N=_[T].optimizeNodes();Array.isArray(N)?_.splice(T,1,...N):N?_[T]=N:_.splice(T,1)}return _.length>0?this:void 0}optimizeNames(_,T){const{nodes:N}=this;let z=N.length;for(;z--;){const W=N[z];W.optimizeNames(_,T)||(ae(_,W.names),N.splice(z,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((_,T)=>H(_,T.names),{})}}class v extends y{render(_){return"{"+_._n+super.render(_)+"}"+_._n}}class w extends y{}class l extends v{}l.kind="else";class p extends v{constructor(_,T){super(T),this.condition=_}render(_){let T=`if(${this.condition})`+super.render(_);return this.else&&(T+="else "+this.else.render(_)),T}optimizeNodes(){super.optimizeNodes();const _=this.condition;if(_===!0)return this.nodes;let T=this.else;if(T){const N=T.optimizeNodes();T=this.else=Array.isArray(N)?new l(N):N}if(T)return _===!1?T instanceof p?T:T.nodes:this.nodes.length?this:new p(ge(_),T instanceof p?[T]:T.nodes);if(!(_===!1||!this.nodes.length))return this}optimizeNames(_,T){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(_,T),!!(super.optimizeNames(_,T)||this.else))return this.condition=x(this.condition,_,T),this}get names(){const _=super.names;return F(_,this.condition),this.else&&H(_,this.else.names),_}}p.kind="if";class c extends v{}c.kind="for";class d extends c{constructor(_){super(),this.iteration=_}render(_){return`for(${this.iteration})`+super.render(_)}optimizeNames(_,T){if(super.optimizeNames(_,T))return this.iteration=x(this.iteration,_,T),this}get names(){return H(super.names,this.iteration.names)}}class S extends c{constructor(_,T,N,z){super(),this.varKind=_,this.name=T,this.from=N,this.to=z}render(_){const T=_.es5?r.varKinds.var:this.varKind,{name:N,from:z,to:W}=this;return`for(${T} ${N}=${z}; ${N}<${W}; ${N}++)`+super.render(_)}get names(){const _=F(super.names,this.from);return F(_,this.to)}}class f extends c{constructor(_,T,N,z){super(),this.loop=_,this.varKind=T,this.name=N,this.iterable=z}render(_){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(_)}optimizeNames(_,T){if(super.optimizeNames(_,T))return this.iterable=x(this.iterable,_,T),this}get names(){return H(super.names,this.iterable.names)}}class b extends v{constructor(_,T,N){super(),this.name=_,this.args=T,this.async=N}render(_){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(_)}}b.kind="func";class E extends y{render(_){return"return "+super.render(_)}}E.kind="return";class C extends v{render(_){let T="try"+super.render(_);return this.catch&&(T+=this.catch.render(_)),this.finally&&(T+=this.finally.render(_)),T}optimizeNodes(){var _,T;return super.optimizeNodes(),(_=this.catch)===null||_===void 0||_.optimizeNodes(),(T=this.finally)===null||T===void 0||T.optimizeNodes(),this}optimizeNames(_,T){var N,z;return super.optimizeNames(_,T),(N=this.catch)===null||N===void 0||N.optimizeNames(_,T),(z=this.finally)===null||z===void 0||z.optimizeNames(_,T),this}get names(){const _=super.names;return this.catch&&H(_,this.catch.names),this.finally&&H(_,this.finally.names),_}}class D extends v{constructor(_){super(),this.error=_}render(_){return`catch(${this.error})`+super.render(_)}}D.kind="catch";class V extends v{render(_){return"finally"+super.render(_)}}V.kind="finally";class q{constructor(_,T={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...T,_n:T.lines?`
|
|
2
|
+
`:""},this._extScope=_,this._scope=new r.Scope({parent:_}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(_){return this._scope.name(_)}scopeName(_){return this._extScope.name(_)}scopeValue(_,T){const N=this._extScope.value(_,T);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(_,T){return this._extScope.getValue(_,T)}scopeRefs(_){return this._extScope.scopeRefs(_,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(_,T,N,z){const W=this._scope.toName(T);return N!==void 0&&z&&(this._constants[W.str]=N),this._leafNode(new i(_,W,N)),W}const(_,T,N){return this._def(r.varKinds.const,_,T,N)}let(_,T,N){return this._def(r.varKinds.let,_,T,N)}var(_,T,N){return this._def(r.varKinds.var,_,T,N)}assign(_,T,N){return this._leafNode(new o(_,T,N))}add(_,T){return this._leafNode(new u(_,t.operators.ADD,T))}code(_){return typeof _=="function"?_():_!==e.nil&&this._leafNode(new g(_)),this}object(..._){const T=["{"];for(const[N,z]of _)T.length>1&&T.push(","),T.push(N),(N!==z||this.opts.es5)&&(T.push(":"),(0,e.addCodeArg)(T,z));return T.push("}"),new e._Code(T)}if(_,T,N){if(this._blockNode(new p(_)),T&&N)this.code(T).else().code(N).endIf();else if(T)this.code(T).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(_){return this._elseNode(new p(_))}else(){return this._elseNode(new l)}endIf(){return this._endBlockNode(p,l)}_for(_,T){return this._blockNode(_),T&&this.code(T).endFor(),this}for(_,T){return this._for(new d(_),T)}forRange(_,T,N,z,W=this.opts.es5?r.varKinds.var:r.varKinds.let){const ne=this._scope.toName(_);return this._for(new S(W,ne,T,N),()=>z(ne))}forOf(_,T,N,z=r.varKinds.const){const W=this._scope.toName(_);if(this.opts.es5){const ne=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${ne}.length`,re=>{this.var(W,(0,e._)`${ne}[${re}]`),N(W)})}return this._for(new f("of",z,W,T),()=>N(W))}forIn(_,T,N,z=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(_,(0,e._)`Object.keys(${T})`,N);const W=this._scope.toName(_);return this._for(new f("in",z,W,T),()=>N(W))}endFor(){return this._endBlockNode(c)}label(_){return this._leafNode(new m(_))}break(_){return this._leafNode(new h(_))}return(_){const T=new E;if(this._blockNode(T),this.code(_),T.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(_,T,N){if(!T&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const z=new C;if(this._blockNode(z),this.code(_),T){const W=this.name("e");this._currNode=z.catch=new D(W),T(W)}return N&&(this._currNode=z.finally=new V,this.code(N)),this._endBlockNode(D,V)}throw(_){return this._leafNode(new $(_))}block(_,T){return this._blockStarts.push(this._nodes.length),_&&this.code(_).endBlock(T),this}endBlock(_){const T=this._blockStarts.pop();if(T===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-T;if(N<0||_!==void 0&&N!==_)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${_} expected`);return this._nodes.length=T,this}func(_,T=e.nil,N,z){return this._blockNode(new b(_,T,N)),z&&this.code(z).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(_=1){for(;_-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(_){return this._currNode.nodes.push(_),this}_blockNode(_){this._currNode.nodes.push(_),this._nodes.push(_)}_endBlockNode(_,T){const N=this._currNode;if(N instanceof _||T&&N instanceof T)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${T?`${_.kind}/${T.kind}`:_.kind}"`)}_elseNode(_){const T=this._currNode;if(!(T instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=T.else=_,this}get _root(){return this._nodes[0]}get _currNode(){const _=this._nodes;return _[_.length-1]}set _currNode(_){const T=this._nodes;T[T.length-1]=_}}t.CodeGen=q;function H(R,_){for(const T in _)R[T]=(R[T]||0)+(_[T]||0);return R}function F(R,_){return _ instanceof e._CodeOrName?H(R,_.names):R}function x(R,_,T){if(R instanceof e.Name)return N(R);if(!z(R))return R;return new e._Code(R._items.reduce((W,ne)=>(ne instanceof e.Name&&(ne=N(ne)),ne instanceof e._Code?W.push(...ne._items):W.push(ne),W),[]));function N(W){const ne=T[W.str];return ne===void 0||_[W.str]!==1?W:(delete _[W.str],ne)}function z(W){return W instanceof e._Code&&W._items.some(ne=>ne instanceof e.Name&&_[ne.str]===1&&T[ne.str]!==void 0)}}function ae(R,_){for(const T in _)R[T]=(R[T]||0)-(_[T]||0)}function ge(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:(0,e._)`!${j(R)}`}t.not=ge;const _e=I(t.operators.AND);function ce(...R){return R.reduce(_e)}t.and=ce;const Ie=I(t.operators.OR);function L(...R){return R.reduce(Ie)}t.or=L;function I(R){return(_,T)=>_===e.nil?T:T===e.nil?_:(0,e._)`${j(_)} ${R} ${j(T)}`}function j(R){return R instanceof e.Name?R:(0,e._)`(${R})`}})(Pr)),Pr}var Q={},fs;function se(){if(fs)return Q;fs=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;const t=Y(),e=fr();function r(f){const b={};for(const E of f)b[E]=!0;return b}Q.toHash=r;function s(f,b){return typeof b=="boolean"?b:Object.keys(b).length===0?!0:(a(f,b),!n(b,f.self.RULES.all))}Q.alwaysValidSchema=s;function a(f,b=f.schema){const{opts:E,self:C}=f;if(!E.strictSchema||typeof b=="boolean")return;const D=C.RULES.keywords;for(const V in b)D[V]||S(f,`unknown keyword: "${V}"`)}Q.checkUnknownRules=a;function n(f,b){if(typeof f=="boolean")return!f;for(const E in f)if(b[E])return!0;return!1}Q.schemaHasRules=n;function i(f,b){if(typeof f=="boolean")return!f;for(const E in f)if(E!=="$ref"&&b.all[E])return!0;return!1}Q.schemaHasRulesButRef=i;function o({topSchemaRef:f,schemaPath:b},E,C,D){if(!D){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${f}${b}${(0,t.getProperty)(C)}`}Q.schemaRefOrVal=o;function u(f){return $(decodeURIComponent(f))}Q.unescapeFragment=u;function m(f){return encodeURIComponent(h(f))}Q.escapeFragment=m;function h(f){return typeof f=="number"?`${f}`:f.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=h;function $(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=$;function g(f,b){if(Array.isArray(f))for(const E of f)b(E);else b(f)}Q.eachItem=g;function y({mergeNames:f,mergeToName:b,mergeValues:E,resultToName:C}){return(D,V,q,H)=>{const F=q===void 0?V:q instanceof t.Name?(V instanceof t.Name?f(D,V,q):b(D,V,q),q):V instanceof t.Name?(b(D,q,V),V):E(V,q);return H===t.Name&&!(F instanceof t.Name)?C(D,F):F}}Q.mergeEvaluated={props:y({mergeNames:(f,b,E)=>f.if((0,t._)`${E} !== true && ${b} !== undefined`,()=>{f.if((0,t._)`${b} === true`,()=>f.assign(E,!0),()=>f.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${b})`))}),mergeToName:(f,b,E)=>f.if((0,t._)`${E} !== true`,()=>{b===!0?f.assign(E,!0):(f.assign(E,(0,t._)`${E} || {}`),w(f,E,b))}),mergeValues:(f,b)=>f===!0?!0:{...f,...b},resultToName:v}),items:y({mergeNames:(f,b,E)=>f.if((0,t._)`${E} !== true && ${b} !== undefined`,()=>f.assign(E,(0,t._)`${b} === true ? true : ${E} > ${b} ? ${E} : ${b}`)),mergeToName:(f,b,E)=>f.if((0,t._)`${E} !== true`,()=>f.assign(E,b===!0?!0:(0,t._)`${E} > ${b} ? ${E} : ${b}`)),mergeValues:(f,b)=>f===!0?!0:Math.max(f,b),resultToName:(f,b)=>f.var("items",b)})};function v(f,b){if(b===!0)return f.var("props",!0);const E=f.var("props",(0,t._)`{}`);return b!==void 0&&w(f,E,b),E}Q.evaluatedPropsToName=v;function w(f,b,E){Object.keys(E).forEach(C=>f.assign((0,t._)`${b}${(0,t.getProperty)(C)}`,!0))}Q.setEvaluated=w;const l={};function p(f,b){return f.scopeValue("func",{ref:b,code:l[b.code]||(l[b.code]=new e._Code(b.code))})}Q.useFunc=p;var c;(function(f){f[f.Num=0]="Num",f[f.Str=1]="Str"})(c||(Q.Type=c={}));function d(f,b,E){if(f instanceof t.Name){const C=b===c.Num;return E?C?(0,t._)`"[" + ${f} + "]"`:(0,t._)`"['" + ${f} + "']"`:C?(0,t._)`"/" + ${f}`:(0,t._)`"/" + ${f}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(f).toString():"/"+h(f)}Q.getErrorPath=d;function S(f,b,E=f.opts.strictSchema){if(E){if(b=`strict mode: ${b}`,E===!0)throw new Error(b);f.self.logger.warn(b)}}return Q.checkStrictMode=S,Q}var St={},hs;function Fe(){if(hs)return St;hs=1,Object.defineProperty(St,"__esModule",{value:!0});const t=Y(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return St.default=e,St}var ps;function _r(){return ps||(ps=1,(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=Y(),r=se(),s=Fe();t.keywordError={message:({keyword:l})=>(0,e.str)`must pass "${l}" keyword validation`},t.keyword$DataError={message:({keyword:l,schemaType:p})=>p?(0,e.str)`"${l}" keyword must be ${p} ($data)`:(0,e.str)`"${l}" keyword is invalid ($data)`};function a(l,p=t.keywordError,c,d){const{it:S}=l,{gen:f,compositeRule:b,allErrors:E}=S,C=$(l,p,c);d??(b||E)?u(f,C):m(S,(0,e._)`[${C}]`)}t.reportError=a;function n(l,p=t.keywordError,c){const{it:d}=l,{gen:S,compositeRule:f,allErrors:b}=d,E=$(l,p,c);u(S,E),f||b||m(d,s.default.vErrors)}t.reportExtraError=n;function i(l,p){l.assign(s.default.errors,p),l.if((0,e._)`${s.default.vErrors} !== null`,()=>l.if(p,()=>l.assign((0,e._)`${s.default.vErrors}.length`,p),()=>l.assign(s.default.vErrors,null)))}t.resetErrorsCount=i;function o({gen:l,keyword:p,schemaValue:c,data:d,errsCount:S,it:f}){if(S===void 0)throw new Error("ajv implementation error");const b=l.name("err");l.forRange("i",S,s.default.errors,E=>{l.const(b,(0,e._)`${s.default.vErrors}[${E}]`),l.if((0,e._)`${b}.instancePath === undefined`,()=>l.assign((0,e._)`${b}.instancePath`,(0,e.strConcat)(s.default.instancePath,f.errorPath))),l.assign((0,e._)`${b}.schemaPath`,(0,e.str)`${f.errSchemaPath}/${p}`),f.opts.verbose&&(l.assign((0,e._)`${b}.schema`,c),l.assign((0,e._)`${b}.data`,d))})}t.extendErrors=o;function u(l,p){const c=l.const("err",p);l.if((0,e._)`${s.default.vErrors} === null`,()=>l.assign(s.default.vErrors,(0,e._)`[${c}]`),(0,e._)`${s.default.vErrors}.push(${c})`),l.code((0,e._)`${s.default.errors}++`)}function m(l,p){const{gen:c,validateName:d,schemaEnv:S}=l;S.$async?c.throw((0,e._)`new ${l.ValidationError}(${p})`):(c.assign((0,e._)`${d}.errors`,p),c.return(!1))}const h={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 $(l,p,c){const{createErrors:d}=l.it;return d===!1?(0,e._)`{}`:g(l,p,c)}function g(l,p,c={}){const{gen:d,it:S}=l,f=[y(S,c),v(l,c)];return w(l,p,f),d.object(...f)}function y({errorPath:l},{instancePath:p}){const c=p?(0,e.str)`${l}${(0,r.getErrorPath)(p,r.Type.Str)}`:l;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,c)]}function v({keyword:l,it:{errSchemaPath:p}},{schemaPath:c,parentSchema:d}){let S=d?p:(0,e.str)`${p}/${l}`;return c&&(S=(0,e.str)`${S}${(0,r.getErrorPath)(c,r.Type.Str)}`),[h.schemaPath,S]}function w(l,{params:p,message:c},d){const{keyword:S,data:f,schemaValue:b,it:E}=l,{opts:C,propertyName:D,topSchemaRef:V,schemaPath:q}=E;d.push([h.keyword,S],[h.params,typeof p=="function"?p(l):p||(0,e._)`{}`]),C.messages&&d.push([h.message,typeof c=="function"?c(l):c]),C.verbose&&d.push([h.schema,b],[h.parentSchema,(0,e._)`${V}${q}`],[s.default.data,f]),D&&d.push([h.propertyName,D])}})(kr)),kr}var ms;function Co(){if(ms)return ze;ms=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.boolOrEmptySchema=ze.topBoolOrEmptySchema=void 0;const t=_r(),e=Y(),r=Fe(),s={message:"boolean schema is false"};function a(o){const{gen:u,schema:m,validateName:h}=o;m===!1?i(o,!1):typeof m=="object"&&m.$async===!0?u.return(r.default.data):(u.assign((0,e._)`${h}.errors`,null),u.return(!0))}ze.topBoolOrEmptySchema=a;function n(o,u){const{gen:m,schema:h}=o;h===!1?(m.var(u,!1),i(o)):m.var(u,!0)}ze.boolOrEmptySchema=n;function i(o,u){const{gen:m,data:h}=o,$={gen:m,keyword:"false schema",data:h,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)($,s,void 0,u)}return ze}var me={},Ke={},ys;function Dn(){if(ys)return Ke;ys=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.getRules=Ke.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function r(a){return typeof a=="string"&&e.has(a)}Ke.isJSONType=r;function s(){const a={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...a,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},a.number,a.string,a.array,a.object],post:{rules:[]},all:{},keywords:{}}}return Ke.getRules=s,Ke}var je={},gs;function Ln(){if(gs)return je;gs=1,Object.defineProperty(je,"__esModule",{value:!0}),je.shouldUseRule=je.shouldUseGroup=je.schemaHasRulesForType=void 0;function t({schema:s,self:a},n){const i=a.RULES.types[n];return i&&i!==!0&&e(s,i)}je.schemaHasRulesForType=t;function e(s,a){return a.rules.some(n=>r(s,n))}je.shouldUseGroup=e;function r(s,a){var n;return s[a.keyword]!==void 0||((n=a.definition.implements)===null||n===void 0?void 0:n.some(i=>s[i]!==void 0))}return je.shouldUseRule=r,je}var _s;function hr(){if(_s)return me;_s=1,Object.defineProperty(me,"__esModule",{value:!0}),me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;const t=Dn(),e=Ln(),r=_r(),s=Y(),a=se();var n;(function(c){c[c.Correct=0]="Correct",c[c.Wrong=1]="Wrong"})(n||(me.DataType=n={}));function i(c){const d=o(c.type);if(d.includes("null")){if(c.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!d.length&&c.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');c.nullable===!0&&d.push("null")}return d}me.getSchemaTypes=i;function o(c){const d=Array.isArray(c)?c:c?[c]:[];if(d.every(t.isJSONType))return d;throw new Error("type must be JSONType or JSONType[]: "+d.join(","))}me.getJSONTypes=o;function u(c,d){const{gen:S,data:f,opts:b}=c,E=h(d,b.coerceTypes),C=d.length>0&&!(E.length===0&&d.length===1&&(0,e.schemaHasRulesForType)(c,d[0]));if(C){const D=v(d,f,b.strictNumbers,n.Wrong);S.if(D,()=>{E.length?$(c,d,E):l(c)})}return C}me.coerceAndCheckDataType=u;const m=new Set(["string","number","integer","boolean","null"]);function h(c,d){return d?c.filter(S=>m.has(S)||d==="array"&&S==="array"):[]}function $(c,d,S){const{gen:f,data:b,opts:E}=c,C=f.let("dataType",(0,s._)`typeof ${b}`),D=f.let("coerced",(0,s._)`undefined`);E.coerceTypes==="array"&&f.if((0,s._)`${C} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>f.assign(b,(0,s._)`${b}[0]`).assign(C,(0,s._)`typeof ${b}`).if(v(d,b,E.strictNumbers),()=>f.assign(D,b))),f.if((0,s._)`${D} !== undefined`);for(const q of S)(m.has(q)||q==="array"&&E.coerceTypes==="array")&&V(q);f.else(),l(c),f.endIf(),f.if((0,s._)`${D} !== undefined`,()=>{f.assign(b,D),g(c,D)});function V(q){switch(q){case"string":f.elseIf((0,s._)`${C} == "number" || ${C} == "boolean"`).assign(D,(0,s._)`"" + ${b}`).elseIf((0,s._)`${b} === null`).assign(D,(0,s._)`""`);return;case"number":f.elseIf((0,s._)`${C} == "boolean" || ${b} === null
|
|
3
3
|
|| (${C} == "string" && ${b} && ${b} == +${b})`).assign(D,(0,s._)`+${b}`);return;case"integer":f.elseIf((0,s._)`${C} === "boolean" || ${b} === null
|
|
4
4
|
|| (${C} === "string" && ${b} && ${b} == +${b} && !(${b} % 1))`).assign(D,(0,s._)`+${b}`);return;case"boolean":f.elseIf((0,s._)`${b} === "false" || ${b} === 0 || ${b} === null`).assign(D,!1).elseIf((0,s._)`${b} === "true" || ${b} === 1`).assign(D,!0);return;case"null":f.elseIf((0,s._)`${b} === "" || ${b} === 0 || ${b} === false`),f.assign(D,null);return;case"array":f.elseIf((0,s._)`${C} === "string" || ${C} === "number"
|
|
5
|
-
|| ${C} === "boolean" || ${b} === null`).assign(D,(0,s._)`[${b}]`)}}}function g({gen:c,parentData:d,parentDataProperty:S},f){c.if((0,s._)`${d} !== undefined`,()=>c.assign((0,s._)`${d}[${S}]`,f))}function y(c,d,S,f=n.Correct){const b=f===n.Correct?s.operators.EQ:s.operators.NEQ;let E;switch(c){case"null":return(0,s._)`${d} ${b} null`;case"array":E=(0,s._)`Array.isArray(${d})`;break;case"object":E=(0,s._)`${d} && typeof ${d} == "object" && !Array.isArray(${d})`;break;case"integer":E=C((0,s._)`!(${d} % 1) && !isNaN(${d})`);break;case"number":E=C();break;default:return(0,s._)`typeof ${d} ${b} ${c}`}return f===n.Correct?E:(0,s.not)(E);function C(D=s.nil){return(0,s.and)((0,s._)`typeof ${d} == "number"`,D,S?(0,s._)`isFinite(${d})`:s.nil)}}ye.checkDataType=y;function v(c,d,S,f){if(c.length===1)return y(c[0],d,S,f);let b;const E=(0,a.toHash)(c);if(E.array&&E.object){const C=(0,s._)`typeof ${d} != "object"`;b=E.null?C:(0,s._)`!${d} || ${C}`,delete E.null,delete E.array,delete E.object}else b=s.nil;E.number&&delete E.integer;for(const C in E)b=(0,s.and)(b,y(C,d,S,f));return b}ye.checkDataTypes=v;const w={message:({schema:c})=>`must be ${c}`,params:({schema:c,schemaValue:d})=>typeof c=="string"?(0,s._)`{type: ${c}}`:(0,s._)`{type: ${d}}`};function l(c){const d=p(c);(0,r.reportError)(d,w)}ye.reportTypeError=l;function p(c){const{gen:d,data:S,schema:f}=c,b=(0,a.schemaRefOrVal)(c,f,"type");return{gen:d,keyword:"type",data:S,schema:f.type,schemaCode:b,schemaValue:b,parentSchema:f,params:{},it:c}}return ye}var ut={},bs;function qo(){if(bs)return ut;bs=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.assignDefaults=void 0;const t=Y(),e=se();function r(a,n){const{properties:i,items:o}=a.schema;if(n==="object"&&i)for(const u in i)s(a,u,i[u].default);else n==="array"&&Array.isArray(o)&&o.forEach((u,m)=>s(a,m,u.default))}ut.assignDefaults=r;function s(a,n,i){const{gen:o,compositeRule:u,data:m,opts:h}=a;if(i===void 0)return;const $=(0,t._)`${m}${(0,t.getProperty)(n)}`;if(u){(0,e.checkStrictMode)(a,`default is ignored for: ${$}`);return}let g=(0,t._)`${$} === undefined`;h.useDefaults==="empty"&&(g=(0,t._)`${g} || ${$} === null || ${$} === ""`),o.if(g,(0,t._)`${$} = ${(0,t.stringify)(i)}`)}return ut}var Re={},ie={},ws;function qe(){if(ws)return ie;ws=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.validateUnion=ie.validateArray=ie.usePattern=ie.callValidateCode=ie.schemaProperties=ie.allSchemaProperties=ie.noPropertyInData=ie.propertyInData=ie.isOwnProperty=ie.hasPropFunc=ie.reportMissingProp=ie.checkMissingProp=ie.checkReportMissingProp=void 0;const t=Y(),e=se(),r=Fe(),s=se();function a(c,d){const{gen:S,data:f,it:b}=c;S.if(h(S,f,d,b.opts.ownProperties),()=>{c.setParams({missingProperty:(0,t._)`${d}`},!0),c.error()})}ie.checkReportMissingProp=a;function n({gen:c,data:d,it:{opts:S}},f,b){return(0,t.or)(...f.map(E=>(0,t.and)(h(c,d,E,S.ownProperties),(0,t._)`${b} = ${E}`)))}ie.checkMissingProp=n;function i(c,d){c.setParams({missingProperty:d},!0),c.error()}ie.reportMissingProp=i;function o(c){return c.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ie.hasPropFunc=o;function u(c,d,S){return(0,t._)`${o(c)}.call(${d}, ${S})`}ie.isOwnProperty=u;function m(c,d,S,f){const b=(0,t._)`${d}${(0,t.getProperty)(S)} !== undefined`;return f?(0,t._)`${b} && ${u(c,d,S)}`:b}ie.propertyInData=m;function h(c,d,S,f){const b=(0,t._)`${d}${(0,t.getProperty)(S)} === undefined`;return f?(0,t.or)(b,(0,t.not)(u(c,d,S))):b}ie.noPropertyInData=h;function $(c){return c?Object.keys(c).filter(d=>d!=="__proto__"):[]}ie.allSchemaProperties=$;function g(c,d){return $(d).filter(S=>!(0,e.alwaysValidSchema)(c,d[S]))}ie.schemaProperties=g;function y({schemaCode:c,data:d,it:{gen:S,topSchemaRef:f,schemaPath:b,errorPath:E},it:C},D,V,q){const H=q?(0,t._)`${c}, ${d}, ${f}${b}`:d,F=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,E)],[r.default.parentData,C.parentData],[r.default.parentDataProperty,C.parentDataProperty],[r.default.rootData,r.default.rootData]];C.opts.dynamicRef&&F.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const x=(0,t._)`${H}, ${S.object(...F)}`;return V!==t.nil?(0,t._)`${D}.call(${V}, ${x})`:(0,t._)`${D}(${x})`}ie.callValidateCode=y;const v=(0,t._)`new RegExp`;function w({gen:c,it:{opts:d}},S){const f=d.unicodeRegExp?"u":"",{regExp:b}=d.code,E=b(S,f);return c.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${b.code==="new RegExp"?v:(0,s.useFunc)(c,b)}(${S}, ${f})`})}ie.usePattern=w;function l(c){const{gen:d,data:S,keyword:f,it:b}=c,E=d.name("valid");if(b.allErrors){const D=d.let("valid",!0);return C(()=>d.assign(D,!1)),D}return d.var(E,!0),C(()=>d.break()),E;function C(D){const V=d.const("len",(0,t._)`${S}.length`);d.forRange("i",0,V,q=>{c.subschema({keyword:f,dataProp:q,dataPropType:e.Type.Num},E),d.if((0,t.not)(E),D)})}}ie.validateArray=l;function p(c){const{gen:d,schema:S,keyword:f,it:b}=c;if(!Array.isArray(S))throw new Error("ajv implementation error");if(S.some(V=>(0,e.alwaysValidSchema)(b,V))&&!b.opts.unevaluated)return;const C=d.let("valid",!1),D=d.name("_valid");d.block(()=>S.forEach((V,q)=>{const H=c.subschema({keyword:f,schemaProp:q,compositeRule:!0},D);d.assign(C,(0,t._)`${C} || ${D}`),c.mergeValidEvaluated(H,D)||d.if((0,t.not)(C))})),c.result(C,()=>c.reset(),()=>c.error(!0))}return ie.validateUnion=p,ie}var Ss;function Mo(){if(Ss)return Re;Ss=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.validateKeywordUsage=Re.validSchemaType=Re.funcKeywordCode=Re.macroKeywordCode=void 0;const t=Y(),e=Fe(),r=qe(),s=vr();function a(g,y){const{gen:v,keyword:w,schema:l,parentSchema:p,it:c}=g,d=y.macro.call(c.self,l,p,c),S=m(v,w,d);c.opts.validateSchema!==!1&&c.self.validateSchema(d,!0);const f=v.name("valid");g.subschema({schema:d,schemaPath:t.nil,errSchemaPath:`${c.errSchemaPath}/${w}`,topSchemaRef:S,compositeRule:!0},f),g.pass(f,()=>g.error(!0))}Re.macroKeywordCode=a;function n(g,y){var v;const{gen:w,keyword:l,schema:p,parentSchema:c,$data:d,it:S}=g;u(S,y);const f=!d&&y.compile?y.compile.call(S.self,p,c,S):y.validate,b=m(w,l,f),E=w.let("valid");g.block$data(E,C),g.ok((v=y.valid)!==null&&v!==void 0?v:E);function C(){if(y.errors===!1)q(),y.modifying&&i(g),H(()=>g.error());else{const F=y.async?D():V();y.modifying&&i(g),H(()=>o(g,F))}}function D(){const F=w.let("ruleErrs",null);return w.try(()=>q((0,t._)`await `),x=>w.assign(E,!1).if((0,t._)`${x} instanceof ${S.ValidationError}`,()=>w.assign(F,(0,t._)`${x}.errors`),()=>w.throw(x))),F}function V(){const F=(0,t._)`${b}.errors`;return w.assign(F,null),q(t.nil),F}function q(F=y.async?(0,t._)`await `:t.nil){const x=S.opts.passContext?e.default.this:e.default.self,ae=!("compile"in y&&!d||y.schema===!1);w.assign(E,(0,t._)`${F}${(0,r.callValidateCode)(g,b,x,ae)}`,y.modifying)}function H(F){var x;w.if((0,t.not)((x=y.valid)!==null&&x!==void 0?x:E),F)}}Re.funcKeywordCode=n;function i(g){const{gen:y,data:v,it:w}=g;y.if(w.parentData,()=>y.assign(v,(0,t._)`${w.parentData}[${w.parentDataProperty}]`))}function o(g,y){const{gen:v}=g;v.if((0,t._)`Array.isArray(${y})`,()=>{v.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${y} : ${e.default.vErrors}.concat(${y})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,s.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},y){if(y.async&&!g.$async)throw new Error("async keyword in sync schema")}function m(g,y,v){if(v===void 0)throw new Error(`keyword "${y}" failed to compile`);return g.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,t.stringify)(v)})}function h(g,y,v=!1){return!y.length||y.some(w=>w==="array"?Array.isArray(g):w==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==w||v&&typeof g>"u")}Re.validSchemaType=h;function $({schema:g,opts:y,self:v,errSchemaPath:w},l,p){if(Array.isArray(l.keyword)?!l.keyword.includes(p):l.keyword!==p)throw new Error("ajv implementation error");const c=l.dependencies;if(c?.some(d=>!Object.prototype.hasOwnProperty.call(g,d)))throw new Error(`parent schema must have dependencies of ${p}: ${c.join(",")}`);if(l.validateSchema&&!l.validateSchema(g[p])){const S=`keyword "${p}" value is invalid at path "${w}": `+v.errorsText(l.validateSchema.errors);if(y.validateSchema==="log")v.logger.error(S);else throw new Error(S)}}return Re.validateKeywordUsage=$,Re}var Ae={},$s;function jo(){if($s)return Ae;$s=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.extendSubschemaMode=Ae.extendSubschemaData=Ae.getSubschema=void 0;const t=Y(),e=se();function r(n,{keyword:i,schemaProp:o,schema:u,schemaPath:m,errSchemaPath:h,topSchemaRef:$}){if(i!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const g=n.schema[i];return o===void 0?{schema:g,schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(i)}`,errSchemaPath:`${n.errSchemaPath}/${i}`}:{schema:g[o],schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(i)}${(0,t.getProperty)(o)}`,errSchemaPath:`${n.errSchemaPath}/${i}/${(0,e.escapeFragment)(o)}`}}if(u!==void 0){if(m===void 0||h===void 0||$===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:m,topSchemaRef:$,errSchemaPath:h}}throw new Error('either "keyword" or "schema" must be passed')}Ae.getSubschema=r;function s(n,i,{dataProp:o,dataPropType:u,data:m,dataTypes:h,propertyName:$}){if(m!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=i;if(o!==void 0){const{errorPath:v,dataPathArr:w,opts:l}=i,p=g.let("data",(0,t._)`${i.data}${(0,t.getProperty)(o)}`,!0);y(p),n.errorPath=(0,t.str)`${v}${(0,e.getErrorPath)(o,u,l.jsPropertySyntax)}`,n.parentDataProperty=(0,t._)`${o}`,n.dataPathArr=[...w,n.parentDataProperty]}if(m!==void 0){const v=m instanceof t.Name?m:g.let("data",m,!0);y(v),$!==void 0&&(n.propertyName=$)}h&&(n.dataTypes=h);function y(v){n.data=v,n.dataLevel=i.dataLevel+1,n.dataTypes=[],i.definedProperties=new Set,n.parentData=i.data,n.dataNames=[...i.dataNames,v]}}Ae.extendSubschemaData=s;function a(n,{jtdDiscriminator:i,jtdMetadata:o,compositeRule:u,createErrors:m,allErrors:h}){u!==void 0&&(n.compositeRule=u),m!==void 0&&(n.createErrors=m),h!==void 0&&(n.allErrors=h),n.jtdDiscriminator=i,n.jtdMetadata=o}return Ae.extendSubschemaMode=a,Ae}var be={},Cr,Es;function Hn(){return Es||(Es=1,Cr=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 i=n[a];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}),Cr}var Nr={exports:{}},Ts;function Ao(){if(Ts)return Nr.exports;Ts=1;var t=Nr.exports=function(s,a,n){typeof a=="function"&&(n=a,a={}),n=a.cb||n;var i=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};e(a,i,o,s,"",s)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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 e(s,a,n,i,o,u,m,h,$,g){if(i&&typeof i=="object"&&!Array.isArray(i)){a(i,o,u,m,h,$,g);for(var y in i){var v=i[y];if(Array.isArray(v)){if(y in t.arrayKeywords)for(var w=0;w<v.length;w++)e(s,a,n,v[w],o+"/"+y+"/"+w,u,o,y,i,w)}else if(y in t.propsKeywords){if(v&&typeof v=="object")for(var l in v)e(s,a,n,v[l],o+"/"+y+"/"+r(l),u,o,y,i,l)}else(y in t.keywords||s.allKeys&&!(y in t.skipKeywords))&&e(s,a,n,v,o+"/"+y,u,o,y,i)}n(i,o,u,m,h,$,g)}}function r(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}return Nr.exports}var ks;function br(){if(ks)return be;ks=1,Object.defineProperty(be,"__esModule",{value:!0}),be.getSchemaRefs=be.resolveUrl=be.normalizeId=be._getFullPath=be.getFullPath=be.inlineRef=void 0;const t=se(),e=Hn(),r=Ao(),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function a(w,l=!0){return typeof w=="boolean"?!0:l===!0?!i(w):l?o(w)<=l:!1}be.inlineRef=a;const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(w){for(const l in w){if(n.has(l))return!0;const p=w[l];if(Array.isArray(p)&&p.some(i)||typeof p=="object"&&i(p))return!0}return!1}function o(w){let l=0;for(const p in w){if(p==="$ref")return 1/0;if(l++,!s.has(p)&&(typeof w[p]=="object"&&(0,t.eachItem)(w[p],c=>l+=o(c)),l===1/0))return 1/0}return l}function u(w,l="",p){p!==!1&&(l=$(l));const c=w.parse(l);return m(w,c)}be.getFullPath=u;function m(w,l){return w.serialize(l).split("#")[0]+"#"}be._getFullPath=m;const h=/#\/?$/;function $(w){return w?w.replace(h,""):""}be.normalizeId=$;function g(w,l,p){return p=$(p),w.resolve(l,p)}be.resolveUrl=g;const y=/^[a-z_][-a-z0-9._]*$/i;function v(w,l){if(typeof w=="boolean")return{};const{schemaId:p,uriResolver:c}=this.opts,d=$(w[p]||l),S={"":d},f=u(c,d,!1),b={},E=new Set;return r(w,{allKeys:!0},(V,q,H,F)=>{if(F===void 0)return;const x=f+q;let ae=S[F];typeof V[p]=="string"&&(ae=_e.call(this,V[p])),ve.call(this,V.$anchor),ve.call(this,V.$dynamicAnchor),S[q]=ae;function _e(ce){const Ie=this.opts.uriResolver.resolve;if(ce=$(ae?Ie(ae,ce):ce),E.has(ce))throw D(ce);E.add(ce);let L=this.refs[ce];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?C(V,L.schema,ce):ce!==$(x)&&(ce[0]==="#"?(C(V,b[ce],ce),b[ce]=V):this.refs[ce]=x),ce}function ve(ce){if(typeof ce=="string"){if(!y.test(ce))throw new Error(`invalid anchor "${ce}"`);_e.call(this,`#${ce}`)}}}),b;function C(V,q,H){if(q!==void 0&&!e(V,q))throw D(H)}function D(V){return new Error(`reference "${V}" resolves to more than one schema`)}}return be.getSchemaRefs=v,be}var Ps;function wr(){if(Ps)return Me;Ps=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.getData=Me.KeywordCxt=Me.validateFunctionCode=void 0;const t=No(),e=pr(),r=Un(),s=pr(),a=qo(),n=Mo(),i=jo(),o=Y(),u=Fe(),m=br(),h=se(),$=vr();function g(k){if(f(k)&&(E(k),S(k))){l(k);return}y(k,()=>(0,t.topBoolOrEmptySchema)(k))}Me.validateFunctionCode=g;function y({gen:k,validateName:O,schema:M,schemaEnv:U,opts:K},X){K.code.es5?k.func(O,(0,o._)`${u.default.data}, ${u.default.valCxt}`,U.$async,()=>{k.code((0,o._)`"use strict"; ${c(M,K)}`),w(k,K),k.code(X)}):k.func(O,(0,o._)`${u.default.data}, ${v(K)}`,U.$async,()=>k.code(c(M,K)).code(X))}function v(k){return(0,o._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${k.dynamicRef?(0,o._)`, ${u.default.dynamicAnchors}={}`:o.nil}}={}`}function w(k,O){k.if(u.default.valCxt,()=>{k.var(u.default.instancePath,(0,o._)`${u.default.valCxt}.${u.default.instancePath}`),k.var(u.default.parentData,(0,o._)`${u.default.valCxt}.${u.default.parentData}`),k.var(u.default.parentDataProperty,(0,o._)`${u.default.valCxt}.${u.default.parentDataProperty}`),k.var(u.default.rootData,(0,o._)`${u.default.valCxt}.${u.default.rootData}`),O.dynamicRef&&k.var(u.default.dynamicAnchors,(0,o._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{k.var(u.default.instancePath,(0,o._)`""`),k.var(u.default.parentData,(0,o._)`undefined`),k.var(u.default.parentDataProperty,(0,o._)`undefined`),k.var(u.default.rootData,u.default.data),O.dynamicRef&&k.var(u.default.dynamicAnchors,(0,o._)`{}`)})}function l(k){const{schema:O,opts:M,gen:U}=k;y(k,()=>{M.$comment&&O.$comment&&F(k),V(k),U.let(u.default.vErrors,null),U.let(u.default.errors,0),M.unevaluated&&p(k),C(k),x(k)})}function p(k){const{gen:O,validateName:M}=k;k.evaluated=O.const("evaluated",(0,o._)`${M}.evaluated`),O.if((0,o._)`${k.evaluated}.dynamicProps`,()=>O.assign((0,o._)`${k.evaluated}.props`,(0,o._)`undefined`)),O.if((0,o._)`${k.evaluated}.dynamicItems`,()=>O.assign((0,o._)`${k.evaluated}.items`,(0,o._)`undefined`))}function c(k,O){const M=typeof k=="object"&&k[O.schemaId];return M&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${M} */`:o.nil}function d(k,O){if(f(k)&&(E(k),S(k))){b(k,O);return}(0,t.boolOrEmptySchema)(k,O)}function S({schema:k,self:O}){if(typeof k=="boolean")return!k;for(const M in k)if(O.RULES.all[M])return!0;return!1}function f(k){return typeof k.schema!="boolean"}function b(k,O){const{schema:M,gen:U,opts:K}=k;K.$comment&&M.$comment&&F(k),q(k),H(k);const X=U.const("_errs",u.default.errors);C(k,X),U.var(O,(0,o._)`${X} === ${u.default.errors}`)}function E(k){(0,h.checkUnknownRules)(k),D(k)}function C(k,O){if(k.opts.jtd)return _e(k,[],!1,O);const M=(0,e.getSchemaTypes)(k.schema),U=(0,e.coerceAndCheckDataType)(k,M);_e(k,M,!U,O)}function D(k){const{schema:O,errSchemaPath:M,opts:U,self:K}=k;O.$ref&&U.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(O,K.RULES)&&K.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function V(k){const{schema:O,opts:M}=k;O.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,h.checkStrictMode)(k,"default is ignored in the schema root")}function q(k){const O=k.schema[k.opts.schemaId];O&&(k.baseId=(0,m.resolveUrl)(k.opts.uriResolver,k.baseId,O))}function H(k){if(k.schema.$async&&!k.schemaEnv.$async)throw new Error("async schema in sync schema")}function F({gen:k,schemaEnv:O,schema:M,errSchemaPath:U,opts:K}){const X=M.$comment;if(K.$comment===!0)k.code((0,o._)`${u.default.self}.logger.log(${X})`);else if(typeof K.$comment=="function"){const pe=(0,o.str)`${U}/$comment`,Oe=k.scopeValue("root",{ref:O.root});k.code((0,o._)`${u.default.self}.opts.$comment(${X}, ${pe}, ${Oe}.schema)`)}}function x(k){const{gen:O,schemaEnv:M,validateName:U,ValidationError:K,opts:X}=k;M.$async?O.if((0,o._)`${u.default.errors} === 0`,()=>O.return(u.default.data),()=>O.throw((0,o._)`new ${K}(${u.default.vErrors})`)):(O.assign((0,o._)`${U}.errors`,u.default.vErrors),X.unevaluated&&ae(k),O.return((0,o._)`${u.default.errors} === 0`))}function ae({gen:k,evaluated:O,props:M,items:U}){M instanceof o.Name&&k.assign((0,o._)`${O}.props`,M),U instanceof o.Name&&k.assign((0,o._)`${O}.items`,U)}function _e(k,O,M,U){const{gen:K,schema:X,data:pe,allErrors:Oe,opts:Se,self:$e}=k,{RULES:me}=$e;if(X.$ref&&(Se.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(X,me))){K.block(()=>z(k,"$ref",me.all.$ref.definition));return}Se.jtd||ce(k,O),K.block(()=>{for(const ke of me.rules)Ze(ke);Ze(me.post)});function Ze(ke){(0,r.shouldUseGroup)(X,ke)&&(ke.type?(K.if((0,s.checkDataType)(ke.type,pe,Se.strictNumbers)),ve(k,ke),O.length===1&&O[0]===ke.type&&M&&(K.else(),(0,s.reportTypeError)(k)),K.endIf()):ve(k,ke),Oe||K.if((0,o._)`${u.default.errors} === ${U||0}`))}}function ve(k,O){const{gen:M,schema:U,opts:{useDefaults:K}}=k;K&&(0,a.assignDefaults)(k,O.type),M.block(()=>{for(const X of O.rules)(0,r.shouldUseRule)(U,X)&&z(k,X.keyword,X.definition,O.type)})}function ce(k,O){k.schemaEnv.meta||!k.opts.strictTypes||(Ie(k,O),k.opts.allowUnionTypes||L(k,O),I(k,k.dataTypes))}function Ie(k,O){if(O.length){if(!k.dataTypes.length){k.dataTypes=O;return}O.forEach(M=>{R(k.dataTypes,M)||T(k,`type "${M}" not allowed by context "${k.dataTypes.join(",")}"`)}),_(k,O)}}function L(k,O){O.length>1&&!(O.length===2&&O.includes("null"))&&T(k,"use allowUnionTypes to allow union type keyword")}function I(k,O){const M=k.self.RULES.all;for(const U in M){const K=M[U];if(typeof K=="object"&&(0,r.shouldUseRule)(k.schema,K)){const{type:X}=K.definition;X.length&&!X.some(pe=>j(O,pe))&&T(k,`missing type "${X.join(",")}" for keyword "${U}"`)}}}function j(k,O){return k.includes(O)||O==="number"&&k.includes("integer")}function R(k,O){return k.includes(O)||O==="integer"&&k.includes("number")}function _(k,O){const M=[];for(const U of k.dataTypes)R(O,U)?M.push(U):O.includes("integer")&&U==="number"&&M.push("integer");k.dataTypes=M}function T(k,O){const M=k.schemaEnv.baseId+k.errSchemaPath;O+=` at "${M}" (strictTypes)`,(0,h.checkStrictMode)(k,O,k.opts.strictTypes)}class N{constructor(O,M,U){if((0,n.validateKeywordUsage)(O,M,U),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=U,this.data=O.data,this.schema=O.schema[U],this.$data=M.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(O,this.schema,U,this.$data),this.schemaType=M.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=M,this.$data)this.schemaCode=O.gen.const("vSchema",re(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=O.gen.const("_errs",u.default.errors))}result(O,M,U){this.failResult((0,o.not)(O),M,U)}failResult(O,M,U){this.gen.if(O),U?U():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,M){this.failResult((0,o.not)(O),void 0,M)}fail(O){if(O===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(O),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);const{schemaCode:M}=this;this.fail((0,o._)`${M} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,M,U){if(M){this.setParams(M),this._error(O,U),this.setParams({});return}this._error(O,U)}_error(O,M){(O?$.reportExtraError:$.reportError)(this,this.def.error,M)}$dataError(){(0,$.reportError)(this,this.def.$dataError||$.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,$.resetErrorsCount)(this.gen,this.errsCount)}ok(O){this.allErrors||this.gen.if(O)}setParams(O,M){M?Object.assign(this.params,O):this.params=O}block$data(O,M,U=o.nil){this.gen.block(()=>{this.check$data(O,U),M()})}check$data(O=o.nil,M=o.nil){if(!this.$data)return;const{gen:U,schemaCode:K,schemaType:X,def:pe}=this;U.if((0,o.or)((0,o._)`${K} === undefined`,M)),O!==o.nil&&U.assign(O,!0),(X.length||pe.validateSchema)&&(U.elseIf(this.invalid$data()),this.$dataError(),O!==o.nil&&U.assign(O,!1)),U.else()}invalid$data(){const{gen:O,schemaCode:M,schemaType:U,def:K,it:X}=this;return(0,o.or)(pe(),Oe());function pe(){if(U.length){if(!(M instanceof o.Name))throw new Error("ajv implementation error");const Se=Array.isArray(U)?U:[U];return(0,o._)`${(0,s.checkDataTypes)(Se,M,X.opts.strictNumbers,s.DataType.Wrong)}`}return o.nil}function Oe(){if(K.validateSchema){const Se=O.scopeValue("validate$data",{ref:K.validateSchema});return(0,o._)`!${Se}(${M})`}return o.nil}}subschema(O,M){const U=(0,i.getSubschema)(this.it,O);(0,i.extendSubschemaData)(U,this.it,O),(0,i.extendSubschemaMode)(U,O);const K={...this.it,...U,items:void 0,props:void 0};return d(K,M),K}mergeEvaluated(O,M){const{it:U,gen:K}=this;U.opts.unevaluated&&(U.props!==!0&&O.props!==void 0&&(U.props=h.mergeEvaluated.props(K,O.props,U.props,M)),U.items!==!0&&O.items!==void 0&&(U.items=h.mergeEvaluated.items(K,O.items,U.items,M)))}mergeValidEvaluated(O,M){const{it:U,gen:K}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return K.if(M,()=>this.mergeEvaluated(O,o.Name)),!0}}Me.KeywordCxt=N;function z(k,O,M,U){const K=new N(k,M,O);"code"in M?M.code(K,U):K.$data&&M.validate?(0,n.funcKeywordCode)(K,M):"macro"in M?(0,n.macroKeywordCode)(K,M):(M.compile||M.validate)&&(0,n.funcKeywordCode)(K,M)}const W=/^\/(?:[^~]|~0|~1)*$/,ne=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function re(k,{dataLevel:O,dataNames:M,dataPathArr:U}){let K,X;if(k==="")return u.default.rootData;if(k[0]==="/"){if(!W.test(k))throw new Error(`Invalid JSON-pointer: ${k}`);K=k,X=u.default.rootData}else{const $e=ne.exec(k);if(!$e)throw new Error(`Invalid JSON-pointer: ${k}`);const me=+$e[1];if(K=$e[2],K==="#"){if(me>=O)throw new Error(Se("property/index",me));return U[O-me]}if(me>O)throw new Error(Se("data",me));if(X=M[O-me],!K)return X}let pe=X;const Oe=K.split("/");for(const $e of Oe)$e&&(X=(0,o._)`${X}${(0,o.getProperty)((0,h.unescapeJsonPointer)($e))}`,pe=(0,o._)`${pe} && ${X}`);return pe;function Se($e,me){return`Cannot access ${$e} ${me} levels up, current level is ${O}`}}return Me.getData=re,Me}var $t={},Is;function Zr(){if(Is)return $t;Is=1,Object.defineProperty($t,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return $t.default=t,$t}var Et={},Os;function Sr(){if(Os)return Et;Os=1,Object.defineProperty(Et,"__esModule",{value:!0});const t=br();class e extends Error{constructor(s,a,n,i){super(i||`can't resolve reference ${n} from id ${a}`),this.missingRef=(0,t.resolveUrl)(s,a,n),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(s,this.missingRef))}}return Et.default=e,Et}var Te={},Rs;function Yr(){if(Rs)return Te;Rs=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.resolveSchema=Te.getCompilingSchema=Te.resolveRef=Te.compileSchema=Te.SchemaEnv=void 0;const t=Y(),e=Zr(),r=Fe(),s=br(),a=se(),n=wr();class i{constructor(p){var c;this.refs={},this.dynamicAnchors={};let d;typeof p.schema=="object"&&(d=p.schema),this.schema=p.schema,this.schemaId=p.schemaId,this.root=p.root||this,this.baseId=(c=p.baseId)!==null&&c!==void 0?c:(0,s.normalizeId)(d?.[p.schemaId||"$id"]),this.schemaPath=p.schemaPath,this.localRefs=p.localRefs,this.meta=p.meta,this.$async=d?.$async,this.refs={}}}Te.SchemaEnv=i;function o(l){const p=h.call(this,l);if(p)return p;const c=(0,s.getFullPath)(this.opts.uriResolver,l.root.baseId),{es5:d,lines:S}=this.opts.code,{ownProperties:f}=this.opts,b=new t.CodeGen(this.scope,{es5:d,lines:S,ownProperties:f});let E;l.$async&&(E=b.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const C=b.scopeName("validate");l.validateName=C;const D={gen:b,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:b.scopeValue("schema",this.opts.code.source===!0?{ref:l.schema,code:(0,t.stringify)(l.schema)}:{ref:l.schema}),validateName:C,ValidationError:E,schema:l.schema,schemaEnv:l,rootId:c,baseId:l.baseId||c,schemaPath:t.nil,errSchemaPath:l.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let V;try{this._compilations.add(l),(0,n.validateFunctionCode)(D),b.optimize(this.opts.code.optimize);const q=b.toString();V=`${b.scopeRefs(r.default.scope)}return ${q}`,this.opts.code.process&&(V=this.opts.code.process(V,l));const F=new Function(`${r.default.self}`,`${r.default.scope}`,V)(this,this.scope.get());if(this.scope.value(C,{ref:F}),F.errors=null,F.schema=l.schema,F.schemaEnv=l,l.$async&&(F.$async=!0),this.opts.code.source===!0&&(F.source={validateName:C,validateCode:q,scopeValues:b._values}),this.opts.unevaluated){const{props:x,items:ae}=D;F.evaluated={props:x instanceof t.Name?void 0:x,items:ae instanceof t.Name?void 0:ae,dynamicProps:x instanceof t.Name,dynamicItems:ae instanceof t.Name},F.source&&(F.source.evaluated=(0,t.stringify)(F.evaluated))}return l.validate=F,l}catch(q){throw delete l.validate,delete l.validateName,V&&this.logger.error("Error compiling schema, function code:",V),q}finally{this._compilations.delete(l)}}Te.compileSchema=o;function u(l,p,c){var d;c=(0,s.resolveUrl)(this.opts.uriResolver,p,c);const S=l.refs[c];if(S)return S;let f=g.call(this,l,c);if(f===void 0){const b=(d=l.localRefs)===null||d===void 0?void 0:d[c],{schemaId:E}=this.opts;b&&(f=new i({schema:b,schemaId:E,root:l,baseId:p}))}if(f!==void 0)return l.refs[c]=m.call(this,f)}Te.resolveRef=u;function m(l){return(0,s.inlineRef)(l.schema,this.opts.inlineRefs)?l.schema:l.validate?l:o.call(this,l)}function h(l){for(const p of this._compilations)if($(p,l))return p}Te.getCompilingSchema=h;function $(l,p){return l.schema===p.schema&&l.root===p.root&&l.baseId===p.baseId}function g(l,p){let c;for(;typeof(c=this.refs[p])=="string";)p=c;return c||this.schemas[p]||y.call(this,l,p)}function y(l,p){const c=this.opts.uriResolver.parse(p),d=(0,s._getFullPath)(this.opts.uriResolver,c);let S=(0,s.getFullPath)(this.opts.uriResolver,l.baseId,void 0);if(Object.keys(l.schema).length>0&&d===S)return w.call(this,c,l);const f=(0,s.normalizeId)(d),b=this.refs[f]||this.schemas[f];if(typeof b=="string"){const E=y.call(this,l,b);return typeof E?.schema!="object"?void 0:w.call(this,c,E)}if(typeof b?.schema=="object"){if(b.validate||o.call(this,b),f===(0,s.normalizeId)(p)){const{schema:E}=b,{schemaId:C}=this.opts,D=E[C];return D&&(S=(0,s.resolveUrl)(this.opts.uriResolver,S,D)),new i({schema:E,schemaId:C,root:l,baseId:S})}return w.call(this,c,b)}}Te.resolveSchema=y;const v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w(l,{baseId:p,schema:c,root:d}){var S;if(((S=l.fragment)===null||S===void 0?void 0:S[0])!=="/")return;for(const E of l.fragment.slice(1).split("/")){if(typeof c=="boolean")return;const C=c[(0,a.unescapeFragment)(E)];if(C===void 0)return;c=C;const D=typeof c=="object"&&c[this.opts.schemaId];!v.has(E)&&D&&(p=(0,s.resolveUrl)(this.opts.uriResolver,p,D))}let f;if(typeof c!="boolean"&&c.$ref&&!(0,a.schemaHasRulesButRef)(c,this.RULES)){const E=(0,s.resolveUrl)(this.opts.uriResolver,p,c.$ref);f=y.call(this,d,E)}const{schemaId:b}=this.opts;if(f=f||new i({schema:c,schemaId:b,root:d,baseId:p}),f.schema!==f.root.schema)return f}return Te}const Do="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Lo="Meta-schema for $data reference (JSON AnySchema extension proposal)",Uo="object",Ho=["$data"],Vo={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Fo=!1,xo={$id:Do,description:Lo,type:Uo,required:Ho,properties:Vo,additionalProperties:Fo};var Tt={},lt={exports:{}},qr,Cs;function Vn(){if(Cs)return qr;Cs=1;const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),e=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 r(g){let y="",v=0,w=0;for(w=0;w<g.length;w++)if(v=g[w].charCodeAt(0),v!==48){if(!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=g[w];break}for(w+=1;w<g.length;w++){if(v=g[w].charCodeAt(0),!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=g[w]}return y}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(g){return g.length=0,!0}function n(g,y,v){if(g.length){const w=r(g);if(w!=="")y.push(w);else return v.error=!0,!1;g.length=0}return!0}function i(g){let y=0;const v={error:!1,address:"",zone:""},w=[],l=[];let p=!1,c=!1,d=n;for(let S=0;S<g.length;S++){const f=g[S];if(!(f==="["||f==="]"))if(f===":"){if(p===!0&&(c=!0),!d(l,w,v))break;if(++y>7){v.error=!0;break}S>0&&g[S-1]===":"&&(p=!0),w.push(":");continue}else if(f==="%"){if(!d(l,w,v))break;d=a}else{l.push(f);continue}}return l.length&&(d===a?v.zone=l.join(""):c?w.push(l.join("")):w.push(r(l))),v.address=w.join(""),v}function o(g){if(u(g,":")<2)return{host:g,isIPV6:!1};const y=i(g);if(y.error)return{host:g,isIPV6:!1};{let v=y.address,w=y.address;return y.zone&&(v+="%"+y.zone,w+="%25"+y.zone),{host:v,isIPV6:!0,escapedHost:w}}}function u(g,y){let v=0;for(let w=0;w<g.length;w++)g[w]===y&&v++;return v}function m(g){let y=g;const v=[];let w=-1,l=0;for(;l=y.length;){if(l===1){if(y===".")break;if(y==="/"){v.push("/");break}else{v.push(y);break}}else if(l===2){if(y[0]==="."){if(y[1]===".")break;if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&(y[1]==="."||y[1]==="/")){v.push("/");break}}else if(l===3&&y==="/.."){v.length!==0&&v.pop(),v.push("/");break}if(y[0]==="."){if(y[1]==="."){if(y[2]==="/"){y=y.slice(3);continue}}else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&y[1]==="."){if(y[2]==="/"){y=y.slice(2);continue}else if(y[2]==="."&&y[3]==="/"){y=y.slice(3),v.length!==0&&v.pop();continue}}if((w=y.indexOf("/",1))===-1){v.push(y);break}else v.push(y.slice(0,w)),y=y.slice(w)}return v.join("")}function h(g,y){const v=y!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=v(g.scheme)),g.userinfo!==void 0&&(g.userinfo=v(g.userinfo)),g.host!==void 0&&(g.host=v(g.host)),g.path!==void 0&&(g.path=v(g.path)),g.query!==void 0&&(g.query=v(g.query)),g.fragment!==void 0&&(g.fragment=v(g.fragment)),g}function $(g){const y=[];if(g.userinfo!==void 0&&(y.push(g.userinfo),y.push("@")),g.host!==void 0){let v=unescape(g.host);if(!e(v)){const w=o(v);w.isIPV6===!0?v=`[${w.escapedHost}]`:v=g.host}y.push(v)}return(typeof g.port=="number"||typeof g.port=="string")&&(y.push(":"),y.push(String(g.port))),y.length?y.join(""):void 0}return qr={nonSimpleDomain:s,recomposeAuthority:$,normalizeComponentEncoding:h,removeDotSegments:m,isIPv4:e,isUUID:t,normalizeIPv6:o,stringArrayToHexStripped:r},qr}var Mr,Ns;function zo(){if(Ns)return Mr;Ns=1;const{isUUID:t}=Vn(),e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function s(f){return r.indexOf(f)!==-1}function a(f){return f.secure===!0?!0:f.secure===!1?!1:f.scheme?f.scheme.length===3&&(f.scheme[0]==="w"||f.scheme[0]==="W")&&(f.scheme[1]==="s"||f.scheme[1]==="S")&&(f.scheme[2]==="s"||f.scheme[2]==="S"):!1}function n(f){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f}function i(f){const b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}function o(f){return f.secure=a(f),f.resourceName=(f.path||"/")+(f.query?"?"+f.query:""),f.path=void 0,f.query=void 0,f}function u(f){if((f.port===(a(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){const[b,E]=f.resourceName.split("?");f.path=b&&b!=="/"?b:void 0,f.query=E,f.resourceName=void 0}return f.fragment=void 0,f}function m(f,b){if(!f.path)return f.error="URN can not be parsed",f;const E=f.path.match(e);if(E){const C=b.scheme||f.scheme||"urn";f.nid=E[1].toLowerCase(),f.nss=E[2];const D=`${C}:${b.nid||f.nid}`,V=S(D);f.path=void 0,V&&(f=V.parse(f,b))}else f.error=f.error||"URN can not be parsed.";return f}function h(f,b){if(f.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=b.scheme||f.scheme||"urn",C=f.nid.toLowerCase(),D=`${E}:${b.nid||C}`,V=S(D);V&&(f=V.serialize(f,b));const q=f,H=f.nss;return q.path=`${C||b.nid}:${H}`,b.skipEscape=!0,q}function $(f,b){const E=f;return E.uuid=E.nss,E.nss=void 0,!b.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function g(f){const b=f;return b.nss=(f.uuid||"").toLowerCase(),b}const y={scheme:"http",domainHost:!0,parse:n,serialize:i},v={scheme:"https",domainHost:y.domainHost,parse:n,serialize:i},w={scheme:"ws",domainHost:!0,parse:o,serialize:u},l={scheme:"wss",domainHost:w.domainHost,parse:w.parse,serialize:w.serialize},d={http:y,https:v,ws:w,wss:l,urn:{scheme:"urn",parse:m,serialize:h,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:$,serialize:g,skipNormalize:!0}};Object.setPrototypeOf(d,null);function S(f){return f&&(d[f]||d[f.toLowerCase()])||void 0}return Mr={wsIsSecure:a,SCHEMES:d,isValidSchemeName:s,getSchemeHandler:S},Mr}var qs;function Ko(){if(qs)return lt.exports;qs=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:r,normalizeComponentEncoding:s,isIPv4:a,nonSimpleDomain:n}=Vn(),{SCHEMES:i,getSchemeHandler:o}=zo();function u(l,p){return typeof l=="string"?l=g(v(l,p),p):typeof l=="object"&&(l=v(g(l,p),p)),l}function m(l,p,c){const d=c?Object.assign({scheme:"null"},c):{scheme:"null"},S=h(v(l,d),v(p,d),d,!0);return d.skipEscape=!0,g(S,d)}function h(l,p,c,d){const S={};return d||(l=v(g(l,c),c),p=v(g(p,c),c)),c=c||{},!c.tolerant&&p.scheme?(S.scheme=p.scheme,S.userinfo=p.userinfo,S.host=p.host,S.port=p.port,S.path=e(p.path||""),S.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(S.userinfo=p.userinfo,S.host=p.host,S.port=p.port,S.path=e(p.path||""),S.query=p.query):(p.path?(p.path[0]==="/"?S.path=e(p.path):((l.userinfo!==void 0||l.host!==void 0||l.port!==void 0)&&!l.path?S.path="/"+p.path:l.path?S.path=l.path.slice(0,l.path.lastIndexOf("/")+1)+p.path:S.path=p.path,S.path=e(S.path)),S.query=p.query):(S.path=l.path,p.query!==void 0?S.query=p.query:S.query=l.query),S.userinfo=l.userinfo,S.host=l.host,S.port=l.port),S.scheme=l.scheme),S.fragment=p.fragment,S}function $(l,p,c){return typeof l=="string"?(l=unescape(l),l=g(s(v(l,c),!0),{...c,skipEscape:!0})):typeof l=="object"&&(l=g(s(l,!0),{...c,skipEscape:!0})),typeof p=="string"?(p=unescape(p),p=g(s(v(p,c),!0),{...c,skipEscape:!0})):typeof p=="object"&&(p=g(s(p,!0),{...c,skipEscape:!0})),l.toLowerCase()===p.toLowerCase()}function g(l,p){const c={host:l.host,scheme:l.scheme,userinfo:l.userinfo,port:l.port,path:l.path,query:l.query,nid:l.nid,nss:l.nss,uuid:l.uuid,fragment:l.fragment,reference:l.reference,resourceName:l.resourceName,secure:l.secure,error:""},d=Object.assign({},p),S=[],f=o(d.scheme||c.scheme);f&&f.serialize&&f.serialize(c,d),c.path!==void 0&&(d.skipEscape?c.path=unescape(c.path):(c.path=escape(c.path),c.scheme!==void 0&&(c.path=c.path.split("%3A").join(":")))),d.reference!=="suffix"&&c.scheme&&S.push(c.scheme,":");const b=r(c);if(b!==void 0&&(d.reference!=="suffix"&&S.push("//"),S.push(b),c.path&&c.path[0]!=="/"&&S.push("/")),c.path!==void 0){let E=c.path;!d.absolutePath&&(!f||!f.absolutePath)&&(E=e(E)),b===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),S.push(E)}return c.query!==void 0&&S.push("?",c.query),c.fragment!==void 0&&S.push("#",c.fragment),S.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v(l,p){const c=Object.assign({},p),d={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let S=!1;c.reference==="suffix"&&(c.scheme?l=c.scheme+":"+l:l="//"+l);const f=l.match(y);if(f){if(d.scheme=f[1],d.userinfo=f[3],d.host=f[4],d.port=parseInt(f[5],10),d.path=f[6]||"",d.query=f[7],d.fragment=f[8],isNaN(d.port)&&(d.port=f[5]),d.host)if(a(d.host)===!1){const C=t(d.host);d.host=C.host.toLowerCase(),S=C.isIPV6}else S=!0;d.scheme===void 0&&d.userinfo===void 0&&d.host===void 0&&d.port===void 0&&d.query===void 0&&!d.path?d.reference="same-document":d.scheme===void 0?d.reference="relative":d.fragment===void 0?d.reference="absolute":d.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==d.reference&&(d.error=d.error||"URI is not a "+c.reference+" reference.");const b=o(c.scheme||d.scheme);if(!c.unicodeSupport&&(!b||!b.unicodeSupport)&&d.host&&(c.domainHost||b&&b.domainHost)&&S===!1&&n(d.host))try{d.host=URL.domainToASCII(d.host.toLowerCase())}catch(E){d.error=d.error||"Host's domain name can not be converted to ASCII: "+E}(!b||b&&!b.skipNormalize)&&(l.indexOf("%")!==-1&&(d.scheme!==void 0&&(d.scheme=unescape(d.scheme)),d.host!==void 0&&(d.host=unescape(d.host))),d.path&&(d.path=escape(unescape(d.path))),d.fragment&&(d.fragment=encodeURI(decodeURIComponent(d.fragment)))),b&&b.parse&&b.parse(d,c)}else d.error=d.error||"URI can not be parsed.";return d}const w={SCHEMES:i,normalize:u,resolve:m,resolveComponent:h,equal:$,serialize:g,parse:v};return lt.exports=w,lt.exports.default=w,lt.exports.fastUri=w,lt.exports}var Ms;function Wo(){if(Ms)return Tt;Ms=1,Object.defineProperty(Tt,"__esModule",{value:!0});const t=Ko();return t.code='require("ajv/dist/runtime/uri").default',Tt.default=t,Tt}var js;function Go(){return js||(js=1,(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=wr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Y();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=Zr(),a=Sr(),n=Ln(),i=Yr(),o=Y(),u=br(),m=pr(),h=se(),$=xo,g=Wo(),y=(L,I)=>new RegExp(L,I);y.code="new RegExp";const v=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),l={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."},p={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},c=200;function d(L){var I,j,R,_,T,N,z,W,ne,re,k,O,M,U,K,X,pe,Oe,Se,$e,me,Ze,ke,$r,Er;const ct=L.strict,Tr=(I=L.code)===null||I===void 0?void 0:I.optimize,ts=Tr===!0||Tr===void 0?1:Tr||0,rs=(R=(j=L.code)===null||j===void 0?void 0:j.regExp)!==null&&R!==void 0?R:y,sa=(_=L.uriResolver)!==null&&_!==void 0?_:g.default;return{strictSchema:(N=(T=L.strictSchema)!==null&&T!==void 0?T:ct)!==null&&N!==void 0?N:!0,strictNumbers:(W=(z=L.strictNumbers)!==null&&z!==void 0?z:ct)!==null&&W!==void 0?W:!0,strictTypes:(re=(ne=L.strictTypes)!==null&&ne!==void 0?ne:ct)!==null&&re!==void 0?re:"log",strictTuples:(O=(k=L.strictTuples)!==null&&k!==void 0?k:ct)!==null&&O!==void 0?O:"log",strictRequired:(U=(M=L.strictRequired)!==null&&M!==void 0?M:ct)!==null&&U!==void 0?U:!1,code:L.code?{...L.code,optimize:ts,regExp:rs}:{optimize:ts,regExp:rs},loopRequired:(K=L.loopRequired)!==null&&K!==void 0?K:c,loopEnum:(X=L.loopEnum)!==null&&X!==void 0?X:c,meta:(pe=L.meta)!==null&&pe!==void 0?pe:!0,messages:(Oe=L.messages)!==null&&Oe!==void 0?Oe:!0,inlineRefs:(Se=L.inlineRefs)!==null&&Se!==void 0?Se:!0,schemaId:($e=L.schemaId)!==null&&$e!==void 0?$e:"$id",addUsedSchema:(me=L.addUsedSchema)!==null&&me!==void 0?me:!0,validateSchema:(Ze=L.validateSchema)!==null&&Ze!==void 0?Ze:!0,validateFormats:(ke=L.validateFormats)!==null&&ke!==void 0?ke:!0,unicodeRegExp:($r=L.unicodeRegExp)!==null&&$r!==void 0?$r:!0,int32range:(Er=L.int32range)!==null&&Er!==void 0?Er:!0,uriResolver:sa}}class S{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...d(I)};const{es5:j,lines:R}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:w,es5:j,lines:R}),this.logger=H(I.logger);const _=I.validateFormats;I.validateFormats=!1,this.RULES=(0,n.getRules)(),f.call(this,l,I,"NOT SUPPORTED"),f.call(this,p,I,"DEPRECATED","warn"),this._metaOpts=V.call(this),I.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&D.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),E.call(this),I.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:I,meta:j,schemaId:R}=this.opts;let _=$;R==="id"&&(_={...$},_.id=_.$id,delete _.$id),j&&I&&this.addMetaSchema(_,_[R],!1)}defaultMeta(){const{meta:I,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[j]||I:void 0}validate(I,j){let R;if(typeof I=="string"){if(R=this.getSchema(I),!R)throw new Error(`no schema with key or ref "${I}"`)}else R=this.compile(I);const _=R(j);return"$async"in R||(this.errors=R.errors),_}compile(I,j){const R=this._addSchema(I,j);return R.validate||this._compileSchemaEnv(R)}compileAsync(I,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:R}=this.opts;return _.call(this,I,j);async function _(re,k){await T.call(this,re.$schema);const O=this._addSchema(re,k);return O.validate||N.call(this,O)}async function T(re){re&&!this.getSchema(re)&&await _.call(this,{$ref:re},!0)}async function N(re){try{return this._compileSchemaEnv(re)}catch(k){if(!(k instanceof a.default))throw k;return z.call(this,k),await W.call(this,k.missingSchema),N.call(this,re)}}function z({missingSchema:re,missingRef:k}){if(this.refs[re])throw new Error(`AnySchema ${re} is loaded but ${k} cannot be resolved`)}async function W(re){const k=await ne.call(this,re);this.refs[re]||await T.call(this,k.$schema),this.refs[re]||this.addSchema(k,re,j)}async function ne(re){const k=this._loading[re];if(k)return k;try{return await(this._loading[re]=R(re))}finally{delete this._loading[re]}}}addSchema(I,j,R,_=this.opts.validateSchema){if(Array.isArray(I)){for(const N of I)this.addSchema(N,void 0,R,_);return this}let T;if(typeof I=="object"){const{schemaId:N}=this.opts;if(T=I[N],T!==void 0&&typeof T!="string")throw new Error(`schema ${N} must be string`)}return j=(0,u.normalizeId)(j||T),this._checkUnique(j),this.schemas[j]=this._addSchema(I,R,j,_,!0),this}addMetaSchema(I,j,R=this.opts.validateSchema){return this.addSchema(I,j,!0,R),this}validateSchema(I,j){if(typeof I=="boolean")return!0;let R;if(R=I.$schema,R!==void 0&&typeof R!="string")throw new Error("$schema must be a string");if(R=R||this.opts.defaultMeta||this.defaultMeta(),!R)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(R,I);if(!_&&j){const T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw new Error(T)}return _}getSchema(I){let j;for(;typeof(j=b.call(this,I))=="string";)I=j;if(j===void 0){const{schemaId:R}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:R});if(j=i.resolveSchema.call(this,_,I),!j)return;this.refs[I]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=b.call(this,I);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{const j=I;this._cache.delete(j);let R=I[this.opts.schemaId];return R&&(R=(0,u.normalizeId)(R),delete this.schemas[R],delete this.refs[R]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(const j of I)this.addKeyword(j);return this}addKeyword(I,j){let R;if(typeof I=="string")R=I,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=R);else if(typeof I=="object"&&j===void 0){if(j=I,R=j.keyword,Array.isArray(R)&&!R.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(x.call(this,R,j),!j)return(0,h.eachItem)(R,T=>ae.call(this,T)),this;ve.call(this,j);const _={...j,type:(0,m.getJSONTypes)(j.type),schemaType:(0,m.getJSONTypes)(j.schemaType)};return(0,h.eachItem)(R,_.type.length===0?T=>ae.call(this,T,_):T=>_.type.forEach(N=>ae.call(this,T,_,N))),this}getKeyword(I){const j=this.RULES.all[I];return typeof j=="object"?j.definition:!!j}removeKeyword(I){const{RULES:j}=this;delete j.keywords[I],delete j.all[I];for(const R of j.rules){const _=R.rules.findIndex(T=>T.keyword===I);_>=0&&R.rules.splice(_,1)}return this}addFormat(I,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[I]=j,this}errorsText(I=this.errors,{separator:j=", ",dataVar:R="data"}={}){return!I||I.length===0?"No errors":I.map(_=>`${R}${_.instancePath} ${_.message}`).reduce((_,T)=>_+j+T)}$dataMetaSchema(I,j){const R=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(const _ of j){const T=_.split("/").slice(1);let N=I;for(const z of T)N=N[z];for(const z in R){const W=R[z];if(typeof W!="object")continue;const{$data:ne}=W.definition,re=N[z];ne&&re&&(N[z]=Ie(re))}}return I}_removeAllSchemas(I,j){for(const R in I){const _=I[R];(!j||j.test(R))&&(typeof _=="string"?delete I[R]:_&&!_.meta&&(this._cache.delete(_.schema),delete I[R]))}}_addSchema(I,j,R,_=this.opts.validateSchema,T=this.opts.addUsedSchema){let N;const{schemaId:z}=this.opts;if(typeof I=="object")N=I[z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let W=this._cache.get(I);if(W!==void 0)return W;R=(0,u.normalizeId)(N||R);const ne=u.getSchemaRefs.call(this,I,R);return W=new i.SchemaEnv({schema:I,schemaId:z,meta:j,baseId:R,localRefs:ne}),this._cache.set(W.schema,W),T&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=W),_&&this.validateSchema(I,!0),W}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=j}}}S.ValidationError=s.default,S.MissingRefError=a.default,t.default=S;function f(L,I,j,R="error"){for(const _ in L){const T=_;T in I&&this.logger[R](`${j}: option ${_}. ${L[T]}`)}}function b(L){return L=(0,u.normalizeId)(L),this.schemas[L]||this.refs[L]}function E(){const L=this.opts.schemas;if(L)if(Array.isArray(L))this.addSchema(L);else for(const I in L)this.addSchema(L[I],I)}function C(){for(const L in this.opts.formats){const I=this.opts.formats[L];I&&this.addFormat(L,I)}}function D(L){if(Array.isArray(L)){this.addVocabulary(L);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const I in L){const j=L[I];j.keyword||(j.keyword=I),this.addKeyword(j)}}function V(){const L={...this.opts};for(const I of v)delete L[I];return L}const q={log(){},warn(){},error(){}};function H(L){if(L===!1)return q;if(L===void 0)return console;if(L.log&&L.warn&&L.error)return L;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function x(L,I){const{RULES:j}=this;if((0,h.eachItem)(L,R=>{if(j.keywords[R])throw new Error(`Keyword ${R} is already defined`);if(!F.test(R))throw new Error(`Keyword ${R} has invalid name`)}),!!I&&I.$data&&!("code"in I||"validate"in I))throw new Error('$data keyword must have "code" or "validate" function')}function ae(L,I,j){var R;const _=I?.post;if(j&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:T}=this;let N=_?T.post:T.rules.find(({type:W})=>W===j);if(N||(N={type:j,rules:[]},T.rules.push(N)),T.keywords[L]=!0,!I)return;const z={keyword:L,definition:{...I,type:(0,m.getJSONTypes)(I.type),schemaType:(0,m.getJSONTypes)(I.schemaType)}};I.before?_e.call(this,N,z,I.before):N.rules.push(z),T.all[L]=z,(R=I.implements)===null||R===void 0||R.forEach(W=>this.addKeyword(W))}function _e(L,I,j){const R=L.rules.findIndex(_=>_.keyword===j);R>=0?L.rules.splice(R,0,I):(L.rules.push(I),this.logger.warn(`rule ${j} is not defined`))}function ve(L){let{metaSchema:I}=L;I!==void 0&&(L.$data&&this.opts.$data&&(I=Ie(I)),L.validateSchema=this.compile(I,!0))}const ce={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(L){return{anyOf:[L,ce]}}})(kr)),kr}var kt={},Pt={},It={},As;function Jo(){if(As)return It;As=1,Object.defineProperty(It,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return It.default=t,It}var Ue={},Ds;function Bo(){if(Ds)return Ue;Ds=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.callRef=Ue.getValidate=void 0;const t=Sr(),e=qe(),r=Y(),s=Fe(),a=Yr(),n=se(),i={keyword:"$ref",schemaType:"string",code(m){const{gen:h,schema:$,it:g}=m,{baseId:y,schemaEnv:v,validateName:w,opts:l,self:p}=g,{root:c}=v;if(($==="#"||$==="#/")&&y===c.baseId)return S();const d=a.resolveRef.call(p,c,y,$);if(d===void 0)throw new t.default(g.opts.uriResolver,y,$);if(d instanceof a.SchemaEnv)return f(d);return b(d);function S(){if(v===c)return u(m,w,v,v.$async);const E=h.scopeValue("root",{ref:c});return u(m,(0,r._)`${E}.validate`,c,c.$async)}function f(E){const C=o(m,E);u(m,C,E,E.$async)}function b(E){const C=h.scopeValue("schema",l.code.source===!0?{ref:E,code:(0,r.stringify)(E)}:{ref:E}),D=h.name("valid"),V=m.subschema({schema:E,dataTypes:[],schemaPath:r.nil,topSchemaRef:C,errSchemaPath:$},D);m.mergeEvaluated(V),m.ok(D)}}};function o(m,h){const{gen:$}=m;return h.validate?$.scopeValue("validate",{ref:h.validate}):(0,r._)`${$.scopeValue("wrapper",{ref:h})}.validate`}Ue.getValidate=o;function u(m,h,$,g){const{gen:y,it:v}=m,{allErrors:w,schemaEnv:l,opts:p}=v,c=p.passContext?s.default.this:r.nil;g?d():S();function d(){if(!l.$async)throw new Error("async schema referenced by sync schema");const E=y.let("valid");y.try(()=>{y.code((0,r._)`await ${(0,e.callValidateCode)(m,h,c)}`),b(h),w||y.assign(E,!0)},C=>{y.if((0,r._)`!(${C} instanceof ${v.ValidationError})`,()=>y.throw(C)),f(C),w||y.assign(E,!1)}),m.ok(E)}function S(){m.result((0,e.callValidateCode)(m,h,c),()=>b(h),()=>f(h))}function f(E){const C=(0,r._)`${E}.errors`;y.assign(s.default.vErrors,(0,r._)`${s.default.vErrors} === null ? ${C} : ${s.default.vErrors}.concat(${C})`),y.assign(s.default.errors,(0,r._)`${s.default.vErrors}.length`)}function b(E){var C;if(!v.opts.unevaluated)return;const D=(C=$?.validate)===null||C===void 0?void 0:C.evaluated;if(v.props!==!0)if(D&&!D.dynamicProps)D.props!==void 0&&(v.props=n.mergeEvaluated.props(y,D.props,v.props));else{const V=y.var("props",(0,r._)`${E}.evaluated.props`);v.props=n.mergeEvaluated.props(y,V,v.props,r.Name)}if(v.items!==!0)if(D&&!D.dynamicItems)D.items!==void 0&&(v.items=n.mergeEvaluated.items(y,D.items,v.items));else{const V=y.var("items",(0,r._)`${E}.evaluated.items`);v.items=n.mergeEvaluated.items(y,V,v.items,r.Name)}}}return Ue.callRef=u,Ue.default=i,Ue}var Ls;function Qo(){if(Ls)return Pt;Ls=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=Jo(),e=Bo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Pt.default=r,Pt}var Ot={},Rt={},Us;function Zo(){if(Us)return Rt;Us=1,Object.defineProperty(Rt,"__esModule",{value:!0});const t=Y(),e=t.operators,r={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},s={message:({keyword:n,schemaCode:i})=>(0,t.str)`must be ${r[n].okStr} ${i}`,params:({keyword:n,schemaCode:i})=>(0,t._)`{comparison: ${r[n].okStr}, limit: ${i}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:s,code(n){const{keyword:i,data:o,schemaCode:u}=n;n.fail$data((0,t._)`${o} ${r[i].fail} ${u} || isNaN(${o})`)}};return Rt.default=a,Rt}var Ct={},Hs;function Yo(){if(Hs)return Ct;Hs=1,Object.defineProperty(Ct,"__esModule",{value:!0});const t=Y(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:s})=>(0,t.str)`must be multiple of ${s}`,params:({schemaCode:s})=>(0,t._)`{multipleOf: ${s}}`},code(s){const{gen:a,data:n,schemaCode:i,it:o}=s,u=o.opts.multipleOfPrecision,m=a.let("res"),h=u?(0,t._)`Math.abs(Math.round(${m}) - ${m}) > 1e-${u}`:(0,t._)`${m} !== parseInt(${m})`;s.fail$data((0,t._)`(${i} === 0 || (${m} = ${n}/${i}, ${h}))`)}};return Ct.default=r,Ct}var Nt={},qt={},Vs;function Xo(){if(Vs)return qt;Vs=1,Object.defineProperty(qt,"__esModule",{value:!0});function t(e){const r=e.length;let s=0,a=0,n;for(;a<r;)s++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<r&&(n=e.charCodeAt(a),(n&64512)===56320&&a++);return s}return qt.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',qt}var Fs;function ei(){if(Fs)return Nt;Fs=1,Object.defineProperty(Nt,"__esModule",{value:!0});const t=Y(),e=se(),r=Xo(),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const o=n==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${i} characters`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,data:o,schemaCode:u,it:m}=n,h=i==="maxLength"?t.operators.GT:t.operators.LT,$=m.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.useFunc)(n.gen,r.default)}(${o})`;n.fail$data((0,t._)`${$} ${h} ${u}`)}};return Nt.default=a,Nt}var Mt={},xs;function ti(){if(xs)return Mt;xs=1,Object.defineProperty(Mt,"__esModule",{value:!0});const t=qe(),e=Y(),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must match pattern "${a}"`,params:({schemaCode:a})=>(0,e._)`{pattern: ${a}}`},code(a){const{data:n,$data:i,schema:o,schemaCode:u,it:m}=a,h=m.opts.unicodeRegExp?"u":"",$=i?(0,e._)`(new RegExp(${u}, ${h}))`:(0,t.usePattern)(a,o);a.fail$data((0,e._)`!${$}.test(${n})`)}};return Mt.default=s,Mt}var jt={},zs;function ri(){if(zs)return jt;zs=1,Object.defineProperty(jt,"__esModule",{value:!0});const t=Y(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const n=s==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${n} than ${a} properties`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:n,schemaCode:i}=s,o=a==="maxProperties"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`Object.keys(${n}).length ${o} ${i}`)}};return jt.default=r,jt}var At={},Ks;function si(){if(Ks)return At;Ks=1,Object.defineProperty(At,"__esModule",{value:!0});const t=qe(),e=Y(),r=se(),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:n}})=>(0,e.str)`must have required property '${n}'`,params:({params:{missingProperty:n}})=>(0,e._)`{missingProperty: ${n}}`},code(n){const{gen:i,schema:o,schemaCode:u,data:m,$data:h,it:$}=n,{opts:g}=$;if(!h&&o.length===0)return;const y=o.length>=g.loopRequired;if($.allErrors?v():w(),g.strictRequired){const c=n.parentSchema.properties,{definedProperties:d}=n.it;for(const S of o)if(c?.[S]===void 0&&!d.has(S)){const f=$.schemaEnv.baseId+$.errSchemaPath,b=`required property "${S}" is not defined at "${f}" (strictRequired)`;(0,r.checkStrictMode)($,b,$.opts.strictRequired)}}function v(){if(y||h)n.block$data(e.nil,l);else for(const c of o)(0,t.checkReportMissingProp)(n,c)}function w(){const c=i.let("missing");if(y||h){const d=i.let("valid",!0);n.block$data(d,()=>p(c,d)),n.ok(d)}else i.if((0,t.checkMissingProp)(n,o,c)),(0,t.reportMissingProp)(n,c),i.else()}function l(){i.forOf("prop",u,c=>{n.setParams({missingProperty:c}),i.if((0,t.noPropertyInData)(i,m,c,g.ownProperties),()=>n.error())})}function p(c,d){n.setParams({missingProperty:c}),i.forOf(c,u,()=>{i.assign(d,(0,t.propertyInData)(i,m,c,g.ownProperties)),i.if((0,e.not)(d),()=>{n.error(),i.break()})},e.nil)}}};return At.default=a,At}var Dt={},Ws;function ni(){if(Ws)return Dt;Ws=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=Y(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const n=s==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${n} than ${a} items`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:n,schemaCode:i}=s,o=a==="maxItems"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`${n}.length ${o} ${i}`)}};return Dt.default=r,Dt}var Lt={},Ut={},Gs;function Xr(){if(Gs)return Ut;Gs=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=Hn();return t.code='require("ajv/dist/runtime/equal").default',Ut.default=t,Ut}var Js;function ai(){if(Js)return Lt;Js=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t=pr(),e=Y(),r=se(),s=Xr(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${i} are identical)`,params:({params:{i,j:o}})=>(0,e._)`{i: ${i}, j: ${o}}`},code(i){const{gen:o,data:u,$data:m,schema:h,parentSchema:$,schemaCode:g,it:y}=i;if(!m&&!h)return;const v=o.let("valid"),w=$.items?(0,t.getSchemaTypes)($.items):[];i.block$data(v,l,(0,e._)`${g} === false`),i.ok(v);function l(){const S=o.let("i",(0,e._)`${u}.length`),f=o.let("j");i.setParams({i:S,j:f}),o.assign(v,!0),o.if((0,e._)`${S} > 1`,()=>(p()?c:d)(S,f))}function p(){return w.length>0&&!w.some(S=>S==="object"||S==="array")}function c(S,f){const b=o.name("item"),E=(0,t.checkDataTypes)(w,b,y.opts.strictNumbers,t.DataType.Wrong),C=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${S}--;`,()=>{o.let(b,(0,e._)`${u}[${S}]`),o.if(E,(0,e._)`continue`),w.length>1&&o.if((0,e._)`typeof ${b} == "string"`,(0,e._)`${b} += "_"`),o.if((0,e._)`typeof ${C}[${b}] == "number"`,()=>{o.assign(f,(0,e._)`${C}[${b}]`),i.error(),o.assign(v,!1).break()}).code((0,e._)`${C}[${b}] = ${S}`)})}function d(S,f){const b=(0,r.useFunc)(o,s.default),E=o.name("outer");o.label(E).for((0,e._)`;${S}--;`,()=>o.for((0,e._)`${f} = ${S}; ${f}--;`,()=>o.if((0,e._)`${b}(${u}[${S}], ${u}[${f}])`,()=>{i.error(),o.assign(v,!1).break(E)})))}}};return Lt.default=n,Lt}var Ht={},Bs;function oi(){if(Bs)return Ht;Bs=1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=Y(),e=se(),r=Xr(),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:n})=>(0,t._)`{allowedValue: ${n}}`},code(n){const{gen:i,data:o,$data:u,schemaCode:m,schema:h}=n;u||h&&typeof h=="object"?n.fail$data((0,t._)`!${(0,e.useFunc)(i,r.default)}(${o}, ${m})`):n.fail((0,t._)`${h} !== ${o}`)}};return Ht.default=a,Ht}var Vt={},Qs;function ii(){if(Qs)return Vt;Qs=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=Y(),e=se(),r=Xr(),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:n})=>(0,t._)`{allowedValues: ${n}}`},code(n){const{gen:i,data:o,$data:u,schema:m,schemaCode:h,it:$}=n;if(!u&&m.length===0)throw new Error("enum must have non-empty array");const g=m.length>=$.opts.loopEnum;let y;const v=()=>y??(y=(0,e.useFunc)(i,r.default));let w;if(g||u)w=i.let("valid"),n.block$data(w,l);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const c=i.const("vSchema",h);w=(0,t.or)(...m.map((d,S)=>p(c,S)))}n.pass(w);function l(){i.assign(w,!1),i.forOf("v",h,c=>i.if((0,t._)`${v()}(${o}, ${c})`,()=>i.assign(w,!0).break()))}function p(c,d){const S=m[d];return typeof S=="object"&&S!==null?(0,t._)`${v()}(${o}, ${c}[${d}])`:(0,t._)`${o} === ${S}`}}};return Vt.default=a,Vt}var Zs;function ci(){if(Zs)return Ot;Zs=1,Object.defineProperty(Ot,"__esModule",{value:!0});const t=Zo(),e=Yo(),r=ei(),s=ti(),a=ri(),n=si(),i=ni(),o=ai(),u=oi(),m=ii(),h=[t.default,e.default,r.default,s.default,a.default,n.default,i.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,m.default];return Ot.default=h,Ot}var Ft={},Xe={},Ys;function Fn(){if(Ys)return Xe;Ys=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateAdditionalItems=void 0;const t=Y(),e=se(),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){const{parentSchema:i,it:o}=n,{items:u}=i;if(!Array.isArray(u)){(0,e.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas');return}a(n,u)}};function a(n,i){const{gen:o,schema:u,data:m,keyword:h,it:$}=n;$.items=!0;const g=o.const("len",(0,t._)`${m}.length`);if(u===!1)n.setParams({len:i.length}),n.pass((0,t._)`${g} <= ${i.length}`);else if(typeof u=="object"&&!(0,e.alwaysValidSchema)($,u)){const v=o.var("valid",(0,t._)`${g} <= ${i.length}`);o.if((0,t.not)(v),()=>y(v)),n.ok(v)}function y(v){o.forRange("i",i.length,g,w=>{n.subschema({keyword:h,dataProp:w,dataPropType:e.Type.Num},v),$.allErrors||o.if((0,t.not)(v),()=>o.break())})}}return Xe.validateAdditionalItems=a,Xe.default=s,Xe}var xt={},et={},Xs;function xn(){if(Xs)return et;Xs=1,Object.defineProperty(et,"__esModule",{value:!0}),et.validateTuple=void 0;const t=Y(),e=se(),r=qe(),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(n){const{schema:i,it:o}=n;if(Array.isArray(i))return a(n,"additionalItems",i);o.items=!0,!(0,e.alwaysValidSchema)(o,i)&&n.ok((0,r.validateArray)(n))}};function a(n,i,o=n.schema){const{gen:u,parentSchema:m,data:h,keyword:$,it:g}=n;w(m),g.opts.unevaluated&&o.length&&g.items!==!0&&(g.items=e.mergeEvaluated.items(u,o.length,g.items));const y=u.name("valid"),v=u.const("len",(0,t._)`${h}.length`);o.forEach((l,p)=>{(0,e.alwaysValidSchema)(g,l)||(u.if((0,t._)`${v} > ${p}`,()=>n.subschema({keyword:$,schemaProp:p,dataProp:p},y)),n.ok(y))});function w(l){const{opts:p,errSchemaPath:c}=g,d=o.length,S=d===l.minItems&&(d===l.maxItems||l[i]===!1);if(p.strictTuples&&!S){const f=`"${$}" is ${d}-tuple, but minItems or maxItems/${i} are not specified or different at path "${c}"`;(0,e.checkStrictMode)(g,f,p.strictTuples)}}}return et.validateTuple=a,et.default=s,et}var en;function ui(){if(en)return xt;en=1,Object.defineProperty(xt,"__esModule",{value:!0});const t=xn(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return xt.default=e,xt}var zt={},tn;function li(){if(tn)return zt;tn=1,Object.defineProperty(zt,"__esModule",{value:!0});const t=Y(),e=se(),r=qe(),s=Fn(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{schema:o,parentSchema:u,it:m}=i,{prefixItems:h}=u;m.items=!0,!(0,e.alwaysValidSchema)(m,o)&&(h?(0,s.validateAdditionalItems)(i,h):i.ok((0,r.validateArray)(i)))}};return zt.default=n,zt}var Kt={},rn;function di(){if(rn)return Kt;rn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:a,max:n}})=>n===void 0?(0,t.str)`must contain at least ${a} valid item(s)`:(0,t.str)`must contain at least ${a} and no more than ${n} valid item(s)`,params:({params:{min:a,max:n}})=>n===void 0?(0,t._)`{minContains: ${a}}`:(0,t._)`{minContains: ${a}, maxContains: ${n}}`},code(a){const{gen:n,schema:i,parentSchema:o,data:u,it:m}=a;let h,$;const{minContains:g,maxContains:y}=o;m.opts.next?(h=g===void 0?1:g,$=y):h=1;const v=n.const("len",(0,t._)`${u}.length`);if(a.setParams({min:h,max:$}),$===void 0&&h===0){(0,e.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if($!==void 0&&h>$){(0,e.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),a.fail();return}if((0,e.alwaysValidSchema)(m,i)){let d=(0,t._)`${v} >= ${h}`;$!==void 0&&(d=(0,t._)`${d} && ${v} <= ${$}`),a.pass(d);return}m.items=!0;const w=n.name("valid");$===void 0&&h===1?p(w,()=>n.if(w,()=>n.break())):h===0?(n.let(w,!0),$!==void 0&&n.if((0,t._)`${u}.length > 0`,l)):(n.let(w,!1),l()),a.result(w,()=>a.reset());function l(){const d=n.name("_valid"),S=n.let("count",0);p(d,()=>n.if(d,()=>c(S)))}function p(d,S){n.forRange("i",0,v,f=>{a.subschema({keyword:"contains",dataProp:f,dataPropType:e.Type.Num,compositeRule:!0},d),S()})}function c(d){n.code((0,t._)`${d}++`),$===void 0?n.if((0,t._)`${d} >= ${h}`,()=>n.assign(w,!0).break()):(n.if((0,t._)`${d} > ${$}`,()=>n.assign(w,!1).break()),h===1?n.assign(w,!0):n.if((0,t._)`${d} >= ${h}`,()=>n.assign(w,!0)))}}};return Kt.default=s,Kt}var jr={},sn;function fi(){return sn||(sn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Y(),r=se(),s=qe();t.error={message:({params:{property:u,depsCount:m,deps:h}})=>{const $=m===1?"property":"properties";return(0,e.str)`must have ${$} ${h} when property ${u} is present`},params:({params:{property:u,depsCount:m,deps:h,missingProperty:$}})=>(0,e._)`{property: ${u},
|
|
5
|
+
|| ${C} === "boolean" || ${b} === null`).assign(D,(0,s._)`[${b}]`)}}}function g({gen:c,parentData:d,parentDataProperty:S},f){c.if((0,s._)`${d} !== undefined`,()=>c.assign((0,s._)`${d}[${S}]`,f))}function y(c,d,S,f=n.Correct){const b=f===n.Correct?s.operators.EQ:s.operators.NEQ;let E;switch(c){case"null":return(0,s._)`${d} ${b} null`;case"array":E=(0,s._)`Array.isArray(${d})`;break;case"object":E=(0,s._)`${d} && typeof ${d} == "object" && !Array.isArray(${d})`;break;case"integer":E=C((0,s._)`!(${d} % 1) && !isNaN(${d})`);break;case"number":E=C();break;default:return(0,s._)`typeof ${d} ${b} ${c}`}return f===n.Correct?E:(0,s.not)(E);function C(D=s.nil){return(0,s.and)((0,s._)`typeof ${d} == "number"`,D,S?(0,s._)`isFinite(${d})`:s.nil)}}me.checkDataType=y;function v(c,d,S,f){if(c.length===1)return y(c[0],d,S,f);let b;const E=(0,a.toHash)(c);if(E.array&&E.object){const C=(0,s._)`typeof ${d} != "object"`;b=E.null?C:(0,s._)`!${d} || ${C}`,delete E.null,delete E.array,delete E.object}else b=s.nil;E.number&&delete E.integer;for(const C in E)b=(0,s.and)(b,y(C,d,S,f));return b}me.checkDataTypes=v;const w={message:({schema:c})=>`must be ${c}`,params:({schema:c,schemaValue:d})=>typeof c=="string"?(0,s._)`{type: ${c}}`:(0,s._)`{type: ${d}}`};function l(c){const d=p(c);(0,r.reportError)(d,w)}me.reportTypeError=l;function p(c){const{gen:d,data:S,schema:f}=c,b=(0,a.schemaRefOrVal)(c,f,"type");return{gen:d,keyword:"type",data:S,schema:f.type,schemaCode:b,schemaValue:b,parentSchema:f,params:{},it:c}}return me}var ut={},vs;function No(){if(vs)return ut;vs=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.assignDefaults=void 0;const t=Y(),e=se();function r(a,n){const{properties:i,items:o}=a.schema;if(n==="object"&&i)for(const u in i)s(a,u,i[u].default);else n==="array"&&Array.isArray(o)&&o.forEach((u,m)=>s(a,m,u.default))}ut.assignDefaults=r;function s(a,n,i){const{gen:o,compositeRule:u,data:m,opts:h}=a;if(i===void 0)return;const $=(0,t._)`${m}${(0,t.getProperty)(n)}`;if(u){(0,e.checkStrictMode)(a,`default is ignored for: ${$}`);return}let g=(0,t._)`${$} === undefined`;h.useDefaults==="empty"&&(g=(0,t._)`${g} || ${$} === null || ${$} === ""`),o.if(g,(0,t._)`${$} = ${(0,t.stringify)(i)}`)}return ut}var Re={},ie={},bs;function qe(){if(bs)return ie;bs=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.validateUnion=ie.validateArray=ie.usePattern=ie.callValidateCode=ie.schemaProperties=ie.allSchemaProperties=ie.noPropertyInData=ie.propertyInData=ie.isOwnProperty=ie.hasPropFunc=ie.reportMissingProp=ie.checkMissingProp=ie.checkReportMissingProp=void 0;const t=Y(),e=se(),r=Fe(),s=se();function a(c,d){const{gen:S,data:f,it:b}=c;S.if(h(S,f,d,b.opts.ownProperties),()=>{c.setParams({missingProperty:(0,t._)`${d}`},!0),c.error()})}ie.checkReportMissingProp=a;function n({gen:c,data:d,it:{opts:S}},f,b){return(0,t.or)(...f.map(E=>(0,t.and)(h(c,d,E,S.ownProperties),(0,t._)`${b} = ${E}`)))}ie.checkMissingProp=n;function i(c,d){c.setParams({missingProperty:d},!0),c.error()}ie.reportMissingProp=i;function o(c){return c.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ie.hasPropFunc=o;function u(c,d,S){return(0,t._)`${o(c)}.call(${d}, ${S})`}ie.isOwnProperty=u;function m(c,d,S,f){const b=(0,t._)`${d}${(0,t.getProperty)(S)} !== undefined`;return f?(0,t._)`${b} && ${u(c,d,S)}`:b}ie.propertyInData=m;function h(c,d,S,f){const b=(0,t._)`${d}${(0,t.getProperty)(S)} === undefined`;return f?(0,t.or)(b,(0,t.not)(u(c,d,S))):b}ie.noPropertyInData=h;function $(c){return c?Object.keys(c).filter(d=>d!=="__proto__"):[]}ie.allSchemaProperties=$;function g(c,d){return $(d).filter(S=>!(0,e.alwaysValidSchema)(c,d[S]))}ie.schemaProperties=g;function y({schemaCode:c,data:d,it:{gen:S,topSchemaRef:f,schemaPath:b,errorPath:E},it:C},D,V,q){const H=q?(0,t._)`${c}, ${d}, ${f}${b}`:d,F=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,E)],[r.default.parentData,C.parentData],[r.default.parentDataProperty,C.parentDataProperty],[r.default.rootData,r.default.rootData]];C.opts.dynamicRef&&F.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const x=(0,t._)`${H}, ${S.object(...F)}`;return V!==t.nil?(0,t._)`${D}.call(${V}, ${x})`:(0,t._)`${D}(${x})`}ie.callValidateCode=y;const v=(0,t._)`new RegExp`;function w({gen:c,it:{opts:d}},S){const f=d.unicodeRegExp?"u":"",{regExp:b}=d.code,E=b(S,f);return c.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${b.code==="new RegExp"?v:(0,s.useFunc)(c,b)}(${S}, ${f})`})}ie.usePattern=w;function l(c){const{gen:d,data:S,keyword:f,it:b}=c,E=d.name("valid");if(b.allErrors){const D=d.let("valid",!0);return C(()=>d.assign(D,!1)),D}return d.var(E,!0),C(()=>d.break()),E;function C(D){const V=d.const("len",(0,t._)`${S}.length`);d.forRange("i",0,V,q=>{c.subschema({keyword:f,dataProp:q,dataPropType:e.Type.Num},E),d.if((0,t.not)(E),D)})}}ie.validateArray=l;function p(c){const{gen:d,schema:S,keyword:f,it:b}=c;if(!Array.isArray(S))throw new Error("ajv implementation error");if(S.some(V=>(0,e.alwaysValidSchema)(b,V))&&!b.opts.unevaluated)return;const C=d.let("valid",!1),D=d.name("_valid");d.block(()=>S.forEach((V,q)=>{const H=c.subschema({keyword:f,schemaProp:q,compositeRule:!0},D);d.assign(C,(0,t._)`${C} || ${D}`),c.mergeValidEvaluated(H,D)||d.if((0,t.not)(C))})),c.result(C,()=>c.reset(),()=>c.error(!0))}return ie.validateUnion=p,ie}var ws;function qo(){if(ws)return Re;ws=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.validateKeywordUsage=Re.validSchemaType=Re.funcKeywordCode=Re.macroKeywordCode=void 0;const t=Y(),e=Fe(),r=qe(),s=_r();function a(g,y){const{gen:v,keyword:w,schema:l,parentSchema:p,it:c}=g,d=y.macro.call(c.self,l,p,c),S=m(v,w,d);c.opts.validateSchema!==!1&&c.self.validateSchema(d,!0);const f=v.name("valid");g.subschema({schema:d,schemaPath:t.nil,errSchemaPath:`${c.errSchemaPath}/${w}`,topSchemaRef:S,compositeRule:!0},f),g.pass(f,()=>g.error(!0))}Re.macroKeywordCode=a;function n(g,y){var v;const{gen:w,keyword:l,schema:p,parentSchema:c,$data:d,it:S}=g;u(S,y);const f=!d&&y.compile?y.compile.call(S.self,p,c,S):y.validate,b=m(w,l,f),E=w.let("valid");g.block$data(E,C),g.ok((v=y.valid)!==null&&v!==void 0?v:E);function C(){if(y.errors===!1)q(),y.modifying&&i(g),H(()=>g.error());else{const F=y.async?D():V();y.modifying&&i(g),H(()=>o(g,F))}}function D(){const F=w.let("ruleErrs",null);return w.try(()=>q((0,t._)`await `),x=>w.assign(E,!1).if((0,t._)`${x} instanceof ${S.ValidationError}`,()=>w.assign(F,(0,t._)`${x}.errors`),()=>w.throw(x))),F}function V(){const F=(0,t._)`${b}.errors`;return w.assign(F,null),q(t.nil),F}function q(F=y.async?(0,t._)`await `:t.nil){const x=S.opts.passContext?e.default.this:e.default.self,ae=!("compile"in y&&!d||y.schema===!1);w.assign(E,(0,t._)`${F}${(0,r.callValidateCode)(g,b,x,ae)}`,y.modifying)}function H(F){var x;w.if((0,t.not)((x=y.valid)!==null&&x!==void 0?x:E),F)}}Re.funcKeywordCode=n;function i(g){const{gen:y,data:v,it:w}=g;y.if(w.parentData,()=>y.assign(v,(0,t._)`${w.parentData}[${w.parentDataProperty}]`))}function o(g,y){const{gen:v}=g;v.if((0,t._)`Array.isArray(${y})`,()=>{v.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${y} : ${e.default.vErrors}.concat(${y})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,s.extendErrors)(g)},()=>g.error())}function u({schemaEnv:g},y){if(y.async&&!g.$async)throw new Error("async keyword in sync schema")}function m(g,y,v){if(v===void 0)throw new Error(`keyword "${y}" failed to compile`);return g.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,t.stringify)(v)})}function h(g,y,v=!1){return!y.length||y.some(w=>w==="array"?Array.isArray(g):w==="object"?g&&typeof g=="object"&&!Array.isArray(g):typeof g==w||v&&typeof g>"u")}Re.validSchemaType=h;function $({schema:g,opts:y,self:v,errSchemaPath:w},l,p){if(Array.isArray(l.keyword)?!l.keyword.includes(p):l.keyword!==p)throw new Error("ajv implementation error");const c=l.dependencies;if(c?.some(d=>!Object.prototype.hasOwnProperty.call(g,d)))throw new Error(`parent schema must have dependencies of ${p}: ${c.join(",")}`);if(l.validateSchema&&!l.validateSchema(g[p])){const S=`keyword "${p}" value is invalid at path "${w}": `+v.errorsText(l.validateSchema.errors);if(y.validateSchema==="log")v.logger.error(S);else throw new Error(S)}}return Re.validateKeywordUsage=$,Re}var Ae={},Ss;function Mo(){if(Ss)return Ae;Ss=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.extendSubschemaMode=Ae.extendSubschemaData=Ae.getSubschema=void 0;const t=Y(),e=se();function r(n,{keyword:i,schemaProp:o,schema:u,schemaPath:m,errSchemaPath:h,topSchemaRef:$}){if(i!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const g=n.schema[i];return o===void 0?{schema:g,schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(i)}`,errSchemaPath:`${n.errSchemaPath}/${i}`}:{schema:g[o],schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(i)}${(0,t.getProperty)(o)}`,errSchemaPath:`${n.errSchemaPath}/${i}/${(0,e.escapeFragment)(o)}`}}if(u!==void 0){if(m===void 0||h===void 0||$===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:m,topSchemaRef:$,errSchemaPath:h}}throw new Error('either "keyword" or "schema" must be passed')}Ae.getSubschema=r;function s(n,i,{dataProp:o,dataPropType:u,data:m,dataTypes:h,propertyName:$}){if(m!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:g}=i;if(o!==void 0){const{errorPath:v,dataPathArr:w,opts:l}=i,p=g.let("data",(0,t._)`${i.data}${(0,t.getProperty)(o)}`,!0);y(p),n.errorPath=(0,t.str)`${v}${(0,e.getErrorPath)(o,u,l.jsPropertySyntax)}`,n.parentDataProperty=(0,t._)`${o}`,n.dataPathArr=[...w,n.parentDataProperty]}if(m!==void 0){const v=m instanceof t.Name?m:g.let("data",m,!0);y(v),$!==void 0&&(n.propertyName=$)}h&&(n.dataTypes=h);function y(v){n.data=v,n.dataLevel=i.dataLevel+1,n.dataTypes=[],i.definedProperties=new Set,n.parentData=i.data,n.dataNames=[...i.dataNames,v]}}Ae.extendSubschemaData=s;function a(n,{jtdDiscriminator:i,jtdMetadata:o,compositeRule:u,createErrors:m,allErrors:h}){u!==void 0&&(n.compositeRule=u),m!==void 0&&(n.createErrors=m),h!==void 0&&(n.allErrors=h),n.jtdDiscriminator=i,n.jtdMetadata=o}return Ae.extendSubschemaMode=a,Ae}var ve={},Rr,$s;function Un(){return $s||($s=1,Rr=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 i=n[a];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}),Rr}var Cr={exports:{}},Es;function jo(){if(Es)return Cr.exports;Es=1;var t=Cr.exports=function(s,a,n){typeof a=="function"&&(n=a,a={}),n=a.cb||n;var i=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};e(a,i,o,s,"",s)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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 e(s,a,n,i,o,u,m,h,$,g){if(i&&typeof i=="object"&&!Array.isArray(i)){a(i,o,u,m,h,$,g);for(var y in i){var v=i[y];if(Array.isArray(v)){if(y in t.arrayKeywords)for(var w=0;w<v.length;w++)e(s,a,n,v[w],o+"/"+y+"/"+w,u,o,y,i,w)}else if(y in t.propsKeywords){if(v&&typeof v=="object")for(var l in v)e(s,a,n,v[l],o+"/"+y+"/"+r(l),u,o,y,i,l)}else(y in t.keywords||s.allKeys&&!(y in t.skipKeywords))&&e(s,a,n,v,o+"/"+y,u,o,y,i)}n(i,o,u,m,h,$,g)}}function r(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}return Cr.exports}var Ts;function vr(){if(Ts)return ve;Ts=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.getSchemaRefs=ve.resolveUrl=ve.normalizeId=ve._getFullPath=ve.getFullPath=ve.inlineRef=void 0;const t=se(),e=Un(),r=jo(),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function a(w,l=!0){return typeof w=="boolean"?!0:l===!0?!i(w):l?o(w)<=l:!1}ve.inlineRef=a;const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(w){for(const l in w){if(n.has(l))return!0;const p=w[l];if(Array.isArray(p)&&p.some(i)||typeof p=="object"&&i(p))return!0}return!1}function o(w){let l=0;for(const p in w){if(p==="$ref")return 1/0;if(l++,!s.has(p)&&(typeof w[p]=="object"&&(0,t.eachItem)(w[p],c=>l+=o(c)),l===1/0))return 1/0}return l}function u(w,l="",p){p!==!1&&(l=$(l));const c=w.parse(l);return m(w,c)}ve.getFullPath=u;function m(w,l){return w.serialize(l).split("#")[0]+"#"}ve._getFullPath=m;const h=/#\/?$/;function $(w){return w?w.replace(h,""):""}ve.normalizeId=$;function g(w,l,p){return p=$(p),w.resolve(l,p)}ve.resolveUrl=g;const y=/^[a-z_][-a-z0-9._]*$/i;function v(w,l){if(typeof w=="boolean")return{};const{schemaId:p,uriResolver:c}=this.opts,d=$(w[p]||l),S={"":d},f=u(c,d,!1),b={},E=new Set;return r(w,{allKeys:!0},(V,q,H,F)=>{if(F===void 0)return;const x=f+q;let ae=S[F];typeof V[p]=="string"&&(ae=ge.call(this,V[p])),_e.call(this,V.$anchor),_e.call(this,V.$dynamicAnchor),S[q]=ae;function ge(ce){const Ie=this.opts.uriResolver.resolve;if(ce=$(ae?Ie(ae,ce):ce),E.has(ce))throw D(ce);E.add(ce);let L=this.refs[ce];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?C(V,L.schema,ce):ce!==$(x)&&(ce[0]==="#"?(C(V,b[ce],ce),b[ce]=V):this.refs[ce]=x),ce}function _e(ce){if(typeof ce=="string"){if(!y.test(ce))throw new Error(`invalid anchor "${ce}"`);ge.call(this,`#${ce}`)}}}),b;function C(V,q,H){if(q!==void 0&&!e(V,q))throw D(H)}function D(V){return new Error(`reference "${V}" resolves to more than one schema`)}}return ve.getSchemaRefs=v,ve}var ks;function br(){if(ks)return Me;ks=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.getData=Me.KeywordCxt=Me.validateFunctionCode=void 0;const t=Co(),e=hr(),r=Ln(),s=hr(),a=No(),n=qo(),i=Mo(),o=Y(),u=Fe(),m=vr(),h=se(),$=_r();function g(k){if(f(k)&&(E(k),S(k))){l(k);return}y(k,()=>(0,t.topBoolOrEmptySchema)(k))}Me.validateFunctionCode=g;function y({gen:k,validateName:O,schema:M,schemaEnv:U,opts:K},X){K.code.es5?k.func(O,(0,o._)`${u.default.data}, ${u.default.valCxt}`,U.$async,()=>{k.code((0,o._)`"use strict"; ${c(M,K)}`),w(k,K),k.code(X)}):k.func(O,(0,o._)`${u.default.data}, ${v(K)}`,U.$async,()=>k.code(c(M,K)).code(X))}function v(k){return(0,o._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${k.dynamicRef?(0,o._)`, ${u.default.dynamicAnchors}={}`:o.nil}}={}`}function w(k,O){k.if(u.default.valCxt,()=>{k.var(u.default.instancePath,(0,o._)`${u.default.valCxt}.${u.default.instancePath}`),k.var(u.default.parentData,(0,o._)`${u.default.valCxt}.${u.default.parentData}`),k.var(u.default.parentDataProperty,(0,o._)`${u.default.valCxt}.${u.default.parentDataProperty}`),k.var(u.default.rootData,(0,o._)`${u.default.valCxt}.${u.default.rootData}`),O.dynamicRef&&k.var(u.default.dynamicAnchors,(0,o._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{k.var(u.default.instancePath,(0,o._)`""`),k.var(u.default.parentData,(0,o._)`undefined`),k.var(u.default.parentDataProperty,(0,o._)`undefined`),k.var(u.default.rootData,u.default.data),O.dynamicRef&&k.var(u.default.dynamicAnchors,(0,o._)`{}`)})}function l(k){const{schema:O,opts:M,gen:U}=k;y(k,()=>{M.$comment&&O.$comment&&F(k),V(k),U.let(u.default.vErrors,null),U.let(u.default.errors,0),M.unevaluated&&p(k),C(k),x(k)})}function p(k){const{gen:O,validateName:M}=k;k.evaluated=O.const("evaluated",(0,o._)`${M}.evaluated`),O.if((0,o._)`${k.evaluated}.dynamicProps`,()=>O.assign((0,o._)`${k.evaluated}.props`,(0,o._)`undefined`)),O.if((0,o._)`${k.evaluated}.dynamicItems`,()=>O.assign((0,o._)`${k.evaluated}.items`,(0,o._)`undefined`))}function c(k,O){const M=typeof k=="object"&&k[O.schemaId];return M&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${M} */`:o.nil}function d(k,O){if(f(k)&&(E(k),S(k))){b(k,O);return}(0,t.boolOrEmptySchema)(k,O)}function S({schema:k,self:O}){if(typeof k=="boolean")return!k;for(const M in k)if(O.RULES.all[M])return!0;return!1}function f(k){return typeof k.schema!="boolean"}function b(k,O){const{schema:M,gen:U,opts:K}=k;K.$comment&&M.$comment&&F(k),q(k),H(k);const X=U.const("_errs",u.default.errors);C(k,X),U.var(O,(0,o._)`${X} === ${u.default.errors}`)}function E(k){(0,h.checkUnknownRules)(k),D(k)}function C(k,O){if(k.opts.jtd)return ge(k,[],!1,O);const M=(0,e.getSchemaTypes)(k.schema),U=(0,e.coerceAndCheckDataType)(k,M);ge(k,M,!U,O)}function D(k){const{schema:O,errSchemaPath:M,opts:U,self:K}=k;O.$ref&&U.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(O,K.RULES)&&K.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function V(k){const{schema:O,opts:M}=k;O.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,h.checkStrictMode)(k,"default is ignored in the schema root")}function q(k){const O=k.schema[k.opts.schemaId];O&&(k.baseId=(0,m.resolveUrl)(k.opts.uriResolver,k.baseId,O))}function H(k){if(k.schema.$async&&!k.schemaEnv.$async)throw new Error("async schema in sync schema")}function F({gen:k,schemaEnv:O,schema:M,errSchemaPath:U,opts:K}){const X=M.$comment;if(K.$comment===!0)k.code((0,o._)`${u.default.self}.logger.log(${X})`);else if(typeof K.$comment=="function"){const he=(0,o.str)`${U}/$comment`,Oe=k.scopeValue("root",{ref:O.root});k.code((0,o._)`${u.default.self}.opts.$comment(${X}, ${he}, ${Oe}.schema)`)}}function x(k){const{gen:O,schemaEnv:M,validateName:U,ValidationError:K,opts:X}=k;M.$async?O.if((0,o._)`${u.default.errors} === 0`,()=>O.return(u.default.data),()=>O.throw((0,o._)`new ${K}(${u.default.vErrors})`)):(O.assign((0,o._)`${U}.errors`,u.default.vErrors),X.unevaluated&&ae(k),O.return((0,o._)`${u.default.errors} === 0`))}function ae({gen:k,evaluated:O,props:M,items:U}){M instanceof o.Name&&k.assign((0,o._)`${O}.props`,M),U instanceof o.Name&&k.assign((0,o._)`${O}.items`,U)}function ge(k,O,M,U){const{gen:K,schema:X,data:he,allErrors:Oe,opts:Se,self:$e}=k,{RULES:pe}=$e;if(X.$ref&&(Se.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(X,pe))){K.block(()=>z(k,"$ref",pe.all.$ref.definition));return}Se.jtd||ce(k,O),K.block(()=>{for(const ke of pe.rules)Ze(ke);Ze(pe.post)});function Ze(ke){(0,r.shouldUseGroup)(X,ke)&&(ke.type?(K.if((0,s.checkDataType)(ke.type,he,Se.strictNumbers)),_e(k,ke),O.length===1&&O[0]===ke.type&&M&&(K.else(),(0,s.reportTypeError)(k)),K.endIf()):_e(k,ke),Oe||K.if((0,o._)`${u.default.errors} === ${U||0}`))}}function _e(k,O){const{gen:M,schema:U,opts:{useDefaults:K}}=k;K&&(0,a.assignDefaults)(k,O.type),M.block(()=>{for(const X of O.rules)(0,r.shouldUseRule)(U,X)&&z(k,X.keyword,X.definition,O.type)})}function ce(k,O){k.schemaEnv.meta||!k.opts.strictTypes||(Ie(k,O),k.opts.allowUnionTypes||L(k,O),I(k,k.dataTypes))}function Ie(k,O){if(O.length){if(!k.dataTypes.length){k.dataTypes=O;return}O.forEach(M=>{R(k.dataTypes,M)||T(k,`type "${M}" not allowed by context "${k.dataTypes.join(",")}"`)}),_(k,O)}}function L(k,O){O.length>1&&!(O.length===2&&O.includes("null"))&&T(k,"use allowUnionTypes to allow union type keyword")}function I(k,O){const M=k.self.RULES.all;for(const U in M){const K=M[U];if(typeof K=="object"&&(0,r.shouldUseRule)(k.schema,K)){const{type:X}=K.definition;X.length&&!X.some(he=>j(O,he))&&T(k,`missing type "${X.join(",")}" for keyword "${U}"`)}}}function j(k,O){return k.includes(O)||O==="number"&&k.includes("integer")}function R(k,O){return k.includes(O)||O==="integer"&&k.includes("number")}function _(k,O){const M=[];for(const U of k.dataTypes)R(O,U)?M.push(U):O.includes("integer")&&U==="number"&&M.push("integer");k.dataTypes=M}function T(k,O){const M=k.schemaEnv.baseId+k.errSchemaPath;O+=` at "${M}" (strictTypes)`,(0,h.checkStrictMode)(k,O,k.opts.strictTypes)}class N{constructor(O,M,U){if((0,n.validateKeywordUsage)(O,M,U),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=U,this.data=O.data,this.schema=O.schema[U],this.$data=M.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(O,this.schema,U,this.$data),this.schemaType=M.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=M,this.$data)this.schemaCode=O.gen.const("vSchema",re(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=O.gen.const("_errs",u.default.errors))}result(O,M,U){this.failResult((0,o.not)(O),M,U)}failResult(O,M,U){this.gen.if(O),U?U():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,M){this.failResult((0,o.not)(O),void 0,M)}fail(O){if(O===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(O),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);const{schemaCode:M}=this;this.fail((0,o._)`${M} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,M,U){if(M){this.setParams(M),this._error(O,U),this.setParams({});return}this._error(O,U)}_error(O,M){(O?$.reportExtraError:$.reportError)(this,this.def.error,M)}$dataError(){(0,$.reportError)(this,this.def.$dataError||$.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,$.resetErrorsCount)(this.gen,this.errsCount)}ok(O){this.allErrors||this.gen.if(O)}setParams(O,M){M?Object.assign(this.params,O):this.params=O}block$data(O,M,U=o.nil){this.gen.block(()=>{this.check$data(O,U),M()})}check$data(O=o.nil,M=o.nil){if(!this.$data)return;const{gen:U,schemaCode:K,schemaType:X,def:he}=this;U.if((0,o.or)((0,o._)`${K} === undefined`,M)),O!==o.nil&&U.assign(O,!0),(X.length||he.validateSchema)&&(U.elseIf(this.invalid$data()),this.$dataError(),O!==o.nil&&U.assign(O,!1)),U.else()}invalid$data(){const{gen:O,schemaCode:M,schemaType:U,def:K,it:X}=this;return(0,o.or)(he(),Oe());function he(){if(U.length){if(!(M instanceof o.Name))throw new Error("ajv implementation error");const Se=Array.isArray(U)?U:[U];return(0,o._)`${(0,s.checkDataTypes)(Se,M,X.opts.strictNumbers,s.DataType.Wrong)}`}return o.nil}function Oe(){if(K.validateSchema){const Se=O.scopeValue("validate$data",{ref:K.validateSchema});return(0,o._)`!${Se}(${M})`}return o.nil}}subschema(O,M){const U=(0,i.getSubschema)(this.it,O);(0,i.extendSubschemaData)(U,this.it,O),(0,i.extendSubschemaMode)(U,O);const K={...this.it,...U,items:void 0,props:void 0};return d(K,M),K}mergeEvaluated(O,M){const{it:U,gen:K}=this;U.opts.unevaluated&&(U.props!==!0&&O.props!==void 0&&(U.props=h.mergeEvaluated.props(K,O.props,U.props,M)),U.items!==!0&&O.items!==void 0&&(U.items=h.mergeEvaluated.items(K,O.items,U.items,M)))}mergeValidEvaluated(O,M){const{it:U,gen:K}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return K.if(M,()=>this.mergeEvaluated(O,o.Name)),!0}}Me.KeywordCxt=N;function z(k,O,M,U){const K=new N(k,M,O);"code"in M?M.code(K,U):K.$data&&M.validate?(0,n.funcKeywordCode)(K,M):"macro"in M?(0,n.macroKeywordCode)(K,M):(M.compile||M.validate)&&(0,n.funcKeywordCode)(K,M)}const W=/^\/(?:[^~]|~0|~1)*$/,ne=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function re(k,{dataLevel:O,dataNames:M,dataPathArr:U}){let K,X;if(k==="")return u.default.rootData;if(k[0]==="/"){if(!W.test(k))throw new Error(`Invalid JSON-pointer: ${k}`);K=k,X=u.default.rootData}else{const $e=ne.exec(k);if(!$e)throw new Error(`Invalid JSON-pointer: ${k}`);const pe=+$e[1];if(K=$e[2],K==="#"){if(pe>=O)throw new Error(Se("property/index",pe));return U[O-pe]}if(pe>O)throw new Error(Se("data",pe));if(X=M[O-pe],!K)return X}let he=X;const Oe=K.split("/");for(const $e of Oe)$e&&(X=(0,o._)`${X}${(0,o.getProperty)((0,h.unescapeJsonPointer)($e))}`,he=(0,o._)`${he} && ${X}`);return he;function Se($e,pe){return`Cannot access ${$e} ${pe} levels up, current level is ${O}`}}return Me.getData=re,Me}var $t={},Ps;function Qr(){if(Ps)return $t;Ps=1,Object.defineProperty($t,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return $t.default=t,$t}var Et={},Is;function wr(){if(Is)return Et;Is=1,Object.defineProperty(Et,"__esModule",{value:!0});const t=vr();class e extends Error{constructor(s,a,n,i){super(i||`can't resolve reference ${n} from id ${a}`),this.missingRef=(0,t.resolveUrl)(s,a,n),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(s,this.missingRef))}}return Et.default=e,Et}var Te={},Os;function Zr(){if(Os)return Te;Os=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.resolveSchema=Te.getCompilingSchema=Te.resolveRef=Te.compileSchema=Te.SchemaEnv=void 0;const t=Y(),e=Qr(),r=Fe(),s=vr(),a=se(),n=br();class i{constructor(p){var c;this.refs={},this.dynamicAnchors={};let d;typeof p.schema=="object"&&(d=p.schema),this.schema=p.schema,this.schemaId=p.schemaId,this.root=p.root||this,this.baseId=(c=p.baseId)!==null&&c!==void 0?c:(0,s.normalizeId)(d?.[p.schemaId||"$id"]),this.schemaPath=p.schemaPath,this.localRefs=p.localRefs,this.meta=p.meta,this.$async=d?.$async,this.refs={}}}Te.SchemaEnv=i;function o(l){const p=h.call(this,l);if(p)return p;const c=(0,s.getFullPath)(this.opts.uriResolver,l.root.baseId),{es5:d,lines:S}=this.opts.code,{ownProperties:f}=this.opts,b=new t.CodeGen(this.scope,{es5:d,lines:S,ownProperties:f});let E;l.$async&&(E=b.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const C=b.scopeName("validate");l.validateName=C;const D={gen:b,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:b.scopeValue("schema",this.opts.code.source===!0?{ref:l.schema,code:(0,t.stringify)(l.schema)}:{ref:l.schema}),validateName:C,ValidationError:E,schema:l.schema,schemaEnv:l,rootId:c,baseId:l.baseId||c,schemaPath:t.nil,errSchemaPath:l.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let V;try{this._compilations.add(l),(0,n.validateFunctionCode)(D),b.optimize(this.opts.code.optimize);const q=b.toString();V=`${b.scopeRefs(r.default.scope)}return ${q}`,this.opts.code.process&&(V=this.opts.code.process(V,l));const F=new Function(`${r.default.self}`,`${r.default.scope}`,V)(this,this.scope.get());if(this.scope.value(C,{ref:F}),F.errors=null,F.schema=l.schema,F.schemaEnv=l,l.$async&&(F.$async=!0),this.opts.code.source===!0&&(F.source={validateName:C,validateCode:q,scopeValues:b._values}),this.opts.unevaluated){const{props:x,items:ae}=D;F.evaluated={props:x instanceof t.Name?void 0:x,items:ae instanceof t.Name?void 0:ae,dynamicProps:x instanceof t.Name,dynamicItems:ae instanceof t.Name},F.source&&(F.source.evaluated=(0,t.stringify)(F.evaluated))}return l.validate=F,l}catch(q){throw delete l.validate,delete l.validateName,V&&this.logger.error("Error compiling schema, function code:",V),q}finally{this._compilations.delete(l)}}Te.compileSchema=o;function u(l,p,c){var d;c=(0,s.resolveUrl)(this.opts.uriResolver,p,c);const S=l.refs[c];if(S)return S;let f=g.call(this,l,c);if(f===void 0){const b=(d=l.localRefs)===null||d===void 0?void 0:d[c],{schemaId:E}=this.opts;b&&(f=new i({schema:b,schemaId:E,root:l,baseId:p}))}if(f!==void 0)return l.refs[c]=m.call(this,f)}Te.resolveRef=u;function m(l){return(0,s.inlineRef)(l.schema,this.opts.inlineRefs)?l.schema:l.validate?l:o.call(this,l)}function h(l){for(const p of this._compilations)if($(p,l))return p}Te.getCompilingSchema=h;function $(l,p){return l.schema===p.schema&&l.root===p.root&&l.baseId===p.baseId}function g(l,p){let c;for(;typeof(c=this.refs[p])=="string";)p=c;return c||this.schemas[p]||y.call(this,l,p)}function y(l,p){const c=this.opts.uriResolver.parse(p),d=(0,s._getFullPath)(this.opts.uriResolver,c);let S=(0,s.getFullPath)(this.opts.uriResolver,l.baseId,void 0);if(Object.keys(l.schema).length>0&&d===S)return w.call(this,c,l);const f=(0,s.normalizeId)(d),b=this.refs[f]||this.schemas[f];if(typeof b=="string"){const E=y.call(this,l,b);return typeof E?.schema!="object"?void 0:w.call(this,c,E)}if(typeof b?.schema=="object"){if(b.validate||o.call(this,b),f===(0,s.normalizeId)(p)){const{schema:E}=b,{schemaId:C}=this.opts,D=E[C];return D&&(S=(0,s.resolveUrl)(this.opts.uriResolver,S,D)),new i({schema:E,schemaId:C,root:l,baseId:S})}return w.call(this,c,b)}}Te.resolveSchema=y;const v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function w(l,{baseId:p,schema:c,root:d}){var S;if(((S=l.fragment)===null||S===void 0?void 0:S[0])!=="/")return;for(const E of l.fragment.slice(1).split("/")){if(typeof c=="boolean")return;const C=c[(0,a.unescapeFragment)(E)];if(C===void 0)return;c=C;const D=typeof c=="object"&&c[this.opts.schemaId];!v.has(E)&&D&&(p=(0,s.resolveUrl)(this.opts.uriResolver,p,D))}let f;if(typeof c!="boolean"&&c.$ref&&!(0,a.schemaHasRulesButRef)(c,this.RULES)){const E=(0,s.resolveUrl)(this.opts.uriResolver,p,c.$ref);f=y.call(this,d,E)}const{schemaId:b}=this.opts;if(f=f||new i({schema:c,schemaId:b,root:d,baseId:p}),f.schema!==f.root.schema)return f}return Te}const Ao="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Do="Meta-schema for $data reference (JSON AnySchema extension proposal)",Lo="object",Uo=["$data"],Ho={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Vo=!1,Fo={$id:Ao,description:Do,type:Lo,required:Uo,properties:Ho,additionalProperties:Vo};var Tt={},lt={exports:{}},Nr,Rs;function Hn(){if(Rs)return Nr;Rs=1;const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),e=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 r(g){let y="",v=0,w=0;for(w=0;w<g.length;w++)if(v=g[w].charCodeAt(0),v!==48){if(!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=g[w];break}for(w+=1;w<g.length;w++){if(v=g[w].charCodeAt(0),!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=g[w]}return y}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(g){return g.length=0,!0}function n(g,y,v){if(g.length){const w=r(g);if(w!=="")y.push(w);else return v.error=!0,!1;g.length=0}return!0}function i(g){let y=0;const v={error:!1,address:"",zone:""},w=[],l=[];let p=!1,c=!1,d=n;for(let S=0;S<g.length;S++){const f=g[S];if(!(f==="["||f==="]"))if(f===":"){if(p===!0&&(c=!0),!d(l,w,v))break;if(++y>7){v.error=!0;break}S>0&&g[S-1]===":"&&(p=!0),w.push(":");continue}else if(f==="%"){if(!d(l,w,v))break;d=a}else{l.push(f);continue}}return l.length&&(d===a?v.zone=l.join(""):c?w.push(l.join("")):w.push(r(l))),v.address=w.join(""),v}function o(g){if(u(g,":")<2)return{host:g,isIPV6:!1};const y=i(g);if(y.error)return{host:g,isIPV6:!1};{let v=y.address,w=y.address;return y.zone&&(v+="%"+y.zone,w+="%25"+y.zone),{host:v,isIPV6:!0,escapedHost:w}}}function u(g,y){let v=0;for(let w=0;w<g.length;w++)g[w]===y&&v++;return v}function m(g){let y=g;const v=[];let w=-1,l=0;for(;l=y.length;){if(l===1){if(y===".")break;if(y==="/"){v.push("/");break}else{v.push(y);break}}else if(l===2){if(y[0]==="."){if(y[1]===".")break;if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&(y[1]==="."||y[1]==="/")){v.push("/");break}}else if(l===3&&y==="/.."){v.length!==0&&v.pop(),v.push("/");break}if(y[0]==="."){if(y[1]==="."){if(y[2]==="/"){y=y.slice(3);continue}}else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&y[1]==="."){if(y[2]==="/"){y=y.slice(2);continue}else if(y[2]==="."&&y[3]==="/"){y=y.slice(3),v.length!==0&&v.pop();continue}}if((w=y.indexOf("/",1))===-1){v.push(y);break}else v.push(y.slice(0,w)),y=y.slice(w)}return v.join("")}function h(g,y){const v=y!==!0?escape:unescape;return g.scheme!==void 0&&(g.scheme=v(g.scheme)),g.userinfo!==void 0&&(g.userinfo=v(g.userinfo)),g.host!==void 0&&(g.host=v(g.host)),g.path!==void 0&&(g.path=v(g.path)),g.query!==void 0&&(g.query=v(g.query)),g.fragment!==void 0&&(g.fragment=v(g.fragment)),g}function $(g){const y=[];if(g.userinfo!==void 0&&(y.push(g.userinfo),y.push("@")),g.host!==void 0){let v=unescape(g.host);if(!e(v)){const w=o(v);w.isIPV6===!0?v=`[${w.escapedHost}]`:v=g.host}y.push(v)}return(typeof g.port=="number"||typeof g.port=="string")&&(y.push(":"),y.push(String(g.port))),y.length?y.join(""):void 0}return Nr={nonSimpleDomain:s,recomposeAuthority:$,normalizeComponentEncoding:h,removeDotSegments:m,isIPv4:e,isUUID:t,normalizeIPv6:o,stringArrayToHexStripped:r},Nr}var qr,Cs;function xo(){if(Cs)return qr;Cs=1;const{isUUID:t}=Hn(),e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function s(f){return r.indexOf(f)!==-1}function a(f){return f.secure===!0?!0:f.secure===!1?!1:f.scheme?f.scheme.length===3&&(f.scheme[0]==="w"||f.scheme[0]==="W")&&(f.scheme[1]==="s"||f.scheme[1]==="S")&&(f.scheme[2]==="s"||f.scheme[2]==="S"):!1}function n(f){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f}function i(f){const b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}function o(f){return f.secure=a(f),f.resourceName=(f.path||"/")+(f.query?"?"+f.query:""),f.path=void 0,f.query=void 0,f}function u(f){if((f.port===(a(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){const[b,E]=f.resourceName.split("?");f.path=b&&b!=="/"?b:void 0,f.query=E,f.resourceName=void 0}return f.fragment=void 0,f}function m(f,b){if(!f.path)return f.error="URN can not be parsed",f;const E=f.path.match(e);if(E){const C=b.scheme||f.scheme||"urn";f.nid=E[1].toLowerCase(),f.nss=E[2];const D=`${C}:${b.nid||f.nid}`,V=S(D);f.path=void 0,V&&(f=V.parse(f,b))}else f.error=f.error||"URN can not be parsed.";return f}function h(f,b){if(f.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=b.scheme||f.scheme||"urn",C=f.nid.toLowerCase(),D=`${E}:${b.nid||C}`,V=S(D);V&&(f=V.serialize(f,b));const q=f,H=f.nss;return q.path=`${C||b.nid}:${H}`,b.skipEscape=!0,q}function $(f,b){const E=f;return E.uuid=E.nss,E.nss=void 0,!b.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function g(f){const b=f;return b.nss=(f.uuid||"").toLowerCase(),b}const y={scheme:"http",domainHost:!0,parse:n,serialize:i},v={scheme:"https",domainHost:y.domainHost,parse:n,serialize:i},w={scheme:"ws",domainHost:!0,parse:o,serialize:u},l={scheme:"wss",domainHost:w.domainHost,parse:w.parse,serialize:w.serialize},d={http:y,https:v,ws:w,wss:l,urn:{scheme:"urn",parse:m,serialize:h,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:$,serialize:g,skipNormalize:!0}};Object.setPrototypeOf(d,null);function S(f){return f&&(d[f]||d[f.toLowerCase()])||void 0}return qr={wsIsSecure:a,SCHEMES:d,isValidSchemeName:s,getSchemeHandler:S},qr}var Ns;function zo(){if(Ns)return lt.exports;Ns=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:r,normalizeComponentEncoding:s,isIPv4:a,nonSimpleDomain:n}=Hn(),{SCHEMES:i,getSchemeHandler:o}=xo();function u(l,p){return typeof l=="string"?l=g(v(l,p),p):typeof l=="object"&&(l=v(g(l,p),p)),l}function m(l,p,c){const d=c?Object.assign({scheme:"null"},c):{scheme:"null"},S=h(v(l,d),v(p,d),d,!0);return d.skipEscape=!0,g(S,d)}function h(l,p,c,d){const S={};return d||(l=v(g(l,c),c),p=v(g(p,c),c)),c=c||{},!c.tolerant&&p.scheme?(S.scheme=p.scheme,S.userinfo=p.userinfo,S.host=p.host,S.port=p.port,S.path=e(p.path||""),S.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(S.userinfo=p.userinfo,S.host=p.host,S.port=p.port,S.path=e(p.path||""),S.query=p.query):(p.path?(p.path[0]==="/"?S.path=e(p.path):((l.userinfo!==void 0||l.host!==void 0||l.port!==void 0)&&!l.path?S.path="/"+p.path:l.path?S.path=l.path.slice(0,l.path.lastIndexOf("/")+1)+p.path:S.path=p.path,S.path=e(S.path)),S.query=p.query):(S.path=l.path,p.query!==void 0?S.query=p.query:S.query=l.query),S.userinfo=l.userinfo,S.host=l.host,S.port=l.port),S.scheme=l.scheme),S.fragment=p.fragment,S}function $(l,p,c){return typeof l=="string"?(l=unescape(l),l=g(s(v(l,c),!0),{...c,skipEscape:!0})):typeof l=="object"&&(l=g(s(l,!0),{...c,skipEscape:!0})),typeof p=="string"?(p=unescape(p),p=g(s(v(p,c),!0),{...c,skipEscape:!0})):typeof p=="object"&&(p=g(s(p,!0),{...c,skipEscape:!0})),l.toLowerCase()===p.toLowerCase()}function g(l,p){const c={host:l.host,scheme:l.scheme,userinfo:l.userinfo,port:l.port,path:l.path,query:l.query,nid:l.nid,nss:l.nss,uuid:l.uuid,fragment:l.fragment,reference:l.reference,resourceName:l.resourceName,secure:l.secure,error:""},d=Object.assign({},p),S=[],f=o(d.scheme||c.scheme);f&&f.serialize&&f.serialize(c,d),c.path!==void 0&&(d.skipEscape?c.path=unescape(c.path):(c.path=escape(c.path),c.scheme!==void 0&&(c.path=c.path.split("%3A").join(":")))),d.reference!=="suffix"&&c.scheme&&S.push(c.scheme,":");const b=r(c);if(b!==void 0&&(d.reference!=="suffix"&&S.push("//"),S.push(b),c.path&&c.path[0]!=="/"&&S.push("/")),c.path!==void 0){let E=c.path;!d.absolutePath&&(!f||!f.absolutePath)&&(E=e(E)),b===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),S.push(E)}return c.query!==void 0&&S.push("?",c.query),c.fragment!==void 0&&S.push("#",c.fragment),S.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v(l,p){const c=Object.assign({},p),d={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let S=!1;c.reference==="suffix"&&(c.scheme?l=c.scheme+":"+l:l="//"+l);const f=l.match(y);if(f){if(d.scheme=f[1],d.userinfo=f[3],d.host=f[4],d.port=parseInt(f[5],10),d.path=f[6]||"",d.query=f[7],d.fragment=f[8],isNaN(d.port)&&(d.port=f[5]),d.host)if(a(d.host)===!1){const C=t(d.host);d.host=C.host.toLowerCase(),S=C.isIPV6}else S=!0;d.scheme===void 0&&d.userinfo===void 0&&d.host===void 0&&d.port===void 0&&d.query===void 0&&!d.path?d.reference="same-document":d.scheme===void 0?d.reference="relative":d.fragment===void 0?d.reference="absolute":d.reference="uri",c.reference&&c.reference!=="suffix"&&c.reference!==d.reference&&(d.error=d.error||"URI is not a "+c.reference+" reference.");const b=o(c.scheme||d.scheme);if(!c.unicodeSupport&&(!b||!b.unicodeSupport)&&d.host&&(c.domainHost||b&&b.domainHost)&&S===!1&&n(d.host))try{d.host=URL.domainToASCII(d.host.toLowerCase())}catch(E){d.error=d.error||"Host's domain name can not be converted to ASCII: "+E}(!b||b&&!b.skipNormalize)&&(l.indexOf("%")!==-1&&(d.scheme!==void 0&&(d.scheme=unescape(d.scheme)),d.host!==void 0&&(d.host=unescape(d.host))),d.path&&(d.path=escape(unescape(d.path))),d.fragment&&(d.fragment=encodeURI(decodeURIComponent(d.fragment)))),b&&b.parse&&b.parse(d,c)}else d.error=d.error||"URI can not be parsed.";return d}const w={SCHEMES:i,normalize:u,resolve:m,resolveComponent:h,equal:$,serialize:g,parse:v};return lt.exports=w,lt.exports.default=w,lt.exports.fastUri=w,lt.exports}var qs;function Ko(){if(qs)return Tt;qs=1,Object.defineProperty(Tt,"__esModule",{value:!0});const t=zo();return t.code='require("ajv/dist/runtime/uri").default',Tt.default=t,Tt}var Ms;function Wo(){return Ms||(Ms=1,(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=br();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Y();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=Qr(),a=wr(),n=Dn(),i=Zr(),o=Y(),u=vr(),m=hr(),h=se(),$=Fo,g=Ko(),y=(L,I)=>new RegExp(L,I);y.code="new RegExp";const v=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),l={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."},p={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},c=200;function d(L){var I,j,R,_,T,N,z,W,ne,re,k,O,M,U,K,X,he,Oe,Se,$e,pe,Ze,ke,Sr,$r;const ct=L.strict,Er=(I=L.code)===null||I===void 0?void 0:I.optimize,es=Er===!0||Er===void 0?1:Er||0,ts=(R=(j=L.code)===null||j===void 0?void 0:j.regExp)!==null&&R!==void 0?R:y,ra=(_=L.uriResolver)!==null&&_!==void 0?_:g.default;return{strictSchema:(N=(T=L.strictSchema)!==null&&T!==void 0?T:ct)!==null&&N!==void 0?N:!0,strictNumbers:(W=(z=L.strictNumbers)!==null&&z!==void 0?z:ct)!==null&&W!==void 0?W:!0,strictTypes:(re=(ne=L.strictTypes)!==null&&ne!==void 0?ne:ct)!==null&&re!==void 0?re:"log",strictTuples:(O=(k=L.strictTuples)!==null&&k!==void 0?k:ct)!==null&&O!==void 0?O:"log",strictRequired:(U=(M=L.strictRequired)!==null&&M!==void 0?M:ct)!==null&&U!==void 0?U:!1,code:L.code?{...L.code,optimize:es,regExp:ts}:{optimize:es,regExp:ts},loopRequired:(K=L.loopRequired)!==null&&K!==void 0?K:c,loopEnum:(X=L.loopEnum)!==null&&X!==void 0?X:c,meta:(he=L.meta)!==null&&he!==void 0?he:!0,messages:(Oe=L.messages)!==null&&Oe!==void 0?Oe:!0,inlineRefs:(Se=L.inlineRefs)!==null&&Se!==void 0?Se:!0,schemaId:($e=L.schemaId)!==null&&$e!==void 0?$e:"$id",addUsedSchema:(pe=L.addUsedSchema)!==null&&pe!==void 0?pe:!0,validateSchema:(Ze=L.validateSchema)!==null&&Ze!==void 0?Ze:!0,validateFormats:(ke=L.validateFormats)!==null&&ke!==void 0?ke:!0,unicodeRegExp:(Sr=L.unicodeRegExp)!==null&&Sr!==void 0?Sr:!0,int32range:($r=L.int32range)!==null&&$r!==void 0?$r:!0,uriResolver:ra}}class S{constructor(I={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,I=this.opts={...I,...d(I)};const{es5:j,lines:R}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:w,es5:j,lines:R}),this.logger=H(I.logger);const _=I.validateFormats;I.validateFormats=!1,this.RULES=(0,n.getRules)(),f.call(this,l,I,"NOT SUPPORTED"),f.call(this,p,I,"DEPRECATED","warn"),this._metaOpts=V.call(this),I.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),I.keywords&&D.call(this,I.keywords),typeof I.meta=="object"&&this.addMetaSchema(I.meta),E.call(this),I.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:I,meta:j,schemaId:R}=this.opts;let _=$;R==="id"&&(_={...$},_.id=_.$id,delete _.$id),j&&I&&this.addMetaSchema(_,_[R],!1)}defaultMeta(){const{meta:I,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof I=="object"?I[j]||I:void 0}validate(I,j){let R;if(typeof I=="string"){if(R=this.getSchema(I),!R)throw new Error(`no schema with key or ref "${I}"`)}else R=this.compile(I);const _=R(j);return"$async"in R||(this.errors=R.errors),_}compile(I,j){const R=this._addSchema(I,j);return R.validate||this._compileSchemaEnv(R)}compileAsync(I,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:R}=this.opts;return _.call(this,I,j);async function _(re,k){await T.call(this,re.$schema);const O=this._addSchema(re,k);return O.validate||N.call(this,O)}async function T(re){re&&!this.getSchema(re)&&await _.call(this,{$ref:re},!0)}async function N(re){try{return this._compileSchemaEnv(re)}catch(k){if(!(k instanceof a.default))throw k;return z.call(this,k),await W.call(this,k.missingSchema),N.call(this,re)}}function z({missingSchema:re,missingRef:k}){if(this.refs[re])throw new Error(`AnySchema ${re} is loaded but ${k} cannot be resolved`)}async function W(re){const k=await ne.call(this,re);this.refs[re]||await T.call(this,k.$schema),this.refs[re]||this.addSchema(k,re,j)}async function ne(re){const k=this._loading[re];if(k)return k;try{return await(this._loading[re]=R(re))}finally{delete this._loading[re]}}}addSchema(I,j,R,_=this.opts.validateSchema){if(Array.isArray(I)){for(const N of I)this.addSchema(N,void 0,R,_);return this}let T;if(typeof I=="object"){const{schemaId:N}=this.opts;if(T=I[N],T!==void 0&&typeof T!="string")throw new Error(`schema ${N} must be string`)}return j=(0,u.normalizeId)(j||T),this._checkUnique(j),this.schemas[j]=this._addSchema(I,R,j,_,!0),this}addMetaSchema(I,j,R=this.opts.validateSchema){return this.addSchema(I,j,!0,R),this}validateSchema(I,j){if(typeof I=="boolean")return!0;let R;if(R=I.$schema,R!==void 0&&typeof R!="string")throw new Error("$schema must be a string");if(R=R||this.opts.defaultMeta||this.defaultMeta(),!R)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const _=this.validate(R,I);if(!_&&j){const T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw new Error(T)}return _}getSchema(I){let j;for(;typeof(j=b.call(this,I))=="string";)I=j;if(j===void 0){const{schemaId:R}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:R});if(j=i.resolveSchema.call(this,_,I),!j)return;this.refs[I]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(I){if(I instanceof RegExp)return this._removeAllSchemas(this.schemas,I),this._removeAllSchemas(this.refs,I),this;switch(typeof I){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const j=b.call(this,I);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[I],delete this.refs[I],this}case"object":{const j=I;this._cache.delete(j);let R=I[this.opts.schemaId];return R&&(R=(0,u.normalizeId)(R),delete this.schemas[R],delete this.refs[R]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(I){for(const j of I)this.addKeyword(j);return this}addKeyword(I,j){let R;if(typeof I=="string")R=I,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=R);else if(typeof I=="object"&&j===void 0){if(j=I,R=j.keyword,Array.isArray(R)&&!R.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(x.call(this,R,j),!j)return(0,h.eachItem)(R,T=>ae.call(this,T)),this;_e.call(this,j);const _={...j,type:(0,m.getJSONTypes)(j.type),schemaType:(0,m.getJSONTypes)(j.schemaType)};return(0,h.eachItem)(R,_.type.length===0?T=>ae.call(this,T,_):T=>_.type.forEach(N=>ae.call(this,T,_,N))),this}getKeyword(I){const j=this.RULES.all[I];return typeof j=="object"?j.definition:!!j}removeKeyword(I){const{RULES:j}=this;delete j.keywords[I],delete j.all[I];for(const R of j.rules){const _=R.rules.findIndex(T=>T.keyword===I);_>=0&&R.rules.splice(_,1)}return this}addFormat(I,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[I]=j,this}errorsText(I=this.errors,{separator:j=", ",dataVar:R="data"}={}){return!I||I.length===0?"No errors":I.map(_=>`${R}${_.instancePath} ${_.message}`).reduce((_,T)=>_+j+T)}$dataMetaSchema(I,j){const R=this.RULES.all;I=JSON.parse(JSON.stringify(I));for(const _ of j){const T=_.split("/").slice(1);let N=I;for(const z of T)N=N[z];for(const z in R){const W=R[z];if(typeof W!="object")continue;const{$data:ne}=W.definition,re=N[z];ne&&re&&(N[z]=Ie(re))}}return I}_removeAllSchemas(I,j){for(const R in I){const _=I[R];(!j||j.test(R))&&(typeof _=="string"?delete I[R]:_&&!_.meta&&(this._cache.delete(_.schema),delete I[R]))}}_addSchema(I,j,R,_=this.opts.validateSchema,T=this.opts.addUsedSchema){let N;const{schemaId:z}=this.opts;if(typeof I=="object")N=I[z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof I!="boolean")throw new Error("schema must be object or boolean")}let W=this._cache.get(I);if(W!==void 0)return W;R=(0,u.normalizeId)(N||R);const ne=u.getSchemaRefs.call(this,I,R);return W=new i.SchemaEnv({schema:I,schemaId:z,meta:j,baseId:R,localRefs:ne}),this._cache.set(W.schema,W),T&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=W),_&&this.validateSchema(I,!0),W}_checkUnique(I){if(this.schemas[I]||this.refs[I])throw new Error(`schema with key or id "${I}" already exists`)}_compileSchemaEnv(I){if(I.meta?this._compileMetaSchema(I):i.compileSchema.call(this,I),!I.validate)throw new Error("ajv implementation error");return I.validate}_compileMetaSchema(I){const j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,I)}finally{this.opts=j}}}S.ValidationError=s.default,S.MissingRefError=a.default,t.default=S;function f(L,I,j,R="error"){for(const _ in L){const T=_;T in I&&this.logger[R](`${j}: option ${_}. ${L[T]}`)}}function b(L){return L=(0,u.normalizeId)(L),this.schemas[L]||this.refs[L]}function E(){const L=this.opts.schemas;if(L)if(Array.isArray(L))this.addSchema(L);else for(const I in L)this.addSchema(L[I],I)}function C(){for(const L in this.opts.formats){const I=this.opts.formats[L];I&&this.addFormat(L,I)}}function D(L){if(Array.isArray(L)){this.addVocabulary(L);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const I in L){const j=L[I];j.keyword||(j.keyword=I),this.addKeyword(j)}}function V(){const L={...this.opts};for(const I of v)delete L[I];return L}const q={log(){},warn(){},error(){}};function H(L){if(L===!1)return q;if(L===void 0)return console;if(L.log&&L.warn&&L.error)return L;throw new Error("logger must implement log, warn and error methods")}const F=/^[a-z_$][a-z0-9_$:-]*$/i;function x(L,I){const{RULES:j}=this;if((0,h.eachItem)(L,R=>{if(j.keywords[R])throw new Error(`Keyword ${R} is already defined`);if(!F.test(R))throw new Error(`Keyword ${R} has invalid name`)}),!!I&&I.$data&&!("code"in I||"validate"in I))throw new Error('$data keyword must have "code" or "validate" function')}function ae(L,I,j){var R;const _=I?.post;if(j&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:T}=this;let N=_?T.post:T.rules.find(({type:W})=>W===j);if(N||(N={type:j,rules:[]},T.rules.push(N)),T.keywords[L]=!0,!I)return;const z={keyword:L,definition:{...I,type:(0,m.getJSONTypes)(I.type),schemaType:(0,m.getJSONTypes)(I.schemaType)}};I.before?ge.call(this,N,z,I.before):N.rules.push(z),T.all[L]=z,(R=I.implements)===null||R===void 0||R.forEach(W=>this.addKeyword(W))}function ge(L,I,j){const R=L.rules.findIndex(_=>_.keyword===j);R>=0?L.rules.splice(R,0,I):(L.rules.push(I),this.logger.warn(`rule ${j} is not defined`))}function _e(L){let{metaSchema:I}=L;I!==void 0&&(L.$data&&this.opts.$data&&(I=Ie(I)),L.validateSchema=this.compile(I,!0))}const ce={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(L){return{anyOf:[L,ce]}}})(Tr)),Tr}var kt={},Pt={},It={},js;function Go(){if(js)return It;js=1,Object.defineProperty(It,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return It.default=t,It}var Ue={},As;function Jo(){if(As)return Ue;As=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.callRef=Ue.getValidate=void 0;const t=wr(),e=qe(),r=Y(),s=Fe(),a=Zr(),n=se(),i={keyword:"$ref",schemaType:"string",code(m){const{gen:h,schema:$,it:g}=m,{baseId:y,schemaEnv:v,validateName:w,opts:l,self:p}=g,{root:c}=v;if(($==="#"||$==="#/")&&y===c.baseId)return S();const d=a.resolveRef.call(p,c,y,$);if(d===void 0)throw new t.default(g.opts.uriResolver,y,$);if(d instanceof a.SchemaEnv)return f(d);return b(d);function S(){if(v===c)return u(m,w,v,v.$async);const E=h.scopeValue("root",{ref:c});return u(m,(0,r._)`${E}.validate`,c,c.$async)}function f(E){const C=o(m,E);u(m,C,E,E.$async)}function b(E){const C=h.scopeValue("schema",l.code.source===!0?{ref:E,code:(0,r.stringify)(E)}:{ref:E}),D=h.name("valid"),V=m.subschema({schema:E,dataTypes:[],schemaPath:r.nil,topSchemaRef:C,errSchemaPath:$},D);m.mergeEvaluated(V),m.ok(D)}}};function o(m,h){const{gen:$}=m;return h.validate?$.scopeValue("validate",{ref:h.validate}):(0,r._)`${$.scopeValue("wrapper",{ref:h})}.validate`}Ue.getValidate=o;function u(m,h,$,g){const{gen:y,it:v}=m,{allErrors:w,schemaEnv:l,opts:p}=v,c=p.passContext?s.default.this:r.nil;g?d():S();function d(){if(!l.$async)throw new Error("async schema referenced by sync schema");const E=y.let("valid");y.try(()=>{y.code((0,r._)`await ${(0,e.callValidateCode)(m,h,c)}`),b(h),w||y.assign(E,!0)},C=>{y.if((0,r._)`!(${C} instanceof ${v.ValidationError})`,()=>y.throw(C)),f(C),w||y.assign(E,!1)}),m.ok(E)}function S(){m.result((0,e.callValidateCode)(m,h,c),()=>b(h),()=>f(h))}function f(E){const C=(0,r._)`${E}.errors`;y.assign(s.default.vErrors,(0,r._)`${s.default.vErrors} === null ? ${C} : ${s.default.vErrors}.concat(${C})`),y.assign(s.default.errors,(0,r._)`${s.default.vErrors}.length`)}function b(E){var C;if(!v.opts.unevaluated)return;const D=(C=$?.validate)===null||C===void 0?void 0:C.evaluated;if(v.props!==!0)if(D&&!D.dynamicProps)D.props!==void 0&&(v.props=n.mergeEvaluated.props(y,D.props,v.props));else{const V=y.var("props",(0,r._)`${E}.evaluated.props`);v.props=n.mergeEvaluated.props(y,V,v.props,r.Name)}if(v.items!==!0)if(D&&!D.dynamicItems)D.items!==void 0&&(v.items=n.mergeEvaluated.items(y,D.items,v.items));else{const V=y.var("items",(0,r._)`${E}.evaluated.items`);v.items=n.mergeEvaluated.items(y,V,v.items,r.Name)}}}return Ue.callRef=u,Ue.default=i,Ue}var Ds;function Bo(){if(Ds)return Pt;Ds=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=Go(),e=Jo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Pt.default=r,Pt}var Ot={},Rt={},Ls;function Qo(){if(Ls)return Rt;Ls=1,Object.defineProperty(Rt,"__esModule",{value:!0});const t=Y(),e=t.operators,r={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},s={message:({keyword:n,schemaCode:i})=>(0,t.str)`must be ${r[n].okStr} ${i}`,params:({keyword:n,schemaCode:i})=>(0,t._)`{comparison: ${r[n].okStr}, limit: ${i}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:s,code(n){const{keyword:i,data:o,schemaCode:u}=n;n.fail$data((0,t._)`${o} ${r[i].fail} ${u} || isNaN(${o})`)}};return Rt.default=a,Rt}var Ct={},Us;function Zo(){if(Us)return Ct;Us=1,Object.defineProperty(Ct,"__esModule",{value:!0});const t=Y(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:s})=>(0,t.str)`must be multiple of ${s}`,params:({schemaCode:s})=>(0,t._)`{multipleOf: ${s}}`},code(s){const{gen:a,data:n,schemaCode:i,it:o}=s,u=o.opts.multipleOfPrecision,m=a.let("res"),h=u?(0,t._)`Math.abs(Math.round(${m}) - ${m}) > 1e-${u}`:(0,t._)`${m} !== parseInt(${m})`;s.fail$data((0,t._)`(${i} === 0 || (${m} = ${n}/${i}, ${h}))`)}};return Ct.default=r,Ct}var Nt={},qt={},Hs;function Yo(){if(Hs)return qt;Hs=1,Object.defineProperty(qt,"__esModule",{value:!0});function t(e){const r=e.length;let s=0,a=0,n;for(;a<r;)s++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<r&&(n=e.charCodeAt(a),(n&64512)===56320&&a++);return s}return qt.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',qt}var Vs;function Xo(){if(Vs)return Nt;Vs=1,Object.defineProperty(Nt,"__esModule",{value:!0});const t=Y(),e=se(),r=Yo(),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:i}){const o=n==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${i} characters`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:i,data:o,schemaCode:u,it:m}=n,h=i==="maxLength"?t.operators.GT:t.operators.LT,$=m.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.useFunc)(n.gen,r.default)}(${o})`;n.fail$data((0,t._)`${$} ${h} ${u}`)}};return Nt.default=a,Nt}var Mt={},Fs;function ei(){if(Fs)return Mt;Fs=1,Object.defineProperty(Mt,"__esModule",{value:!0});const t=qe(),e=Y(),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:a})=>(0,e.str)`must match pattern "${a}"`,params:({schemaCode:a})=>(0,e._)`{pattern: ${a}}`},code(a){const{data:n,$data:i,schema:o,schemaCode:u,it:m}=a,h=m.opts.unicodeRegExp?"u":"",$=i?(0,e._)`(new RegExp(${u}, ${h}))`:(0,t.usePattern)(a,o);a.fail$data((0,e._)`!${$}.test(${n})`)}};return Mt.default=s,Mt}var jt={},xs;function ti(){if(xs)return jt;xs=1,Object.defineProperty(jt,"__esModule",{value:!0});const t=Y(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const n=s==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${n} than ${a} properties`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:n,schemaCode:i}=s,o=a==="maxProperties"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`Object.keys(${n}).length ${o} ${i}`)}};return jt.default=r,jt}var At={},zs;function ri(){if(zs)return At;zs=1,Object.defineProperty(At,"__esModule",{value:!0});const t=qe(),e=Y(),r=se(),a={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:n}})=>(0,e.str)`must have required property '${n}'`,params:({params:{missingProperty:n}})=>(0,e._)`{missingProperty: ${n}}`},code(n){const{gen:i,schema:o,schemaCode:u,data:m,$data:h,it:$}=n,{opts:g}=$;if(!h&&o.length===0)return;const y=o.length>=g.loopRequired;if($.allErrors?v():w(),g.strictRequired){const c=n.parentSchema.properties,{definedProperties:d}=n.it;for(const S of o)if(c?.[S]===void 0&&!d.has(S)){const f=$.schemaEnv.baseId+$.errSchemaPath,b=`required property "${S}" is not defined at "${f}" (strictRequired)`;(0,r.checkStrictMode)($,b,$.opts.strictRequired)}}function v(){if(y||h)n.block$data(e.nil,l);else for(const c of o)(0,t.checkReportMissingProp)(n,c)}function w(){const c=i.let("missing");if(y||h){const d=i.let("valid",!0);n.block$data(d,()=>p(c,d)),n.ok(d)}else i.if((0,t.checkMissingProp)(n,o,c)),(0,t.reportMissingProp)(n,c),i.else()}function l(){i.forOf("prop",u,c=>{n.setParams({missingProperty:c}),i.if((0,t.noPropertyInData)(i,m,c,g.ownProperties),()=>n.error())})}function p(c,d){n.setParams({missingProperty:c}),i.forOf(c,u,()=>{i.assign(d,(0,t.propertyInData)(i,m,c,g.ownProperties)),i.if((0,e.not)(d),()=>{n.error(),i.break()})},e.nil)}}};return At.default=a,At}var Dt={},Ks;function si(){if(Ks)return Dt;Ks=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=Y(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:a}){const n=s==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${n} than ${a} items`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){const{keyword:a,data:n,schemaCode:i}=s,o=a==="maxItems"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`${n}.length ${o} ${i}`)}};return Dt.default=r,Dt}var Lt={},Ut={},Ws;function Yr(){if(Ws)return Ut;Ws=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=Un();return t.code='require("ajv/dist/runtime/equal").default',Ut.default=t,Ut}var Gs;function ni(){if(Gs)return Lt;Gs=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t=hr(),e=Y(),r=se(),s=Yr(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${i} are identical)`,params:({params:{i,j:o}})=>(0,e._)`{i: ${i}, j: ${o}}`},code(i){const{gen:o,data:u,$data:m,schema:h,parentSchema:$,schemaCode:g,it:y}=i;if(!m&&!h)return;const v=o.let("valid"),w=$.items?(0,t.getSchemaTypes)($.items):[];i.block$data(v,l,(0,e._)`${g} === false`),i.ok(v);function l(){const S=o.let("i",(0,e._)`${u}.length`),f=o.let("j");i.setParams({i:S,j:f}),o.assign(v,!0),o.if((0,e._)`${S} > 1`,()=>(p()?c:d)(S,f))}function p(){return w.length>0&&!w.some(S=>S==="object"||S==="array")}function c(S,f){const b=o.name("item"),E=(0,t.checkDataTypes)(w,b,y.opts.strictNumbers,t.DataType.Wrong),C=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${S}--;`,()=>{o.let(b,(0,e._)`${u}[${S}]`),o.if(E,(0,e._)`continue`),w.length>1&&o.if((0,e._)`typeof ${b} == "string"`,(0,e._)`${b} += "_"`),o.if((0,e._)`typeof ${C}[${b}] == "number"`,()=>{o.assign(f,(0,e._)`${C}[${b}]`),i.error(),o.assign(v,!1).break()}).code((0,e._)`${C}[${b}] = ${S}`)})}function d(S,f){const b=(0,r.useFunc)(o,s.default),E=o.name("outer");o.label(E).for((0,e._)`;${S}--;`,()=>o.for((0,e._)`${f} = ${S}; ${f}--;`,()=>o.if((0,e._)`${b}(${u}[${S}], ${u}[${f}])`,()=>{i.error(),o.assign(v,!1).break(E)})))}}};return Lt.default=n,Lt}var Ht={},Js;function ai(){if(Js)return Ht;Js=1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=Y(),e=se(),r=Yr(),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:n})=>(0,t._)`{allowedValue: ${n}}`},code(n){const{gen:i,data:o,$data:u,schemaCode:m,schema:h}=n;u||h&&typeof h=="object"?n.fail$data((0,t._)`!${(0,e.useFunc)(i,r.default)}(${o}, ${m})`):n.fail((0,t._)`${h} !== ${o}`)}};return Ht.default=a,Ht}var Vt={},Bs;function oi(){if(Bs)return Vt;Bs=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=Y(),e=se(),r=Yr(),a={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:n})=>(0,t._)`{allowedValues: ${n}}`},code(n){const{gen:i,data:o,$data:u,schema:m,schemaCode:h,it:$}=n;if(!u&&m.length===0)throw new Error("enum must have non-empty array");const g=m.length>=$.opts.loopEnum;let y;const v=()=>y??(y=(0,e.useFunc)(i,r.default));let w;if(g||u)w=i.let("valid"),n.block$data(w,l);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const c=i.const("vSchema",h);w=(0,t.or)(...m.map((d,S)=>p(c,S)))}n.pass(w);function l(){i.assign(w,!1),i.forOf("v",h,c=>i.if((0,t._)`${v()}(${o}, ${c})`,()=>i.assign(w,!0).break()))}function p(c,d){const S=m[d];return typeof S=="object"&&S!==null?(0,t._)`${v()}(${o}, ${c}[${d}])`:(0,t._)`${o} === ${S}`}}};return Vt.default=a,Vt}var Qs;function ii(){if(Qs)return Ot;Qs=1,Object.defineProperty(Ot,"__esModule",{value:!0});const t=Qo(),e=Zo(),r=Xo(),s=ei(),a=ti(),n=ri(),i=si(),o=ni(),u=ai(),m=oi(),h=[t.default,e.default,r.default,s.default,a.default,n.default,i.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,m.default];return Ot.default=h,Ot}var Ft={},Xe={},Zs;function Vn(){if(Zs)return Xe;Zs=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateAdditionalItems=void 0;const t=Y(),e=se(),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){const{parentSchema:i,it:o}=n,{items:u}=i;if(!Array.isArray(u)){(0,e.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas');return}a(n,u)}};function a(n,i){const{gen:o,schema:u,data:m,keyword:h,it:$}=n;$.items=!0;const g=o.const("len",(0,t._)`${m}.length`);if(u===!1)n.setParams({len:i.length}),n.pass((0,t._)`${g} <= ${i.length}`);else if(typeof u=="object"&&!(0,e.alwaysValidSchema)($,u)){const v=o.var("valid",(0,t._)`${g} <= ${i.length}`);o.if((0,t.not)(v),()=>y(v)),n.ok(v)}function y(v){o.forRange("i",i.length,g,w=>{n.subschema({keyword:h,dataProp:w,dataPropType:e.Type.Num},v),$.allErrors||o.if((0,t.not)(v),()=>o.break())})}}return Xe.validateAdditionalItems=a,Xe.default=s,Xe}var xt={},et={},Ys;function Fn(){if(Ys)return et;Ys=1,Object.defineProperty(et,"__esModule",{value:!0}),et.validateTuple=void 0;const t=Y(),e=se(),r=qe(),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(n){const{schema:i,it:o}=n;if(Array.isArray(i))return a(n,"additionalItems",i);o.items=!0,!(0,e.alwaysValidSchema)(o,i)&&n.ok((0,r.validateArray)(n))}};function a(n,i,o=n.schema){const{gen:u,parentSchema:m,data:h,keyword:$,it:g}=n;w(m),g.opts.unevaluated&&o.length&&g.items!==!0&&(g.items=e.mergeEvaluated.items(u,o.length,g.items));const y=u.name("valid"),v=u.const("len",(0,t._)`${h}.length`);o.forEach((l,p)=>{(0,e.alwaysValidSchema)(g,l)||(u.if((0,t._)`${v} > ${p}`,()=>n.subschema({keyword:$,schemaProp:p,dataProp:p},y)),n.ok(y))});function w(l){const{opts:p,errSchemaPath:c}=g,d=o.length,S=d===l.minItems&&(d===l.maxItems||l[i]===!1);if(p.strictTuples&&!S){const f=`"${$}" is ${d}-tuple, but minItems or maxItems/${i} are not specified or different at path "${c}"`;(0,e.checkStrictMode)(g,f,p.strictTuples)}}}return et.validateTuple=a,et.default=s,et}var Xs;function ci(){if(Xs)return xt;Xs=1,Object.defineProperty(xt,"__esModule",{value:!0});const t=Fn(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return xt.default=e,xt}var zt={},en;function ui(){if(en)return zt;en=1,Object.defineProperty(zt,"__esModule",{value:!0});const t=Y(),e=se(),r=qe(),s=Vn(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{schema:o,parentSchema:u,it:m}=i,{prefixItems:h}=u;m.items=!0,!(0,e.alwaysValidSchema)(m,o)&&(h?(0,s.validateAdditionalItems)(i,h):i.ok((0,r.validateArray)(i)))}};return zt.default=n,zt}var Kt={},tn;function li(){if(tn)return Kt;tn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:a,max:n}})=>n===void 0?(0,t.str)`must contain at least ${a} valid item(s)`:(0,t.str)`must contain at least ${a} and no more than ${n} valid item(s)`,params:({params:{min:a,max:n}})=>n===void 0?(0,t._)`{minContains: ${a}}`:(0,t._)`{minContains: ${a}, maxContains: ${n}}`},code(a){const{gen:n,schema:i,parentSchema:o,data:u,it:m}=a;let h,$;const{minContains:g,maxContains:y}=o;m.opts.next?(h=g===void 0?1:g,$=y):h=1;const v=n.const("len",(0,t._)`${u}.length`);if(a.setParams({min:h,max:$}),$===void 0&&h===0){(0,e.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if($!==void 0&&h>$){(0,e.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),a.fail();return}if((0,e.alwaysValidSchema)(m,i)){let d=(0,t._)`${v} >= ${h}`;$!==void 0&&(d=(0,t._)`${d} && ${v} <= ${$}`),a.pass(d);return}m.items=!0;const w=n.name("valid");$===void 0&&h===1?p(w,()=>n.if(w,()=>n.break())):h===0?(n.let(w,!0),$!==void 0&&n.if((0,t._)`${u}.length > 0`,l)):(n.let(w,!1),l()),a.result(w,()=>a.reset());function l(){const d=n.name("_valid"),S=n.let("count",0);p(d,()=>n.if(d,()=>c(S)))}function p(d,S){n.forRange("i",0,v,f=>{a.subschema({keyword:"contains",dataProp:f,dataPropType:e.Type.Num,compositeRule:!0},d),S()})}function c(d){n.code((0,t._)`${d}++`),$===void 0?n.if((0,t._)`${d} >= ${h}`,()=>n.assign(w,!0).break()):(n.if((0,t._)`${d} > ${$}`,()=>n.assign(w,!1).break()),h===1?n.assign(w,!0):n.if((0,t._)`${d} >= ${h}`,()=>n.assign(w,!0)))}}};return Kt.default=s,Kt}var Mr={},rn;function di(){return rn||(rn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Y(),r=se(),s=qe();t.error={message:({params:{property:u,depsCount:m,deps:h}})=>{const $=m===1?"property":"properties";return(0,e.str)`must have ${$} ${h} when property ${u} is present`},params:({params:{property:u,depsCount:m,deps:h,missingProperty:$}})=>(0,e._)`{property: ${u},
|
|
6
6
|
missingProperty: ${$},
|
|
7
7
|
depsCount: ${m},
|
|
8
|
-
deps: ${h}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(u){const[m,h]=n(u);i(u,m),o(u,h)}};function n({schema:u}){const m={},h={};for(const $ in u){if($==="__proto__")continue;const g=Array.isArray(u[$])?m:h;g[$]=u[$]}return[m,h]}function i(u,m=u.schema){const{gen:h,data:$,it:g}=u;if(Object.keys(m).length===0)return;const y=h.let("missing");for(const v in m){const w=m[v];if(w.length===0)continue;const l=(0,s.propertyInData)(h,$,v,g.opts.ownProperties);u.setParams({property:v,depsCount:w.length,deps:w.join(", ")}),g.allErrors?h.if(l,()=>{for(const p of w)(0,s.checkReportMissingProp)(u,p)}):(h.if((0,e._)`${l} && (${(0,s.checkMissingProp)(u,w,y)})`),(0,s.reportMissingProp)(u,y),h.else())}}t.validatePropertyDeps=i;function o(u,m=u.schema){const{gen:h,data:$,keyword:g,it:y}=u,v=h.name("valid");for(const w in m)(0,r.alwaysValidSchema)(y,m[w])||(h.if((0,s.propertyInData)(h,$,w,y.opts.ownProperties),()=>{const l=u.subschema({keyword:g,schemaProp:w},v);u.mergeValidEvaluated(l,v)},()=>h.var(v,!0)),u.ok(v))}t.validateSchemaDeps=o,t.default=a})(jr)),jr}var Wt={},nn;function hi(){if(nn)return Wt;nn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:a})=>(0,t._)`{propertyName: ${a.propertyName}}`},code(a){const{gen:n,schema:i,data:o,it:u}=a;if((0,e.alwaysValidSchema)(u,i))return;const m=n.name("valid");n.forIn("key",o,h=>{a.setParams({propertyName:h}),a.subschema({keyword:"propertyNames",data:h,dataTypes:["string"],propertyName:h,compositeRule:!0},m),n.if((0,t.not)(m),()=>{a.error(!0),u.allErrors||n.break()})}),a.ok(m)}};return Wt.default=s,Wt}var Gt={},an;function zn(){if(an)return Gt;an=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=qe(),e=Y(),r=Fe(),s=se(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,e._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:o,schema:u,parentSchema:m,data:h,errsCount:$,it:g}=i;if(!$)throw new Error("ajv implementation error");const{allErrors:y,opts:v}=g;if(g.props=!0,v.removeAdditional!=="all"&&(0,s.alwaysValidSchema)(g,u))return;const w=(0,t.allSchemaProperties)(m.properties),l=(0,t.allSchemaProperties)(m.patternProperties);p(),i.ok((0,e._)`${$} === ${r.default.errors}`);function p(){o.forIn("key",h,b=>{!w.length&&!l.length?S(b):o.if(c(b),()=>S(b))})}function c(b){let E;if(w.length>8){const C=(0,s.schemaRefOrVal)(g,m.properties,"properties");E=(0,t.isOwnProperty)(o,C,b)}else w.length?E=(0,e.or)(...w.map(C=>(0,e._)`${b} === ${C}`)):E=e.nil;return l.length&&(E=(0,e.or)(E,...l.map(C=>(0,e._)`${(0,t.usePattern)(i,C)}.test(${b})`))),(0,e.not)(E)}function d(b){o.code((0,e._)`delete ${h}[${b}]`)}function S(b){if(v.removeAdditional==="all"||v.removeAdditional&&u===!1){d(b);return}if(u===!1){i.setParams({additionalProperty:b}),i.error(),y||o.break();return}if(typeof u=="object"&&!(0,s.alwaysValidSchema)(g,u)){const E=o.name("valid");v.removeAdditional==="failing"?(f(b,E,!1),o.if((0,e.not)(E),()=>{i.reset(),d(b)})):(f(b,E),y||o.if((0,e.not)(E),()=>o.break()))}}function f(b,E,C){const D={keyword:"additionalProperties",dataProp:b,dataPropType:s.Type.Str};C===!1&&Object.assign(D,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(D,E)}}};return Gt.default=n,Gt}var Jt={},on;function pi(){if(on)return Jt;on=1,Object.defineProperty(Jt,"__esModule",{value:!0});const t=wr(),e=qe(),r=se(),s=zn(),a={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:i,schema:o,parentSchema:u,data:m,it:h}=n;h.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&s.default.code(new t.KeywordCxt(h,s.default,"additionalProperties"));const $=(0,e.allSchemaProperties)(o);for(const l of $)h.definedProperties.add(l);h.opts.unevaluated&&$.length&&h.props!==!0&&(h.props=r.mergeEvaluated.props(i,(0,r.toHash)($),h.props));const g=$.filter(l=>!(0,r.alwaysValidSchema)(h,o[l]));if(g.length===0)return;const y=i.name("valid");for(const l of g)v(l)?w(l):(i.if((0,e.propertyInData)(i,m,l,h.opts.ownProperties)),w(l),h.allErrors||i.else().var(y,!0),i.endIf()),n.it.definedProperties.add(l),n.ok(y);function v(l){return h.opts.useDefaults&&!h.compositeRule&&o[l].default!==void 0}function w(l){n.subschema({keyword:"properties",schemaProp:l,dataProp:l},y)}}};return Jt.default=a,Jt}var Bt={},cn;function mi(){if(cn)return Bt;cn=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=qe(),e=Y(),r=se(),s=se(),a={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:i,schema:o,data:u,parentSchema:m,it:h}=n,{opts:$}=h,g=(0,t.allSchemaProperties)(o),y=g.filter(S=>(0,r.alwaysValidSchema)(h,o[S]));if(g.length===0||y.length===g.length&&(!h.opts.unevaluated||h.props===!0))return;const v=$.strictSchema&&!$.allowMatchingProperties&&m.properties,w=i.name("valid");h.props!==!0&&!(h.props instanceof e.Name)&&(h.props=(0,s.evaluatedPropsToName)(i,h.props));const{props:l}=h;p();function p(){for(const S of g)v&&c(S),h.allErrors?d(S):(i.var(w,!0),d(S),i.if(w))}function c(S){for(const f in v)new RegExp(S).test(f)&&(0,r.checkStrictMode)(h,`property ${f} matches pattern ${S} (use allowMatchingProperties)`)}function d(S){i.forIn("key",u,f=>{i.if((0,e._)`${(0,t.usePattern)(n,S)}.test(${f})`,()=>{const b=y.includes(S);b||n.subschema({keyword:"patternProperties",schemaProp:S,dataProp:f,dataPropType:s.Type.Str},w),h.opts.unevaluated&&l!==!0?i.assign((0,e._)`${l}[${f}]`,!0):!b&&!h.allErrors&&i.if((0,e.not)(w),()=>i.break())})})}}};return Bt.default=a,Bt}var Qt={},un;function yi(){if(un)return Qt;un=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=se(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:s,schema:a,it:n}=r;if((0,t.alwaysValidSchema)(n,a)){r.fail();return}const i=s.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),r.failResult(i,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return Qt.default=e,Qt}var Zt={},ln;function gi(){if(ln)return Zt;ln=1,Object.defineProperty(Zt,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:qe().validateUnion,error:{message:"must match a schema in anyOf"}};return Zt.default=e,Zt}var Yt={},dn;function _i(){if(dn)return Yt;dn=1,Object.defineProperty(Yt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:a})=>(0,t._)`{passingSchemas: ${a.passing}}`},code(a){const{gen:n,schema:i,parentSchema:o,it:u}=a;if(!Array.isArray(i))throw new Error("ajv implementation error");if(u.opts.discriminator&&o.discriminator)return;const m=i,h=n.let("valid",!1),$=n.let("passing",null),g=n.name("_valid");a.setParams({passing:$}),n.block(y),a.result(h,()=>a.reset(),()=>a.error(!0));function y(){m.forEach((v,w)=>{let l;(0,e.alwaysValidSchema)(u,v)?n.var(g,!0):l=a.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},g),w>0&&n.if((0,t._)`${g} && ${h}`).assign(h,!1).assign($,(0,t._)`[${$}, ${w}]`).else(),n.if(g,()=>{n.assign(h,!0),n.assign($,w),l&&a.mergeEvaluated(l,t.Name)})})}}};return Yt.default=s,Yt}var Xt={},fn;function vi(){if(fn)return Xt;fn=1,Object.defineProperty(Xt,"__esModule",{value:!0});const t=se(),e={keyword:"allOf",schemaType:"array",code(r){const{gen:s,schema:a,it:n}=r;if(!Array.isArray(a))throw new Error("ajv implementation error");const i=s.name("valid");a.forEach((o,u)=>{if((0,t.alwaysValidSchema)(n,o))return;const m=r.subschema({keyword:"allOf",schemaProp:u},i);r.ok(i),r.mergeEvaluated(m)})}};return Xt.default=e,Xt}var er={},hn;function bi(){if(hn)return er;hn=1,Object.defineProperty(er,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:n})=>(0,t.str)`must match "${n.ifClause}" schema`,params:({params:n})=>(0,t._)`{failingKeyword: ${n.ifClause}}`},code(n){const{gen:i,parentSchema:o,it:u}=n;o.then===void 0&&o.else===void 0&&(0,e.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const m=a(u,"then"),h=a(u,"else");if(!m&&!h)return;const $=i.let("valid",!0),g=i.name("_valid");if(y(),n.reset(),m&&h){const w=i.let("ifClause");n.setParams({ifClause:w}),i.if(g,v("then",w),v("else",w))}else m?i.if(g,v("then")):i.if((0,t.not)(g),v("else"));n.pass($,()=>n.error(!0));function y(){const w=n.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},g);n.mergeEvaluated(w)}function v(w,l){return()=>{const p=n.subschema({keyword:w},g);i.assign($,g),n.mergeValidEvaluated(p,$),l?i.assign(l,(0,t._)`${w}`):n.setParams({ifClause:w})}}}};function a(n,i){const o=n.schema[i];return o!==void 0&&!(0,e.alwaysValidSchema)(n,o)}return er.default=s,er}var tr={},pn;function wi(){if(pn)return tr;pn=1,Object.defineProperty(tr,"__esModule",{value:!0});const t=se(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:s,it:a}){s.if===void 0&&(0,t.checkStrictMode)(a,`"${r}" without "if" is ignored`)}};return tr.default=e,tr}var mn;function Si(){if(mn)return Ft;mn=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=Fn(),e=ui(),r=xn(),s=li(),a=di(),n=fi(),i=hi(),o=zn(),u=pi(),m=mi(),h=yi(),$=gi(),g=_i(),y=vi(),v=bi(),w=wi();function l(p=!1){const c=[h.default,$.default,g.default,y.default,v.default,w.default,i.default,o.default,n.default,u.default,m.default];return p?c.push(e.default,s.default):c.push(t.default,r.default),c.push(a.default),c}return Ft.default=l,Ft}var rr={},sr={},yn;function $i(){if(yn)return sr;yn=1,Object.defineProperty(sr,"__esModule",{value:!0});const t=Y(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,t.str)`must match format "${s}"`,params:({schemaCode:s})=>(0,t._)`{format: ${s}}`},code(s,a){const{gen:n,data:i,$data:o,schema:u,schemaCode:m,it:h}=s,{opts:$,errSchemaPath:g,schemaEnv:y,self:v}=h;if(!$.validateFormats)return;o?w():l();function w(){const p=n.scopeValue("formats",{ref:v.formats,code:$.code.formats}),c=n.const("fDef",(0,t._)`${p}[${m}]`),d=n.let("fType"),S=n.let("format");n.if((0,t._)`typeof ${c} == "object" && !(${c} instanceof RegExp)`,()=>n.assign(d,(0,t._)`${c}.type || "string"`).assign(S,(0,t._)`${c}.validate`),()=>n.assign(d,(0,t._)`"string"`).assign(S,c)),s.fail$data((0,t.or)(f(),b()));function f(){return $.strictSchema===!1?t.nil:(0,t._)`${m} && !${S}`}function b(){const E=y.$async?(0,t._)`(${c}.async ? await ${S}(${i}) : ${S}(${i}))`:(0,t._)`${S}(${i})`,C=(0,t._)`(typeof ${S} == "function" ? ${E} : ${S}.test(${i}))`;return(0,t._)`${S} && ${S} !== true && ${d} === ${a} && !${C}`}}function l(){const p=v.formats[u];if(!p){f();return}if(p===!0)return;const[c,d,S]=b(p);c===a&&s.pass(E());function f(){if($.strictSchema===!1){v.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${u}" ignored in schema at path "${g}"`}}function b(C){const D=C instanceof RegExp?(0,t.regexpCode)(C):$.code.formats?(0,t._)`${$.code.formats}${(0,t.getProperty)(u)}`:void 0,V=n.scopeValue("formats",{key:u,ref:C,code:D});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,t._)`${V}.validate`]:["string",C,V]}function E(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!y.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${i})`}return typeof d=="function"?(0,t._)`${S}(${i})`:(0,t._)`${S}.test(${i})`}}}};return sr.default=r,sr}var gn;function Ei(){if(gn)return rr;gn=1,Object.defineProperty(rr,"__esModule",{value:!0});const e=[$i().default];return rr.default=e,rr}var We={},_n;function Ti(){return _n||(_n=1,Object.defineProperty(We,"__esModule",{value:!0}),We.contentVocabulary=We.metadataVocabulary=void 0,We.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],We.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),We}var vn;function ki(){if(vn)return kt;vn=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Qo(),e=ci(),r=Si(),s=Ei(),a=Ti(),n=[t.default,e.default,(0,r.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];return kt.default=n,kt}var nr={},dt={},bn;function Pi(){if(bn)return dt;bn=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(dt.DiscrError=t={})),dt}var wn;function Ii(){if(wn)return nr;wn=1,Object.defineProperty(nr,"__esModule",{value:!0});const t=Y(),e=Pi(),r=Yr(),s=Sr(),a=se(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:u}})=>o===e.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:o,tag:u,tagName:m}})=>(0,t._)`{error: ${o}, tag: ${m}, tagValue: ${u}}`},code(o){const{gen:u,data:m,schema:h,parentSchema:$,it:g}=o,{oneOf:y}=$;if(!g.opts.discriminator)throw new Error("discriminator: requires discriminator option");const v=h.propertyName;if(typeof v!="string")throw new Error("discriminator: requires propertyName");if(h.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");const w=u.let("valid",!1),l=u.const("tag",(0,t._)`${m}${(0,t.getProperty)(v)}`);u.if((0,t._)`typeof ${l} == "string"`,()=>p(),()=>o.error(!1,{discrError:e.DiscrError.Tag,tag:l,tagName:v})),o.ok(w);function p(){const S=d();u.if(!1);for(const f in S)u.elseIf((0,t._)`${l} === ${f}`),u.assign(w,c(S[f]));u.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:l,tagName:v}),u.endIf()}function c(S){const f=u.name("valid"),b=o.subschema({keyword:"oneOf",schemaProp:S},f);return o.mergeEvaluated(b,t.Name),f}function d(){var S;const f={},b=C($);let E=!0;for(let q=0;q<y.length;q++){let H=y[q];if(H?.$ref&&!(0,a.schemaHasRulesButRef)(H,g.self.RULES)){const x=H.$ref;if(H=r.resolveRef.call(g.self,g.schemaEnv.root,g.baseId,x),H instanceof r.SchemaEnv&&(H=H.schema),H===void 0)throw new s.default(g.opts.uriResolver,g.baseId,x)}const F=(S=H?.properties)===null||S===void 0?void 0:S[v];if(typeof F!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);E=E&&(b||C(H)),D(F,q)}if(!E)throw new Error(`discriminator: "${v}" must be required`);return f;function C({required:q}){return Array.isArray(q)&&q.includes(v)}function D(q,H){if(q.const)V(q.const,H);else if(q.enum)for(const F of q.enum)V(F,H);else throw new Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function V(q,H){if(typeof q!="string"||q in f)throw new Error(`discriminator: "${v}" values must be unique strings`);f[q]=H}}}};return nr.default=i,nr}const Oi="http://json-schema.org/draft-07/schema#",Ri="http://json-schema.org/draft-07/schema#",Ci="Core schema meta-schema",Ni={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:[]}},qi=["object","boolean"],Mi={$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:"#"}},ji={$schema:Oi,$id:Ri,title:Ci,definitions:Ni,type:qi,properties:Mi,default:!0};var Sn;function Kn(){return Sn||(Sn=1,(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=Go(),s=ki(),a=Ii(),n=ji,i=["/properties"],o="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(v=>this.addVocabulary(v)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const v=this.opts.$data?this.$dataMetaSchema(n,i):n;this.addMetaSchema(v,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var m=wr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return m.KeywordCxt}});var h=Y();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var $=Zr();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return $.default}});var g=Sr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(wt,wt.exports)),wt.exports}var Ai=Kn();const Di=Mn(Ai);var ar={exports:{}},Ar={},$n;function Li(){return $n||($n=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(q,H){return{validate:q,compare:H}}t.fullFormats={date:e(n,i),time:e(u(!0),m),"date-time":e(g(!0),y),"iso-time":e(u(),h),"iso-date-time":e(g(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:p,"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:V,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:d,int32:{type:"number",validate:b},int64:{type:"number",validate:E},float:{type:"number",validate:C},double:{type:"number",validate:C},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"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,y),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),"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,v),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(q){return q%4===0&&(q%100!==0||q%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(q){const H=s.exec(q);if(!H)return!1;const F=+H[1],x=+H[2],ae=+H[3];return x>=1&&x<=12&&ae>=1&&ae<=(x===2&&r(F)?29:a[x])}function i(q,H){if(q&&H)return q>H?1:q<H?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(q){return function(F){const x=o.exec(F);if(!x)return!1;const ae=+x[1],_e=+x[2],ve=+x[3],ce=x[4],Ie=x[5]==="-"?-1:1,L=+(x[6]||0),I=+(x[7]||0);if(L>23||I>59||q&&!ce)return!1;if(ae<=23&&_e<=59&&ve<60)return!0;const j=_e-I*Ie,R=ae-L*Ie-(j<0?1:0);return(R===23||R===-1)&&(j===59||j===-1)&&ve<61}}function m(q,H){if(!(q&&H))return;const F=new Date("2020-01-01T"+q).valueOf(),x=new Date("2020-01-01T"+H).valueOf();if(F&&x)return F-x}function h(q,H){if(!(q&&H))return;const F=o.exec(q),x=o.exec(H);if(F&&x)return q=F[1]+F[2]+F[3],H=x[1]+x[2]+x[3],q>H?1:q<H?-1:0}const $=/t|\s/i;function g(q){const H=u(q);return function(x){const ae=x.split($);return ae.length===2&&n(ae[0])&&H(ae[1])}}function y(q,H){if(!(q&&H))return;const F=new Date(q).valueOf(),x=new Date(H).valueOf();if(F&&x)return F-x}function v(q,H){if(!(q&&H))return;const[F,x]=q.split($),[ae,_e]=H.split($),ve=i(F,ae);if(ve!==void 0)return ve||m(x,_e)}const w=/\/|:/,l=/^(?:[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 p(q){return w.test(q)&&l.test(q)}const c=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function d(q){return c.lastIndex=0,c.test(q)}const S=-2147483648,f=2**31-1;function b(q){return Number.isInteger(q)&&q<=f&&q>=S}function E(q){return Number.isInteger(q)}function C(){return!0}const D=/[^\\]\\Z/;function V(q){if(D.test(q))return!1;try{return new RegExp(q),!0}catch{return!1}}})(Ar)),Ar}var Dr={},En;function Ui(){return En||(En=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Kn(),r=Y(),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:o,schemaCode:u})=>(0,r.str)`should be ${a[o].okStr} ${u}`,params:({keyword:o,schemaCode:u})=>(0,r._)`{comparison: ${a[o].okStr}, limit: ${u}}`};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:n,code(o){const{gen:u,data:m,schemaCode:h,keyword:$,it:g}=o,{opts:y,self:v}=g;if(!y.validateFormats)return;const w=new e.KeywordCxt(g,v.RULES.all.format.definition,"format");w.$data?l():p();function l(){const d=u.scopeValue("formats",{ref:v.formats,code:y.code.formats}),S=u.const("fmt",(0,r._)`${d}[${w.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,c(S)))}function p(){const d=w.schema,S=v.formats[d];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${$}": format "${d}" does not define "compare" function`);const f=u.scopeValue("formats",{key:d,ref:S,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(d)}`:void 0});o.fail$data(c(f))}function c(d){return(0,r._)`${d}.compare(${m}, ${h}) ${a[$].fail} 0`}},dependencies:["format"]};const i=o=>(o.addKeyword(t.formatLimitDefinition),o);t.default=i})(Dr)),Dr}var Tn;function Hi(){return Tn||(Tn=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Li(),s=Ui(),a=Y(),n=new a.Name("fullFormats"),i=new a.Name("fastFormats"),o=(m,h={keywords:!0})=>{if(Array.isArray(h))return u(m,h,r.fullFormats,n),m;const[$,g]=h.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,n],y=h.formats||r.formatNames;return u(m,y,$,g),h.keywords&&(0,s.default)(m),m};o.get=(m,h="full")=>{const g=(h==="fast"?r.fastFormats:r.fullFormats)[m];if(!g)throw new Error(`Unknown format "${m}"`);return g};function u(m,h,$,g){var y,v;(y=(v=m.opts.code).formats)!==null&&y!==void 0||(v.formats=(0,a._)`require("ajv-formats/dist/formats").${g}`);for(const w of h)m.addFormat(w,$[w])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(ar,ar.exports)),ar.exports}var Vi=Hi();const Fi=Mn(Vi);function xi(){const t=new Di({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Fi(t),t}class zi{constructor(e){this._ajv=e??xi()}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 Ki{constructor(e){this._client=e}async*callToolStream(e,r=jn,s){const a=this._client,n={...s,task:s?.task??(a.isToolTask(e.name)?{}:void 0)},i=a.requestStream({method:"tools/call",params:e},r,n),o=a.getToolOutputValidator(e.name);for await(const u of i){if(u.type==="result"&&o){const m=u.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new G(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(m.structuredContent)try{const h=o(m.structuredContent);if(!h.valid){yield{type:"error",error:new G(Z.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof G){yield{type:"error",error:h};return}yield{type:"error",error:new G(Z.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield u}}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 Wi(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break}}function Gi(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break}}function ir(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&&ir(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&ir(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&ir(r,e)}}function Ji(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}}let Bi=class extends Ro{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?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new zi,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ta,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",ka,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pa,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Ki(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Co(this._capabilities,e)}setRequestHandler(e,r){const a=Dn(e)?.method;if(!a)throw new Error("Schema is missing a method literal");let n;if(_r(a)){const o=a;n=o._zod?.def?.value??o.value}else{const o=a;n=o._def?.value??o.value}if(typeof n!="string")throw new Error("Schema method literal must be a string");const i=n;if(i==="elicitation/create"){const o=async(u,m)=>{const h=He(La,u);if(!h.success){const c=h.error instanceof Error?h.error.message:String(h.error);throw new G(Z.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:$}=h.data;$.mode=$.mode??"form";const{supportsFormMode:g,supportsUrlMode:y}=Ji(this._capabilities.elicitation);if($.mode==="form"&&!g)throw new G(Z.InvalidParams,"Client does not support form-mode elicitation requests");if($.mode==="url"&&!y)throw new G(Z.InvalidParams,"Client does not support URL-mode elicitation requests");const v=await Promise.resolve(r(u,m));if($.task){const c=He(Hr,v);if(!c.success){const d=c.error instanceof Error?c.error.message:String(c.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${d}`)}return c.data}const w=He(Ua,v);if(!w.success){const c=w.error instanceof Error?w.error.message:String(w.error);throw new G(Z.InvalidParams,`Invalid elicitation result: ${c}`)}const l=w.data,p=$.mode==="form"?$.requestedSchema:void 0;if($.mode==="form"&&l.action==="accept"&&l.content&&p&&this._capabilities.elicitation?.form?.applyDefaults)try{ir(p,l.content)}catch{}return l};return super.setRequestHandler(e,o)}if(i==="sampling/createMessage"){const o=async(u,m)=>{const h=He(Ha,u);if(!h.success){const v=h.error instanceof Error?h.error.message:String(h.error);throw new G(Z.InvalidParams,`Invalid sampling request: ${v}`)}const{params:$}=h.data,g=await Promise.resolve(r(u,m));if($.task){const v=He(Hr,g);if(!v.success){const w=v.error instanceof Error?v.error.message:String(v.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${w}`)}return v.data}const y=He(Va,g);if(!y.success){const v=y.error instanceof Error?y.error.message:String(y.error);throw new G(Z.InvalidParams,`Invalid sampling result: ${v}`)}return y.data};return super.setRequestHandler(e,o)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[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:Ia,capabilities:this._capabilities,clientInfo:this._clientInfo}},Oa,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ra.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){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.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(!this._serverCapabilities?.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(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.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){Wi(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Gi(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},bt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Ca,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},bt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Na,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},qa,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Ma,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},ja,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Aa,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},bt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},bt,r)}async callTool(e,r=jn,s){if(this.isToolTaskRequired(e.name))throw new G(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 G(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const i=n(a.structuredContent);if(!i.valid)throw new G(Z.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof G?i:new G(Z.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const r of e){if(r.outputSchema){const a=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,a)}const s=r.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(r.name),s==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},An,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=Da.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:i,debounceMs:o}=n.data,{onChanged:u}=s,m=async()=>{if(!i){u(null,null);return}try{const $=await a();u(null,$)}catch($){const g=$ instanceof Error?$:new Error(String($));u(g,null)}},h=()=>{if(o){const $=this._listChangedDebounceTimers.get(e);$&&clearTimeout($);const g=setTimeout(m,o);this._listChangedDebounceTimers.set(e,g)}else m()};this.setNotificationHandler(r,h)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class kn extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Lr(t){}function Wn(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Lr,onError:r=Lr,onRetry:s=Lr,onComment:a}=t;let n="",i=!0,o,u="",m="";function h(w){const l=i?w.replace(/^\xEF\xBB\xBF/,""):w,[p,c]=Qi(`${n}${l}`);for(const d of p)$(d);n=c,i=!1}function $(w){if(w===""){y();return}if(w.startsWith(":")){a&&a(w.slice(w.startsWith(": ")?2:1));return}const l=w.indexOf(":");if(l!==-1){const p=w.slice(0,l),c=w[l+1]===" "?2:1,d=w.slice(l+c);g(p,d,w);return}g(w,"",w)}function g(w,l,p){switch(w){case"event":m=l;break;case"data":u=`${u}${l}
|
|
9
|
-
`;break;case"id":o=l.includes("\0")?void 0:l;break;case"retry":/^\d+$/.test(l)?s(parseInt(l,10)):r(new
|
|
10
|
-
`)?u.slice(0,-1):u}),o=void 0,u="",m=""}function v(w={}){n&&w.consume&&$(n),i=!0,o=void 0,u="",m="",n=""}return{feed:h,reset:v}}function
|
|
8
|
+
deps: ${h}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(u){const[m,h]=n(u);i(u,m),o(u,h)}};function n({schema:u}){const m={},h={};for(const $ in u){if($==="__proto__")continue;const g=Array.isArray(u[$])?m:h;g[$]=u[$]}return[m,h]}function i(u,m=u.schema){const{gen:h,data:$,it:g}=u;if(Object.keys(m).length===0)return;const y=h.let("missing");for(const v in m){const w=m[v];if(w.length===0)continue;const l=(0,s.propertyInData)(h,$,v,g.opts.ownProperties);u.setParams({property:v,depsCount:w.length,deps:w.join(", ")}),g.allErrors?h.if(l,()=>{for(const p of w)(0,s.checkReportMissingProp)(u,p)}):(h.if((0,e._)`${l} && (${(0,s.checkMissingProp)(u,w,y)})`),(0,s.reportMissingProp)(u,y),h.else())}}t.validatePropertyDeps=i;function o(u,m=u.schema){const{gen:h,data:$,keyword:g,it:y}=u,v=h.name("valid");for(const w in m)(0,r.alwaysValidSchema)(y,m[w])||(h.if((0,s.propertyInData)(h,$,w,y.opts.ownProperties),()=>{const l=u.subschema({keyword:g,schemaProp:w},v);u.mergeValidEvaluated(l,v)},()=>h.var(v,!0)),u.ok(v))}t.validateSchemaDeps=o,t.default=a})(Mr)),Mr}var Wt={},sn;function fi(){if(sn)return Wt;sn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:a})=>(0,t._)`{propertyName: ${a.propertyName}}`},code(a){const{gen:n,schema:i,data:o,it:u}=a;if((0,e.alwaysValidSchema)(u,i))return;const m=n.name("valid");n.forIn("key",o,h=>{a.setParams({propertyName:h}),a.subschema({keyword:"propertyNames",data:h,dataTypes:["string"],propertyName:h,compositeRule:!0},m),n.if((0,t.not)(m),()=>{a.error(!0),u.allErrors||n.break()})}),a.ok(m)}};return Wt.default=s,Wt}var Gt={},nn;function xn(){if(nn)return Gt;nn=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=qe(),e=Y(),r=Fe(),s=se(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,e._)`{additionalProperty: ${i.additionalProperty}}`},code(i){const{gen:o,schema:u,parentSchema:m,data:h,errsCount:$,it:g}=i;if(!$)throw new Error("ajv implementation error");const{allErrors:y,opts:v}=g;if(g.props=!0,v.removeAdditional!=="all"&&(0,s.alwaysValidSchema)(g,u))return;const w=(0,t.allSchemaProperties)(m.properties),l=(0,t.allSchemaProperties)(m.patternProperties);p(),i.ok((0,e._)`${$} === ${r.default.errors}`);function p(){o.forIn("key",h,b=>{!w.length&&!l.length?S(b):o.if(c(b),()=>S(b))})}function c(b){let E;if(w.length>8){const C=(0,s.schemaRefOrVal)(g,m.properties,"properties");E=(0,t.isOwnProperty)(o,C,b)}else w.length?E=(0,e.or)(...w.map(C=>(0,e._)`${b} === ${C}`)):E=e.nil;return l.length&&(E=(0,e.or)(E,...l.map(C=>(0,e._)`${(0,t.usePattern)(i,C)}.test(${b})`))),(0,e.not)(E)}function d(b){o.code((0,e._)`delete ${h}[${b}]`)}function S(b){if(v.removeAdditional==="all"||v.removeAdditional&&u===!1){d(b);return}if(u===!1){i.setParams({additionalProperty:b}),i.error(),y||o.break();return}if(typeof u=="object"&&!(0,s.alwaysValidSchema)(g,u)){const E=o.name("valid");v.removeAdditional==="failing"?(f(b,E,!1),o.if((0,e.not)(E),()=>{i.reset(),d(b)})):(f(b,E),y||o.if((0,e.not)(E),()=>o.break()))}}function f(b,E,C){const D={keyword:"additionalProperties",dataProp:b,dataPropType:s.Type.Str};C===!1&&Object.assign(D,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(D,E)}}};return Gt.default=n,Gt}var Jt={},an;function hi(){if(an)return Jt;an=1,Object.defineProperty(Jt,"__esModule",{value:!0});const t=br(),e=qe(),r=se(),s=xn(),a={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:i,schema:o,parentSchema:u,data:m,it:h}=n;h.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&s.default.code(new t.KeywordCxt(h,s.default,"additionalProperties"));const $=(0,e.allSchemaProperties)(o);for(const l of $)h.definedProperties.add(l);h.opts.unevaluated&&$.length&&h.props!==!0&&(h.props=r.mergeEvaluated.props(i,(0,r.toHash)($),h.props));const g=$.filter(l=>!(0,r.alwaysValidSchema)(h,o[l]));if(g.length===0)return;const y=i.name("valid");for(const l of g)v(l)?w(l):(i.if((0,e.propertyInData)(i,m,l,h.opts.ownProperties)),w(l),h.allErrors||i.else().var(y,!0),i.endIf()),n.it.definedProperties.add(l),n.ok(y);function v(l){return h.opts.useDefaults&&!h.compositeRule&&o[l].default!==void 0}function w(l){n.subschema({keyword:"properties",schemaProp:l,dataProp:l},y)}}};return Jt.default=a,Jt}var Bt={},on;function pi(){if(on)return Bt;on=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=qe(),e=Y(),r=se(),s=se(),a={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:i,schema:o,data:u,parentSchema:m,it:h}=n,{opts:$}=h,g=(0,t.allSchemaProperties)(o),y=g.filter(S=>(0,r.alwaysValidSchema)(h,o[S]));if(g.length===0||y.length===g.length&&(!h.opts.unevaluated||h.props===!0))return;const v=$.strictSchema&&!$.allowMatchingProperties&&m.properties,w=i.name("valid");h.props!==!0&&!(h.props instanceof e.Name)&&(h.props=(0,s.evaluatedPropsToName)(i,h.props));const{props:l}=h;p();function p(){for(const S of g)v&&c(S),h.allErrors?d(S):(i.var(w,!0),d(S),i.if(w))}function c(S){for(const f in v)new RegExp(S).test(f)&&(0,r.checkStrictMode)(h,`property ${f} matches pattern ${S} (use allowMatchingProperties)`)}function d(S){i.forIn("key",u,f=>{i.if((0,e._)`${(0,t.usePattern)(n,S)}.test(${f})`,()=>{const b=y.includes(S);b||n.subschema({keyword:"patternProperties",schemaProp:S,dataProp:f,dataPropType:s.Type.Str},w),h.opts.unevaluated&&l!==!0?i.assign((0,e._)`${l}[${f}]`,!0):!b&&!h.allErrors&&i.if((0,e.not)(w),()=>i.break())})})}}};return Bt.default=a,Bt}var Qt={},cn;function mi(){if(cn)return Qt;cn=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=se(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:s,schema:a,it:n}=r;if((0,t.alwaysValidSchema)(n,a)){r.fail();return}const i=s.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),r.failResult(i,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return Qt.default=e,Qt}var Zt={},un;function yi(){if(un)return Zt;un=1,Object.defineProperty(Zt,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:qe().validateUnion,error:{message:"must match a schema in anyOf"}};return Zt.default=e,Zt}var Yt={},ln;function gi(){if(ln)return Yt;ln=1,Object.defineProperty(Yt,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:a})=>(0,t._)`{passingSchemas: ${a.passing}}`},code(a){const{gen:n,schema:i,parentSchema:o,it:u}=a;if(!Array.isArray(i))throw new Error("ajv implementation error");if(u.opts.discriminator&&o.discriminator)return;const m=i,h=n.let("valid",!1),$=n.let("passing",null),g=n.name("_valid");a.setParams({passing:$}),n.block(y),a.result(h,()=>a.reset(),()=>a.error(!0));function y(){m.forEach((v,w)=>{let l;(0,e.alwaysValidSchema)(u,v)?n.var(g,!0):l=a.subschema({keyword:"oneOf",schemaProp:w,compositeRule:!0},g),w>0&&n.if((0,t._)`${g} && ${h}`).assign(h,!1).assign($,(0,t._)`[${$}, ${w}]`).else(),n.if(g,()=>{n.assign(h,!0),n.assign($,w),l&&a.mergeEvaluated(l,t.Name)})})}}};return Yt.default=s,Yt}var Xt={},dn;function _i(){if(dn)return Xt;dn=1,Object.defineProperty(Xt,"__esModule",{value:!0});const t=se(),e={keyword:"allOf",schemaType:"array",code(r){const{gen:s,schema:a,it:n}=r;if(!Array.isArray(a))throw new Error("ajv implementation error");const i=s.name("valid");a.forEach((o,u)=>{if((0,t.alwaysValidSchema)(n,o))return;const m=r.subschema({keyword:"allOf",schemaProp:u},i);r.ok(i),r.mergeEvaluated(m)})}};return Xt.default=e,Xt}var er={},fn;function vi(){if(fn)return er;fn=1,Object.defineProperty(er,"__esModule",{value:!0});const t=Y(),e=se(),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:n})=>(0,t.str)`must match "${n.ifClause}" schema`,params:({params:n})=>(0,t._)`{failingKeyword: ${n.ifClause}}`},code(n){const{gen:i,parentSchema:o,it:u}=n;o.then===void 0&&o.else===void 0&&(0,e.checkStrictMode)(u,'"if" without "then" and "else" is ignored');const m=a(u,"then"),h=a(u,"else");if(!m&&!h)return;const $=i.let("valid",!0),g=i.name("_valid");if(y(),n.reset(),m&&h){const w=i.let("ifClause");n.setParams({ifClause:w}),i.if(g,v("then",w),v("else",w))}else m?i.if(g,v("then")):i.if((0,t.not)(g),v("else"));n.pass($,()=>n.error(!0));function y(){const w=n.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},g);n.mergeEvaluated(w)}function v(w,l){return()=>{const p=n.subschema({keyword:w},g);i.assign($,g),n.mergeValidEvaluated(p,$),l?i.assign(l,(0,t._)`${w}`):n.setParams({ifClause:w})}}}};function a(n,i){const o=n.schema[i];return o!==void 0&&!(0,e.alwaysValidSchema)(n,o)}return er.default=s,er}var tr={},hn;function bi(){if(hn)return tr;hn=1,Object.defineProperty(tr,"__esModule",{value:!0});const t=se(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:s,it:a}){s.if===void 0&&(0,t.checkStrictMode)(a,`"${r}" without "if" is ignored`)}};return tr.default=e,tr}var pn;function wi(){if(pn)return Ft;pn=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=Vn(),e=ci(),r=Fn(),s=ui(),a=li(),n=di(),i=fi(),o=xn(),u=hi(),m=pi(),h=mi(),$=yi(),g=gi(),y=_i(),v=vi(),w=bi();function l(p=!1){const c=[h.default,$.default,g.default,y.default,v.default,w.default,i.default,o.default,n.default,u.default,m.default];return p?c.push(e.default,s.default):c.push(t.default,r.default),c.push(a.default),c}return Ft.default=l,Ft}var rr={},sr={},mn;function Si(){if(mn)return sr;mn=1,Object.defineProperty(sr,"__esModule",{value:!0});const t=Y(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,t.str)`must match format "${s}"`,params:({schemaCode:s})=>(0,t._)`{format: ${s}}`},code(s,a){const{gen:n,data:i,$data:o,schema:u,schemaCode:m,it:h}=s,{opts:$,errSchemaPath:g,schemaEnv:y,self:v}=h;if(!$.validateFormats)return;o?w():l();function w(){const p=n.scopeValue("formats",{ref:v.formats,code:$.code.formats}),c=n.const("fDef",(0,t._)`${p}[${m}]`),d=n.let("fType"),S=n.let("format");n.if((0,t._)`typeof ${c} == "object" && !(${c} instanceof RegExp)`,()=>n.assign(d,(0,t._)`${c}.type || "string"`).assign(S,(0,t._)`${c}.validate`),()=>n.assign(d,(0,t._)`"string"`).assign(S,c)),s.fail$data((0,t.or)(f(),b()));function f(){return $.strictSchema===!1?t.nil:(0,t._)`${m} && !${S}`}function b(){const E=y.$async?(0,t._)`(${c}.async ? await ${S}(${i}) : ${S}(${i}))`:(0,t._)`${S}(${i})`,C=(0,t._)`(typeof ${S} == "function" ? ${E} : ${S}.test(${i}))`;return(0,t._)`${S} && ${S} !== true && ${d} === ${a} && !${C}`}}function l(){const p=v.formats[u];if(!p){f();return}if(p===!0)return;const[c,d,S]=b(p);c===a&&s.pass(E());function f(){if($.strictSchema===!1){v.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${u}" ignored in schema at path "${g}"`}}function b(C){const D=C instanceof RegExp?(0,t.regexpCode)(C):$.code.formats?(0,t._)`${$.code.formats}${(0,t.getProperty)(u)}`:void 0,V=n.scopeValue("formats",{key:u,ref:C,code:D});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,t._)`${V}.validate`]:["string",C,V]}function E(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!y.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${i})`}return typeof d=="function"?(0,t._)`${S}(${i})`:(0,t._)`${S}.test(${i})`}}}};return sr.default=r,sr}var yn;function $i(){if(yn)return rr;yn=1,Object.defineProperty(rr,"__esModule",{value:!0});const e=[Si().default];return rr.default=e,rr}var We={},gn;function Ei(){return gn||(gn=1,Object.defineProperty(We,"__esModule",{value:!0}),We.contentVocabulary=We.metadataVocabulary=void 0,We.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],We.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),We}var _n;function Ti(){if(_n)return kt;_n=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Bo(),e=ii(),r=wi(),s=$i(),a=Ei(),n=[t.default,e.default,(0,r.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];return kt.default=n,kt}var nr={},dt={},vn;function ki(){if(vn)return dt;vn=1,Object.defineProperty(dt,"__esModule",{value:!0}),dt.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(dt.DiscrError=t={})),dt}var bn;function Pi(){if(bn)return nr;bn=1,Object.defineProperty(nr,"__esModule",{value:!0});const t=Y(),e=ki(),r=Zr(),s=wr(),a=se(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:u}})=>o===e.DiscrError.Tag?`tag "${u}" must be string`:`value of tag "${u}" must be in oneOf`,params:({params:{discrError:o,tag:u,tagName:m}})=>(0,t._)`{error: ${o}, tag: ${m}, tagValue: ${u}}`},code(o){const{gen:u,data:m,schema:h,parentSchema:$,it:g}=o,{oneOf:y}=$;if(!g.opts.discriminator)throw new Error("discriminator: requires discriminator option");const v=h.propertyName;if(typeof v!="string")throw new Error("discriminator: requires propertyName");if(h.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");const w=u.let("valid",!1),l=u.const("tag",(0,t._)`${m}${(0,t.getProperty)(v)}`);u.if((0,t._)`typeof ${l} == "string"`,()=>p(),()=>o.error(!1,{discrError:e.DiscrError.Tag,tag:l,tagName:v})),o.ok(w);function p(){const S=d();u.if(!1);for(const f in S)u.elseIf((0,t._)`${l} === ${f}`),u.assign(w,c(S[f]));u.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:l,tagName:v}),u.endIf()}function c(S){const f=u.name("valid"),b=o.subschema({keyword:"oneOf",schemaProp:S},f);return o.mergeEvaluated(b,t.Name),f}function d(){var S;const f={},b=C($);let E=!0;for(let q=0;q<y.length;q++){let H=y[q];if(H?.$ref&&!(0,a.schemaHasRulesButRef)(H,g.self.RULES)){const x=H.$ref;if(H=r.resolveRef.call(g.self,g.schemaEnv.root,g.baseId,x),H instanceof r.SchemaEnv&&(H=H.schema),H===void 0)throw new s.default(g.opts.uriResolver,g.baseId,x)}const F=(S=H?.properties)===null||S===void 0?void 0:S[v];if(typeof F!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);E=E&&(b||C(H)),D(F,q)}if(!E)throw new Error(`discriminator: "${v}" must be required`);return f;function C({required:q}){return Array.isArray(q)&&q.includes(v)}function D(q,H){if(q.const)V(q.const,H);else if(q.enum)for(const F of q.enum)V(F,H);else throw new Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function V(q,H){if(typeof q!="string"||q in f)throw new Error(`discriminator: "${v}" values must be unique strings`);f[q]=H}}}};return nr.default=i,nr}const Ii="http://json-schema.org/draft-07/schema#",Oi="http://json-schema.org/draft-07/schema#",Ri="Core schema meta-schema",Ci={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:[]}},Ni=["object","boolean"],qi={$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:"#"}},Mi={$schema:Ii,$id:Oi,title:Ri,definitions:Ci,type:Ni,properties:qi,default:!0};var wn;function zn(){return wn||(wn=1,(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=Wo(),s=Ti(),a=Pi(),n=Mi,i=["/properties"],o="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(v=>this.addVocabulary(v)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const v=this.opts.$data?this.$dataMetaSchema(n,i):n;this.addMetaSchema(v,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var m=br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return m.KeywordCxt}});var h=Y();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var $=Qr();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return $.default}});var g=wr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})(wt,wt.exports)),wt.exports}var ji=zn();const Ai=qn(ji);var ar={exports:{}},jr={},Sn;function Di(){return Sn||(Sn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(q,H){return{validate:q,compare:H}}t.fullFormats={date:e(n,i),time:e(u(!0),m),"date-time":e(g(!0),y),"iso-time":e(u(),h),"iso-date-time":e(g(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:p,"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:V,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:d,int32:{type:"number",validate:b},int64:{type:"number",validate:E},float:{type:"number",validate:C},double:{type:"number",validate:C},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"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,y),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),"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,v),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(q){return q%4===0&&(q%100!==0||q%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(q){const H=s.exec(q);if(!H)return!1;const F=+H[1],x=+H[2],ae=+H[3];return x>=1&&x<=12&&ae>=1&&ae<=(x===2&&r(F)?29:a[x])}function i(q,H){if(q&&H)return q>H?1:q<H?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(q){return function(F){const x=o.exec(F);if(!x)return!1;const ae=+x[1],ge=+x[2],_e=+x[3],ce=x[4],Ie=x[5]==="-"?-1:1,L=+(x[6]||0),I=+(x[7]||0);if(L>23||I>59||q&&!ce)return!1;if(ae<=23&&ge<=59&&_e<60)return!0;const j=ge-I*Ie,R=ae-L*Ie-(j<0?1:0);return(R===23||R===-1)&&(j===59||j===-1)&&_e<61}}function m(q,H){if(!(q&&H))return;const F=new Date("2020-01-01T"+q).valueOf(),x=new Date("2020-01-01T"+H).valueOf();if(F&&x)return F-x}function h(q,H){if(!(q&&H))return;const F=o.exec(q),x=o.exec(H);if(F&&x)return q=F[1]+F[2]+F[3],H=x[1]+x[2]+x[3],q>H?1:q<H?-1:0}const $=/t|\s/i;function g(q){const H=u(q);return function(x){const ae=x.split($);return ae.length===2&&n(ae[0])&&H(ae[1])}}function y(q,H){if(!(q&&H))return;const F=new Date(q).valueOf(),x=new Date(H).valueOf();if(F&&x)return F-x}function v(q,H){if(!(q&&H))return;const[F,x]=q.split($),[ae,ge]=H.split($),_e=i(F,ae);if(_e!==void 0)return _e||m(x,ge)}const w=/\/|:/,l=/^(?:[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 p(q){return w.test(q)&&l.test(q)}const c=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function d(q){return c.lastIndex=0,c.test(q)}const S=-2147483648,f=2**31-1;function b(q){return Number.isInteger(q)&&q<=f&&q>=S}function E(q){return Number.isInteger(q)}function C(){return!0}const D=/[^\\]\\Z/;function V(q){if(D.test(q))return!1;try{return new RegExp(q),!0}catch{return!1}}})(jr)),jr}var Ar={},$n;function Li(){return $n||($n=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=zn(),r=Y(),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:o,schemaCode:u})=>(0,r.str)`should be ${a[o].okStr} ${u}`,params:({keyword:o,schemaCode:u})=>(0,r._)`{comparison: ${a[o].okStr}, limit: ${u}}`};t.formatLimitDefinition={keyword:Object.keys(a),type:"string",schemaType:"string",$data:!0,error:n,code(o){const{gen:u,data:m,schemaCode:h,keyword:$,it:g}=o,{opts:y,self:v}=g;if(!y.validateFormats)return;const w=new e.KeywordCxt(g,v.RULES.all.format.definition,"format");w.$data?l():p();function l(){const d=u.scopeValue("formats",{ref:v.formats,code:y.code.formats}),S=u.const("fmt",(0,r._)`${d}[${w.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,c(S)))}function p(){const d=w.schema,S=v.formats[d];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${$}": format "${d}" does not define "compare" function`);const f=u.scopeValue("formats",{key:d,ref:S,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(d)}`:void 0});o.fail$data(c(f))}function c(d){return(0,r._)`${d}.compare(${m}, ${h}) ${a[$].fail} 0`}},dependencies:["format"]};const i=o=>(o.addKeyword(t.formatLimitDefinition),o);t.default=i})(Ar)),Ar}var En;function Ui(){return En||(En=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Di(),s=Li(),a=Y(),n=new a.Name("fullFormats"),i=new a.Name("fastFormats"),o=(m,h={keywords:!0})=>{if(Array.isArray(h))return u(m,h,r.fullFormats,n),m;const[$,g]=h.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,n],y=h.formats||r.formatNames;return u(m,y,$,g),h.keywords&&(0,s.default)(m),m};o.get=(m,h="full")=>{const g=(h==="fast"?r.fastFormats:r.fullFormats)[m];if(!g)throw new Error(`Unknown format "${m}"`);return g};function u(m,h,$,g){var y,v;(y=(v=m.opts.code).formats)!==null&&y!==void 0||(v.formats=(0,a._)`require("ajv-formats/dist/formats").${g}`);for(const w of h)m.addFormat(w,$[w])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(ar,ar.exports)),ar.exports}var Hi=Ui();const Vi=qn(Hi);function Fi(){const t=new Ai({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Vi(t),t}class xi{constructor(e){this._ajv=e??Fi()}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 zi{constructor(e){this._client=e}async*callToolStream(e,r=Mn,s){const a=this._client,n={...s,task:s?.task??(a.isToolTask(e.name)?{}:void 0)},i=a.requestStream({method:"tools/call",params:e},r,n),o=a.getToolOutputValidator(e.name);for await(const u of i){if(u.type==="result"&&o){const m=u.result;if(!m.structuredContent&&!m.isError){yield{type:"error",error:new G(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(m.structuredContent)try{const h=o(m.structuredContent);if(!h.valid){yield{type:"error",error:new G(Z.InvalidParams,`Structured content does not match the tool's output schema: ${h.errorMessage}`)};return}}catch(h){if(h instanceof G){yield{type:"error",error:h};return}yield{type:"error",error:new G(Z.InvalidParams,`Failed to validate structured content: ${h instanceof Error?h.message:String(h)}`)};return}}yield u}}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 Ki(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break}}function Wi(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break}}function ir(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&&ir(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&ir(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&ir(r,e)}}function Gi(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}}let Ji=class extends Oo{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?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new xi,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ea,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Ta,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",ka,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new zi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ro(this._capabilities,e)}setRequestHandler(e,r){const a=An(e)?.method;if(!a)throw new Error("Schema is missing a method literal");let n;if(gr(a)){const o=a;n=o._zod?.def?.value??o.value}else{const o=a;n=o._def?.value??o.value}if(typeof n!="string")throw new Error("Schema method literal must be a string");const i=n;if(i==="elicitation/create"){const o=async(u,m)=>{const h=He(Da,u);if(!h.success){const c=h.error instanceof Error?h.error.message:String(h.error);throw new G(Z.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:$}=h.data;$.mode=$.mode??"form";const{supportsFormMode:g,supportsUrlMode:y}=Gi(this._capabilities.elicitation);if($.mode==="form"&&!g)throw new G(Z.InvalidParams,"Client does not support form-mode elicitation requests");if($.mode==="url"&&!y)throw new G(Z.InvalidParams,"Client does not support URL-mode elicitation requests");const v=await Promise.resolve(r(u,m));if($.task){const c=He(Ur,v);if(!c.success){const d=c.error instanceof Error?c.error.message:String(c.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${d}`)}return c.data}const w=He(La,v);if(!w.success){const c=w.error instanceof Error?w.error.message:String(w.error);throw new G(Z.InvalidParams,`Invalid elicitation result: ${c}`)}const l=w.data,p=$.mode==="form"?$.requestedSchema:void 0;if($.mode==="form"&&l.action==="accept"&&l.content&&p&&this._capabilities.elicitation?.form?.applyDefaults)try{ir(p,l.content)}catch{}return l};return super.setRequestHandler(e,o)}if(i==="sampling/createMessage"){const o=async(u,m)=>{const h=He(Ua,u);if(!h.success){const v=h.error instanceof Error?h.error.message:String(h.error);throw new G(Z.InvalidParams,`Invalid sampling request: ${v}`)}const{params:$}=h.data,g=await Promise.resolve(r(u,m));if($.task){const v=He(Ur,g);if(!v.success){const w=v.error instanceof Error?v.error.message:String(v.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${w}`)}return v.data}const y=He(Ha,g);if(!y.success){const v=y.error instanceof Error?y.error.message:String(y.error);throw new G(Z.InvalidParams,`Invalid sampling result: ${v}`)}return y.data};return super.setRequestHandler(e,o)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[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:Pa,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ia,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Oa.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){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.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(!this._serverCapabilities?.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(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.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){Ki(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Wi(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},bt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Ra,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},bt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Ca,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Na,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},qa,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Ma,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},ja,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},bt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},bt,r)}async callTool(e,r=Mn,s){if(this.isToolTaskRequired(e.name))throw new G(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 G(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent)try{const i=n(a.structuredContent);if(!i.valid)throw new G(Z.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof G?i:new G(Z.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return a}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const r of e){if(r.outputSchema){const a=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,a)}const s=r.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(r.name),s==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},jn,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=Aa.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:i,debounceMs:o}=n.data,{onChanged:u}=s,m=async()=>{if(!i){u(null,null);return}try{const $=await a();u(null,$)}catch($){const g=$ instanceof Error?$:new Error(String($));u(g,null)}},h=()=>{if(o){const $=this._listChangedDebounceTimers.get(e);$&&clearTimeout($);const g=setTimeout(m,o);this._listChangedDebounceTimers.set(e,g)}else m()};this.setNotificationHandler(r,h)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class Tn extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function Dr(t){}function Kn(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=Dr,onError:r=Dr,onRetry:s=Dr,onComment:a}=t;let n="",i=!0,o,u="",m="";function h(w){const l=i?w.replace(/^\xEF\xBB\xBF/,""):w,[p,c]=Bi(`${n}${l}`);for(const d of p)$(d);n=c,i=!1}function $(w){if(w===""){y();return}if(w.startsWith(":")){a&&a(w.slice(w.startsWith(": ")?2:1));return}const l=w.indexOf(":");if(l!==-1){const p=w.slice(0,l),c=w[l+1]===" "?2:1,d=w.slice(l+c);g(p,d,w);return}g(w,"",w)}function g(w,l,p){switch(w){case"event":m=l;break;case"data":u=`${u}${l}
|
|
9
|
+
`;break;case"id":o=l.includes("\0")?void 0:l;break;case"retry":/^\d+$/.test(l)?s(parseInt(l,10)):r(new Tn(`Invalid \`retry\` value: "${l}"`,{type:"invalid-retry",value:l,line:p}));break;default:r(new Tn(`Unknown field "${w.length>20?`${w.slice(0,20)}…`:w}"`,{type:"unknown-field",field:w,value:l,line:p}));break}}function y(){u.length>0&&e({id:o,event:m||void 0,data:u.endsWith(`
|
|
10
|
+
`)?u.slice(0,-1):u}),o=void 0,u="",m=""}function v(w={}){n&&w.consume&&$(n),i=!0,o=void 0,u="",m="",n=""}return{feed:h,reset:v}}function Bi(t){const e=[];let r="",s=0;for(;s<t.length;){const a=t.indexOf("\r",s),n=t.indexOf(`
|
|
11
11
|
`,s);let i=-1;if(a!==-1&&n!==-1?i=Math.min(a,n):a!==-1?a===t.length-1?i=-1:i=a:n!==-1&&(i=n),i===-1){r=t.slice(s);break}else{const o=t.slice(s,i);e.push(o),s=i+1,t[s-1]==="\r"&&t[s]===`
|
|
12
|
-
`&&s++}}return[e,r]}class Pn extends Event{constructor(e,r){var s,a;super(e),this.code=(s=r?.code)!=null?s:void 0,this.message=(a=r?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s(In(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(In(this),r)}}function Zi(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Vr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Vr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Vr(t.cause)}`:t.message:`${t}`}function In(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Gn=t=>{throw TypeError(t)},es=(t,e,r)=>e.has(t)||Gn("Cannot "+r),ee=(t,e,r)=>(es(t,e,"read from private field"),r?r.call(t):e.get(t)),le=(t,e,r)=>e.has(t)?Gn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ue=(t,e,r,s)=>(es(t,e,"write to private field"),e.set(t,r),r),De=(t,e,r)=>(es(t,e,"access private method"),r),Ee,Ge,rt,cr,mr,yt,at,gt,Ve,st,ot,nt,ht,Ce,Fr,xr,zr,On,Kr,Wr,pt,Gr,Jr;class ur extends EventTarget{constructor(e,r){var s,a;super(),le(this,Ce),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,le(this,Ee),le(this,Ge),le(this,rt),le(this,cr),le(this,mr),le(this,yt),le(this,at),le(this,gt,null),le(this,Ve),le(this,st),le(this,ot,null),le(this,nt,null),le(this,ht,null),le(this,xr,async n=>{var i;ee(this,st).reset();const{body:o,redirected:u,status:m,headers:h}=n;if(m===204){De(this,Ce,pt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?ue(this,rt,new URL(n.url)):ue(this,rt,void 0),m!==200){De(this,Ce,pt).call(this,`Non-200 status code (${m})`,m);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){De(this,Ce,pt).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(ee(this,Ee)===this.CLOSED)return;ue(this,Ee,this.OPEN);const $=new Event("open");if((i=ee(this,ht))==null||i.call(this,$),this.dispatchEvent($),typeof o!="object"||!o||!("getReader"in o)){De(this,Ce,pt).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const g=new TextDecoder,y=o.getReader();let v=!0;do{const{done:w,value:l}=await y.read();l&&ee(this,st).feed(g.decode(l,{stream:!w})),w&&(v=!1,ee(this,st).reset(),De(this,Ce,Gr).call(this))}while(v)}),le(this,zr,n=>{ue(this,Ve,void 0),!(n.name==="AbortError"||n.type==="aborted")&&De(this,Ce,Gr).call(this,Vr(n))}),le(this,Kr,n=>{typeof n.id=="string"&&ue(this,gt,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:ee(this,rt)?ee(this,rt).origin:ee(this,Ge).origin,lastEventId:n.id||""});ee(this,nt)&&(!n.event||n.event==="message")&&ee(this,nt).call(this,i),this.dispatchEvent(i)}),le(this,Wr,n=>{ue(this,yt,n)}),le(this,Jr,()=>{ue(this,at,void 0),ee(this,Ee)===this.CONNECTING&&De(this,Ce,Fr).call(this)});try{if(e instanceof URL)ue(this,Ge,e);else if(typeof e=="string")ue(this,Ge,new URL(e,Yi()));else throw new Error("Invalid URL")}catch{throw Zi("An invalid or illegal string was specified")}ue(this,st,Wn({onEvent:ee(this,Kr),onRetry:ee(this,Wr)})),ue(this,Ee,this.CONNECTING),ue(this,yt,3e3),ue(this,mr,(s=r?.fetch)!=null?s:globalThis.fetch),ue(this,cr,(a=r?.withCredentials)!=null?a:!1),De(this,Ce,Fr).call(this)}get readyState(){return ee(this,Ee)}get url(){return ee(this,Ge).href}get withCredentials(){return ee(this,cr)}get onerror(){return ee(this,ot)}set onerror(e){ue(this,ot,e)}get onmessage(){return ee(this,nt)}set onmessage(e){ue(this,nt,e)}get onopen(){return ee(this,ht)}set onopen(e){ue(this,ht,e)}addEventListener(e,r,s){const a=r;super.addEventListener(e,a,s)}removeEventListener(e,r,s){const a=r;super.removeEventListener(e,a,s)}close(){ee(this,at)&&clearTimeout(ee(this,at)),ee(this,Ee)!==this.CLOSED&&(ee(this,Ve)&&ee(this,Ve).abort(),ue(this,Ee,this.CLOSED),ue(this,Ve,void 0))}}Ee=new WeakMap,Ge=new WeakMap,rt=new WeakMap,cr=new WeakMap,mr=new WeakMap,yt=new WeakMap,at=new WeakMap,gt=new WeakMap,Ve=new WeakMap,st=new WeakMap,ot=new WeakMap,nt=new WeakMap,ht=new WeakMap,Ce=new WeakSet,Fr=function(){ue(this,Ee,this.CONNECTING),ue(this,Ve,new AbortController),ee(this,mr)(ee(this,Ge),De(this,Ce,On).call(this)).then(ee(this,xr)).catch(ee(this,zr))},xr=new WeakMap,zr=new WeakMap,On=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ee(this,gt)?{"Last-Event-ID":ee(this,gt)}:void 0},cache:"no-store",signal:(t=ee(this,Ve))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Kr=new WeakMap,Wr=new WeakMap,pt=function(t,e){var r;ee(this,Ee)!==this.CLOSED&&ue(this,Ee,this.CLOSED);const s=new Pn("error",{code:e,message:t});(r=ee(this,ot))==null||r.call(this,s),this.dispatchEvent(s)},Gr=function(t,e){var r;if(ee(this,Ee)===this.CLOSED)return;ue(this,Ee,this.CONNECTING);const s=new Pn("error",{code:e,message:t});(r=ee(this,ot))==null||r.call(this,s),this.dispatchEvent(s),ue(this,at,setTimeout(ee(this,Jr),ee(this,yt)))},Jr=new WeakMap,ur.CONNECTING=0,ur.OPEN=1,ur.CLOSED=2;function Yi(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function yr(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Jn(t=fetch,e){return e?async(r,s)=>{const a={...e,...s,headers:s?.headers?{...yr(e.headers),...yr(s.headers)}:e.headers};return t(r,a)}:t}class Xi extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class ec{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Jn(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new Ne("No auth provider");let e;try{e=await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Ne;return await this._startOrAuth()}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const r=yr(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){const e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,s)=>{this._eventSource=new ur(this._url.href,{...this._eventSourceInit,fetch:async(a,n)=>{const i=await this._commonHeaders();i.set("Accept","text/event-stream");const o=await e(a,{...n,headers:i});if(o.status===401&&o.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:m}=dr(o);this._resourceMetadataUrl=u,this._scope=m}return o}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{if(a.code===401&&this._authProvider){this._authThenStart().then(r,s);return}const n=new Xi(a.code,a.message,a);s(n),this.onerror?.(n)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{const n=a;try{if(this._endpoint=new URL(n.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(i){s(i),this.onerror?.(i),this.close();return}r()}),this._eventSource.onmessage=a=>{const n=a;let i;try{i=mt.parse(JSON.parse(n.data))}catch(o){this.onerror?.(o);return}this.onmessage?.(i)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Ne("No auth provider");if(await Je(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{const r=await this._commonHeaders();r.set("content-type","application/json");const s={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._endpoint,s);if(!a.ok){const n=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:i,scope:o}=dr(a);if(this._resourceMetadataUrl=i,this._scope=o,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${n}`)}await a.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}const tc="mcp";class rc{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._socket=new WebSocket(this._url,tc),this._socket.onerror=s=>{const a="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);r(a),this.onerror?.(a)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=s=>{let a;try{a=mt.parse(JSON.parse(s.data))}catch(n){this.onerror?.(n);return}this.onmessage?.(a)}})}async close(){this._socket?.close()}send(e){return new Promise((r,s)=>{if(!this._socket){s(new Error("Not connected"));return}this._socket?.send(JSON.stringify(e)),r()})}}class sc extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let a;super({start(n){a=Wn({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:s})},transform(n){a.feed(n)}})}}const nc={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class tt extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class ac{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Jn(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??nc}async _authThenStart(){if(!this._authProvider)throw new Ne("No auth provider");let e;try{e=await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Ne;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const r=yr(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){const{resumptionToken:r}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),r&&s.set("last-event-id",r);const a=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!a.ok){if(await a.body?.cancel(),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new tt(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(s,e),a)}_scheduleReconnection(e,r=0){const s=this._reconnectionOptions.maxRetries;if(r>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(n=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,s){if(!e)return;const{onresumptiontoken:a,replayMessageId:n}=r;let i,o=!1,u=!1;(async()=>{try{const h=e.pipeThrough(new TextDecoderStream).pipeThrough(new sc({onRetry:y=>{this._serverRetryMs=y}})).getReader();for(;;){const{value:y,done:v}=await h.read();if(v)break;if(y.id&&(i=y.id,o=!0,a?.(y.id)),!!y.data&&(!y.event||y.event==="message"))try{const w=mt.parse(JSON.parse(y.data));ft(w)&&(u=!0,n!==void 0&&(w.id=n)),this.onmessage?.(w)}catch(w){this.onerror?.(w)}}(s||o)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(h){if(this.onerror?.(new Error(`SSE stream disconnected: ${h}`)),(s||o)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(y){this.onerror?.(new Error(`Failed to reconnect: ${y instanceof Error?y.message:String(y)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Ne("No auth provider");if(await Je(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{const{resumptionToken:s,onresumptiontoken:a}=r||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:Ur(e)?e.id:void 0}).catch(g=>this.onerror?.(g));return}const n=await this._commonHeaders();n.set("content-type","application/json"),n.set("accept","application/json, text/event-stream");const i={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,i),u=o.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!o.ok){const g=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new tt(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:y,scope:v}=dr(o);if(this._resourceMetadataUrl=y,this._scope=v,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){const{resourceMetadataUrl:y,scope:v,error:w}=dr(o);if(w==="insufficient_scope"){const l=o.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===l)throw new tt(403,"Server returned 403 after trying upscoping");if(v&&(this._scope=v),y&&(this._resourceMetadataUrl=y),this._lastUpscopingHeader=l??void 0,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ne;return this.send(e)}}throw new tt(o.status,`Error POSTing to endpoint: ${g}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),Fa(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>this.onerror?.(g));return}const h=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,$=o.headers.get("content-type");if(h)if($?.includes("text/event-stream"))this._handleSseStream(o.body,{onresumptiontoken:a},!1);else if($?.includes("application/json")){const g=await o.json(),y=Array.isArray(g)?g.map(v=>mt.parse(v)):[mt.parse(g)];for(const v of y)this.onmessage?.(v)}else throw await o.body?.cancel(),new tt(-1,`Unexpected content type: ${$}`);else await o.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,r);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new tt(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}class oc extends ac{constructor(e,r){super(e,r)}send(e,r){const s=ic(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function ic(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const r=e?.params?.protocolVersion;return r?{type:"emit",message:{result:{protocolVersion:r,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class cc extends Bi{constructor(e,r){super(e,r)}async listTools(e,r){return await this.request({method:"tools/list",params:e},An,r)}}const uc=async(t,e,r)=>{const s=lc(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const a=new cc({name:t?.name??"MCP Client",version:"1.0.0"});return await a.connect(s),{client:a,callStreamableTool:(n,i)=>{if(t.connection.type!=="HTTP")throw new Error("HTTP connection required");const o=new Headers(r);o.has("Authorization")||o.set("Authorization",`Bearer ${t.connection.token}`);for(const[h,$]of Object.entries(t.connection.headers??{}))o.set(h,$);const u=new URL(t.connection.url),m=u.pathname.replace(/\/+$/,"")||"/";return u.pathname=`${m}/call-tool/${encodeURIComponent(n)}`,fetch(u.href,{method:"POST",redirect:"manual",body:JSON.stringify(i),headers:o})}}},lc=(t,e,r)=>{if(t.type==="Websocket")return new rc(new URL(t.url));if(t.type!=="SSE"&&t.type!=="HTTP")return null;const a={...t.token?{authorization:`Bearer ${t.token}`}:{},...r??{},..."headers"in t?t.headers||{}:{}};if(t.type==="SSE"){const n={requestInit:{headers:a,signal:e}};return t.token&&(n.eventSourceInit={fetch:(i,o)=>fetch(i,{...o,headers:{...a,Accept:"text/event-stream"},signal:e})}),new ec(new URL(t.url),n)}return new oc(new URL(t.url),{requestInit:{headers:a,signal:e,credentials:"include"}})},dc=t=>{try{return JSON.parse(t)}catch{return t}},or=new Map,Rn=(t,e)=>({...t,id:t.name,inputSchema:t.inputSchema?fe(t.inputSchema):void 0,outputSchema:t.outputSchema?fe(t.outputSchema):void 0,execute:r=>e(r.context,t.name)});function fc(t){const e=r=>"connection"in t?uc({connection:t.connection},void 0,r):t.client;return new Proxy({},{get(r,s){if(s==="toJSON")return null;if(typeof s!="string")throw new Error("Name must be a string");if(s==="listTools")return o;async function a(u,m=s){const h=t?.debugId?.(),$=h?{"x-trace-debug-id":h}:void 0,{client:g,callStreamableTool:y}=await e($);if(t?.streamable?.[String(m)])return y(String(m),u);const{structuredContent:v,isError:w,content:l}=await g.callTool({name:String(m),arguments:u});if(w){const p=l?.[0]?.text,c=typeof p=="string"?dc(p):null,d=c?.code&&typeof t?.getErrorByStatusCode=="function"?t.getErrorByStatusCode(c.code,c.message,c.traceId):null;throw d||new Error(`Tool ${String(m)} returned an error: ${JSON.stringify(v??l)}`)}return v}async function n(){const{client:u}=await e(),{tools:m}=await u.listTools();return m}async function i(){if(!("connection"in t))return n();const u=t.connection,m=JSON.stringify(u);try{return or.has(m)||or.set(m,n()),await or.get(m)}catch(h){console.error("Failed to list tools",h),or.delete(m);return}}async function o(){return(await i()??[]).map(m=>Rn(m,a))}return a.asTool=async()=>{const m=(await i()??[]).find(h=>h.name===s);if(!m)throw new Error(`Tool ${s} not found`);return Rn(m,a)},a}})}new Proxy({},{get(t,e){return e==="toJSON"?null:e==="forConnection"?r=>hc({connection:r}):global[e]}});function hc(t){return fc(t)}function Bn(t){return{isImplementedBy:e=>{for(const r of t){const s=typeof r.name=="string"?new RegExp(`^${r.name}$`):r.name,a=e.find(n=>s.test(n.name));if(!(!a&&r.opt)&&!a)return!1}return!0}}}const Be=A({id:P().describe("Unique identifier for the entity"),title:P().describe("Human-readable title for the entity"),description:P().nullish().describe("Description of the entity"),created_at:P().datetime(),updated_at:P().datetime(),created_by:P().optional(),updated_by:P().optional()}),pc=A({field:B(P()),operator:Pe(["eq","gt","gte","lt","lte","in","like","contains"]),value:ge()}),Qn=Qr(()=>de([pc,A({operator:Pe(["and","or","not"]),conditions:B(Qn)})])),mc=A({field:B(P()),direction:Pe(["asc","desc"]),nulls:Pe(["first","last"]).optional()}),yc=A({where:Qn.optional().describe("Filter expression"),orderBy:B(mc).optional().describe("Sort expressions"),limit:J().int().min(1).max(1e3).optional().describe("Maximum number of items to return"),offset:J().int().min(0).optional().describe("Number of items to skip")});function gc(t){return A({items:B(t).describe("Array of collection items"),totalCount:J().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:he().optional().describe("Whether there are more items available")})}const _c=A({id:P().describe("ID of the entity to retrieve")});function vc(t){return A({item:t.nullable().describe("The retrieved item, or null if not found")})}function bc(t){return A({data:t.partial().describe("Data for the new entity (id may be auto-generated)")})}function wc(t){return A({item:t.describe("The created entity with generated id")})}function Sc(t){return A({id:P().describe("ID of the entity to update"),data:t.partial().describe("Partial entity data to update")})}function $c(t){return A({item:t.describe("The updated entity")})}const Ec=A({id:P().describe("ID of the entity to delete")});function Tc(t){return A({item:t.describe("The deleted entity")})}function Qe(t,e,r){const s=t.toUpperCase(),a=r?.readOnly??!1,n=[{name:`COLLECTION_${s}_LIST`,inputSchema:yc,outputSchema:gc(e)},{name:`COLLECTION_${s}_GET`,inputSchema:_c,outputSchema:vc(e)}];return a||n.push({name:`COLLECTION_${s}_CREATE`,inputSchema:bc(e),outputSchema:wc(e),opt:!0},{name:`COLLECTION_${s}_UPDATE`,inputSchema:Sc(e),outputSchema:$c(e),opt:!0},{name:`COLLECTION_${s}_DELETE`,inputSchema:Ec,outputSchema:Tc(e),opt:!0}),n}const kc=A({id:P(),name:P(),description:P().optional(),inputSchema:we(P(),ge()),outputSchema:we(P(),ge()).optional()}),Pc=Be.extend({_meta:A({"io.decocms":A({id:P(),verified:he(),scopeName:P(),appName:P(),friendlyName:P().nullable().optional(),metadata:we(P(),ge()).nullable().optional(),publishedAt:P().datetime().optional(),updatedAt:P().datetime().optional(),tools:B(kc).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:A({$schema:P().optional(),_meta:we(P(),ge()).optional(),name:P().describe("The server name (scope/app)"),title:P().optional().describe("User-friendly title"),description:P().optional().describe("Server description"),icons:B(A({src:P(),mimeType:P().optional(),sizes:B(P()).optional(),theme:Pe(["light","dark"]).optional()})).optional(),remotes:B(A({type:Pe(["http","stdio","sse"]),url:P().optional(),headers:B(ge()).optional()})).optional(),packages:B(ge()).optional(),repository:A({url:P(),source:P().optional(),subfolder:P().optional()}).optional(),version:P().optional(),websiteUrl:P().optional()})});Qe("registry_app",Pc,{readOnly:!0});const Ic=A({specversion:te("1.0").describe("CloudEvents specification version"),id:P().describe("Unique identifier for this event (UUID recommended)"),source:P().describe("Connection ID of the event publisher"),type:P().describe("Event type (e.g., 'order.created', 'user.signup')"),time:P().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:P().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:P().optional().default("application/json").describe("Content type of the data attribute"),dataschema:P().url().optional().describe("URI to the schema for the data attribute"),data:ge().optional().describe("Event payload (any JSON value)")});A({events:B(Ic).min(1).describe("Batch of CloudEvents to process")});const Oc=A({success:he().optional().describe("Whether this event was processed successfully"),error:P().optional().describe("Error message for this event"),retryAfter:J().int().positive().optional().describe("Re-deliver this event after this many ms")});A({success:he().optional().describe("Batch success - applies to events not in results"),error:P().optional().describe("Batch error message - applies to events not in results"),processedCount:J().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:J().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:we(P(),Oc).optional().describe("Per-event results keyed by event ID")});A({type:P().min(1).max(255).describe("Event type identifier"),subject:P().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:ge().optional().describe("Event payload"),deliverAt:P().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:P().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});A({id:P().describe("Unique event ID"),type:P().describe("Event type"),source:P().describe("Source connection ID"),time:P().describe("Event timestamp")});A({eventType:P().min(1).max(255).describe("Event type to subscribe to"),publisher:P().optional().describe("Filter events by publisher connection ID"),filter:P().max(1e3).optional().describe("JSONPath filter expression on event data")});A({subscription:A({id:P().describe("Subscription ID"),connectionId:P().describe("Subscriber connection ID"),eventType:P().describe("Event type pattern"),publisher:P().nullable().describe("Publisher connection filter"),filter:P().nullable().describe("JSONPath filter expression"),enabled:he().describe("Whether subscription is enabled"),createdAt:de([P(),lr()]).describe("Created timestamp"),updatedAt:de([P(),lr()]).describe("Updated timestamp")})});const Rc=A({eventType:P().min(1).max(255).describe("Event type to subscribe to"),publisher:P().optional().describe("Filter events by publisher connection ID"),filter:P().max(1e3).optional().describe("JSONPath filter expression on event data")}),Cc=A({id:P().describe("Subscription ID"),connectionId:P().describe("Subscriber connection ID"),eventType:P().describe("Event type pattern"),publisher:P().nullable().describe("Publisher connection filter"),filter:P().nullable().describe("JSONPath filter expression"),enabled:he().describe("Whether subscription is enabled"),createdAt:de([P(),lr()]).describe("Created timestamp"),updatedAt:de([P(),lr()]).describe("Updated timestamp")});A({subscriptions:B(Rc).describe("Desired subscriptions - system will create/update/delete to match")});A({created:J().int().min(0).describe("Number of subscriptions created"),updated:J().int().min(0).describe("Number of subscriptions with filter updated"),deleted:J().int().min(0).describe("Number of subscriptions removed"),unchanged:J().int().min(0).describe("Number of subscriptions unchanged"),subscriptions:B(Cc).describe("Current subscriptions after sync")});A({subscriptionId:P().describe("Subscription ID to remove")});A({success:he().describe("Whether unsubscribe was successful"),subscriptionId:P().describe("Subscription ID that was removed")});A({eventId:P().describe("Event ID to cancel")});A({success:he().describe("Whether cancellation was successful"),eventId:P().describe("Event ID that was cancelled")});A({eventId:P().describe("Event ID to acknowledge")});A({success:he().describe("Whether ACK was successful"),eventId:P().describe("Event ID that was acknowledged")});const Nc=Be.extend({avatar:P().describe("URL or data URI to the assistant's avatar image"),system_prompt:P().describe("System prompt that defines the assistant's behavior"),gateway_id:P().describe("Gateway ID to use for this assistant"),model:A({id:P().describe("Model ID"),connectionId:P().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),qc=Qe("assistant",Nc),Mc=[...qc],vt=Qr(()=>de([gr(),P(),J(),he(),we(P(),vt),B(vt)])),Le=we(P(),we(P(),vt)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),Zn=A({type:te("text"),text:P().describe("The text content"),providerOptions:Le}),jc=A({type:te("text"),text:P().describe("The text content"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),Ac=P().describe("File data as URL string"),Yn=A({type:te("file"),filename:P().optional().describe("Optional filename of the file"),data:Ac,mediaType:P().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:Le}),Dc=A({type:te("file"),mediaType:P().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:P().describe("Generated file data as base64 encoded string")}),Lc=A({type:te("reasoning"),text:P().describe("The reasoning text"),providerOptions:Le}),Uc=A({type:te("reasoning"),text:P().describe("The reasoning text"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),Hc=A({type:te("tool-call"),toolCallId:P().describe("ID of the tool call, used to match with tool result"),toolName:P().describe("Name of the tool being called"),input:P().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:he().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:Le}),Vc=A({type:te("tool-call"),toolCallId:P().describe("ID of the tool call"),toolName:P().describe("Name of the tool being called"),input:P().describe("Stringified JSON object with the tool call arguments"),providerExecuted:he().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),Fc=de([A({type:te("text"),value:P()}),A({type:te("json"),value:vt}),A({type:te("error-text"),value:P()}),A({type:te("error-json"),value:vt}),A({type:te("content"),value:B(de([A({type:te("text"),text:P().describe("Text content")}),A({type:te("media"),data:P().describe("Base-64 encoded media data"),mediaType:P().describe("IANA media type")})]))})]),Xn=A({type:te("tool-result"),toolCallId:P().describe("ID of the tool call that this result is associated with"),toolName:P().describe("Name of the tool that generated this result"),output:Fc.describe("Result of the tool call"),result:ge().describe("Unknown result of the tool call"),providerOptions:Le}),xc=A({type:te("tool-result"),toolCallId:P().describe("ID of the tool call that this result is associated with"),toolName:P().describe("Name of the tool that generated this result"),result:oe().describe("Result of the tool call (JSON-serializable)"),isError:he().optional().describe("Whether the result is an error or error message"),providerExecuted:he().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),zc=de([A({type:te("source"),sourceType:te("url"),id:P().describe("The ID of the source"),url:P().describe("The URL of the source"),title:P().optional().describe("The title of the source"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),A({type:te("source"),sourceType:te("document"),id:P().describe("The ID of the source"),mediaType:P().describe("IANA media type of the document (e.g., application/pdf)"),title:P().describe("The title of the document"),filename:P().optional().describe("Optional filename of the document"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")})]),Kc=A({role:te("system"),content:P().describe("System message content"),providerOptions:Le}),Wc=A({role:te("user"),content:B(de([Zn,Yn])).describe("User message content parts (text or file)"),providerOptions:Le}),Gc=A({role:te("assistant"),content:B(de([Zn,Yn,Lc,Hc,Xn])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:Le}),Jc=A({role:te("tool"),content:B(Xn).describe("Tool message content (tool results)"),providerOptions:Le}),Bc=de([Kc,Wc,Gc,Jc]),Qc=B(Bc).describe("A list of messages forming the prompt"),Zc=A({prompt:Qc.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:J().optional().describe("Maximum number of tokens to generate"),temperature:J().optional().describe("Temperature setting. The range depends on the provider and model"),topP:J().optional().describe("Nucleus sampling parameter"),topK:J().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:J().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:J().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:J().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:B(P()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:de([A({type:te("text")}),A({type:te("json"),schema:oe().optional().describe("JSON schema that the generated output should conform to"),name:P().optional().describe("Name of output that should be generated"),description:P().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:B(oe()).optional().describe("The tools that are available for the model"),toolChoice:oe().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:he().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:oe().optional().describe("Abort signal for cancelling the operation"),providerOptions:oe().optional().describe("Additional provider-specific options")}),Yc=A({content:B(de([jc,Dc,Uc,Vc,xc,zc])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:Pe(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:la({inputTokens:J().optional(),outputTokens:J().optional(),totalTokens:J().optional(),reasoningTokens:J().optional()}).describe("Usage information for the language model call"),providerMetadata:oe().optional().describe("Additional provider-specific metadata"),request:A({body:oe().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({id:P().optional().describe("ID for the generated response"),timestamp:da().optional().describe("Timestamp for the start of the generated response"),modelId:P().optional().describe("The ID of the response model that was used"),headers:we(P(),P()).optional().describe("Response headers"),body:oe().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:B(oe()).describe("Warnings for the call, e.g. unsupported settings")});A({stream:oe().describe("ReadableStream of LanguageModelV2StreamPart"),request:A({body:oe().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({headers:we(P(),P()).optional().describe("Response headers")}).optional().describe("Optional response data")});const Xc=A({supportedUrls:we(P(),B(P())).describe("Supported URL patterns by media type for the provider")});A({modelId:P().describe("The ID of the model"),logo:P().nullable(),description:P().nullable(),capabilities:B(P()),limits:A({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:A({input:J(),output:J()}).nullable(),provider:Pe(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const Cn=A({modelId:P().describe("The ID of the model"),callOptions:Zc}),eu=Be.extend({logo:P().nullable(),description:P().nullable(),capabilities:B(P()),limits:A({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:A({input:J(),output:J()}).nullable(),provider:Pe(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),tu=Qe("llm",eu,{readOnly:!0}),ru=[{name:"LLM_METADATA",inputSchema:A({modelId:P().describe("The ID of the model")}),outputSchema:Xc},{name:"LLM_DO_STREAM",inputSchema:Cn,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:Cn,outputSchema:Yc},...tu],su=A({scopes:B(P()).describe("List of scopes available"),stateSchema:we(P(),ge()).describe("JSON Schema (draft-07) defining the state structure")}),nu=[{name:"MCP_CONFIGURATION",inputSchema:A({}),outputSchema:su}],au=A({toolName:P().describe("Name of the tool to invoke on that connection"),transformCode:P().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),ou=A({code:P().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
|
|
12
|
+
`&&s++}}return[e,r]}class kn extends Event{constructor(e,r){var s,a;super(e),this.code=(s=r?.code)!=null?s:void 0,this.message=(a=r?.message)!=null?a:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,s){return s(Pn(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Pn(this),r)}}function Qi(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Hr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Hr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Hr(t.cause)}`:t.message:`${t}`}function Pn(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Wn=t=>{throw TypeError(t)},Xr=(t,e,r)=>e.has(t)||Wn("Cannot "+r),ee=(t,e,r)=>(Xr(t,e,"read from private field"),r?r.call(t):e.get(t)),le=(t,e,r)=>e.has(t)?Wn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ue=(t,e,r,s)=>(Xr(t,e,"write to private field"),e.set(t,r),r),De=(t,e,r)=>(Xr(t,e,"access private method"),r),Ee,Ge,rt,cr,pr,yt,at,gt,Ve,st,ot,nt,ht,Ce,Vr,Fr,xr,In,zr,Kr,pt,Wr,Gr;class ur extends EventTarget{constructor(e,r){var s,a;super(),le(this,Ce),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,le(this,Ee),le(this,Ge),le(this,rt),le(this,cr),le(this,pr),le(this,yt),le(this,at),le(this,gt,null),le(this,Ve),le(this,st),le(this,ot,null),le(this,nt,null),le(this,ht,null),le(this,Fr,async n=>{var i;ee(this,st).reset();const{body:o,redirected:u,status:m,headers:h}=n;if(m===204){De(this,Ce,pt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?ue(this,rt,new URL(n.url)):ue(this,rt,void 0),m!==200){De(this,Ce,pt).call(this,`Non-200 status code (${m})`,m);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){De(this,Ce,pt).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(ee(this,Ee)===this.CLOSED)return;ue(this,Ee,this.OPEN);const $=new Event("open");if((i=ee(this,ht))==null||i.call(this,$),this.dispatchEvent($),typeof o!="object"||!o||!("getReader"in o)){De(this,Ce,pt).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const g=new TextDecoder,y=o.getReader();let v=!0;do{const{done:w,value:l}=await y.read();l&&ee(this,st).feed(g.decode(l,{stream:!w})),w&&(v=!1,ee(this,st).reset(),De(this,Ce,Wr).call(this))}while(v)}),le(this,xr,n=>{ue(this,Ve,void 0),!(n.name==="AbortError"||n.type==="aborted")&&De(this,Ce,Wr).call(this,Hr(n))}),le(this,zr,n=>{typeof n.id=="string"&&ue(this,gt,n.id);const i=new MessageEvent(n.event||"message",{data:n.data,origin:ee(this,rt)?ee(this,rt).origin:ee(this,Ge).origin,lastEventId:n.id||""});ee(this,nt)&&(!n.event||n.event==="message")&&ee(this,nt).call(this,i),this.dispatchEvent(i)}),le(this,Kr,n=>{ue(this,yt,n)}),le(this,Gr,()=>{ue(this,at,void 0),ee(this,Ee)===this.CONNECTING&&De(this,Ce,Vr).call(this)});try{if(e instanceof URL)ue(this,Ge,e);else if(typeof e=="string")ue(this,Ge,new URL(e,Zi()));else throw new Error("Invalid URL")}catch{throw Qi("An invalid or illegal string was specified")}ue(this,st,Kn({onEvent:ee(this,zr),onRetry:ee(this,Kr)})),ue(this,Ee,this.CONNECTING),ue(this,yt,3e3),ue(this,pr,(s=r?.fetch)!=null?s:globalThis.fetch),ue(this,cr,(a=r?.withCredentials)!=null?a:!1),De(this,Ce,Vr).call(this)}get readyState(){return ee(this,Ee)}get url(){return ee(this,Ge).href}get withCredentials(){return ee(this,cr)}get onerror(){return ee(this,ot)}set onerror(e){ue(this,ot,e)}get onmessage(){return ee(this,nt)}set onmessage(e){ue(this,nt,e)}get onopen(){return ee(this,ht)}set onopen(e){ue(this,ht,e)}addEventListener(e,r,s){const a=r;super.addEventListener(e,a,s)}removeEventListener(e,r,s){const a=r;super.removeEventListener(e,a,s)}close(){ee(this,at)&&clearTimeout(ee(this,at)),ee(this,Ee)!==this.CLOSED&&(ee(this,Ve)&&ee(this,Ve).abort(),ue(this,Ee,this.CLOSED),ue(this,Ve,void 0))}}Ee=new WeakMap,Ge=new WeakMap,rt=new WeakMap,cr=new WeakMap,pr=new WeakMap,yt=new WeakMap,at=new WeakMap,gt=new WeakMap,Ve=new WeakMap,st=new WeakMap,ot=new WeakMap,nt=new WeakMap,ht=new WeakMap,Ce=new WeakSet,Vr=function(){ue(this,Ee,this.CONNECTING),ue(this,Ve,new AbortController),ee(this,pr)(ee(this,Ge),De(this,Ce,In).call(this)).then(ee(this,Fr)).catch(ee(this,xr))},Fr=new WeakMap,xr=new WeakMap,In=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ee(this,gt)?{"Last-Event-ID":ee(this,gt)}:void 0},cache:"no-store",signal:(t=ee(this,Ve))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},zr=new WeakMap,Kr=new WeakMap,pt=function(t,e){var r;ee(this,Ee)!==this.CLOSED&&ue(this,Ee,this.CLOSED);const s=new kn("error",{code:e,message:t});(r=ee(this,ot))==null||r.call(this,s),this.dispatchEvent(s)},Wr=function(t,e){var r;if(ee(this,Ee)===this.CLOSED)return;ue(this,Ee,this.CONNECTING);const s=new kn("error",{code:e,message:t});(r=ee(this,ot))==null||r.call(this,s),this.dispatchEvent(s),ue(this,at,setTimeout(ee(this,Gr),ee(this,yt)))},Gr=new WeakMap,ur.CONNECTING=0,ur.OPEN=1,ur.CLOSED=2;function Zi(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function mr(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Gn(t=fetch,e){return e?async(r,s)=>{const a={...e,...s,headers:s?.headers?{...mr(e.headers),...mr(s.headers)}:e.headers};return t(r,a)}:t}class Yi extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class Xi{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Gn(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new Ne("No auth provider");let e;try{e=await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Ne;return await this._startOrAuth()}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const r=mr(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){const e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,s)=>{this._eventSource=new ur(this._url.href,{...this._eventSourceInit,fetch:async(a,n)=>{const i=await this._commonHeaders();i.set("Accept","text/event-stream");const o=await e(a,{...n,headers:i});if(o.status===401&&o.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:m}=lr(o);this._resourceMetadataUrl=u,this._scope=m}return o}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{if(a.code===401&&this._authProvider){this._authThenStart().then(r,s);return}const n=new Yi(a.code,a.message,a);s(n),this.onerror?.(n)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{const n=a;try{if(this._endpoint=new URL(n.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(i){s(i),this.onerror?.(i),this.close();return}r()}),this._eventSource.onmessage=a=>{const n=a;let i;try{i=mt.parse(JSON.parse(n.data))}catch(o){this.onerror?.(o);return}this.onmessage?.(i)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new Ne("No auth provider");if(await Je(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{const r=await this._commonHeaders();r.set("content-type","application/json");const s={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._endpoint,s);if(!a.ok){const n=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:i,scope:o}=lr(a);if(this._resourceMetadataUrl=i,this._scope=o,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${n}`)}await a.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}}const ec="mcp";class tc{constructor(e){this._url=e}start(){if(this._socket)throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._socket=new WebSocket(this._url,ec),this._socket.onerror=s=>{const a="error"in s?s.error:new Error(`WebSocket error: ${JSON.stringify(s)}`);r(a),this.onerror?.(a)},this._socket.onopen=()=>{e()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=s=>{let a;try{a=mt.parse(JSON.parse(s.data))}catch(n){this.onerror?.(n);return}this.onmessage?.(a)}})}async close(){this._socket?.close()}send(e){return new Promise((r,s)=>{if(!this._socket){s(new Error("Not connected"));return}this._socket?.send(JSON.stringify(e)),r()})}}class rc extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let a;super({start(n){a=Kn({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:r,onComment:s})},transform(n){a.feed(n)}})}}const sc={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class tt extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class nc{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Gn(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??sc}async _authThenStart(){if(!this._authProvider)throw new Ne("No auth provider");let e;try{e=await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new Ne;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const r=mr(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){const{resumptionToken:r}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),r&&s.set("last-event-id",r);const a=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!a.ok){if(await a.body?.cancel(),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new tt(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,a=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(s,e),a)}_scheduleReconnection(e,r=0){const s=this._reconnectionOptions.maxRetries;if(r>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const a=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(n=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,r+1)})},a)}_handleSseStream(e,r,s){if(!e)return;const{onresumptiontoken:a,replayMessageId:n}=r;let i,o=!1,u=!1;(async()=>{try{const h=e.pipeThrough(new TextDecoderStream).pipeThrough(new rc({onRetry:y=>{this._serverRetryMs=y}})).getReader();for(;;){const{value:y,done:v}=await h.read();if(v)break;if(y.id&&(i=y.id,o=!0,a?.(y.id)),!!y.data&&(!y.event||y.event==="message"))try{const w=mt.parse(JSON.parse(y.data));ft(w)&&(u=!0,n!==void 0&&(w.id=n)),this.onmessage?.(w)}catch(w){this.onerror?.(w)}}(s||o)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(h){if(this.onerror?.(new Error(`SSE stream disconnected: ${h}`)),(s||o)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:a,replayMessageId:n},0)}catch(y){this.onerror?.(new Error(`Failed to reconnect: ${y instanceof Error?y.message:String(y)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Ne("No auth provider");if(await Je(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{const{resumptionToken:s,onresumptiontoken:a}=r||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:Lr(e)?e.id:void 0}).catch(g=>this.onerror?.(g));return}const n=await this._commonHeaders();n.set("content-type","application/json"),n.set("accept","application/json, text/event-stream");const i={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,i),u=o.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!o.ok){const g=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new tt(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:y,scope:v}=lr(o);if(this._resourceMetadataUrl=y,this._scope=v,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ne;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){const{resourceMetadataUrl:y,scope:v,error:w}=lr(o);if(w==="insufficient_scope"){const l=o.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===l)throw new tt(403,"Server returned 403 after trying upscoping");if(v&&(this._scope=v),y&&(this._resourceMetadataUrl=y),this._lastUpscopingHeader=l??void 0,await Je(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ne;return this.send(e)}}throw new tt(o.status,`Error POSTing to endpoint: ${g}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),Va(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>this.onerror?.(g));return}const h=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,$=o.headers.get("content-type");if(h)if($?.includes("text/event-stream"))this._handleSseStream(o.body,{onresumptiontoken:a},!1);else if($?.includes("application/json")){const g=await o.json(),y=Array.isArray(g)?g.map(v=>mt.parse(v)):[mt.parse(g)];for(const v of y)this.onmessage?.(v)}else throw await o.body?.cancel(),new tt(-1,`Unexpected content type: ${$}`);else await o.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,r);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new tt(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}class ac extends nc{constructor(e,r){super(e,r)}send(e,r){const s=oc(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function oc(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const r=e?.params?.protocolVersion;return r?{type:"emit",message:{result:{protocolVersion:r,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}class ic extends Ji{constructor(e,r){super(e,r)}async listTools(e,r){return await this.request({method:"tools/list",params:e},jn,r)}}const cc=async(t,e,r)=>{const s=uc(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const a=new ic({name:t?.name??"MCP Client",version:"1.0.0"});return await a.connect(s),{client:a,callStreamableTool:(n,i)=>{if(t.connection.type!=="HTTP")throw new Error("HTTP connection required");const o=new Headers(r);o.has("Authorization")||o.set("Authorization",`Bearer ${t.connection.token}`);for(const[h,$]of Object.entries(t.connection.headers??{}))o.set(h,$);const u=new URL(t.connection.url),m=u.pathname.replace(/\/+$/,"")||"/";return u.pathname=`${m}/call-tool/${encodeURIComponent(n)}`,fetch(u.href,{method:"POST",redirect:"manual",body:JSON.stringify(i),headers:o})}}},uc=(t,e,r)=>{if(t.type==="Websocket")return new tc(new URL(t.url));if(t.type!=="SSE"&&t.type!=="HTTP")return null;const a={...t.token?{authorization:`Bearer ${t.token}`}:{},...r??{},..."headers"in t?t.headers||{}:{}};if(t.type==="SSE"){const n={requestInit:{headers:a,signal:e}};return t.token&&(n.eventSourceInit={fetch:(i,o)=>fetch(i,{...o,headers:{...a,Accept:"text/event-stream"},signal:e})}),new Xi(new URL(t.url),n)}return new ac(new URL(t.url),{requestInit:{headers:a,signal:e,credentials:"include"}})},lc=t=>{try{return JSON.parse(t)}catch{return t}},or=new Map,On=(t,e)=>({...t,id:t.name,inputSchema:t.inputSchema?de(t.inputSchema):void 0,outputSchema:t.outputSchema?de(t.outputSchema):void 0,execute:r=>e(r.context,t.name)});function dc(t){const e=r=>"connection"in t?cc({connection:t.connection},void 0,r):t.client;return new Proxy({},{get(r,s){if(s==="toJSON")return null;if(typeof s!="string")throw new Error("Name must be a string");if(s==="listTools")return o;async function a(u,m=s){const h=t?.debugId?.(),$=h?{"x-trace-debug-id":h}:void 0,{client:g,callStreamableTool:y}=await e($);if(t?.streamable?.[String(m)])return y(String(m),u);const{structuredContent:v,isError:w,content:l}=await g.callTool({name:String(m),arguments:u});if(w){const p=l?.[0]?.text,c=typeof p=="string"?lc(p):null,d=c?.code&&typeof t?.getErrorByStatusCode=="function"?t.getErrorByStatusCode(c.code,c.message,c.traceId):null;throw d||new Error(`Tool ${String(m)} returned an error: ${JSON.stringify(v??l)}`)}return v}async function n(){const{client:u}=await e(),{tools:m}=await u.listTools();return m}async function i(){if(!("connection"in t))return n();const u=t.connection,m=JSON.stringify(u);try{return or.has(m)||or.set(m,n()),await or.get(m)}catch(h){console.error("Failed to list tools",h),or.delete(m);return}}async function o(){return(await i()??[]).map(m=>On(m,a))}return a.asTool=async()=>{const m=(await i()??[]).find(h=>h.name===s);if(!m)throw new Error(`Tool ${s} not found`);return On(m,a)},a}})}new Proxy({},{get(t,e){return e==="toJSON"?null:e==="forConnection"?r=>fc({connection:r}):global[e]}});function fc(t){return dc(t)}function Jn(t){return{isImplementedBy:e=>{for(const r of t){const s=typeof r.name=="string"?new RegExp(`^${r.name}$`):r.name,a=e.find(n=>s.test(n.name));if(!(!a&&r.opt)&&!a)return!1}return!0}}}const Be=A({id:P().describe("Unique identifier for the entity"),title:P().describe("Human-readable title for the entity"),description:P().nullish().describe("Description of the entity"),created_at:P().datetime(),updated_at:P().datetime(),created_by:P().optional(),updated_by:P().optional()}),hc=A({field:B(P()),operator:Pe(["eq","gt","gte","lt","lte","in","like","contains"]),value:ye()}),Bn=Br(()=>be([hc,A({operator:Pe(["and","or","not"]),conditions:B(Bn)})])),pc=A({field:B(P()),direction:Pe(["asc","desc"]),nulls:Pe(["first","last"]).optional()}),mc=A({where:Bn.optional().describe("Filter expression"),orderBy:B(pc).optional().describe("Sort expressions"),limit:J().int().min(1).max(1e3).optional().describe("Maximum number of items to return"),offset:J().int().min(0).optional().describe("Number of items to skip")});function yc(t){return A({items:B(t).describe("Array of collection items"),totalCount:J().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:fe().optional().describe("Whether there are more items available")})}const gc=A({id:P().describe("ID of the entity to retrieve")});function _c(t){return A({item:t.nullable().describe("The retrieved item, or null if not found")})}function vc(t){return A({data:t.partial().describe("Data for the new entity (id may be auto-generated)")})}function bc(t){return A({item:t.describe("The created entity with generated id")})}function wc(t){return A({id:P().describe("ID of the entity to update"),data:t.partial().describe("Partial entity data to update")})}function Sc(t){return A({item:t.describe("The updated entity")})}const $c=A({id:P().describe("ID of the entity to delete")});function Ec(t){return A({item:t.describe("The deleted entity")})}function Qe(t,e,r){const s=t.toUpperCase(),a=r?.readOnly??!1,n=[{name:`COLLECTION_${s}_LIST`,inputSchema:mc,outputSchema:yc(e)},{name:`COLLECTION_${s}_GET`,inputSchema:gc,outputSchema:_c(e)}];return a||n.push({name:`COLLECTION_${s}_CREATE`,inputSchema:vc(e),outputSchema:bc(e),opt:!0},{name:`COLLECTION_${s}_UPDATE`,inputSchema:wc(e),outputSchema:Sc(e),opt:!0},{name:`COLLECTION_${s}_DELETE`,inputSchema:$c,outputSchema:Ec(e),opt:!0}),n}const Tc=A({id:P(),name:P(),description:P().optional(),inputSchema:we(P(),ye()),outputSchema:we(P(),ye()).optional()}),kc=Be.extend({_meta:A({"io.decocms":A({id:P(),verified:fe(),scopeName:P(),appName:P(),friendlyName:P().nullable().optional(),metadata:we(P(),ye()).nullable().optional(),publishedAt:P().datetime().optional(),updatedAt:P().datetime().optional(),tools:B(Tc).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:A({$schema:P().optional(),_meta:we(P(),ye()).optional(),name:P().describe("The server name (scope/app)"),title:P().optional().describe("User-friendly title"),description:P().optional().describe("Server description"),icons:B(A({src:P(),mimeType:P().optional(),sizes:B(P()).optional(),theme:Pe(["light","dark"]).optional()})).optional(),remotes:B(A({type:Pe(["http","stdio","sse"]),url:P().optional(),headers:B(ye()).optional()})).optional(),packages:B(ye()).optional(),repository:A({url:P(),source:P().optional(),subfolder:P().optional()}).optional(),version:P().optional(),websiteUrl:P().optional()})});Qe("registry_app",kc,{readOnly:!0});const Pc=A({specversion:te("1.0").describe("CloudEvents specification version"),id:P().describe("Unique identifier for this event (UUID recommended)"),source:P().describe("Connection ID of the event publisher"),type:P().describe("Event type (e.g., 'order.created', 'user.signup')"),time:P().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:P().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:P().optional().default("application/json").describe("Content type of the data attribute"),dataschema:P().url().optional().describe("URI to the schema for the data attribute"),data:ye().optional().describe("Event payload (any JSON value)")});A({events:B(Pc).min(1).describe("Batch of CloudEvents to process")});const Ic=A({success:fe().optional().describe("Whether this event was processed successfully"),error:P().optional().describe("Error message for this event"),retryAfter:J().int().positive().optional().describe("Re-deliver this event after this many ms")});A({success:fe().optional().describe("Batch success - applies to events not in results"),error:P().optional().describe("Batch error message - applies to events not in results"),processedCount:J().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:J().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:we(P(),Ic).optional().describe("Per-event results keyed by event ID")});A({type:P().min(1).max(255).describe("Event type identifier"),subject:P().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:ye().optional().describe("Event payload"),deliverAt:P().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:P().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});A({id:P().describe("Unique event ID"),type:P().describe("Event type"),source:P().describe("Source connection ID"),time:P().describe("Event timestamp")});A({eventType:P().min(1).max(255).describe("Event type to subscribe to"),publisher:P().optional().describe("Filter events by publisher connection ID"),filter:P().max(1e3).optional().describe("JSONPath filter expression on event data")});A({subscription:A({id:P().describe("Subscription ID"),connectionId:P().describe("Subscriber connection ID"),eventType:P().describe("Event type pattern"),publisher:P().nullable().describe("Publisher connection filter"),filter:P().nullable().describe("JSONPath filter expression"),enabled:fe().describe("Whether subscription is enabled"),createdAt:P().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:P().datetime().describe("Updated timestamp (ISO 8601)")})});const Oc=A({eventType:P().min(1).max(255).describe("Event type to subscribe to"),publisher:P().optional().describe("Filter events by publisher connection ID"),filter:P().max(1e3).optional().describe("JSONPath filter expression on event data")}),Rc=A({id:P().describe("Subscription ID"),connectionId:P().describe("Subscriber connection ID"),eventType:P().describe("Event type pattern"),publisher:P().nullable().describe("Publisher connection filter"),filter:P().nullable().describe("JSONPath filter expression"),enabled:fe().describe("Whether subscription is enabled"),createdAt:P().datetime().describe("Created timestamp (ISO 8601)"),updatedAt:P().datetime().describe("Updated timestamp (ISO 8601)")});A({subscriptions:B(Oc).describe("Desired subscriptions - system will create/update/delete to match")});A({created:J().int().min(0).describe("Number of subscriptions created"),updated:J().int().min(0).describe("Number of subscriptions with filter updated"),deleted:J().int().min(0).describe("Number of subscriptions removed"),unchanged:J().int().min(0).describe("Number of subscriptions unchanged"),subscriptions:B(Rc).describe("Current subscriptions after sync")});A({subscriptionId:P().describe("Subscription ID to remove")});A({success:fe().describe("Whether unsubscribe was successful"),subscriptionId:P().describe("Subscription ID that was removed")});A({eventId:P().describe("Event ID to cancel")});A({success:fe().describe("Whether cancellation was successful"),eventId:P().describe("Event ID that was cancelled")});A({eventId:P().describe("Event ID to acknowledge")});A({success:fe().describe("Whether ACK was successful"),eventId:P().describe("Event ID that was acknowledged")});const Cc=Be.extend({avatar:P().describe("URL or data URI to the assistant's avatar image"),system_prompt:P().describe("System prompt that defines the assistant's behavior"),gateway_id:P().describe("Gateway ID to use for this assistant"),model:A({id:P().describe("Model ID"),connectionId:P().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),Nc=Qe("assistant",Cc),qc=[...Nc],vt=Br(()=>be([yr(),P(),J(),fe(),we(P(),vt),B(vt)])),Le=we(P(),we(P(),vt)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),Qn=A({type:te("text"),text:P().describe("The text content"),providerOptions:Le}),Mc=A({type:te("text"),text:P().describe("The text content"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),jc=P().describe("File data as URL string"),Zn=A({type:te("file"),filename:P().optional().describe("Optional filename of the file"),data:jc,mediaType:P().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:Le}),Ac=A({type:te("file"),mediaType:P().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:P().describe("Generated file data as base64 encoded string")}),Dc=A({type:te("reasoning"),text:P().describe("The reasoning text"),providerOptions:Le}),Lc=A({type:te("reasoning"),text:P().describe("The reasoning text"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),Uc=A({type:te("tool-call"),toolCallId:P().describe("ID of the tool call, used to match with tool result"),toolName:P().describe("Name of the tool being called"),input:P().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:fe().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:Le}),Hc=A({type:te("tool-call"),toolCallId:P().describe("ID of the tool call"),toolName:P().describe("Name of the tool being called"),input:P().describe("Stringified JSON object with the tool call arguments"),providerExecuted:fe().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),Vc=be([A({type:te("text"),value:P()}),A({type:te("json"),value:vt}),A({type:te("error-text"),value:P()}),A({type:te("error-json"),value:vt}),A({type:te("content"),value:B(be([A({type:te("text"),text:P().describe("Text content")}),A({type:te("media"),data:P().describe("Base-64 encoded media data"),mediaType:P().describe("IANA media type")})]))})]),Yn=A({type:te("tool-result"),toolCallId:P().describe("ID of the tool call that this result is associated with"),toolName:P().describe("Name of the tool that generated this result"),output:Vc.describe("Result of the tool call"),result:ye().describe("Unknown result of the tool call"),providerOptions:Le}),Fc=A({type:te("tool-result"),toolCallId:P().describe("ID of the tool call that this result is associated with"),toolName:P().describe("Name of the tool that generated this result"),result:oe().describe("Result of the tool call (JSON-serializable)"),isError:fe().optional().describe("Whether the result is an error or error message"),providerExecuted:fe().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),xc=be([A({type:te("source"),sourceType:te("url"),id:P().describe("The ID of the source"),url:P().describe("The URL of the source"),title:P().optional().describe("The title of the source"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")}),A({type:te("source"),sourceType:te("document"),id:P().describe("The ID of the source"),mediaType:P().describe("IANA media type of the document (e.g., application/pdf)"),title:P().describe("The title of the document"),filename:P().optional().describe("Optional filename of the document"),providerMetadata:oe().optional().describe("Additional provider-specific metadata")})]),zc=A({role:te("system"),content:P().describe("System message content"),providerOptions:Le}),Kc=A({role:te("user"),content:B(be([Qn,Zn])).describe("User message content parts (text or file)"),providerOptions:Le}),Wc=A({role:te("assistant"),content:B(be([Qn,Zn,Dc,Uc,Yn])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:Le}),Gc=A({role:te("tool"),content:B(Yn).describe("Tool message content (tool results)"),providerOptions:Le}),Jc=be([zc,Kc,Wc,Gc]),Bc=B(Jc).describe("A list of messages forming the prompt"),Qc=A({prompt:Bc.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:J().optional().describe("Maximum number of tokens to generate"),temperature:J().optional().describe("Temperature setting. The range depends on the provider and model"),topP:J().optional().describe("Nucleus sampling parameter"),topK:J().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:J().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:J().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:J().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:B(P()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:be([A({type:te("text")}),A({type:te("json"),schema:oe().optional().describe("JSON schema that the generated output should conform to"),name:P().optional().describe("Name of output that should be generated"),description:P().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:B(oe()).optional().describe("The tools that are available for the model"),toolChoice:oe().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:fe().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:oe().optional().describe("Abort signal for cancelling the operation"),providerOptions:oe().optional().describe("Additional provider-specific options")}),Zc=A({content:B(be([Mc,Ac,Lc,Hc,Fc,xc])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:Pe(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:ua({inputTokens:J().optional(),outputTokens:J().optional(),totalTokens:J().optional(),reasoningTokens:J().optional()}).describe("Usage information for the language model call"),providerMetadata:oe().optional().describe("Additional provider-specific metadata"),request:A({body:oe().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({id:P().optional().describe("ID for the generated response"),timestamp:la().optional().describe("Timestamp for the start of the generated response"),modelId:P().optional().describe("The ID of the response model that was used"),headers:we(P(),P()).optional().describe("Response headers"),body:oe().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:B(oe()).describe("Warnings for the call, e.g. unsupported settings")});A({stream:oe().describe("ReadableStream of LanguageModelV2StreamPart"),request:A({body:oe().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({headers:we(P(),P()).optional().describe("Response headers")}).optional().describe("Optional response data")});const Yc=A({supportedUrls:we(P(),B(P())).describe("Supported URL patterns by media type for the provider")});A({modelId:P().describe("The ID of the model"),logo:P().nullable(),description:P().nullable(),capabilities:B(P()),limits:A({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:A({input:J(),output:J()}).nullable(),provider:Pe(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const Rn=A({modelId:P().describe("The ID of the model"),callOptions:Qc}),Xc=Be.extend({logo:P().nullable(),description:P().nullable(),capabilities:B(P()),limits:A({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:A({input:J(),output:J()}).nullable(),provider:Pe(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),eu=Qe("llm",Xc,{readOnly:!0}),tu=[{name:"LLM_METADATA",inputSchema:A({modelId:P().describe("The ID of the model")}),outputSchema:Yc},{name:"LLM_DO_STREAM",inputSchema:Rn,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:Rn,outputSchema:Zc},...eu],ru=A({scopes:B(P()).describe("List of scopes available"),stateSchema:we(P(),ye()).describe("JSON Schema (draft-07) defining the state structure")}),su=[{name:"MCP_CONFIGURATION",inputSchema:A({}),outputSchema:ru}],nu=A({toolName:P().describe("Name of the tool to invoke on that connection"),transformCode:P().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),au=A({code:P().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
|
|
13
13
|
The input is the resolved value of the references in the input field. Example:
|
|
14
14
|
{
|
|
15
15
|
"input": {
|
|
@@ -18,7 +18,7 @@ import{bj as oe,bk as ss,v as P,M as J,Q as he,L as gr,W as B,I as na,H as de,X
|
|
|
18
18
|
},
|
|
19
19
|
"code": "export default function(input): Output { return { result: \`\${input.name} is \${input.age} years old.\` } }"
|
|
20
20
|
}
|
|
21
|
-
`)});A({signalName:P().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")});const
|
|
21
|
+
`)});A({signalName:P().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")});const ou=be([nu.describe("Call an external tool via MCP connection. "),au.describe("Run pure TypeScript code for data transformation. Useful to merge data from multiple steps and transform it.")]),iu=A({maxAttempts:J().optional().describe("Max retry attempts on failure (default: 1, no retries)"),backoffMs:J().optional().describe("Initial delay between retries in ms (doubles each attempt)"),timeoutMs:J().optional().describe("Max execution time in ms before step fails (default: 30000)")}),Xn=Br(()=>A({type:P().optional(),properties:we(P(),ye()).optional(),required:B(P()).optional(),description:P().optional(),additionalProperties:fe().optional(),additionalItems:fe().optional(),items:Xn.optional()}).passthrough()),cu=A({name:P().min(1).describe("Unique identifier for this step. Other steps reference its output as @name.field"),description:P().optional().describe("What this step does"),action:ou,input:we(P(),ye()).optional().describe("Data passed to the action. Use @ref for dynamic values: @input.field (workflow input), @stepName.field (previous step output), @item/@index (loop context). Example: { 'userId': '@input.user_id', 'data': '@fetch.result' }"),outputSchema:Xn.optional().describe("Optional JSON Schema describing the expected output of the step."),config:iu.optional().describe("Retry and timeout settings")}),uu=Pe(["enqueued","running","success","error","failed","cancelled"]).default("enqueued"),ea=Be.extend({gateway_id:P().describe("ID of the gateway that will be used to execute the workflow"),status:uu.describe("Current status of the workflow execution"),input:we(P(),ye()).optional().describe("Input data for the workflow execution"),output:ye().optional().describe("Output data for the workflow execution"),completed_at_epoch_ms:J().nullish().describe("Timestamp of when the workflow execution completed"),start_at_epoch_ms:J().nullish().describe("Timestamp of when the workflow execution started or will start"),timeout_ms:J().nullish().describe("Timeout in milliseconds for the workflow execution"),deadline_at_epoch_ms:J().nullish().describe("Deadline for the workflow execution - when the workflow execution will be cancelled if it is not completed. This is read-only and is set by the workflow engine when an execution is created."),error:ye().nullish().describe("Error that occurred during the workflow execution"),completed_steps:A({success:B(P()).describe("Names of the steps that were completed successfully"),error:B(P()).describe("Names of the steps that errored")}).optional().describe("Names of the steps that were completed and their status")}),lu=Pe(["signal","timer","message","output","step_started","step_completed","workflow_started","workflow_completed"]);Be.extend({execution_id:P(),type:lu,name:P().nullish(),payload:ye().optional(),visible_at:J().nullish(),consumed_at:J().nullish(),source_execution_id:P().nullish()});const du=Be.extend({description:P().optional().describe("Human-readable summary of what this workflow does"),steps:B(cu).describe("Ordered list of steps. Execution order is auto-determined by @ref dependencies: steps with no @ref dependencies run in parallel; steps referencing @stepName wait for that step to complete.")}),fu=Qe("workflow",du),hu={maxAttempts:1,timeoutMs:3e4},Pu={name:"Initial Step",action:{code:`
|
|
22
22
|
interface Input {
|
|
23
23
|
example: string;
|
|
24
24
|
}
|
|
@@ -31,4 +31,4 @@ import{bj as oe,bk as ss,v as P,M as J,Q as he,L as gr,W as B,I as na,H as de,X
|
|
|
31
31
|
return {
|
|
32
32
|
result: input.example
|
|
33
33
|
}
|
|
34
|
-
}`},config:
|
|
34
|
+
}`},config:hu,outputSchema:{type:"object",properties:{result:{type:"string",description:"The result of the step"}},required:["result"],description:"The output of the step. This is a JSON Schema describing the expected output of the step."}},pu=Qe("workflow_execution",ea),mu=[...fu,...pu],yu=[...mu],gu=Qe("workflow_execution",ea),Cn={LLMS:tu,WORKFLOW:yu,WORKFLOW_EXECUTION:gu,ASSISTANTS:qc,MCP:su};function _u(t){return t.map(e=>({name:e.name,inputSchema:e.inputSchema?(()=>{try{return de(e.inputSchema)}catch(r){return console.error(`Failed to convert input schema for ${e.name}:`,r),A({})}})():A({}),outputSchema:e.outputSchema?(()=>{try{return de(e.outputSchema)}catch(r){return console.error(`Failed to convert output schema for ${e.name}:`,r),A({})}})():A({})}))}function vu(t,e){const r=t.tools;if(!r||r.length===0)return!1;const s=r.map(i=>({name:i.name,inputSchema:i.inputSchema})),a=e.map(i=>({name:i.name,inputSchema:i.inputSchema,opt:i.opt}));return Jn(a).isImplementedBy(s)}function Iu({connections:t,binding:e}){const r=(()=>{if(e){if(typeof e=="string"){const s=e.toUpperCase(),a=Cn[s];if(!a){console.warn(`[useBindingConnections] Unknown binding "${e}". Available bindings: ${Object.keys(Cn).join(", ")}. Returning all connections without filtering.`);return}return a}if(e.length===0){console.warn("[useBindingConnections] Empty binding array provided. Returning all connections without filtering.");return}return _u(e)}})();return t?r?t.filter(s=>vu(s,r)):t:[]}function bu(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function ta(t){if(!t||t.length===0)return[];const e=/^COLLECTION_(.+)_LIST$/,r=[];for(const s of t){const a=s.name.match(e);a?.[1]&&r.push(a[1])}return r}function wu(t,e){const s=t.find(u=>u.name===`COLLECTION_${e}_CREATE`)?.inputSchema?.properties;if(s&&typeof s=="object"&&"data"in s)return s.data;const n=t.find(u=>u.name===`COLLECTION_${e}_UPDATE`)?.inputSchema?.properties;if(n&&typeof n=="object"&&"data"in n)return n.data;const o=t.find(u=>u.name===`COLLECTION_${e}_LIST`)?.outputSchema?.properties;if(o&&typeof o=="object"&&"items"in o){const u=o.items;if(u.items)return u.items}}function Su(t,e){const r=e.toUpperCase();return{hasCreateTool:t.some(s=>s.name===`COLLECTION_${r}_CREATE`),hasUpdateTool:t.some(s=>s.name===`COLLECTION_${r}_UPDATE`),hasDeleteTool:t.some(s=>s.name===`COLLECTION_${r}_DELETE`)}}function $u(t){if(!t||t.length===0)return[];const e=ta(t);if(e.length===0)return[];const r=[];for(const s of e)try{const a=Qe(s.toLowerCase(),Be,{readOnly:!0}),n=t.map(m=>({name:m.name,inputSchema:m.inputSchema})),i=a.map(m=>({name:m.name,inputSchema:m.inputSchema}));if(Jn(i).isImplementedBy(n)){const m=Su(t,s);r.push({name:s,displayName:bu(s),schema:wu(t,s),...m})}}catch{}return r}function Ou(t){return $u(t?.tools??null)}function Ru(t){return t?t.filter(e=>ta(e.tools).find(r=>r==="REGISTRY_APP")):[]}export{Ai as A,Be as B,Pu as D,rc as E,Ru as a,Ou as b,zn as c,Y as d,zo as r,Iu as u};
|