@decocms/mesh 1.0.8 → 1.0.10
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-BOdIbqIs.js → AlertCircle-zCOLtXNG.js} +1 -1
- package/dist/client/assets/{ArrowLeft--mrEcY9t.js → ArrowLeft-b0UM4Vui.js} +1 -1
- package/dist/client/assets/{Calendar-FEvoSB5L.js → Calendar-Cxw5FKll.js} +1 -1
- package/dist/client/assets/{CheckCircle-DCY43SXR.js → CheckCircle-U8-nit8x.js} +1 -1
- package/dist/client/assets/{ChevronDown-BQbWxkfW.js → ChevronDown-BFYjmmoG.js} +1 -1
- package/dist/client/assets/{Clock-B2GhwaAI.js → Clock-qZko4uak.js} +1 -1
- package/dist/client/assets/{Copy01-CNQxqLRw.js → Copy01-XN5V21c6.js} +1 -1
- package/dist/client/assets/{CpuChip02-BiTasWbD.js → CpuChip02-Nhk4zHXl.js} +1 -1
- package/dist/client/assets/{DotsVertical-D0xC4MY4.js → DotsVertical-CcNQsTaW.js} +1 -1
- package/dist/client/assets/{File06-CginPRn9.js → File06-DB55FK-Z.js} +1 -1
- package/dist/client/assets/{GitBranch01-GzTSxN9T.js → GitBranch01-CM-ab6hS.js} +1 -1
- package/dist/client/assets/{Inbox01-D9KmcOy8.js → Inbox01-CIzt2AdR.js} +1 -1
- package/dist/client/assets/{InfoCircle-D8mTtKdA.js → InfoCircle-ChxTTkMX.js} +1 -1
- package/dist/client/assets/{Key01-e6YzBDTD.js → Key01-DYiMWoz_.js} +1 -1
- package/dist/client/assets/{LinkExternal01-NfJeAPv5.js → LinkExternal01-CBZhTXC0.js} +1 -1
- package/dist/client/assets/{Loading01-CCRghFAi.js → Loading01-Dtm2TLlA.js} +1 -1
- package/dist/client/assets/{Plus-Bu89Xdvq.js → Plus-DF_I5mml.js} +1 -1
- package/dist/client/assets/{SearchMd-9OvHwtrD.js → SearchMd-C_ak4ze3.js} +1 -1
- package/dist/client/assets/{Terminal-CS-oYY6X.js → Terminal-4DdepWh9.js} +1 -1
- package/dist/client/assets/{Trash01-D6Jd-C-A.js → Trash01-FYPMjpVf.js} +1 -1
- package/dist/client/assets/{Upload01-p9mtwUJO.js → Upload01-BYeEw9Vy.js} +1 -1
- package/dist/client/assets/{X-CPWcGQX-.js → X-BTsWwO_U.js} +1 -1
- package/dist/client/assets/{XClose-Bg1dQbEQ.js → XClose-CY6vd_0A.js} +1 -1
- package/dist/client/assets/{alert-dialog-C5WdCZb7.js → alert-dialog-DhxQ40TA.js} +2 -2
- package/dist/client/assets/auth-CfgXQhXI.js +1 -0
- package/dist/client/assets/{auth-catchall-BXbesUXT.js → auth-catchall-CohlC3Pb.js} +1 -1
- package/dist/client/assets/{avatar-_r3OideF.js → avatar-CcUZFpwU.js} +1 -1
- package/dist/client/assets/{badge-C0Qf1_P5.js → badge-CgUwfcKq.js} +1 -1
- package/dist/client/assets/{button-C6Q9i6bB.js → button-DuitHSR8.js} +1 -1
- package/dist/client/assets/{card-CkqxLUmD.js → card-DkEpNms8.js} +1 -1
- package/dist/client/assets/{checkbox-BrNiXyG6.js → checkbox-DTaSeum9.js} +1 -1
- package/dist/client/assets/{collection-detail-D9-8PQpD.js → collection-detail-Dvc6iyHF.js} +2 -2
- package/dist/client/assets/{collection-display-button-CapIICNB.js → collection-display-button-DgDdVSTg.js} +1 -1
- package/dist/client/assets/{collection-header-xspJxL_F.js → collection-header-D-wXFMG4.js} +1 -1
- package/dist/client/assets/{collection-page-BcW_e2hi.js → collection-page-AFIAghtr.js} +1 -1
- package/dist/client/assets/{collection-search-BP4aaz_a.js → collection-search-OoKPetka.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BqYO84av.js → collection-table-wrapper-DEVlTpj8.js} +1 -1
- package/dist/client/assets/{connection-card-CVvPIgot.js → connection-card-CVX6Dj6b.js} +1 -1
- package/dist/client/assets/{connection-detail-JBGxZxkM.js → connection-detail-C_uPOJ6z.js} +1 -1
- package/dist/client/assets/{connections-B74A-ujA.js → connections-DoAE9QhX.js} +1 -1
- package/dist/client/assets/{core-CrBooOPa.js → core-BMfBj0bw.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DKjCEIp0.js → create-organization-dialog-C_xVF_Jl.js} +1 -1
- package/dist/client/assets/{dialog-wqLP6s8y.js → dialog-Dl9CupEb.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Cf1-ucSW.js → dropdown-menu-CPQpNQmn.js} +1 -1
- package/dist/client/assets/env-vars-editor-BcyBU5xA.js +1 -0
- package/dist/client/assets/{error-boundary-BvHIgIeG.js → error-boundary-DMJQCmxn.js} +1 -1
- package/dist/client/assets/extract-connection-data-Bt1_1dQ8.js +1 -0
- package/dist/client/assets/{form-eTDr0W4q.js → form-BfiwCHdz.js} +1 -1
- package/dist/client/assets/{formatDistanceToNow-BxzU2by2.js → formatDistanceToNow-BmkU67cZ.js} +1 -1
- package/dist/client/assets/{gateway-detail-DKkqklk0.js → gateway-detail-ZknLelfM.js} +1 -1
- package/dist/client/assets/{gateways-BhKn-EFm.js → gateways-BAQA-e5y.js} +1 -1
- package/dist/client/assets/{home-DI8Z0JFU.js → home-BzOK0WeX.js} +1 -1
- package/dist/client/assets/index-CCNaUj2A.js +156 -0
- package/dist/client/assets/{index-CZhZ_SKX.js → index-DR-B7Y1Z.js} +1 -1
- package/dist/client/assets/{index-BWHtrgim.js → index-T7OaHK12.js} +1 -1
- package/dist/client/assets/{index-CZLUv0P3.js → index-be58e1VX.js} +3 -3
- package/dist/client/assets/{input-CRJkMCdz.js → input-YU6lpVgW.js} +1 -1
- package/dist/client/assets/json-BnmF_c7J.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-B03842aR.js → json-syntax-highlighter-Dve1WRV4.js} +2 -2
- package/dist/client/assets/{layout-6uTC86JS.js → layout-n40g10Oh.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-BSMDGfqn.js → lazy-highlighter-BY_mRZdt.js} +1 -1
- package/dist/client/assets/{localstorage-keys-CcQMsGvY.js → localstorage-keys-BphvZ-YX.js} +1 -1
- package/dist/client/assets/{login-DGpMcH9O.js → login-CJi6KFGq.js} +1 -1
- package/dist/client/assets/mcp-oauth-CvO1Z13d.js +1 -0
- package/dist/client/assets/{members-F8i7vdZR.js → members-UHyk3Nn4.js} +1 -1
- package/dist/client/assets/{monitoring-C2lb19h6.js → monitoring-65mgE8O0.js} +1 -1
- package/dist/client/assets/{oauth-callback-DtKkmmTQ.js → oauth-callback-KqixmXKf.js} +1 -1
- package/dist/client/assets/{page-DIUi9KSN.js → page-DmmG4y1n.js} +1 -1
- package/dist/client/assets/{popover-Un-VhPfR.js → popover-PTQF8Dbg.js} +1 -1
- package/dist/client/assets/prism-light-0RxCg8xt.js +1 -0
- package/dist/client/assets/{resizable-Dnzm7-QR.js → resizable-BF9gWgPg.js} +45 -47
- package/dist/client/assets/{resource-tabs-BYy3Anud.js → resource-tabs-Dx5v9tHv.js} +1 -1
- package/dist/client/assets/{select-7BtgByyw.js → select-C4QWjnSz.js} +1 -1
- package/dist/client/assets/{settings-rADjIbaj.js → settings-UndPSfwX.js} +1 -1
- package/dist/client/assets/{shell-layout-CvvtwN5U.js → shell-layout-BLjMALRt.js} +1 -1
- package/dist/client/assets/{spinner-DveBEBL5.js → spinner-CNb2mD_9.js} +1 -1
- package/dist/client/assets/{store-BiC_Wlh-.js → store-CGyOcqhE.js} +1 -1
- package/dist/client/assets/{store-app-detail-D_pvzf3Y.js → store-app-detail-BQ4UUaoG.js} +1 -1
- package/dist/client/assets/{switch-Bbk1L7Rg.js → switch-BmVnuO_C.js} +1 -1
- package/dist/client/assets/{tools-list-CUD0lf51.js → tools-list-BV-qlQqF.js} +1 -1
- package/dist/client/assets/{tooltip-CZ2WJBN2.js → tooltip-CqCXb38Z.js} +1 -1
- package/dist/client/assets/{types-BqGYxJd7.js → types-Bm46njUN.js} +1 -1
- package/dist/client/assets/use-binding-DdwsXkNS.js +34 -0
- package/dist/client/assets/{use-connection-B9lcLaJ5.js → use-connection-BbvAiBvg.js} +1 -1
- package/dist/client/assets/{use-connection-resources-DixC-5o3.js → use-connection-resources-D-1-SK-8.js} +1 -1
- package/dist/client/assets/{use-gateway-t9P_FOn3.js → use-gateway-L1UQyU7-.js} +1 -1
- package/dist/client/assets/{use-list-state-BYLR5Bm8.js → use-list-state-DVYCFUpb.js} +1 -1
- package/dist/client/assets/{use-mcp-Bi_aHqdL.js → use-mcp-CWOlOW9q.js} +1 -1
- package/dist/client/assets/{use-members-DaneJZgJ.js → use-members-Dyh_-7GU.js} +1 -1
- package/dist/client/assets/{use-mobile-_A8zw_eW.js → use-mobile-B0xRFGhT.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DsAkGjtI.js → use-organization-settings-fWTyw7VB.js} +1 -1
- package/dist/client/assets/{use-tool-call-DdkMQUZF.js → use-tool-call-CVPTtLoG.js} +1 -1
- package/dist/client/assets/useQuery-C4GPpw7d.js +1 -0
- package/dist/client/assets/utils-o1atviYh.js +1 -0
- package/dist/client/assets/{view-mode-toggle-DHnvkOqv.js → view-mode-toggle-DOtHoBLN.js} +1 -1
- package/dist/client/assets/{well-known-mcp-C4yFJOry.js → well-known-mcp-d1wcdFCF.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +188 -216
- package/dist/server/migrate.js +141 -168
- package/dist/server/server.js +185 -213
- package/package.json +3 -4
- package/dist/client/assets/auth-PBZStuMm.js +0 -26
- package/dist/client/assets/env-vars-editor-Clod5sfm.js +0 -1
- package/dist/client/assets/extract-connection-data-CbrawrDX.js +0 -1
- package/dist/client/assets/index-Cvm_GyUI.js +0 -118
- package/dist/client/assets/json-CcI2X6AJ.js +0 -1
- package/dist/client/assets/mcp-oauth-DQCyGoJw.js +0 -1
- package/dist/client/assets/prism-light-DUBQ6Lm-.js +0 -1
- package/dist/client/assets/use-binding-B349nAGS.js +0 -38
- package/dist/client/assets/useQuery-DhoA2M5z.js +0 -1
- package/dist/client/assets/utils-CYeWJWkG.js +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{aV as ie,aW as zr,V as te,aX as Ee,s as j,X as me,aS as ue,aY as J,v as O,a0 as Te,aZ as aa,a_ as oa,a$ as ia,aj as Mn,b0 as Xr,aR as pe,W as ye,b1 as bt,b2 as ca,b3 as ua}from"./index-Cvm_GyUI.js";import{C as la,P as da,m as fa,G as ha,M as G,E as Z,p as pa,L as ma,q as ya,t as mt,v as _a,w as Vr,x as ga,R as rt,y as va,z as Hr,A as wa,B as ba,D as $a,T as as,F as An,H as Sa,I as Ea,J as ka,K as Ta,N as Pa,S as Ia,O as St,Q as Ra,U as Oa,V as Ca,W as Na,X as qa,Y as Ma,Z as jn,a0 as Aa,a1 as ja,a2 as Da,a3 as La,a4 as Ua,a5 as Me,a6 as Xe,a7 as hr,a8 as gt,a9 as Fa}from"./auth-PBZStuMm.js";function Fe(t){function e(r,s){return s.description&&(r=r.describe(s.description)),r}if(t.const!==void 0)return typeof t.const=="string"?e(ie(t.const),t):typeof t.const=="number"?e(ie(t.const),t):typeof t.const=="boolean"?e(ie(t.const),t):t.const===null?e(zr(),t):e(ie(t.const),t);if(t.type)switch(t.type){case"string":{if(t.enum)return t.enum.length===0?e(O(),t):e(Te(t.enum),t);let r=O();if(t.minLength!==void 0&&(r=r.min(t.minLength)),t.maxLength!==void 0&&(r=r.max(t.maxLength)),t.pattern!==void 0){const s=new RegExp(t.pattern);r=r.regex(s)}return e(r,t)}case"number":case"integer":{if(t.enum){if(t.enum.length===0)return e(J(),t);const s=t.enum.map(a=>ie(a));if(s.length===1)return e(s[0],t);if(s.length>=2){const a=ue([s[0],s[1],...s.slice(2)]);return e(a,t)}}let r=t.type==="integer"?J().int():J();return t.minimum!==void 0&&(r=r.min(t.minimum)),t.maximum!==void 0&&(r=r.max(t.maximum)),t.exclusiveMinimum!==void 0&&(r=r.gt(t.exclusiveMinimum)),t.exclusiveMaximum!==void 0&&(r=r.lt(t.exclusiveMaximum)),t.multipleOf!==void 0&&(r=r.multipleOf(t.multipleOf)),e(r,t)}case"boolean":if(t.enum){if(t.enum.length===0)return e(me(),t);const r=t.enum.map(s=>ie(s));if(r.length===1)return e(r[0],t);if(r.length>=2){const s=ue([r[0],r[1],...r.slice(2)]);return e(s,t)}}return e(me(),t);case"null":return e(zr(),t);case"object":if(t.properties){const r={};for(const[a,n]of Object.entries(t.properties))r[a]=Fe(n);if(t.required&&Array.isArray(t.required)){const a=new Set(t.required);for(const n of Object.keys(r))a.has(n)||(r[n]=r[n].optional())}else for(const a of Object.keys(r))r[a]=r[a].optional();let s;return t.additionalProperties!==!1?s=j(r).passthrough():s=j(r),e(s,t)}return e(j({}),t);case"array":{let r;return t.items?r=te(Fe(t.items)):r=te(Ee()),t.minItems!==void 0&&(r=r.min(t.minItems)),t.maxItems!==void 0&&(r=r.max(t.maxItems)),t.uniqueItems===!0&&(r=r.refine(s=>{const a=new Set;return s.every(n=>{if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return a.has(n)?!1:(a.add(n),!0);const c=JSON.stringify(n);return a.has(c)?!1:(a.add(c),!0)})},{message:"Array items must be unique"})),e(r,t)}}if(t.enum){if(t.enum.length===0)return e(aa(),t);if(t.enum.every(s=>typeof s=="string"))return e(Te(t.enum),t);{const s=t.enum.map(a=>ie(a));if(s.length===1)return e(s[0],t);if(s.length>=2){const a=ue([s[0],s[1],...s.slice(2)]);return e(a,t)}}}if(t.anyOf&&t.anyOf.length>=2){const r=t.anyOf.map(Fe);return e(ue([r[0],r[1],...r.slice(2)]),t)}if(t.allOf)return e(t.allOf.reduce((r,s)=>oa(r,Fe(s)),j({})),t);if(t.oneOf&&t.oneOf.length>=2){const r=t.oneOf.map(Fe);return e(ue([r[0],r[1],...r.slice(2)]),t)}return e(Ee(),t)}function gr(t){return!!t._zod}function He(t,e){return gr(t)?ia(t,e):t.safeParse(e)}function Dn(t){if(!t)return;let e;if(gr(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function za(t){if(gr(t)){const n=t._zod?.def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}}const r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}const s=t.value;if(s!==void 0)return s}function We(t){return t==="completed"||t==="failed"||t==="cancelled"}function Va(t,e,r,s){s?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Ze(t,e,r,s,a){t[e]=r,Va(t,e,s,a)}let Tr;const Oe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Tr===void 0&&(Tr=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tr),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Dc(t,e){const r={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":Ze(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e);break;case"max":Ze(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ce(r,"email",s.message,e);break;case"format:idn-email":Ce(r,"idn-email",s.message,e);break;case"pattern:zod":ve(r,Oe.email,s.message,e);break}break;case"url":Ce(r,"uri",s.message,e);break;case"uuid":Ce(r,"uuid",s.message,e);break;case"regex":ve(r,s.regex,s.message,e);break;case"cuid":ve(r,Oe.cuid,s.message,e);break;case"cuid2":ve(r,Oe.cuid2,s.message,e);break;case"startsWith":ve(r,RegExp(`^${Pr(s.value,e)}`),s.message,e);break;case"endsWith":ve(r,RegExp(`${Pr(s.value,e)}$`),s.message,e);break;case"datetime":Ce(r,"date-time",s.message,e);break;case"date":Ce(r,"date",s.message,e);break;case"time":Ce(r,"time",s.message,e);break;case"duration":Ce(r,"duration",s.message,e);break;case"length":Ze(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,s.value):s.value,s.message,e),Ze(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,s.value):s.value,s.message,e);break;case"includes":{ve(r,RegExp(Pr(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Ce(r,"ipv4",s.message,e),s.version!=="v4"&&Ce(r,"ipv6",s.message,e);break}case"base64url":ve(r,Oe.base64url,s.message,e);break;case"jwt":ve(r,Oe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ve(r,Oe.ipv4Cidr,s.message,e),s.version!=="v4"&&ve(r,Oe.ipv6Cidr,s.message,e);break}case"emoji":ve(r,Oe.emoji(),s.message,e);break;case"ulid":{ve(r,Oe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ce(r,"binary",s.message,e);break}case"contentEncoding:base64":{Ze(r,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{ve(r,Oe.base64,s.message,e);break}}break}case"nanoid":ve(r,Oe.nanoid,s.message,e)}return r}function Pr(t,e){return e.patternStrategy==="escape"?xa(t):t}const Ha=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function xa(t){let e="";for(let r=0;r<t.length;r++)Ha.has(t[r])||(e+="\\"),e+=t[r];return e}function Ce(t,e,r,s){t.format||t.anyOf?.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&s.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&s.errorMessages&&{errorMessage:{format:r}}})):Ze(t,"format",e,r,s)}function ve(t,e,r,s){t.pattern||t.allOf?.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&s.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:os(e,s),...r&&s.errorMessages&&{errorMessage:{pattern:r}}})):Ze(t,"pattern",os(e,s),r,s)}function os(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},s=r.i?t.source.toLowerCase():t.source;let a="",n=!1,c=!1,o=!1;for(let u=0;u<s.length;u++){if(n){a+=s[u],n=!1;continue}if(r.i){if(c){if(s[u].match(/[a-z]/)){o?(a+=s[u],a+=`${s[u-2]}-${s[u]}`.toUpperCase(),o=!1):s[u+1]==="-"&&s[u+2]?.match(/[a-z]/)?(a+=s[u],o=!0):a+=`${s[u]}${s[u].toUpperCase()}`;continue}}else if(s[u].match(/[a-z]/)){a+=`[${s[u]}${s[u].toUpperCase()}]`;continue}}if(r.m){if(s[u]==="^"){a+=`(^|(?<=[\r
|
|
2
|
-
]))`;continue}else if(s[u]==="$"){a+=`($|(?=[\r
|
|
3
|
-
]))`;continue}}if(r.s&&s[u]==="."){a+=c?`${s[u]}\r
|
|
4
|
-
`:`[${s[u]}\r
|
|
5
|
-
]`;continue}a+=s[u],s[u]==="\\"?n=!0:c&&s[u]==="]"?c=!1:!c&&s[u]==="["&&(c=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function is(t){const r=Dn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");const s=za(r);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function cs(t,e){const r=He(t,e);if(!r.success)throw r.error;return r.data}const Ka=6e4;class Wa{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(la,r=>{this._oncancel(r)}),this.setNotificationHandler(da,r=>{this._onprogress(r)}),this.setRequestHandler(fa,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ha,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(pa,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 S=u,_=new G(S.error.code,S.error.message,S.error.data);h(_)}else{const S=o.type==="response"?"Response":"Error";this._onerror(new Error(`${S} handler missing for request ${m}`))}continue}await this._transport?.send(o.message,{relatedRequestId:s.requestId})}}const c=await this._taskStore.getTask(n,s.sessionId);if(!c)throw new G(Z.InvalidParams,`Task not found: ${n}`);if(!We(c.status))return await this._waitForTaskUpdate(n,s.signal),await a();if(We(c.status)){const o=await this._taskStore.getTaskResult(n,s.sessionId);return this._clearTaskQueue(n),{...o,_meta:{...o._meta,[rt]:{taskId:n}}}}return await a()};return await a()}),this.setRequestHandler(ma,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(ya,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(We(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,c)=>{a?.(n,c),mt(n)||_a(n)?this._onresponse(n):Vr(n)?this._onrequest(n,c):ga(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?.[rt]?.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(S=>this._onerror(new Error(`Failed to enqueue error response: ${S}`))):a?.send(h).catch(S=>this._onerror(new Error(`Failed to send an error response: ${S}`)));return}const c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);const o=va(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,a?.sessionId):void 0,m={signal:c.signal,sessionId:a?.sessionId,_meta:e.params?._meta,sendNotification:async h=>{const S={relatedRequestId:e.id};n&&(S.relatedTask={taskId:n}),await this.notification(h,S)},sendRequest:async(h,S,_)=>{const y={..._,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,S,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(c.signal.aborted)return;const S={result:h,jsonrpc:"2.0",id:e.id};n&&this._taskMessageQueue?await this._enqueueTaskMessage(n,{type:"response",message:S,timestamp:Date.now()},a?.sessionId):await a?.send(S)},async h=>{if(c.signal.aborted)return;const S={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:S,timestamp:Date.now()},a?.sessionId):await a?.send(S)}).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 c=this._responseHandlers.get(a),o=this._timeoutInfo.get(a);if(o&&c&&o.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(u){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),c(u);return}n(s)}_onresponse(e){const r=Number(e.id),s=this._requestResolvers.get(r);if(s){if(this._requestResolvers.delete(r),mt(e))s(e);else{const c=new G(e.error.code,e.error.message,e.error.data);s(c)}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(mt(e)&&e.result&&typeof e.result=="object"){const c=e.result;if(c.task&&typeof c.task=="object"){const o=c.task;typeof o.taskId=="string"&&(n=!0,this._taskProgressTokens.set(o.taskId,r))}}if(n||this._progressHandlers.delete(r),mt(e))a(e);else{const c=G.fromError(e.error.code,e.error.message,e.error.data);a(c)}}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(c){yield{type:"error",error:c instanceof G?c:new G(Z.InternalError,String(c))}}return}let n;try{const c=await this.request(e,Hr,s);if(c.task)n=c.task.taskId,yield{type:"taskCreated",task:c.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},We(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(c){yield{type:"error",error:c instanceof G?c:new G(Z.InternalError,String(c))}}}request(e,r,s){const{relatedRequestId:a,resumptionToken:n,onresumptiontoken:c,task:o,relatedTask:u}=s??{};return new Promise((m,h)=>{const S=i=>{h(i)};if(!this._transport){S(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(i){S(i);return}s?.signal?.throwIfAborted();const _=this._requestMessageId++,y={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),y.params={...e.params,_meta:{...e.params?._meta||{},progressToken:_}}),o&&(y.params={...y.params,task:o}),u&&(y.params={...y.params,_meta:{...y.params?._meta||{},[rt]:u}});const v=i=>{this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(i)}},{relatedRequestId:a,resumptionToken:n,onresumptiontoken:c}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const d=i instanceof G?i:new G(Z.RequestTimeout,String(i));h(d)};this._responseHandlers.set(_,i=>{if(!s?.signal?.aborted){if(i instanceof Error)return h(i);try{const d=He(r,i.result);d.success?m(d.data):h(d.error)}catch(d){h(d)}}}),s?.signal?.addEventListener("abort",()=>{v(s?.signal?.reason)});const b=s?.timeout??Ka,l=()=>v(G.fromError(Z.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(_,b,s?.maxTotalTimeout,l,s?.resetTimeoutOnProgress??!1);const p=u?.taskId;if(p){const i=d=>{const $=this._responseHandlers.get(_);$?$(d):this._onerror(new Error(`Response handler missing for side-channeled request ${_}`))};this._requestResolvers.set(_,i),this._enqueueTaskMessage(p,{type:"request",message:y,timestamp:Date.now()}).catch(d=>{this._cleanupTimeout(_),h(d)})}else this._transport.send(y,{relatedRequestId:a,resumptionToken:n,onresumptiontoken:c}).catch(i=>{this._cleanupTimeout(_),h(i)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},wa,r)}async getTaskResult(e,r,s){return this.request({method:"tasks/result",params:e},r,s)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},ba,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},$a,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=r?.relatedTask?.taskId;if(s){const o={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[rt]: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||{},[rt]:r.relatedTask}}}),this._transport?.send(o,r).catch(u=>this._onerror(u))});return}let c={...e,jsonrpc:"2.0"};r?.relatedTask&&(c={...c,params:{...c.params,_meta:{...c.params?._meta||{},[rt]:r.relatedTask}}}),await this._transport.send(c,r)}setRequestHandler(e,r){const s=is(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(a,n)=>{const c=cs(e,a);return Promise.resolve(r(c,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=is(e);this._notificationHandlers.set(s,a=>{const n=cs(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"&&Vr(a.message)){const n=a.message.id,c=this._requestResolvers.get(n);c?(c(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 c=setTimeout(a,s);r.addEventListener("abort",()=>{clearTimeout(c),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,c)=>{await s.storeTaskResult(a,n,c,r);const o=await s.getTask(a,r);if(o){const u=as.parse({method:"notifications/tasks/status",params:o});await this.notification(u),We(o.status)&&this._cleanupTaskProgressHandler(a)}},getTaskResult:a=>s.getTaskResult(a,r),updateTaskStatus:async(a,n,c)=>{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(We(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,c,r);const u=await s.getTask(a,r);if(u){const m=as.parse({method:"notifications/tasks/status",params:u});await this.notification(m),We(u.status)&&this._cleanupTaskProgressHandler(a)}},listTasks:a=>s.listTasks(a,r)}}}function us(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ga(t,e){const r={...t};for(const s in e){const a=s,n=e[a];if(n===void 0)continue;const c=r[a];us(c)&&us(n)?r[a]={...c,...n}:r[a]=n}return r}var Et={exports:{}},Ir={},je={},Ge={},Rr={},Or={},Cr={},ls;function pr(){return ls||(ls=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(i){if(super(),!t.IDENTIFIER.test(i))throw new Error("CodeGen: name must be a valid identifier");this.str=i}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class s extends e{constructor(i){super(),this._items=typeof i=="string"?[i]:i}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const i=this._items[0];return i===""||i==='""'}get str(){var i;return(i=this._str)!==null&&i!==void 0?i:this._str=this._items.reduce((d,$)=>`${d}${$}`,"")}get names(){var i;return(i=this._names)!==null&&i!==void 0?i:this._names=this._items.reduce((d,$)=>($ instanceof r&&(d[$.str]=(d[$.str]||0)+1),d),{})}}t._Code=s,t.nil=new s("");function a(p,...i){const d=[p[0]];let $=0;for(;$<i.length;)o(d,i[$]),d.push(p[++$]);return new s(d)}t._=a;const n=new s("+");function c(p,...i){const d=[y(p[0])];let $=0;for(;$<i.length;)d.push(n),o(d,i[$]),d.push(n,y(p[++$]));return u(d),new s(d)}t.str=c;function o(p,i){i instanceof s?p.push(...i._items):i instanceof r?p.push(i):p.push(S(i))}t.addCodeArg=o;function u(p){let i=1;for(;i<p.length-1;){if(p[i]===n){const d=m(p[i-1],p[i+1]);if(d!==void 0){p.splice(i-1,3,d);continue}p[i++]="+"}i++}}function m(p,i){if(i==='""')return p;if(p==='""')return i;if(typeof p=="string")return i instanceof r||p[p.length-1]!=='"'?void 0:typeof i!="string"?`${p.slice(0,-1)}${i}"`:i[0]==='"'?p.slice(0,-1)+i.slice(1):void 0;if(typeof i=="string"&&i[0]==='"'&&!(p instanceof r))return`"${p}${i.slice(1)}`}function h(p,i){return i.emptyStr()?p:p.emptyStr()?i:c`${p}${i}`}t.strConcat=h;function S(p){return typeof p=="number"||typeof p=="boolean"||p===null?p:y(Array.isArray(p)?p.join(","):p)}function _(p){return new s(y(p))}t.stringify=_;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 b(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=b;function l(p){return new s(p.toString())}t.regexpCode=l})(Cr)),Cr}var Nr={},ds;function fs(){return ds||(ds=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=pr();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,S;if(!((S=(h=this._parent)===null||h===void 0?void 0:h._prefixes)===null||S===void 0)&&S.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:S}){this.value=m,this.scopePath=(0,e._)`.${new e.Name(h)}[${S}]`}}t.ValueScopeName=n;const c=(0,e._)`\n`;class o extends a{constructor(m){super(m),this._values={},this._scope=m.scope,this.opts={...m,_n:m.lines?c:e.nil}}get(){return this._scope}name(m){return new n(m,this._newName(m))}value(m,h){var S;if(h.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const _=this.toName(m),{prefix:y}=_,v=(S=h.key)!==null&&S!==void 0?S:h.ref;let b=this._values[y];if(b){const i=b.get(v);if(i)return i}else b=this._values[y]=new Map;b.set(v,_);const l=this._scope[y]||(this._scope[y]=[]),p=l.length;return l[p]=h.ref,_.setValue(h,{property:y,itemIndex:p}),_}getValue(m,h){const S=this._values[m];if(S)return S.get(h)}scopeRefs(m,h=this._values){return this._reduceValues(h,S=>{if(S.scopePath===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return(0,e._)`${m}${S.scopePath}`})}scopeCode(m=this._values,h,S){return this._reduceValues(m,_=>{if(_.value===void 0)throw new Error(`CodeGen: name "${_}" has no value`);return _.value.code},h,S)}_reduceValues(m,h,S={},_){let y=e.nil;for(const v in m){const b=m[v];if(!b)continue;const l=S[v]=S[v]||new Map;b.forEach(p=>{if(l.has(p))return;l.set(p,s.Started);let i=h(p);if(i){const d=this.opts.es5?t.varKinds.var:t.varKinds.const;y=(0,e._)`${y}${d} ${p} = ${i};${this.opts._n}`}else if(i=_?.(p))y=(0,e._)`${y}${i}${this.opts._n}`;else throw new r(p);l.set(p,s.Completed)})}return y}}t.ValueScope=o})(Nr)),Nr}var hs;function Q(){return hs||(hs=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=pr(),r=fs();var s=pr();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=fs();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(g,k){return this}}class c extends n{constructor(g,k,N){super(),this.varKind=g,this.name=k,this.rhs=N}render({es5:g,_n:k}){const N=g?r.varKinds.var:this.varKind,x=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${x};`+k}optimizeNames(g,k){if(g[this.name.str])return this.rhs&&(this.rhs=H(this.rhs,g,k)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends n{constructor(g,k,N){super(),this.lhs=g,this.rhs=k,this.sideEffects=N}render({_n:g}){return`${this.lhs} = ${this.rhs};`+g}optimizeNames(g,k){if(!(this.lhs instanceof e.Name&&!g[this.lhs.str]&&!this.sideEffects))return this.rhs=H(this.rhs,g,k),this}get names(){const g=this.lhs instanceof e.Name?{}:{...this.lhs.names};return V(g,this.rhs)}}class u extends o{constructor(g,k,N,x){super(g,N,x),this.op=k}render({_n:g}){return`${this.lhs} ${this.op}= ${this.rhs};`+g}}class m extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`${this.label}:`+g}}class h extends n{constructor(g){super(),this.label=g,this.names={}}render({_n:g}){return`break${this.label?` ${this.label}`:""};`+g}}class S extends n{constructor(g){super(),this.error=g}render({_n:g}){return`throw ${this.error};`+g}get names(){return this.error.names}}class _ extends n{constructor(g){super(),this.code=g}render({_n:g}){return`${this.code};`+g}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(g,k){return this.code=H(this.code,g,k),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class y extends n{constructor(g=[]){super(),this.nodes=g}render(g){return this.nodes.reduce((k,N)=>k+N.render(g),"")}optimizeNodes(){const{nodes:g}=this;let k=g.length;for(;k--;){const N=g[k].optimizeNodes();Array.isArray(N)?g.splice(k,1,...N):N?g[k]=N:g.splice(k,1)}return g.length>0?this:void 0}optimizeNames(g,k){const{nodes:N}=this;let x=N.length;for(;x--;){const W=N[x];W.optimizeNames(g,k)||(ne(g,W.names),N.splice(x,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((g,k)=>F(g,k.names),{})}}class v extends y{render(g){return"{"+g._n+super.render(g)+"}"+g._n}}class b extends y{}class l extends v{}l.kind="else";class p extends v{constructor(g,k){super(k),this.condition=g}render(g){let k=`if(${this.condition})`+super.render(g);return this.else&&(k+="else "+this.else.render(g)),k}optimizeNodes(){super.optimizeNodes();const g=this.condition;if(g===!0)return this.nodes;let k=this.else;if(k){const N=k.optimizeNodes();k=this.else=Array.isArray(N)?new l(N):N}if(k)return g===!1?k instanceof p?k:k.nodes:this.nodes.length?this:new p(_e(g),k instanceof p?[k]:k.nodes);if(!(g===!1||!this.nodes.length))return this}optimizeNames(g,k){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(g,k),!!(super.optimizeNames(g,k)||this.else))return this.condition=H(this.condition,g,k),this}get names(){const g=super.names;return V(g,this.condition),this.else&&F(g,this.else.names),g}}p.kind="if";class i extends v{}i.kind="for";class d extends i{constructor(g){super(),this.iteration=g}render(g){return`for(${this.iteration})`+super.render(g)}optimizeNames(g,k){if(super.optimizeNames(g,k))return this.iteration=H(this.iteration,g,k),this}get names(){return F(super.names,this.iteration.names)}}class $ extends i{constructor(g,k,N,x){super(),this.varKind=g,this.name=k,this.from=N,this.to=x}render(g){const k=g.es5?r.varKinds.var:this.varKind,{name:N,from:x,to:W}=this;return`for(${k} ${N}=${x}; ${N}<${W}; ${N}++)`+super.render(g)}get names(){const g=V(super.names,this.from);return V(g,this.to)}}class f extends i{constructor(g,k,N,x){super(),this.loop=g,this.varKind=k,this.name=N,this.iterable=x}render(g){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(g)}optimizeNames(g,k){if(super.optimizeNames(g,k))return this.iterable=H(this.iterable,g,k),this}get names(){return F(super.names,this.iterable.names)}}class w extends v{constructor(g,k,N){super(),this.name=g,this.args=k,this.async=N}render(g){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(g)}}w.kind="func";class E extends y{render(g){return"return "+super.render(g)}}E.kind="return";class C extends v{render(g){let k="try"+super.render(g);return this.catch&&(k+=this.catch.render(g)),this.finally&&(k+=this.finally.render(g)),k}optimizeNodes(){var g,k;return super.optimizeNodes(),(g=this.catch)===null||g===void 0||g.optimizeNodes(),(k=this.finally)===null||k===void 0||k.optimizeNodes(),this}optimizeNames(g,k){var N,x;return super.optimizeNames(g,k),(N=this.catch)===null||N===void 0||N.optimizeNames(g,k),(x=this.finally)===null||x===void 0||x.optimizeNames(g,k),this}get names(){const g=super.names;return this.catch&&F(g,this.catch.names),this.finally&&F(g,this.finally.names),g}}class D extends v{constructor(g){super(),this.error=g}render(g){return`catch(${this.error})`+super.render(g)}}D.kind="catch";class z extends v{render(g){return"finally"+super.render(g)}}z.kind="finally";class q{constructor(g,k={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...k,_n:k.lines?`
|
|
6
|
-
`:""},this._extScope=g,this._scope=new r.Scope({parent:g}),this._nodes=[new b]}toString(){return this._root.render(this.opts)}name(g){return this._scope.name(g)}scopeName(g){return this._extScope.name(g)}scopeValue(g,k){const N=this._extScope.value(g,k);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(g,k){return this._extScope.getValue(g,k)}scopeRefs(g){return this._extScope.scopeRefs(g,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(g,k,N,x){const W=this._scope.toName(k);return N!==void 0&&x&&(this._constants[W.str]=N),this._leafNode(new c(g,W,N)),W}const(g,k,N){return this._def(r.varKinds.const,g,k,N)}let(g,k,N){return this._def(r.varKinds.let,g,k,N)}var(g,k,N){return this._def(r.varKinds.var,g,k,N)}assign(g,k,N){return this._leafNode(new o(g,k,N))}add(g,k){return this._leafNode(new u(g,t.operators.ADD,k))}code(g){return typeof g=="function"?g():g!==e.nil&&this._leafNode(new _(g)),this}object(...g){const k=["{"];for(const[N,x]of g)k.length>1&&k.push(","),k.push(N),(N!==x||this.opts.es5)&&(k.push(":"),(0,e.addCodeArg)(k,x));return k.push("}"),new e._Code(k)}if(g,k,N){if(this._blockNode(new p(g)),k&&N)this.code(k).else().code(N).endIf();else if(k)this.code(k).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(g){return this._elseNode(new p(g))}else(){return this._elseNode(new l)}endIf(){return this._endBlockNode(p,l)}_for(g,k){return this._blockNode(g),k&&this.code(k).endFor(),this}for(g,k){return this._for(new d(g),k)}forRange(g,k,N,x,W=this.opts.es5?r.varKinds.var:r.varKinds.let){const se=this._scope.toName(g);return this._for(new $(W,se,k,N),()=>x(se))}forOf(g,k,N,x=r.varKinds.const){const W=this._scope.toName(g);if(this.opts.es5){const se=k instanceof e.Name?k:this.var("_arr",k);return this.forRange("_i",0,(0,e._)`${se}.length`,ee=>{this.var(W,(0,e._)`${se}[${ee}]`),N(W)})}return this._for(new f("of",x,W,k),()=>N(W))}forIn(g,k,N,x=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(g,(0,e._)`Object.keys(${k})`,N);const W=this._scope.toName(g);return this._for(new f("in",x,W,k),()=>N(W))}endFor(){return this._endBlockNode(i)}label(g){return this._leafNode(new m(g))}break(g){return this._leafNode(new h(g))}return(g){const k=new E;if(this._blockNode(k),this.code(g),k.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(g,k,N){if(!k&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const x=new C;if(this._blockNode(x),this.code(g),k){const W=this.name("e");this._currNode=x.catch=new D(W),k(W)}return N&&(this._currNode=x.finally=new z,this.code(N)),this._endBlockNode(D,z)}throw(g){return this._leafNode(new S(g))}block(g,k){return this._blockStarts.push(this._nodes.length),g&&this.code(g).endBlock(k),this}endBlock(g){const k=this._blockStarts.pop();if(k===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-k;if(N<0||g!==void 0&&N!==g)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${g} expected`);return this._nodes.length=k,this}func(g,k=e.nil,N,x){return this._blockNode(new w(g,k,N)),x&&this.code(x).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(g=1){for(;g-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(g){return this._currNode.nodes.push(g),this}_blockNode(g){this._currNode.nodes.push(g),this._nodes.push(g)}_endBlockNode(g,k){const N=this._currNode;if(N instanceof g||k&&N instanceof k)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${k?`${g.kind}/${k.kind}`:g.kind}"`)}_elseNode(g){const k=this._currNode;if(!(k instanceof p))throw new Error('CodeGen: "else" without "if"');return this._currNode=k.else=g,this}get _root(){return this._nodes[0]}get _currNode(){const g=this._nodes;return g[g.length-1]}set _currNode(g){const k=this._nodes;k[k.length-1]=g}}t.CodeGen=q;function F(R,g){for(const k in g)R[k]=(R[k]||0)+(g[k]||0);return R}function V(R,g){return g instanceof e._CodeOrName?F(R,g.names):R}function H(R,g,k){if(R instanceof e.Name)return N(R);if(!x(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=k[W.str];return se===void 0||g[W.str]!==1?W:(delete g[W.str],se)}function x(W){return W instanceof e._Code&&W._items.some(se=>se instanceof e.Name&&g[se.str]===1&&k[se.str]!==void 0)}}function ne(R,g){for(const k in g)R[k]=(R[k]||0)-(g[k]||0)}function _e(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:(0,e._)`!${A(R)}`}t.not=_e;const ge=P(t.operators.AND);function oe(...R){return R.reduce(ge)}t.and=oe;const Ie=P(t.operators.OR);function L(...R){return R.reduce(Ie)}t.or=L;function P(R){return(g,k)=>g===e.nil?k:k===e.nil?g:(0,e._)`${A(g)} ${R} ${A(k)}`}function A(R){return R instanceof e.Name?R:(0,e._)`(${R})`}})(Or)),Or}var B={},ps;function re(){if(ps)return B;ps=1,Object.defineProperty(B,"__esModule",{value:!0}),B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;const t=Q(),e=pr();function r(f){const w={};for(const E of f)w[E]=!0;return w}B.toHash=r;function s(f,w){return typeof w=="boolean"?w:Object.keys(w).length===0?!0:(a(f,w),!n(w,f.self.RULES.all))}B.alwaysValidSchema=s;function a(f,w=f.schema){const{opts:E,self:C}=f;if(!E.strictSchema||typeof w=="boolean")return;const D=C.RULES.keywords;for(const z in w)D[z]||$(f,`unknown keyword: "${z}"`)}B.checkUnknownRules=a;function n(f,w){if(typeof f=="boolean")return!f;for(const E in f)if(w[E])return!0;return!1}B.schemaHasRules=n;function c(f,w){if(typeof f=="boolean")return!f;for(const E in f)if(E!=="$ref"&&w.all[E])return!0;return!1}B.schemaHasRulesButRef=c;function o({topSchemaRef:f,schemaPath:w},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}${w}${(0,t.getProperty)(C)}`}B.schemaRefOrVal=o;function u(f){return S(decodeURIComponent(f))}B.unescapeFragment=u;function m(f){return encodeURIComponent(h(f))}B.escapeFragment=m;function h(f){return typeof f=="number"?`${f}`:f.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=h;function S(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=S;function _(f,w){if(Array.isArray(f))for(const E of f)w(E);else w(f)}B.eachItem=_;function y({mergeNames:f,mergeToName:w,mergeValues:E,resultToName:C}){return(D,z,q,F)=>{const V=q===void 0?z:q instanceof t.Name?(z instanceof t.Name?f(D,z,q):w(D,z,q),q):z instanceof t.Name?(w(D,q,z),z):E(z,q);return F===t.Name&&!(V instanceof t.Name)?C(D,V):V}}B.mergeEvaluated={props:y({mergeNames:(f,w,E)=>f.if((0,t._)`${E} !== true && ${w} !== undefined`,()=>{f.if((0,t._)`${w} === true`,()=>f.assign(E,!0),()=>f.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${w})`))}),mergeToName:(f,w,E)=>f.if((0,t._)`${E} !== true`,()=>{w===!0?f.assign(E,!0):(f.assign(E,(0,t._)`${E} || {}`),b(f,E,w))}),mergeValues:(f,w)=>f===!0?!0:{...f,...w},resultToName:v}),items:y({mergeNames:(f,w,E)=>f.if((0,t._)`${E} !== true && ${w} !== undefined`,()=>f.assign(E,(0,t._)`${w} === true ? true : ${E} > ${w} ? ${E} : ${w}`)),mergeToName:(f,w,E)=>f.if((0,t._)`${E} !== true`,()=>f.assign(E,w===!0?!0:(0,t._)`${E} > ${w} ? ${E} : ${w}`)),mergeValues:(f,w)=>f===!0?!0:Math.max(f,w),resultToName:(f,w)=>f.var("items",w)})};function v(f,w){if(w===!0)return f.var("props",!0);const E=f.var("props",(0,t._)`{}`);return w!==void 0&&b(f,E,w),E}B.evaluatedPropsToName=v;function b(f,w,E){Object.keys(E).forEach(C=>f.assign((0,t._)`${w}${(0,t.getProperty)(C)}`,!0))}B.setEvaluated=b;const l={};function p(f,w){return f.scopeValue("func",{ref:w,code:l[w.code]||(l[w.code]=new e._Code(w.code))})}B.useFunc=p;var i;(function(f){f[f.Num=0]="Num",f[f.Str=1]="Str"})(i||(B.Type=i={}));function d(f,w,E){if(f instanceof t.Name){const C=w===i.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)}B.getErrorPath=d;function $(f,w,E=f.opts.strictSchema){if(E){if(w=`strict mode: ${w}`,E===!0)throw new Error(w);f.self.logger.warn(w)}}return B.checkStrictMode=$,B}var kt={},ms;function Ke(){if(ms)return kt;ms=1,Object.defineProperty(kt,"__esModule",{value:!0});const t=Q(),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 kt.default=e,kt}var ys;function vr(){return ys||(ys=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=Q(),r=re(),s=Ke();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,i,d){const{it:$}=l,{gen:f,compositeRule:w,allErrors:E}=$,C=S(l,p,i);d??(w||E)?u(f,C):m($,(0,e._)`[${C}]`)}t.reportError=a;function n(l,p=t.keywordError,i){const{it:d}=l,{gen:$,compositeRule:f,allErrors:w}=d,E=S(l,p,i);u($,E),f||w||m(d,s.default.vErrors)}t.reportExtraError=n;function c(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=c;function o({gen:l,keyword:p,schemaValue:i,data:d,errsCount:$,it:f}){if($===void 0)throw new Error("ajv implementation error");const w=l.name("err");l.forRange("i",$,s.default.errors,E=>{l.const(w,(0,e._)`${s.default.vErrors}[${E}]`),l.if((0,e._)`${w}.instancePath === undefined`,()=>l.assign((0,e._)`${w}.instancePath`,(0,e.strConcat)(s.default.instancePath,f.errorPath))),l.assign((0,e._)`${w}.schemaPath`,(0,e.str)`${f.errSchemaPath}/${p}`),f.opts.verbose&&(l.assign((0,e._)`${w}.schema`,i),l.assign((0,e._)`${w}.data`,d))})}t.extendErrors=o;function u(l,p){const i=l.const("err",p);l.if((0,e._)`${s.default.vErrors} === null`,()=>l.assign(s.default.vErrors,(0,e._)`[${i}]`),(0,e._)`${s.default.vErrors}.push(${i})`),l.code((0,e._)`${s.default.errors}++`)}function m(l,p){const{gen:i,validateName:d,schemaEnv:$}=l;$.$async?i.throw((0,e._)`new ${l.ValidationError}(${p})`):(i.assign((0,e._)`${d}.errors`,p),i.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 S(l,p,i){const{createErrors:d}=l.it;return d===!1?(0,e._)`{}`:_(l,p,i)}function _(l,p,i={}){const{gen:d,it:$}=l,f=[y($,i),v(l,i)];return b(l,p,f),d.object(...f)}function y({errorPath:l},{instancePath:p}){const i=p?(0,e.str)`${l}${(0,r.getErrorPath)(p,r.Type.Str)}`:l;return[s.default.instancePath,(0,e.strConcat)(s.default.instancePath,i)]}function v({keyword:l,it:{errSchemaPath:p}},{schemaPath:i,parentSchema:d}){let $=d?p:(0,e.str)`${p}/${l}`;return i&&($=(0,e.str)`${$}${(0,r.getErrorPath)(i,r.Type.Str)}`),[h.schemaPath,$]}function b(l,{params:p,message:i},d){const{keyword:$,data:f,schemaValue:w,it:E}=l,{opts:C,propertyName:D,topSchemaRef:z,schemaPath:q}=E;d.push([h.keyword,$],[h.params,typeof p=="function"?p(l):p||(0,e._)`{}`]),C.messages&&d.push([h.message,typeof i=="function"?i(l):i]),C.verbose&&d.push([h.schema,w],[h.parentSchema,(0,e._)`${z}${q}`],[s.default.data,f]),D&&d.push([h.propertyName,D])}})(Rr)),Rr}var _s;function Ja(){if(_s)return Ge;_s=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.boolOrEmptySchema=Ge.topBoolOrEmptySchema=void 0;const t=vr(),e=Q(),r=Ke(),s={message:"boolean schema is false"};function a(o){const{gen:u,schema:m,validateName:h}=o;m===!1?c(o,!1):typeof m=="object"&&m.$async===!0?u.return(r.default.data):(u.assign((0,e._)`${h}.errors`,null),u.return(!0))}Ge.topBoolOrEmptySchema=a;function n(o,u){const{gen:m,schema:h}=o;h===!1?(m.var(u,!1),c(o)):m.var(u,!0)}Ge.boolOrEmptySchema=n;function c(o,u){const{gen:m,data:h}=o,S={gen:m,keyword:"false schema",data:h,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(S,s,void 0,u)}return Ge}var he={},Je={},gs;function Ln(){if(gs)return Je;gs=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.getRules=Je.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)}Je.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 Je.getRules=s,Je}var De={},vs;function Un(){if(vs)return De;vs=1,Object.defineProperty(De,"__esModule",{value:!0}),De.shouldUseRule=De.shouldUseGroup=De.schemaHasRulesForType=void 0;function t({schema:s,self:a},n){const c=a.RULES.types[n];return c&&c!==!0&&e(s,c)}De.schemaHasRulesForType=t;function e(s,a){return a.rules.some(n=>r(s,n))}De.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(c=>s[c]!==void 0))}return De.shouldUseRule=r,De}var ws;function mr(){if(ws)return he;ws=1,Object.defineProperty(he,"__esModule",{value:!0}),he.reportTypeError=he.checkDataTypes=he.checkDataType=he.coerceAndCheckDataType=he.getJSONTypes=he.getSchemaTypes=he.DataType=void 0;const t=Ln(),e=Un(),r=vr(),s=Q(),a=re();var n;(function(i){i[i.Correct=0]="Correct",i[i.Wrong=1]="Wrong"})(n||(he.DataType=n={}));function c(i){const d=o(i.type);if(d.includes("null")){if(i.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!d.length&&i.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');i.nullable===!0&&d.push("null")}return d}he.getSchemaTypes=c;function o(i){const d=Array.isArray(i)?i:i?[i]:[];if(d.every(t.isJSONType))return d;throw new Error("type must be JSONType or JSONType[]: "+d.join(","))}he.getJSONTypes=o;function u(i,d){const{gen:$,data:f,opts:w}=i,E=h(d,w.coerceTypes),C=d.length>0&&!(E.length===0&&d.length===1&&(0,e.schemaHasRulesForType)(i,d[0]));if(C){const D=v(d,f,w.strictNumbers,n.Wrong);$.if(D,()=>{E.length?S(i,d,E):l(i)})}return C}he.coerceAndCheckDataType=u;const m=new Set(["string","number","integer","boolean","null"]);function h(i,d){return d?i.filter($=>m.has($)||d==="array"&&$==="array"):[]}function S(i,d,$){const{gen:f,data:w,opts:E}=i,C=f.let("dataType",(0,s._)`typeof ${w}`),D=f.let("coerced",(0,s._)`undefined`);E.coerceTypes==="array"&&f.if((0,s._)`${C} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>f.assign(w,(0,s._)`${w}[0]`).assign(C,(0,s._)`typeof ${w}`).if(v(d,w,E.strictNumbers),()=>f.assign(D,w))),f.if((0,s._)`${D} !== undefined`);for(const q of $)(m.has(q)||q==="array"&&E.coerceTypes==="array")&&z(q);f.else(),l(i),f.endIf(),f.if((0,s._)`${D} !== undefined`,()=>{f.assign(w,D),_(i,D)});function z(q){switch(q){case"string":f.elseIf((0,s._)`${C} == "number" || ${C} == "boolean"`).assign(D,(0,s._)`"" + ${w}`).elseIf((0,s._)`${w} === null`).assign(D,(0,s._)`""`);return;case"number":f.elseIf((0,s._)`${C} == "boolean" || ${w} === null
|
|
7
|
-
|| (${C} == "string" && ${w} && ${w} == +${w})`).assign(D,(0,s._)`+${w}`);return;case"integer":f.elseIf((0,s._)`${C} === "boolean" || ${w} === null
|
|
8
|
-
|| (${C} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(D,(0,s._)`+${w}`);return;case"boolean":f.elseIf((0,s._)`${w} === "false" || ${w} === 0 || ${w} === null`).assign(D,!1).elseIf((0,s._)`${w} === "true" || ${w} === 1`).assign(D,!0);return;case"null":f.elseIf((0,s._)`${w} === "" || ${w} === 0 || ${w} === false`),f.assign(D,null);return;case"array":f.elseIf((0,s._)`${C} === "string" || ${C} === "number"
|
|
9
|
-
|| ${C} === "boolean" || ${w} === null`).assign(D,(0,s._)`[${w}]`)}}}function _({gen:i,parentData:d,parentDataProperty:$},f){i.if((0,s._)`${d} !== undefined`,()=>i.assign((0,s._)`${d}[${$}]`,f))}function y(i,d,$,f=n.Correct){const w=f===n.Correct?s.operators.EQ:s.operators.NEQ;let E;switch(i){case"null":return(0,s._)`${d} ${w} 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} ${w} ${i}`}return f===n.Correct?E:(0,s.not)(E);function C(D=s.nil){return(0,s.and)((0,s._)`typeof ${d} == "number"`,D,$?(0,s._)`isFinite(${d})`:s.nil)}}he.checkDataType=y;function v(i,d,$,f){if(i.length===1)return y(i[0],d,$,f);let w;const E=(0,a.toHash)(i);if(E.array&&E.object){const C=(0,s._)`typeof ${d} != "object"`;w=E.null?C:(0,s._)`!${d} || ${C}`,delete E.null,delete E.array,delete E.object}else w=s.nil;E.number&&delete E.integer;for(const C in E)w=(0,s.and)(w,y(C,d,$,f));return w}he.checkDataTypes=v;const b={message:({schema:i})=>`must be ${i}`,params:({schema:i,schemaValue:d})=>typeof i=="string"?(0,s._)`{type: ${i}}`:(0,s._)`{type: ${d}}`};function l(i){const d=p(i);(0,r.reportError)(d,b)}he.reportTypeError=l;function p(i){const{gen:d,data:$,schema:f}=i,w=(0,a.schemaRefOrVal)(i,f,"type");return{gen:d,keyword:"type",data:$,schema:f.type,schemaCode:w,schemaValue:w,parentSchema:f,params:{},it:i}}return he}var ft={},bs;function Ba(){if(bs)return ft;bs=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.assignDefaults=void 0;const t=Q(),e=re();function r(a,n){const{properties:c,items:o}=a.schema;if(n==="object"&&c)for(const u in c)s(a,u,c[u].default);else n==="array"&&Array.isArray(o)&&o.forEach((u,m)=>s(a,m,u.default))}ft.assignDefaults=r;function s(a,n,c){const{gen:o,compositeRule:u,data:m,opts:h}=a;if(c===void 0)return;const S=(0,t._)`${m}${(0,t.getProperty)(n)}`;if(u){(0,e.checkStrictMode)(a,`default is ignored for: ${S}`);return}let _=(0,t._)`${S} === undefined`;h.useDefaults==="empty"&&(_=(0,t._)`${_} || ${S} === null || ${S} === ""`),o.if(_,(0,t._)`${S} = ${(0,t.stringify)(c)}`)}return ft}var Ne={},ae={},$s;function Ae(){if($s)return ae;$s=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=Q(),e=re(),r=Ke(),s=re();function a(i,d){const{gen:$,data:f,it:w}=i;$.if(h($,f,d,w.opts.ownProperties),()=>{i.setParams({missingProperty:(0,t._)`${d}`},!0),i.error()})}ae.checkReportMissingProp=a;function n({gen:i,data:d,it:{opts:$}},f,w){return(0,t.or)(...f.map(E=>(0,t.and)(h(i,d,E,$.ownProperties),(0,t._)`${w} = ${E}`)))}ae.checkMissingProp=n;function c(i,d){i.setParams({missingProperty:d},!0),i.error()}ae.reportMissingProp=c;function o(i){return i.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=o;function u(i,d,$){return(0,t._)`${o(i)}.call(${d}, ${$})`}ae.isOwnProperty=u;function m(i,d,$,f){const w=(0,t._)`${d}${(0,t.getProperty)($)} !== undefined`;return f?(0,t._)`${w} && ${u(i,d,$)}`:w}ae.propertyInData=m;function h(i,d,$,f){const w=(0,t._)`${d}${(0,t.getProperty)($)} === undefined`;return f?(0,t.or)(w,(0,t.not)(u(i,d,$))):w}ae.noPropertyInData=h;function S(i){return i?Object.keys(i).filter(d=>d!=="__proto__"):[]}ae.allSchemaProperties=S;function _(i,d){return S(d).filter($=>!(0,e.alwaysValidSchema)(i,d[$]))}ae.schemaProperties=_;function y({schemaCode:i,data:d,it:{gen:$,topSchemaRef:f,schemaPath:w,errorPath:E},it:C},D,z,q){const F=q?(0,t._)`${i}, ${d}, ${f}${w}`:d,V=[[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&&V.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const H=(0,t._)`${F}, ${$.object(...V)}`;return z!==t.nil?(0,t._)`${D}.call(${z}, ${H})`:(0,t._)`${D}(${H})`}ae.callValidateCode=y;const v=(0,t._)`new RegExp`;function b({gen:i,it:{opts:d}},$){const f=d.unicodeRegExp?"u":"",{regExp:w}=d.code,E=w($,f);return i.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${w.code==="new RegExp"?v:(0,s.useFunc)(i,w)}(${$}, ${f})`})}ae.usePattern=b;function l(i){const{gen:d,data:$,keyword:f,it:w}=i,E=d.name("valid");if(w.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 z=d.const("len",(0,t._)`${$}.length`);d.forRange("i",0,z,q=>{i.subschema({keyword:f,dataProp:q,dataPropType:e.Type.Num},E),d.if((0,t.not)(E),D)})}}ae.validateArray=l;function p(i){const{gen:d,schema:$,keyword:f,it:w}=i;if(!Array.isArray($))throw new Error("ajv implementation error");if($.some(z=>(0,e.alwaysValidSchema)(w,z))&&!w.opts.unevaluated)return;const C=d.let("valid",!1),D=d.name("_valid");d.block(()=>$.forEach((z,q)=>{const F=i.subschema({keyword:f,schemaProp:q,compositeRule:!0},D);d.assign(C,(0,t._)`${C} || ${D}`),i.mergeValidEvaluated(F,D)||d.if((0,t.not)(C))})),i.result(C,()=>i.reset(),()=>i.error(!0))}return ae.validateUnion=p,ae}var Ss;function Za(){if(Ss)return Ne;Ss=1,Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.validateKeywordUsage=Ne.validSchemaType=Ne.funcKeywordCode=Ne.macroKeywordCode=void 0;const t=Q(),e=Ke(),r=Ae(),s=vr();function a(_,y){const{gen:v,keyword:b,schema:l,parentSchema:p,it:i}=_,d=y.macro.call(i.self,l,p,i),$=m(v,b,d);i.opts.validateSchema!==!1&&i.self.validateSchema(d,!0);const f=v.name("valid");_.subschema({schema:d,schemaPath:t.nil,errSchemaPath:`${i.errSchemaPath}/${b}`,topSchemaRef:$,compositeRule:!0},f),_.pass(f,()=>_.error(!0))}Ne.macroKeywordCode=a;function n(_,y){var v;const{gen:b,keyword:l,schema:p,parentSchema:i,$data:d,it:$}=_;u($,y);const f=!d&&y.compile?y.compile.call($.self,p,i,$):y.validate,w=m(b,l,f),E=b.let("valid");_.block$data(E,C),_.ok((v=y.valid)!==null&&v!==void 0?v:E);function C(){if(y.errors===!1)q(),y.modifying&&c(_),F(()=>_.error());else{const V=y.async?D():z();y.modifying&&c(_),F(()=>o(_,V))}}function D(){const V=b.let("ruleErrs",null);return b.try(()=>q((0,t._)`await `),H=>b.assign(E,!1).if((0,t._)`${H} instanceof ${$.ValidationError}`,()=>b.assign(V,(0,t._)`${H}.errors`),()=>b.throw(H))),V}function z(){const V=(0,t._)`${w}.errors`;return b.assign(V,null),q(t.nil),V}function q(V=y.async?(0,t._)`await `:t.nil){const H=$.opts.passContext?e.default.this:e.default.self,ne=!("compile"in y&&!d||y.schema===!1);b.assign(E,(0,t._)`${V}${(0,r.callValidateCode)(_,w,H,ne)}`,y.modifying)}function F(V){var H;b.if((0,t.not)((H=y.valid)!==null&&H!==void 0?H:E),V)}}Ne.funcKeywordCode=n;function c(_){const{gen:y,data:v,it:b}=_;y.if(b.parentData,()=>y.assign(v,(0,t._)`${b.parentData}[${b.parentDataProperty}]`))}function o(_,y){const{gen:v}=_;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)(_)},()=>_.error())}function u({schemaEnv:_},y){if(y.async&&!_.$async)throw new Error("async keyword in sync schema")}function m(_,y,v){if(v===void 0)throw new Error(`keyword "${y}" failed to compile`);return _.scopeValue("keyword",typeof v=="function"?{ref:v}:{ref:v,code:(0,t.stringify)(v)})}function h(_,y,v=!1){return!y.length||y.some(b=>b==="array"?Array.isArray(_):b==="object"?_&&typeof _=="object"&&!Array.isArray(_):typeof _==b||v&&typeof _>"u")}Ne.validSchemaType=h;function S({schema:_,opts:y,self:v,errSchemaPath:b},l,p){if(Array.isArray(l.keyword)?!l.keyword.includes(p):l.keyword!==p)throw new Error("ajv implementation error");const i=l.dependencies;if(i?.some(d=>!Object.prototype.hasOwnProperty.call(_,d)))throw new Error(`parent schema must have dependencies of ${p}: ${i.join(",")}`);if(l.validateSchema&&!l.validateSchema(_[p])){const $=`keyword "${p}" value is invalid at path "${b}": `+v.errorsText(l.validateSchema.errors);if(y.validateSchema==="log")v.logger.error($);else throw new Error($)}}return Ne.validateKeywordUsage=S,Ne}var Le={},Es;function Qa(){if(Es)return Le;Es=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.extendSubschemaMode=Le.extendSubschemaData=Le.getSubschema=void 0;const t=Q(),e=re();function r(n,{keyword:c,schemaProp:o,schema:u,schemaPath:m,errSchemaPath:h,topSchemaRef:S}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){const _=n.schema[c];return o===void 0?{schema:_,schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${n.errSchemaPath}/${c}`}:{schema:_[o],schemaPath:(0,t._)`${n.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(o)}`,errSchemaPath:`${n.errSchemaPath}/${c}/${(0,e.escapeFragment)(o)}`}}if(u!==void 0){if(m===void 0||h===void 0||S===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:m,topSchemaRef:S,errSchemaPath:h}}throw new Error('either "keyword" or "schema" must be passed')}Le.getSubschema=r;function s(n,c,{dataProp:o,dataPropType:u,data:m,dataTypes:h,propertyName:S}){if(m!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:_}=c;if(o!==void 0){const{errorPath:v,dataPathArr:b,opts:l}=c,p=_.let("data",(0,t._)`${c.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=[...b,n.parentDataProperty]}if(m!==void 0){const v=m instanceof t.Name?m:_.let("data",m,!0);y(v),S!==void 0&&(n.propertyName=S)}h&&(n.dataTypes=h);function y(v){n.data=v,n.dataLevel=c.dataLevel+1,n.dataTypes=[],c.definedProperties=new Set,n.parentData=c.data,n.dataNames=[...c.dataNames,v]}}Le.extendSubschemaData=s;function a(n,{jtdDiscriminator:c,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=c,n.jtdMetadata=o}return Le.extendSubschemaMode=a,Le}var we={},qr,ks;function Fn(){return ks||(ks=1,qr=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 c=n[a];if(!t(e[c],r[c]))return!1}return!0}return e!==e&&r!==r}),qr}var Mr={exports:{}},Ts;function Xa(){if(Ts)return Mr.exports;Ts=1;var t=Mr.exports=function(s,a,n){typeof a=="function"&&(n=a,a={}),n=a.cb||n;var c=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};e(a,c,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,c,o,u,m,h,S,_){if(c&&typeof c=="object"&&!Array.isArray(c)){a(c,o,u,m,h,S,_);for(var y in c){var v=c[y];if(Array.isArray(v)){if(y in t.arrayKeywords)for(var b=0;b<v.length;b++)e(s,a,n,v[b],o+"/"+y+"/"+b,u,o,y,c,b)}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,c,l)}else(y in t.keywords||s.allKeys&&!(y in t.skipKeywords))&&e(s,a,n,v,o+"/"+y,u,o,y,c)}n(c,o,u,m,h,S,_)}}function r(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}return Mr.exports}var Ps;function wr(){if(Ps)return we;Ps=1,Object.defineProperty(we,"__esModule",{value:!0}),we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;const t=re(),e=Fn(),r=Xa(),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function a(b,l=!0){return typeof b=="boolean"?!0:l===!0?!c(b):l?o(b)<=l:!1}we.inlineRef=a;const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(b){for(const l in b){if(n.has(l))return!0;const p=b[l];if(Array.isArray(p)&&p.some(c)||typeof p=="object"&&c(p))return!0}return!1}function o(b){let l=0;for(const p in b){if(p==="$ref")return 1/0;if(l++,!s.has(p)&&(typeof b[p]=="object"&&(0,t.eachItem)(b[p],i=>l+=o(i)),l===1/0))return 1/0}return l}function u(b,l="",p){p!==!1&&(l=S(l));const i=b.parse(l);return m(b,i)}we.getFullPath=u;function m(b,l){return b.serialize(l).split("#")[0]+"#"}we._getFullPath=m;const h=/#\/?$/;function S(b){return b?b.replace(h,""):""}we.normalizeId=S;function _(b,l,p){return p=S(p),b.resolve(l,p)}we.resolveUrl=_;const y=/^[a-z_][-a-z0-9._]*$/i;function v(b,l){if(typeof b=="boolean")return{};const{schemaId:p,uriResolver:i}=this.opts,d=S(b[p]||l),$={"":d},f=u(i,d,!1),w={},E=new Set;return r(b,{allKeys:!0},(z,q,F,V)=>{if(V===void 0)return;const H=f+q;let ne=$[V];typeof z[p]=="string"&&(ne=_e.call(this,z[p])),ge.call(this,z.$anchor),ge.call(this,z.$dynamicAnchor),$[q]=ne;function _e(oe){const Ie=this.opts.uriResolver.resolve;if(oe=S(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(z,L.schema,oe):oe!==S(H)&&(oe[0]==="#"?(C(z,w[oe],oe),w[oe]=z):this.refs[oe]=H),oe}function ge(oe){if(typeof oe=="string"){if(!y.test(oe))throw new Error(`invalid anchor "${oe}"`);_e.call(this,`#${oe}`)}}}),w;function C(z,q,F){if(q!==void 0&&!e(z,q))throw D(F)}function D(z){return new Error(`reference "${z}" resolves to more than one schema`)}}return we.getSchemaRefs=v,we}var Is;function br(){if(Is)return je;Is=1,Object.defineProperty(je,"__esModule",{value:!0}),je.getData=je.KeywordCxt=je.validateFunctionCode=void 0;const t=Ja(),e=mr(),r=Un(),s=mr(),a=Ba(),n=Za(),c=Qa(),o=Q(),u=Ke(),m=wr(),h=re(),S=vr();function _(T){if(f(T)&&(E(T),$(T))){l(T);return}y(T,()=>(0,t.topBoolOrEmptySchema)(T))}je.validateFunctionCode=_;function y({gen:T,validateName:I,schema:M,schemaEnv:U,opts:K},X){K.code.es5?T.func(I,(0,o._)`${u.default.data}, ${u.default.valCxt}`,U.$async,()=>{T.code((0,o._)`"use strict"; ${i(M,K)}`),b(T,K),T.code(X)}):T.func(I,(0,o._)`${u.default.data}, ${v(K)}`,U.$async,()=>T.code(i(M,K)).code(X))}function v(T){return(0,o._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${T.dynamicRef?(0,o._)`, ${u.default.dynamicAnchors}={}`:o.nil}}={}`}function b(T,I){T.if(u.default.valCxt,()=>{T.var(u.default.instancePath,(0,o._)`${u.default.valCxt}.${u.default.instancePath}`),T.var(u.default.parentData,(0,o._)`${u.default.valCxt}.${u.default.parentData}`),T.var(u.default.parentDataProperty,(0,o._)`${u.default.valCxt}.${u.default.parentDataProperty}`),T.var(u.default.rootData,(0,o._)`${u.default.valCxt}.${u.default.rootData}`),I.dynamicRef&&T.var(u.default.dynamicAnchors,(0,o._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{T.var(u.default.instancePath,(0,o._)`""`),T.var(u.default.parentData,(0,o._)`undefined`),T.var(u.default.parentDataProperty,(0,o._)`undefined`),T.var(u.default.rootData,u.default.data),I.dynamicRef&&T.var(u.default.dynamicAnchors,(0,o._)`{}`)})}function l(T){const{schema:I,opts:M,gen:U}=T;y(T,()=>{M.$comment&&I.$comment&&V(T),z(T),U.let(u.default.vErrors,null),U.let(u.default.errors,0),M.unevaluated&&p(T),C(T),H(T)})}function p(T){const{gen:I,validateName:M}=T;T.evaluated=I.const("evaluated",(0,o._)`${M}.evaluated`),I.if((0,o._)`${T.evaluated}.dynamicProps`,()=>I.assign((0,o._)`${T.evaluated}.props`,(0,o._)`undefined`)),I.if((0,o._)`${T.evaluated}.dynamicItems`,()=>I.assign((0,o._)`${T.evaluated}.items`,(0,o._)`undefined`))}function i(T,I){const M=typeof T=="object"&&T[I.schemaId];return M&&(I.code.source||I.code.process)?(0,o._)`/*# sourceURL=${M} */`:o.nil}function d(T,I){if(f(T)&&(E(T),$(T))){w(T,I);return}(0,t.boolOrEmptySchema)(T,I)}function $({schema:T,self:I}){if(typeof T=="boolean")return!T;for(const M in T)if(I.RULES.all[M])return!0;return!1}function f(T){return typeof T.schema!="boolean"}function w(T,I){const{schema:M,gen:U,opts:K}=T;K.$comment&&M.$comment&&V(T),q(T),F(T);const X=U.const("_errs",u.default.errors);C(T,X),U.var(I,(0,o._)`${X} === ${u.default.errors}`)}function E(T){(0,h.checkUnknownRules)(T),D(T)}function C(T,I){if(T.opts.jtd)return _e(T,[],!1,I);const M=(0,e.getSchemaTypes)(T.schema),U=(0,e.coerceAndCheckDataType)(T,M);_e(T,M,!U,I)}function D(T){const{schema:I,errSchemaPath:M,opts:U,self:K}=T;I.$ref&&U.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(I,K.RULES)&&K.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function z(T){const{schema:I,opts:M}=T;I.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,h.checkStrictMode)(T,"default is ignored in the schema root")}function q(T){const I=T.schema[T.opts.schemaId];I&&(T.baseId=(0,m.resolveUrl)(T.opts.uriResolver,T.baseId,I))}function F(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function V({gen:T,schemaEnv:I,schema:M,errSchemaPath:U,opts:K}){const X=M.$comment;if(K.$comment===!0)T.code((0,o._)`${u.default.self}.logger.log(${X})`);else if(typeof K.$comment=="function"){const de=(0,o.str)`${U}/$comment`,Re=T.scopeValue("root",{ref:I.root});T.code((0,o._)`${u.default.self}.opts.$comment(${X}, ${de}, ${Re}.schema)`)}}function H(T){const{gen:I,schemaEnv:M,validateName:U,ValidationError:K,opts:X}=T;M.$async?I.if((0,o._)`${u.default.errors} === 0`,()=>I.return(u.default.data),()=>I.throw((0,o._)`new ${K}(${u.default.vErrors})`)):(I.assign((0,o._)`${U}.errors`,u.default.vErrors),X.unevaluated&&ne(T),I.return((0,o._)`${u.default.errors} === 0`))}function ne({gen:T,evaluated:I,props:M,items:U}){M instanceof o.Name&&T.assign((0,o._)`${I}.props`,M),U instanceof o.Name&&T.assign((0,o._)`${I}.items`,U)}function _e(T,I,M,U){const{gen:K,schema:X,data:de,allErrors:Re,opts:be,self:$e}=T,{RULES:fe}=$e;if(X.$ref&&(be.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(X,fe))){K.block(()=>x(T,"$ref",fe.all.$ref.definition));return}be.jtd||oe(T,I),K.block(()=>{for(const Pe of fe.rules)tt(Pe);tt(fe.post)});function tt(Pe){(0,r.shouldUseGroup)(X,Pe)&&(Pe.type?(K.if((0,s.checkDataType)(Pe.type,de,be.strictNumbers)),ge(T,Pe),I.length===1&&I[0]===Pe.type&&M&&(K.else(),(0,s.reportTypeError)(T)),K.endIf()):ge(T,Pe),Re||K.if((0,o._)`${u.default.errors} === ${U||0}`))}}function ge(T,I){const{gen:M,schema:U,opts:{useDefaults:K}}=T;K&&(0,a.assignDefaults)(T,I.type),M.block(()=>{for(const X of I.rules)(0,r.shouldUseRule)(U,X)&&x(T,X.keyword,X.definition,I.type)})}function oe(T,I){T.schemaEnv.meta||!T.opts.strictTypes||(Ie(T,I),T.opts.allowUnionTypes||L(T,I),P(T,T.dataTypes))}function Ie(T,I){if(I.length){if(!T.dataTypes.length){T.dataTypes=I;return}I.forEach(M=>{R(T.dataTypes,M)||k(T,`type "${M}" not allowed by context "${T.dataTypes.join(",")}"`)}),g(T,I)}}function L(T,I){I.length>1&&!(I.length===2&&I.includes("null"))&&k(T,"use allowUnionTypes to allow union type keyword")}function P(T,I){const M=T.self.RULES.all;for(const U in M){const K=M[U];if(typeof K=="object"&&(0,r.shouldUseRule)(T.schema,K)){const{type:X}=K.definition;X.length&&!X.some(de=>A(I,de))&&k(T,`missing type "${X.join(",")}" for keyword "${U}"`)}}}function A(T,I){return T.includes(I)||I==="number"&&T.includes("integer")}function R(T,I){return T.includes(I)||I==="integer"&&T.includes("number")}function g(T,I){const M=[];for(const U of T.dataTypes)R(I,U)?M.push(U):I.includes("integer")&&U==="number"&&M.push("integer");T.dataTypes=M}function k(T,I){const M=T.schemaEnv.baseId+T.errSchemaPath;I+=` at "${M}" (strictTypes)`,(0,h.checkStrictMode)(T,I,T.opts.strictTypes)}class N{constructor(I,M,U){if((0,n.validateKeywordUsage)(I,M,U),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=U,this.data=I.data,this.schema=I.schema[U],this.$data=M.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(I,this.schema,U,this.$data),this.schemaType=M.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=M,this.$data)this.schemaCode=I.gen.const("vSchema",ee(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,n.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=I.gen.const("_errs",u.default.errors))}result(I,M,U){this.failResult((0,o.not)(I),M,U)}failResult(I,M,U){this.gen.if(I),U?U():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(I,M){this.failResult((0,o.not)(I),void 0,M)}fail(I){if(I===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(I),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);const{schemaCode:M}=this;this.fail((0,o._)`${M} !== undefined && (${(0,o.or)(this.invalid$data(),I)})`)}error(I,M,U){if(M){this.setParams(M),this._error(I,U),this.setParams({});return}this._error(I,U)}_error(I,M){(I?S.reportExtraError:S.reportError)(this,this.def.error,M)}$dataError(){(0,S.reportError)(this,this.def.$dataError||S.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,S.resetErrorsCount)(this.gen,this.errsCount)}ok(I){this.allErrors||this.gen.if(I)}setParams(I,M){M?Object.assign(this.params,I):this.params=I}block$data(I,M,U=o.nil){this.gen.block(()=>{this.check$data(I,U),M()})}check$data(I=o.nil,M=o.nil){if(!this.$data)return;const{gen:U,schemaCode:K,schemaType:X,def:de}=this;U.if((0,o.or)((0,o._)`${K} === undefined`,M)),I!==o.nil&&U.assign(I,!0),(X.length||de.validateSchema)&&(U.elseIf(this.invalid$data()),this.$dataError(),I!==o.nil&&U.assign(I,!1)),U.else()}invalid$data(){const{gen:I,schemaCode:M,schemaType:U,def:K,it:X}=this;return(0,o.or)(de(),Re());function de(){if(U.length){if(!(M instanceof o.Name))throw new Error("ajv implementation error");const be=Array.isArray(U)?U:[U];return(0,o._)`${(0,s.checkDataTypes)(be,M,X.opts.strictNumbers,s.DataType.Wrong)}`}return o.nil}function Re(){if(K.validateSchema){const be=I.scopeValue("validate$data",{ref:K.validateSchema});return(0,o._)`!${be}(${M})`}return o.nil}}subschema(I,M){const U=(0,c.getSubschema)(this.it,I);(0,c.extendSubschemaData)(U,this.it,I),(0,c.extendSubschemaMode)(U,I);const K={...this.it,...U,items:void 0,props:void 0};return d(K,M),K}mergeEvaluated(I,M){const{it:U,gen:K}=this;U.opts.unevaluated&&(U.props!==!0&&I.props!==void 0&&(U.props=h.mergeEvaluated.props(K,I.props,U.props,M)),U.items!==!0&&I.items!==void 0&&(U.items=h.mergeEvaluated.items(K,I.items,U.items,M)))}mergeValidEvaluated(I,M){const{it:U,gen:K}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return K.if(M,()=>this.mergeEvaluated(I,o.Name)),!0}}je.KeywordCxt=N;function x(T,I,M,U){const K=new N(T,M,I);"code"in M?M.code(K,U):K.$data&&M.validate?(0,n.funcKeywordCode)(K,M):"macro"in M?(0,n.macroKeywordCode)(K,M):(M.compile||M.validate)&&(0,n.funcKeywordCode)(K,M)}const W=/^\/(?:[^~]|~0|~1)*$/,se=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ee(T,{dataLevel:I,dataNames:M,dataPathArr:U}){let K,X;if(T==="")return u.default.rootData;if(T[0]==="/"){if(!W.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);K=T,X=u.default.rootData}else{const $e=se.exec(T);if(!$e)throw new Error(`Invalid JSON-pointer: ${T}`);const fe=+$e[1];if(K=$e[2],K==="#"){if(fe>=I)throw new Error(be("property/index",fe));return U[I-fe]}if(fe>I)throw new Error(be("data",fe));if(X=M[I-fe],!K)return X}let de=X;const Re=K.split("/");for(const $e of Re)$e&&(X=(0,o._)`${X}${(0,o.getProperty)((0,h.unescapeJsonPointer)($e))}`,de=(0,o._)`${de} && ${X}`);return de;function be($e,fe){return`Cannot access ${$e} ${fe} levels up, current level is ${I}`}}return je.getData=ee,je}var Tt={},Rs;function Yr(){if(Rs)return Tt;Rs=1,Object.defineProperty(Tt,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return Tt.default=t,Tt}var Pt={},Os;function $r(){if(Os)return Pt;Os=1,Object.defineProperty(Pt,"__esModule",{value:!0});const t=wr();class e extends Error{constructor(s,a,n,c){super(c||`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 Pt.default=e,Pt}var ke={},Cs;function es(){if(Cs)return ke;Cs=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.resolveSchema=ke.getCompilingSchema=ke.resolveRef=ke.compileSchema=ke.SchemaEnv=void 0;const t=Q(),e=Yr(),r=Ke(),s=wr(),a=re(),n=br();class c{constructor(p){var i;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=(i=p.baseId)!==null&&i!==void 0?i:(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={}}}ke.SchemaEnv=c;function o(l){const p=h.call(this,l);if(p)return p;const i=(0,s.getFullPath)(this.opts.uriResolver,l.root.baseId),{es5:d,lines:$}=this.opts.code,{ownProperties:f}=this.opts,w=new t.CodeGen(this.scope,{es5:d,lines:$,ownProperties:f});let E;l.$async&&(E=w.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const C=w.scopeName("validate");l.validateName=C;const D={gen:w,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:w.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:i,baseId:l.baseId||i,schemaPath:t.nil,errSchemaPath:l.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let z;try{this._compilations.add(l),(0,n.validateFunctionCode)(D),w.optimize(this.opts.code.optimize);const q=w.toString();z=`${w.scopeRefs(r.default.scope)}return ${q}`,this.opts.code.process&&(z=this.opts.code.process(z,l));const V=new Function(`${r.default.self}`,`${r.default.scope}`,z)(this,this.scope.get());if(this.scope.value(C,{ref:V}),V.errors=null,V.schema=l.schema,V.schemaEnv=l,l.$async&&(V.$async=!0),this.opts.code.source===!0&&(V.source={validateName:C,validateCode:q,scopeValues:w._values}),this.opts.unevaluated){const{props:H,items:ne}=D;V.evaluated={props:H instanceof t.Name?void 0:H,items:ne instanceof t.Name?void 0:ne,dynamicProps:H instanceof t.Name,dynamicItems:ne instanceof t.Name},V.source&&(V.source.evaluated=(0,t.stringify)(V.evaluated))}return l.validate=V,l}catch(q){throw delete l.validate,delete l.validateName,z&&this.logger.error("Error compiling schema, function code:",z),q}finally{this._compilations.delete(l)}}ke.compileSchema=o;function u(l,p,i){var d;i=(0,s.resolveUrl)(this.opts.uriResolver,p,i);const $=l.refs[i];if($)return $;let f=_.call(this,l,i);if(f===void 0){const w=(d=l.localRefs)===null||d===void 0?void 0:d[i],{schemaId:E}=this.opts;w&&(f=new c({schema:w,schemaId:E,root:l,baseId:p}))}if(f!==void 0)return l.refs[i]=m.call(this,f)}ke.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(S(p,l))return p}ke.getCompilingSchema=h;function S(l,p){return l.schema===p.schema&&l.root===p.root&&l.baseId===p.baseId}function _(l,p){let i;for(;typeof(i=this.refs[p])=="string";)p=i;return i||this.schemas[p]||y.call(this,l,p)}function y(l,p){const i=this.opts.uriResolver.parse(p),d=(0,s._getFullPath)(this.opts.uriResolver,i);let $=(0,s.getFullPath)(this.opts.uriResolver,l.baseId,void 0);if(Object.keys(l.schema).length>0&&d===$)return b.call(this,i,l);const f=(0,s.normalizeId)(d),w=this.refs[f]||this.schemas[f];if(typeof w=="string"){const E=y.call(this,l,w);return typeof E?.schema!="object"?void 0:b.call(this,i,E)}if(typeof w?.schema=="object"){if(w.validate||o.call(this,w),f===(0,s.normalizeId)(p)){const{schema:E}=w,{schemaId:C}=this.opts,D=E[C];return D&&($=(0,s.resolveUrl)(this.opts.uriResolver,$,D)),new c({schema:E,schemaId:C,root:l,baseId:$})}return b.call(this,i,w)}}ke.resolveSchema=y;const v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function b(l,{baseId:p,schema:i,root:d}){var $;if((($=l.fragment)===null||$===void 0?void 0:$[0])!=="/")return;for(const E of l.fragment.slice(1).split("/")){if(typeof i=="boolean")return;const C=i[(0,a.unescapeFragment)(E)];if(C===void 0)return;i=C;const D=typeof i=="object"&&i[this.opts.schemaId];!v.has(E)&&D&&(p=(0,s.resolveUrl)(this.opts.uriResolver,p,D))}let f;if(typeof i!="boolean"&&i.$ref&&!(0,a.schemaHasRulesButRef)(i,this.RULES)){const E=(0,s.resolveUrl)(this.opts.uriResolver,p,i.$ref);f=y.call(this,d,E)}const{schemaId:w}=this.opts;if(f=f||new c({schema:i,schemaId:w,root:d,baseId:p}),f.schema!==f.root.schema)return f}return ke}const Ya="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",eo="Meta-schema for $data reference (JSON AnySchema extension proposal)",to="object",ro=["$data"],so={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},no=!1,ao={$id:Ya,description:eo,type:to,required:ro,properties:so,additionalProperties:no};var It={},ht={exports:{}},Ar,Ns;function zn(){if(Ns)return Ar;Ns=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(_){let y="",v=0,b=0;for(b=0;b<_.length;b++)if(v=_[b].charCodeAt(0),v!==48){if(!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=_[b];break}for(b+=1;b<_.length;b++){if(v=_[b].charCodeAt(0),!(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102))return"";y+=_[b]}return y}const s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(_){return _.length=0,!0}function n(_,y,v){if(_.length){const b=r(_);if(b!=="")y.push(b);else return v.error=!0,!1;_.length=0}return!0}function c(_){let y=0;const v={error:!1,address:"",zone:""},b=[],l=[];let p=!1,i=!1,d=n;for(let $=0;$<_.length;$++){const f=_[$];if(!(f==="["||f==="]"))if(f===":"){if(p===!0&&(i=!0),!d(l,b,v))break;if(++y>7){v.error=!0;break}$>0&&_[$-1]===":"&&(p=!0),b.push(":");continue}else if(f==="%"){if(!d(l,b,v))break;d=a}else{l.push(f);continue}}return l.length&&(d===a?v.zone=l.join(""):i?b.push(l.join("")):b.push(r(l))),v.address=b.join(""),v}function o(_){if(u(_,":")<2)return{host:_,isIPV6:!1};const y=c(_);if(y.error)return{host:_,isIPV6:!1};{let v=y.address,b=y.address;return y.zone&&(v+="%"+y.zone,b+="%25"+y.zone),{host:v,isIPV6:!0,escapedHost:b}}}function u(_,y){let v=0;for(let b=0;b<_.length;b++)_[b]===y&&v++;return v}function m(_){let y=_;const v=[];let b=-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((b=y.indexOf("/",1))===-1){v.push(y);break}else v.push(y.slice(0,b)),y=y.slice(b)}return v.join("")}function h(_,y){const v=y!==!0?escape:unescape;return _.scheme!==void 0&&(_.scheme=v(_.scheme)),_.userinfo!==void 0&&(_.userinfo=v(_.userinfo)),_.host!==void 0&&(_.host=v(_.host)),_.path!==void 0&&(_.path=v(_.path)),_.query!==void 0&&(_.query=v(_.query)),_.fragment!==void 0&&(_.fragment=v(_.fragment)),_}function S(_){const y=[];if(_.userinfo!==void 0&&(y.push(_.userinfo),y.push("@")),_.host!==void 0){let v=unescape(_.host);if(!e(v)){const b=o(v);b.isIPV6===!0?v=`[${b.escapedHost}]`:v=_.host}y.push(v)}return(typeof _.port=="number"||typeof _.port=="string")&&(y.push(":"),y.push(String(_.port))),y.length?y.join(""):void 0}return Ar={nonSimpleDomain:s,recomposeAuthority:S,normalizeComponentEncoding:h,removeDotSegments:m,isIPv4:e,isUUID:t,normalizeIPv6:o,stringArrayToHexStripped:r},Ar}var jr,qs;function oo(){if(qs)return jr;qs=1;const{isUUID:t}=zn(),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 c(f){const w=String(f.scheme).toLowerCase()==="https";return(f.port===(w?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[w,E]=f.resourceName.split("?");f.path=w&&w!=="/"?w:void 0,f.query=E,f.resourceName=void 0}return f.fragment=void 0,f}function m(f,w){if(!f.path)return f.error="URN can not be parsed",f;const E=f.path.match(e);if(E){const C=w.scheme||f.scheme||"urn";f.nid=E[1].toLowerCase(),f.nss=E[2];const D=`${C}:${w.nid||f.nid}`,z=$(D);f.path=void 0,z&&(f=z.parse(f,w))}else f.error=f.error||"URN can not be parsed.";return f}function h(f,w){if(f.nid===void 0)throw new Error("URN without nid cannot be serialized");const E=w.scheme||f.scheme||"urn",C=f.nid.toLowerCase(),D=`${E}:${w.nid||C}`,z=$(D);z&&(f=z.serialize(f,w));const q=f,F=f.nss;return q.path=`${C||w.nid}:${F}`,w.skipEscape=!0,q}function S(f,w){const E=f;return E.uuid=E.nss,E.nss=void 0,!w.tolerant&&(!E.uuid||!t(E.uuid))&&(E.error=E.error||"UUID is not valid."),E}function _(f){const w=f;return w.nss=(f.uuid||"").toLowerCase(),w}const y={scheme:"http",domainHost:!0,parse:n,serialize:c},v={scheme:"https",domainHost:y.domainHost,parse:n,serialize:c},b={scheme:"ws",domainHost:!0,parse:o,serialize:u},l={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},d={http:y,https:v,ws:b,wss:l,urn:{scheme:"urn",parse:m,serialize:h,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:S,serialize:_,skipNormalize:!0}};Object.setPrototypeOf(d,null);function $(f){return f&&(d[f]||d[f.toLowerCase()])||void 0}return jr={wsIsSecure:a,SCHEMES:d,isValidSchemeName:s,getSchemeHandler:$},jr}var Ms;function io(){if(Ms)return ht.exports;Ms=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:r,normalizeComponentEncoding:s,isIPv4:a,nonSimpleDomain:n}=zn(),{SCHEMES:c,getSchemeHandler:o}=oo();function u(l,p){return typeof l=="string"?l=_(v(l,p),p):typeof l=="object"&&(l=v(_(l,p),p)),l}function m(l,p,i){const d=i?Object.assign({scheme:"null"},i):{scheme:"null"},$=h(v(l,d),v(p,d),d,!0);return d.skipEscape=!0,_($,d)}function h(l,p,i,d){const $={};return d||(l=v(_(l,i),i),p=v(_(p,i),i)),i=i||{},!i.tolerant&&p.scheme?($.scheme=p.scheme,$.userinfo=p.userinfo,$.host=p.host,$.port=p.port,$.path=e(p.path||""),$.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?($.userinfo=p.userinfo,$.host=p.host,$.port=p.port,$.path=e(p.path||""),$.query=p.query):(p.path?(p.path[0]==="/"?$.path=e(p.path):((l.userinfo!==void 0||l.host!==void 0||l.port!==void 0)&&!l.path?$.path="/"+p.path:l.path?$.path=l.path.slice(0,l.path.lastIndexOf("/")+1)+p.path:$.path=p.path,$.path=e($.path)),$.query=p.query):($.path=l.path,p.query!==void 0?$.query=p.query:$.query=l.query),$.userinfo=l.userinfo,$.host=l.host,$.port=l.port),$.scheme=l.scheme),$.fragment=p.fragment,$}function S(l,p,i){return typeof l=="string"?(l=unescape(l),l=_(s(v(l,i),!0),{...i,skipEscape:!0})):typeof l=="object"&&(l=_(s(l,!0),{...i,skipEscape:!0})),typeof p=="string"?(p=unescape(p),p=_(s(v(p,i),!0),{...i,skipEscape:!0})):typeof p=="object"&&(p=_(s(p,!0),{...i,skipEscape:!0})),l.toLowerCase()===p.toLowerCase()}function _(l,p){const i={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),$=[],f=o(d.scheme||i.scheme);f&&f.serialize&&f.serialize(i,d),i.path!==void 0&&(d.skipEscape?i.path=unescape(i.path):(i.path=escape(i.path),i.scheme!==void 0&&(i.path=i.path.split("%3A").join(":")))),d.reference!=="suffix"&&i.scheme&&$.push(i.scheme,":");const w=r(i);if(w!==void 0&&(d.reference!=="suffix"&&$.push("//"),$.push(w),i.path&&i.path[0]!=="/"&&$.push("/")),i.path!==void 0){let E=i.path;!d.absolutePath&&(!f||!f.absolutePath)&&(E=e(E)),w===void 0&&E[0]==="/"&&E[1]==="/"&&(E="/%2F"+E.slice(2)),$.push(E)}return i.query!==void 0&&$.push("?",i.query),i.fragment!==void 0&&$.push("#",i.fragment),$.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v(l,p){const i=Object.assign({},p),d={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let $=!1;i.reference==="suffix"&&(i.scheme?l=i.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(),$=C.isIPV6}else $=!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",i.reference&&i.reference!=="suffix"&&i.reference!==d.reference&&(d.error=d.error||"URI is not a "+i.reference+" reference.");const w=o(i.scheme||d.scheme);if(!i.unicodeSupport&&(!w||!w.unicodeSupport)&&d.host&&(i.domainHost||w&&w.domainHost)&&$===!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}(!w||w&&!w.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)))),w&&w.parse&&w.parse(d,i)}else d.error=d.error||"URI can not be parsed.";return d}const b={SCHEMES:c,normalize:u,resolve:m,resolveComponent:h,equal:S,serialize:_,parse:v};return ht.exports=b,ht.exports.default=b,ht.exports.fastUri=b,ht.exports}var As;function co(){if(As)return It;As=1,Object.defineProperty(It,"__esModule",{value:!0});const t=io();return t.code='require("ajv/dist/runtime/uri").default',It.default=t,It}var js;function uo(){return js||(js=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=br();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Q();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=Yr(),a=$r(),n=Ln(),c=es(),o=Q(),u=wr(),m=mr(),h=re(),S=ao,_=co(),y=(L,P)=>new RegExp(L,P);y.code="new RegExp";const v=["removeAdditional","useDefaults","coerceTypes"],b=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.'},i=200;function d(L){var P,A,R,g,k,N,x,W,se,ee,T,I,M,U,K,X,de,Re,be,$e,fe,tt,Pe,Sr,Er;const dt=L.strict,kr=(P=L.code)===null||P===void 0?void 0:P.optimize,ss=kr===!0||kr===void 0?1:kr||0,ns=(R=(A=L.code)===null||A===void 0?void 0:A.regExp)!==null&&R!==void 0?R:y,na=(g=L.uriResolver)!==null&&g!==void 0?g:_.default;return{strictSchema:(N=(k=L.strictSchema)!==null&&k!==void 0?k:dt)!==null&&N!==void 0?N:!0,strictNumbers:(W=(x=L.strictNumbers)!==null&&x!==void 0?x:dt)!==null&&W!==void 0?W:!0,strictTypes:(ee=(se=L.strictTypes)!==null&&se!==void 0?se:dt)!==null&&ee!==void 0?ee:"log",strictTuples:(I=(T=L.strictTuples)!==null&&T!==void 0?T:dt)!==null&&I!==void 0?I:"log",strictRequired:(U=(M=L.strictRequired)!==null&&M!==void 0?M:dt)!==null&&U!==void 0?U:!1,code:L.code?{...L.code,optimize:ss,regExp:ns}:{optimize:ss,regExp:ns},loopRequired:(K=L.loopRequired)!==null&&K!==void 0?K:i,loopEnum:(X=L.loopEnum)!==null&&X!==void 0?X:i,meta:(de=L.meta)!==null&&de!==void 0?de:!0,messages:(Re=L.messages)!==null&&Re!==void 0?Re:!0,inlineRefs:(be=L.inlineRefs)!==null&&be!==void 0?be:!0,schemaId:($e=L.schemaId)!==null&&$e!==void 0?$e:"$id",addUsedSchema:(fe=L.addUsedSchema)!==null&&fe!==void 0?fe:!0,validateSchema:(tt=L.validateSchema)!==null&&tt!==void 0?tt:!0,validateFormats:(Pe=L.validateFormats)!==null&&Pe!==void 0?Pe:!0,unicodeRegExp:(Sr=L.unicodeRegExp)!==null&&Sr!==void 0?Sr:!0,int32range:(Er=L.int32range)!==null&&Er!==void 0?Er:!0,uriResolver:na}}class ${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:A,lines:R}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:b,es5:A,lines:R}),this.logger=F(P.logger);const g=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=z.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=g}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:P,meta:A,schemaId:R}=this.opts;let g=S;R==="id"&&(g={...S},g.id=g.$id,delete g.$id),A&&P&&this.addMetaSchema(g,g[R],!1)}defaultMeta(){const{meta:P,schemaId:A}=this.opts;return this.opts.defaultMeta=typeof P=="object"?P[A]||P:void 0}validate(P,A){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 g=R(A);return"$async"in R||(this.errors=R.errors),g}compile(P,A){const R=this._addSchema(P,A);return R.validate||this._compileSchemaEnv(R)}compileAsync(P,A){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:R}=this.opts;return g.call(this,P,A);async function g(ee,T){await k.call(this,ee.$schema);const I=this._addSchema(ee,T);return I.validate||N.call(this,I)}async function k(ee){ee&&!this.getSchema(ee)&&await g.call(this,{$ref:ee},!0)}async function N(ee){try{return this._compileSchemaEnv(ee)}catch(T){if(!(T instanceof a.default))throw T;return x.call(this,T),await W.call(this,T.missingSchema),N.call(this,ee)}}function x({missingSchema:ee,missingRef:T}){if(this.refs[ee])throw new Error(`AnySchema ${ee} is loaded but ${T} cannot be resolved`)}async function W(ee){const T=await se.call(this,ee);this.refs[ee]||await k.call(this,T.$schema),this.refs[ee]||this.addSchema(T,ee,A)}async function se(ee){const T=this._loading[ee];if(T)return T;try{return await(this._loading[ee]=R(ee))}finally{delete this._loading[ee]}}}addSchema(P,A,R,g=this.opts.validateSchema){if(Array.isArray(P)){for(const N of P)this.addSchema(N,void 0,R,g);return this}let k;if(typeof P=="object"){const{schemaId:N}=this.opts;if(k=P[N],k!==void 0&&typeof k!="string")throw new Error(`schema ${N} must be string`)}return A=(0,u.normalizeId)(A||k),this._checkUnique(A),this.schemas[A]=this._addSchema(P,R,A,g,!0),this}addMetaSchema(P,A,R=this.opts.validateSchema){return this.addSchema(P,A,!0,R),this}validateSchema(P,A){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 g=this.validate(R,P);if(!g&&A){const k="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(k);else throw new Error(k)}return g}getSchema(P){let A;for(;typeof(A=w.call(this,P))=="string";)P=A;if(A===void 0){const{schemaId:R}=this.opts,g=new c.SchemaEnv({schema:{},schemaId:R});if(A=c.resolveSchema.call(this,g,P),!A)return;this.refs[P]=A}return A.validate||this._compileSchemaEnv(A)}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 A=w.call(this,P);return typeof A=="object"&&this._cache.delete(A.schema),delete this.schemas[P],delete this.refs[P],this}case"object":{const A=P;this._cache.delete(A);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 A of P)this.addKeyword(A);return this}addKeyword(P,A){let R;if(typeof P=="string")R=P,typeof A=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),A.keyword=R);else if(typeof P=="object"&&A===void 0){if(A=P,R=A.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(H.call(this,R,A),!A)return(0,h.eachItem)(R,k=>ne.call(this,k)),this;ge.call(this,A);const g={...A,type:(0,m.getJSONTypes)(A.type),schemaType:(0,m.getJSONTypes)(A.schemaType)};return(0,h.eachItem)(R,g.type.length===0?k=>ne.call(this,k,g):k=>g.type.forEach(N=>ne.call(this,k,g,N))),this}getKeyword(P){const A=this.RULES.all[P];return typeof A=="object"?A.definition:!!A}removeKeyword(P){const{RULES:A}=this;delete A.keywords[P],delete A.all[P];for(const R of A.rules){const g=R.rules.findIndex(k=>k.keyword===P);g>=0&&R.rules.splice(g,1)}return this}addFormat(P,A){return typeof A=="string"&&(A=new RegExp(A)),this.formats[P]=A,this}errorsText(P=this.errors,{separator:A=", ",dataVar:R="data"}={}){return!P||P.length===0?"No errors":P.map(g=>`${R}${g.instancePath} ${g.message}`).reduce((g,k)=>g+A+k)}$dataMetaSchema(P,A){const R=this.RULES.all;P=JSON.parse(JSON.stringify(P));for(const g of A){const k=g.split("/").slice(1);let N=P;for(const x of k)N=N[x];for(const x in R){const W=R[x];if(typeof W!="object")continue;const{$data:se}=W.definition,ee=N[x];se&&ee&&(N[x]=Ie(ee))}}return P}_removeAllSchemas(P,A){for(const R in P){const g=P[R];(!A||A.test(R))&&(typeof g=="string"?delete P[R]:g&&!g.meta&&(this._cache.delete(g.schema),delete P[R]))}}_addSchema(P,A,R,g=this.opts.validateSchema,k=this.opts.addUsedSchema){let N;const{schemaId:x}=this.opts;if(typeof P=="object")N=P[x];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 c.SchemaEnv({schema:P,schemaId:x,meta:A,baseId:R,localRefs:se}),this._cache.set(W.schema,W),k&&!R.startsWith("#")&&(R&&this._checkUnique(R),this.refs[R]=W),g&&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):c.compileSchema.call(this,P),!P.validate)throw new Error("ajv implementation error");return P.validate}_compileMetaSchema(P){const A=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,P)}finally{this.opts=A}}}$.ValidationError=s.default,$.MissingRefError=a.default,t.default=$;function f(L,P,A,R="error"){for(const g in L){const k=g;k in P&&this.logger[R](`${A}: option ${g}. ${L[k]}`)}}function w(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 A=L[P];A.keyword||(A.keyword=P),this.addKeyword(A)}}function z(){const L={...this.opts};for(const P of v)delete L[P];return L}const q={log(){},warn(){},error(){}};function F(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 V=/^[a-z_$][a-z0-9_$:-]*$/i;function H(L,P){const{RULES:A}=this;if((0,h.eachItem)(L,R=>{if(A.keywords[R])throw new Error(`Keyword ${R} is already defined`);if(!V.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,A){var R;const g=P?.post;if(A&&g)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:k}=this;let N=g?k.post:k.rules.find(({type:W})=>W===A);if(N||(N={type:A,rules:[]},k.rules.push(N)),k.keywords[L]=!0,!P)return;const x={keyword:L,definition:{...P,type:(0,m.getJSONTypes)(P.type),schemaType:(0,m.getJSONTypes)(P.schemaType)}};P.before?_e.call(this,N,x,P.before):N.rules.push(x),k.all[L]=x,(R=P.implements)===null||R===void 0||R.forEach(W=>this.addKeyword(W))}function _e(L,P,A){const R=L.rules.findIndex(g=>g.keyword===A);R>=0?L.rules.splice(R,0,P):(L.rules.push(P),this.logger.warn(`rule ${A} is not defined`))}function ge(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]}}})(Ir)),Ir}var Rt={},Ot={},Ct={},Ds;function lo(){if(Ds)return Ct;Ds=1,Object.defineProperty(Ct,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return Ct.default=t,Ct}var Ve={},Ls;function fo(){if(Ls)return Ve;Ls=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.callRef=Ve.getValidate=void 0;const t=$r(),e=Ae(),r=Q(),s=Ke(),a=es(),n=re(),c={keyword:"$ref",schemaType:"string",code(m){const{gen:h,schema:S,it:_}=m,{baseId:y,schemaEnv:v,validateName:b,opts:l,self:p}=_,{root:i}=v;if((S==="#"||S==="#/")&&y===i.baseId)return $();const d=a.resolveRef.call(p,i,y,S);if(d===void 0)throw new t.default(_.opts.uriResolver,y,S);if(d instanceof a.SchemaEnv)return f(d);return w(d);function $(){if(v===i)return u(m,b,v,v.$async);const E=h.scopeValue("root",{ref:i});return u(m,(0,r._)`${E}.validate`,i,i.$async)}function f(E){const C=o(m,E);u(m,C,E,E.$async)}function w(E){const C=h.scopeValue("schema",l.code.source===!0?{ref:E,code:(0,r.stringify)(E)}:{ref:E}),D=h.name("valid"),z=m.subschema({schema:E,dataTypes:[],schemaPath:r.nil,topSchemaRef:C,errSchemaPath:S},D);m.mergeEvaluated(z),m.ok(D)}}};function o(m,h){const{gen:S}=m;return h.validate?S.scopeValue("validate",{ref:h.validate}):(0,r._)`${S.scopeValue("wrapper",{ref:h})}.validate`}Ve.getValidate=o;function u(m,h,S,_){const{gen:y,it:v}=m,{allErrors:b,schemaEnv:l,opts:p}=v,i=p.passContext?s.default.this:r.nil;_?d():$();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,i)}`),w(h),b||y.assign(E,!0)},C=>{y.if((0,r._)`!(${C} instanceof ${v.ValidationError})`,()=>y.throw(C)),f(C),b||y.assign(E,!1)}),m.ok(E)}function $(){m.result((0,e.callValidateCode)(m,h,i),()=>w(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 w(E){var C;if(!v.opts.unevaluated)return;const D=(C=S?.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 z=y.var("props",(0,r._)`${E}.evaluated.props`);v.props=n.mergeEvaluated.props(y,z,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 z=y.var("items",(0,r._)`${E}.evaluated.items`);v.items=n.mergeEvaluated.items(y,z,v.items,r.Name)}}}return Ve.callRef=u,Ve.default=c,Ve}var Us;function ho(){if(Us)return Ot;Us=1,Object.defineProperty(Ot,"__esModule",{value:!0});const t=lo(),e=fo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Ot.default=r,Ot}var Nt={},qt={},Fs;function po(){if(Fs)return qt;Fs=1,Object.defineProperty(qt,"__esModule",{value:!0});const t=Q(),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:c})=>(0,t.str)`must be ${r[n].okStr} ${c}`,params:({keyword:n,schemaCode:c})=>(0,t._)`{comparison: ${r[n].okStr}, limit: ${c}}`},a={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:s,code(n){const{keyword:c,data:o,schemaCode:u}=n;n.fail$data((0,t._)`${o} ${r[c].fail} ${u} || isNaN(${o})`)}};return qt.default=a,qt}var Mt={},zs;function mo(){if(zs)return Mt;zs=1,Object.defineProperty(Mt,"__esModule",{value:!0});const t=Q(),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:c,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._)`(${c} === 0 || (${m} = ${n}/${c}, ${h}))`)}};return Mt.default=r,Mt}var At={},jt={},Vs;function yo(){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 Hs;function _o(){if(Hs)return At;Hs=1,Object.defineProperty(At,"__esModule",{value:!0});const t=Q(),e=re(),r=yo(),a={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:c}){const o=n==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${c} characters`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:c,data:o,schemaCode:u,it:m}=n,h=c==="maxLength"?t.operators.GT:t.operators.LT,S=m.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.useFunc)(n.gen,r.default)}(${o})`;n.fail$data((0,t._)`${S} ${h} ${u}`)}};return At.default=a,At}var Dt={},xs;function go(){if(xs)return Dt;xs=1,Object.defineProperty(Dt,"__esModule",{value:!0});const t=Ae(),e=Q(),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:c,schema:o,schemaCode:u,it:m}=a,h=m.opts.unicodeRegExp?"u":"",S=c?(0,e._)`(new RegExp(${u}, ${h}))`:(0,t.usePattern)(a,o);a.fail$data((0,e._)`!${S}.test(${n})`)}};return Dt.default=s,Dt}var Lt={},Ks;function vo(){if(Ks)return Lt;Ks=1,Object.defineProperty(Lt,"__esModule",{value:!0});const t=Q(),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:c}=s,o=a==="maxProperties"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`Object.keys(${n}).length ${o} ${c}`)}};return Lt.default=r,Lt}var Ut={},Ws;function wo(){if(Ws)return Ut;Ws=1,Object.defineProperty(Ut,"__esModule",{value:!0});const t=Ae(),e=Q(),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:c,schema:o,schemaCode:u,data:m,$data:h,it:S}=n,{opts:_}=S;if(!h&&o.length===0)return;const y=o.length>=_.loopRequired;if(S.allErrors?v():b(),_.strictRequired){const i=n.parentSchema.properties,{definedProperties:d}=n.it;for(const $ of o)if(i?.[$]===void 0&&!d.has($)){const f=S.schemaEnv.baseId+S.errSchemaPath,w=`required property "${$}" is not defined at "${f}" (strictRequired)`;(0,r.checkStrictMode)(S,w,S.opts.strictRequired)}}function v(){if(y||h)n.block$data(e.nil,l);else for(const i of o)(0,t.checkReportMissingProp)(n,i)}function b(){const i=c.let("missing");if(y||h){const d=c.let("valid",!0);n.block$data(d,()=>p(i,d)),n.ok(d)}else c.if((0,t.checkMissingProp)(n,o,i)),(0,t.reportMissingProp)(n,i),c.else()}function l(){c.forOf("prop",u,i=>{n.setParams({missingProperty:i}),c.if((0,t.noPropertyInData)(c,m,i,_.ownProperties),()=>n.error())})}function p(i,d){n.setParams({missingProperty:i}),c.forOf(i,u,()=>{c.assign(d,(0,t.propertyInData)(c,m,i,_.ownProperties)),c.if((0,e.not)(d),()=>{n.error(),c.break()})},e.nil)}}};return Ut.default=a,Ut}var Ft={},Gs;function bo(){if(Gs)return Ft;Gs=1,Object.defineProperty(Ft,"__esModule",{value:!0});const t=Q(),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:c}=s,o=a==="maxItems"?t.operators.GT:t.operators.LT;s.fail$data((0,t._)`${n}.length ${o} ${c}`)}};return Ft.default=r,Ft}var zt={},Vt={},Js;function ts(){if(Js)return Vt;Js=1,Object.defineProperty(Vt,"__esModule",{value:!0});const t=Fn();return t.code='require("ajv/dist/runtime/equal").default',Vt.default=t,Vt}var Bs;function $o(){if(Bs)return zt;Bs=1,Object.defineProperty(zt,"__esModule",{value:!0});const t=mr(),e=Q(),r=re(),s=ts(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:c,j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${c} are identical)`,params:({params:{i:c,j:o}})=>(0,e._)`{i: ${c}, j: ${o}}`},code(c){const{gen:o,data:u,$data:m,schema:h,parentSchema:S,schemaCode:_,it:y}=c;if(!m&&!h)return;const v=o.let("valid"),b=S.items?(0,t.getSchemaTypes)(S.items):[];c.block$data(v,l,(0,e._)`${_} === false`),c.ok(v);function l(){const $=o.let("i",(0,e._)`${u}.length`),f=o.let("j");c.setParams({i:$,j:f}),o.assign(v,!0),o.if((0,e._)`${$} > 1`,()=>(p()?i:d)($,f))}function p(){return b.length>0&&!b.some($=>$==="object"||$==="array")}function i($,f){const w=o.name("item"),E=(0,t.checkDataTypes)(b,w,y.opts.strictNumbers,t.DataType.Wrong),C=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${$}--;`,()=>{o.let(w,(0,e._)`${u}[${$}]`),o.if(E,(0,e._)`continue`),b.length>1&&o.if((0,e._)`typeof ${w} == "string"`,(0,e._)`${w} += "_"`),o.if((0,e._)`typeof ${C}[${w}] == "number"`,()=>{o.assign(f,(0,e._)`${C}[${w}]`),c.error(),o.assign(v,!1).break()}).code((0,e._)`${C}[${w}] = ${$}`)})}function d($,f){const w=(0,r.useFunc)(o,s.default),E=o.name("outer");o.label(E).for((0,e._)`;${$}--;`,()=>o.for((0,e._)`${f} = ${$}; ${f}--;`,()=>o.if((0,e._)`${w}(${u}[${$}], ${u}[${f}])`,()=>{c.error(),o.assign(v,!1).break(E)})))}}};return zt.default=n,zt}var Ht={},Zs;function So(){if(Zs)return Ht;Zs=1,Object.defineProperty(Ht,"__esModule",{value:!0});const t=Q(),e=re(),r=ts(),a={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:n})=>(0,t._)`{allowedValue: ${n}}`},code(n){const{gen:c,data:o,$data:u,schemaCode:m,schema:h}=n;u||h&&typeof h=="object"?n.fail$data((0,t._)`!${(0,e.useFunc)(c,r.default)}(${o}, ${m})`):n.fail((0,t._)`${h} !== ${o}`)}};return Ht.default=a,Ht}var xt={},Qs;function Eo(){if(Qs)return xt;Qs=1,Object.defineProperty(xt,"__esModule",{value:!0});const t=Q(),e=re(),r=ts(),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:c,data:o,$data:u,schema:m,schemaCode:h,it:S}=n;if(!u&&m.length===0)throw new Error("enum must have non-empty array");const _=m.length>=S.opts.loopEnum;let y;const v=()=>y??(y=(0,e.useFunc)(c,r.default));let b;if(_||u)b=c.let("valid"),n.block$data(b,l);else{if(!Array.isArray(m))throw new Error("ajv implementation error");const i=c.const("vSchema",h);b=(0,t.or)(...m.map((d,$)=>p(i,$)))}n.pass(b);function l(){c.assign(b,!1),c.forOf("v",h,i=>c.if((0,t._)`${v()}(${o}, ${i})`,()=>c.assign(b,!0).break()))}function p(i,d){const $=m[d];return typeof $=="object"&&$!==null?(0,t._)`${v()}(${o}, ${i}[${d}])`:(0,t._)`${o} === ${$}`}}};return xt.default=a,xt}var Xs;function ko(){if(Xs)return Nt;Xs=1,Object.defineProperty(Nt,"__esModule",{value:!0});const t=po(),e=mo(),r=_o(),s=go(),a=vo(),n=wo(),c=bo(),o=$o(),u=So(),m=Eo(),h=[t.default,e.default,r.default,s.default,a.default,n.default,c.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,m.default];return Nt.default=h,Nt}var Kt={},st={},Ys;function Vn(){if(Ys)return st;Ys=1,Object.defineProperty(st,"__esModule",{value:!0}),st.validateAdditionalItems=void 0;const t=Q(),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:c,it:o}=n,{items:u}=c;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,c){const{gen:o,schema:u,data:m,keyword:h,it:S}=n;S.items=!0;const _=o.const("len",(0,t._)`${m}.length`);if(u===!1)n.setParams({len:c.length}),n.pass((0,t._)`${_} <= ${c.length}`);else if(typeof u=="object"&&!(0,e.alwaysValidSchema)(S,u)){const v=o.var("valid",(0,t._)`${_} <= ${c.length}`);o.if((0,t.not)(v),()=>y(v)),n.ok(v)}function y(v){o.forRange("i",c.length,_,b=>{n.subschema({keyword:h,dataProp:b,dataPropType:e.Type.Num},v),S.allErrors||o.if((0,t.not)(v),()=>o.break())})}}return st.validateAdditionalItems=a,st.default=s,st}var Wt={},nt={},en;function Hn(){if(en)return nt;en=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.validateTuple=void 0;const t=Q(),e=re(),r=Ae(),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(n){const{schema:c,it:o}=n;if(Array.isArray(c))return a(n,"additionalItems",c);o.items=!0,!(0,e.alwaysValidSchema)(o,c)&&n.ok((0,r.validateArray)(n))}};function a(n,c,o=n.schema){const{gen:u,parentSchema:m,data:h,keyword:S,it:_}=n;b(m),_.opts.unevaluated&&o.length&&_.items!==!0&&(_.items=e.mergeEvaluated.items(u,o.length,_.items));const y=u.name("valid"),v=u.const("len",(0,t._)`${h}.length`);o.forEach((l,p)=>{(0,e.alwaysValidSchema)(_,l)||(u.if((0,t._)`${v} > ${p}`,()=>n.subschema({keyword:S,schemaProp:p,dataProp:p},y)),n.ok(y))});function b(l){const{opts:p,errSchemaPath:i}=_,d=o.length,$=d===l.minItems&&(d===l.maxItems||l[c]===!1);if(p.strictTuples&&!$){const f=`"${S}" is ${d}-tuple, but minItems or maxItems/${c} are not specified or different at path "${i}"`;(0,e.checkStrictMode)(_,f,p.strictTuples)}}}return nt.validateTuple=a,nt.default=s,nt}var tn;function To(){if(tn)return Wt;tn=1,Object.defineProperty(Wt,"__esModule",{value:!0});const t=Hn(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return Wt.default=e,Wt}var Gt={},rn;function Po(){if(rn)return Gt;rn=1,Object.defineProperty(Gt,"__esModule",{value:!0});const t=Q(),e=re(),r=Ae(),s=Vn(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:c}})=>(0,t.str)`must NOT have more than ${c} items`,params:({params:{len:c}})=>(0,t._)`{limit: ${c}}`},code(c){const{schema:o,parentSchema:u,it:m}=c,{prefixItems:h}=u;m.items=!0,!(0,e.alwaysValidSchema)(m,o)&&(h?(0,s.validateAdditionalItems)(c,h):c.ok((0,r.validateArray)(c)))}};return Gt.default=n,Gt}var Jt={},sn;function Io(){if(sn)return Jt;sn=1,Object.defineProperty(Jt,"__esModule",{value:!0});const t=Q(),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:c,parentSchema:o,data:u,it:m}=a;let h,S;const{minContains:_,maxContains:y}=o;m.opts.next?(h=_===void 0?1:_,S=y):h=1;const v=n.const("len",(0,t._)`${u}.length`);if(a.setParams({min:h,max:S}),S===void 0&&h===0){(0,e.checkStrictMode)(m,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(S!==void 0&&h>S){(0,e.checkStrictMode)(m,'"minContains" > "maxContains" is always invalid'),a.fail();return}if((0,e.alwaysValidSchema)(m,c)){let d=(0,t._)`${v} >= ${h}`;S!==void 0&&(d=(0,t._)`${d} && ${v} <= ${S}`),a.pass(d);return}m.items=!0;const b=n.name("valid");S===void 0&&h===1?p(b,()=>n.if(b,()=>n.break())):h===0?(n.let(b,!0),S!==void 0&&n.if((0,t._)`${u}.length > 0`,l)):(n.let(b,!1),l()),a.result(b,()=>a.reset());function l(){const d=n.name("_valid"),$=n.let("count",0);p(d,()=>n.if(d,()=>i($)))}function p(d,$){n.forRange("i",0,v,f=>{a.subschema({keyword:"contains",dataProp:f,dataPropType:e.Type.Num,compositeRule:!0},d),$()})}function i(d){n.code((0,t._)`${d}++`),S===void 0?n.if((0,t._)`${d} >= ${h}`,()=>n.assign(b,!0).break()):(n.if((0,t._)`${d} > ${S}`,()=>n.assign(b,!1).break()),h===1?n.assign(b,!0):n.if((0,t._)`${d} >= ${h}`,()=>n.assign(b,!0)))}}};return Jt.default=s,Jt}var Dr={},nn;function Ro(){return nn||(nn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=Q(),r=re(),s=Ae();t.error={message:({params:{property:u,depsCount:m,deps:h}})=>{const S=m===1?"property":"properties";return(0,e.str)`must have ${S} ${h} when property ${u} is present`},params:({params:{property:u,depsCount:m,deps:h,missingProperty:S}})=>(0,e._)`{property: ${u},
|
|
10
|
-
missingProperty: ${S},
|
|
11
|
-
depsCount: ${m},
|
|
12
|
-
deps: ${h}}`};const a={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(u){const[m,h]=n(u);c(u,m),o(u,h)}};function n({schema:u}){const m={},h={};for(const S in u){if(S==="__proto__")continue;const _=Array.isArray(u[S])?m:h;_[S]=u[S]}return[m,h]}function c(u,m=u.schema){const{gen:h,data:S,it:_}=u;if(Object.keys(m).length===0)return;const y=h.let("missing");for(const v in m){const b=m[v];if(b.length===0)continue;const l=(0,s.propertyInData)(h,S,v,_.opts.ownProperties);u.setParams({property:v,depsCount:b.length,deps:b.join(", ")}),_.allErrors?h.if(l,()=>{for(const p of b)(0,s.checkReportMissingProp)(u,p)}):(h.if((0,e._)`${l} && (${(0,s.checkMissingProp)(u,b,y)})`),(0,s.reportMissingProp)(u,y),h.else())}}t.validatePropertyDeps=c;function o(u,m=u.schema){const{gen:h,data:S,keyword:_,it:y}=u,v=h.name("valid");for(const b in m)(0,r.alwaysValidSchema)(y,m[b])||(h.if((0,s.propertyInData)(h,S,b,y.opts.ownProperties),()=>{const l=u.subschema({keyword:_,schemaProp:b},v);u.mergeValidEvaluated(l,v)},()=>h.var(v,!0)),u.ok(v))}t.validateSchemaDeps=o,t.default=a})(Dr)),Dr}var Bt={},an;function Oo(){if(an)return Bt;an=1,Object.defineProperty(Bt,"__esModule",{value:!0});const t=Q(),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:c,data:o,it:u}=a;if((0,e.alwaysValidSchema)(u,c))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 Bt.default=s,Bt}var Zt={},on;function xn(){if(on)return Zt;on=1,Object.defineProperty(Zt,"__esModule",{value:!0});const t=Ae(),e=Q(),r=Ke(),s=re(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:c})=>(0,e._)`{additionalProperty: ${c.additionalProperty}}`},code(c){const{gen:o,schema:u,parentSchema:m,data:h,errsCount:S,it:_}=c;if(!S)throw new Error("ajv implementation error");const{allErrors:y,opts:v}=_;if(_.props=!0,v.removeAdditional!=="all"&&(0,s.alwaysValidSchema)(_,u))return;const b=(0,t.allSchemaProperties)(m.properties),l=(0,t.allSchemaProperties)(m.patternProperties);p(),c.ok((0,e._)`${S} === ${r.default.errors}`);function p(){o.forIn("key",h,w=>{!b.length&&!l.length?$(w):o.if(i(w),()=>$(w))})}function i(w){let E;if(b.length>8){const C=(0,s.schemaRefOrVal)(_,m.properties,"properties");E=(0,t.isOwnProperty)(o,C,w)}else b.length?E=(0,e.or)(...b.map(C=>(0,e._)`${w} === ${C}`)):E=e.nil;return l.length&&(E=(0,e.or)(E,...l.map(C=>(0,e._)`${(0,t.usePattern)(c,C)}.test(${w})`))),(0,e.not)(E)}function d(w){o.code((0,e._)`delete ${h}[${w}]`)}function $(w){if(v.removeAdditional==="all"||v.removeAdditional&&u===!1){d(w);return}if(u===!1){c.setParams({additionalProperty:w}),c.error(),y||o.break();return}if(typeof u=="object"&&!(0,s.alwaysValidSchema)(_,u)){const E=o.name("valid");v.removeAdditional==="failing"?(f(w,E,!1),o.if((0,e.not)(E),()=>{c.reset(),d(w)})):(f(w,E),y||o.if((0,e.not)(E),()=>o.break()))}}function f(w,E,C){const D={keyword:"additionalProperties",dataProp:w,dataPropType:s.Type.Str};C===!1&&Object.assign(D,{compositeRule:!0,createErrors:!1,allErrors:!1}),c.subschema(D,E)}}};return Zt.default=n,Zt}var Qt={},cn;function Co(){if(cn)return Qt;cn=1,Object.defineProperty(Qt,"__esModule",{value:!0});const t=br(),e=Ae(),r=re(),s=xn(),a={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:c,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 S=(0,e.allSchemaProperties)(o);for(const l of S)h.definedProperties.add(l);h.opts.unevaluated&&S.length&&h.props!==!0&&(h.props=r.mergeEvaluated.props(c,(0,r.toHash)(S),h.props));const _=S.filter(l=>!(0,r.alwaysValidSchema)(h,o[l]));if(_.length===0)return;const y=c.name("valid");for(const l of _)v(l)?b(l):(c.if((0,e.propertyInData)(c,m,l,h.opts.ownProperties)),b(l),h.allErrors||c.else().var(y,!0),c.endIf()),n.it.definedProperties.add(l),n.ok(y);function v(l){return h.opts.useDefaults&&!h.compositeRule&&o[l].default!==void 0}function b(l){n.subschema({keyword:"properties",schemaProp:l,dataProp:l},y)}}};return Qt.default=a,Qt}var Xt={},un;function No(){if(un)return Xt;un=1,Object.defineProperty(Xt,"__esModule",{value:!0});const t=Ae(),e=Q(),r=re(),s=re(),a={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:c,schema:o,data:u,parentSchema:m,it:h}=n,{opts:S}=h,_=(0,t.allSchemaProperties)(o),y=_.filter($=>(0,r.alwaysValidSchema)(h,o[$]));if(_.length===0||y.length===_.length&&(!h.opts.unevaluated||h.props===!0))return;const v=S.strictSchema&&!S.allowMatchingProperties&&m.properties,b=c.name("valid");h.props!==!0&&!(h.props instanceof e.Name)&&(h.props=(0,s.evaluatedPropsToName)(c,h.props));const{props:l}=h;p();function p(){for(const $ of _)v&&i($),h.allErrors?d($):(c.var(b,!0),d($),c.if(b))}function i($){for(const f in v)new RegExp($).test(f)&&(0,r.checkStrictMode)(h,`property ${f} matches pattern ${$} (use allowMatchingProperties)`)}function d($){c.forIn("key",u,f=>{c.if((0,e._)`${(0,t.usePattern)(n,$)}.test(${f})`,()=>{const w=y.includes($);w||n.subschema({keyword:"patternProperties",schemaProp:$,dataProp:f,dataPropType:s.Type.Str},b),h.opts.unevaluated&&l!==!0?c.assign((0,e._)`${l}[${f}]`,!0):!w&&!h.allErrors&&c.if((0,e.not)(b),()=>c.break())})})}}};return Xt.default=a,Xt}var Yt={},ln;function qo(){if(ln)return Yt;ln=1,Object.defineProperty(Yt,"__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 c=s.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),r.failResult(c,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return Yt.default=e,Yt}var er={},dn;function Mo(){if(dn)return er;dn=1,Object.defineProperty(er,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ae().validateUnion,error:{message:"must match a schema in anyOf"}};return er.default=e,er}var tr={},fn;function Ao(){if(fn)return tr;fn=1,Object.defineProperty(tr,"__esModule",{value:!0});const t=Q(),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:c,parentSchema:o,it:u}=a;if(!Array.isArray(c))throw new Error("ajv implementation error");if(u.opts.discriminator&&o.discriminator)return;const m=c,h=n.let("valid",!1),S=n.let("passing",null),_=n.name("_valid");a.setParams({passing:S}),n.block(y),a.result(h,()=>a.reset(),()=>a.error(!0));function y(){m.forEach((v,b)=>{let l;(0,e.alwaysValidSchema)(u,v)?n.var(_,!0):l=a.subschema({keyword:"oneOf",schemaProp:b,compositeRule:!0},_),b>0&&n.if((0,t._)`${_} && ${h}`).assign(h,!1).assign(S,(0,t._)`[${S}, ${b}]`).else(),n.if(_,()=>{n.assign(h,!0),n.assign(S,b),l&&a.mergeEvaluated(l,t.Name)})})}}};return tr.default=s,tr}var rr={},hn;function jo(){if(hn)return rr;hn=1,Object.defineProperty(rr,"__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 c=s.name("valid");a.forEach((o,u)=>{if((0,t.alwaysValidSchema)(n,o))return;const m=r.subschema({keyword:"allOf",schemaProp:u},c);r.ok(c),r.mergeEvaluated(m)})}};return rr.default=e,rr}var sr={},pn;function Do(){if(pn)return sr;pn=1,Object.defineProperty(sr,"__esModule",{value:!0});const t=Q(),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:c,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 S=c.let("valid",!0),_=c.name("_valid");if(y(),n.reset(),m&&h){const b=c.let("ifClause");n.setParams({ifClause:b}),c.if(_,v("then",b),v("else",b))}else m?c.if(_,v("then")):c.if((0,t.not)(_),v("else"));n.pass(S,()=>n.error(!0));function y(){const b=n.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},_);n.mergeEvaluated(b)}function v(b,l){return()=>{const p=n.subschema({keyword:b},_);c.assign(S,_),n.mergeValidEvaluated(p,S),l?c.assign(l,(0,t._)`${b}`):n.setParams({ifClause:b})}}}};function a(n,c){const o=n.schema[c];return o!==void 0&&!(0,e.alwaysValidSchema)(n,o)}return sr.default=s,sr}var nr={},mn;function Lo(){if(mn)return nr;mn=1,Object.defineProperty(nr,"__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 nr.default=e,nr}var yn;function Uo(){if(yn)return Kt;yn=1,Object.defineProperty(Kt,"__esModule",{value:!0});const t=Vn(),e=To(),r=Hn(),s=Po(),a=Io(),n=Ro(),c=Oo(),o=xn(),u=Co(),m=No(),h=qo(),S=Mo(),_=Ao(),y=jo(),v=Do(),b=Lo();function l(p=!1){const i=[h.default,S.default,_.default,y.default,v.default,b.default,c.default,o.default,n.default,u.default,m.default];return p?i.push(e.default,s.default):i.push(t.default,r.default),i.push(a.default),i}return Kt.default=l,Kt}var ar={},or={},_n;function Fo(){if(_n)return or;_n=1,Object.defineProperty(or,"__esModule",{value:!0});const t=Q(),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:c,$data:o,schema:u,schemaCode:m,it:h}=s,{opts:S,errSchemaPath:_,schemaEnv:y,self:v}=h;if(!S.validateFormats)return;o?b():l();function b(){const p=n.scopeValue("formats",{ref:v.formats,code:S.code.formats}),i=n.const("fDef",(0,t._)`${p}[${m}]`),d=n.let("fType"),$=n.let("format");n.if((0,t._)`typeof ${i} == "object" && !(${i} instanceof RegExp)`,()=>n.assign(d,(0,t._)`${i}.type || "string"`).assign($,(0,t._)`${i}.validate`),()=>n.assign(d,(0,t._)`"string"`).assign($,i)),s.fail$data((0,t.or)(f(),w()));function f(){return S.strictSchema===!1?t.nil:(0,t._)`${m} && !${$}`}function w(){const E=y.$async?(0,t._)`(${i}.async ? await ${$}(${c}) : ${$}(${c}))`:(0,t._)`${$}(${c})`,C=(0,t._)`(typeof ${$} == "function" ? ${E} : ${$}.test(${c}))`;return(0,t._)`${$} && ${$} !== true && ${d} === ${a} && !${C}`}}function l(){const p=v.formats[u];if(!p){f();return}if(p===!0)return;const[i,d,$]=w(p);i===a&&s.pass(E());function f(){if(S.strictSchema===!1){v.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${u}" ignored in schema at path "${_}"`}}function w(C){const D=C instanceof RegExp?(0,t.regexpCode)(C):S.code.formats?(0,t._)`${S.code.formats}${(0,t.getProperty)(u)}`:void 0,z=n.scopeValue("formats",{key:u,ref:C,code:D});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,t._)`${z}.validate`]:["string",C,z]}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 ${$}(${c})`}return typeof d=="function"?(0,t._)`${$}(${c})`:(0,t._)`${$}.test(${c})`}}}};return or.default=r,or}var gn;function zo(){if(gn)return ar;gn=1,Object.defineProperty(ar,"__esModule",{value:!0});const e=[Fo().default];return ar.default=e,ar}var Be={},vn;function Vo(){return vn||(vn=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.contentVocabulary=Be.metadataVocabulary=void 0,Be.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Be.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Be}var wn;function Ho(){if(wn)return Rt;wn=1,Object.defineProperty(Rt,"__esModule",{value:!0});const t=ho(),e=ko(),r=Uo(),s=zo(),a=Vo(),n=[t.default,e.default,(0,r.default)(),s.default,a.metadataVocabulary,a.contentVocabulary];return Rt.default=n,Rt}var ir={},pt={},bn;function xo(){if(bn)return pt;bn=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(pt.DiscrError=t={})),pt}var $n;function Ko(){if($n)return ir;$n=1,Object.defineProperty(ir,"__esModule",{value:!0});const t=Q(),e=xo(),r=es(),s=$r(),a=re(),c={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:S,it:_}=o,{oneOf:y}=S;if(!_.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 b=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(b);function p(){const $=d();u.if(!1);for(const f in $)u.elseIf((0,t._)`${l} === ${f}`),u.assign(b,i($[f]));u.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:l,tagName:v}),u.endIf()}function i($){const f=u.name("valid"),w=o.subschema({keyword:"oneOf",schemaProp:$},f);return o.mergeEvaluated(w,t.Name),f}function d(){var $;const f={},w=C(S);let E=!0;for(let q=0;q<y.length;q++){let F=y[q];if(F?.$ref&&!(0,a.schemaHasRulesButRef)(F,_.self.RULES)){const H=F.$ref;if(F=r.resolveRef.call(_.self,_.schemaEnv.root,_.baseId,H),F instanceof r.SchemaEnv&&(F=F.schema),F===void 0)throw new s.default(_.opts.uriResolver,_.baseId,H)}const V=($=F?.properties)===null||$===void 0?void 0:$[v];if(typeof V!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${v}"`);E=E&&(w||C(F)),D(V,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,F){if(q.const)z(q.const,F);else if(q.enum)for(const V of q.enum)z(V,F);else throw new Error(`discriminator: "properties/${v}" must have "const" or "enum"`)}function z(q,F){if(typeof q!="string"||q in f)throw new Error(`discriminator: "${v}" values must be unique strings`);f[q]=F}}}};return ir.default=c,ir}const Wo="http://json-schema.org/draft-07/schema#",Go="http://json-schema.org/draft-07/schema#",Jo="Core schema meta-schema",Bo={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:[]}},Zo=["object","boolean"],Qo={$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:"#"}},Xo={$schema:Wo,$id:Go,title:Jo,definitions:Bo,type:Zo,properties:Qo,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=uo(),s=Ho(),a=Ko(),n=Xo,c=["/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,c):n;this.addMetaSchema(v,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=u,t.exports=e=u,t.exports.Ajv=u,Object.defineProperty(e,"__esModule",{value:!0}),e.default=u;var m=br();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return m.KeywordCxt}});var h=Q();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 S=Yr();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return S.default}});var _=$r();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return _.default}})})(Et,Et.exports)),Et.exports}var Yo=Kn();const ei=Mn(Yo);var cr={exports:{}},Lr={},En;function ti(){return En||(En=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(q,F){return{validate:q,compare:F}}t.fullFormats={date:e(n,c),time:e(u(!0),m),"date-time":e(_(!0),y),"iso-time":e(u(),h),"iso-date-time":e(_(),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:z,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:w},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$/,c),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 F=s.exec(q);if(!F)return!1;const V=+F[1],H=+F[2],ne=+F[3];return H>=1&&H<=12&&ne>=1&&ne<=(H===2&&r(V)?29:a[H])}function c(q,F){if(q&&F)return q>F?1:q<F?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(q){return function(V){const H=o.exec(V);if(!H)return!1;const ne=+H[1],_e=+H[2],ge=+H[3],oe=H[4],Ie=H[5]==="-"?-1:1,L=+(H[6]||0),P=+(H[7]||0);if(L>23||P>59||q&&!oe)return!1;if(ne<=23&&_e<=59&&ge<60)return!0;const A=_e-P*Ie,R=ne-L*Ie-(A<0?1:0);return(R===23||R===-1)&&(A===59||A===-1)&&ge<61}}function m(q,F){if(!(q&&F))return;const V=new Date("2020-01-01T"+q).valueOf(),H=new Date("2020-01-01T"+F).valueOf();if(V&&H)return V-H}function h(q,F){if(!(q&&F))return;const V=o.exec(q),H=o.exec(F);if(V&&H)return q=V[1]+V[2]+V[3],F=H[1]+H[2]+H[3],q>F?1:q<F?-1:0}const S=/t|\s/i;function _(q){const F=u(q);return function(H){const ne=H.split(S);return ne.length===2&&n(ne[0])&&F(ne[1])}}function y(q,F){if(!(q&&F))return;const V=new Date(q).valueOf(),H=new Date(F).valueOf();if(V&&H)return V-H}function v(q,F){if(!(q&&F))return;const[V,H]=q.split(S),[ne,_e]=F.split(S),ge=c(V,ne);if(ge!==void 0)return ge||m(H,_e)}const b=/\/|:/,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 b.test(q)&&l.test(q)}const i=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function d(q){return i.lastIndex=0,i.test(q)}const $=-2147483648,f=2**31-1;function w(q){return Number.isInteger(q)&&q<=f&&q>=$}function E(q){return Number.isInteger(q)}function C(){return!0}const D=/[^\\]\\Z/;function z(q){if(D.test(q))return!1;try{return new RegExp(q),!0}catch{return!1}}})(Lr)),Lr}var Ur={},kn;function ri(){return kn||(kn=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Kn(),r=Q(),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:S,it:_}=o,{opts:y,self:v}=_;if(!y.validateFormats)return;const b=new e.KeywordCxt(_,v.RULES.all.format.definition,"format");b.$data?l():p();function l(){const d=u.scopeValue("formats",{ref:v.formats,code:y.code.formats}),$=u.const("fmt",(0,r._)`${d}[${b.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${$} != "object"`,(0,r._)`${$} instanceof RegExp`,(0,r._)`typeof ${$}.compare != "function"`,i($)))}function p(){const d=b.schema,$=v.formats[d];if(!$||$===!0)return;if(typeof $!="object"||$ instanceof RegExp||typeof $.compare!="function")throw new Error(`"${S}": format "${d}" does not define "compare" function`);const f=u.scopeValue("formats",{key:d,ref:$,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(d)}`:void 0});o.fail$data(i(f))}function i(d){return(0,r._)`${d}.compare(${m}, ${h}) ${a[S].fail} 0`}},dependencies:["format"]};const c=o=>(o.addKeyword(t.formatLimitDefinition),o);t.default=c})(Ur)),Ur}var Tn;function si(){return Tn||(Tn=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=ti(),s=ri(),a=Q(),n=new a.Name("fullFormats"),c=new a.Name("fastFormats"),o=(m,h={keywords:!0})=>{if(Array.isArray(h))return u(m,h,r.fullFormats,n),m;const[S,_]=h.mode==="fast"?[r.fastFormats,c]:[r.fullFormats,n],y=h.formats||r.formatNames;return u(m,y,S,_),h.keywords&&(0,s.default)(m),m};o.get=(m,h="full")=>{const _=(h==="fast"?r.fastFormats:r.fullFormats)[m];if(!_)throw new Error(`Unknown format "${m}"`);return _};function u(m,h,S,_){var y,v;(y=(v=m.opts.code).formats)!==null&&y!==void 0||(v.formats=(0,a._)`require("ajv-formats/dist/formats").${_}`);for(const b of h)m.addFormat(b,S[b])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(cr,cr.exports)),cr.exports}var ni=si();const ai=Mn(ni);function oi(){const t=new ei({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ai(t),t}class ii{constructor(e){this._ajv=e??oi()}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 ci{constructor(e){this._client=e}async*callToolStream(e,r=An,s){const a=this._client,n={...s,task:s?.task??(a.isToolTask(e.name)?{}:void 0)},c=a.requestStream({method:"tools/call",params:e},r,n),o=a.getToolOutputValidator(e.name);for await(const u of c){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 ui(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 li(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 lr(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&&lr(n,r[a])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)typeof r!="boolean"&&lr(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)typeof r!="boolean"&&lr(r,e)}}function di(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 fi=class extends Wa{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 ii,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Sa,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Ea,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",ka,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ci(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ga(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(gr(a)){const o=a;n=o._zod?.def?.value??o.value}else{const o=a;n=o._def?.value??o.value}if(typeof n!="string")throw new Error("Schema method literal must be a string");const c=n;if(c==="elicitation/create"){const o=async(u,m)=>{const h=He(ja,u);if(!h.success){const i=h.error instanceof Error?h.error.message:String(h.error);throw new G(Z.InvalidParams,`Invalid elicitation request: ${i}`)}const{params:S}=h.data;S.mode=S.mode??"form";const{supportsFormMode:_,supportsUrlMode:y}=di(this._capabilities.elicitation);if(S.mode==="form"&&!_)throw new G(Z.InvalidParams,"Client does not support form-mode elicitation requests");if(S.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(S.task){const i=He(Hr,v);if(!i.success){const d=i.error instanceof Error?i.error.message:String(i.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${d}`)}return i.data}const b=He(Da,v);if(!b.success){const i=b.error instanceof Error?b.error.message:String(b.error);throw new G(Z.InvalidParams,`Invalid elicitation result: ${i}`)}const l=b.data,p=S.mode==="form"?S.requestedSchema:void 0;if(S.mode==="form"&&l.action==="accept"&&l.content&&p&&this._capabilities.elicitation?.form?.applyDefaults)try{lr(p,l.content)}catch{}return l};return super.setRequestHandler(e,o)}if(c==="sampling/createMessage"){const o=async(u,m)=>{const h=He(La,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:S}=h.data,_=await Promise.resolve(r(u,m));if(S.task){const v=He(Hr,_);if(!v.success){const b=v.error instanceof Error?v.error.message:String(v.error);throw new G(Z.InvalidParams,`Invalid task creation result: ${b}`)}return v.data}const y=He(Ua,_);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:Ta,capabilities:this._capabilities,clientInfo:this._clientInfo}},Pa,r);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ia.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){ui(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&li(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},St,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},Ra,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},St,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Oa,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Ca,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Na,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},qa,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Ma,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},St,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},St,r)}async callTool(e,r=An,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 c=n(a.structuredContent);if(!c.valid)throw new G(Z.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)}catch(c){throw c instanceof G?c:new G(Z.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)}}return a}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const r of e){if(r.outputSchema){const a=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,a)}const s=r.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(r.name),s==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const s=await this.request({method:"tools/list",params:e},jn,r);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,r,s,a){const n=Aa.safeParse(s);if(!n.success)throw new Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:c,debounceMs:o}=n.data,{onChanged:u}=s,m=async()=>{if(!c){u(null,null);return}try{const S=await a();u(null,S)}catch(S){const _=S instanceof Error?S:new Error(String(S));u(_,null)}},h=()=>{if(o){const S=this._listChangedDebounceTimers.get(e);S&&clearTimeout(S);const _=setTimeout(m,o);this._listChangedDebounceTimers.set(e,_)}else m()};this.setNotificationHandler(r,h)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class Pn 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 Fr(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=Fr,onError:r=Fr,onRetry:s=Fr,onComment:a}=t;let n="",c=!0,o,u="",m="";function h(b){const l=c?b.replace(/^\xEF\xBB\xBF/,""):b,[p,i]=hi(`${n}${l}`);for(const d of p)S(d);n=i,c=!1}function S(b){if(b===""){y();return}if(b.startsWith(":")){a&&a(b.slice(b.startsWith(": ")?2:1));return}const l=b.indexOf(":");if(l!==-1){const p=b.slice(0,l),i=b[l+1]===" "?2:1,d=b.slice(l+i);_(p,d,b);return}_(b,"",b)}function _(b,l,p){switch(b){case"event":m=l;break;case"data":u=`${u}${l}
|
|
13
|
-
`;break;case"id":o=l.includes("\0")?void 0:l;break;case"retry":/^\d+$/.test(l)?s(parseInt(l,10)):r(new Pn(`Invalid \`retry\` value: "${l}"`,{type:"invalid-retry",value:l,line:p}));break;default:r(new Pn(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:l,line:p}));break}}function y(){u.length>0&&e({id:o,event:m||void 0,data:u.endsWith(`
|
|
14
|
-
`)?u.slice(0,-1):u}),o=void 0,u="",m=""}function v(b={}){n&&b.consume&&S(n),c=!0,o=void 0,u="",m="",n=""}return{feed:h,reset:v}}function hi(t){const e=[];let r="",s=0;for(;s<t.length;){const a=t.indexOf("\r",s),n=t.indexOf(`
|
|
15
|
-
`,s);let c=-1;if(a!==-1&&n!==-1?c=Math.min(a,n):a!==-1?a===t.length-1?c=-1:c=a:n!==-1&&(c=n),c===-1){r=t.slice(s);break}else{const o=t.slice(s,c);e.push(o),s=c+1,t[s-1]==="\r"&&t[s]===`
|
|
16
|
-
`&&s++}}return[e,r]}class In 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(Rn(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(Rn(this),r)}}function pi(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function xr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(xr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${xr(t.cause)}`:t.message:`${t}`}function Rn(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)},rs=(t,e,r)=>e.has(t)||Gn("Cannot "+r),Y=(t,e,r)=>(rs(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)=>(rs(t,e,"write to private field"),e.set(t,r),r),Ue=(t,e,r)=>(rs(t,e,"access private method"),r),Se,Qe,ot,dr,yr,vt,ut,wt,xe,it,lt,ct,yt,qe,Kr,Wr,Gr,On,Jr,Br,_t,Zr,Qr;class fr extends EventTarget{constructor(e,r){var s,a;super(),le(this,qe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,le(this,Se),le(this,Qe),le(this,ot),le(this,dr),le(this,yr),le(this,vt),le(this,ut),le(this,wt,null),le(this,xe),le(this,it),le(this,lt,null),le(this,ct,null),le(this,yt,null),le(this,Wr,async n=>{var c;Y(this,it).reset();const{body:o,redirected:u,status:m,headers:h}=n;if(m===204){Ue(this,qe,_t).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?ce(this,ot,new URL(n.url)):ce(this,ot,void 0),m!==200){Ue(this,qe,_t).call(this,`Non-200 status code (${m})`,m);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Ue(this,qe,_t).call(this,'Invalid content type, expected "text/event-stream"',m);return}if(Y(this,Se)===this.CLOSED)return;ce(this,Se,this.OPEN);const S=new Event("open");if((c=Y(this,yt))==null||c.call(this,S),this.dispatchEvent(S),typeof o!="object"||!o||!("getReader"in o)){Ue(this,qe,_t).call(this,"Invalid response body, expected a web ReadableStream",m),this.close();return}const _=new TextDecoder,y=o.getReader();let v=!0;do{const{done:b,value:l}=await y.read();l&&Y(this,it).feed(_.decode(l,{stream:!b})),b&&(v=!1,Y(this,it).reset(),Ue(this,qe,Zr).call(this))}while(v)}),le(this,Gr,n=>{ce(this,xe,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Ue(this,qe,Zr).call(this,xr(n))}),le(this,Jr,n=>{typeof n.id=="string"&&ce(this,wt,n.id);const c=new MessageEvent(n.event||"message",{data:n.data,origin:Y(this,ot)?Y(this,ot).origin:Y(this,Qe).origin,lastEventId:n.id||""});Y(this,ct)&&(!n.event||n.event==="message")&&Y(this,ct).call(this,c),this.dispatchEvent(c)}),le(this,Br,n=>{ce(this,vt,n)}),le(this,Qr,()=>{ce(this,ut,void 0),Y(this,Se)===this.CONNECTING&&Ue(this,qe,Kr).call(this)});try{if(e instanceof URL)ce(this,Qe,e);else if(typeof e=="string")ce(this,Qe,new URL(e,mi()));else throw new Error("Invalid URL")}catch{throw pi("An invalid or illegal string was specified")}ce(this,it,Wn({onEvent:Y(this,Jr),onRetry:Y(this,Br)})),ce(this,Se,this.CONNECTING),ce(this,vt,3e3),ce(this,yr,(s=r?.fetch)!=null?s:globalThis.fetch),ce(this,dr,(a=r?.withCredentials)!=null?a:!1),Ue(this,qe,Kr).call(this)}get readyState(){return Y(this,Se)}get url(){return Y(this,Qe).href}get withCredentials(){return Y(this,dr)}get onerror(){return Y(this,lt)}set onerror(e){ce(this,lt,e)}get onmessage(){return Y(this,ct)}set onmessage(e){ce(this,ct,e)}get onopen(){return Y(this,yt)}set onopen(e){ce(this,yt,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(){Y(this,ut)&&clearTimeout(Y(this,ut)),Y(this,Se)!==this.CLOSED&&(Y(this,xe)&&Y(this,xe).abort(),ce(this,Se,this.CLOSED),ce(this,xe,void 0))}}Se=new WeakMap,Qe=new WeakMap,ot=new WeakMap,dr=new WeakMap,yr=new WeakMap,vt=new WeakMap,ut=new WeakMap,wt=new WeakMap,xe=new WeakMap,it=new WeakMap,lt=new WeakMap,ct=new WeakMap,yt=new WeakMap,qe=new WeakSet,Kr=function(){ce(this,Se,this.CONNECTING),ce(this,xe,new AbortController),Y(this,yr)(Y(this,Qe),Ue(this,qe,On).call(this)).then(Y(this,Wr)).catch(Y(this,Gr))},Wr=new WeakMap,Gr=new WeakMap,On=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Y(this,wt)?{"Last-Event-ID":Y(this,wt)}:void 0},cache:"no-store",signal:(t=Y(this,xe))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Jr=new WeakMap,Br=new WeakMap,_t=function(t,e){var r;Y(this,Se)!==this.CLOSED&&ce(this,Se,this.CLOSED);const s=new In("error",{code:e,message:t});(r=Y(this,lt))==null||r.call(this,s),this.dispatchEvent(s)},Zr=function(t,e){var r;if(Y(this,Se)===this.CLOSED)return;ce(this,Se,this.CONNECTING);const s=new In("error",{code:e,message:t});(r=Y(this,lt))==null||r.call(this,s),this.dispatchEvent(s),ce(this,ut,setTimeout(Y(this,Qr),Y(this,vt)))},Qr=new WeakMap,fr.CONNECTING=0,fr.OPEN=1,fr.CLOSED=2;function mi(){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 _r(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?{..._r(e.headers),..._r(s.headers)}:e.headers};return t(r,a)}:t}class yi extends Error{constructor(e,r,s){super(`SSE error: ${r}`),this.code=e,this.event=s}}class _i{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 Me("No auth provider");let e;try{e=await Xe(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 Me;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=_r(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 fr(this._url.href,{...this._eventSourceInit,fetch:async(a,n)=>{const c=await this._commonHeaders();c.set("Accept","text/event-stream");const o=await e(a,{...n,headers:c});if(o.status===401&&o.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:m}=hr(o);this._resourceMetadataUrl=u,this._scope=m}return o}}),this._abortController=new AbortController,this._eventSource.onerror=a=>{if(a.code===401&&this._authProvider){this._authThenStart().then(r,s);return}const n=new yi(a.code,a.message,a);s(n),this.onerror?.(n)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",a=>{const n=a;try{if(this._endpoint=new URL(n.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(c){s(c),this.onerror?.(c),this.close();return}r()}),this._eventSource.onmessage=a=>{const n=a;let c;try{c=gt.parse(JSON.parse(n.data))}catch(o){this.onerror?.(o);return}this.onmessage?.(c)}})}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 Me("No auth provider");if(await Xe(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Me("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:c,scope:o}=hr(a);if(this._resourceMetadataUrl=c,this._scope=o,await Xe(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Me;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 gi="mcp";class vi{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,gi),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=gt.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 wi extends TransformStream{constructor({onError:e,onRetry:r,onComment:s}={}){let a;super({start(n){a=Wn({onEvent:c=>{n.enqueue(c)},onError(c){e==="terminate"?n.error(c):typeof e=="function"&&e(c)},onRetry:r,onComment:s})},transform(n){a.feed(n)}})}}const bi={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class at extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class $i{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??bi}async _authThenStart(){if(!this._authProvider)throw new Me("No auth provider");let e;try{e=await Xe(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 Me;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=_r(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 at(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 c,o=!1,u=!1;(async()=>{try{const h=e.pipeThrough(new TextDecoderStream).pipeThrough(new wi({onRetry:y=>{this._serverRetryMs=y}})).getReader();for(;;){const{value:y,done:v}=await h.read();if(v)break;if(y.id&&(c=y.id,o=!0,a?.(y.id)),!!y.data&&(!y.event||y.event==="message"))try{const b=gt.parse(JSON.parse(y.data));mt(b)&&(u=!0,n!==void 0&&(b.id=n)),this.onmessage?.(b)}catch(b){this.onerror?.(b)}}(s||o)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:c,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:c,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 Me("No auth provider");if(await Xe(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Me("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:Vr(e)?e.id:void 0}).catch(_=>this.onerror?.(_));return}const n=await this._commonHeaders();n.set("content-type","application/json"),n.set("accept","application/json, text/event-stream");const c={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,c),u=o.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!o.ok){const _=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new at(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:y,scope:v}=hr(o);if(this._resourceMetadataUrl=y,this._scope=v,await Xe(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Me;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){const{resourceMetadataUrl:y,scope:v,error:b}=hr(o);if(b==="insufficient_scope"){const l=o.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===l)throw new at(403,"Server returned 403 after trying upscoping");if(v&&(this._scope=v),y&&(this._resourceMetadataUrl=y),this._lastUpscopingHeader=l??void 0,await Xe(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Me;return this.send(e)}}throw new at(o.status,`Error POSTing to endpoint: ${_}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),Fa(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(_=>this.onerror?.(_));return}const h=(Array.isArray(e)?e:[e]).filter(_=>"method"in _&&"id"in _&&_.id!==void 0).length>0,S=o.headers.get("content-type");if(h)if(S?.includes("text/event-stream"))this._handleSseStream(o.body,{onresumptiontoken:a},!1);else if(S?.includes("application/json")){const _=await o.json(),y=Array.isArray(_)?_.map(v=>gt.parse(v)):[gt.parse(_)];for(const v of y)this.onmessage?.(v)}else throw await o.body?.cancel(),new at(-1,`Unexpected content type: ${S}`);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 at(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 Si extends $i{constructor(e,r){super(e,r)}send(e,r){const s=Ei(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,r)}}function Ei(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 ki extends fi{constructor(e,r){super(e,r)}async listTools(e,r){return await this.request({method:"tools/list",params:e},jn,r)}}const Ti=async(t,e,r)=>{const s=Pi(t.connection,e,r);if(!s)throw new Error("Unknown MCP connection type");const a=new ki({name:t?.name??"MCP Client",version:"1.0.0"});return await a.connect(s),{client:a,callStreamableTool:(n,c)=>{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,S]of Object.entries(t.connection.headers??{}))o.set(h,S);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(c),headers:o})}}},Pi=(t,e,r)=>{if(t.type==="Websocket")return new vi(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:(c,o)=>fetch(c,{...o,headers:{...a,Accept:"text/event-stream"},signal:e})}),new _i(new URL(t.url),n)}return new Si(new URL(t.url),{requestInit:{headers:a,signal:e,credentials:"include"}})},Ii=t=>{try{return JSON.parse(t)}catch{return t}},ur=new Map,Cn=(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 Ri(t){const e=r=>"connection"in t?Ti({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?.(),S=h?{"x-trace-debug-id":h}:void 0,{client:_,callStreamableTool:y}=await e(S);if(t?.streamable?.[String(m)])return y(String(m),u);const{structuredContent:v,isError:b,content:l}=await _.callTool({name:String(m),arguments:u});if(b){const p=l?.[0]?.text,i=typeof p=="string"?Ii(p):null,d=i?.code&&typeof t?.getErrorByStatusCode=="function"?t.getErrorByStatusCode(i.code,i.message,i.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 c(){if(!("connection"in t))return n();const u=t.connection,m=JSON.stringify(u);try{return ur.has(m)||ur.set(m,n()),await ur.get(m)}catch(h){console.error("Failed to list tools",h),ur.delete(m);return}}async function o(){return(await c()??[]).map(m=>Cn(m,a))}return a.asTool=async()=>{const m=(await c()??[]).find(h=>h.name===s);if(!m)throw new Error(`Tool ${s} not found`);return Cn(m,a)},a}})}new Proxy({},{get(t,e){return e==="toJSON"?null:e==="forConnection"?r=>Oi({connection:r}):global[e]}});function Oi(t){return Ri(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 Ye=j({id:O().describe("Unique identifier for the entity"),title:O().describe("Human-readable title for the entity"),description:O().nullish().describe("Description of the entity"),created_at:O().datetime(),updated_at:O().datetime(),created_by:O().optional(),updated_by:O().optional()}),Ci=j({field:te(O()),operator:Te(["eq","gt","gte","lt","lte","in","like","contains"]),value:pe()}),Zn=Xr(()=>ue([Ci,j({operator:Te(["and","or","not"]),conditions:te(Zn)})])),Ni=j({field:te(O()),direction:Te(["asc","desc"]),nulls:Te(["first","last"]).optional()}),qi=j({where:Zn.optional().describe("Filter expression"),orderBy:te(Ni).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 Mi(t){return j({items:te(t).describe("Array of collection items"),totalCount:J().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:me().optional().describe("Whether there are more items available")})}const Ai=j({id:O().describe("ID of the entity to retrieve")});function ji(t){return j({item:t.nullable().describe("The retrieved item, or null if not found")})}function Di(t){return j({data:t.partial().describe("Data for the new entity (id may be auto-generated)")})}function Li(t){return j({item:t.describe("The created entity with generated id")})}function Ui(t){return j({id:O().describe("ID of the entity to update"),data:t.partial().describe("Partial entity data to update")})}function Fi(t){return j({item:t.describe("The updated entity")})}const zi=j({id:O().describe("ID of the entity to delete")});function Vi(t){return j({item:t.describe("The deleted entity")})}function et(t,e,r){const s=t.toUpperCase(),a=r?.readOnly??!1,n=[{name:`COLLECTION_${s}_LIST`,inputSchema:qi,outputSchema:Mi(e)},{name:`COLLECTION_${s}_GET`,inputSchema:Ai,outputSchema:ji(e)}];return a||n.push({name:`COLLECTION_${s}_CREATE`,inputSchema:Di(e),outputSchema:Li(e),opt:!0},{name:`COLLECTION_${s}_UPDATE`,inputSchema:Ui(e),outputSchema:Fi(e),opt:!0},{name:`COLLECTION_${s}_DELETE`,inputSchema:zi,outputSchema:Vi(e),opt:!0}),n}const Hi=j({id:O(),name:O(),description:O().optional(),inputSchema:ye(pe()),outputSchema:ye(pe()).optional()}),xi=Ye.extend({_meta:j({"io.decocms":j({id:O(),verified:me(),scopeName:O(),appName:O(),friendlyName:O().nullable().optional(),metadata:ye(pe()).nullable().optional(),publishedAt:O().datetime().optional(),updatedAt:O().datetime().optional(),tools:te(Hi).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:j({$schema:O().optional(),_meta:ye(pe()).optional(),name:O().describe("The server name (scope/app)"),title:O().optional().describe("User-friendly title"),description:O().optional().describe("Server description"),icons:te(j({src:O(),mimeType:O().optional(),sizes:te(O()).optional(),theme:Te(["light","dark"]).optional()})).optional(),remotes:te(j({type:Te(["http","stdio","sse"]),url:O().optional(),headers:te(pe()).optional()})).optional(),packages:te(pe()).optional(),repository:j({url:O(),source:O().optional(),subfolder:O().optional()}).optional(),version:O().optional(),websiteUrl:O().optional()})});et("registry_app",xi,{readOnly:!0});const Ki=j({specversion:ie("1.0").describe("CloudEvents specification version"),id:O().describe("Unique identifier for this event (UUID recommended)"),source:O().describe("Connection ID of the event publisher"),type:O().describe("Event type (e.g., 'order.created', 'user.signup')"),time:O().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:O().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:O().optional().default("application/json").describe("Content type of the data attribute"),dataschema:O().url().optional().describe("URI to the schema for the data attribute"),data:pe().optional().describe("Event payload (any JSON value)")});j({events:te(Ki).min(1).describe("Batch of CloudEvents to process")});const Wi=j({success:me().optional().describe("Whether this event was processed successfully"),error:O().optional().describe("Error message for this event"),retryAfter:J().int().positive().optional().describe("Re-deliver this event after this many ms")});j({success:me().optional().describe("Batch success - applies to events not in results"),error:O().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:ye(O(),Wi).optional().describe("Per-event results keyed by event ID")});j({type:O().min(1).max(255).describe("Event type identifier"),subject:O().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:pe().optional().describe("Event payload"),deliverAt:O().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:O().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")});j({id:O().describe("Unique event ID"),type:O().describe("Event type"),source:O().describe("Source connection ID"),time:O().describe("Event timestamp")});j({eventType:O().min(1).max(255).describe("Event type to subscribe to"),publisher:O().optional().describe("Filter events by publisher connection ID"),filter:O().max(1e3).optional().describe("JSONPath filter expression on event data")});j({subscription:j({id:O().describe("Subscription ID"),connectionId:O().describe("Subscriber connection ID"),eventType:O().describe("Event type pattern"),publisher:O().nullable().describe("Publisher connection filter"),filter:O().nullable().describe("JSONPath filter expression"),enabled:me().describe("Whether subscription is enabled"),createdAt:ue([O(),bt()]).describe("Created timestamp"),updatedAt:ue([O(),bt()]).describe("Updated timestamp")})});const Gi=j({eventType:O().min(1).max(255).describe("Event type to subscribe to"),publisher:O().optional().describe("Filter events by publisher connection ID"),filter:O().max(1e3).optional().describe("JSONPath filter expression on event data")}),Ji=j({id:O().describe("Subscription ID"),connectionId:O().describe("Subscriber connection ID"),eventType:O().describe("Event type pattern"),publisher:O().nullable().describe("Publisher connection filter"),filter:O().nullable().describe("JSONPath filter expression"),enabled:me().describe("Whether subscription is enabled"),createdAt:ue([O(),bt()]).describe("Created timestamp"),updatedAt:ue([O(),bt()]).describe("Updated timestamp")});j({subscriptions:te(Gi).describe("Desired subscriptions - system will create/update/delete to match")});j({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:te(Ji).describe("Current subscriptions after sync")});j({subscriptionId:O().describe("Subscription ID to remove")});j({success:me().describe("Whether unsubscribe was successful"),subscriptionId:O().describe("Subscription ID that was removed")});j({eventId:O().describe("Event ID to cancel")});j({success:me().describe("Whether cancellation was successful"),eventId:O().describe("Event ID that was cancelled")});j({eventId:O().describe("Event ID to acknowledge")});j({success:me().describe("Whether ACK was successful"),eventId:O().describe("Event ID that was acknowledged")});const Bi=Ye.extend({avatar:O().describe("URL or data URI to the assistant's avatar image"),system_prompt:O().describe("System prompt that defines the assistant's behavior"),gateway_id:O().describe("Gateway ID to use for this assistant"),model:j({id:O().describe("Model ID"),connectionId:O().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),Zi=et("assistant",Bi),Qi=[...Zi],$t=Xr(()=>ue([zr(),O(),J(),me(),ye(O(),$t),te($t)])),ze=ye(O(),ye(O(),$t)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),Qn=j({type:ie("text"),text:O().describe("The text content"),providerOptions:ze}),Xi=ue([O(),ua(Uint8Array)]).describe("File data as base64 encoded string, URL string, or Uint8Array"),Xn=j({type:ie("file"),filename:O().optional().describe("Optional filename of the file"),data:Xi,mediaType:O().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:ze}),Yi=j({type:ie("reasoning"),text:O().describe("The reasoning text"),providerOptions:ze}),ec=j({type:ie("tool-call"),toolCallId:O().describe("ID of the tool call, used to match with tool result"),toolName:O().describe("Name of the tool being called"),input:pe().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:me().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:ze}),tc=ue([j({type:ie("text"),value:O()}),j({type:ie("json"),value:$t}),j({type:ie("error-text"),value:O()}),j({type:ie("error-json"),value:$t}),j({type:ie("content"),value:te(ue([j({type:ie("text"),text:O().describe("Text content")}),j({type:ie("media"),data:O().describe("Base-64 encoded media data"),mediaType:O().describe("IANA media type")})]))})]),Yn=j({type:ie("tool-result"),toolCallId:O().describe("ID of the tool call that this result is associated with"),toolName:O().describe("Name of the tool that generated this result"),output:tc.describe("Result of the tool call"),providerOptions:ze}),rc=j({role:ie("system"),content:O().describe("System message content"),providerOptions:ze}),sc=j({role:ie("user"),content:te(ue([Qn,Xn])).describe("User message content parts (text or file)"),providerOptions:ze}),nc=j({role:ie("assistant"),content:te(ue([Qn,Xn,Yi,ec,Yn])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:ze}),ac=j({role:ie("tool"),content:te(Yn).describe("Tool message content (tool results)"),providerOptions:ze}),oc=ue([rc,sc,nc,ac]),ic=te(oc).describe("A list of messages forming the prompt"),cc=j({prompt:ic.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:te(O()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:ue([j({type:ie("text")}),j({type:ie("json"),schema:Ee().optional().describe("JSON schema that the generated output should conform to"),name:O().optional().describe("Name of output that should be generated"),description:O().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:te(Ee()).optional().describe("The tools that are available for the model"),toolChoice:Ee().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:me().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:Ee().optional().describe("Abort signal for cancelling the operation"),headers:ye(O(),ue([O(),ca()])).optional().describe("Additional HTTP headers to be sent with the request"),providerOptions:Ee().optional().describe("Additional provider-specific options")}),uc=j({content:te(Ee()).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:Te(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:j({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:Ee().optional().describe("Additional provider-specific metadata"),request:j({body:Ee().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:j({id:O().optional().describe("ID for the generated response"),timestamp:bt().optional().describe("Timestamp for the start of the generated response"),modelId:O().optional().describe("The ID of the response model that was used"),headers:ye(O(),O()).optional().describe("Response headers"),body:Ee().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:te(Ee()).describe("Warnings for the call, e.g. unsupported settings")});j({stream:Ee().describe("ReadableStream of LanguageModelV2StreamPart"),request:j({body:Ee().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:j({headers:ye(O(),O()).optional().describe("Response headers")}).optional().describe("Optional response data")});const lc=j({supportedUrls:ye(O(),te(O())).describe("Supported URL patterns by media type for the provider")});j({modelId:O().describe("The ID of the model"),logo:O().nullable(),description:O().nullable(),capabilities:te(O()),limits:j({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:j({input:J(),output:J()}).nullable(),provider:Te(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const Nn=j({modelId:O().describe("The ID of the model"),callOptions:cc}),dc=Ye.extend({logo:O().nullable(),description:O().nullable(),capabilities:te(O()),limits:j({contextWindow:J(),maxOutputTokens:J()}).nullable(),costs:j({input:J(),output:J()}).nullable(),provider:Te(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),fc=et("llm",dc,{readOnly:!0}),hc=[{name:"LLM_METADATA",inputSchema:j({modelId:O().describe("The ID of the model")}),outputSchema:lc},{name:"LLM_DO_STREAM",inputSchema:Nn,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:Nn,outputSchema:uc},...fc],pc=j({scopes:te(O()).describe("List of scopes available"),stateSchema:ye(O(),pe()).describe("JSON Schema (draft-07) defining the state structure")}),mc=[{name:"MCP_CONFIGURATION",inputSchema:j({}),outputSchema:pc}],yc=j({toolName:O().describe("Name of the tool to invoke on that connection"),transformCode:O().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.")}),_c=j({code:O().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 { ... }\`
|
|
17
|
-
The input is the resolved value of the references in the input field. Example:
|
|
18
|
-
{
|
|
19
|
-
"input": {
|
|
20
|
-
"name": "@Step_1.name",
|
|
21
|
-
"age": "@Step_2.age"
|
|
22
|
-
},
|
|
23
|
-
"code": "export default function(input): Output { return { result: \`\${input.name} is \${input.age} years old.\` } }"
|
|
24
|
-
}
|
|
25
|
-
`)});j({signalName:O().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")});const gc=ue([yc.describe("Call an external tool via MCP connection. "),_c.describe("Run pure TypeScript code for data transformation. Useful to merge data from multiple steps and transform it.")]),vc=j({maxAttempts:J().optional().describe("Max retry attempts on failure (default: 1, no retries)"),backoffMs:J().optional().describe("Initial delay between retries in ms (doubles each attempt)"),timeoutMs:J().optional().describe("Max execution time in ms before step fails (default: 30000)")}),ea=Xr(()=>j({type:O().optional(),properties:ye(pe()).optional(),required:te(O()).optional(),description:O().optional(),additionalProperties:me().optional(),additionalItems:me().optional(),items:ea.optional()}).passthrough()),ta=j({name:O().min(1).describe("Unique identifier for this step. Other steps reference its output as @name.field"),description:O().optional().describe("What this step does"),action:gc,input:ye(pe()).optional().describe("Data passed to the action. Use @ref for dynamic values: @input.field (workflow input), @stepName.field (previous step output), @item/@index (loop context). Example: { 'userId': '@input.user_id', 'data': '@fetch.result' }"),outputSchema:ea.optional().describe("Optional JSON Schema describing the expected output of the step."),config:vc.optional().describe("Retry and timeout settings")}),wc=Te(["enqueued","running","success","error","failed","cancelled"]).default("enqueued"),ra=Ye.extend({steps:te(ta).describe("Steps that make up the workflow").describe("Workflow that was executed"),gateway_id:O().describe("ID of the gateway that will be used to execute the workflow"),status:wc.describe("Current status of the workflow execution"),input:ye(pe()).optional().describe("Input data for the workflow execution"),output:pe().optional().describe("Output data for the workflow execution"),completed_at_epoch_ms:J().nullish().describe("Timestamp of when the workflow execution completed"),start_at_epoch_ms:J().nullish().describe("Timestamp of when the workflow execution started or will start"),timeout_ms:J().nullish().describe("Timeout in milliseconds for the workflow execution"),deadline_at_epoch_ms:J().nullish().describe("Deadline for the workflow execution - when the workflow execution will be cancelled if it is not completed. This is read-only and is set by the workflow engine when an execution is created."),error:pe().describe("Error that occurred during the workflow execution")}),bc=Te(["signal","timer","message","output","step_started","step_completed","workflow_started","workflow_completed"]);Ye.extend({execution_id:O(),type:bc,name:O().nullish(),payload:pe().optional(),visible_at:J().nullish(),consumed_at:J().nullish(),source_execution_id:O().nullish()});const $c=Ye.extend({description:O().optional().describe("Human-readable summary of what this workflow does"),steps:te(ta).describe("Ordered list of steps. Execution order is auto-determined by @ref dependencies: steps with no @ref dependencies run in parallel; steps referencing @stepName wait for that step to complete.")}),Sc=et("workflow",$c),Ec={maxAttempts:1,timeoutMs:3e4},Uc={name:"Initial Step",action:{code:`
|
|
26
|
-
interface Input {
|
|
27
|
-
example: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface Output {
|
|
31
|
-
result: unknown;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default async function(input: Input): Promise<Output> {
|
|
35
|
-
return {
|
|
36
|
-
result: input.example
|
|
37
|
-
}
|
|
38
|
-
}`},config:Ec,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."}},kc=et("workflow_execution",ra),Tc=[...Sc,...kc],Pc=[...Tc],Ic=et("workflow_execution",ra),qn={LLMS:hc,WORKFLOW:Pc,WORKFLOW_EXECUTION:Ic,ASSISTANTS:Qi,MCP:mc};function Rc(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),j({})}})():j({}),outputSchema:e.outputSchema?(()=>{try{return Fe(e.outputSchema)}catch(r){return console.error(`Failed to convert output schema for ${e.name}:`,r),j({})}})():j({})}))}function Oc(t,e){const r=t.tools;if(!r||r.length===0)return!1;const s=r.map(c=>({name:c.name,inputSchema:c.inputSchema})),a=e.map(c=>({name:c.name,inputSchema:c.inputSchema,opt:c.opt}));return Bn(a).isImplementedBy(s)}function Fc({connections:t,binding:e}){const r=(()=>{if(e){if(typeof e=="string"){const s=e.toUpperCase(),a=qn[s];if(!a){console.warn(`[useBindingConnections] Unknown binding "${e}". Available bindings: ${Object.keys(qn).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 Rc(e)}})();return t?r?t.filter(s=>Oc(s,r)):t:[]}function Cc(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 Nc(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 qc(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 Mc(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=et(s.toLowerCase(),Ye,{readOnly:!0}),n=t.map(m=>({name:m.name,inputSchema:m.inputSchema})),c=a.map(m=>({name:m.name,inputSchema:m.inputSchema}));if(Bn(c).isImplementedBy(n)){const m=qc(t,s);r.push({name:s,displayName:Cc(s),schema:Nc(t,s),...m})}}catch{}return r}function zc(t){return Mc(t?.tools??null)}function Vc(t){return t?t.filter(e=>sa(e.tools).find(r=>r==="REGISTRY_APP")):[]}export{Bi as A,Ye as B,Uc as D,wi as E,Vc as a,zc as b,Kn as c,Q as d,ei as e,Va as f,Dc as p,io as r,Ze as s,Fc as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{at as u,ap as s}from"./index-Cvm_GyUI.js";function t(e,r){return u(e,s,r)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aL as t,Q as a}from"./index-Cvm_GyUI.js";function e(...r){return t(a(r))}export{e as c};
|