@decocms/mesh 1.0.15 → 1.0.16
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-DaEUMwle.js → AlertCircle-cYjr_0xB.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CvFDkdiU.js → ArrowLeft-CBi8stO3.js} +1 -1
- package/dist/client/assets/{Calendar-DBqzL4c-.js → Calendar-cB-o1wit.js} +1 -1
- package/dist/client/assets/{ChevronDown-g4L12M9A.js → ChevronDown-7kPeUreU.js} +1 -1
- package/dist/client/assets/{Clock-C-uwthk9.js → Clock-D4OCvk0s.js} +1 -1
- package/dist/client/assets/{Copy01-CHjgpWtl.js → Copy01-DmZIDbuC.js} +1 -1
- package/dist/client/assets/{CpuChip02-DlCI7cQJ.js → CpuChip02-CvUOZekE.js} +1 -1
- package/dist/client/assets/{DotsVertical-CIfapH0j.js → DotsVertical-CugHspqx.js} +1 -1
- package/dist/client/assets/{File06-CBkqKj5m.js → File06-B9Csx588.js} +1 -1
- package/dist/client/assets/{GitBranch01-Ci5lqvRi.js → GitBranch01-DGYWk3k6.js} +1 -1
- package/dist/client/assets/{Inbox01-DCkU3Xgq.js → Inbox01-x47sKUjp.js} +1 -1
- package/dist/client/assets/{InfoCircle-BwNsGATl.js → InfoCircle-DXZ2AFmC.js} +1 -1
- package/dist/client/assets/{Key01-5nxXQgMM.js → Key01-BemiGYAL.js} +1 -1
- package/dist/client/assets/{LinkExternal01-ISpHuMJE.js → LinkExternal01-BrZUQjLP.js} +1 -1
- package/dist/client/assets/{Loading01-r04aEG5T.js → Loading01-CZ--C9o4.js} +1 -1
- package/dist/client/assets/{Plus-CS_Y2Vnc.js → Plus-B87V-eUk.js} +1 -1
- package/dist/client/assets/SearchMd-C_x78fQD.js +1 -0
- package/dist/client/assets/{Terminal-DYN6gEAz.js → Terminal-Bp8rdp_p.js} +1 -1
- package/dist/client/assets/{Trash01-DVxmznxT.js → Trash01-kv9nDzIp.js} +1 -1
- package/dist/client/assets/{Upload01-Da0sGkRE.js → Upload01-BkY8x2qR.js} +1 -1
- package/dist/client/assets/{X-BX0rl0N7.js → X-BI6-CrX0.js} +1 -1
- package/dist/client/assets/{XClose-BUuGHVgA.js → XClose-CPlecLXh.js} +1 -1
- package/dist/client/assets/{alert-dialog-DdP064l-.js → alert-dialog-DLlk9oGk.js} +3 -3
- package/dist/client/assets/{auth-AUS48lXs.js → auth-O7mzDtBv.js} +1 -1
- package/dist/client/assets/{auth-catchall-DqCIX1bA.js → auth-catchall-Cj2BmrFb.js} +1 -1
- package/dist/client/assets/avatar-yEkJ_N8H.js +1 -0
- package/dist/client/assets/badge-CzGd9Js-.js +1 -0
- package/dist/client/assets/button-RGWd1X_P.js +1 -0
- package/dist/client/assets/card-Bch45nKF.js +1 -0
- package/dist/client/assets/checkbox-Bkz-wJOC.js +1 -0
- package/dist/client/assets/collection-detail-BrxtwdmN.js +184 -0
- package/dist/client/assets/collection-display-button-s3SUZ2ky.js +1 -0
- package/dist/client/assets/{collection-header-DcpyPzrC.js → collection-header-g7B4v38B.js} +1 -1
- package/dist/client/assets/{collection-page-DpUZNbpd.js → collection-page-CXQu5PW5.js} +1 -1
- package/dist/client/assets/collection-search-B_ze9BPw.js +1 -0
- package/dist/client/assets/collection-table-wrapper-yPDs4QFo.js +1 -0
- package/dist/client/assets/connection-card-B2ZNmA6T.js +1 -0
- package/dist/client/assets/connection-detail-D98NZkPb.js +1 -0
- package/dist/client/assets/connections-CdxYZab0.js +1 -0
- package/dist/client/assets/{core-DJoPglro.js → core-GvCAeL42.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-fbCy_hNu.js → create-organization-dialog-c2EjUvFE.js} +1 -1
- package/dist/client/assets/dialog-xbeC24qR.js +1 -0
- package/dist/client/assets/dropdown-menu-Dz-Cfe4c.js +1 -0
- package/dist/client/assets/{env-vars-editor-DEYac6H7.js → env-vars-editor-B-ADXMkg.js} +1 -1
- package/dist/client/assets/{error-boundary-CdmYlIj7.js → error-boundary-IlI5HY5C.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Ty2DjF1e.js → extract-connection-data-3bWrIOWG.js} +1 -1
- package/dist/client/assets/form-C0miQmjx.js +1 -0
- package/dist/client/assets/formatDistanceToNow-BgvVIEk6.js +1 -0
- package/dist/client/assets/gateway-detail-C1Vlo23c.js +1 -0
- package/dist/client/assets/gateways-BphVjp-r.js +1 -0
- package/dist/client/assets/home-GBkZhhXc.js +1 -0
- package/dist/client/assets/{index-JV0IIYp6.js → index-CbrmpR2c.js} +1 -1
- package/dist/client/assets/index-Ce0bVa0I.js +155 -0
- package/dist/client/assets/index-FEm5nfEy.css +1 -0
- package/dist/client/assets/{index-DDiLOLYT.js → index-KVbZU2bI.js} +1 -1
- package/dist/client/assets/index-RUqw7d0T.js +25 -0
- package/dist/client/assets/input-Cc7Y8Lsj.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-i1hiMNnF.js → json-syntax-highlighter-Bc0wDiKJ.js} +2 -2
- package/dist/client/assets/json-zc228CLg.js +1 -0
- package/dist/client/assets/{layout-dxbGsEKV.js → layout-k5sx-zLk.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-QDCjbXst.js → lazy-highlighter-tp_1h6Wp.js} +1 -1
- package/dist/client/assets/{localstorage-keys-D7pZSS7H.js → localstorage-keys-C2n4sqaz.js} +1 -1
- package/dist/client/assets/login-BI3qBB8Y.js +1 -0
- package/dist/client/assets/{mcp-oauth-D7V7V-GS.js → mcp-oauth-BrdcIayH.js} +1 -1
- package/dist/client/assets/members-ClQFNkDC.js +3 -0
- package/dist/client/assets/monitoring-BXnIcCQV.js +1 -0
- package/dist/client/assets/oauth-callback-uokDqdRF.js +1 -0
- package/dist/client/assets/{page-C8KGQPlY.js → page-D8Upjw8L.js} +2 -2
- package/dist/client/assets/popover-gYOPU7b5.js +1 -0
- package/dist/client/assets/prism-light-BmyQu-TG.js +1 -0
- package/dist/client/assets/{resizable-B3HA_CX4.js → resizable-0evkHPjb.js} +48 -48
- package/dist/client/assets/resource-tabs-Bp2LCK5n.js +1 -0
- package/dist/client/assets/select-B-74Vw7Q.js +1 -0
- package/dist/client/assets/settings-DZGZ9pQP.js +1 -0
- package/dist/client/assets/shell-layout-CmBAtkbZ.js +17 -0
- package/dist/client/assets/spinner-B6Gpa1lS.js +1 -0
- package/dist/client/assets/store-CZ1oyjvA.js +1 -0
- package/dist/client/assets/store-app-detail-Cr8HLsme.js +1 -0
- package/dist/client/assets/switch-C6VfIG9f.js +1 -0
- package/dist/client/assets/{tools-list-BsHebq88.js → tools-list-6PdjsEP-.js} +1 -1
- package/dist/client/assets/tooltip-B77piVwL.js +1 -0
- package/dist/client/assets/{types-D4T3qWDr.js → types-0U77q4OL.js} +5 -5
- package/dist/client/assets/{use-binding-CapMpNVF.js → use-binding-DOHpn0td.js} +6 -6
- package/dist/client/assets/use-connection-CcfriG4b.js +2 -0
- package/dist/client/assets/{use-connection-resources-FqHsvBSA.js → use-connection-resources-C-ecJARs.js} +1 -1
- package/dist/client/assets/{use-gateway-CseaalWF.js → use-gateway-CCphplYZ.js} +1 -1
- package/dist/client/assets/{use-list-state-7NLbXyOC.js → use-list-state-Bcpc0dEc.js} +1 -1
- package/dist/client/assets/{use-mcp-M6XXMHar.js → use-mcp-B7yS6xB_.js} +1 -1
- package/dist/client/assets/{use-members-DzZB15s9.js → use-members-ii7q5pxE.js} +1 -1
- package/dist/client/assets/{use-mobile-TpeNqylz.js → use-mobile-DYo2aQNt.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BAhAEDx8.js → use-organization-settings-uQsDNKHC.js} +1 -1
- package/dist/client/assets/{use-tool-call-CQCb5PBf.js → use-tool-call-CI1nZAFC.js} +1 -1
- package/dist/client/assets/useQuery-CF3kr9sY.js +1 -0
- package/dist/client/assets/view-mode-toggle-BGpxvqYI.js +1 -0
- package/dist/client/assets/{well-known-mcp-BPQQU1v0.js → well-known-mcp-B16sbKCU.js} +1 -1
- package/dist/client/empty-state-error.svg +19 -0
- package/dist/client/empty-state-logs.svg +80 -0
- package/dist/client/empty-state-success-muted.svg +19 -0
- package/dist/client/empty-state-success.svg +19 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/migrate.js +45 -45
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/CheckCircle-CILz6OCh.js +0 -1
- package/dist/client/assets/SearchMd-1Gq7nypQ.js +0 -1
- package/dist/client/assets/avatar-bcdjVFyi.js +0 -1
- package/dist/client/assets/badge-1WraHGEG.js +0 -1
- package/dist/client/assets/button-DodNLkpL.js +0 -1
- package/dist/client/assets/card-BHz-BqEu.js +0 -1
- package/dist/client/assets/checkbox-Bj9jBMQF.js +0 -1
- package/dist/client/assets/collection-detail-QGbMDWA7.js +0 -184
- package/dist/client/assets/collection-display-button-475jHotV.js +0 -1
- package/dist/client/assets/collection-search-DVBnlN6E.js +0 -1
- package/dist/client/assets/collection-table-wrapper-DQ4F9pbh.js +0 -1
- package/dist/client/assets/connection-card-opsQBUfD.js +0 -1
- package/dist/client/assets/connection-detail-DpiL6xjK.js +0 -1
- package/dist/client/assets/connections-CeDc3J_o.js +0 -1
- package/dist/client/assets/dialog-BqvvzTa7.js +0 -1
- package/dist/client/assets/dropdown-menu-DrQKdl4f.js +0 -1
- package/dist/client/assets/form-Bus-fIfC.js +0 -1
- package/dist/client/assets/formatDistanceToNow-D46rGC8T.js +0 -1
- package/dist/client/assets/gateway-detail-fCVh3_nF.js +0 -1
- package/dist/client/assets/gateways-DQmZoxNy.js +0 -1
- package/dist/client/assets/home-heelYyW2.js +0 -1
- package/dist/client/assets/index-A52jfksK.js +0 -156
- package/dist/client/assets/index-DKrh5SL2.css +0 -1
- package/dist/client/assets/index-td_4XAxf.js +0 -25
- package/dist/client/assets/input-BXHWk19m.js +0 -1
- package/dist/client/assets/json-gPxhilNK.js +0 -1
- package/dist/client/assets/login-CcnR2b1q.js +0 -1
- package/dist/client/assets/members-D5QtYSzf.js +0 -3
- package/dist/client/assets/monitoring-Cp92YRPy.js +0 -1
- package/dist/client/assets/oauth-callback-1_PgXFG_.js +0 -1
- package/dist/client/assets/popover-MhzpcVkW.js +0 -1
- package/dist/client/assets/prism-light-C-ukkBST.js +0 -1
- package/dist/client/assets/resource-tabs-ru5yaRIE.js +0 -1
- package/dist/client/assets/select-Be0LRVWn.js +0 -1
- package/dist/client/assets/settings-gZFi_2QA.js +0 -1
- package/dist/client/assets/shell-layout-adVEIdhn.js +0 -17
- package/dist/client/assets/spinner-oZ2DO2-U.js +0 -1
- package/dist/client/assets/store-DzO4PTg0.js +0 -1
- package/dist/client/assets/store-app-detail-BIXt1EdE.js +0 -1
- package/dist/client/assets/switch-DsCvClV8.js +0 -1
- package/dist/client/assets/tooltip-BjhP6ibY.js +0 -1
- package/dist/client/assets/use-connection-BX5-4xHw.js +0 -2
- package/dist/client/assets/useQuery-ojqdZMTH.js +0 -1
- package/dist/client/assets/utils-DgLfrg3u.js +0 -1
- package/dist/client/assets/view-mode-toggle-DAXMt6ZW.js +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{b1 as ue,b2 as ss,v as I,aN as J,X as we,aM as gr,V as B,aK as aa,aI as de,aO as ie,a0 as Pe,b3 as it,b4 as oa,s as A,b5 as Br,b6 as ns,b7 as ia,b8 as qn,b9 as ca,ba as ua,bb as la,aj as jn,aL as Qr,aP as ye,W as ge,bc as _t,bd as da,aJ as fa}from"./index-A52jfksK.js";import{C as ha,P as pa,a as ma,G as ya,M as G,E as Z,b as ga,L as _a,c as va,i as ft,d as ba,e as Ur,f as wa,R as Xe,g as Sa,h as Hr,j as $a,k as Ea,l as Ta,T as as,m as Mn,n as ka,o as Pa,p as Ia,q as Oa,I as Ra,S as Ca,r as wt,s as Na,t as qa,u as ja,v as Ma,w as Aa,x as Da,y as An,z as La,A as Ua,B as Ha,D as Va,F as Fa,U as Ne,H as Je,J as dr,K as mt,N as xa}from"./auth-AUS48lXs.js";var za=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())}}},Ka=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=ie(r):typeof r=="number"?t.number=ie(r):typeof r=="boolean"?t.boolean=ie(r):r===null?t.null=gr():Array.isArray(r)?t.array=void 0:typeof r=="object"&&(t.object=void 0)}},Wa=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 ie(t[0]);if(e==="string")return Pe(t);if(e==="number"){const[r,s,...a]=t;return de([ie(r),ie(s),...a.map(n=>ie(n))])}return e==="boolean"?de([ie(!0),ie(!1)]):!1}},Ga=class{apply(t,e){const r=e;if(r.type==="string"&&r.format==="binary"&&r.contentEncoding==="binary"){let s=oa();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}}},Ja=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=I())}},Ba=class{apply(t,e){const r=e;if(r.minLength!==void 0&&t.string!==!1){const s=t.string||I();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length>=r.minLength,{message:`String must be at least ${r.minLength} characters long`}))}}},Qa=class{apply(t,e){const r=e;if(r.maxLength!==void 0&&t.string!==!1){const s=t.string||I();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length<=r.maxLength,{message:`String must be at most ${r.maxLength} characters long`}))}}},Za=class{apply(t,e){const r=e;if(r.pattern&&t.string!==!1){const s=t.string||I();if(s instanceof Br){const a=new RegExp(r.pattern);t.string=s.regex(a)}}}},Xa=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))}}},eo=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)}}},to=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)}}},ro=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}`}))}}},so=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(ue()))}},no=class{apply(t,e){const r=e;r.minItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(ue())).min(r.minItems))}},ao=class{apply(t,e){const r=e;r.maxItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(ue())).max(r.maxItems))}},oo=class{apply(t,e){const r=e;if(t.array!==!1)if(Array.isArray(r.items))t.array=t.array||B(ue());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 ia){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(ue()):t.array=B(ue()).max(0):typeof r.items=="boolean"&&r.items===!0?t.array=t.array||B(ue()):r.prefixItems&&(t.array=t.array||B(ue()))}},io=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}},co=class{apply(t,e){const r=e;t.object!==!1&&(r.properties||r.required||r.additionalProperties!==void 0)&&(t.object=t.object||A({}).passthrough())}},uo=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())}},lo=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`})}}},fo=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 vt(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)=>vt(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)&&vt(t[a],e[a]))}return!1}function ho(){return t=>{if(!Array.isArray(t))return!0;const e=[];return t.every(r=>e.some(a=>vt(r,a))?!1:(e.push(r),!0))}}function fr(t,e){return t.safeParse(e).success}var po=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"})}},mo=class{apply(t,e){return e.uniqueItems!==!0?t:t.refine(ho(),{message:"Array items must be unique"})}},yo=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)}},go=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)}},_o=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"})}},vo=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}},bo=class{apply(t,e){const r=e;if(!r.properties&&!r.required&&r.additionalProperties!==!1)return t;if(t instanceof ca||t instanceof ua){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"})}},wo=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=>vt(s,a)),{message:"Value must match one of the enum values"})}},So=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=>vt(s,r),{message:"Value must equal the const value"})}},$o=class{apply(t,e){return e.description&&(t=t.describe(e.description)),t}},Eo=class{apply(t,e){var r;const s=e;return!((r=s.required)!=null&&r.includes("__proto__"))||e.type!==void 0?t:ue().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))}},To=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"})}},ko=class{apply(t,e){const{default:r}=e;return r===void 0||!t.safeParse(r).success?t:t.default(r)}},Po=[new Ka,new Wa,new za,new Ga,new Ja,new so,new uo,new Ba,new Qa,new Za,new Xa,new Ya,new eo,new to,new ro,new io,new no,new ao,new oo,new lo,new fo,new co],Io=[new Eo,new wo,new So,new yo,new go,new _o,new vo,new bo,new To,new po,new mo,new ko,new $o];function fe(t){if(typeof t=="boolean")return t?ue():ss();const e={};for(const a of Po)a.apply(e,t);const r=[];if(e.string!==!1&&r.push(e.string||I()),e.number!==!1&&r.push(e.number||J()),e.boolean!==!1&&r.push(e.boolean||we()),e.null!==!1&&r.push(e.null||gr()),e.array!==!1&&r.push(e.array||B(ue())),e.tuple!==!1&&e.tuple!==void 0&&r.push(e.tuple),e.object!==!1)if(e.object)r.push(e.object);else{const a=aa(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=ue();for(const a of Io)s=a.apply(s,t);return s}function _r(t){return!!t._zod}function He(t,e){return _r(t)?la(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 Oo(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=Oo(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 Ro=6e4;class Co{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(ha,r=>{this._oncancel(r)}),this.setNotificationHandler(pa,r=>{this._onprogress(r)}),this.setRequestHandler(ma,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ya,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(ga,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,[Xe]:{taskId:n}}}}return await a()};return await a()}),this.setRequestHandler(_a,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(va,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)||ba(n)?this._onresponse(n):Ur(n)?this._onrequest(n,i):wa(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?.[Xe]?.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=Sa(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||{},[Xe]: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??Ro,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},$a,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},Ea,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Ta,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||{},[Xe]: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||{},[Xe]: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||{},[Xe]: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 No(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 St={exports:{}},kr={},je={},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 X(){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)||(ne(_,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 se=this._scope.toName(_);return this._for(new S(W,se,T,N),()=>z(se))}forOf(_,T,N,z=r.varKinds.const){const W=this._scope.toName(_);if(this.opts.es5){const se=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${se}.length`,te=>{this.var(W,(0,e._)`${se}[${te}]`),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,se)=>(se instanceof e.Name&&(se=N(se)),se instanceof e._Code?W.push(...se._items):W.push(se),W),[]));function N(W){const se=T[W.str];return se===void 0||_[W.str]!==1?W:(delete _[W.str],se)}function z(W){return W instanceof e._Code&&W._items.some(se=>se instanceof e.Name&&_[se.str]===1&&T[se.str]!==void 0)}}function ne(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._)`!${M(R)}`}t.not=_e;const ve=P(t.operators.AND);function oe(...R){return R.reduce(ve)}t.and=oe;const Ie=P(t.operators.OR);function L(...R){return R.reduce(Ie)}t.or=L;function P(R){return(_,T)=>_===e.nil?T:T===e.nil?_:(0,e._)`${M(_)} ${R} ${M(T)}`}function M(R){return R instanceof e.Name?R:(0,e._)`(${R})`}})(Ir)),Ir}var Q={},hs;function re(){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=X(),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 $t={},ps;function Fe(){if(ps)return $t;ps=1,Object.defineProperty($t,"__esModule",{value:!0});const t=X(),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 $t.default=e,$t}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=X(),r=re(),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 qo(){if(ys)return ze;ys=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.boolOrEmptySchema=ze.topBoolOrEmptySchema=void 0;const t=vr(),e=X(),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={},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 Me={},_s;function Un(){if(_s)return Me;_s=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.shouldUseRule=Me.shouldUseGroup=Me.schemaHasRulesForType=void 0;function t({schema:s,self:a},n){const i=a.RULES.types[n];return i&&i!==!0&&e(s,i)}Me.schemaHasRulesForType=t;function e(s,a){return a.rules.some(n=>r(s,n))}Me.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 Me.shouldUseRule=r,Me}var vs;function pr(){if(vs)return me;vs=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=Ln(),e=Un(),r=vr(),s=X(),a=re();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
|
|
1
|
+
import{b1 as ue,b2 as ss,w as I,aM as J,Y as we,aL as gr,W as B,aJ as aa,aH as de,aN as ie,a0 as Pe,b3 as it,b4 as oa,v as A,b5 as Br,b6 as ns,b7 as ia,b8 as qn,b9 as ca,ba as ua,bb as la,aj as jn,aK as Qr,aO as ye,X as ge,bc as _t,bd as da,aI as fa}from"./index-Ce0bVa0I.js";import{C as ha,P as pa,a as ma,G as ya,M as G,E as Z,b as ga,L as _a,c as va,i as ft,d as ba,e as Ur,f as wa,R as Ye,g as Sa,h as Hr,j as $a,k as Ea,l as Ta,T as as,m as Mn,n as ka,o as Pa,p as Ia,q as Oa,I as Ra,S as Ca,r as wt,s as Na,t as qa,u as ja,v as Ma,w as Aa,x as Da,y as An,z as La,A as Ua,B as Ha,D as Va,F as Fa,U as Ne,H as Je,J as dr,K as mt,N as xa}from"./auth-O7mzDtBv.js";var za=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())}}},Ka=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=ie(r):typeof r=="number"?t.number=ie(r):typeof r=="boolean"?t.boolean=ie(r):r===null?t.null=gr():Array.isArray(r)?t.array=void 0:typeof r=="object"&&(t.object=void 0)}},Wa=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 ie(t[0]);if(e==="string")return Pe(t);if(e==="number"){const[r,s,...a]=t;return de([ie(r),ie(s),...a.map(n=>ie(n))])}return e==="boolean"?de([ie(!0),ie(!1)]):!1}},Ga=class{apply(t,e){const r=e;if(r.type==="string"&&r.format==="binary"&&r.contentEncoding==="binary"){let s=oa();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}}},Ja=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=I())}},Ba=class{apply(t,e){const r=e;if(r.minLength!==void 0&&t.string!==!1){const s=t.string||I();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length>=r.minLength,{message:`String must be at least ${r.minLength} characters long`}))}}},Qa=class{apply(t,e){const r=e;if(r.maxLength!==void 0&&t.string!==!1){const s=t.string||I();s instanceof Br&&(t.string=s.refine(a=>Array.from(a).length<=r.maxLength,{message:`String must be at most ${r.maxLength} characters long`}))}}},Za=class{apply(t,e){const r=e;if(r.pattern&&t.string!==!1){const s=t.string||I();if(s instanceof Br){const a=new RegExp(r.pattern);t.string=s.regex(a)}}}},Ya=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))}}},Xa=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))}}},eo=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)}}},to=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)}}},ro=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}`}))}}},so=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(ue()))}},no=class{apply(t,e){const r=e;r.minItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(ue())).min(r.minItems))}},ao=class{apply(t,e){const r=e;r.maxItems!==void 0&&t.array!==!1&&(t.array=(t.array||B(ue())).max(r.maxItems))}},oo=class{apply(t,e){const r=e;if(t.array!==!1)if(Array.isArray(r.items))t.array=t.array||B(ue());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 ia){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(ue()):t.array=B(ue()).max(0):typeof r.items=="boolean"&&r.items===!0?t.array=t.array||B(ue()):r.prefixItems&&(t.array=t.array||B(ue()))}},io=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}},co=class{apply(t,e){const r=e;t.object!==!1&&(r.properties||r.required||r.additionalProperties!==void 0)&&(t.object=t.object||A({}).passthrough())}},uo=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())}},lo=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`})}}},fo=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 vt(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)=>vt(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)&&vt(t[a],e[a]))}return!1}function ho(){return t=>{if(!Array.isArray(t))return!0;const e=[];return t.every(r=>e.some(a=>vt(r,a))?!1:(e.push(r),!0))}}function fr(t,e){return t.safeParse(e).success}var po=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"})}},mo=class{apply(t,e){return e.uniqueItems!==!0?t:t.refine(ho(),{message:"Array items must be unique"})}},yo=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)}},go=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)}},_o=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"})}},vo=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}},bo=class{apply(t,e){const r=e;if(!r.properties&&!r.required&&r.additionalProperties!==!1)return t;if(t instanceof ca||t instanceof ua){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"})}},wo=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=>vt(s,a)),{message:"Value must match one of the enum values"})}},So=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=>vt(s,r),{message:"Value must equal the const value"})}},$o=class{apply(t,e){return e.description&&(t=t.describe(e.description)),t}},Eo=class{apply(t,e){var r;const s=e;return!((r=s.required)!=null&&r.includes("__proto__"))||e.type!==void 0?t:ue().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))}},To=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"})}},ko=class{apply(t,e){const{default:r}=e;return r===void 0||!t.safeParse(r).success?t:t.default(r)}},Po=[new Ka,new Wa,new za,new Ga,new Ja,new so,new uo,new Ba,new Qa,new Za,new Ya,new Xa,new eo,new to,new ro,new io,new no,new ao,new oo,new lo,new fo,new co],Io=[new Eo,new wo,new So,new yo,new go,new _o,new vo,new bo,new To,new po,new mo,new ko,new $o];function fe(t){if(typeof t=="boolean")return t?ue():ss();const e={};for(const a of Po)a.apply(e,t);const r=[];if(e.string!==!1&&r.push(e.string||I()),e.number!==!1&&r.push(e.number||J()),e.boolean!==!1&&r.push(e.boolean||we()),e.null!==!1&&r.push(e.null||gr()),e.array!==!1&&r.push(e.array||B(ue())),e.tuple!==!1&&e.tuple!==void 0&&r.push(e.tuple),e.object!==!1)if(e.object)r.push(e.object);else{const a=aa(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=ue();for(const a of Io)s=a.apply(s,t);return s}function _r(t){return!!t._zod}function He(t,e){return _r(t)?la(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 Oo(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=Oo(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 Ro=6e4;class Co{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(ha,r=>{this._oncancel(r)}),this.setNotificationHandler(pa,r=>{this._onprogress(r)}),this.setRequestHandler(ma,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ya,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(ga,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(_a,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(va,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)||ba(n)?this._onresponse(n):Ur(n)?this._onrequest(n,i):wa(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=Sa(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??Ro,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},$a,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},Ea,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Ta,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 No(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 St={exports:{}},kr={},je={},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)||(ne(_,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 se=this._scope.toName(_);return this._for(new S(W,se,T,N),()=>z(se))}forOf(_,T,N,z=r.varKinds.const){const W=this._scope.toName(_);if(this.opts.es5){const se=T instanceof e.Name?T:this.var("_arr",T);return this.forRange("_i",0,(0,e._)`${se}.length`,te=>{this.var(W,(0,e._)`${se}[${te}]`),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,se)=>(se instanceof e.Name&&(se=N(se)),se instanceof e._Code?W.push(...se._items):W.push(se),W),[]));function N(W){const se=T[W.str];return se===void 0||_[W.str]!==1?W:(delete _[W.str],se)}function z(W){return W instanceof e._Code&&W._items.some(se=>se instanceof e.Name&&_[se.str]===1&&T[se.str]!==void 0)}}function ne(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._)`!${M(R)}`}t.not=_e;const ve=P(t.operators.AND);function oe(...R){return R.reduce(ve)}t.and=oe;const Ie=P(t.operators.OR);function L(...R){return R.reduce(Ie)}t.or=L;function P(R){return(_,T)=>_===e.nil?T:T===e.nil?_:(0,e._)`${M(_)} ${R} ${M(T)}`}function M(R){return R instanceof e.Name?R:(0,e._)`(${R})`}})(Ir)),Ir}var Q={},hs;function re(){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 $t={},ps;function Fe(){if(ps)return $t;ps=1,Object.defineProperty($t,"__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 $t.default=e,$t}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=re(),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 qo(){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 me={},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 Me={},_s;function Un(){if(_s)return Me;_s=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.shouldUseRule=Me.shouldUseGroup=Me.schemaHasRulesForType=void 0;function t({schema:s,self:a},n){const i=a.RULES.types[n];return i&&i!==!0&&e(s,i)}Me.schemaHasRulesForType=t;function e(s,a){return a.rules.some(n=>r(s,n))}Me.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 Me.shouldUseRule=r,Me}var vs;function pr(){if(vs)return me;vs=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=Ln(),e=Un(),r=vr(),s=Y(),a=re();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)}}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={},bs;function jo(){if(bs)return ut;bs=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.assignDefaults=void 0;const t=X(),e=re();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={},ae={},ws;function qe(){if(ws)return ae;ws=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;const t=X(),e=re(),r=Fe(),s=re();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()})}ae.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}`)))}ae.checkMissingProp=n;function i(c,d){c.setParams({missingProperty:d},!0),c.error()}ae.reportMissingProp=i;function o(c){return c.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=o;function u(c,d,S){return(0,t._)`${o(c)}.call(${d}, ${S})`}ae.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}ae.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}ae.noPropertyInData=h;function $(c){return c?Object.keys(c).filter(d=>d!=="__proto__"):[]}ae.allSchemaProperties=$;function g(c,d){return $(d).filter(S=>!(0,e.alwaysValidSchema)(c,d[S]))}ae.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})`}ae.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})`})}ae.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)})}}ae.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 ae.validateUnion=p,ae}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=X(),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,ne=!("compile"in y&&!d||y.schema===!1);w.assign(E,(0,t._)`${F}${(0,r.callValidateCode)(g,b,x,ne)}`,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 Ao(){if($s)return Ae;$s=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.extendSubschemaMode=Ae.extendSubschemaData=Ae.getSubschema=void 0;const t=X(),e=re();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 Do(){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=re(),e=Hn(),r=Do(),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 ne=S[F];typeof V[p]=="string"&&(ne=_e.call(this,V[p])),ve.call(this,V.$anchor),ve.call(this,V.$dynamicAnchor),S[q]=ne;function _e(oe){const Ie=this.opts.uriResolver.resolve;if(oe=$(ne?Ie(ne,oe):oe),E.has(oe))throw D(oe);E.add(oe);let L=this.refs[oe];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?C(V,L.schema,oe):oe!==$(x)&&(oe[0]==="#"?(C(V,b[oe],oe),b[oe]=V):this.refs[oe]=x),oe}function ve(oe){if(typeof oe=="string"){if(!y.test(oe))throw new Error(`invalid anchor "${oe}"`);_e.call(this,`#${oe}`)}}}),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 je;Ps=1,Object.defineProperty(je,"__esModule",{value:!0}),je.getData=je.KeywordCxt=je.validateFunctionCode=void 0;const t=qo(),e=pr(),r=Un(),s=pr(),a=jo(),n=Mo(),i=Ao(),o=X(),u=Fe(),m=br(),h=re(),$=vr();function g(k){if(f(k)&&(E(k),S(k))){l(k);return}y(k,()=>(0,t.topBoolOrEmptySchema)(k))}je.validateFunctionCode=g;function y({gen:k,validateName:O,schema:j,schemaEnv:U,opts:K},Y){K.code.es5?k.func(O,(0,o._)`${u.default.data}, ${u.default.valCxt}`,U.$async,()=>{k.code((0,o._)`"use strict"; ${c(j,K)}`),w(k,K),k.code(Y)}):k.func(O,(0,o._)`${u.default.data}, ${v(K)}`,U.$async,()=>k.code(c(j,K)).code(Y))}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:j,gen:U}=k;y(k,()=>{j.$comment&&O.$comment&&F(k),V(k),U.let(u.default.vErrors,null),U.let(u.default.errors,0),j.unevaluated&&p(k),C(k),x(k)})}function p(k){const{gen:O,validateName:j}=k;k.evaluated=O.const("evaluated",(0,o._)`${j}.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 j=typeof k=="object"&&k[O.schemaId];return j&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${j} */`: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 j in k)if(O.RULES.all[j])return!0;return!1}function f(k){return typeof k.schema!="boolean"}function b(k,O){const{schema:j,gen:U,opts:K}=k;K.$comment&&j.$comment&&F(k),q(k),H(k);const Y=U.const("_errs",u.default.errors);C(k,Y),U.var(O,(0,o._)`${Y} === ${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 j=(0,e.getSchemaTypes)(k.schema),U=(0,e.coerceAndCheckDataType)(k,j);_e(k,j,!U,O)}function D(k){const{schema:O,errSchemaPath:j,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 "${j}"`)}function V(k){const{schema:O,opts:j}=k;O.default!==void 0&&j.useDefaults&&j.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:j,errSchemaPath:U,opts:K}){const Y=j.$comment;if(K.$comment===!0)k.code((0,o._)`${u.default.self}.logger.log(${Y})`);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(${Y}, ${he}, ${Oe}.schema)`)}}function x(k){const{gen:O,schemaEnv:j,validateName:U,ValidationError:K,opts:Y}=k;j.$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),Y.unevaluated&&ne(k),O.return((0,o._)`${u.default.errors} === 0`))}function ne({gen:k,evaluated:O,props:j,items:U}){j instanceof o.Name&&k.assign((0,o._)`${O}.props`,j),U instanceof o.Name&&k.assign((0,o._)`${O}.items`,U)}function _e(k,O,j,U){const{gen:K,schema:Y,data:he,allErrors:Oe,opts:Se,self:$e}=k,{RULES:pe}=$e;if(Y.$ref&&(Se.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(Y,pe))){K.block(()=>z(k,"$ref",pe.all.$ref.definition));return}Se.jtd||oe(k,O),K.block(()=>{for(const ke of pe.rules)Ze(ke);Ze(pe.post)});function Ze(ke){(0,r.shouldUseGroup)(Y,ke)&&(ke.type?(K.if((0,s.checkDataType)(ke.type,he,Se.strictNumbers)),ve(k,ke),O.length===1&&O[0]===ke.type&&j&&(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:j,schema:U,opts:{useDefaults:K}}=k;K&&(0,a.assignDefaults)(k,O.type),j.block(()=>{for(const Y of O.rules)(0,r.shouldUseRule)(U,Y)&&z(k,Y.keyword,Y.definition,O.type)})}function oe(k,O){k.schemaEnv.meta||!k.opts.strictTypes||(Ie(k,O),k.opts.allowUnionTypes||L(k,O),P(k,k.dataTypes))}function Ie(k,O){if(O.length){if(!k.dataTypes.length){k.dataTypes=O;return}O.forEach(j=>{R(k.dataTypes,j)||T(k,`type "${j}" 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 P(k,O){const j=k.self.RULES.all;for(const U in j){const K=j[U];if(typeof K=="object"&&(0,r.shouldUseRule)(k.schema,K)){const{type:Y}=K.definition;Y.length&&!Y.some(he=>M(O,he))&&T(k,`missing type "${Y.join(",")}" for keyword "${U}"`)}}}function M(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 j=[];for(const U of k.dataTypes)R(O,U)?j.push(U):O.includes("integer")&&U==="number"&&j.push("integer");k.dataTypes=j}function T(k,O){const j=k.schemaEnv.baseId+k.errSchemaPath;O+=` at "${j}" (strictTypes)`,(0,h.checkStrictMode)(k,O,k.opts.strictTypes)}class N{constructor(O,j,U){if((0,n.validateKeywordUsage)(O,j,U),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=U,this.data=O.data,this.schema=O.schema[U],this.$data=j.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(O,this.schema,U,this.$data),this.schemaType=j.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=j,this.$data)this.schemaCode=O.gen.const("vSchema",te(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,j.schemaType,j.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(j.schemaType)}`);("code"in j?j.trackErrors:j.errors!==!1)&&(this.errsCount=O.gen.const("_errs",u.default.errors))}result(O,j,U){this.failResult((0,o.not)(O),j,U)}failResult(O,j,U){this.gen.if(O),U?U():this.error(),j?(this.gen.else(),j(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,j){this.failResult((0,o.not)(O),void 0,j)}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:j}=this;this.fail((0,o._)`${j} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,j,U){if(j){this.setParams(j),this._error(O,U),this.setParams({});return}this._error(O,U)}_error(O,j){(O?$.reportExtraError:$.reportError)(this,this.def.error,j)}$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,j){j?Object.assign(this.params,O):this.params=O}block$data(O,j,U=o.nil){this.gen.block(()=>{this.check$data(O,U),j()})}check$data(O=o.nil,j=o.nil){if(!this.$data)return;const{gen:U,schemaCode:K,schemaType:Y,def:he}=this;U.if((0,o.or)((0,o._)`${K} === undefined`,j)),O!==o.nil&&U.assign(O,!0),(Y.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:j,schemaType:U,def:K,it:Y}=this;return(0,o.or)(he(),Oe());function he(){if(U.length){if(!(j instanceof o.Name))throw new Error("ajv implementation error");const Se=Array.isArray(U)?U:[U];return(0,o._)`${(0,s.checkDataTypes)(Se,j,Y.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}(${j})`}return o.nil}}subschema(O,j){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,j),K}mergeEvaluated(O,j){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,j)),U.items!==!0&&O.items!==void 0&&(U.items=h.mergeEvaluated.items(K,O.items,U.items,j)))}mergeValidEvaluated(O,j){const{it:U,gen:K}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return K.if(j,()=>this.mergeEvaluated(O,o.Name)),!0}}je.KeywordCxt=N;function z(k,O,j,U){const K=new N(k,j,O);"code"in j?j.code(K,U):K.$data&&j.validate?(0,n.funcKeywordCode)(K,j):"macro"in j?(0,n.macroKeywordCode)(K,j):(j.compile||j.validate)&&(0,n.funcKeywordCode)(K,j)}const W=/^\/(?:[^~]|~0|~1)*$/,se=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function te(k,{dataLevel:O,dataNames:j,dataPathArr:U}){let K,Y;if(k==="")return u.default.rootData;if(k[0]==="/"){if(!W.test(k))throw new Error(`Invalid JSON-pointer: ${k}`);K=k,Y=u.default.rootData}else{const $e=se.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(Y=j[O-pe],!K)return Y}let he=Y;const Oe=K.split("/");for(const $e of Oe)$e&&(Y=(0,o._)`${Y}${(0,o.getProperty)((0,h.unescapeJsonPointer)($e))}`,he=(0,o._)`${he} && ${Y}`);return he;function Se($e,pe){return`Cannot access ${$e} ${pe} levels up, current level is ${O}`}}return je.getData=te,je}var Et={},Is;function Zr(){if(Is)return Et;Is=1,Object.defineProperty(Et,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return Et.default=t,Et}var Tt={},Os;function Sr(){if(Os)return Tt;Os=1,Object.defineProperty(Tt,"__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 Tt.default=e,Tt}var Te={},Rs;function Xr(){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=X(),e=Zr(),r=Fe(),s=br(),a=re(),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:ne}=D;F.evaluated={props:x instanceof t.Name?void 0:x,items:ne instanceof t.Name?void 0:ne,dynamicProps:x instanceof t.Name,dynamicItems:ne 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 Lo="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Uo="Meta-schema for $data reference (JSON AnySchema extension proposal)",Ho="object",Vo=["$data"],Fo={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},xo=!1,zo={$id:Lo,description:Uo,type:Ho,required:Vo,properties:Fo,additionalProperties:xo};var kt={},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 jr,Ns;function Ko(){if(Ns)return jr;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 jr={wsIsSecure:a,SCHEMES:d,isValidSchemeName:s,getSchemeHandler:S},jr}var qs;function Wo(){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}=Ko();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 js;function Go(){if(js)return kt;js=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Wo();return t.code='require("ajv/dist/runtime/uri").default',kt.default=t,kt}var Ms;function Jo(){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=wr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=X();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=Xr(),o=X(),u=br(),m=pr(),h=re(),$=zo,g=Go(),y=(L,P)=>new RegExp(L,P);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 P,M,R,_,T,N,z,W,se,te,k,O,j,U,K,Y,he,Oe,Se,$e,pe,Ze,ke,$r,Er;const ct=L.strict,Tr=(P=L.code)===null||P===void 0?void 0:P.optimize,ts=Tr===!0||Tr===void 0?1:Tr||0,rs=(R=(M=L.code)===null||M===void 0?void 0:M.regExp)!==null&&R!==void 0?R:y,na=(_=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:(te=(se=L.strictTypes)!==null&&se!==void 0?se:ct)!==null&&te!==void 0?te:"log",strictTuples:(O=(k=L.strictTuples)!==null&&k!==void 0?k:ct)!==null&&O!==void 0?O:"log",strictRequired:(U=(j=L.strictRequired)!==null&&j!==void 0?j: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:(Y=L.loopEnum)!==null&&Y!==void 0?Y: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:($r=L.unicodeRegExp)!==null&&$r!==void 0?$r:!0,int32range:(Er=L.int32range)!==null&&Er!==void 0?Er:!0,uriResolver:na}}class S{constructor(P={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,P=this.opts={...P,...d(P)};const{es5:M,lines:R}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:w,es5:M,lines:R}),this.logger=H(P.logger);const _=P.validateFormats;P.validateFormats=!1,this.RULES=(0,n.getRules)(),f.call(this,l,P,"NOT SUPPORTED"),f.call(this,p,P,"DEPRECATED","warn"),this._metaOpts=V.call(this),P.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),P.keywords&&D.call(this,P.keywords),typeof P.meta=="object"&&this.addMetaSchema(P.meta),E.call(this),P.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:P,meta:M,schemaId:R}=this.opts;let _=$;R==="id"&&(_={...$},_.id=_.$id,delete _.$id),M&&P&&this.addMetaSchema(_,_[R],!1)}defaultMeta(){const{meta:P,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof P=="object"?P[M]||P:void 0}validate(P,M){let R;if(typeof P=="string"){if(R=this.getSchema(P),!R)throw new Error(`no schema with key or ref "${P}"`)}else R=this.compile(P);const _=R(M);return"$async"in R||(this.errors=R.errors),_}compile(P,M){const R=this._addSchema(P,M);return R.validate||this._compileSchemaEnv(R)}compileAsync(P,M){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:R}=this.opts;return _.call(this,P,M);async function _(te,k){await T.call(this,te.$schema);const O=this._addSchema(te,k);return O.validate||N.call(this,O)}async function T(te){te&&!this.getSchema(te)&&await _.call(this,{$ref:te},!0)}async function N(te){try{return this._compileSchemaEnv(te)}catch(k){if(!(k instanceof a.default))throw k;return z.call(this,k),await W.call(this,k.missingSchema),N.call(this,te)}}function z({missingSchema:te,missingRef:k}){if(this.refs[te])throw new Error(`AnySchema ${te} is loaded but ${k} cannot be resolved`)}async function W(te){const k=await se.call(this,te);this.refs[te]||await T.call(this,k.$schema),this.refs[te]||this.addSchema(k,te,M)}async function se(te){const k=this._loading[te];if(k)return k;try{return await(this._loading[te]=R(te))}finally{delete this._loading[te]}}}addSchema(P,M,R,_=this.opts.validateSchema){if(Array.isArray(P)){for(const N of P)this.addSchema(N,void 0,R,_);return this}let T;if(typeof P=="object"){const{schemaId:N}=this.opts;if(T=P[N],T!==void 0&&typeof T!="string")throw new Error(`schema ${N} must be string`)}return M=(0,u.normalizeId)(M||T),this._checkUnique(M),this.schemas[M]=this._addSchema(P,R,M,_,!0),this}addMetaSchema(P,M,R=this.opts.validateSchema){return this.addSchema(P,M,!0,R),this}validateSchema(P,M){if(typeof P=="boolean")return!0;let R;if(R=P.$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,P);if(!_&&M){const T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw new Error(T)}return _}getSchema(P){let M;for(;typeof(M=b.call(this,P))=="string";)P=M;if(M===void 0){const{schemaId:R}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:R});if(M=i.resolveSchema.call(this,_,P),!M)return;this.refs[P]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(P){if(P instanceof RegExp)return this._removeAllSchemas(this.schemas,P),this._removeAllSchemas(this.refs,P),this;switch(typeof P){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const M=b.call(this,P);return typeof M=="object"&&this._cache.delete(M.schema),delete this.schemas[P],delete this.refs[P],this}case"object":{const M=P;this._cache.delete(M);let R=P[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(P){for(const M of P)this.addKeyword(M);return this}addKeyword(P,M){let R;if(typeof P=="string")R=P,typeof M=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=R);else if(typeof P=="object"&&M===void 0){if(M=P,R=M.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,M),!M)return(0,h.eachItem)(R,T=>ne.call(this,T)),this;ve.call(this,M);const _={...M,type:(0,m.getJSONTypes)(M.type),schemaType:(0,m.getJSONTypes)(M.schemaType)};return(0,h.eachItem)(R,_.type.length===0?T=>ne.call(this,T,_):T=>_.type.forEach(N=>ne.call(this,T,_,N))),this}getKeyword(P){const M=this.RULES.all[P];return typeof M=="object"?M.definition:!!M}removeKeyword(P){const{RULES:M}=this;delete M.keywords[P],delete M.all[P];for(const R of M.rules){const _=R.rules.findIndex(T=>T.keyword===P);_>=0&&R.rules.splice(_,1)}return this}addFormat(P,M){return typeof M=="string"&&(M=new RegExp(M)),this.formats[P]=M,this}errorsText(P=this.errors,{separator:M=", ",dataVar:R="data"}={}){return!P||P.length===0?"No errors":P.map(_=>`${R}${_.instancePath} ${_.message}`).reduce((_,T)=>_+M+T)}$dataMetaSchema(P,M){const R=this.RULES.all;P=JSON.parse(JSON.stringify(P));for(const _ of M){const T=_.split("/").slice(1);let N=P;for(const z of T)N=N[z];for(const z in R){const W=R[z];if(typeof W!="object")continue;const{$data:se}=W.definition,te=N[z];se&&te&&(N[z]=Ie(te))}}return P}_removeAllSchemas(P,M){for(const R in P){const _=P[R];(!M||M.test(R))&&(typeof _=="string"?delete P[R]:_&&!_.meta&&(this._cache.delete(_.schema),delete P[R]))}}_addSchema(P,M,R,_=this.opts.validateSchema,T=this.opts.addUsedSchema){let N;const{schemaId:z}=this.opts;if(typeof P=="object")N=P[z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof P!="boolean")throw new Error("schema must be object or boolean")}let W=this._cache.get(P);if(W!==void 0)return W;R=(0,u.normalizeId)(N||R);const se=u.getSchemaRefs.call(this,P,R);return W=new i.SchemaEnv({schema:P,schemaId:z,meta:M,baseId:R,localRefs:se}),this._cache.set(W.schema,W),T&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=W),_&&this.validateSchema(P,!0),W}_checkUnique(P){if(this.schemas[P]||this.refs[P])throw new Error(`schema with key or id "${P}" already exists`)}_compileSchemaEnv(P){if(P.meta?this._compileMetaSchema(P):i.compileSchema.call(this,P),!P.validate)throw new Error("ajv implementation error");return P.validate}_compileMetaSchema(P){const M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,P)}finally{this.opts=M}}}S.ValidationError=s.default,S.MissingRefError=a.default,t.default=S;function f(L,P,M,R="error"){for(const _ in L){const T=_;T in P&&this.logger[R](`${M}: 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 P in L)this.addSchema(L[P],P)}function C(){for(const L in this.opts.formats){const P=this.opts.formats[L];P&&this.addFormat(L,P)}}function D(L){if(Array.isArray(L)){this.addVocabulary(L);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const P in L){const M=L[P];M.keyword||(M.keyword=P),this.addKeyword(M)}}function V(){const L={...this.opts};for(const P of v)delete L[P];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,P){const{RULES:M}=this;if((0,h.eachItem)(L,R=>{if(M.keywords[R])throw new Error(`Keyword ${R} is already defined`);if(!F.test(R))throw new Error(`Keyword ${R} has invalid name`)}),!!P&&P.$data&&!("code"in P||"validate"in P))throw new Error('$data keyword must have "code" or "validate" function')}function ne(L,P,M){var R;const _=P?.post;if(M&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:T}=this;let N=_?T.post:T.rules.find(({type:W})=>W===M);if(N||(N={type:M,rules:[]},T.rules.push(N)),T.keywords[L]=!0,!P)return;const z={keyword:L,definition:{...P,type:(0,m.getJSONTypes)(P.type),schemaType:(0,m.getJSONTypes)(P.schemaType)}};P.before?_e.call(this,N,z,P.before):N.rules.push(z),T.all[L]=z,(R=P.implements)===null||R===void 0||R.forEach(W=>this.addKeyword(W))}function _e(L,P,M){const R=L.rules.findIndex(_=>_.keyword===M);R>=0?L.rules.splice(R,0,P):(L.rules.push(P),this.logger.warn(`rule ${M} is not defined`))}function ve(L){let{metaSchema:P}=L;P!==void 0&&(L.$data&&this.opts.$data&&(P=Ie(P)),L.validateSchema=this.compile(P,!0))}const oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(L){return{anyOf:[L,oe]}}})(kr)),kr}var Pt={},It={},Ot={},As;function Bo(){if(As)return Ot;As=1,Object.defineProperty(Ot,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Ot.default=t,Ot}var Ue={},Ds;function Qo(){if(Ds)return Ue;Ds=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.callRef=Ue.getValidate=void 0;const t=Sr(),e=qe(),r=X(),s=Fe(),a=Xr(),n=re(),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 Zo(){if(Ls)return It;Ls=1,Object.defineProperty(It,"__esModule",{value:!0});const t=Bo(),e=Qo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return It.default=r,It}var Rt={},Ct={},Us;function Xo(){if(Us)return Ct;Us=1,Object.defineProperty(Ct,"__esModule",{value:!0});const t=X(),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 Ct.default=a,Ct}var Nt={},Hs;function Yo(){if(Hs)return Nt;Hs=1,Object.defineProperty(Nt,"__esModule",{value:!0});const t=X(),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 Nt.default=r,Nt}var qt={},jt={},Vs;function ei(){if(Vs)return jt;Vs=1,Object.defineProperty(jt,"__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 jt.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',jt}var Fs;function ti(){if(Fs)return qt;Fs=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=X(),e=re(),r=ei(),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 qt.default=a,qt}var Mt={},xs;function ri(){if(xs)return Mt;xs=1,Object.defineProperty(Mt,"__esModule",{value:!0});const t=qe(),e=X(),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 At={},zs;function si(){if(zs)return At;zs=1,Object.defineProperty(At,"__esModule",{value:!0});const t=X(),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 At.default=r,At}var Dt={},Ks;function ni(){if(Ks)return Dt;Ks=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=qe(),e=X(),r=re(),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 Dt.default=a,Dt}var Lt={},Ws;function ai(){if(Ws)return Lt;Ws=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t=X(),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 Lt.default=r,Lt}var Ut={},Ht={},Gs;function Yr(){if(Gs)return Ht;Gs=1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=Hn();return t.code='require("ajv/dist/runtime/equal").default',Ht.default=t,Ht}var Js;function oi(){if(Js)return Ut;Js=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=pr(),e=X(),r=re(),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 Ut.default=n,Ut}var Vt={},Bs;function ii(){if(Bs)return Vt;Bs=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=X(),e=re(),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 Vt.default=a,Vt}var Ft={},Qs;function ci(){if(Qs)return Ft;Qs=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=X(),e=re(),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 Ft.default=a,Ft}var Zs;function ui(){if(Zs)return Rt;Zs=1,Object.defineProperty(Rt,"__esModule",{value:!0});const t=Xo(),e=Yo(),r=ti(),s=ri(),a=si(),n=ni(),i=ai(),o=oi(),u=ii(),m=ci(),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 Rt.default=h,Rt}var xt={},Ye={},Xs;function Fn(){if(Xs)return Ye;Xs=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.validateAdditionalItems=void 0;const t=X(),e=re(),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 Ye.validateAdditionalItems=a,Ye.default=s,Ye}var zt={},et={},Ys;function xn(){if(Ys)return et;Ys=1,Object.defineProperty(et,"__esModule",{value:!0}),et.validateTuple=void 0;const t=X(),e=re(),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 li(){if(en)return zt;en=1,Object.defineProperty(zt,"__esModule",{value:!0});const t=xn(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return zt.default=e,zt}var Kt={},tn;function di(){if(tn)return Kt;tn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=X(),e=re(),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 Kt.default=n,Kt}var Wt={},rn;function fi(){if(rn)return Wt;rn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=X(),e=re(),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 Wt.default=s,Wt}var Mr={},sn;function hi(){return sn||(sn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=X(),r=re(),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={},bs;function jo(){if(bs)return ut;bs=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.assignDefaults=void 0;const t=Y(),e=re();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={},ae={},ws;function qe(){if(ws)return ae;ws=1,Object.defineProperty(ae,"__esModule",{value:!0}),ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;const t=Y(),e=re(),r=Fe(),s=re();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()})}ae.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}`)))}ae.checkMissingProp=n;function i(c,d){c.setParams({missingProperty:d},!0),c.error()}ae.reportMissingProp=i;function o(c){return c.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=o;function u(c,d,S){return(0,t._)`${o(c)}.call(${d}, ${S})`}ae.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}ae.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}ae.noPropertyInData=h;function $(c){return c?Object.keys(c).filter(d=>d!=="__proto__"):[]}ae.allSchemaProperties=$;function g(c,d){return $(d).filter(S=>!(0,e.alwaysValidSchema)(c,d[S]))}ae.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})`}ae.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})`})}ae.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)})}}ae.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 ae.validateUnion=p,ae}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,ne=!("compile"in y&&!d||y.schema===!1);w.assign(E,(0,t._)`${F}${(0,r.callValidateCode)(g,b,x,ne)}`,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 Ao(){if($s)return Ae;$s=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.extendSubschemaMode=Ae.extendSubschemaData=Ae.getSubschema=void 0;const t=Y(),e=re();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 Do(){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=re(),e=Hn(),r=Do(),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 ne=S[F];typeof V[p]=="string"&&(ne=_e.call(this,V[p])),ve.call(this,V.$anchor),ve.call(this,V.$dynamicAnchor),S[q]=ne;function _e(oe){const Ie=this.opts.uriResolver.resolve;if(oe=$(ne?Ie(ne,oe):oe),E.has(oe))throw D(oe);E.add(oe);let L=this.refs[oe];return typeof L=="string"&&(L=this.refs[L]),typeof L=="object"?C(V,L.schema,oe):oe!==$(x)&&(oe[0]==="#"?(C(V,b[oe],oe),b[oe]=V):this.refs[oe]=x),oe}function ve(oe){if(typeof oe=="string"){if(!y.test(oe))throw new Error(`invalid anchor "${oe}"`);_e.call(this,`#${oe}`)}}}),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 je;Ps=1,Object.defineProperty(je,"__esModule",{value:!0}),je.getData=je.KeywordCxt=je.validateFunctionCode=void 0;const t=qo(),e=pr(),r=Un(),s=pr(),a=jo(),n=Mo(),i=Ao(),o=Y(),u=Fe(),m=br(),h=re(),$=vr();function g(k){if(f(k)&&(E(k),S(k))){l(k);return}y(k,()=>(0,t.topBoolOrEmptySchema)(k))}je.validateFunctionCode=g;function y({gen:k,validateName:O,schema:j,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(j,K)}`),w(k,K),k.code(X)}):k.func(O,(0,o._)`${u.default.data}, ${v(K)}`,U.$async,()=>k.code(c(j,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:j,gen:U}=k;y(k,()=>{j.$comment&&O.$comment&&F(k),V(k),U.let(u.default.vErrors,null),U.let(u.default.errors,0),j.unevaluated&&p(k),C(k),x(k)})}function p(k){const{gen:O,validateName:j}=k;k.evaluated=O.const("evaluated",(0,o._)`${j}.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 j=typeof k=="object"&&k[O.schemaId];return j&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${j} */`: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 j in k)if(O.RULES.all[j])return!0;return!1}function f(k){return typeof k.schema!="boolean"}function b(k,O){const{schema:j,gen:U,opts:K}=k;K.$comment&&j.$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 j=(0,e.getSchemaTypes)(k.schema),U=(0,e.coerceAndCheckDataType)(k,j);_e(k,j,!U,O)}function D(k){const{schema:O,errSchemaPath:j,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 "${j}"`)}function V(k){const{schema:O,opts:j}=k;O.default!==void 0&&j.useDefaults&&j.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:j,errSchemaPath:U,opts:K}){const X=j.$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:j,validateName:U,ValidationError:K,opts:X}=k;j.$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&&ne(k),O.return((0,o._)`${u.default.errors} === 0`))}function ne({gen:k,evaluated:O,props:j,items:U}){j instanceof o.Name&&k.assign((0,o._)`${O}.props`,j),U instanceof o.Name&&k.assign((0,o._)`${O}.items`,U)}function _e(k,O,j,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||oe(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)),ve(k,ke),O.length===1&&O[0]===ke.type&&j&&(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:j,schema:U,opts:{useDefaults:K}}=k;K&&(0,a.assignDefaults)(k,O.type),j.block(()=>{for(const X of O.rules)(0,r.shouldUseRule)(U,X)&&z(k,X.keyword,X.definition,O.type)})}function oe(k,O){k.schemaEnv.meta||!k.opts.strictTypes||(Ie(k,O),k.opts.allowUnionTypes||L(k,O),P(k,k.dataTypes))}function Ie(k,O){if(O.length){if(!k.dataTypes.length){k.dataTypes=O;return}O.forEach(j=>{R(k.dataTypes,j)||T(k,`type "${j}" 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 P(k,O){const j=k.self.RULES.all;for(const U in j){const K=j[U];if(typeof K=="object"&&(0,r.shouldUseRule)(k.schema,K)){const{type:X}=K.definition;X.length&&!X.some(he=>M(O,he))&&T(k,`missing type "${X.join(",")}" for keyword "${U}"`)}}}function M(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 j=[];for(const U of k.dataTypes)R(O,U)?j.push(U):O.includes("integer")&&U==="number"&&j.push("integer");k.dataTypes=j}function T(k,O){const j=k.schemaEnv.baseId+k.errSchemaPath;O+=` at "${j}" (strictTypes)`,(0,h.checkStrictMode)(k,O,k.opts.strictTypes)}class N{constructor(O,j,U){if((0,n.validateKeywordUsage)(O,j,U),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=U,this.data=O.data,this.schema=O.schema[U],this.$data=j.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(O,this.schema,U,this.$data),this.schemaType=j.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=j,this.$data)this.schemaCode=O.gen.const("vSchema",te(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,j.schemaType,j.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(j.schemaType)}`);("code"in j?j.trackErrors:j.errors!==!1)&&(this.errsCount=O.gen.const("_errs",u.default.errors))}result(O,j,U){this.failResult((0,o.not)(O),j,U)}failResult(O,j,U){this.gen.if(O),U?U():this.error(),j?(this.gen.else(),j(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,j){this.failResult((0,o.not)(O),void 0,j)}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:j}=this;this.fail((0,o._)`${j} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,j,U){if(j){this.setParams(j),this._error(O,U),this.setParams({});return}this._error(O,U)}_error(O,j){(O?$.reportExtraError:$.reportError)(this,this.def.error,j)}$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,j){j?Object.assign(this.params,O):this.params=O}block$data(O,j,U=o.nil){this.gen.block(()=>{this.check$data(O,U),j()})}check$data(O=o.nil,j=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`,j)),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:j,schemaType:U,def:K,it:X}=this;return(0,o.or)(he(),Oe());function he(){if(U.length){if(!(j instanceof o.Name))throw new Error("ajv implementation error");const Se=Array.isArray(U)?U:[U];return(0,o._)`${(0,s.checkDataTypes)(Se,j,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}(${j})`}return o.nil}}subschema(O,j){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,j),K}mergeEvaluated(O,j){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,j)),U.items!==!0&&O.items!==void 0&&(U.items=h.mergeEvaluated.items(K,O.items,U.items,j)))}mergeValidEvaluated(O,j){const{it:U,gen:K}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return K.if(j,()=>this.mergeEvaluated(O,o.Name)),!0}}je.KeywordCxt=N;function z(k,O,j,U){const K=new N(k,j,O);"code"in j?j.code(K,U):K.$data&&j.validate?(0,n.funcKeywordCode)(K,j):"macro"in j?(0,n.macroKeywordCode)(K,j):(j.compile||j.validate)&&(0,n.funcKeywordCode)(K,j)}const W=/^\/(?:[^~]|~0|~1)*$/,se=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function te(k,{dataLevel:O,dataNames:j,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=se.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=j[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 je.getData=te,je}var Et={},Is;function Zr(){if(Is)return Et;Is=1,Object.defineProperty(Et,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return Et.default=t,Et}var Tt={},Os;function Sr(){if(Os)return Tt;Os=1,Object.defineProperty(Tt,"__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 Tt.default=e,Tt}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=re(),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:ne}=D;F.evaluated={props:x instanceof t.Name?void 0:x,items:ne instanceof t.Name?void 0:ne,dynamicProps:x instanceof t.Name,dynamicItems:ne 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 Lo="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Uo="Meta-schema for $data reference (JSON AnySchema extension proposal)",Ho="object",Vo=["$data"],Fo={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},xo=!1,zo={$id:Lo,description:Uo,type:Ho,required:Vo,properties:Fo,additionalProperties:xo};var kt={},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 jr,Ns;function Ko(){if(Ns)return jr;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 jr={wsIsSecure:a,SCHEMES:d,isValidSchemeName:s,getSchemeHandler:S},jr}var qs;function Wo(){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}=Ko();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 js;function Go(){if(js)return kt;js=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Wo();return t.code='require("ajv/dist/runtime/uri").default',kt.default=t,kt}var Ms;function Jo(){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=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=re(),$=zo,g=Go(),y=(L,P)=>new RegExp(L,P);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 P,M,R,_,T,N,z,W,se,te,k,O,j,U,K,X,he,Oe,Se,$e,pe,Ze,ke,$r,Er;const ct=L.strict,Tr=(P=L.code)===null||P===void 0?void 0:P.optimize,ts=Tr===!0||Tr===void 0?1:Tr||0,rs=(R=(M=L.code)===null||M===void 0?void 0:M.regExp)!==null&&R!==void 0?R:y,na=(_=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:(te=(se=L.strictTypes)!==null&&se!==void 0?se:ct)!==null&&te!==void 0?te:"log",strictTuples:(O=(k=L.strictTuples)!==null&&k!==void 0?k:ct)!==null&&O!==void 0?O:"log",strictRequired:(U=(j=L.strictRequired)!==null&&j!==void 0?j: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:(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:($r=L.unicodeRegExp)!==null&&$r!==void 0?$r:!0,int32range:(Er=L.int32range)!==null&&Er!==void 0?Er:!0,uriResolver:na}}class S{constructor(P={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,P=this.opts={...P,...d(P)};const{es5:M,lines:R}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:w,es5:M,lines:R}),this.logger=H(P.logger);const _=P.validateFormats;P.validateFormats=!1,this.RULES=(0,n.getRules)(),f.call(this,l,P,"NOT SUPPORTED"),f.call(this,p,P,"DEPRECATED","warn"),this._metaOpts=V.call(this),P.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),P.keywords&&D.call(this,P.keywords),typeof P.meta=="object"&&this.addMetaSchema(P.meta),E.call(this),P.validateFormats=_}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:P,meta:M,schemaId:R}=this.opts;let _=$;R==="id"&&(_={...$},_.id=_.$id,delete _.$id),M&&P&&this.addMetaSchema(_,_[R],!1)}defaultMeta(){const{meta:P,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof P=="object"?P[M]||P:void 0}validate(P,M){let R;if(typeof P=="string"){if(R=this.getSchema(P),!R)throw new Error(`no schema with key or ref "${P}"`)}else R=this.compile(P);const _=R(M);return"$async"in R||(this.errors=R.errors),_}compile(P,M){const R=this._addSchema(P,M);return R.validate||this._compileSchemaEnv(R)}compileAsync(P,M){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:R}=this.opts;return _.call(this,P,M);async function _(te,k){await T.call(this,te.$schema);const O=this._addSchema(te,k);return O.validate||N.call(this,O)}async function T(te){te&&!this.getSchema(te)&&await _.call(this,{$ref:te},!0)}async function N(te){try{return this._compileSchemaEnv(te)}catch(k){if(!(k instanceof a.default))throw k;return z.call(this,k),await W.call(this,k.missingSchema),N.call(this,te)}}function z({missingSchema:te,missingRef:k}){if(this.refs[te])throw new Error(`AnySchema ${te} is loaded but ${k} cannot be resolved`)}async function W(te){const k=await se.call(this,te);this.refs[te]||await T.call(this,k.$schema),this.refs[te]||this.addSchema(k,te,M)}async function se(te){const k=this._loading[te];if(k)return k;try{return await(this._loading[te]=R(te))}finally{delete this._loading[te]}}}addSchema(P,M,R,_=this.opts.validateSchema){if(Array.isArray(P)){for(const N of P)this.addSchema(N,void 0,R,_);return this}let T;if(typeof P=="object"){const{schemaId:N}=this.opts;if(T=P[N],T!==void 0&&typeof T!="string")throw new Error(`schema ${N} must be string`)}return M=(0,u.normalizeId)(M||T),this._checkUnique(M),this.schemas[M]=this._addSchema(P,R,M,_,!0),this}addMetaSchema(P,M,R=this.opts.validateSchema){return this.addSchema(P,M,!0,R),this}validateSchema(P,M){if(typeof P=="boolean")return!0;let R;if(R=P.$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,P);if(!_&&M){const T="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(T);else throw new Error(T)}return _}getSchema(P){let M;for(;typeof(M=b.call(this,P))=="string";)P=M;if(M===void 0){const{schemaId:R}=this.opts,_=new i.SchemaEnv({schema:{},schemaId:R});if(M=i.resolveSchema.call(this,_,P),!M)return;this.refs[P]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(P){if(P instanceof RegExp)return this._removeAllSchemas(this.schemas,P),this._removeAllSchemas(this.refs,P),this;switch(typeof P){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const M=b.call(this,P);return typeof M=="object"&&this._cache.delete(M.schema),delete this.schemas[P],delete this.refs[P],this}case"object":{const M=P;this._cache.delete(M);let R=P[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(P){for(const M of P)this.addKeyword(M);return this}addKeyword(P,M){let R;if(typeof P=="string")R=P,typeof M=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=R);else if(typeof P=="object"&&M===void 0){if(M=P,R=M.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,M),!M)return(0,h.eachItem)(R,T=>ne.call(this,T)),this;ve.call(this,M);const _={...M,type:(0,m.getJSONTypes)(M.type),schemaType:(0,m.getJSONTypes)(M.schemaType)};return(0,h.eachItem)(R,_.type.length===0?T=>ne.call(this,T,_):T=>_.type.forEach(N=>ne.call(this,T,_,N))),this}getKeyword(P){const M=this.RULES.all[P];return typeof M=="object"?M.definition:!!M}removeKeyword(P){const{RULES:M}=this;delete M.keywords[P],delete M.all[P];for(const R of M.rules){const _=R.rules.findIndex(T=>T.keyword===P);_>=0&&R.rules.splice(_,1)}return this}addFormat(P,M){return typeof M=="string"&&(M=new RegExp(M)),this.formats[P]=M,this}errorsText(P=this.errors,{separator:M=", ",dataVar:R="data"}={}){return!P||P.length===0?"No errors":P.map(_=>`${R}${_.instancePath} ${_.message}`).reduce((_,T)=>_+M+T)}$dataMetaSchema(P,M){const R=this.RULES.all;P=JSON.parse(JSON.stringify(P));for(const _ of M){const T=_.split("/").slice(1);let N=P;for(const z of T)N=N[z];for(const z in R){const W=R[z];if(typeof W!="object")continue;const{$data:se}=W.definition,te=N[z];se&&te&&(N[z]=Ie(te))}}return P}_removeAllSchemas(P,M){for(const R in P){const _=P[R];(!M||M.test(R))&&(typeof _=="string"?delete P[R]:_&&!_.meta&&(this._cache.delete(_.schema),delete P[R]))}}_addSchema(P,M,R,_=this.opts.validateSchema,T=this.opts.addUsedSchema){let N;const{schemaId:z}=this.opts;if(typeof P=="object")N=P[z];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof P!="boolean")throw new Error("schema must be object or boolean")}let W=this._cache.get(P);if(W!==void 0)return W;R=(0,u.normalizeId)(N||R);const se=u.getSchemaRefs.call(this,P,R);return W=new i.SchemaEnv({schema:P,schemaId:z,meta:M,baseId:R,localRefs:se}),this._cache.set(W.schema,W),T&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=W),_&&this.validateSchema(P,!0),W}_checkUnique(P){if(this.schemas[P]||this.refs[P])throw new Error(`schema with key or id "${P}" already exists`)}_compileSchemaEnv(P){if(P.meta?this._compileMetaSchema(P):i.compileSchema.call(this,P),!P.validate)throw new Error("ajv implementation error");return P.validate}_compileMetaSchema(P){const M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,P)}finally{this.opts=M}}}S.ValidationError=s.default,S.MissingRefError=a.default,t.default=S;function f(L,P,M,R="error"){for(const _ in L){const T=_;T in P&&this.logger[R](`${M}: 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 P in L)this.addSchema(L[P],P)}function C(){for(const L in this.opts.formats){const P=this.opts.formats[L];P&&this.addFormat(L,P)}}function D(L){if(Array.isArray(L)){this.addVocabulary(L);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const P in L){const M=L[P];M.keyword||(M.keyword=P),this.addKeyword(M)}}function V(){const L={...this.opts};for(const P of v)delete L[P];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,P){const{RULES:M}=this;if((0,h.eachItem)(L,R=>{if(M.keywords[R])throw new Error(`Keyword ${R} is already defined`);if(!F.test(R))throw new Error(`Keyword ${R} has invalid name`)}),!!P&&P.$data&&!("code"in P||"validate"in P))throw new Error('$data keyword must have "code" or "validate" function')}function ne(L,P,M){var R;const _=P?.post;if(M&&_)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:T}=this;let N=_?T.post:T.rules.find(({type:W})=>W===M);if(N||(N={type:M,rules:[]},T.rules.push(N)),T.keywords[L]=!0,!P)return;const z={keyword:L,definition:{...P,type:(0,m.getJSONTypes)(P.type),schemaType:(0,m.getJSONTypes)(P.schemaType)}};P.before?_e.call(this,N,z,P.before):N.rules.push(z),T.all[L]=z,(R=P.implements)===null||R===void 0||R.forEach(W=>this.addKeyword(W))}function _e(L,P,M){const R=L.rules.findIndex(_=>_.keyword===M);R>=0?L.rules.splice(R,0,P):(L.rules.push(P),this.logger.warn(`rule ${M} is not defined`))}function ve(L){let{metaSchema:P}=L;P!==void 0&&(L.$data&&this.opts.$data&&(P=Ie(P)),L.validateSchema=this.compile(P,!0))}const oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ie(L){return{anyOf:[L,oe]}}})(kr)),kr}var Pt={},It={},Ot={},As;function Bo(){if(As)return Ot;As=1,Object.defineProperty(Ot,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Ot.default=t,Ot}var Ue={},Ds;function Qo(){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=re(),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 Zo(){if(Ls)return It;Ls=1,Object.defineProperty(It,"__esModule",{value:!0});const t=Bo(),e=Qo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return It.default=r,It}var Rt={},Ct={},Us;function Yo(){if(Us)return Ct;Us=1,Object.defineProperty(Ct,"__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 Ct.default=a,Ct}var Nt={},Hs;function Xo(){if(Hs)return Nt;Hs=1,Object.defineProperty(Nt,"__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 Nt.default=r,Nt}var qt={},jt={},Vs;function ei(){if(Vs)return jt;Vs=1,Object.defineProperty(jt,"__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 jt.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',jt}var Fs;function ti(){if(Fs)return qt;Fs=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=Y(),e=re(),r=ei(),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 qt.default=a,qt}var Mt={},xs;function ri(){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 At={},zs;function si(){if(zs)return At;zs=1,Object.defineProperty(At,"__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 At.default=r,At}var Dt={},Ks;function ni(){if(Ks)return Dt;Ks=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=qe(),e=Y(),r=re(),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 Dt.default=a,Dt}var Lt={},Ws;function ai(){if(Ws)return Lt;Ws=1,Object.defineProperty(Lt,"__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 Lt.default=r,Lt}var Ut={},Ht={},Gs;function Xr(){if(Gs)return Ht;Gs=1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=Hn();return t.code='require("ajv/dist/runtime/equal").default',Ht.default=t,Ht}var Js;function oi(){if(Js)return Ut;Js=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=pr(),e=Y(),r=re(),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 Ut.default=n,Ut}var Vt={},Bs;function ii(){if(Bs)return Vt;Bs=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=Y(),e=re(),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 Vt.default=a,Vt}var Ft={},Qs;function ci(){if(Qs)return Ft;Qs=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=Y(),e=re(),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 Ft.default=a,Ft}var Zs;function ui(){if(Zs)return Rt;Zs=1,Object.defineProperty(Rt,"__esModule",{value:!0});const t=Yo(),e=Xo(),r=ti(),s=ri(),a=si(),n=ni(),i=ai(),o=oi(),u=ii(),m=ci(),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 Rt.default=h,Rt}var xt={},Xe={},Ys;function Fn(){if(Ys)return Xe;Ys=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.validateAdditionalItems=void 0;const t=Y(),e=re(),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 zt={},et={},Xs;function xn(){if(Xs)return et;Xs=1,Object.defineProperty(et,"__esModule",{value:!0}),et.validateTuple=void 0;const t=Y(),e=re(),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 li(){if(en)return zt;en=1,Object.defineProperty(zt,"__esModule",{value:!0});const t=xn(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return zt.default=e,zt}var Kt={},tn;function di(){if(tn)return Kt;tn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=Y(),e=re(),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 Kt.default=n,Kt}var Wt={},rn;function fi(){if(rn)return Wt;rn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=Y(),e=re(),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 Wt.default=s,Wt}var Mr={},sn;function hi(){return sn||(sn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Y(),r=re(),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})(Mr)),Mr}var Gt={},nn;function pi(){if(nn)return Gt;nn=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=X(),e=re(),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 Gt.default=s,Gt}var Jt={},an;function zn(){if(an)return Jt;an=1,Object.defineProperty(Jt,"__esModule",{value:!0});const t=qe(),e=X(),r=Fe(),s=re(),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 Jt.default=n,Jt}var Bt={},on;function mi(){if(on)return Bt;on=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=wr(),e=qe(),r=re(),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 Bt.default=a,Bt}var Qt={},cn;function yi(){if(cn)return Qt;cn=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=qe(),e=X(),r=re(),s=re(),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 Qt.default=a,Qt}var Zt={},un;function gi(){if(un)return Zt;un=1,Object.defineProperty(Zt,"__esModule",{value:!0});const t=re(),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 Zt.default=e,Zt}var Xt={},ln;function _i(){if(ln)return Xt;ln=1,Object.defineProperty(Xt,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:qe().validateUnion,error:{message:"must match a schema in anyOf"}};return Xt.default=e,Xt}var Yt={},dn;function vi(){if(dn)return Yt;dn=1,Object.defineProperty(Yt,"__esModule",{value:!0});const t=X(),e=re(),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 er={},fn;function bi(){if(fn)return er;fn=1,Object.defineProperty(er,"__esModule",{value:!0});const t=re(),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 er.default=e,er}var tr={},hn;function wi(){if(hn)return tr;hn=1,Object.defineProperty(tr,"__esModule",{value:!0});const t=X(),e=re(),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 tr.default=s,tr}var rr={},pn;function Si(){if(pn)return rr;pn=1,Object.defineProperty(rr,"__esModule",{value:!0});const t=re(),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 rr.default=e,rr}var mn;function $i(){if(mn)return xt;mn=1,Object.defineProperty(xt,"__esModule",{value:!0});const t=Fn(),e=li(),r=xn(),s=di(),a=fi(),n=hi(),i=pi(),o=zn(),u=mi(),m=yi(),h=gi(),$=_i(),g=vi(),y=bi(),v=wi(),w=Si();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 xt.default=l,xt}var sr={},nr={},yn;function Ei(){if(yn)return nr;yn=1,Object.defineProperty(nr,"__esModule",{value:!0});const t=X(),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 nr.default=r,nr}var gn;function Ti(){if(gn)return sr;gn=1,Object.defineProperty(sr,"__esModule",{value:!0});const e=[Ei().default];return sr.default=e,sr}var We={},_n;function ki(){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 Pi(){if(vn)return Pt;vn=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=Zo(),e=ui(),r=$i(),s=Ti(),a=ki(),n=[t.default,e.default,(0,r.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];return Pt.default=n,Pt}var ar={},dt={},bn;function Ii(){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 Oi(){if(wn)return ar;wn=1,Object.defineProperty(ar,"__esModule",{value:!0});const t=X(),e=Ii(),r=Xr(),s=Sr(),a=re(),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 ar.default=i,ar}const Ri="http://json-schema.org/draft-07/schema#",Ci="http://json-schema.org/draft-07/schema#",Ni="Core schema meta-schema",qi={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:[]}},ji=["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:"#"}},Ai={$schema:Ri,$id:Ci,title:Ni,definitions:qi,type:ji,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=Jo(),s=Pi(),a=Oi(),n=Ai,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=X();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}})})(St,St.exports)),St.exports}var Di=Kn();const Li=jn(Di);var or={exports:{}},Ar={},$n;function Ui(){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],ne=+H[3];return x>=1&&x<=12&&ne>=1&&ne<=(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 ne=+x[1],_e=+x[2],ve=+x[3],oe=x[4],Ie=x[5]==="-"?-1:1,L=+(x[6]||0),P=+(x[7]||0);if(L>23||P>59||q&&!oe)return!1;if(ne<=23&&_e<=59&&ve<60)return!0;const M=_e-P*Ie,R=ne-L*Ie-(M<0?1:0);return(R===23||R===-1)&&(M===59||M===-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 ne=x.split($);return ne.length===2&&n(ne[0])&&H(ne[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($),[ne,_e]=H.split($),ve=i(F,ne);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 Hi(){return En||(En=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Kn(),r=X(),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 Vi(){return Tn||(Tn=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Ui(),s=Hi(),a=X(),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})(or,or.exports)),or.exports}var Fi=Vi();const xi=jn(Fi);function zi(){const t=new Li({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return xi(t),t}class Ki{constructor(e){this._ajv=e??zi()}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 Wi{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 Gi(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 Ji(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 cr(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&&cr(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&cr(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&cr(r,e)}}function Bi(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 Qi=class extends Co{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 Ki,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ka,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Pa,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ia,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Wi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=No(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(Ua,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}=Bi(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(Ha,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{cr(p,l.content)}catch{}return l};return super.setRequestHandler(e,o)}if(i==="sampling/createMessage"){const o=async(u,m)=>{const h=He(Va,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(Fa,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:Oa,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ra,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ca.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){Gi(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Ji(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},wt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Na,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},wt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},qa,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},ja,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},Aa,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Da,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},wt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},wt,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},An,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=La.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]=Zi(`${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}
|
|
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 Gt={},nn;function pi(){if(nn)return Gt;nn=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=Y(),e=re(),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 Gt.default=s,Gt}var Jt={},an;function zn(){if(an)return Jt;an=1,Object.defineProperty(Jt,"__esModule",{value:!0});const t=qe(),e=Y(),r=Fe(),s=re(),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 Jt.default=n,Jt}var Bt={},on;function mi(){if(on)return Bt;on=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=wr(),e=qe(),r=re(),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 Bt.default=a,Bt}var Qt={},cn;function yi(){if(cn)return Qt;cn=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=qe(),e=Y(),r=re(),s=re(),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 Qt.default=a,Qt}var Zt={},un;function gi(){if(un)return Zt;un=1,Object.defineProperty(Zt,"__esModule",{value:!0});const t=re(),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 Zt.default=e,Zt}var Yt={},ln;function _i(){if(ln)return Yt;ln=1,Object.defineProperty(Yt,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:qe().validateUnion,error:{message:"must match a schema in anyOf"}};return Yt.default=e,Yt}var Xt={},dn;function vi(){if(dn)return Xt;dn=1,Object.defineProperty(Xt,"__esModule",{value:!0});const t=Y(),e=re(),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 Xt.default=s,Xt}var er={},fn;function bi(){if(fn)return er;fn=1,Object.defineProperty(er,"__esModule",{value:!0});const t=re(),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 er.default=e,er}var tr={},hn;function wi(){if(hn)return tr;hn=1,Object.defineProperty(tr,"__esModule",{value:!0});const t=Y(),e=re(),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 tr.default=s,tr}var rr={},pn;function Si(){if(pn)return rr;pn=1,Object.defineProperty(rr,"__esModule",{value:!0});const t=re(),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 rr.default=e,rr}var mn;function $i(){if(mn)return xt;mn=1,Object.defineProperty(xt,"__esModule",{value:!0});const t=Fn(),e=li(),r=xn(),s=di(),a=fi(),n=hi(),i=pi(),o=zn(),u=mi(),m=yi(),h=gi(),$=_i(),g=vi(),y=bi(),v=wi(),w=Si();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 xt.default=l,xt}var sr={},nr={},yn;function Ei(){if(yn)return nr;yn=1,Object.defineProperty(nr,"__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 nr.default=r,nr}var gn;function Ti(){if(gn)return sr;gn=1,Object.defineProperty(sr,"__esModule",{value:!0});const e=[Ei().default];return sr.default=e,sr}var We={},_n;function ki(){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 Pi(){if(vn)return Pt;vn=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=Zo(),e=ui(),r=$i(),s=Ti(),a=ki(),n=[t.default,e.default,(0,r.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];return Pt.default=n,Pt}var ar={},dt={},bn;function Ii(){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 Oi(){if(wn)return ar;wn=1,Object.defineProperty(ar,"__esModule",{value:!0});const t=Y(),e=Ii(),r=Yr(),s=Sr(),a=re(),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 ar.default=i,ar}const Ri="http://json-schema.org/draft-07/schema#",Ci="http://json-schema.org/draft-07/schema#",Ni="Core schema meta-schema",qi={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:[]}},ji=["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:"#"}},Ai={$schema:Ri,$id:Ci,title:Ni,definitions:qi,type:ji,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=Jo(),s=Pi(),a=Oi(),n=Ai,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}})})(St,St.exports)),St.exports}var Di=Kn();const Li=jn(Di);var or={exports:{}},Ar={},$n;function Ui(){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],ne=+H[3];return x>=1&&x<=12&&ne>=1&&ne<=(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 ne=+x[1],_e=+x[2],ve=+x[3],oe=x[4],Ie=x[5]==="-"?-1:1,L=+(x[6]||0),P=+(x[7]||0);if(L>23||P>59||q&&!oe)return!1;if(ne<=23&&_e<=59&&ve<60)return!0;const M=_e-P*Ie,R=ne-L*Ie-(M<0?1:0);return(R===23||R===-1)&&(M===59||M===-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 ne=x.split($);return ne.length===2&&n(ne[0])&&H(ne[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($),[ne,_e]=H.split($),ve=i(F,ne);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 Hi(){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 Vi(){return Tn||(Tn=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=Ui(),s=Hi(),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})(or,or.exports)),or.exports}var Fi=Vi();const xi=jn(Fi);function zi(){const t=new Li({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return xi(t),t}class Ki{constructor(e){this._ajv=e??zi()}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 Wi{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 Gi(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 Ji(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 cr(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&&cr(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&cr(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&cr(r,e)}}function Bi(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 Qi=class extends Co{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 Ki,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ka,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Pa,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Ia,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Wi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=No(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(Ua,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}=Bi(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(Ha,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{cr(p,l.content)}catch{}return l};return super.setRequestHandler(e,o)}if(i==="sampling/createMessage"){const o=async(u,m)=>{const h=He(Va,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(Fa,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:Oa,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ra,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ca.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){Gi(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Ji(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},wt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Na,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},wt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},qa,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},ja,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},Aa,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Da,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},wt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},wt,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},An,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=La.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]=Zi(`${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
9
|
`;break;case"id":o=l.includes("\0")?void 0:l;break;case"retry":/^\d+$/.test(l)?s(parseInt(l,10)):r(new kn(`Invalid \`retry\` value: "${l}"`,{type:"invalid-retry",value:l,line:p}));break;default:r(new kn(`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
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 Zi(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 Xi(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),ce=(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,ur,mr,yt,at,gt,Ve,st,ot,nt,ht,Ce,Fr,xr,zr,On,Kr,Wr,pt,Gr,Jr;class lr 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,ur),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?ce(this,rt,new URL(n.url)):ce(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;ce(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=>{ce(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"&&ce(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=>{ce(this,yt,n)}),le(this,Jr,()=>{ce(this,at,void 0),ee(this,Ee)===this.CONNECTING&&De(this,Ce,Fr).call(this)});try{if(e instanceof URL)ce(this,Ge,e);else if(typeof e=="string")ce(this,Ge,new URL(e,Yi()));else throw new Error("Invalid URL")}catch{throw Xi("An invalid or illegal string was specified")}ce(this,st,Wn({onEvent:ee(this,Kr),onRetry:ee(this,Wr)})),ce(this,Ee,this.CONNECTING),ce(this,yt,3e3),ce(this,mr,(s=r?.fetch)!=null?s:globalThis.fetch),ce(this,ur,(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,ur)}get onerror(){return ee(this,ot)}set onerror(e){ce(this,ot,e)}get onmessage(){return ee(this,nt)}set onmessage(e){ce(this,nt,e)}get onopen(){return ee(this,ht)}set onopen(e){ce(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(),ce(this,Ee,this.CLOSED),ce(this,Ve,void 0))}}Ee=new WeakMap,Ge=new WeakMap,rt=new WeakMap,ur=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(){ce(this,Ee,this.CONNECTING),ce(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&&ce(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;ce(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),ce(this,at,setTimeout(ee(this,Jr),ee(this,yt)))},Jr=new WeakMap,lr.CONNECTING=0,lr.OPEN=1,lr.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 ec extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class tc{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 lr(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 ec(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 rc="mcp";class sc{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,rc),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 nc 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 ac={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 oc{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??ac}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 nc({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(),xa(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 ic extends oc{constructor(e,r){super(e,r)}send(e,r){const s=cc(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function cc(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 uc extends Qi{constructor(e,r){super(e,r)}async listTools(e,r){return await this.request({method:"tools/list",params:e},An,r)}}const lc=async(t,e,r)=>{const s=dc(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const a=new uc({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})}}},dc=(t,e,r)=>{if(t.type==="Websocket")return new sc(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 tc(new URL(t.url),n)}return new ic(new URL(t.url),{requestInit:{headers:a,signal:e,credentials:"include"}})},fc=t=>{try{return JSON.parse(t)}catch{return t}},ir=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 hc(t){const e=r=>"connection"in t?lc({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"?fc(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 ir.has(m)||ir.set(m,n()),await ir.get(m)}catch(h){console.error("Failed to list tools",h),ir.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=>pc({connection:r}):global[e]}});function pc(t){return hc(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:I().describe("Unique identifier for the entity"),title:I().describe("Human-readable title for the entity"),description:I().nullish().describe("Description of the entity"),created_at:I().datetime(),updated_at:I().datetime(),created_by:I().optional(),updated_by:I().optional()}),mc=A({field:B(I()),operator:Pe(["eq","gt","gte","lt","lte","in","like","contains"]),value:ye()}),Qn=Qr(()=>de([mc,A({operator:Pe(["and","or","not"]),conditions:B(Qn)})])),yc=A({field:B(I()),direction:Pe(["asc","desc"]),nulls:Pe(["first","last"]).optional()}),gc=A({where:Qn.optional().describe("Filter expression"),orderBy:B(yc).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 _c(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:we().optional().describe("Whether there are more items available")})}const vc=A({id:I().describe("ID of the entity to retrieve")});function bc(t){return A({item:t.nullable().describe("The retrieved item, or null if not found")})}function wc(t){return A({data:t.partial().describe("Data for the new entity (id may be auto-generated)")})}function Sc(t){return A({item:t.describe("The created entity with generated id")})}function $c(t){return A({id:I().describe("ID of the entity to update"),data:t.partial().describe("Partial entity data to update")})}function Ec(t){return A({item:t.describe("The updated entity")})}const Tc=A({id:I().describe("ID of the entity to delete")});function kc(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:gc,outputSchema:_c(e)},{name:`COLLECTION_${s}_GET`,inputSchema:vc,outputSchema:bc(e)}];return a||n.push({name:`COLLECTION_${s}_CREATE`,inputSchema:wc(e),outputSchema:Sc(e),opt:!0},{name:`COLLECTION_${s}_UPDATE`,inputSchema:$c(e),outputSchema:Ec(e),opt:!0},{name:`COLLECTION_${s}_DELETE`,inputSchema:Tc,outputSchema:kc(e),opt:!0}),n}const Pc=A({id:I(),name:I(),description:I().optional(),inputSchema:ge(I(),ye()),outputSchema:ge(I(),ye()).optional()}),Ic=Be.extend({_meta:A({"io.decocms":A({id:I(),verified:we(),scopeName:I(),appName:I(),friendlyName:I().nullable().optional(),metadata:ge(I(),ye()).nullable().optional(),publishedAt:I().datetime().optional(),updatedAt:I().datetime().optional(),tools:B(Pc).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:A({$schema:I().optional(),_meta:ge(I(),ye()).optional(),name:I().describe("The server name (scope/app)"),title:I().optional().describe("User-friendly title"),description:I().optional().describe("Server description"),icons:B(A({src:I(),mimeType:I().optional(),sizes:B(I()).optional(),theme:Pe(["light","dark"]).optional()})).optional(),remotes:B(A({type:Pe(["http","stdio","sse"]),url:I().optional(),headers:B(ye()).optional()})).optional(),packages:B(ye()).optional(),repository:A({url:I(),source:I().optional(),subfolder:I().optional()}).optional(),version:I().optional(),websiteUrl:I().optional()})});Qe("registry_app",Ic,{readOnly:!0});const Oc=A({specversion:ie("1.0").describe("CloudEvents specification version"),id:I().describe("Unique identifier for this event (UUID recommended)"),source:I().describe("Connection ID of the event publisher"),type:I().describe("Event type (e.g., 'order.created', 'user.signup')"),time:I().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:I().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:I().optional().default("application/json").describe("Content type of the data attribute"),dataschema:I().url().optional().describe("URI to the schema for the data attribute"),data:ye().optional().describe("Event payload (any JSON value)")});A({events:B(Oc).min(1).describe("Batch of CloudEvents to process")});const Rc=A({success:we().optional().describe("Whether this event was processed successfully"),error:I().optional().describe("Error message for this event"),retryAfter:J().int().positive().optional().describe("Re-deliver this event after this many ms")});A({success:we().optional().describe("Batch success - applies to events not in results"),error:I().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:ge(I(),Rc).optional().describe("Per-event results keyed by event ID")});A({type:I().min(1).max(255).describe("Event type identifier"),subject:I().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:ye().optional().describe("Event payload"),deliverAt:I().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:I().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});A({id:I().describe("Unique event ID"),type:I().describe("Event type"),source:I().describe("Source connection ID"),time:I().describe("Event timestamp")});A({eventType:I().min(1).max(255).describe("Event type to subscribe to"),publisher:I().optional().describe("Filter events by publisher connection ID"),filter:I().max(1e3).optional().describe("JSONPath filter expression on event data")});A({subscription:A({id:I().describe("Subscription ID"),connectionId:I().describe("Subscriber connection ID"),eventType:I().describe("Event type pattern"),publisher:I().nullable().describe("Publisher connection filter"),filter:I().nullable().describe("JSONPath filter expression"),enabled:we().describe("Whether subscription is enabled"),createdAt:de([I(),_t()]).describe("Created timestamp"),updatedAt:de([I(),_t()]).describe("Updated timestamp")})});const Cc=A({eventType:I().min(1).max(255).describe("Event type to subscribe to"),publisher:I().optional().describe("Filter events by publisher connection ID"),filter:I().max(1e3).optional().describe("JSONPath filter expression on event data")}),Nc=A({id:I().describe("Subscription ID"),connectionId:I().describe("Subscriber connection ID"),eventType:I().describe("Event type pattern"),publisher:I().nullable().describe("Publisher connection filter"),filter:I().nullable().describe("JSONPath filter expression"),enabled:we().describe("Whether subscription is enabled"),createdAt:de([I(),_t()]).describe("Created timestamp"),updatedAt:de([I(),_t()]).describe("Updated timestamp")});A({subscriptions:B(Cc).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(Nc).describe("Current subscriptions after sync")});A({subscriptionId:I().describe("Subscription ID to remove")});A({success:we().describe("Whether unsubscribe was successful"),subscriptionId:I().describe("Subscription ID that was removed")});A({eventId:I().describe("Event ID to cancel")});A({success:we().describe("Whether cancellation was successful"),eventId:I().describe("Event ID that was cancelled")});A({eventId:I().describe("Event ID to acknowledge")});A({success:we().describe("Whether ACK was successful"),eventId:I().describe("Event ID that was acknowledged")});const qc=Be.extend({avatar:I().describe("URL or data URI to the assistant's avatar image"),system_prompt:I().describe("System prompt that defines the assistant's behavior"),gateway_id:I().describe("Gateway ID to use for this assistant"),model:A({id:I().describe("Model ID"),connectionId:I().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),jc=Qe("assistant",qc),Mc=[...jc],bt=Qr(()=>de([gr(),I(),J(),we(),ge(I(),bt),B(bt)])),Le=ge(I(),ge(I(),bt)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),Zn=A({type:ie("text"),text:I().describe("The text content"),providerOptions:Le}),Ac=de([I(),fa(Uint8Array)]).describe("File data as base64 encoded string, URL string, or Uint8Array"),Xn=A({type:ie("file"),filename:I().optional().describe("Optional filename of the file"),data:Ac,mediaType:I().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:Le}),Dc=A({type:ie("reasoning"),text:I().describe("The reasoning text"),providerOptions:Le}),Lc=A({type:ie("tool-call"),toolCallId:I().describe("ID of the tool call, used to match with tool result"),toolName:I().describe("Name of the tool being called"),input:ye().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:we().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:Le}),Uc=de([A({type:ie("text"),value:I()}),A({type:ie("json"),value:bt}),A({type:ie("error-text"),value:I()}),A({type:ie("error-json"),value:bt}),A({type:ie("content"),value:B(de([A({type:ie("text"),text:I().describe("Text content")}),A({type:ie("media"),data:I().describe("Base-64 encoded media data"),mediaType:I().describe("IANA media type")})]))})]),Yn=A({type:ie("tool-result"),toolCallId:I().describe("ID of the tool call that this result is associated with"),toolName:I().describe("Name of the tool that generated this result"),output:Uc.describe("Result of the tool call"),providerOptions:Le}),Hc=A({role:ie("system"),content:I().describe("System message content"),providerOptions:Le}),Vc=A({role:ie("user"),content:B(de([Zn,Xn])).describe("User message content parts (text or file)"),providerOptions:Le}),Fc=A({role:ie("assistant"),content:B(de([Zn,Xn,Dc,Lc,Yn])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:Le}),xc=A({role:ie("tool"),content:B(Yn).describe("Tool message content (tool results)"),providerOptions:Le}),zc=de([Hc,Vc,Fc,xc]),Kc=B(zc).describe("A list of messages forming the prompt"),Wc=A({prompt:Kc.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(I()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:de([A({type:ie("text")}),A({type:ie("json"),schema:ue().optional().describe("JSON schema that the generated output should conform to"),name:I().optional().describe("Name of output that should be generated"),description:I().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(ue()).optional().describe("The tools that are available for the model"),toolChoice:ue().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:we().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:ue().optional().describe("Abort signal for cancelling the operation"),headers:ge(I(),de([I(),da()])).optional().describe("Additional HTTP headers to be sent with the request"),providerOptions:ue().optional().describe("Additional provider-specific options")}),Gc=A({content:B(ue()).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:A({inputTokens:J().optional(),outputTokens:J().optional(),totalTokens:J().optional(),reasoningTokens:J().optional()}).passthrough().transform(t=>({inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,reasoningTokens:t.reasoningTokens,...t})).describe("Usage information for the language model call"),providerMetadata:ue().optional().describe("Additional provider-specific metadata"),request:A({body:ue().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({id:I().optional().describe("ID for the generated response"),timestamp:_t().optional().describe("Timestamp for the start of the generated response"),modelId:I().optional().describe("The ID of the response model that was used"),headers:ge(I(),I()).optional().describe("Response headers"),body:ue().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:B(ue()).describe("Warnings for the call, e.g. unsupported settings")});A({stream:ue().describe("ReadableStream of LanguageModelV2StreamPart"),request:A({body:ue().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({headers:ge(I(),I()).optional().describe("Response headers")}).optional().describe("Optional response data")});const Jc=A({supportedUrls:ge(I(),B(I())).describe("Supported URL patterns by media type for the provider")});A({modelId:I().describe("The ID of the model"),logo:I().nullable(),description:I().nullable(),capabilities:B(I()),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:I().describe("The ID of the model"),callOptions:Wc}),Bc=Be.extend({logo:I().nullable(),description:I().nullable(),capabilities:B(I()),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()}),Qc=Qe("llm",Bc,{readOnly:!0}),Zc=[{name:"LLM_METADATA",inputSchema:A({modelId:I().describe("The ID of the model")}),outputSchema:Jc},{name:"LLM_DO_STREAM",inputSchema:Cn,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:Cn,outputSchema:Gc},...Qc],Xc=A({scopes:B(I()).describe("List of scopes available"),stateSchema:ge(I(),ye()).describe("JSON Schema (draft-07) defining the state structure")}),Yc=[{name:"MCP_CONFIGURATION",inputSchema:A({}),outputSchema:Xc}],eu=A({toolName:I().describe("Name of the tool to invoke on that connection"),transformCode:I().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.")}),tu=A({code:I().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 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 Yi(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),ce=(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,ur,mr,yt,at,gt,Ve,st,ot,nt,ht,Ce,Fr,xr,zr,On,Kr,Wr,pt,Gr,Jr;class lr 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,ur),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?ce(this,rt,new URL(n.url)):ce(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;ce(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=>{ce(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"&&ce(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=>{ce(this,yt,n)}),le(this,Jr,()=>{ce(this,at,void 0),ee(this,Ee)===this.CONNECTING&&De(this,Ce,Fr).call(this)});try{if(e instanceof URL)ce(this,Ge,e);else if(typeof e=="string")ce(this,Ge,new URL(e,Xi()));else throw new Error("Invalid URL")}catch{throw Yi("An invalid or illegal string was specified")}ce(this,st,Wn({onEvent:ee(this,Kr),onRetry:ee(this,Wr)})),ce(this,Ee,this.CONNECTING),ce(this,yt,3e3),ce(this,mr,(s=r?.fetch)!=null?s:globalThis.fetch),ce(this,ur,(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,ur)}get onerror(){return ee(this,ot)}set onerror(e){ce(this,ot,e)}get onmessage(){return ee(this,nt)}set onmessage(e){ce(this,nt,e)}get onopen(){return ee(this,ht)}set onopen(e){ce(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(),ce(this,Ee,this.CLOSED),ce(this,Ve,void 0))}}Ee=new WeakMap,Ge=new WeakMap,rt=new WeakMap,ur=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(){ce(this,Ee,this.CONNECTING),ce(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&&ce(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;ce(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),ce(this,at,setTimeout(ee(this,Jr),ee(this,yt)))},Jr=new WeakMap,lr.CONNECTING=0,lr.OPEN=1,lr.CLOSED=2;function Xi(){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 ec extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class tc{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 lr(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 ec(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 rc="mcp";class sc{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,rc),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 nc 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 ac={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 oc{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??ac}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 nc({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(),xa(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 ic extends oc{constructor(e,r){super(e,r)}send(e,r){const s=cc(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function cc(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 uc extends Qi{constructor(e,r){super(e,r)}async listTools(e,r){return await this.request({method:"tools/list",params:e},An,r)}}const lc=async(t,e,r)=>{const s=dc(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const a=new uc({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})}}},dc=(t,e,r)=>{if(t.type==="Websocket")return new sc(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 tc(new URL(t.url),n)}return new ic(new URL(t.url),{requestInit:{headers:a,signal:e,credentials:"include"}})},fc=t=>{try{return JSON.parse(t)}catch{return t}},ir=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 hc(t){const e=r=>"connection"in t?lc({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"?fc(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 ir.has(m)||ir.set(m,n()),await ir.get(m)}catch(h){console.error("Failed to list tools",h),ir.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=>pc({connection:r}):global[e]}});function pc(t){return hc(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:I().describe("Unique identifier for the entity"),title:I().describe("Human-readable title for the entity"),description:I().nullish().describe("Description of the entity"),created_at:I().datetime(),updated_at:I().datetime(),created_by:I().optional(),updated_by:I().optional()}),mc=A({field:B(I()),operator:Pe(["eq","gt","gte","lt","lte","in","like","contains"]),value:ye()}),Qn=Qr(()=>de([mc,A({operator:Pe(["and","or","not"]),conditions:B(Qn)})])),yc=A({field:B(I()),direction:Pe(["asc","desc"]),nulls:Pe(["first","last"]).optional()}),gc=A({where:Qn.optional().describe("Filter expression"),orderBy:B(yc).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 _c(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:we().optional().describe("Whether there are more items available")})}const vc=A({id:I().describe("ID of the entity to retrieve")});function bc(t){return A({item:t.nullable().describe("The retrieved item, or null if not found")})}function wc(t){return A({data:t.partial().describe("Data for the new entity (id may be auto-generated)")})}function Sc(t){return A({item:t.describe("The created entity with generated id")})}function $c(t){return A({id:I().describe("ID of the entity to update"),data:t.partial().describe("Partial entity data to update")})}function Ec(t){return A({item:t.describe("The updated entity")})}const Tc=A({id:I().describe("ID of the entity to delete")});function kc(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:gc,outputSchema:_c(e)},{name:`COLLECTION_${s}_GET`,inputSchema:vc,outputSchema:bc(e)}];return a||n.push({name:`COLLECTION_${s}_CREATE`,inputSchema:wc(e),outputSchema:Sc(e),opt:!0},{name:`COLLECTION_${s}_UPDATE`,inputSchema:$c(e),outputSchema:Ec(e),opt:!0},{name:`COLLECTION_${s}_DELETE`,inputSchema:Tc,outputSchema:kc(e),opt:!0}),n}const Pc=A({id:I(),name:I(),description:I().optional(),inputSchema:ge(I(),ye()),outputSchema:ge(I(),ye()).optional()}),Ic=Be.extend({_meta:A({"io.decocms":A({id:I(),verified:we(),scopeName:I(),appName:I(),friendlyName:I().nullable().optional(),metadata:ge(I(),ye()).nullable().optional(),publishedAt:I().datetime().optional(),updatedAt:I().datetime().optional(),tools:B(Pc).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:A({$schema:I().optional(),_meta:ge(I(),ye()).optional(),name:I().describe("The server name (scope/app)"),title:I().optional().describe("User-friendly title"),description:I().optional().describe("Server description"),icons:B(A({src:I(),mimeType:I().optional(),sizes:B(I()).optional(),theme:Pe(["light","dark"]).optional()})).optional(),remotes:B(A({type:Pe(["http","stdio","sse"]),url:I().optional(),headers:B(ye()).optional()})).optional(),packages:B(ye()).optional(),repository:A({url:I(),source:I().optional(),subfolder:I().optional()}).optional(),version:I().optional(),websiteUrl:I().optional()})});Qe("registry_app",Ic,{readOnly:!0});const Oc=A({specversion:ie("1.0").describe("CloudEvents specification version"),id:I().describe("Unique identifier for this event (UUID recommended)"),source:I().describe("Connection ID of the event publisher"),type:I().describe("Event type (e.g., 'order.created', 'user.signup')"),time:I().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:I().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:I().optional().default("application/json").describe("Content type of the data attribute"),dataschema:I().url().optional().describe("URI to the schema for the data attribute"),data:ye().optional().describe("Event payload (any JSON value)")});A({events:B(Oc).min(1).describe("Batch of CloudEvents to process")});const Rc=A({success:we().optional().describe("Whether this event was processed successfully"),error:I().optional().describe("Error message for this event"),retryAfter:J().int().positive().optional().describe("Re-deliver this event after this many ms")});A({success:we().optional().describe("Batch success - applies to events not in results"),error:I().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:ge(I(),Rc).optional().describe("Per-event results keyed by event ID")});A({type:I().min(1).max(255).describe("Event type identifier"),subject:I().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:ye().optional().describe("Event payload"),deliverAt:I().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:I().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});A({id:I().describe("Unique event ID"),type:I().describe("Event type"),source:I().describe("Source connection ID"),time:I().describe("Event timestamp")});A({eventType:I().min(1).max(255).describe("Event type to subscribe to"),publisher:I().optional().describe("Filter events by publisher connection ID"),filter:I().max(1e3).optional().describe("JSONPath filter expression on event data")});A({subscription:A({id:I().describe("Subscription ID"),connectionId:I().describe("Subscriber connection ID"),eventType:I().describe("Event type pattern"),publisher:I().nullable().describe("Publisher connection filter"),filter:I().nullable().describe("JSONPath filter expression"),enabled:we().describe("Whether subscription is enabled"),createdAt:de([I(),_t()]).describe("Created timestamp"),updatedAt:de([I(),_t()]).describe("Updated timestamp")})});const Cc=A({eventType:I().min(1).max(255).describe("Event type to subscribe to"),publisher:I().optional().describe("Filter events by publisher connection ID"),filter:I().max(1e3).optional().describe("JSONPath filter expression on event data")}),Nc=A({id:I().describe("Subscription ID"),connectionId:I().describe("Subscriber connection ID"),eventType:I().describe("Event type pattern"),publisher:I().nullable().describe("Publisher connection filter"),filter:I().nullable().describe("JSONPath filter expression"),enabled:we().describe("Whether subscription is enabled"),createdAt:de([I(),_t()]).describe("Created timestamp"),updatedAt:de([I(),_t()]).describe("Updated timestamp")});A({subscriptions:B(Cc).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(Nc).describe("Current subscriptions after sync")});A({subscriptionId:I().describe("Subscription ID to remove")});A({success:we().describe("Whether unsubscribe was successful"),subscriptionId:I().describe("Subscription ID that was removed")});A({eventId:I().describe("Event ID to cancel")});A({success:we().describe("Whether cancellation was successful"),eventId:I().describe("Event ID that was cancelled")});A({eventId:I().describe("Event ID to acknowledge")});A({success:we().describe("Whether ACK was successful"),eventId:I().describe("Event ID that was acknowledged")});const qc=Be.extend({avatar:I().describe("URL or data URI to the assistant's avatar image"),system_prompt:I().describe("System prompt that defines the assistant's behavior"),gateway_id:I().describe("Gateway ID to use for this assistant"),model:A({id:I().describe("Model ID"),connectionId:I().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),jc=Qe("assistant",qc),Mc=[...jc],bt=Qr(()=>de([gr(),I(),J(),we(),ge(I(),bt),B(bt)])),Le=ge(I(),ge(I(),bt)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),Zn=A({type:ie("text"),text:I().describe("The text content"),providerOptions:Le}),Ac=de([I(),fa(Uint8Array)]).describe("File data as base64 encoded string, URL string, or Uint8Array"),Yn=A({type:ie("file"),filename:I().optional().describe("Optional filename of the file"),data:Ac,mediaType:I().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:Le}),Dc=A({type:ie("reasoning"),text:I().describe("The reasoning text"),providerOptions:Le}),Lc=A({type:ie("tool-call"),toolCallId:I().describe("ID of the tool call, used to match with tool result"),toolName:I().describe("Name of the tool being called"),input:ye().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:we().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:Le}),Uc=de([A({type:ie("text"),value:I()}),A({type:ie("json"),value:bt}),A({type:ie("error-text"),value:I()}),A({type:ie("error-json"),value:bt}),A({type:ie("content"),value:B(de([A({type:ie("text"),text:I().describe("Text content")}),A({type:ie("media"),data:I().describe("Base-64 encoded media data"),mediaType:I().describe("IANA media type")})]))})]),Xn=A({type:ie("tool-result"),toolCallId:I().describe("ID of the tool call that this result is associated with"),toolName:I().describe("Name of the tool that generated this result"),output:Uc.describe("Result of the tool call"),providerOptions:Le}),Hc=A({role:ie("system"),content:I().describe("System message content"),providerOptions:Le}),Vc=A({role:ie("user"),content:B(de([Zn,Yn])).describe("User message content parts (text or file)"),providerOptions:Le}),Fc=A({role:ie("assistant"),content:B(de([Zn,Yn,Dc,Lc,Xn])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:Le}),xc=A({role:ie("tool"),content:B(Xn).describe("Tool message content (tool results)"),providerOptions:Le}),zc=de([Hc,Vc,Fc,xc]),Kc=B(zc).describe("A list of messages forming the prompt"),Wc=A({prompt:Kc.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(I()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:de([A({type:ie("text")}),A({type:ie("json"),schema:ue().optional().describe("JSON schema that the generated output should conform to"),name:I().optional().describe("Name of output that should be generated"),description:I().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(ue()).optional().describe("The tools that are available for the model"),toolChoice:ue().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:we().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:ue().optional().describe("Abort signal for cancelling the operation"),headers:ge(I(),de([I(),da()])).optional().describe("Additional HTTP headers to be sent with the request"),providerOptions:ue().optional().describe("Additional provider-specific options")}),Gc=A({content:B(ue()).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:A({inputTokens:J().optional(),outputTokens:J().optional(),totalTokens:J().optional(),reasoningTokens:J().optional()}).passthrough().transform(t=>({inputTokens:t.inputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,reasoningTokens:t.reasoningTokens,...t})).describe("Usage information for the language model call"),providerMetadata:ue().optional().describe("Additional provider-specific metadata"),request:A({body:ue().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({id:I().optional().describe("ID for the generated response"),timestamp:_t().optional().describe("Timestamp for the start of the generated response"),modelId:I().optional().describe("The ID of the response model that was used"),headers:ge(I(),I()).optional().describe("Response headers"),body:ue().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:B(ue()).describe("Warnings for the call, e.g. unsupported settings")});A({stream:ue().describe("ReadableStream of LanguageModelV2StreamPart"),request:A({body:ue().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:A({headers:ge(I(),I()).optional().describe("Response headers")}).optional().describe("Optional response data")});const Jc=A({supportedUrls:ge(I(),B(I())).describe("Supported URL patterns by media type for the provider")});A({modelId:I().describe("The ID of the model"),logo:I().nullable(),description:I().nullable(),capabilities:B(I()),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:I().describe("The ID of the model"),callOptions:Wc}),Bc=Be.extend({logo:I().nullable(),description:I().nullable(),capabilities:B(I()),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()}),Qc=Qe("llm",Bc,{readOnly:!0}),Zc=[{name:"LLM_METADATA",inputSchema:A({modelId:I().describe("The ID of the model")}),outputSchema:Jc},{name:"LLM_DO_STREAM",inputSchema:Cn,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:Cn,outputSchema:Gc},...Qc],Yc=A({scopes:B(I()).describe("List of scopes available"),stateSchema:ge(I(),ye()).describe("JSON Schema (draft-07) defining the state structure")}),Xc=[{name:"MCP_CONFIGURATION",inputSchema:A({}),outputSchema:Yc}],eu=A({toolName:I().describe("Name of the tool to invoke on that connection"),transformCode:I().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.")}),tu=A({code:I().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": {
|
|
@@ -31,4 +31,4 @@ import{b1 as ue,b2 as ss,v as I,aN as J,X as we,aM as gr,V as B,aK as aa,aI as d
|
|
|
31
31
|
return {
|
|
32
32
|
result: input.example
|
|
33
33
|
}
|
|
34
|
-
}`},config:cu,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."}},uu=Qe("workflow_execution",ra),lu=[...iu,...uu],du=[...lu],fu=Qe("workflow_execution",ra),Nn={LLMS:Zc,WORKFLOW:du,WORKFLOW_EXECUTION:fu,ASSISTANTS:Mc,MCP:
|
|
34
|
+
}`},config:cu,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."}},uu=Qe("workflow_execution",ra),lu=[...iu,...uu],du=[...lu],fu=Qe("workflow_execution",ra),Nn={LLMS:Zc,WORKFLOW:du,WORKFLOW_EXECUTION:fu,ASSISTANTS:Mc,MCP:Xc};function hu(t){return t.map(e=>({name:e.name,inputSchema:e.inputSchema?(()=>{try{return fe(e.inputSchema)}catch(r){return console.error(`Failed to convert input schema for ${e.name}:`,r),A({})}})():A({}),outputSchema:e.outputSchema?(()=>{try{return fe(e.outputSchema)}catch(r){return console.error(`Failed to convert output schema for ${e.name}:`,r),A({})}})():A({})}))}function pu(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 Bn(a).isImplementedBy(s)}function $u({connections:t,binding:e}){const r=(()=>{if(e){if(typeof e=="string"){const s=e.toUpperCase(),a=Nn[s];if(!a){console.warn(`[useBindingConnections] Unknown binding "${e}". Available bindings: ${Object.keys(Nn).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 hu(e)}})();return t?r?t.filter(s=>pu(s,r)):t:[]}function mu(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function sa(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 yu(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 gu(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=sa(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(Bn(i).isImplementedBy(n)){const m=gu(t,s);r.push({name:s,displayName:mu(s),schema:yu(t,s),...m})}}catch{}return r}function Eu(t){return _u(t?.tools??null)}function Tu(t){return t?t.filter(e=>sa(e.tools).find(r=>r==="REGISTRY_APP")):[]}export{qc as A,Be as B,Su as D,nc as E,Tu as a,Eu as b,Kn as c,Y as d,Li as e,Wo as r,$u as u};
|