yaml-flow 8.5.3 → 8.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/asset-integrity.json +3 -3
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +266 -5
- package/examples/board/server/board-worker/task-executor.js +166 -51
- package/examples/board/server/chat-flow/copilot-chat/assistant.js +25 -12
- package/examples/board/server/chat-flow/copilot-chat/probe.js +7 -0
- package/examples/board/server/chat-flow/copilot-chat/shared.js +97 -0
- package/examples/board/server/chat-flow/flow-steps.json +109 -51
- package/examples/board/server-config.json +1 -0
- package/examples/board/test/server-http-test.js +870 -67
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-D-k-E8Vy.d.ts → artifacts-store-lib-C1rtrkxm.d.ts} +1 -1
- package/lib/{artifacts-store-lib-CVgtQrNZ.d.cts → artifacts-store-lib-CLOtsiav.d.cts} +1 -1
- package/lib/artifacts-store-public.cjs +1 -1
- package/lib/artifacts-store-public.d.cts +3 -3
- package/lib/artifacts-store-public.d.ts +3 -3
- package/lib/artifacts-store-public.js +1 -1
- package/lib/batch/index.cjs +1 -1
- package/lib/batch/index.js +1 -1
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +35 -15
- package/lib/board-live-cards-mcp.d.ts +35 -15
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +8 -16
- package/lib/board-live-cards-node.d.cts +32 -12
- package/lib/board-live-cards-node.d.ts +32 -12
- package/lib/board-live-cards-node.js +8 -16
- package/lib/{board-live-cards-public-BGS22cMb.d.ts → board-live-cards-public-CBVjm327.d.ts} +59 -24
- package/lib/{board-live-cards-public-B13InXhC.d.cts → board-live-cards-public-CPJy-aGW.d.cts} +59 -24
- package/lib/board-live-cards-public.cjs +1 -2
- package/lib/board-live-cards-public.d.cts +2 -2
- package/lib/board-live-cards-public.d.ts +2 -2
- package/lib/board-live-cards-public.js +1 -2
- package/lib/board-live-cards-server-runtime.cjs +1 -7
- package/lib/board-live-cards-server-runtime.d.cts +5 -5
- package/lib/board-live-cards-server-runtime.d.ts +5 -5
- package/lib/board-live-cards-server-runtime.js +1 -7
- package/lib/board-livegraph-runtime/index.cjs +1 -2
- package/lib/board-livegraph-runtime/index.js +1 -2
- package/lib/board-worker-adapter.cjs +21 -7
- package/lib/board-worker-adapter.d.cts +17 -2
- package/lib/board-worker-adapter.d.ts +17 -2
- package/lib/board-worker-adapter.js +21 -7
- package/lib/card-compute/index.cjs +1 -9
- package/lib/card-compute/index.js +1 -9
- package/lib/card-store-public.cjs +1 -1
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/card-store-public.js +1 -1
- package/lib/card-validation.cjs +1 -9
- package/lib/card-validation.js +1 -9
- package/lib/{chat-storage-lib-CJn7a6OH.d.ts → chat-storage-lib-Bce-xx6l.d.ts} +1 -1
- package/lib/{chat-storage-lib-0imhRX3l.d.cts → chat-storage-lib-CKylihjm.d.cts} +1 -1
- package/lib/chat-store-public.cjs +1 -1
- package/lib/chat-store-public.d.cts +3 -3
- package/lib/chat-store-public.d.ts +3 -3
- package/lib/chat-store-public.js +1 -1
- package/lib/chunk-2MZUYY65.cjs +2 -0
- package/lib/chunk-5DB54ZX2.cjs +2 -0
- package/lib/chunk-5EA2ESS4.cjs +16 -0
- package/lib/chunk-6APH25VI.js +2 -0
- package/lib/chunk-76ON3V7R.js +2 -0
- package/lib/chunk-7BKNHFNH.js +2 -0
- package/lib/chunk-CWREBRXS.js +3 -0
- package/lib/chunk-DAXACY63.js +2 -0
- package/lib/chunk-FW4363Y4.js +2 -0
- package/lib/chunk-FZ2SBU5M.js +3 -0
- package/lib/chunk-G4XXRHL2.cjs +3 -0
- package/lib/chunk-GNFE24S7.cjs +2 -0
- package/lib/chunk-GYQXDNNI.cjs +2 -0
- package/lib/chunk-H5KD3JPY.cjs +2 -0
- package/lib/chunk-HLJH7LGW.js +16 -0
- package/lib/chunk-I4WH5U5D.cjs +2 -0
- package/lib/chunk-IXZG74EW.cjs +2 -0
- package/lib/chunk-JAL25FGA.cjs +2 -0
- package/lib/chunk-JM5EKT57.js +2 -0
- package/lib/chunk-JMDHDY6M.js +2 -0
- package/lib/chunk-KBELAKIY.js +2 -0
- package/lib/chunk-KHJABJ45.cjs +3 -0
- package/lib/chunk-KLRUISRY.cjs +2 -0
- package/lib/chunk-KNFFDVLD.cjs +2 -0
- package/lib/chunk-LBMEVV4U.js +2 -0
- package/lib/chunk-LDAP75GN.js +2 -0
- package/lib/chunk-LODXIALE.cjs +2 -0
- package/lib/chunk-LVNQCE5X.cjs +3 -0
- package/lib/chunk-M7EQRS6W.js +3 -0
- package/lib/chunk-MNEOJWPS.js +10 -0
- package/lib/chunk-NJJ7WEDT.cjs +2 -0
- package/lib/chunk-NMZ6XNLB.cjs +3 -0
- package/lib/chunk-OPNGCSXJ.js +2 -0
- package/lib/chunk-P64UKI3L.cjs +8 -0
- package/lib/chunk-P7ZCDICS.cjs +2 -0
- package/lib/chunk-Q6H7NINN.cjs +5 -0
- package/lib/chunk-Q6VSL327.js +8 -0
- package/lib/chunk-QWBNDVUA.js +5 -0
- package/lib/chunk-S6DRP2HX.cjs +2 -0
- package/lib/chunk-UJ7ZTV4J.cjs +10 -0
- package/lib/chunk-UVE65IPR.cjs +3 -0
- package/lib/chunk-VCCTAUIG.js +2 -0
- package/lib/chunk-VGT3TRQG.js +3 -0
- package/lib/chunk-VLBB3D6B.js +3 -0
- package/lib/chunk-WDPOGXTY.js +2 -0
- package/lib/chunk-X3LC4LII.js +2 -0
- package/lib/chunk-YGKDQLYP.js +2 -0
- package/lib/chunk-YMEIPKLW.cjs +2 -0
- package/lib/config/index.cjs +1 -1
- package/lib/config/index.js +1 -1
- package/lib/continuous-event-graph/index.cjs +1 -2
- package/lib/continuous-event-graph/index.js +1 -2
- package/lib/event-graph/index.cjs +1 -22
- package/lib/event-graph/index.js +1 -22
- package/lib/execution-refs.cjs +1 -2
- package/lib/execution-refs.d.cts +3 -2
- package/lib/execution-refs.d.ts +3 -2
- package/lib/execution-refs.js +1 -2
- package/lib/index.cjs +2 -24
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -24
- package/lib/server-runtime/index.cjs +1 -7
- package/lib/server-runtime/index.d.cts +6 -6
- package/lib/server-runtime/index.d.ts +6 -6
- package/lib/server-runtime/index.js +1 -7
- package/lib/step-machine/index.cjs +1 -11
- package/lib/step-machine/index.js +1 -11
- package/lib/step-machine-public/index.cjs +1 -4
- package/lib/step-machine-public/index.d.cts +1 -1
- package/lib/step-machine-public/index.d.ts +1 -1
- package/lib/step-machine-public/index.js +1 -4
- package/lib/{storage-interface-B2WD9D5n.d.cts → storage-interface-Ct-C4tlz.d.cts} +28 -1
- package/lib/{storage-interface-B2WD9D5n.d.ts → storage-interface-Ct-C4tlz.d.ts} +28 -1
- package/lib/stores/index.cjs +1 -2
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -2
- package/lib/stores/kv.cjs +1 -2
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/lib/stores/kv.js +1 -2
- package/lib/stores/memory.cjs +1 -1
- package/lib/stores/memory.js +1 -1
- package/lib/{types-30R357js.d.ts → types-BuK2UMxk.d.ts} +4 -4
- package/lib/{types-CIgsh56O.d.cts → types-DRl0Hy_p.d.cts} +4 -4
- package/package.json +2 -16
- package/cli/board-live-cards-lib-COi4bSpk.d.ts +0 -322
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +0 -36
- package/cli/browser-api/board-live-cards-browser-adapter.js +0 -4
- package/cli/browser-api/card-store-browser-api.d.ts +0 -25
- package/cli/browser-api/card-store-browser-api.js +0 -2
- package/cli/browser-api/jsonata-sync.cjs +0 -7623
- package/cli/bundled/artifacts-store-cli.mjs +0 -12
- package/cli/bundled/batch-runner-cli.mjs +0 -3
- package/cli/bundled/board-live-cards-cli.mjs +0 -29
- package/cli/bundled/card-store-cli.mjs +0 -154
- package/cli/bundled/chat-store-cli.mjs +0 -16
- package/cli/bundled/jsonata-sync.cjs +0 -7623
- package/cli/bundled/step-machine-cli.mjs +0 -150
- package/cli/execution-interface-BCIhu1gO.d.ts +0 -442
- package/cli/types-H3EMBPY2.d.ts +0 -398
- package/examples/board/server/README-mcp-api.md +0 -690
- package/examples/board/test/server-http-mcp-test.js +0 -1280
- package/lib/board-livegraph-runtime/jsonata-sync.cjs +0 -7623
- package/lib/card-compute/jsonata-sync.cjs +0 -7623
- package/lib/continuous-event-graph/jsonata-sync.cjs +0 -7623
- package/lib/server-runtime/jsonata-sync.cjs +0 -7623
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {b,c,e as e$1,d}from'./chunk-6APH25VI.js';import {e,f,a as a$2}from'./chunk-M7EQRS6W.js';import {b as b$1}from'./chunk-CWREBRXS.js';import {a as a$3}from'./chunk-VCCTAUIG.js';import {a as a$1}from'./chunk-KBELAKIY.js';import {a}from'./chunk-76ON3V7R.js';var be={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"content-type,x-file-name","Access-Control-Allow-Methods":"GET,POST,PATCH,OPTIONS"},Ye=32;function tr(){return {status:null,computedValues:{},dataObjects:{},cards:{}}}function we(m){if(!m||typeof m!="object")return false;let y=m.summary;return !y||typeof y!="object"?false:Number(y.card_count||0)>0}function Ce(m,y){if(!y||typeof y!="object")return;let w=y;if(w.kind==="notification-batch"&&Array.isArray(w.notifications)){for(let _ of w.notifications)Ce(m,_);return}w.kind==="status"&&we(w.status)&&(m.status=w.status),w.kind==="computed_values"&&w.cardId&&(m.computedValues[w.cardId]=w.values),w.kind==="data_object"&&w.key&&(m.dataObjects[w.key]=w.payload),w.kind==="card_refreshed"&&w.cardId&&(m.cards[w.cardId]=w.card),w.kind==="card_removed"&&w.cardId&&(delete m.cards[w.cardId],delete m.computedValues[w.cardId]);}function lr(m){let y=String(m.apiBasePath||"/api/board").replace(/\/$/,""),w={...be,...m.corsHeaders||{}},_=m.boardId||"",j=m.logger||{info:console.log,warn:console.warn,error:console.error},z=m.invocationAdapter,st=m.chatFlowRunner||null,B=m.chatStorage??b(),at=a(B),it=m.notificationTransport||null,Y=m.serverUrl||null,J=m.executionExtra||{},Ct=m.onSseClientConnected,Rt=m.onSseClientDisconnected,kt=m.onChannelSubscribed,St=m.onChannelUnsubscribed,p=new Map,k=new Map,I=new Map,$=null;function M(t){let e$1=e(t.baseRef,t.boardAdapter),r=t.nonCoreAdapter??(K(t.boardAdapter)?t.boardAdapter:null),n=r?f(t.baseRef,r):null,o=t.boardAdapter.kvStorageForRef(t.cardStoreRef),a=a$1(a$2({readIndex:()=>o.read("_index"),writeIndex:b=>o.write("_index",b),readCard:b=>o.read(b),writeCard:(b,O)=>(o.write(b,O),b),removeCard:b=>{o.delete(b);},cardExists:b=>o.read(b)!==null,defaultCardKey:b=>b},j.warn)),i=t.artifactsAdapter||t.boardAdapter,u=t.filesArtifactsStore??null,C=t.artifactsAdapter?i.blobStorage(""):i.blobStorage("files"),h=null;return {label:t.label,board:e$1,nonCore:n,cardStore:a,get filesArtifacts(){return h??=u??c(C)},boardAdapter:t.boardAdapter,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,artifactsStoreRef:t.artifactsStoreRef,scratchStoreRef:t.scratchStoreRef,archiveStoreRef:t.archiveStoreRef,notifyRef:t.notifyRef,taskExecutorRef:t.taskExecutorRef,chatHandlerRef:t.chatHandlerRef,chatHandlerFlow:t.chatHandlerFlow,inferenceAdapterRef:t.inferenceAdapterRef,notification:tr(),notificationTeardown:null,initialized:false,cardsBootstrapped:false}}let S=m.boards.map(M),G=new Map;function N(t){return G.get(t)??0}function K(t){let e=t;return typeof e.invokeExecutor=="function"&&typeof e.validateSchema=="function"}function tt(t){let e=S[N(t)];return {files:e?e.filesArtifacts:null}}function At(t){let e=tt(t);return e.files?d(e.files):null}function D(){return e$1()}function L(t){return String(t||"").replace(/[^a-zA-Z0-9_-]/g,"_")||"unknown-card"}async function ct(t){if(!t||t.notificationTeardown||!it||!t.notifyRef)return;let e=await it.subscribe(t.notifyRef,r=>{Ce(t.notification,r);let n=r.kind==="notification-batch"?r.notifications:[r];oe(n);});t.notificationTeardown=e;}async function Re(t){if(!t||t.initialized)return;let e={cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef};t.artifactsStoreRef&&(e.artifactsStoreRef=t.artifactsStoreRef),t.scratchStoreRef&&(e.scratchStoreRef=t.scratchStoreRef),t.archiveStoreRef&&(e.archiveStoreRef=t.archiveStoreRef);let r={};t.taskExecutorRef&&(r["task-executor-ref"]=t.taskExecutorRef),t.chatHandlerFlow!==void 0&&(r["chat-handler-flow"]=t.chatHandlerFlow),t.inferenceAdapterRef&&(r["inference-adapter-ref"]=t.inferenceAdapterRef);let n=t.board.init({params:e,body:r});if(n.status!=="success")throw Object.assign(new Error(n.error||`init failed for ${t.label}`),{statusCode:500});if(await ct(t),!t.chatHandlerFlow&&t.chatHandlerRef&&z.describe)try{let o=await z.describe(t.chatHandlerRef);o&&o.kind!=="chat-handler"?j.warn(`[init] chat-handler describe returned kind="${o.kind}", expected "chat-handler" for ${t.label}`):o&&j.info(`[init] chat-handler validated: ${o.name} (protocol ${o.protocolVersion}) for ${t.label}`);}catch(o){j.warn(`[init] chat-handler describe failed for ${t.label}: ${o?.message||String(o)}`);}t.initialized=true;}function Ft(t){if(!t.boardAdapter.publishBoardChangeNotifications)return;let e=[],r=t.board.status({});r.status==="success"&&r.data!=null&&we(r.data)&&e.push({kind:"status",status:r.data});let n=t.board.getAllOutputsDataObjects({});if(n.status==="success"&&n.data!=null)for(let[s,a]of Object.entries(n.data))s&&e.push({kind:"data_object",key:s,payload:a});let o=t.board.getAllOutputsComputedValues({});if(o.status==="success"&&o.data!=null)for(let[s,a]of Object.entries(o.data))s&&e.push({kind:"computed_values",cardId:s,values:a});e.length>0&&t.boardAdapter.publishBoardChangeNotifications(e);}function Mt(t,e){if(!t||t.cardsBootstrapped)return;let r=t.cardStore.get({}),n=r.status==="success"&&Array.isArray(r.data?.cards)?r.data.cards:[];for(let o of n)typeof o.id=="string"&&(G.set(o.id,e),t.board.upsertCard({params:{cardId:o.id}}));t.cardsBootstrapped=true;}async function ft(){for(let t of S)await Re(t);}async function E(){await ft();for(let t=0;t<S.length;t++)Ft(S[t]),Mt(S[t],t);}function T(t){return S[N(t)]??null}function rt(t){let e=T(t);if(!e)return null;let r=e.cardStore.get({params:{id:t}});if(r.status!=="success")return null;let n=Array.isArray(r.data?.cards)?r.data.cards:[];return n.length>0?n[0]:null}function Nt(){let t=r=>{if(!r||!r.cardStore)return [];let n=r.cardStore.get({});return n.status!=="success"||!Array.isArray(n.data?.cards)?[]:n.data.cards},e=[];for(let r of S)e.push(...t(r));return e}function H(){return S[0]??null}function ke(){return {status(){let t=Ht();return t==null?{status:"fail",error:"Board status is unavailable"}:{status:"success",data:t}},getOutputsDataObject(t){let e=t?.params?.key;return e?{status:"success",data:zt()[e]}:{status:"fail",error:"getOutputsDataObject requires params.key"}},getOutputsComputedValues(t){let e=t?.params?.key;return e?{status:"success",data:Vt()[e]?.computed_values}:{status:"fail",error:"getOutputsComputedValues requires params.key"}},getOutputsFetchedSources(t){let e=t?.params?.key;if(!e)return {status:"fail",error:"getOutputsFetchedSources requires params.key"};let r=T(e)??H();return r?r.board.getOutputsFetchedSources({params:{key:e}}):{status:"fail",error:"Board context is unavailable"}},removeCard(t){let e=t?.params?.id;if(!e)return {status:"fail",error:"removeCard requires params.id"};let r=T(e)??H();return r?r.board.removeCard({params:{id:e}}):{status:"fail",error:"Board context is unavailable"}},cardRefreshedNotify(t){let e=t?.params?.cardId;if(!e)return {status:"fail",error:"cardRefreshedNotify requires params.cardId"};let r=T(e)??H();return r?r.board.cardRefreshedNotify({params:{cardId:e}}):{status:"fail",error:"Board context is unavailable"}},upsertCard(t){let e=t?.params?.cardId;if(!e)return {status:"fail",error:"upsertCard requires params.cardId"};let r=T(e)??H();return r?r.board.upsertCard({params:{cardId:e,restart:t.params.restart===true}}):{status:"fail",error:"Board context is unavailable"}}}}function Se(){let t=()=>{let e=H();if(!e?.nonCore)throw new Error("Board non-core adapter is not configured for MCP preflight/discovery tools");return e.nonCore};return {describeTaskExecutorCapabilities(e){return t().describeTaskExecutorCapabilities(e)},validateCardPreflight(e){return t().validateCardPreflight(e)},evalCardCompute(e){return t().evalCardCompute(e)},probeSourcePreflight(e){return t().probeSourcePreflight(e)},runSourcePreflight(e){return t().runSourcePreflight(e)},simulateCardCycle(e){return t().simulateCardCycle(e)}}}function gt(){return {get(t){let e=typeof t.params?.id=="string"?t.params.id:void 0;if(e){let r=rt(e);return r?{status:"success",data:{cards:[r]}}:{status:"success",data:{cards:[]}}}return {status:"success",data:{cards:Nt()}}},set(t){let e=t.body;if(e==null)return {status:"fail",error:"set requires a body (card object or array of cards)"};let r=Array.isArray(e)?e:[e];for(let n of r){let o=n,s=typeof o.id=="string"?o.id:"";if(!s)return {status:"fail",error:"each card must have a string `id` field"};let a=G.get(s)??0,i=S[a]??H();if(!i)return {status:"fail",error:"Board context is unavailable"};let u=i.cardStore.set({body:o});if(u.status!=="success")return u;G.set(s,a);}return {status:"success",data:{count:r.length}}},del(t){let e=[t.params?.id,...t.body?.ids??[]].filter(r=>typeof r=="string"&&!!r);if(e.length===0)return {status:"fail",error:"del requires body.ids (string[]) or params.id"};for(let r of e){let n=T(r)??H();if(!n)return {status:"fail",error:"Board context is unavailable"};let o=n.cardStore.del({params:{id:r}});if(o.status!=="success")return o;G.delete(r);}return {status:"success",data:{count:e.length}}},patch(t){let e=typeof t.params?.id=="string"?t.params.id:void 0,r=typeof t.params?.path=="string"?t.params.path:void 0;if(!e||!r)return {status:"fail",error:"patch requires params.id and params.path"};let n=T(e)??H();return n?n.cardStore.patch(t):{status:"fail",error:"Board context is unavailable"}},appendFiles(t){let e=typeof t.params?.id=="string"?t.params.id:void 0;if(!e)return {status:"fail",error:"appendFiles requires params.id"};let r=T(e)??H();return r?r.cardStore.appendFiles(t):{status:"fail",error:"Board context is unavailable"}}}}function V(){return a$3({board:ke(),nonCore:Se(),cardStore:gt(),chatStore:at,uploadCardFile({cardId:t,fileName:e,contentType:r,bytes:n}){return xt(t,e,r,n,{inChat:false})},buildFileDownloadUrl({cardId:t,fileIdx:e,storedName:r}){let n=`${Y||""}${y}/cards/${encodeURIComponent(t)}/files/${e}`;return r?`${n}?sn=${encodeURIComponent(r)}`:n},readFetchedSourceJsonByRef({cardId:t,ref:e}){let r=T(t)??H();if(!r)return null;let o=r.boardAdapter.resolveBlob(b$1(e)).trim();return o?JSON.parse(o):null}})}function A(t,...e){for(let r of e)if(typeof t[r]=="string")return String(t[r]);return ""}function W(t,...e){for(let r of e)if(t[r]!==void 0)return Number(t[r])}function dt(t,...e){for(let r of e){let n=t[r];if(n&&typeof n=="object"&&!Array.isArray(n))return n}return {}}function Z(t,e,...r){for(let n of r){let o=t[n];if(o&&typeof o=="object"&&!Array.isArray(o))return o}throw Object.assign(new Error(`MCP tool requires ${e}`),{statusCode:400})}function vt(t,e,...r){for(let n of r){let o=t[n];if(o!==void 0){let s=Number(o);if(Number.isFinite(s))return s}}throw Object.assign(new Error(`MCP tool requires ${e}`),{statusCode:400})}function Ae(t){if(Array.isArray(t.bytes))return new Uint8Array(t.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof t.text=="string")return new TextEncoder().encode(t.text);if(typeof t.base64=="string"){let e=String(t.base64).replace(/-/g,"+").replace(/_/g,"/"),r=e+"=".repeat((4-e.length%4)%4),n=atob(r);return Uint8Array.from(n,o=>o.charCodeAt(0))}return null}function Ut(t,e){let r=A(t,"board_id"),n=A(t,"card_id");if(!r)throw Object.assign(new Error("MCP tool requires board_id"),{statusCode:400});if(!n)throw Object.assign(new Error("MCP tool requires card_id"),{statusCode:400});if(r!==_)throw Object.assign(new Error(`Unknown board_id: ${r}`),{statusCode:400});return V().setChatProcessing({cardId:n,active:e}),{status:"success",data:{boardId:_,cardId:n,active:e}}}function pt(t){let e=A(t,"board_id"),r=A(t,"card_id");if(!e)throw Object.assign(new Error("MCP tool requires board_id"),{statusCode:400});if(!r)throw Object.assign(new Error("MCP tool requires card_id"),{statusCode:400});if(e!==_)throw Object.assign(new Error(`Unknown board_id: ${e}`),{statusCode:400});return {cardId:r}}function _t(t,e){if(t?.status==="success")return Object.prototype.hasOwnProperty.call(t,"data")?t.data:void 0;throw t?.status==="fail"||t?.status==="error"?Object.assign(new Error(t.error||`${e} failed`),{statusCode:400}):Object.assign(new Error(`${e} returned an unexpected response`),{statusCode:500})}function qt(t){let e=A(t,"key");if(!e)throw Object.assign(new Error("MCP tool requires key"),{statusCode:400});let r=e.split(".");if(!(r.length>=2&&r[0]==="chat"&&r.every(o=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(o))))throw Object.assign(new Error("MCP tool only supports card meta keys under chat.*"),{statusCode:400});return e}function Dt(t,e){let r=t.meta;for(let n of e.split(".")){if(!r||typeof r!="object"||Array.isArray(r)||!Object.prototype.hasOwnProperty.call(r,n))return {exists:false,value:null};r=r[n];}return {exists:true,value:r}}function ve(t){let{cardId:e}=pt(t),r=V().getChatProcessing({cardId:e});return {status:"success",data:{boardId:_,cardId:e,active:r.active}}}function _e(t){let{cardId:e}=pt(t),r=qt(t);if(!Object.prototype.hasOwnProperty.call(t,"value"))throw Object.assign(new Error("MCP tool requires value"),{statusCode:400});if(r.split(".").includes("__visible_controlplane_only")){let n=_t(gt().get({params:{id:e}}),"cardStore.get"),o=Array.isArray(n.cards)&&n.cards.length>0&&typeof n.cards[0]=="object"&&!Array.isArray(n.cards[0])?n.cards[0]:null,s=o?Dt(o,"__visible_controlplane_only").value:void 0;if(t.value!==s)throw Object.assign(new Error("MCP tool cannot change the reserved meta flag __visible_controlplane_only"),{statusCode:403});return {status:"success",data:{boardId:_,cardId:e,key:r}}}return _t(gt().patch({params:{id:e,path:`meta.${r}`},body:{value:t.value}}),"cardStore.patch"),{status:"success",data:{boardId:_,cardId:e,key:r}}}function Be(t){let{cardId:e}=pt(t),r=qt(t),n=_t(gt().get({params:{id:e}}),"cardStore.get"),o=Array.isArray(n.cards)&&n.cards.length>0&&n.cards[0]&&typeof n.cards[0]=="object"&&!Array.isArray(n.cards[0])?n.cards[0]:null;if(!o)throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});let s=Dt(o,r);return {status:"success",data:{boardId:_,cardId:e,key:r,exists:s.exists,value:s.value}}}function Ie(t){return {"discover.source-kinds":()=>t.discoverSourceKinds(),"inspect.board-runtime-status":()=>t.inspectBoardRuntimeStatus(),"inspect.card-definition-and-runtime":e=>t.inspectCardDefinitionAndRuntime({cardId:A(e,"card_id")}),"inspect.chat-messages-on-cards":e=>{let r=W(e,"tail_turns"),n=W(e,"tail"),o=A(e,"turn_id"),s=e.all_turns===true,a=A(e,"tail_turns_before_id");return t.inspectChatMessagesOnCards({cardId:A(e,"card_id"),...r!==void 0?{lastUserTurns:r}:{},...n!==void 0?{tail:n}:{},...o?{turnId:o}:{},...s?{allTurns:true}:{},...a?{tailTurnsBeforeId:a}:{}})},"inspect.file-contents":e=>t.inspectFileContents({cardId:A(e,"card_id"),fileIdx:Number(W(e,"file_idx"))}),"preflight.validate-candidate-card-definition":e=>t.preflightValidateCandidateCardDefinition({candidateCardContent:Z(e,"candidate_card_content","candidate_card_content")}),"preflight.materialize-candidate-card":e=>t.preflightMaterializeCandidateCard({candidateCardContent:Z(e,"candidate_card_content","candidate_card_content"),mockRequires:Z(e,"mock_requires","mock_requires"),mockFetchedSources:Z(e,"mock_fetched_sources","mock_fetched_sources")}),"preflight.probe-single-source-in-candidate-card":e=>t.preflightProbeSingleSourceInCandidateCard({candidateCardContent:Z(e,"candidate_card_content","candidate_card_content"),mockProjections:dt(e,"mock_projections"),sourceIdx:vt(e,"source_idx","source_idx")}),"preflight.run-single-source-in-candidate-card":e=>t.preflightRunSingleSourceInCandidateCard({candidateCardContent:Z(e,"candidate_card_content","candidate_card_content"),mockProjections:dt(e,"mock_projections"),sourceIdx:vt(e,"source_idx","source_idx")}),"preflight.run-single-source-in-live-card":e=>t.preflightRunSingleSourceInLiveCard({cardId:A(e,"card_id"),sourceIdx:vt(e,"source_idx","source_idx"),mockRequires:Z(e,"mock_requires","mock_requires")}),"preflight.run-one-cycle-with-candidate-card":e=>t.preflightRunOneCycleWithCandidateCard({candidateCardContent:Z(e,"candidate_card_content","candidate_card_content"),mockRequires:dt(e,"mock_requires")}),"manage.read-card":e=>t.manageReadCard({cardId:A(e,"card_id")}),"stage-ai-response-and-any-attachments":e=>{let r=A(e,"turn_id");if(!r)throw Object.assign(new Error("stage-ai-response-and-any-attachments requires a non-empty turn_id"),{statusCode:400});return t.manageAddChatEntryAndAnyAttachments({cardId:A(e,"card_id"),role:"assistant",...typeof e.text=="string"?{text:e.text}:{},...r?{turn:r}:{},...Array.isArray(e.files)?{files:e.files}:{}})},"manage.upsert-card":e=>t.manageUpsertCard({cardId:A(e,"card_id"),candidateCardContent:dt(e,"candidate_card_content")}),"manage.remove-card":e=>t.manageRemoveCard({cardId:A(e,"card_id")})}}function xe(){return {"getstate.is-chat-processing":t=>ve(t),"setstate.chat-processing-started":t=>Ut(t,true),"setstate.chat-processing-done":t=>Ut(t,false),"getstate.card-meta":t=>Be(t),"setstate.card-meta":t=>_e(t),"manage.upload-card-file":t=>{let e=A(t,"board_id"),r=A(t,"card_id"),n=A(t,"file_name"),o=A(t,"content_type")||"application/octet-stream",s=Ae(t);if(!e)throw Object.assign(new Error("manage.upload-card-file requires board_id"),{statusCode:400});if(e!==_)throw Object.assign(new Error(`Unknown board_id: ${e}`),{statusCode:400});if(!r)throw Object.assign(new Error("manage.upload-card-file requires card_id"),{statusCode:400});if(!n)throw Object.assign(new Error("manage.upload-card-file requires file_name"),{statusCode:400});if(!s)throw Object.assign(new Error("manage.upload-card-file requires args.bytes, args.text, or args.base64"),{statusCode:400});return xt(r,n,o,s,{inChat:false})},"manage.admin-read-card":t=>{let{cardId:e}=pt(t);return {status:"success",data:{cards:V().adminReadCard({cardId:e})}}},"manage.admin-upsert-card":t=>{let e=A(t,"board_id"),r=A(t,"card_id");if(!e)throw Object.assign(new Error("manage.admin-upsert-card requires board_id"),{statusCode:400});if(!r)throw Object.assign(new Error("manage.admin-upsert-card requires card_id"),{statusCode:400});if(e!==_)throw Object.assign(new Error(`Unknown board_id: ${e}`),{statusCode:400});return V().adminUpsertCard({cardId:r,candidateCardContent:dt(t,"candidate_card_content")})}}}async function Lt(t,e,r){let n=r[t];if(!n)throw Object.assign(new Error(`Unknown MCP tool: ${t}`),{statusCode:400});let o=await n(e);if(o&&typeof o=="object"&&!Array.isArray(o)){let s=o,a=s.status;if(a==="success")return Object.prototype.hasOwnProperty.call(s,"data")?o:{status:"success",data:{}};if(a==="fail"||a==="error")return o}return {status:"success",data:o}}function mt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return e;let r=t;if(typeof r.error=="string"&&r.error.trim())return r.error;if(r.step==="validate"){let n=r.validation;if(n&&typeof n=="object"&&!Array.isArray(n)){let s=n.data;if(s&&typeof s=="object"&&!Array.isArray(s)){let a=s.issues;if(Array.isArray(a)){let u=a.find(C=>typeof C=="string"&&C.trim());if(typeof u=="string")return `Validation failed: ${u}`}let i=s.errors;if(Array.isArray(i)&&i.length>0)return "Validation failed"}}return "Validation failed"}return e}function Ht(){let t=S.map(s=>{try{let i=s.boardAdapter.kvStorageForRef(s.outputsStoreRef).read("status");if(i!=null)return i}catch{}return s.notification.status}).filter(Boolean);if(t.length===0)return null;if(t.length===1)return t[0];let e=[],r=["completed","eligible","pending","blocked","unresolved","failed","in_progress","orphan_cards"],n={};for(let s of r)n[s]=0;for(let s of t){let a=s,i=Array.isArray(a.cards)?a.cards:[];e.push(...i);for(let u of r)n[u]+=Number(a?.summary?.[u]||0);}let o=t[0];return {...o,cards:e,summary:{...o.summary||{},card_count:e.length,...n}}}function Vt(){let t={},e=r=>{for(let[n,o]of Object.entries(r.notification.computedValues)){let s=r.notification.cards[n];t[n]={schema_version:"v1",card_id:n,card_data:s?.card_data??{},computed_values:o??{}};}};for(let r of S)e(r);return t}function zt(){let t={};for(let e of S)Object.assign(t,e.notification.dataObjects||{});return t}function yt(){let t=Nt(),e=Vt(),r=zt(),n={};for(let s of t){if(!s?.id)continue;let a=s.id,i=e[a]||{},u={...i.card_data&&typeof i.card_data=="object"?i.card_data:s.card_data&&typeof s.card_data=="object"?s.card_data:{}};n[a]={schema_version:i.schema_version||"v1",card_id:i.card_id||a,card_data:u,computed_values:i.computed_values&&typeof i.computed_values=="object"?i.computed_values:{}};}let o={};for(let s of t){if(!s?.id)continue;let a=s.id;try{let i=It(a),u=V().getChatProcessing({cardId:a}).active;(i.length>0||u)&&(o[a]={messages:i.map(C=>({role:String(C.role||"system"),text:String(C.text||""),files:Array.isArray(C.files)?C.files:[]})),receiving:!1,processing:u});}catch{}}return {boardId:_,cardDefinitions:t,statusSnapshot:Ht(),dataObjectsByToken:r,cardRuntimeById:n,cardChatsByCardId:o}}function Bt(t,e,r){let n=r?.syncBoard!==false,o=r?.restartOnlyIfChanged===true,s=T(t);if(!s)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let a=rt(t);if(!a)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let i=o?JSON.stringify(a):null,u=e(a)||a;if(o&&JSON.stringify(u)===i)return;let C=s.cardStore.set({body:u});if(C.status!=="success")throw Object.assign(new Error(C.error||`Failed to persist card: ${t}`),{statusCode:500});if(n){let h=s.board.upsertCard({params:{cardId:t,restart:true}});if(h.status!=="success")throw Object.assign(new Error(h.error||`Failed to upsert card: ${t}`),{statusCode:500})}}function je(t,e){Bt(t,e,{syncBoard:true});}function Jt(t,e){Bt(t,e,{syncBoard:false});}function Oe(t){let e=T(t);if(!e)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});if(!rt(t))throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let n=e.board.upsertCard({params:{cardId:t,restart:true}});if(n.status!=="success")throw Object.assign(new Error(n.error||`Failed to retrigger card: ${t}`),{statusCode:500})}function $e(t,e){Bt(t,r=>{if(!e||typeof e!="object"||Object.keys(e).length===0)return r;function n(o,s,a){let i=String(s||"").split(".").filter(Boolean);if(!i.length)return;let u=o;for(let C=0;C<i.length-1;C++){let h=i[C];(!u[h]||typeof u[h]!="object")&&(u[h]={}),u=u[h];}u[i[i.length-1]]=a;}if(e.fieldValues!==void 0&&e.fieldValues!==null){let o=null,s=r.view;if(s&&Array.isArray(s.elements)){for(let a of s.elements)if(a?.data&&a.data.writeTo){o=a.data.writeTo;break}}o?n(r,o,e.fieldValues):typeof e.fieldValues=="object"&&!Array.isArray(e.fieldValues)&&(r.card_data={...r.card_data||{},...e.fieldValues});}else {if(Array.isArray(e._stagedFiles)&&e._stagedFiles.length>0)return r;for(let[o,s]of Object.entries(e))o!=="_stagedFiles"&&(s!==null&&typeof s=="object"&&!Array.isArray(s)&&r[o]!==null&&typeof r[o]=="object"&&!Array.isArray(r[o])?r[o]={...r[o],...s}:r[o]=s);}return r},{syncBoard:true,restartOnlyIfChanged:true});}function Ee(t){let e=String(t||"").trim();if(!e)return "upload.bin";let r=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return (r>=0?e.slice(r+1):e)||"upload.bin"}function Pe(t){B.clear(t);try{V().setChatProcessing({cardId:t,active:!1});}catch{}}function Te(t,e,r,n,o=""){let s=typeof r=="string"?r.trim():"";return B.append(t,e,s,n,o)}function It(t){return B.readAll(t)}function Fe(t){let e=[];try{let r=rt(t);if(!r)return e;let n=D().read(r.card_data&&typeof r.card_data=="object"?r.card_data:null);for(let o of n)e.push(o.stored_name);}catch{}return e}function Me(t,e,r,n){let o=L(t),s=tt(t),a=Ee(e),i=At(t),u=i?i.allocateStoredName(o,a,{seedNames:Fe(t),maxLen:Ye}):`${String(Date.now())}-${a}`;return s.files&&s.files.putBytes(`${o}/${u}`,new Uint8Array(n),r||"application/octet-stream"),{name:a,stored_name:u,size:n.length,mime_type:r||"application/octet-stream",uploaded_at:new Date().toISOString()}}function xt(t,e,r,n,o){if(!n.length)throw Object.assign(new Error("Empty upload body"),{statusCode:400});let s=o?.inChat===true,a=Me(t,e,r,n),i=null;if(Jt(t,u=>{let C=new Date().toISOString(),h=u.card_data&&typeof u.card_data=="object"?u.card_data:{};u.card_data=h;let b=D().normalizeIncoming([{name:a.name,stored_name:a.stored_name,size:a.size,mime_type:a.mime_type,uploaded_at:a.uploaded_at||C,chat:s}],C);return i=D().merge(h,b).findIndex(nt=>nt.stored_name===a.stored_name),u}),s){let u=typeof i=="number"&&i>=0?` #${i}`:"";Te(t,"system",`file uploaded: ${a.name} as ${a.stored_name}${u}`,[],o?.turnId??"");}return {ok:true,file:a}}function Gt(t){let e=T(t);if(!e)return null;let r=e.board.getConfig({params:{key:"chat-handler-flow"}}),n=r.status==="success"?r.data?.value:null,o=e.chatHandlerRef;return n==null&&(!o||typeof o!="object")?null:{ctx:e,handlerFlow:n,handlerRef:o}}function Ne(t,e,r=false,n=""){let o=Gt(t);if(!o)return;let{ctx:s,handlerFlow:a,handlerRef:i}=o;if(!r)try{V().setChatProcessing({cardId:t,active:!0});}catch{}let u={boardId:_,cardId:String(t),lastChatEntryId:e,...n?{turnId:n}:{},...J,...Y?{serverUrl:Y}:{}};if(!st&&a!=null){try{V().setChatProcessing({cardId:t,active:!1});}catch{}j.warn(`[chat-handler-flow] configured for card "${t}" but no chatFlowRunner was provided`);return}if(a!=null){let h=st;if(!h)return;h.run(a,u,{boardId:_,cardId:String(t),label:s.label,logger:j,serverUrl:Y,executionExtra:J}).then(b=>{if(b.dispatched)j.info(`[chat-handler-flow] invoked for card "${t}" (boardId: "${_}")`);else {try{B.setProcessing(t,!1);}catch{}j.warn(`[chat-handler-flow] dispatch failed for card "${t}": ${b.error||"unknown"}`);}},b=>{try{B.setProcessing(t,!1);}catch{}j.warn(`[chat-handler-flow] invoke failed for card "${t}": ${b?.message||String(b)}`);});return}let C=i;C&&z.invoke(C,u).then(h=>{if(h.dispatched)j.info(`[chat-handler] invoked for card "${t}" (boardId: "${_}")`);else {try{B.setProcessing(t,!1);}catch{}j.warn(`[chat-handler] dispatch failed for card "${t}": ${h.error||"unknown"}`);}},h=>{try{B.setProcessing(t,!1);}catch{}j.warn(`[chat-handler] invoke failed for card "${t}": ${h?.message||String(h)}`);});}function Ue(t,e,r){let n=e==="chat-send"?Jt:je,o;n(t,s=>{let a=new Date().toISOString(),i=s.card_data&&typeof s.card_data=="object"?s.card_data:{};if(s.card_data=i,e==="chat-send"){let u=r&&typeof r.text=="string"?r.text.trim():"",C=r&&typeof r["turn-id"]=="string"?r["turn-id"]:r&&typeof r.turnId=="string"?r.turnId:r&&typeof r.turn=="string"?r.turn:"",h=[];if(Array.isArray(r?.files)){for(let b of r.files)if(b){if(typeof b=="string"){h.push({name:b});continue}if(typeof b=="object"){let O=b;typeof O.name=="string"&&h.push({name:O.name,size:O.size,mime_type:O.mime_type,uploaded_at:O.uploaded_at,stored_name:O.stored_name,chat:O.chat===true});}}}if(u||h.length>0){let b=at.runBatch({cardId:t,commands:[{command:"append",role:"user",text:u,files:h,turn:C},{command:"set-processing",active:true}]});if(b.status!=="success")throw new Error(b.error);let O=b.data.results[0]?.data?.id;if(typeof O!="string"||!O)throw new Error(`chat-send did not return an append id for card ${t}`);o={cardId:t,lastEntryId:O,processingAlreadySet:true,turnId:C};try{let bt=It(t);oe([{kind:"card_chats",cardId:t,messages:bt.map(X=>({role:String(X.role||"system"),text:String(X.text||""),files:Array.isArray(X.files)?X.files:[]})),receiving:!0,processing:B.isProcessing(t)}]);}catch{}}return s}if(e==="file-upload"){let u=D().normalizeIncoming(r?.files,a);return u.length>0&&D().merge(i,u),s}if(e==="action"){let u=r&&typeof r.buttonId=="string"?r.buttonId:"";if(!u)return s;i.lastAction={buttonId:u,at:a},i.lastActionText=`${u} @ ${a}`;}return s}),o&&Ne(o.cardId,o.lastEntryId,o.processingAlreadySet,o.turnId??"");}function f$1(t,e,r){let n=JSON.stringify(r),o=typeof Buffer<"u"?Buffer.byteLength(n):new TextEncoder().encode(n).length;t.writeHead(e,{...w,"Content-Type":"application/json; charset=utf-8","Content-Length":o}),t.end(n);}function Kt(t,e,r){let n=rt(t);if(!n)throw Object.assign(new Error("Card not found"),{statusCode:404});let o=D().resolve(n.card_data,e,r);if(!o.ok&&o.reason==="stale_reference")throw Object.assign(new Error("File reference is stale. Refresh and try again."),{statusCode:409});if(!o.ok)throw Object.assign(new Error("File not found"),{statusCode:404});let s=o.file,a=L(t),i=tt(t),u=String(s.stored_name||""),C=`${a}/${u}`,h=i.files?i.files.getBytes(C):null;if(!h)throw Object.assign(new Error("File not found"),{statusCode:404});return {fileRecord:s,bytes:h}}function qe(t,e,r,n){let{fileRecord:o,bytes:s}=Kt(e,r,n),a=String(o.name||o.stored_name||"download.bin"),i=String(o.mime_type||"application/octet-stream");t.writeHead(200,{"Content-Type":i,"Content-Disposition":`attachment; filename="${a}"`,"Content-Length":s.length}),t.end(s);}function De(t){let e=String(t||"").toLowerCase();return e.startsWith("text/")||e.includes("json")||e.includes("xml")||e.includes("javascript")||e.includes("typescript")||e.includes("yaml")||e.includes("csv")}function Wt(t,e,r){let n=t.split(/\r?\n/);return (e==="head"?n.slice(0,r):n.slice(-r)).join(`
|
|
2
|
+
`)}async function U(t){let e=[];for await(let n of t)e.push(n);let r=typeof Buffer<"u"?Buffer.concat(e).toString("utf-8").trim():new TextDecoder().decode(Zt(e)).trim();return r?JSON.parse(r):{}}async function Le(t){let e=[];for await(let r of t)e.push(r);return typeof Buffer<"u"?Buffer.concat(e):Zt(e)}function Zt(t){let e=t.reduce((o,s)=>o+s.length,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function Xt(t,e){let r=typeof e.ref=="string"?e.ref.trim():"";if(!r)return {status:"fail",error:"board-worker success callback requires body.ref"};let n=S[0];return n?n.board.sourceDataFetched({params:{token:t,ref:r}}):{status:"fail",error:"no board context"}}function Qt(t,e){let r=typeof e.reason=="string"&&e.reason.trim()?e.reason:"unknown",n=S[0];return n?n.board.sourceDataFetchFailure({params:{token:t,reason:r}}):{status:"fail",error:"no board context"}}function He(t,e,r){let n=String(t||"").trim();if(!n)return {statusCode:400,body:{error:"callback token is required"}};let o=e==="success"?Xt(n,r):Qt(n,r);return o.status==="success"?{statusCode:200,body:o}:o.status==="fail"?{statusCode:400,body:{error:o.error}}:{statusCode:500,body:{error:o.error}}}let Yt=0;function te(t){let e=JSON.stringify(t);return Yt++,`id: ${Yt}
|
|
3
|
+
data: ${e}
|
|
4
|
+
|
|
5
|
+
`}function ee(t){let e=t;try{e.flushHeaders?.();}catch{}try{e.flush?.();}catch{}try{e.socket?.setNoDelay?.(!0);}catch{}try{e.socket?.uncork?.();}catch{}}function jt(t,e){let r=p.get(t);if(r&&!(e&&r.res!==e)){p.delete(t),Et();try{Rt?.(t);}catch{}try{r.res.end();}catch{}}}function ht(t,e){let r=p.get(t);if(!r)return;let n=te(e);try{r.res.write(n),ee(r.res);}catch{jt(t,r.res);}}function re(t,e,r,n,o){if(!p.has(e)){f$1(t,404,{error:`SSE client not connected: ${e}`});return}o?kt?.(e,r,n):St?.(e,r,n),f$1(t,200,{ok:true,clientId:e,channelName:r,...n.cardId?{cardId:n.cardId}:{},subscribed:o});}function Ot(){let t=new Set;for(let e of p.values())for(let r of e.subscribedChatCardIds)t.add(r);return Array.from(t)}function Ve(t){let e=k.has(t)?k.get(t):null,{cursor:r}=B.readAfter(t,e),n=B.isProcessing(t),o=n!==(I.get(t)??false),s=r!==e;return s&&k.set(t,r),I.set(t,n),s||o}function ne(t,e=true){let r=It(t),n=Date.now();return {kind:"card_chats",cardId:t,sentAt:new Date(n).toISOString(),sentAtMs:n,messages:r.map(o=>({role:String(o.role||"system"),text:String(o.text||""),files:Array.isArray(o.files)?o.files:[]})),receiving:e,processing:B.isProcessing(t)}}function $t(t,e=true){let r={kind:"notification-batch",notifications:[ne(t,e)]};for(let[n,o]of p.entries())o.subscribedChatCardIds.has(t)&&ht(n,r);}function Et(){Ot().length>0||($&&(clearInterval($),$=null),k.clear(),I.clear());}function ze(){if($)return;let t=()=>{let e=Ot();if(e.length===0){Et();return}let r=new Set(e);for(let n of Array.from(k.keys()))r.has(n)||k.delete(n);for(let n of Array.from(I.keys()))r.has(n)||I.delete(n);for(let n of e)Ve(n)&&$t(n,true);};t(),$=setInterval(t,1e3);}function Je(t,e){let r=p.get(t);if(!r)return false;r.subscribedChatCardIds.add(e);let{cursor:n}=B.readAfter(e,null);return k.set(e,n),I.set(e,B.isProcessing(e)),ze(),ht(t,{kind:"notification-batch",notifications:[ne(e,true)]}),true}function Ge(t,e){let r=p.get(t);return r?(r.subscribedChatCardIds.delete(e),Ot().includes(e)||(k.delete(e),I.delete(e)),Et(),true):false}function Ke(t){if(!t||typeof t!="object")return false;let e=t.kind;return e==="card_chats"||e==="chat_messages"}function oe(t){if(!t||t.length===0)return;let e=[],r=new Set;for(let n of t)Ke(n)&&typeof n.cardId=="string"?r.add(String(n.cardId)):e.push(n);if(e.length>0){let n={kind:"notification-batch",notifications:e};for(let o of p.keys())ht(o,n);}for(let n of r)$t(n,true);}function We(t,e,r){let n=p.get(r),o=n?new Set(n.subscribedChatCardIds):new Set;n&&jt(r,n.res),e.writeHead(200,{...w,"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),ee(e),p.set(r,{res:e,subscribedChatCardIds:o});let s=yt(),a=te(s);e.write(a);try{Ct?.(r,u=>{ht(r,u);});}catch{}let i=setInterval(()=>{try{e.write(`: keepalive
|
|
6
|
+
|
|
7
|
+
`);}catch{}},15e3);t.on("close",()=>{clearInterval(i),jt(r,e);});}async function Ze(t,e,r){let n=t.method||"GET",o=r,s=o.pathname;try{if(n==="GET"&&s===`${y}/init-board`)return await ft(),f$1(e,200,yt()),!0;if(n==="GET"&&s===`${y}/sse`){await ft();let d=String(o.searchParams.get("clientId")||"").trim();if(!d)return f$1(e,400,{error:"clientId query param is required for SSE"}),!0;We(t,e,d);for(let c=0;c<S.length;c++)Ft(S[c]),Mt(S[c],c);return !0}if(n==="GET"&&s===`${y}/board-status`)return f$1(e,200,yt()),!0;let a=s.match(new RegExp(`^${F(y)}/callback/board-worker/([^/]+)/(success|failure)$`));if(n==="POST"&&a){await ft();let d=decodeURIComponent(a[1]),c=a[2],g=await U(t),l=He(d,c,g);return f$1(e,l.statusCode,l.body),!0}if(n==="POST"&&s===`${y}/mcp`){await E();let d=await U(t),c=typeof d.tool=="string"?d.tool.trim():"",g=d.args&&typeof d.args=="object"&&!Array.isArray(d.args)?d.args:{};if(!c)return f$1(e,400,{error:"tool is required"}),!0;if(c==="inspect.file-contents")return f$1(e,400,{error:"inspect.file-contents is only available on /mcp-raw"}),!0;try{let l=await Lt(c,g,Ie(V()));if(l&&typeof l=="object"&&!Array.isArray(l)){let R=l;if(R.status==="fail")return f$1(e,400,{error:mt(l,"Request failed")}),!0;if(R.status==="error")return f$1(e,500,{error:mt(l,"Internal error")}),!0}f$1(e,200,l);}catch(l){let R=typeof l?.statusCode=="number"?Number(l.statusCode):500,x=l instanceof Error?l.message:String(l);f$1(e,R,{error:x});}return !0}if(n==="POST"&&s===`${y}/mcp-controlplane`){await E();let d=await U(t),c=typeof d.tool=="string"?d.tool.trim():"",g=d.args&&typeof d.args=="object"&&!Array.isArray(d.args)?d.args:{};if(!c)return f$1(e,400,{error:"tool is required"}),!0;try{let l=await Lt(c,g,xe());if(l&&typeof l=="object"&&!Array.isArray(l)){let R=l;if(R.status==="fail")return f$1(e,400,{error:mt(l,"Request failed")}),!0;if(R.status==="error")return f$1(e,500,{error:mt(l,"Internal error")}),!0}f$1(e,200,l);}catch(l){let R=typeof l?.statusCode=="number"?Number(l.statusCode):500,x=l instanceof Error?l.message:String(l);f$1(e,R,{error:x});}return !0}if(n==="POST"&&s===`${y}/mcp-raw`){await E();let d=await U(t),c=typeof d.tool=="string"?d.tool.trim():"",g=d.args&&typeof d.args=="object"&&!Array.isArray(d.args)?d.args:{};if(!c)return f$1(e,400,{error:"tool is required"}),!0;if(c!=="inspect.file-contents")return f$1(e,400,{error:`Tool does not support raw response: ${c}`}),!0;let l=A(g,"card_id","cardId"),R=W(g,"file_idx","fileIdx"),x=W(g,"head-lines","headLines"),v=W(g,"tail-lines","tailLines"),P=W(g,"head-bytes","headBytes"),et=W(g,"tail-bytes","tailBytes");if(!l)return f$1(e,400,{error:"inspect.file-contents requires card_id"}),!0;if(R===void 0||!Number.isInteger(R)||R<0)return f$1(e,400,{error:"inspect.file-contents requires file_idx to be a non-negative integer"}),!0;if([x,v,P,et].filter(q=>q!==void 0).length>1)return f$1(e,400,{error:"inspect.file-contents accepts at most one of head-lines, tail-lines, head-bytes, tail-bytes"}),!0;for(let[q,ot]of [["head-lines",x],["tail-lines",v],["head-bytes",P],["tail-bytes",et]])if(ot!==void 0&&(!Number.isInteger(ot)||ot<0))return f$1(e,400,{error:`inspect.file-contents requires ${q} to be a non-negative integer`}),!0;let se=V().inspectFileContents({cardId:l,fileIdx:R}),Xe=typeof se?.stored_name=="string"?se.stored_name:null,{fileRecord:Pt,bytes:lt}=Kt(l,R,Xe),ae=String(Pt.name||Pt.stored_name||"download.bin"),Tt=String(Pt.mime_type||"application/octet-stream"),wt=(o.searchParams.get("resp")||"").trim().toLowerCase();if(wt&&wt!=="json-b64")return f$1(e,400,{error:`unsupported resp mode: ${wt}`}),!0;let Qe=wt==="json-b64",Q;if(x!==void 0||v!==void 0){if(!De(Tt))return f$1(e,400,{error:"head-lines/tail-lines are only supported for text-like files; use head-bytes/tail-bytes for binary content"}),!0;let q=new TextDecoder().decode(lt),ot=x!==void 0?Wt(q,"head",x):Wt(q,"tail",v);Q=typeof Buffer<"u"?Buffer.from(ot,"utf8"):new TextEncoder().encode(ot);}else if(P!==void 0||et!==void 0){let q=P??et;Q=P!==void 0?lt.slice(0,q):lt.slice(Math.max(0,lt.length-q));}else Q=lt;if(Qe){let q=typeof Buffer<"u"?Buffer.from(Q).toString("base64"):btoa(String.fromCharCode(...Q));return f$1(e,200,{bodyBase64:q,mimeType:Tt,filename:ae,byteLength:Q.length}),!0}return e.writeHead(200,{"Content-Type":Tt,"Content-Disposition":`attachment; filename="${ae}"`,"Content-Length":Q.length}),e.end(Q),!0}let i=s.match(new RegExp(`^${F(y)}/cards/([^/]+)$`));if(n==="GET"&&i){await E();let d=decodeURIComponent(i[1]),c=rt(d);return c?(f$1(e,200,c),!0):(f$1(e,404,{error:`card not found: ${d}`}),!0)}if(n==="PATCH"&&i){await E();let d=decodeURIComponent(i[1]),c=await U(t);return $e(d,c),f$1(e,200,{ok:!0}),!0}let u=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/retrigger$`));if(n==="POST"&&u){await E();let d=decodeURIComponent(u[1]);return Oe(d),f$1(e,200,{ok:!0}),!0}let C=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/actions$`));if(n==="POST"&&C){await E();let d=decodeURIComponent(C[1]),c=Date.now(),g=new Date(c).toISOString(),l=await U(t),R=l?.actionType;if(R==="chat-send"&&!Gt(d)){let v=Date.now();return f$1(e,409,{error:`chat handler is not configured for card: ${d}`,requestReceivedAt:g,requestReceivedAtMs:c,responseSentAt:new Date(v).toISOString(),responseSentAtMs:v,responseStatus:409}),!0}if(R==="chat-send"){let v=l?.payload??{},P=typeof v["turn-id"]=="string"?v["turn-id"]:typeof v.turnId=="string"?v.turnId:typeof v.turn=="string"?v.turn:"";if(!P||!String(P).trim()){let et=Date.now();return f$1(e,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${d}`,requestReceivedAt:g,requestReceivedAtMs:c,responseSentAt:new Date(et).toISOString(),responseSentAtMs:et,responseStatus:400}),!0}}Ue(d,R,l?.payload);let x=Date.now();return f$1(e,200,{ok:!0,requestReceivedAt:g,requestReceivedAtMs:c,responseSentAt:new Date(x).toISOString(),responseSentAtMs:x,responseStatus:200}),!0}let h=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/chats$`));if(n==="GET"&&h){await E();let d=decodeURIComponent(h[1]),c=String(o.searchParams.get("turn-id")||""),g=String(o.searchParams.get("all-turns")||"").toLowerCase()==="true",l=String(o.searchParams.get("tail-turns-before-id")||""),R=o.searchParams.get("tail-turns"),x=R==null||R===""?g||c?void 0:1:Number.parseInt(R,10),v=at.readAll({params:{cardId:d},body:{...x===void 0?{}:{tailTurns:x},...c?{turnId:c}:{},...g?{allTurns:!0}:{},...l?{tailTurnsBeforeId:l}:{}}});if(v.status!=="success")return f$1(e,400,{error:v.error||"Failed to read chats"}),!0;let P=v.data.records;return f$1(e,200,{ok:!0,messages:P}),!0}if(n==="POST"&&h){await E();let d=decodeURIComponent(h[1]),c=await U(t),g=typeof c?.role=="string"?c.role:"assistant",l=typeof c?.text=="string"?c.text:"",R=Array.isArray(c?.files)?c.files:[],x=typeof c?.turn=="string"?c.turn:typeof c?.["turn-id"]=="string"?c["turn-id"]:typeof c?.turnId=="string"?c.turnId:"",v=c?.done===!0,P=B.append(d,g,l,R,x);return v&&B.setProcessing(d,!1),$t(d,!v),f$1(e,200,{ok:!0,id:P}),!0}let b=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/chats/subscribe-sse$`));if(n==="POST"&&b){await E();let d=decodeURIComponent(b[1]),c=await U(t),g=typeof c?.clientId=="string"?c.clientId.trim():"";return g?Je(g,d)?(f$1(e,200,{ok:!0,clientId:g,cardId:d,subscribed:!0}),!0):(f$1(e,404,{error:`SSE client not connected: ${g}`}),!0):(f$1(e,400,{error:"clientId is required"}),!0)}let O=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/chats/unsubscribe-sse$`));if(n==="POST"&&O){await E();let d=decodeURIComponent(O[1]),c=await U(t),g=typeof c?.clientId=="string"?c.clientId.trim():"";return g?Ge(g,d)?(f$1(e,200,{ok:!0,clientId:g,cardId:d,subscribed:!1}),!0):(f$1(e,404,{error:`SSE client not connected: ${g}`}),!0):(f$1(e,400,{error:"clientId is required"}),!0)}let nt=s.match(new RegExp(`^${F(y)}/watch-channel/([^/]+)/(subscribe|unsubscribe)-sse$`));if(n==="POST"&&nt){await E();let d=decodeURIComponent(nt[1]),c=nt[2]==="subscribe",g=await U(t),l=typeof g?.clientId=="string"?g.clientId.trim():"";return l?(re(e,l,d,{},c),!0):(f$1(e,400,{error:"clientId is required"}),!0)}let ut=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/watch-channel/([^/]+)/(subscribe|unsubscribe)-sse$`));if(n==="POST"&&ut){await E();let d=decodeURIComponent(ut[1]),c=decodeURIComponent(ut[2]),g=ut[3]==="subscribe",l=await U(t),R=typeof l?.clientId=="string"?l.clientId.trim():"";return R?(re(e,R,c,{cardId:d},g),!0):(f$1(e,400,{error:"clientId is required"}),!0)}let bt=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/files$`));if(n==="POST"&&bt){await E();let d=decodeURIComponent(bt[1]),c=String(o.searchParams.get("inChat")||"").toLowerCase()==="true",g=String(o.searchParams.get("turn-id")||"").trim();if(c&&!g)return f$1(e,400,{error:`file upload with inChat=true requires a non-empty 'turn-id' query parameter for card: ${d}`}),!0;let l=t.headers["x-file-name"],R=String(t.headers["content-type"]||"application/octet-stream"),x=Array.isArray(l)?l[0]:l,v=x?decodeURIComponent(String(x)):"upload.bin",P=await Le(t);return f$1(e,200,xt(d,v,R,P,{inChat:c,turnId:g})),!0}let X=s.match(new RegExp(`^${F(y)}/cards/([^/]+)/files/(\\d+)$`));if(n==="GET"&&X){let d=decodeURIComponent(X[1]),c=parseInt(X[2],10),g=o.searchParams.get("sn");return qe(e,d,c,g),!0}return !1}catch(a){let i=a?.statusCode||500;return f$1(e,i,{error:String(a?.message||a)}),true}}return {get apiBasePath(){return y},get corsHeaders(){return w},handleRuntimeApi:Ze,buildPublishedRuntimePayload:yt,clearChatRecords:Pe,reportSourceFetched(t,e){return Xt(t,{ref:e})},reportSourceFetchFailure(t,e){return Qt(t,{reason:e})},get cardStore(){return S[0]?.cardStore??{set(){return {status:"fail",error:"no board context"}}}}}}function fr(m){let y=String(m.apiBasePath||"/api/boards").replace(/\/$/,""),w={...be,...m.corsHeaders||{}},_=m.serverMetaStore,j=m.boardRuntimeFactory,z=new Map,st="boards-config.json";function B(){let p=_.getText(st);if(!p)return {boards:[{id:"default",label:"Default Board"}]};try{return JSON.parse(p)}catch{return {boards:[{id:"default",label:"Default Board"}]}}}function at(p){_.putText(st,JSON.stringify(p,null,2));}function it(p){let k=String(p||"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/^_+|_+$/g,"");return k.length>0&&k.length<=64?k:null}function Y(p){if(z.has(p))return z.get(p);let I=B().boards.find(M=>M.id===p)||{},$=j(p,I);return z.set(p,$),$}function J(p,k,I){let $=JSON.stringify(I),M=typeof Buffer<"u"?Buffer.byteLength($):new TextEncoder().encode($).length;p.writeHead(k,{...w,"Content-Type":"application/json; charset=utf-8","Content-Length":M}),p.end($);}async function Ct(p,k,I){let $=p.method||"GET",M=I.pathname;if($==="GET"&&M===y)return J(k,200,{ok:true,boards:B().boards}),true;if($==="POST"&&M===y){let S=[];for await(let L of p)S.push(L);let G=typeof Buffer<"u"?Buffer.concat(S).toString("utf-8").trim():new TextDecoder().decode(er(S)).trim(),N={};try{N=G?JSON.parse(G):{};}catch{N={};}let K=it(N.id);if(!K)return J(k,400,{error:"board id must be 1-64 alphanumeric/dash/underscore characters"}),true;let tt=B();if(tt.boards.some(L=>L.id===K))return J(k,409,{error:`Board "${K}" is already registered`}),true;let At=typeof N.label=="string"&&N.label.trim()?N.label.trim():K,D={id:K,label:At};for(let[L,ct]of Object.entries(N))L==="id"||L==="label"||ct!=null&&(D[L]=ct);return tt.boards.push(D),at(tt),J(k,200,{ok:true,board:D}),true}return false}async function Rt(p,k,I){let M=I.pathname.match(new RegExp(`^${F(y)}/([^/]+)(/|$)`));if(!M)return false;let S=it(decodeURIComponent(M[1]));return S?B().boards.some(K=>K.id===S)?!!await Y(S).handleRuntimeApi(p,k,I):(J(k,404,{error:`Board "${S}" not registered. POST ${y} with {id} to register it first.`}),true):(J(k,400,{error:"Invalid board id"}),true)}async function kt(p,k,I){return !!(await Ct(p,k,I)||await Rt(p,k,I))}function St(p){if(!B().boards.some(I=>I.id===p))throw Object.assign(new Error(`Board "${p}" not registered`),{statusCode:404});return {service:Y(p)}}return {get apiBasePath(){return y},get corsHeaders(){return w},handleApi:kt,requireBoardService:St}}function F(m){return m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function er(m){let y=m.reduce((j,z)=>j+z.length,0),w=new Uint8Array(y),_=0;for(let j of m)w.set(j,_),_+=j.length;return w}export{lr as a,fr as b};//# sourceMappingURL=chunk-Q6VSL327.js.map
|
|
8
|
+
//# sourceMappingURL=chunk-Q6VSL327.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {a}from'./chunk-JM5EKT57.js';import {q as q$1}from'./chunk-MNEOJWPS.js';import {b}from'./chunk-FW4363Y4.js';import L from'ajv-formats';function w(r,t,e,i){let s=r.steps[e];if(!s)throw new Error(`Step "${e}" not found in flow configuration`);if(i.result==="failure"&&s.retry){let o=t.retryCounts[e]??0;if(o<s.retry.max_attempts)return {newState:{...t,retryCounts:{...t.retryCounts,[e]:o+1},updatedAt:Date.now()},nextStep:e,isTerminal:false,isCircuitBroken:false,shouldRetry:true}}let n=s.failure_transitions?.[i.result]??s.transitions[i.result];if(!n)throw new Error(`No transition defined for result "${i.result}" in step "${e}"`);let p=!!r.terminal_states[n];return {newState:{...t,currentStep:n,stepHistory:[...t.stepHistory,e],retryCounts:{...t.retryCounts,[e]:0},updatedAt:Date.now()},nextStep:n,isTerminal:p,isCircuitBroken:false,shouldRetry:false}}function S(r,t,e){let i=r.steps[e];if(!i?.circuit_breaker)return {broken:false,newState:{...t,iterationCounts:{...t.iterationCounts,[e]:(t.iterationCounts[e]??0)+1},updatedAt:Date.now()}};let s=t.iterationCounts[e]??0;return s>=i.circuit_breaker.max_iterations?{broken:true,redirectStep:i.circuit_breaker.on_open,newState:{...t,currentStep:i.circuit_breaker.on_open,updatedAt:Date.now()}}:{broken:false,newState:{...t,iterationCounts:{...t.iterationCounts,[e]:s+1},updatedAt:Date.now()}}}function h(r,t,e){let i=r.steps[t];if(!i)throw new Error(`Step "${t}" not found`);if(i.expects_data){let s={};for(let n of i.expects_data)s[n]=e[n];return s}return {...e}}function g(r,t){if(r===false||r===void 0)return {};if(typeof r=="string")return {[r]:t[r]};if(Array.isArray(r)){let e={};for(let i of r)e[i]=t[i];return e}return {}}function y(r,t){let e=Date.now();return {runId:t,flowId:r.id??"unnamed",currentStep:r.settings.start_step,status:"running",stepHistory:[],iterationCounts:{},retryCounts:{},startedAt:e,updatedAt:e}}function $(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let t=Math.random()*16|0;return (r==="x"?t:t&3|8).toString(16)})}var u=class{flow;handlers;store;components;options;listeners=new Map;aborted=false;constructor(t,e,i={}){this.flow=t,this.handlers=new Map(Object.entries(e)),this.store=i.store??new a,this.components=i.components??{},this.options=i,i.signal&&i.signal.addEventListener("abort",()=>{this.aborted=true;}),this.validateFlow();}validateFlow(){let{settings:t,steps:e,terminal_states:i}=this.flow;if(!t?.start_step)throw new Error("Flow must have settings.start_step defined");if(!e||Object.keys(e).length===0)throw new Error("Flow must have at least one step defined");if(!i||Object.keys(i).length===0)throw new Error("Flow must have at least one terminal_state defined");if(!e[t.start_step]&&!i[t.start_step])throw new Error(`Start step "${t.start_step}" not found`);for(let[s,n]of Object.entries(e)){for(let[p,o]of Object.entries(n.transitions))if(!e[o]&&!i[o])throw new Error(`Step "${s}" transition "${p}" points to unknown step "${o}"`);if(n.failure_transitions){for(let[p,o]of Object.entries(n.failure_transitions))if(!e[o]&&!i[o])throw new Error(`Step "${s}" failure_transition "${p}" points to unknown step "${o}"`)}}}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(e);}off(t,e){this.listeners.get(t)?.delete(e);}emit(t){let e=this.listeners.get(t.type);if(e)for(let i of e)try{i(t);}catch{}}sleep(t){return new Promise(e=>setTimeout(e,t))}async run(t){let e=$(),i=y(this.flow,e);if(await this.store.saveRunState(e,i),t)for(let[s,n]of Object.entries(t))await this.store.setData(e,s,n);this.emit({type:"flow:start",runId:e,timestamp:i.startedAt,data:{initialData:t??{}}});try{return await this.executeLoop(e,i)}catch(s){let n=s instanceof Error?s:new Error(String(s));return this.emit({type:"flow:error",runId:e,timestamp:Date.now(),data:{error:n.message}}),this.options.onError?.(n),i={...i,status:"failed",updatedAt:Date.now()},await this.store.saveRunState(e,i),{runId:e,status:"failed",data:await this.store.getAllData(e),finalStep:i.currentStep,stepHistory:i.stepHistory,durationMs:Date.now()-i.startedAt,error:n}}}async resume(t){let e=await this.store.loadRunState(t);if(!e)throw new Error(`No run found with ID: ${t}`);if(e.status==="completed"||e.status==="failed")throw new Error(`Cannot resume a ${e.status} run`);let i={...e,status:"running",pausedAt:void 0,updatedAt:Date.now()};return await this.store.saveRunState(t,i),this.emit({type:"flow:resumed",runId:t,timestamp:Date.now(),data:{currentStep:i.currentStep}}),this.executeLoop(t,i)}async pause(t){let e=await this.store.loadRunState(t);if(!e)throw new Error(`No run found with ID: ${t}`);let i={...e,status:"paused",pausedAt:Date.now(),updatedAt:Date.now()};await this.store.saveRunState(t,i),this.emit({type:"flow:paused",runId:t,timestamp:Date.now(),data:{currentStep:i.currentStep}});}async executeLoop(t,e){let i=this.flow.settings.max_total_steps??1e6,s=this.flow.settings.timeout_ms,n=e,p=0;for(;p<i;){if(this.aborted)return n={...n,status:"cancelled",updatedAt:Date.now()},await this.store.saveRunState(t,n),{runId:t,status:"cancelled",data:await this.store.getAllData(t),finalStep:n.currentStep,stepHistory:n.stepHistory,durationMs:Date.now()-n.startedAt};if(s&&Date.now()-n.startedAt>s)return n={...n,status:"completed",updatedAt:Date.now()},await this.store.saveRunState(t,n),{runId:t,status:"timeout",intent:"timeout",data:await this.store.getAllData(t),finalStep:n.currentStep,stepHistory:n.stepHistory,durationMs:Date.now()-n.startedAt};let o=n.currentStep,d=this.flow.terminal_states[o];if(d){n={...n,status:"completed",updatedAt:Date.now()},await this.store.saveRunState(t,n);let a=await this.store.getAllData(t),c={runId:t,status:"completed",intent:d.return_intent,data:g(d.return_artifacts,a),finalStep:o,stepHistory:n.stepHistory,durationMs:Date.now()-n.startedAt};return this.emit({type:"flow:complete",runId:t,timestamp:Date.now(),data:{...c}}),this.options.onComplete?.(c),c}let m=S(this.flow,n,o);if(m.broken){n=m.newState,await this.store.saveRunState(t,n),p++;continue}n=m.newState;let F=await this.store.getAllData(t),_=h(this.flow,o,F),j={runId:t,stepName:o,components:this.components,store:this.store,signal:this.options.signal,emit:(a,c)=>{this.emit({type:"step:complete",runId:t,timestamp:Date.now(),data:{event:a,payload:c}});}};this.emit({type:"step:start",runId:t,timestamp:Date.now(),data:{step:o,input:_}});let l;try{let a=this.handlers.get(o);if(!a)throw new Error(`No handler registered for step "${o}"`);l=await a(_,j);}catch(a){let c=a instanceof Error?a:new Error(String(a));this.emit({type:"step:error",runId:t,timestamp:Date.now(),data:{step:o,error:c.message}}),l={result:"failure",data:{error:c.message}};}if(l.data)for(let[a,c]of Object.entries(l.data))await this.store.setData(t,a,c);this.emit({type:"step:complete",runId:t,timestamp:Date.now(),data:{step:o,result:l.result}}),this.options.onStep?.(o,l);let b=w(this.flow,n,o,l);if(n=b.newState,b.shouldRetry){await this.store.saveRunState(t,n);let a=this.flow.steps[o];if(a.retry?.delay_ms){let c=n.retryCounts[o]??0,D=a.retry.backoff_multiplier?a.retry.delay_ms*Math.pow(a.retry.backoff_multiplier,c-1):a.retry.delay_ms;await this.sleep(D);}p++;continue}await this.store.saveRunState(t,n),this.emit({type:"transition",runId:t,timestamp:Date.now(),data:{from:o,to:n.currentStep,result:l.result}}),this.options.onTransition?.(o,n.currentStep),p++;}return n={...n,status:"completed",updatedAt:Date.now()},await this.store.saveRunState(t,n),{runId:t,status:"max_iterations",intent:"max_iterations",data:await this.store.getAllData(t),finalStep:n.currentStep,stepHistory:n.stepHistory,durationMs:Date.now()-n.startedAt}}};function A(r,t,e){return new u(r,t,e)}async function x(r){return (await import('yaml')).parse(r)}async function P(r){let t=await fetch(r);if(!t.ok)throw new Error(`Failed to load flow from ${r}: ${t.statusText}`);let e=t.headers.get("content-type")??"",i=await t.text();return e.includes("json")||r.endsWith(".json")?JSON.parse(i):x(i)}async function H(r){let e=await(await import('fs/promises')).readFile(r,"utf-8");return r.endsWith(".json")?JSON.parse(e):x(e)}function k(r){let t=[];if(!r||typeof r!="object")return ["Flow must be an object"];let e=r;if(!e.settings||typeof e.settings!="object"?t.push('Flow must have a "settings" object'):typeof e.settings.start_step!="string"&&t.push("settings.start_step must be a string"),!e.steps||typeof e.steps!="object")t.push('Flow must have a "steps" object');else {let i=e.steps;for(let[s,n]of Object.entries(i)){if(!n||typeof n!="object"){t.push(`Step "${s}" must be an object`);continue}let p=n;(!p.transitions||typeof p.transitions!="object")&&t.push(`Step "${s}" must have a "transitions" object`),p.failure_transitions!==void 0&&typeof p.failure_transitions!="object"&&t.push(`Step "${s}" failure_transitions must be an object when provided`);}}if(!e.terminal_states||typeof e.terminal_states!="object")t.push('Flow must have a "terminal_states" object');else {let i=e.terminal_states;for(let[s,n]of Object.entries(i)){if(!n||typeof n!="object"){t.push(`Terminal state "${s}" must be an object`);continue}typeof n.return_intent!="string"&&t.push(`Terminal state "${s}" must have a "return_intent" string`);}}return t}async function O(r){let t;typeof r=="string"?r.startsWith("http://")||r.startsWith("https://")?t=await P(r):r.includes("{")?t=JSON.parse(r):t=await H(r):t=r;let e=k(t);if(e.length>0)throw new Error(`Invalid step flow configuration:
|
|
2
|
+
- ${e.join(`
|
|
3
|
+
- `)}`);return t}var C={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://github.com/yaml-flow/schema/flow.json",title:"YamlFlow Configuration",description:"Schema for yaml-flow workflow definitions",type:"object",required:["settings","steps","terminal_states"],properties:{id:{type:"string",description:"Optional flow identifier"},settings:{type:"object",description:"Flow-level settings",required:["start_step"],properties:{start_step:{type:"string",description:"Step to start execution from"},max_total_steps:{type:"integer",minimum:1,default:1e6,description:"Maximum steps before forced termination"},timeout_ms:{type:"integer",minimum:0,description:"Flow timeout in milliseconds"},invoke_timeout_ms:{type:"integer",minimum:0,description:"Per-ref invocation timeout in milliseconds"}},additionalProperties:false},steps:{type:"object",description:"Step definitions",minProperties:1,additionalProperties:{$ref:"#/definitions/step"}},terminal_states:{type:"object",description:"Terminal state definitions",minProperties:1,additionalProperties:{$ref:"#/definitions/terminal_state"}}},additionalProperties:false,definitions:{step:{type:"object",description:"Individual step configuration",required:["transitions"],properties:{description:{type:"string",description:"Human-readable description"},expects_data:{type:"array",items:{type:"string"},description:"Data keys this step expects as input"},produces_data:{type:"array",items:{type:"string"},description:"Data keys this step produces as output"},transitions:{type:"object",description:"Mapping of result -> next step name",additionalProperties:{type:"string"},minProperties:1},failure_transitions:{type:"object",description:"Mapping of failure-like results (e.g. failure, timeout) -> next step name",additionalProperties:{type:"string"}},retry:{$ref:"#/definitions/retry_config"},circuit_breaker:{$ref:"#/definitions/circuit_breaker_config"}},additionalProperties:false},terminal_state:{type:"object",description:"Terminal state configuration",required:["return_intent"],properties:{description:{type:"string",description:"Human-readable description"},return_intent:{type:"string",description:"Intent/status to return (e.g., 'success', 'error')"},return_artifacts:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}},{type:"boolean",const:false}],description:"Data key(s) to include in result, or false to exclude"},expects_data:{type:"array",items:{type:"string"},description:"Data keys this terminal state expects"}},additionalProperties:false},retry_config:{type:"object",description:"Retry configuration for step failures",required:["max_attempts"],properties:{max_attempts:{type:"integer",minimum:1,description:"Maximum retry attempts"},delay_ms:{type:"integer",minimum:0,description:"Delay between retries in ms"},backoff_multiplier:{type:"number",minimum:1,description:"Backoff multiplier (e.g., 2 for exponential)"}},additionalProperties:false},circuit_breaker_config:{type:"object",description:"Circuit breaker configuration for loops",required:["max_iterations","on_open"],properties:{max_iterations:{type:"integer",minimum:1,description:"Maximum iterations before circuit opens"},on_open:{type:"string",description:"Step to transition to when circuit opens"}},additionalProperties:false}}};var R=b(q$1(),1);var f=null;function B(){if(f)return f;let r=new R.default({allErrors:true});return L(r),f=r.compile(C),f}function q(r){let t=B();return t(r)?{ok:true,errors:[]}:{ok:false,errors:(t.errors??[]).map(s=>`${s.instancePath||"/"}: ${s.message??"unknown error"}`)}}
|
|
4
|
+
export{w as a,S as b,h as c,g as d,y as e,u as f,A as g,x as h,k as i,O as j,q as k};//# sourceMappingURL=chunk-QWBNDVUA.js.map
|
|
5
|
+
//# sourceMappingURL=chunk-QWBNDVUA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkG4XXRHL2_cjs=require('./chunk-G4XXRHL2.cjs'),chunkIXZG74EW_cjs=require('./chunk-IXZG74EW.cjs');function b(e){return JSON.parse(JSON.stringify(e))}function E(e){let r=e.provides&&e.provides.length>0?e.provides.map(n=>n.bindTo):[e.id];return {requires:e.requires&&e.requires.length>0?[...e.requires]:void 0,provides:r,taskHandlers:[e.id],description:e.meta?.title??e.id}}function I(e){let r=new Map;for(let[n,u]of e.entries()){let o=u.provides&&u.provides.length>0?u.provides:[{bindTo:n,ref:"card_data"}];for(let h of o)r.set(h.bindTo,n);}return r}function O(e,r){let n=I(e),u=e.get(r);if(u){for(let o of u.requires??[])if(!n.has(o))throw new Error(`Card "${r}" requires token "${o}" but no card provides it`)}}var F={CARD_PREFIX:"yf:cards:",RUNTIME_OUT_PREFIX:"yf:runtime-out:cards:",STATUS_KEY:"yf:runtime-out:status",writeCard(e,r){try{localStorage.setItem(this.CARD_PREFIX+e,JSON.stringify(r));}catch(n){console.warn(`Failed to write card ${e} to localStorage:`,n);}},readCard(e){try{let r=localStorage.getItem(this.CARD_PREFIX+e);return r?JSON.parse(r):null}catch(r){return console.warn(`Failed to read card ${e} from localStorage:`,r),null}},readAllCards(e){let r={};for(let n of e){let u=this.readCard(n);u&&(r[n]=u);}return r},writeComputedArtifact(e){if(!(!e||!e.card_id))try{localStorage.setItem(this.RUNTIME_OUT_PREFIX+String(e.card_id),JSON.stringify(e));}catch(r){console.warn(`Failed to write computed artifact ${e.card_id}:`,r);}},readComputedArtifact(e){try{let r=localStorage.getItem(this.RUNTIME_OUT_PREFIX+e);return r?JSON.parse(r):null}catch(r){return console.warn(`Failed to read computed artifact ${e}:`,r),null}},readAllComputedArtifacts(e){let r={};for(let n of e){let u=this.readComputedArtifact(n);u&&(r[n]=u);}return r},writeStatusSnapshot(e){try{localStorage.setItem(this.STATUS_KEY,JSON.stringify(e));}catch(r){console.warn("Failed to write status snapshot to localStorage:",r);}},readStatusSnapshot(){try{let e=localStorage.getItem(this.STATUS_KEY);return e?JSON.parse(e):null}catch(e){return console.warn("Failed to read status snapshot from localStorage:",e),null}},clear(){let e=[];for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);n&&(n.startsWith(this.CARD_PREFIX)||n.startsWith(this.RUNTIME_OUT_PREFIX)||n===this.STATUS_KEY)&&e.push(n);}for(let r of e)localStorage.removeItem(r);}};function H(e,r={}){let n=Array.isArray(e)?{}:{id:e.id,title:e.title,mode:e.mode,positions:e.positions,settings:e.settings},u=Array.isArray(e)?e:e.nodes,o=new Map;for(let t of u){if(o.has(t.id))throw new Error(`Duplicate card ID: "${t.id}"`);o.set(t.id,b(t));}let h=new Set,S=r.taskExecutor,L=r.sourceAdapters??{},d=r.defaultSourceAdapter,m=null,A=(t,g)=>{let a={events:t,graph:g,nodes:v()};for(let w of h)w(a);},_=t=>async g=>{let a=o.get(t);if(!a)return "task-initiate-failure";let w={};for(let R of a.requires??[]){let y=g.state[R];if(!y||typeof y!="object")continue;let k=y.provides_data;!k||typeof k!="object"||Object.prototype.hasOwnProperty.call(k,R)&&(w[R]=k[R]);}let p={};if(a.source_defs&&a.source_defs.length>0){let R=L[t]??d,y=S?await S({card:a,input:g}):R?await R({card:a,input:g}):void 0;if(y&&typeof y=="object")for(let k of a.source_defs)Object.prototype.hasOwnProperty.call(y,k.bindTo)?p[k.bindTo]=y[k.bindTo]:a.source_defs.length===1&&(p[k.bindTo]=y);}let c={id:a.id,card_data:b(a.card_data??{}),requires:w,source_defs:a.source_defs,compute:a.compute};c._sourcesData=p,c.compute&&c.compute.length>0&&await chunkIXZG74EW_cjs.a.run(c,{sourcesData:p});let T={};if(a.provides&&a.provides.length>0)for(let{bindTo:R,ref:y}of a.provides)T[R]=chunkIXZG74EW_cjs.a.resolve(c,y);else T[a.id]={...c.card_data??{},...c.computed_values??{},...c._sourcesData??{}};let B={provides_data:T,card_data:c.card_data??{},computed_values:c.computed_values??{},fetched_sources:p,requires:w};return m?.resolveCallback(g.callbackToken,B),"task-initiated"},s={},f={};for(let[t,g]of o.entries())O(o,t),s[t]=E(g),f[t]=_(t);let l={id:n.id??`browser-board-${Date.now()}`,settings:{completion:"manual",execution_mode:"eligibility-mode",...n.settings??{},...r.graphSettings??{}},tasks:s},C=r.reactiveOptions?.onDrain,i=chunkG4XXRHL2_cjs.u(l,{...r.reactiveOptions??{},handlers:f,onDrain:(t,g,a)=>{C?.(t,g,a),A(t,g);}},r.executionId);m=i;function v(){let t=i.getState(),g=[];for(let[a,w]of o.entries()){let p=t.state.tasks[a]?.data,c=t.state.tasks[a],T={...w.card_data??{},...p&&typeof p.card_data=="object"?p.card_data:{}},B=c?.status==="running"?"loading":c?.status,R={...T,...B?{status:B}:{},...c?.lastUpdated?{lastRun:c.lastUpdated}:{},...c?.status==="failed"&&c.error?{error:c.error}:{}};g.push({id:a,card:b(w),card_data:R,requires:p&&typeof p.requires=="object"?b(p.requires):{},computed_values:p&&typeof p.computed_values=="object"?b(p.computed_values):{},runtime_state:c?b(c):{}});}return g}return {getGraph:()=>i,getState:()=>i.getState(),getSchedule:()=>i.getSchedule(),getNodes:()=>v(),getBoard:()=>({...n,nodes:v()}),subscribe(t){return h.add(t),t({events:[],graph:i.getState(),nodes:v()}),()=>h.delete(t)},addCard(t){if(o.has(t.id))throw new Error(`Card "${t.id}" already exists`);o.set(t.id,b(t)),O(o,t.id),i.registerHandler(t.id,_(t.id)),i.addNode(t.id,E(t));},upsertCard(t){o.set(t.id,b(t)),O(o,t.id),i.registerHandler(t.id,_(t.id)),i.addNode(t.id,E(t));},removeCard(t){o.delete(t),i.unregisterHandler(t),i.removeNode(t);},patchCardState(t,g){let a=o.get(t);if(!a)throw new Error(`Card "${t}" not found`);a.card_data={...a.card_data??{},...g},i.retrigger(t);},retrigger(t){i.retrigger(t);},retriggerAll(){i.retriggerAll(Array.from(o.keys()));},push(t){i.push(t);},pushAll(t){i.pushAll(t);},dispose(){h.clear(),i.dispose();}}}function G(e){return e==="running"||e==="in-progress"?"loading":e==="failed"?"error":"fresh"}function D(e){return e==="loading"?"in-progress":e==="error"?"failed":e==="stale"?"pending":e==="fresh"?"completed":"pending"}function M(e,r){let n=r&&typeof r=="object"&&!Array.isArray(r)?r:{};return {schema_version:n.schema_version||"v1",card_id:typeof n.card_id=="string"?n.card_id:e,card_data:n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?structuredClone(n.card_data):{},computed_values:n.computed_values&&typeof n.computed_values=="object"&&!Array.isArray(n.computed_values)?structuredClone(n.computed_values):{}}}function P(e,r){if(!e||typeof e!="object")throw new Error("payload must be an object");if(!r)throw new Error("cardId is required");let u=(Array.isArray(e.cardDefinitions)?e.cardDefinitions:[]).find(t=>t.id===r);if(!u)throw new Error(`cardDefinitions has no entry with id ${r}`);let o=e.statusSnapshot&&typeof e.statusSnapshot=="object"?e.statusSnapshot:{},h=e.cardRuntimeById&&typeof e.cardRuntimeById=="object"?e.cardRuntimeById:{},S=e.dataObjectsByToken&&typeof e.dataObjectsByToken=="object"?e.dataObjectsByToken:{},d=(Array.isArray(o.cards)?o.cards:[]).find(t=>t.name===r),m=structuredClone(u),A=M(r,h[r]),s={...m.card_data&&typeof m.card_data=="object"&&!Array.isArray(m.card_data)?m.card_data:{},...A.card_data||{},status:G(d?.status),lastRun:d?.runtime?.last_transition_at??null};d?.error?.message&&(s.error=d.error.message);let f=d?{task_status:d.status??null,card_status:G(d.status),runtime:structuredClone(d.runtime??{}),error:d.error?structuredClone(d.error):null,blocked_by:Array.isArray(d.blocked_by)?structuredClone(d.blocked_by):[],requires_missing:Array.isArray(d.requires_missing)?structuredClone(d.requires_missing):[]}:{task_status:null,card_status:s.status??"fresh",runtime:{last_transition_at:s.lastRun??null},error:s.error?{message:s.error}:null,blocked_by:[],requires_missing:[]},l=Array.isArray(m.requires)?m.requires:[],C={};for(let[t,g]of Object.entries(S))C[t]=structuredClone(g);for(let t of l)Object.prototype.hasOwnProperty.call(C,t)||(C[t]=null);let v=(e.cardChatsByCardId&&typeof e.cardChatsByCardId=="object"?e.cardChatsByCardId:{})[r],q=v?{messages:Array.isArray(v.messages)?v.messages:[],receiving:!!v.receiving,processing:!!v.processing}:null;return {id:r,card:m,card_data:s,requires:C,computed_values:A.computed_values,runtime_state:f,card_chats:q}}function $(e){if(!e||typeof e!="object")throw new Error("payload must be an object");return (Array.isArray(e.cardDefinitions)?e.cardDefinitions:[]).map(n=>P(e,n.id))}function J({boardPath:e,cardDefinitions:r,runtimeModels:n,graphState:u}){let o=Array.isArray(r)?r:[],h=Array.isArray(n)?n:[],S=new Map(h.map(s=>[s.id,s])),d=u.state?.tasks??{},m={};for(let s of h)s?.id&&(m[s.id]={schema_version:"v1",card_id:s.id,card_data:structuredClone(s.card_data??{}),computed_values:structuredClone(s.computed_values??{})});let A={};for(let s of Object.keys(d)){let f=d[s]?.data?.provides_data;if(f&&typeof f=="object")for(let l of Object.keys(f))A[l]=structuredClone(f[l]);}let _=o.map(s=>{let f=S.get(s.id)??{},l=d[s.id],C=typeof l?.status=="string"?l.status:D(f.card_data?.status),i=typeof l?.error=="string"?l.error:typeof f.card_data?.error=="string"?f.card_data.error:null;return {name:s.id,status:C,...i?{error:{message:i,code:"TASK_FAILED",at:l?.failedAt??null,source:"browser-runtime"}}:{},requires:Array.isArray(s.requires)?s.requires:[],requires_satisfied:[],requires_missing:[],provides_declared:Array.isArray(s.provides)?s.provides.map(v=>v.bindTo):[s.id],provides_runtime:Object.keys(l?.data?.provides_data??{}).sort(),blocked_by:[],unblocks:[],runtime:{attempt_count:l?.executionCount??0,restart_count:l?.retryCount??0,in_progress_since:C==="in-progress"?l?.startedAt??null:null,last_transition_at:l?.lastUpdated??f.card_data?.lastRun??null,last_completed_at:l?.completedAt??null,last_restarted_at:l?.startedAt??null,status_age_ms:null}}});return {cardDefinitions:structuredClone(o),cardRuntimeById:m,dataObjectsByToken:A,statusSnapshot:{schema_version:"v1",meta:{board:{path:e??"browser-runtime"}},summary:{card_count:_.length,completed:_.filter(s=>s.status==="completed").length,eligible:0,pending:_.filter(s=>s.status==="pending").length,blocked:0,unresolved:0,failed:_.filter(s=>s.status==="failed").length,in_progress:_.filter(s=>s.status==="in-progress").length,orphan_cards:0,topology:{edge_count:0,max_fan_out_card:null,max_fan_out:0}},cards:_}}}exports.a=F;exports.b=H;exports.c=P;exports.d=$;exports.e=J;//# sourceMappingURL=chunk-S6DRP2HX.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-S6DRP2HX.cjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';var chunkGNFE24S7_cjs=require('./chunk-GNFE24S7.cjs');var Qe=chunkGNFE24S7_cjs.a(I=>{Object.defineProperty(I,"__esModule",{value:true});I.regexpCode=I.getEsmExportName=I.getProperty=I.safeStringify=I.stringify=I.strConcat=I.addCodeArg=I.str=I._=I.nil=I._Code=I.Name=I.IDENTIFIER=I._CodeOrName=void 0;var Je=class{};I._CodeOrName=Je;I.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var we=class extends Je{constructor(e){if(super(),!I.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};I.Name=we;var Q=class extends Je{constructor(e){super(),this._items=typeof e=="string"?[e]:e;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;let e=this._items[0];return e===""||e==='""'}get str(){var e;return (e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,s)=>`${r}${s}`,"")}get names(){var e;return (e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,s)=>(s instanceof we&&(r[s.str]=(r[s.str]||0)+1),r),{})}};I._Code=Q;I.nil=new Q("");function Ls(t,...e){let r=[t[0]],s=0;for(;s<e.length;)or(r,e[s]),r.push(t[++s]);return new Q(r)}I._=Ls;var nr=new Q("+");function Hs(t,...e){let r=[We(t[0])],s=0;for(;s<e.length;)r.push(nr),or(r,e[s]),r.push(nr,We(t[++s]));return $a(r),new Q(r)}I.str=Hs;function or(t,e){e instanceof Q?t.push(...e._items):e instanceof we?t.push(e):t.push(ba(e));}I.addCodeArg=or;function $a(t){let e=1;for(;e<t.length-1;){if(t[e]===nr){let r=va(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+";}e++;}}function va(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof we||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof we))return `"${t}${e.slice(1)}`}function wa(t,e){return e.emptyStr()?t:t.emptyStr()?e:Hs`${t}${e}`}I.strConcat=wa;function ba(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:We(Array.isArray(t)?t.join(","):t)}function Ea(t){return new Q(We(t))}I.stringify=Ea;function We(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}I.safeStringify=We;function Sa(t){return typeof t=="string"&&I.IDENTIFIER.test(t)?new Q(`.${t}`):Ls`[${t}]`}I.getProperty=Sa;function Pa(t){if(typeof t=="string"&&I.IDENTIFIER.test(t))return new Q(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}I.getEsmExportName=Pa;function Na(t){return new Q(t.toString())}I.regexpCode=Na;});var cr=chunkGNFE24S7_cjs.a(G=>{Object.defineProperty(G,"__esModule",{value:true});G.ValueScope=G.ValueScopeName=G.Scope=G.varKinds=G.UsedValueState=void 0;var H=Qe(),ar=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value;}},wt;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed";})(wt||(G.UsedValueState=wt={}));G.varKinds={const:new H.Name("const"),let:new H.Name("let"),var:new H.Name("var")};var bt=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r;}toName(e){return e instanceof H.Name?e:this.name(e)}name(e){return new H.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return `${e}${r.index++}`}_nameGroup(e){var r,s;if(!((s=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||s===void 0)&&s.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};G.Scope=bt;var Et=class extends H.Name{constructor(e,r){super(r),this.prefix=e;}setValue(e,{property:r,itemIndex:s}){this.value=e,this.scopePath=(0, H._)`.${new H.Name(r)}[${s}]`;}};G.ValueScopeName=Et;var ka=(0, H._)`\n`,ir=class extends bt{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?ka:H.nil};}get(){return this._scope}name(e){return new Et(e,this._newName(e))}value(e,r){var s;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,a=(s=r.key)!==null&&s!==void 0?s:r.ref,i=this._values[o];if(i){let u=i.get(a);if(u)return u}else i=this._values[o]=new Map;i.set(a,n);let c=this._scope[o]||(this._scope[o]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(e,r){let s=this._values[e];if(s)return s.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,s=>{if(s.scopePath===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return (0, H._)`${e}${s.scopePath}`})}scopeCode(e=this._values,r,s){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,s)}_reduceValues(e,r,s={},n){let o=H.nil;for(let a in e){let i=e[a];if(!i)continue;let c=s[a]=s[a]||new Map;i.forEach(l=>{if(c.has(l))return;c.set(l,wt.Started);let u=r(l);if(u){let d=this.opts.es5?G.varKinds.var:G.varKinds.const;o=(0, H._)`${o}${d} ${l} = ${u};${this.opts._n}`;}else if(u=n?.(l))o=(0, H._)`${o}${u}${this.opts._n}`;else throw new ar(l);c.set(l,wt.Completed);});}return o}};G.ValueScope=ir;});var S=chunkGNFE24S7_cjs.a(E=>{Object.defineProperty(E,"__esModule",{value:true});E.or=E.and=E.not=E.CodeGen=E.operators=E.varKinds=E.ValueScopeName=E.ValueScope=E.Scope=E.Name=E.regexpCode=E.stringify=E.getProperty=E.nil=E.strConcat=E.str=E._=void 0;var k=Qe(),Z=cr(),pe=Qe();Object.defineProperty(E,"_",{enumerable:true,get:function(){return pe._}});Object.defineProperty(E,"str",{enumerable:true,get:function(){return pe.str}});Object.defineProperty(E,"strConcat",{enumerable:true,get:function(){return pe.strConcat}});Object.defineProperty(E,"nil",{enumerable:true,get:function(){return pe.nil}});Object.defineProperty(E,"getProperty",{enumerable:true,get:function(){return pe.getProperty}});Object.defineProperty(E,"stringify",{enumerable:true,get:function(){return pe.stringify}});Object.defineProperty(E,"regexpCode",{enumerable:true,get:function(){return pe.regexpCode}});Object.defineProperty(E,"Name",{enumerable:true,get:function(){return pe.Name}});var kt=cr();Object.defineProperty(E,"Scope",{enumerable:true,get:function(){return kt.Scope}});Object.defineProperty(E,"ValueScope",{enumerable:true,get:function(){return kt.ValueScope}});Object.defineProperty(E,"ValueScopeName",{enumerable:true,get:function(){return kt.ValueScopeName}});Object.defineProperty(E,"varKinds",{enumerable:true,get:function(){return kt.varKinds}});E.operators={GT:new k._Code(">"),GTE:new k._Code(">="),LT:new k._Code("<"),LTE:new k._Code("<="),EQ:new k._Code("==="),NEQ:new k._Code("!=="),NOT:new k._Code("!"),OR:new k._Code("||"),AND:new k._Code("&&"),ADD:new k._Code("+")};var ue=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ur=class extends ue{constructor(e,r,s){super(),this.varKind=e,this.name=r,this.rhs=s;}render({es5:e,_n:r}){let s=e?Z.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return `${s} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Re(this.rhs,e,r)),this}get names(){return this.rhs instanceof k._CodeOrName?this.rhs.names:{}}},St=class extends ue{constructor(e,r,s){super(),this.lhs=e,this.rhs=r,this.sideEffects=s;}render({_n:e}){return `${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof k.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Re(this.rhs,e,r),this}get names(){let e=this.lhs instanceof k.Name?{}:{...this.lhs.names};return Nt(e,this.rhs)}},lr=class extends St{constructor(e,r,s,n){super(e,s,n),this.op=r;}render({_n:e}){return `${this.lhs} ${this.op}= ${this.rhs};`+e}},dr=class extends ue{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `${this.label}:`+e}},fr=class extends ue{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `break${this.label?` ${this.label}`:""};`+e}},hr=class extends ue{constructor(e){super(),this.error=e;}render({_n:e}){return `throw ${this.error};`+e}get names(){return this.error.names}},pr=class extends ue{constructor(e){super(),this.code=e;}render({_n:e}){return `${this.code};`+e}optimizeNodes(){return `${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Re(this.code,e,r),this}get names(){return this.code instanceof k._CodeOrName?this.code.names:{}}},Be=class extends ue{constructor(e=[]){super(),this.nodes=e;}render(e){return this.nodes.reduce((r,s)=>r+s.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let s=e[r].optimizeNodes();Array.isArray(s)?e.splice(r,1,...s):s?e[r]=s:e.splice(r,1);}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:s}=this,n=s.length;for(;n--;){let o=s[n];o.optimizeNames(e,r)||(qa(e,o.names),s.splice(n,1));}return s.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Se(e,r.names),{})}},le=class extends Be{render(e){return "{"+e._n+super.render(e)+"}"+e._n}},mr=class extends Be{},Ie=class extends le{};Ie.kind="else";var be=class t extends le{constructor(e,r){super(r),this.condition=e;}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===true)return this.nodes;let r=this.else;if(r){let s=r.optimizeNodes();r=this.else=Array.isArray(s)?new Ie(s):s;}if(r)return e===false?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Gs(e),r instanceof t?[r]:r.nodes);if(!(e===false||!this.nodes.length))return this}optimizeNames(e,r){var s;if(this.else=(s=this.else)===null||s===void 0?void 0:s.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Re(this.condition,e,r),this}get names(){let e=super.names;return Nt(e,this.condition),this.else&&Se(e,this.else.names),e}};be.kind="if";var Ee=class extends le{};Ee.kind="for";var yr=class extends Ee{constructor(e){super(),this.iteration=e;}render(e){return `for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Re(this.iteration,e,r),this}get names(){return Se(super.names,this.iteration.names)}},_r=class extends Ee{constructor(e,r,s,n){super(),this.varKind=e,this.name=r,this.from=s,this.to=n;}render(e){let r=e.es5?Z.varKinds.var:this.varKind,{name:s,from:n,to:o}=this;return `for(${r} ${s}=${n}; ${s}<${o}; ${s}++)`+super.render(e)}get names(){let e=Nt(super.names,this.from);return Nt(e,this.to)}},Pt=class extends Ee{constructor(e,r,s,n){super(),this.loop=e,this.varKind=r,this.name=s,this.iterable=n;}render(e){return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Re(this.iterable,e,r),this}get names(){return Se(super.names,this.iterable.names)}},Xe=class extends le{constructor(e,r,s){super(),this.name=e,this.args=r,this.async=s;}render(e){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Xe.kind="func";var Ye=class extends Be{render(e){return "return "+super.render(e)}};Ye.kind="return";var gr=class extends le{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var s,n;return super.optimizeNames(e,r),(s=this.catch)===null||s===void 0||s.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Se(e,this.catch.names),this.finally&&Se(e,this.finally.names),e}},Ze=class extends le{constructor(e){super(),this.error=e;}render(e){return `catch(${this.error})`+super.render(e)}};Ze.kind="catch";var et=class extends le{render(e){return "finally"+super.render(e)}};et.kind="finally";var $r=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=e,this._scope=new Z.Scope({parent:e}),this._nodes=[new mr];}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let s=this._extScope.value(e,r);return (this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,s,n){let o=this._scope.toName(r);return s!==void 0&&n&&(this._constants[o.str]=s),this._leafNode(new ur(e,o,s)),o}const(e,r,s){return this._def(Z.varKinds.const,e,r,s)}let(e,r,s){return this._def(Z.varKinds.let,e,r,s)}var(e,r,s){return this._def(Z.varKinds.var,e,r,s)}assign(e,r,s){return this._leafNode(new St(e,r,s))}add(e,r){return this._leafNode(new lr(e,E.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==k.nil&&this._leafNode(new pr(e)),this}object(...e){let r=["{"];for(let[s,n]of e)r.length>1&&r.push(","),r.push(s),(s!==n||this.opts.es5)&&(r.push(":"),(0, k.addCodeArg)(r,n));return r.push("}"),new k._Code(r)}if(e,r,s){if(this._blockNode(new be(e)),r&&s)this.code(r).else().code(s).endIf();else if(r)this.code(r).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new be(e))}else(){return this._elseNode(new Ie)}endIf(){return this._endBlockNode(be,Ie)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new yr(e),r)}forRange(e,r,s,n,o=this.opts.es5?Z.varKinds.var:Z.varKinds.let){let a=this._scope.toName(e);return this._for(new _r(o,a,r,s),()=>n(a))}forOf(e,r,s,n=Z.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let a=r instanceof k.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, k._)`${a}.length`,i=>{this.var(o,(0, k._)`${a}[${i}]`),s(o);})}return this._for(new Pt("of",n,o,r),()=>s(o))}forIn(e,r,s,n=this.opts.es5?Z.varKinds.var:Z.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0, k._)`Object.keys(${r})`,s);let o=this._scope.toName(e);return this._for(new Pt("in",n,o,r),()=>s(o))}endFor(){return this._endBlockNode(Ee)}label(e){return this._leafNode(new dr(e))}break(e){return this._leafNode(new fr(e))}return(e){let r=new Ye;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ye)}try(e,r,s){if(!r&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new gr;if(this._blockNode(n),this.code(e),r){let o=this.name("e");this._currNode=n.catch=new Ze(o),r(o);}return s&&(this._currNode=n.finally=new et,this.code(s)),this._endBlockNode(Ze,et)}throw(e){return this._leafNode(new hr(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let s=this._nodes.length-r;if(s<0||e!==void 0&&s!==e)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=k.nil,s,n){return this._blockNode(new Xe(e,r,s)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Xe)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants);}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e);}_endBlockNode(e,r){let s=this._currNode;if(s instanceof e||r&&s instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof be))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e;}};E.CodeGen=$r;function Se(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Nt(t,e){return e instanceof k._CodeOrName?Se(t,e.names):t}function Re(t,e,r){if(t instanceof k.Name)return s(t);if(!n(t))return t;return new k._Code(t._items.reduce((o,a)=>(a instanceof k.Name&&(a=s(a)),a instanceof k._Code?o.push(...a._items):o.push(a),o),[]));function s(o){let a=r[o.str];return a===void 0||e[o.str]!==1?o:(delete e[o.str],a)}function n(o){return o instanceof k._Code&&o._items.some(a=>a instanceof k.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function qa(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0);}function Gs(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0, k._)`!${vr(t)}`}E.not=Gs;var ja=Js(E.operators.AND);function Oa(...t){return t.reduce(ja)}E.and=Oa;var Ia=Js(E.operators.OR);function Ra(...t){return t.reduce(Ia)}E.or=Ra;function Js(t){return (e,r)=>e===k.nil?r:r===k.nil?e:(0, k._)`${vr(e)} ${t} ${vr(r)}`}function vr(t){return t instanceof k.Name?t:(0, k._)`(${t})`}});var j=chunkGNFE24S7_cjs.a(P=>{Object.defineProperty(P,"__esModule",{value:true});P.checkStrictMode=P.getErrorPath=P.Type=P.useFunc=P.setEvaluated=P.evaluatedPropsToName=P.mergeEvaluated=P.eachItem=P.unescapeJsonPointer=P.escapeJsonPointer=P.escapeFragment=P.unescapeFragment=P.schemaRefOrVal=P.schemaHasRulesButRef=P.schemaHasRules=P.checkUnknownRules=P.alwaysValidSchema=P.toHash=void 0;var T=S(),Ta=Qe();function Ca(t){let e={};for(let r of t)e[r]=true;return e}P.toHash=Ca;function Ma(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?true:(Bs(t,e),!Xs(e,t.self.RULES.all))}P.alwaysValidSchema=Ma;function Bs(t,e=t.schema){let{opts:r,self:s}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=s.RULES.keywords;for(let o in e)n[o]||en(t,`unknown keyword: "${o}"`);}P.checkUnknownRules=Bs;function Xs(t,e){if(typeof t=="boolean")return !t;for(let r in t)if(e[r])return true;return false}P.schemaHasRules=Xs;function Aa(t,e){if(typeof t=="boolean")return !t;for(let r in t)if(r!=="$ref"&&e.all[r])return true;return false}P.schemaHasRulesButRef=Aa;function Da({topSchemaRef:t,schemaPath:e},r,s,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, T._)`${r}`}return (0, T._)`${t}${e}${(0, T.getProperty)(s)}`}P.schemaRefOrVal=Da;function Va(t){return Ys(decodeURIComponent(t))}P.unescapeFragment=Va;function za(t){return encodeURIComponent(br(t))}P.escapeFragment=za;function br(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}P.escapeJsonPointer=br;function Ys(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}P.unescapeJsonPointer=Ys;function Ua(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t);}P.eachItem=Ua;function Ws({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:s}){return (n,o,a,i)=>{let c=a===void 0?o:a instanceof T.Name?(o instanceof T.Name?t(n,o,a):e(n,o,a),a):o instanceof T.Name?(e(n,a,o),o):r(o,a);return i===T.Name&&!(c instanceof T.Name)?s(n,c):c}}P.mergeEvaluated={props:Ws({mergeNames:(t,e,r)=>t.if((0, T._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0, T._)`${e} === true`,()=>t.assign(r,true),()=>t.assign(r,(0, T._)`${r} || {}`).code((0, T._)`Object.assign(${r}, ${e})`));}),mergeToName:(t,e,r)=>t.if((0, T._)`${r} !== true`,()=>{e===true?t.assign(r,true):(t.assign(r,(0, T._)`${r} || {}`),Er(t,r,e));}),mergeValues:(t,e)=>t===true?true:{...t,...e},resultToName:Zs}),items:Ws({mergeNames:(t,e,r)=>t.if((0, T._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0, T._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0, T._)`${r} !== true`,()=>t.assign(r,e===true?true:(0, T._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===true?true:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Zs(t,e){if(e===true)return t.var("props",true);let r=t.var("props",(0, T._)`{}`);return e!==void 0&&Er(t,r,e),r}P.evaluatedPropsToName=Zs;function Er(t,e,r){Object.keys(r).forEach(s=>t.assign((0, T._)`${e}${(0, T.getProperty)(s)}`,true));}P.setEvaluated=Er;var Qs={};function Ka(t,e){return t.scopeValue("func",{ref:e,code:Qs[e.code]||(Qs[e.code]=new Ta._Code(e.code))})}P.useFunc=Ka;var wr;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str";})(wr||(P.Type=wr={}));function Fa(t,e,r){if(t instanceof T.Name){let s=e===wr.Num;return r?s?(0, T._)`"[" + ${t} + "]"`:(0, T._)`"['" + ${t} + "']"`:s?(0, T._)`"/" + ${t}`:(0, T._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, T.getProperty)(t).toString():"/"+br(t)}P.getErrorPath=Fa;function en(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===true)throw new Error(e);t.self.logger.warn(e);}}P.checkStrictMode=en;});var de=chunkGNFE24S7_cjs.a(Sr=>{Object.defineProperty(Sr,"__esModule",{value:true});var U=S(),xa={data:new U.Name("data"),valCxt:new U.Name("valCxt"),instancePath:new U.Name("instancePath"),parentData:new U.Name("parentData"),parentDataProperty:new U.Name("parentDataProperty"),rootData:new U.Name("rootData"),dynamicAnchors:new U.Name("dynamicAnchors"),vErrors:new U.Name("vErrors"),errors:new U.Name("errors"),this:new U.Name("this"),self:new U.Name("self"),scope:new U.Name("scope"),json:new U.Name("json"),jsonPos:new U.Name("jsonPos"),jsonLen:new U.Name("jsonLen"),jsonPart:new U.Name("jsonPart")};Sr.default=xa;});var tt=chunkGNFE24S7_cjs.a(K=>{Object.defineProperty(K,"__esModule",{value:true});K.extendErrors=K.resetErrorsCount=K.reportExtraError=K.reportError=K.keyword$DataError=K.keywordError=void 0;var O=S(),qt=j(),x=de();K.keywordError={message:({keyword:t})=>(0, O.str)`must pass "${t}" keyword validation`};K.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0, O.str)`"${t}" keyword must be ${e} ($data)`:(0, O.str)`"${t}" keyword is invalid ($data)`};function La(t,e=K.keywordError,r,s){let{it:n}=t,{gen:o,compositeRule:a,allErrors:i}=n,c=sn(t,e,r);s??(a||i)?tn(o,c):rn(n,(0, O._)`[${c}]`);}K.reportError=La;function Ha(t,e=K.keywordError,r){let{it:s}=t,{gen:n,compositeRule:o,allErrors:a}=s,i=sn(t,e,r);tn(n,i),o||a||rn(s,x.default.vErrors);}K.reportExtraError=Ha;function Ga(t,e){t.assign(x.default.errors,e),t.if((0, O._)`${x.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0, O._)`${x.default.vErrors}.length`,e),()=>t.assign(x.default.vErrors,null)));}K.resetErrorsCount=Ga;function Ja({gen:t,keyword:e,schemaValue:r,data:s,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",n,x.default.errors,i=>{t.const(a,(0, O._)`${x.default.vErrors}[${i}]`),t.if((0, O._)`${a}.instancePath === undefined`,()=>t.assign((0, O._)`${a}.instancePath`,(0, O.strConcat)(x.default.instancePath,o.errorPath))),t.assign((0, O._)`${a}.schemaPath`,(0, O.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0, O._)`${a}.schema`,r),t.assign((0, O._)`${a}.data`,s));});}K.extendErrors=Ja;function tn(t,e){let r=t.const("err",e);t.if((0, O._)`${x.default.vErrors} === null`,()=>t.assign(x.default.vErrors,(0, O._)`[${r}]`),(0, O._)`${x.default.vErrors}.push(${r})`),t.code((0, O._)`${x.default.errors}++`);}function rn(t,e){let{gen:r,validateName:s,schemaEnv:n}=t;n.$async?r.throw((0, O._)`new ${t.ValidationError}(${e})`):(r.assign((0, O._)`${s}.errors`,e),r.return(false));}var Pe={keyword:new O.Name("keyword"),schemaPath:new O.Name("schemaPath"),params:new O.Name("params"),propertyName:new O.Name("propertyName"),message:new O.Name("message"),schema:new O.Name("schema"),parentSchema:new O.Name("parentSchema")};function sn(t,e,r){let{createErrors:s}=t.it;return s===false?(0, O._)`{}`:Wa(t,e,r)}function Wa(t,e,r={}){let{gen:s,it:n}=t,o=[Qa(n,r),Ba(t,r)];return Xa(t,e,o),s.object(...o)}function Qa({errorPath:t},{instancePath:e}){let r=e?(0, O.str)`${t}${(0, qt.getErrorPath)(e,qt.Type.Str)}`:t;return [x.default.instancePath,(0, O.strConcat)(x.default.instancePath,r)]}function Ba({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:s}){let n=s?e:(0, O.str)`${e}/${t}`;return r&&(n=(0, O.str)`${n}${(0, qt.getErrorPath)(r,qt.Type.Str)}`),[Pe.schemaPath,n]}function Xa(t,{params:e,message:r},s){let{keyword:n,data:o,schemaValue:a,it:i}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=i;s.push([Pe.keyword,n],[Pe.params,typeof e=="function"?e(t):e||(0, O._)`{}`]),c.messages&&s.push([Pe.message,typeof r=="function"?r(t):r]),c.verbose&&s.push([Pe.schema,a],[Pe.parentSchema,(0, O._)`${u}${d}`],[x.default.data,o]),l&&s.push([Pe.propertyName,l]);}});var on=chunkGNFE24S7_cjs.a(Te=>{Object.defineProperty(Te,"__esModule",{value:true});Te.boolOrEmptySchema=Te.topBoolOrEmptySchema=void 0;var Ya=tt(),Za=S(),ei=de(),ti={message:"boolean schema is false"};function ri(t){let{gen:e,schema:r,validateName:s}=t;r===false?nn(t,false):typeof r=="object"&&r.$async===true?e.return(ei.default.data):(e.assign((0, Za._)`${s}.errors`,null),e.return(true));}Te.topBoolOrEmptySchema=ri;function si(t,e){let{gen:r,schema:s}=t;s===false?(r.var(e,false),nn(t)):r.var(e,true);}Te.boolOrEmptySchema=si;function nn(t,e){let{gen:r,data:s}=t,n={gen:r,keyword:"false schema",data:s,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0, Ya.reportError)(n,ti,void 0,e);}});var Pr=chunkGNFE24S7_cjs.a(Ce=>{Object.defineProperty(Ce,"__esModule",{value:true});Ce.getRules=Ce.isJSONType=void 0;var ni=["string","number","integer","boolean","null","object","array"],oi=new Set(ni);function ai(t){return typeof t=="string"&&oi.has(t)}Ce.isJSONType=ai;function ii(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return {types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ce.getRules=ii;});var Nr=chunkGNFE24S7_cjs.a(me=>{Object.defineProperty(me,"__esModule",{value:true});me.shouldUseRule=me.shouldUseGroup=me.schemaHasRulesForType=void 0;function ci({schema:t,self:e},r){let s=e.RULES.types[r];return s&&s!==true&&an(t,s)}me.schemaHasRulesForType=ci;function an(t,e){return e.rules.some(r=>cn(t,r))}me.shouldUseGroup=an;function cn(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(s=>t[s]!==void 0))}me.shouldUseRule=cn;});var rt=chunkGNFE24S7_cjs.a(F=>{Object.defineProperty(F,"__esModule",{value:true});F.reportTypeError=F.checkDataTypes=F.checkDataType=F.coerceAndCheckDataType=F.getJSONTypes=F.getSchemaTypes=F.DataType=void 0;var ui=Pr(),li=Nr(),di=tt(),b=S(),un=j(),Me;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong";})(Me||(F.DataType=Me={}));function fi(t){let e=ln(t.type);if(e.includes("null")){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else {if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===true&&e.push("null");}return e}F.getSchemaTypes=fi;function ln(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(ui.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}F.getJSONTypes=ln;function hi(t,e){let{gen:r,data:s,opts:n}=t,o=pi(e,n.coerceTypes),a=e.length>0&&!(o.length===0&&e.length===1&&(0, li.schemaHasRulesForType)(t,e[0]));if(a){let i=qr(e,s,n.strictNumbers,Me.Wrong);r.if(i,()=>{o.length?mi(t,e,o):jr(t);});}return a}F.coerceAndCheckDataType=hi;var dn=new Set(["string","number","integer","boolean","null"]);function pi(t,e){return e?t.filter(r=>dn.has(r)||e==="array"&&r==="array"):[]}function mi(t,e,r){let{gen:s,data:n,opts:o}=t,a=s.let("dataType",(0, b._)`typeof ${n}`),i=s.let("coerced",(0, b._)`undefined`);o.coerceTypes==="array"&&s.if((0, b._)`${a} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>s.assign(n,(0, b._)`${n}[0]`).assign(a,(0, b._)`typeof ${n}`).if(qr(e,n,o.strictNumbers),()=>s.assign(i,n))),s.if((0, b._)`${i} !== undefined`);for(let l of r)(dn.has(l)||l==="array"&&o.coerceTypes==="array")&&c(l);s.else(),jr(t),s.endIf(),s.if((0, b._)`${i} !== undefined`,()=>{s.assign(n,i),yi(t,i);});function c(l){switch(l){case "string":s.elseIf((0, b._)`${a} == "number" || ${a} == "boolean"`).assign(i,(0, b._)`"" + ${n}`).elseIf((0, b._)`${n} === null`).assign(i,(0, b._)`""`);return;case "number":s.elseIf((0, b._)`${a} == "boolean" || ${n} === null
|
|
3
|
+
|| (${a} == "string" && ${n} && ${n} == +${n})`).assign(i,(0, b._)`+${n}`);return;case "integer":s.elseIf((0, b._)`${a} === "boolean" || ${n} === null
|
|
4
|
+
|| (${a} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(i,(0, b._)`+${n}`);return;case "boolean":s.elseIf((0, b._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(i,false).elseIf((0, b._)`${n} === "true" || ${n} === 1`).assign(i,true);return;case "null":s.elseIf((0, b._)`${n} === "" || ${n} === 0 || ${n} === false`),s.assign(i,null);return;case "array":s.elseIf((0, b._)`${a} === "string" || ${a} === "number"
|
|
5
|
+
|| ${a} === "boolean" || ${n} === null`).assign(i,(0, b._)`[${n}]`);}}}function yi({gen:t,parentData:e,parentDataProperty:r},s){t.if((0, b._)`${e} !== undefined`,()=>t.assign((0, b._)`${e}[${r}]`,s));}function kr(t,e,r,s=Me.Correct){let n=s===Me.Correct?b.operators.EQ:b.operators.NEQ,o;switch(t){case "null":return (0, b._)`${e} ${n} null`;case "array":o=(0, b._)`Array.isArray(${e})`;break;case "object":o=(0, b._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case "integer":o=a((0, b._)`!(${e} % 1) && !isNaN(${e})`);break;case "number":o=a();break;default:return (0, b._)`typeof ${e} ${n} ${t}`}return s===Me.Correct?o:(0, b.not)(o);function a(i=b.nil){return (0, b.and)((0, b._)`typeof ${e} == "number"`,i,r?(0, b._)`isFinite(${e})`:b.nil)}}F.checkDataType=kr;function qr(t,e,r,s){if(t.length===1)return kr(t[0],e,r,s);let n,o=(0, un.toHash)(t);if(o.array&&o.object){let a=(0, b._)`typeof ${e} != "object"`;n=o.null?a:(0, b._)`!${e} || ${a}`,delete o.null,delete o.array,delete o.object;}else n=b.nil;o.number&&delete o.integer;for(let a in o)n=(0, b.and)(n,kr(a,e,r,s));return n}F.checkDataTypes=qr;var _i={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0, b._)`{type: ${t}}`:(0, b._)`{type: ${e}}`};function jr(t){let e=gi(t);(0, di.reportError)(e,_i);}F.reportTypeError=jr;function gi(t){let{gen:e,data:r,schema:s}=t,n=(0, un.schemaRefOrVal)(t,s,"type");return {gen:e,keyword:"type",data:r,schema:s.type,schemaCode:n,schemaValue:n,parentSchema:s,params:{},it:t}}});var hn=chunkGNFE24S7_cjs.a(jt=>{Object.defineProperty(jt,"__esModule",{value:true});jt.assignDefaults=void 0;var Ae=S(),$i=j();function vi(t,e){let{properties:r,items:s}=t.schema;if(e==="object"&&r)for(let n in r)fn(t,n,r[n].default);else e==="array"&&Array.isArray(s)&&s.forEach((n,o)=>fn(t,o,n.default));}jt.assignDefaults=vi;function fn(t,e,r){let{gen:s,compositeRule:n,data:o,opts:a}=t;if(r===void 0)return;let i=(0, Ae._)`${o}${(0, Ae.getProperty)(e)}`;if(n){(0, $i.checkStrictMode)(t,`default is ignored for: ${i}`);return}let c=(0, Ae._)`${i} === undefined`;a.useDefaults==="empty"&&(c=(0, Ae._)`${c} || ${i} === null || ${i} === ""`),s.if(c,(0, Ae._)`${i} = ${(0, Ae.stringify)(r)}`);}});var B=chunkGNFE24S7_cjs.a(R=>{Object.defineProperty(R,"__esModule",{value:true});R.validateUnion=R.validateArray=R.usePattern=R.callValidateCode=R.schemaProperties=R.allSchemaProperties=R.noPropertyInData=R.propertyInData=R.isOwnProperty=R.hasPropFunc=R.reportMissingProp=R.checkMissingProp=R.checkReportMissingProp=void 0;var M=S(),Or=j(),ye=de(),wi=j();function bi(t,e){let{gen:r,data:s,it:n}=t;r.if(Rr(r,s,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0, M._)`${e}`},true),t.error();});}R.checkReportMissingProp=bi;function Ei({gen:t,data:e,it:{opts:r}},s,n){return (0, M.or)(...s.map(o=>(0, M.and)(Rr(t,e,o,r.ownProperties),(0, M._)`${n} = ${o}`)))}R.checkMissingProp=Ei;function Si(t,e){t.setParams({missingProperty:e},true),t.error();}R.reportMissingProp=Si;function pn(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, M._)`Object.prototype.hasOwnProperty`})}R.hasPropFunc=pn;function Ir(t,e,r){return (0, M._)`${pn(t)}.call(${e}, ${r})`}R.isOwnProperty=Ir;function Pi(t,e,r,s){let n=(0, M._)`${e}${(0, M.getProperty)(r)} !== undefined`;return s?(0, M._)`${n} && ${Ir(t,e,r)}`:n}R.propertyInData=Pi;function Rr(t,e,r,s){let n=(0, M._)`${e}${(0, M.getProperty)(r)} === undefined`;return s?(0, M.or)(n,(0, M.not)(Ir(t,e,r))):n}R.noPropertyInData=Rr;function mn(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}R.allSchemaProperties=mn;function Ni(t,e){return mn(e).filter(r=>!(0, Or.alwaysValidSchema)(t,e[r]))}R.schemaProperties=Ni;function ki({schemaCode:t,data:e,it:{gen:r,topSchemaRef:s,schemaPath:n,errorPath:o},it:a},i,c,l){let u=l?(0, M._)`${t}, ${e}, ${s}${n}`:e,d=[[ye.default.instancePath,(0, M.strConcat)(ye.default.instancePath,o)],[ye.default.parentData,a.parentData],[ye.default.parentDataProperty,a.parentDataProperty],[ye.default.rootData,ye.default.rootData]];a.opts.dynamicRef&&d.push([ye.default.dynamicAnchors,ye.default.dynamicAnchors]);let y=(0, M._)`${u}, ${r.object(...d)}`;return c!==M.nil?(0, M._)`${i}.call(${c}, ${y})`:(0, M._)`${i}(${y})`}R.callValidateCode=ki;var qi=(0, M._)`new RegExp`;function ji({gen:t,it:{opts:e}},r){let s=e.unicodeRegExp?"u":"",{regExp:n}=e.code,o=n(r,s);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0, M._)`${n.code==="new RegExp"?qi:(0, wi.useFunc)(t,n)}(${r}, ${s})`})}R.usePattern=ji;function Oi(t){let{gen:e,data:r,keyword:s,it:n}=t,o=e.name("valid");if(n.allErrors){let i=e.let("valid",true);return a(()=>e.assign(i,false)),i}return e.var(o,true),a(()=>e.break()),o;function a(i){let c=e.const("len",(0, M._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Or.Type.Num},o),e.if((0, M.not)(o),i);});}}R.validateArray=Oi;function Ii(t){let{gen:e,schema:r,keyword:s,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0, Or.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let a=e.let("valid",false),i=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:s,schemaProp:l,compositeRule:true},i);e.assign(a,(0, M._)`${a} || ${i}`),t.mergeValidEvaluated(u,i)||e.if((0, M.not)(a));})),t.result(a,()=>t.reset(),()=>t.error(true));}R.validateUnion=Ii;});var gn=chunkGNFE24S7_cjs.a(ne=>{Object.defineProperty(ne,"__esModule",{value:true});ne.validateKeywordUsage=ne.validSchemaType=ne.funcKeywordCode=ne.macroKeywordCode=void 0;var L=S(),Ne=de(),Ri=B(),Ti=tt();function Ci(t,e){let{gen:r,keyword:s,schema:n,parentSchema:o,it:a}=t,i=e.macro.call(a.self,n,o,a),c=_n(r,s,i);a.opts.validateSchema!==false&&a.self.validateSchema(i,true);let l=r.name("valid");t.subschema({schema:i,schemaPath:L.nil,errSchemaPath:`${a.errSchemaPath}/${s}`,topSchemaRef:c,compositeRule:true},l),t.pass(l,()=>t.error(true));}ne.macroKeywordCode=Ci;function Mi(t,e){var r;let{gen:s,keyword:n,schema:o,parentSchema:a,$data:i,it:c}=t;Di(c,e);let l=!i&&e.compile?e.compile.call(c.self,o,a,c):e.validate,u=_n(s,n,l),d=s.let("valid");t.block$data(d,y),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function y(){if(e.errors===false)f(),e.modifying&&yn(t),p(()=>t.error());else {let _=e.async?m():h();e.modifying&&yn(t),p(()=>Ai(t,_));}}function m(){let _=s.let("ruleErrs",null);return s.try(()=>f((0, L._)`await `),q=>s.assign(d,false).if((0, L._)`${q} instanceof ${c.ValidationError}`,()=>s.assign(_,(0, L._)`${q}.errors`),()=>s.throw(q))),_}function h(){let _=(0, L._)`${u}.errors`;return s.assign(_,null),f(L.nil),_}function f(_=e.async?(0, L._)`await `:L.nil){let q=c.opts.passContext?Ne.default.this:Ne.default.self,N=!("compile"in e&&!i||e.schema===false);s.assign(d,(0, L._)`${_}${(0, Ri.callValidateCode)(t,u,q,N)}`,e.modifying);}function p(_){var q;s.if((0, L.not)((q=e.valid)!==null&&q!==void 0?q:d),_);}}ne.funcKeywordCode=Mi;function yn(t){let{gen:e,data:r,it:s}=t;e.if(s.parentData,()=>e.assign(r,(0, L._)`${s.parentData}[${s.parentDataProperty}]`));}function Ai(t,e){let{gen:r}=t;r.if((0, L._)`Array.isArray(${e})`,()=>{r.assign(Ne.default.vErrors,(0, L._)`${Ne.default.vErrors} === null ? ${e} : ${Ne.default.vErrors}.concat(${e})`).assign(Ne.default.errors,(0, L._)`${Ne.default.vErrors}.length`),(0, Ti.extendErrors)(t);},()=>t.error());}function Di({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function _n(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0, L.stringify)(r)})}function Vi(t,e,r=false){return !e.length||e.some(s=>s==="array"?Array.isArray(t):s==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==s||r&&typeof t>"u")}ne.validSchemaType=Vi;function zi({schema:t,opts:e,self:r,errSchemaPath:s},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let a=n.dependencies;if(a?.some(i=>!Object.prototype.hasOwnProperty.call(t,i)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${s}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ne.validateKeywordUsage=zi;});var vn=chunkGNFE24S7_cjs.a(_e=>{Object.defineProperty(_e,"__esModule",{value:true});_e.extendSubschemaMode=_e.extendSubschemaData=_e.getSubschema=void 0;var oe=S(),$n=j();function Ui(t,{keyword:e,schemaProp:r,schema:s,schemaPath:n,errSchemaPath:o,topSchemaRef:a}){if(e!==void 0&&s!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let i=t.schema[e];return r===void 0?{schema:i,schemaPath:(0, oe._)`${t.schemaPath}${(0, oe.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[r],schemaPath:(0, oe._)`${t.schemaPath}${(0, oe.getProperty)(e)}${(0, oe.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0, $n.escapeFragment)(r)}`}}if(s!==void 0){if(n===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return {schema:s,schemaPath:n,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}_e.getSubschema=Ui;function Ki(t,e,{dataProp:r,dataPropType:s,data:n,dataTypes:o,propertyName:a}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,y=i.let("data",(0, oe._)`${e.data}${(0, oe.getProperty)(r)}`,true);c(y),t.errorPath=(0, oe.str)`${l}${(0, $n.getErrorPath)(r,s,d.jsPropertySyntax)}`,t.parentDataProperty=(0, oe._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty];}if(n!==void 0){let l=n instanceof oe.Name?n:i.let("data",n,true);c(l),a!==void 0&&(t.propertyName=a);}o&&(t.dataTypes=o);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l];}}_e.extendSubschemaData=Ki;function Fi(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:s,createErrors:n,allErrors:o}){s!==void 0&&(t.compositeRule=s),n!==void 0&&(t.createErrors=n),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r;}_e.extendSubschemaMode=Fi;});var Tr=chunkGNFE24S7_cjs.a((af,wn)=>{wn.exports=function t(e,r){if(e===r)return true;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return false;var s,n,o;if(Array.isArray(e)){if(s=e.length,s!=r.length)return false;for(n=s;n--!==0;)if(!t(e[n],r[n]))return false;return true}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(o=Object.keys(e),s=o.length,s!==Object.keys(r).length)return false;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return false;for(n=s;n--!==0;){var a=o[n];if(!t(e[a],r[a]))return false}return true}return e!==e&&r!==r};});var En=chunkGNFE24S7_cjs.a((cf,bn)=>{var ge=bn.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var s=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Ot(e,s,n,t,"",t);};ge.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};ge.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};ge.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};ge.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function Ot(t,e,r,s,n,o,a,i,c,l){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,n,o,a,i,c,l);for(var u in s){var d=s[u];if(Array.isArray(d)){if(u in ge.arrayKeywords)for(var y=0;y<d.length;y++)Ot(t,e,r,d[y],n+"/"+u+"/"+y,o,n,u,s,y);}else if(u in ge.propsKeywords){if(d&&typeof d=="object")for(var m in d)Ot(t,e,r,d[m],n+"/"+u+"/"+xi(m),o,n,u,s,m);}else (u in ge.keywords||t.allKeys&&!(u in ge.skipKeywords))&&Ot(t,e,r,d,n+"/"+u,o,n,u,s);}r(s,n,o,a,i,c,l);}}function xi(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var st=chunkGNFE24S7_cjs.a(J=>{Object.defineProperty(J,"__esModule",{value:true});J.getSchemaRefs=J.resolveUrl=J.normalizeId=J._getFullPath=J.getFullPath=J.inlineRef=void 0;var Li=j(),Hi=Tr(),Gi=En(),Ji=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Wi(t,e=true){return typeof t=="boolean"?true:e===true?!Cr(t):e?Sn(t)<=e:false}J.inlineRef=Wi;var Qi=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Cr(t){for(let e in t){if(Qi.has(e))return true;let r=t[e];if(Array.isArray(r)&&r.some(Cr)||typeof r=="object"&&Cr(r))return true}return false}function Sn(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Ji.has(r)&&(typeof t[r]=="object"&&(0, Li.eachItem)(t[r],s=>e+=Sn(s)),e===1/0))return 1/0}return e}function Pn(t,e="",r){r!==false&&(e=De(e));let s=t.parse(e);return Nn(t,s)}J.getFullPath=Pn;function Nn(t,e){return t.serialize(e).split("#")[0]+"#"}J._getFullPath=Nn;var Bi=/#\/?$/;function De(t){return t?t.replace(Bi,""):""}J.normalizeId=De;function Xi(t,e,r){return r=De(r),t.resolve(e,r)}J.resolveUrl=Xi;var Yi=/^[a-z_][-a-z0-9._]*$/i;function Zi(t,e){if(typeof t=="boolean")return {};let{schemaId:r,uriResolver:s}=this.opts,n=De(t[r]||e),o={"":n},a=Pn(s,n,false),i={},c=new Set;return Gi(t,{allKeys:true},(d,y,m,h)=>{if(h===void 0)return;let f=a+y,p=o[h];typeof d[r]=="string"&&(p=_.call(this,d[r])),q.call(this,d.$anchor),q.call(this,d.$dynamicAnchor),o[y]=p;function _(N){let C=this.opts.uriResolver.resolve;if(N=De(p?C(p,N):N),c.has(N))throw u(N);c.add(N);let w=this.refs[N];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,N):N!==De(f)&&(N[0]==="#"?(l(d,i[N],N),i[N]=d):this.refs[N]=f),N}function q(N){if(typeof N=="string"){if(!Yi.test(N))throw new Error(`invalid anchor "${N}"`);_.call(this,`#${N}`);}}}),i;function l(d,y,m){if(y!==void 0&&!Hi(d,y))throw u(m)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}J.getSchemaRefs=Zi;});var at=chunkGNFE24S7_cjs.a($e=>{Object.defineProperty($e,"__esModule",{value:true});$e.getData=$e.KeywordCxt=$e.validateFunctionCode=void 0;var In=on(),kn=rt(),Ar=Nr(),It=rt(),ec=hn(),ot=gn(),Mr=vn(),$=S(),v=de(),tc=st(),fe=j(),nt=tt();function rc(t){if(Cn(t)&&(Mn(t),Tn(t))){oc(t);return}Rn(t,()=>(0, In.topBoolOrEmptySchema)(t));}$e.validateFunctionCode=rc;function Rn({gen:t,validateName:e,schema:r,schemaEnv:s,opts:n},o){n.code.es5?t.func(e,(0, $._)`${v.default.data}, ${v.default.valCxt}`,s.$async,()=>{t.code((0, $._)`"use strict"; ${qn(r,n)}`),nc(t,n),t.code(o);}):t.func(e,(0, $._)`${v.default.data}, ${sc(n)}`,s.$async,()=>t.code(qn(r,n)).code(o));}function sc(t){return (0, $._)`{${v.default.instancePath}="", ${v.default.parentData}, ${v.default.parentDataProperty}, ${v.default.rootData}=${v.default.data}${t.dynamicRef?(0, $._)`, ${v.default.dynamicAnchors}={}`:$.nil}}={}`}function nc(t,e){t.if(v.default.valCxt,()=>{t.var(v.default.instancePath,(0, $._)`${v.default.valCxt}.${v.default.instancePath}`),t.var(v.default.parentData,(0, $._)`${v.default.valCxt}.${v.default.parentData}`),t.var(v.default.parentDataProperty,(0, $._)`${v.default.valCxt}.${v.default.parentDataProperty}`),t.var(v.default.rootData,(0, $._)`${v.default.valCxt}.${v.default.rootData}`),e.dynamicRef&&t.var(v.default.dynamicAnchors,(0, $._)`${v.default.valCxt}.${v.default.dynamicAnchors}`);},()=>{t.var(v.default.instancePath,(0, $._)`""`),t.var(v.default.parentData,(0, $._)`undefined`),t.var(v.default.parentDataProperty,(0, $._)`undefined`),t.var(v.default.rootData,v.default.data),e.dynamicRef&&t.var(v.default.dynamicAnchors,(0, $._)`{}`);});}function oc(t){let{schema:e,opts:r,gen:s}=t;Rn(t,()=>{r.$comment&&e.$comment&&Dn(t),lc(t),s.let(v.default.vErrors,null),s.let(v.default.errors,0),r.unevaluated&&ac(t),An(t),hc(t);});}function ac(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0, $._)`${r}.evaluated`),e.if((0, $._)`${t.evaluated}.dynamicProps`,()=>e.assign((0, $._)`${t.evaluated}.props`,(0, $._)`undefined`)),e.if((0, $._)`${t.evaluated}.dynamicItems`,()=>e.assign((0, $._)`${t.evaluated}.items`,(0, $._)`undefined`));}function qn(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0, $._)`/*# sourceURL=${r} */`:$.nil}function ic(t,e){if(Cn(t)&&(Mn(t),Tn(t))){cc(t,e);return}(0, In.boolOrEmptySchema)(t,e);}function Tn({schema:t,self:e}){if(typeof t=="boolean")return !t;for(let r in t)if(e.RULES.all[r])return true;return false}function Cn(t){return typeof t.schema!="boolean"}function cc(t,e){let{schema:r,gen:s,opts:n}=t;n.$comment&&r.$comment&&Dn(t),dc(t),fc(t);let o=s.const("_errs",v.default.errors);An(t,o),s.var(e,(0, $._)`${o} === ${v.default.errors}`);}function Mn(t){(0, fe.checkUnknownRules)(t),uc(t);}function An(t,e){if(t.opts.jtd)return jn(t,[],false,e);let r=(0, kn.getSchemaTypes)(t.schema),s=(0, kn.coerceAndCheckDataType)(t,r);jn(t,r,!s,e);}function uc(t){let{schema:e,errSchemaPath:r,opts:s,self:n}=t;e.$ref&&s.ignoreKeywordsWithRef&&(0, fe.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function lc(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, fe.checkStrictMode)(t,"default is ignored in the schema root");}function dc(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0, tc.resolveUrl)(t.opts.uriResolver,t.baseId,e));}function fc(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Dn({gen:t,schemaEnv:e,schema:r,errSchemaPath:s,opts:n}){let o=r.$comment;if(n.$comment===true)t.code((0, $._)`${v.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let a=(0, $.str)`${s}/$comment`,i=t.scopeValue("root",{ref:e.root});t.code((0, $._)`${v.default.self}.opts.$comment(${o}, ${a}, ${i}.schema)`);}}function hc(t){let{gen:e,schemaEnv:r,validateName:s,ValidationError:n,opts:o}=t;r.$async?e.if((0, $._)`${v.default.errors} === 0`,()=>e.return(v.default.data),()=>e.throw((0, $._)`new ${n}(${v.default.vErrors})`)):(e.assign((0, $._)`${s}.errors`,v.default.vErrors),o.unevaluated&&pc(t),e.return((0, $._)`${v.default.errors} === 0`));}function pc({gen:t,evaluated:e,props:r,items:s}){r instanceof $.Name&&t.assign((0, $._)`${e}.props`,r),s instanceof $.Name&&t.assign((0, $._)`${e}.items`,s);}function jn(t,e,r,s){let{gen:n,schema:o,data:a,allErrors:i,opts:c,self:l}=t,{RULES:u}=l;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0, fe.schemaHasRulesButRef)(o,u))){n.block(()=>zn(t,"$ref",u.all.$ref.definition));return}c.jtd||mc(t,e),n.block(()=>{for(let y of u.rules)d(y);d(u.post);});function d(y){(0, Ar.shouldUseGroup)(o,y)&&(y.type?(n.if((0, It.checkDataType)(y.type,a,c.strictNumbers)),On(t,y),e.length===1&&e[0]===y.type&&r&&(n.else(),(0, It.reportTypeError)(t)),n.endIf()):On(t,y),i||n.if((0, $._)`${v.default.errors} === ${s||0}`));}}function On(t,e){let{gen:r,schema:s,opts:{useDefaults:n}}=t;n&&(0, ec.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0, Ar.shouldUseRule)(s,o)&&zn(t,o.keyword,o.definition,e.type);});}function mc(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(yc(t,e),t.opts.allowUnionTypes||_c(t,e),gc(t,t.dataTypes));}function yc(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Vn(t.dataTypes,r)||Dr(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`);}),vc(t,e);}}function _c(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Dr(t,"use allowUnionTypes to allow union type keyword");}function gc(t,e){let r=t.self.RULES.all;for(let s in r){let n=r[s];if(typeof n=="object"&&(0, Ar.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(a=>$c(e,a))&&Dr(t,`missing type "${o.join(",")}" for keyword "${s}"`);}}}function $c(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Vn(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function vc(t,e){let r=[];for(let s of t.dataTypes)Vn(e,s)?r.push(s):e.includes("integer")&&s==="number"&&r.push("integer");t.dataTypes=r;}function Dr(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0, fe.checkStrictMode)(t,e,t.opts.strictTypes);}var Rt=class{constructor(e,r,s){if((0, ot.validateKeywordUsage)(e,r,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0, fe.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Un(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0, ot.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==false)&&(this.errsCount=e.gen.const("_errs",v.default.errors));}result(e,r,s){this.failResult((0, $.not)(e),r,s);}failResult(e,r,s){this.gen.if(e),s?s():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else();}pass(e,r){this.failResult((0, $.not)(e),void 0,r);}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(false);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else();}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0, $._)`${r} !== undefined && (${(0, $.or)(this.invalid$data(),e)})`);}error(e,r,s){if(r){this.setParams(r),this._error(e,s),this.setParams({});return}this._error(e,s);}_error(e,r){(e?nt.reportExtraError:nt.reportError)(this,this.def.error,r);}$dataError(){(0, nt.reportError)(this,this.def.$dataError||nt.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, nt.resetErrorsCount)(this.gen,this.errsCount);}ok(e){this.allErrors||this.gen.if(e);}setParams(e,r){r?Object.assign(this.params,e):this.params=e;}block$data(e,r,s=$.nil){this.gen.block(()=>{this.check$data(e,s),r();});}check$data(e=$.nil,r=$.nil){if(!this.$data)return;let{gen:s,schemaCode:n,schemaType:o,def:a}=this;s.if((0, $.or)((0, $._)`${n} === undefined`,r)),e!==$.nil&&s.assign(e,true),(o.length||a.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==$.nil&&s.assign(e,false)),s.else();}invalid$data(){let{gen:e,schemaCode:r,schemaType:s,def:n,it:o}=this;return (0, $.or)(a(),i());function a(){if(s.length){if(!(r instanceof $.Name))throw new Error("ajv implementation error");let c=Array.isArray(s)?s:[s];return (0, $._)`${(0, It.checkDataTypes)(c,r,o.opts.strictNumbers,It.DataType.Wrong)}`}return $.nil}function i(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return (0, $._)`!${c}(${r})`}return $.nil}}subschema(e,r){let s=(0, Mr.getSubschema)(this.it,e);(0, Mr.extendSubschemaData)(s,this.it,e),(0, Mr.extendSubschemaMode)(s,e);let n={...this.it,...s,items:void 0,props:void 0};return ic(n,r),n}mergeEvaluated(e,r){let{it:s,gen:n}=this;s.opts.unevaluated&&(s.props!==true&&e.props!==void 0&&(s.props=fe.mergeEvaluated.props(n,e.props,s.props,r)),s.items!==true&&e.items!==void 0&&(s.items=fe.mergeEvaluated.items(n,e.items,s.items,r)));}mergeValidEvaluated(e,r){let{it:s,gen:n}=this;if(s.opts.unevaluated&&(s.props!==true||s.items!==true))return n.if(r,()=>this.mergeEvaluated(e,$.Name)),true}};$e.KeywordCxt=Rt;function zn(t,e,r,s){let n=new Rt(t,r,e);"code"in r?r.code(n,s):n.$data&&r.validate?(0, ot.funcKeywordCode)(n,r):"macro"in r?(0, ot.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0, ot.funcKeywordCode)(n,r);}var wc=/^\/(?:[^~]|~0|~1)*$/,bc=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Un(t,{dataLevel:e,dataNames:r,dataPathArr:s}){let n,o;if(t==="")return v.default.rootData;if(t[0]==="/"){if(!wc.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=v.default.rootData;}else {let l=bc.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=e)throw new Error(c("property/index",u));return s[e-u]}if(u>e)throw new Error(c("data",u));if(o=r[e-u],!n)return o}let a=o,i=n.split("/");for(let l of i)l&&(o=(0, $._)`${o}${(0, $.getProperty)((0, fe.unescapeJsonPointer)(l))}`,a=(0, $._)`${a} && ${o}`);return a;function c(l,u){return `Cannot access ${l} ${u} levels up, current level is ${e}`}}$e.getData=Un;});var Tt=chunkGNFE24S7_cjs.a(zr=>{Object.defineProperty(zr,"__esModule",{value:true});var Vr=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=true;}};zr.default=Vr;});var it=chunkGNFE24S7_cjs.a(Fr=>{Object.defineProperty(Fr,"__esModule",{value:true});var Ur=st(),Kr=class extends Error{constructor(e,r,s,n){super(n||`can't resolve reference ${s} from id ${r}`),this.missingRef=(0, Ur.resolveUrl)(e,r,s),this.missingSchema=(0, Ur.normalizeId)((0, Ur.getFullPath)(e,this.missingRef));}};Fr.default=Kr;});var Mt=chunkGNFE24S7_cjs.a(X=>{Object.defineProperty(X,"__esModule",{value:true});X.resolveSchema=X.getCompilingSchema=X.resolveRef=X.compileSchema=X.SchemaEnv=void 0;var ee=S(),Ec=Tt(),ke=de(),te=st(),Kn=j(),Sc=at(),Ve=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let s;typeof e.schema=="object"&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0, te.normalizeId)(s?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=s?.$async,this.refs={};}};X.SchemaEnv=Ve;function Lr(t){let e=Fn.call(this,t);if(e)return e;let r=(0, te.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:s,lines:n}=this.opts.code,{ownProperties:o}=this.opts,a=new ee.CodeGen(this.scope,{es5:s,lines:n,ownProperties:o}),i;t.$async&&(i=a.scopeValue("Error",{ref:Ec.default,code:(0, ee._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let l={gen:a,allErrors:this.opts.allErrors,data:ke.default.data,parentData:ke.default.parentData,parentDataProperty:ke.default.parentDataProperty,dataNames:[ke.default.data],dataPathArr:[ee.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0, ee.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ee.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, ee._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,Sc.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);let d=a.toString();u=`${a.scopeRefs(ke.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let m=new Function(`${ke.default.self}`,`${ke.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:f}=l;m.evaluated={props:h instanceof ee.Name?void 0:h,items:f instanceof ee.Name?void 0:f,dynamicProps:h instanceof ee.Name,dynamicItems:f instanceof ee.Name},m.source&&(m.source.evaluated=(0,ee.stringify)(m.evaluated));}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t);}}X.compileSchema=Lr;function Pc(t,e,r){var s;r=(0, te.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let o=qc.call(this,t,r);if(o===void 0){let a=(s=t.localRefs)===null||s===void 0?void 0:s[r],{schemaId:i}=this.opts;a&&(o=new Ve({schema:a,schemaId:i,root:t,baseId:e}));}if(o!==void 0)return t.refs[r]=Nc.call(this,o)}X.resolveRef=Pc;function Nc(t){return (0, te.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Lr.call(this,t)}function Fn(t){for(let e of this._compilations)if(kc(e,t))return e}X.getCompilingSchema=Fn;function kc(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function qc(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ct.call(this,t,e)}function Ct(t,e){let r=this.opts.uriResolver.parse(e),s=(0, te._getFullPath)(this.opts.uriResolver,r),n=(0, te.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&s===n)return xr.call(this,r,t);let o=(0, te.normalizeId)(s),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let i=Ct.call(this,t,a);return typeof i?.schema!="object"?void 0:xr.call(this,r,i)}if(typeof a?.schema=="object"){if(a.validate||Lr.call(this,a),o===(0, te.normalizeId)(e)){let{schema:i}=a,{schemaId:c}=this.opts,l=i[c];return l&&(n=(0, te.resolveUrl)(this.opts.uriResolver,n,l)),new Ve({schema:i,schemaId:c,root:t,baseId:n})}return xr.call(this,r,a)}}X.resolveSchema=Ct;var jc=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xr(t,{baseId:e,schema:r,root:s}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0, Kn.unescapeFragment)(i)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!jc.has(i)&&l&&(e=(0, te.resolveUrl)(this.opts.uriResolver,e,l));}let o;if(typeof r!="boolean"&&r.$ref&&!(0, Kn.schemaHasRulesButRef)(r,this.RULES)){let i=(0, te.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Ct.call(this,s,i);}let{schemaId:a}=this.opts;if(o=o||new Ve({schema:r,schemaId:a,root:s,baseId:e}),o.schema!==o.root.schema)return o}});var xn=chunkGNFE24S7_cjs.a((pf,Oc)=>{Oc.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:false};});var Gr=chunkGNFE24S7_cjs.a((mf,Jn)=>{var Ic=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Hn=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 Hr(t){let e="",r=0,s=0;for(s=0;s<t.length;s++)if(r=t[s].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";e+=t[s];break}for(s+=1;s<t.length;s++){if(r=t[s].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";e+=t[s];}return e}var Rc=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ln(t){return t.length=0,true}function Tc(t,e,r){if(t.length){let s=Hr(t);if(s!=="")e.push(s);else return r.error=true,false;t.length=0;}return true}function Cc(t){let e=0,r={error:false,address:"",zone:""},s=[],n=[],o=false,a=false,i=Tc;for(let c=0;c<t.length;c++){let l=t[c];if(!(l==="["||l==="]"))if(l===":"){if(o===true&&(a=true),!i(n,s,r))break;if(++e>7){r.error=true;break}c>0&&t[c-1]===":"&&(o=true),s.push(":");continue}else if(l==="%"){if(!i(n,s,r))break;i=Ln;}else {n.push(l);continue}}return n.length&&(i===Ln?r.zone=n.join(""):a?s.push(n.join("")):s.push(Hr(n))),r.address=s.join(""),r}function Gn(t){if(Mc(t,":")<2)return {host:t,isIPV6:false};let e=Cc(t);if(e.error)return {host:t,isIPV6:false};{let r=e.address,s=e.address;return e.zone&&(r+="%"+e.zone,s+="%25"+e.zone),{host:r,isIPV6:true,escapedHost:s}}}function Mc(t,e){let r=0;for(let s=0;s<t.length;s++)t[s]===e&&r++;return r}function Ac(t){let e=t,r=[],s=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else {r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((s=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,s)),e=e.slice(s);}return r.join("")}function Dc(t,e){let r=e!==true?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Vc(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Hn(r)){let s=Gn(r);s.isIPV6===true?r=`[${s.escapedHost}]`:r=t.host;}e.push(r);}return (typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Jn.exports={nonSimpleDomain:Rc,recomposeAuthority:Vc,normalizeComponentEncoding:Dc,removeDotSegments:Ac,isIPv4:Hn,isUUID:Ic,normalizeIPv6:Gn,stringArrayToHexStripped:Hr};});var Yn=chunkGNFE24S7_cjs.a((yf,Xn)=>{var{isUUID:zc}=Gr(),Uc=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Kc=["http","https","ws","wss","urn","urn:uuid"];function Fc(t){return Kc.indexOf(t)!==-1}function Jr(t){return t.secure===true?true:t.secure===false?false:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):false}function Wn(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Qn(t){let e=String(t.scheme).toLowerCase()==="https";return (t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function xc(t){return t.secure=Jr(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Lc(t){if((t.port===(Jr(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0;}return t.fragment=void 0,t}function Hc(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(Uc);if(r){let s=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${s}:${e.nid||t.nid}`,o=Wr(n);t.path=void 0,o&&(t=o.parse(t,e));}else t.error=t.error||"URN can not be parsed.";return t}function Gc(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",s=t.nid.toLowerCase(),n=`${r}:${e.nid||s}`,o=Wr(n);o&&(t=o.serialize(t,e));let a=t,i=t.nss;return a.path=`${s||e.nid}:${i}`,e.skipEscape=true,a}function Jc(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!zc(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Wc(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Bn={scheme:"http",domainHost:true,parse:Wn,serialize:Qn},Qc={scheme:"https",domainHost:Bn.domainHost,parse:Wn,serialize:Qn},At={scheme:"ws",domainHost:true,parse:xc,serialize:Lc},Bc={scheme:"wss",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize},Xc={scheme:"urn",parse:Hc,serialize:Gc,skipNormalize:true},Yc={scheme:"urn:uuid",parse:Jc,serialize:Wc,skipNormalize:true},Dt={http:Bn,https:Qc,ws:At,wss:Bc,urn:Xc,"urn:uuid":Yc};Object.setPrototypeOf(Dt,null);function Wr(t){return t&&(Dt[t]||Dt[t.toLowerCase()])||void 0}Xn.exports={wsIsSecure:Jr,SCHEMES:Dt,isValidSchemeName:Fc,getSchemeHandler:Wr};});var to=chunkGNFE24S7_cjs.a((_f,zt)=>{var{normalizeIPv6:Zc,removeDotSegments:ct,recomposeAuthority:eu,normalizeComponentEncoding:Vt,isIPv4:tu,nonSimpleDomain:ru}=Gr(),{SCHEMES:su,getSchemeHandler:Zn}=Yn();function nu(t,e){return typeof t=="string"?t=ae(he(t,e),e):typeof t=="object"&&(t=he(ae(t,e),e)),t}function ou(t,e,r){let s=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=eo(he(t,s),he(e,s),s,true);return s.skipEscape=true,ae(n,s)}function eo(t,e,r,s){let n={};return s||(t=he(ae(t,r),r),e=he(ae(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=ct(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=ct(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=ct(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=ct(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function au(t,e,r){return typeof t=="string"?(t=unescape(t),t=ae(Vt(he(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=ae(Vt(t,true),{...r,skipEscape:true})),typeof e=="string"?(e=unescape(e),e=ae(Vt(he(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=ae(Vt(e,true),{...r,skipEscape:true})),t.toLowerCase()===e.toLowerCase()}function ae(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},s=Object.assign({},e),n=[],o=Zn(s.scheme||r.scheme);o&&o.serialize&&o.serialize(r,s),r.path!==void 0&&(s.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),s.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let a=eu(r);if(a!==void 0&&(s.reference!=="suffix"&&n.push("//"),n.push(a),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let i=r.path;!s.absolutePath&&(!o||!o.absolutePath)&&(i=ct(i)),a===void 0&&i[0]==="/"&&i[1]==="/"&&(i="/%2F"+i.slice(2)),n.push(i);}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var iu=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function he(t,e){let r=Object.assign({},e),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=false;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(iu);if(o){if(s.scheme=o[1],s.userinfo=o[3],s.host=o[4],s.port=parseInt(o[5],10),s.path=o[6]||"",s.query=o[7],s.fragment=o[8],isNaN(s.port)&&(s.port=o[5]),s.host)if(tu(s.host)===false){let c=Zc(s.host);s.host=c.host.toLowerCase(),n=c.isIPV6;}else n=true;s.scheme===void 0&&s.userinfo===void 0&&s.host===void 0&&s.port===void 0&&s.query===void 0&&!s.path?s.reference="same-document":s.scheme===void 0?s.reference="relative":s.fragment===void 0?s.reference="absolute":s.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==s.reference&&(s.error=s.error||"URI is not a "+r.reference+" reference.");let a=Zn(r.scheme||s.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&s.host&&(r.domainHost||a&&a.domainHost)&&n===false&&ru(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase());}catch(i){s.error=s.error||"Host's domain name can not be converted to ASCII: "+i;}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(s.scheme!==void 0&&(s.scheme=unescape(s.scheme)),s.host!==void 0&&(s.host=unescape(s.host))),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),a&&a.parse&&a.parse(s,r);}else s.error=s.error||"URI can not be parsed.";return s}var Qr={SCHEMES:su,normalize:nu,resolve:ou,resolveComponent:eo,equal:au,serialize:ae,parse:he};zt.exports=Qr;zt.exports.default=Qr;zt.exports.fastUri=Qr;});var so=chunkGNFE24S7_cjs.a(Br=>{Object.defineProperty(Br,"__esModule",{value:true});var ro=to();ro.code='require("ajv/dist/runtime/uri").default';Br.default=ro;});var fo=chunkGNFE24S7_cjs.a(V=>{Object.defineProperty(V,"__esModule",{value:true});V.CodeGen=V.Name=V.nil=V.stringify=V.str=V._=V.KeywordCxt=void 0;var cu=at();Object.defineProperty(V,"KeywordCxt",{enumerable:true,get:function(){return cu.KeywordCxt}});var ze=S();Object.defineProperty(V,"_",{enumerable:true,get:function(){return ze._}});Object.defineProperty(V,"str",{enumerable:true,get:function(){return ze.str}});Object.defineProperty(V,"stringify",{enumerable:true,get:function(){return ze.stringify}});Object.defineProperty(V,"nil",{enumerable:true,get:function(){return ze.nil}});Object.defineProperty(V,"Name",{enumerable:true,get:function(){return ze.Name}});Object.defineProperty(V,"CodeGen",{enumerable:true,get:function(){return ze.CodeGen}});var uu=Tt(),co=it(),lu=Pr(),ut=Mt(),du=S(),lt=st(),Ut=rt(),Yr=j(),no=xn(),fu=so(),uo=(t,e)=>new RegExp(t,e);uo.code="new RegExp";var hu=["removeAdditional","useDefaults","coerceTypes"],pu=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),mu={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."},yu={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},oo=200;function _u(t){var e,r,s,n,o,a,i,c,l,u,d,y,m,h,f,p,_,q,N,C,w,se,ce,tr,rr;let Ge=t.strict,sr=(e=t.code)===null||e===void 0?void 0:e.optimize,Fs=sr===true||sr===void 0?1:sr||0,xs=(s=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&s!==void 0?s:uo,ga=(n=t.uriResolver)!==null&&n!==void 0?n:fu.default;return {strictSchema:(a=(o=t.strictSchema)!==null&&o!==void 0?o:Ge)!==null&&a!==void 0?a:true,strictNumbers:(c=(i=t.strictNumbers)!==null&&i!==void 0?i:Ge)!==null&&c!==void 0?c:true,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:Ge)!==null&&u!==void 0?u:"log",strictTuples:(y=(d=t.strictTuples)!==null&&d!==void 0?d:Ge)!==null&&y!==void 0?y:"log",strictRequired:(h=(m=t.strictRequired)!==null&&m!==void 0?m:Ge)!==null&&h!==void 0?h:false,code:t.code?{...t.code,optimize:Fs,regExp:xs}:{optimize:Fs,regExp:xs},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:oo,loopEnum:(p=t.loopEnum)!==null&&p!==void 0?p:oo,meta:(_=t.meta)!==null&&_!==void 0?_:true,messages:(q=t.messages)!==null&&q!==void 0?q:true,inlineRefs:(N=t.inlineRefs)!==null&&N!==void 0?N:true,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:true,validateSchema:(se=t.validateSchema)!==null&&se!==void 0?se:true,validateFormats:(ce=t.validateFormats)!==null&&ce!==void 0?ce:true,unicodeRegExp:(tr=t.unicodeRegExp)!==null&&tr!==void 0?tr:true,int32range:(rr=t.int32range)!==null&&rr!==void 0?rr:true,uriResolver:ga}}var dt=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,..._u(e)};let{es5:r,lines:s}=this.opts.code;this.scope=new du.ValueScope({scope:{},prefixes:pu,es5:r,lines:s}),this.logger=Eu(e.logger);let n=e.validateFormats;e.validateFormats=false,this.RULES=(0, lu.getRules)(),ao.call(this,mu,e,"NOT SUPPORTED"),ao.call(this,yu,e,"DEPRECATED","warn"),this._metaOpts=wu.call(this),e.formats&&$u.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&vu.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),gu.call(this),e.validateFormats=n;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:s}=this.opts,n=no;s==="id"&&(n={...no},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[s],false);}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let s;if(typeof e=="string"){if(s=this.getSchema(e),!s)throw new Error(`no schema with key or ref "${e}"`)}else s=this.compile(e);let n=s(r);return "$async"in s||(this.errors=s.errors),n}compile(e,r){let s=this._addSchema(e,r);return s.validate||this._compileSchemaEnv(s)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:s}=this.opts;return n.call(this,e,r);async function n(u,d){await o.call(this,u.$schema);let y=this._addSchema(u,d);return y.validate||a.call(this,y)}async function o(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},true);}async function a(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof co.default))throw d;return i.call(this,d),await c.call(this,d.missingSchema),a.call(this,u)}}function i({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await o.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r);}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=s(u))}finally{delete this._loading[u];}}}addSchema(e,r,s,n=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,s,n);return this}let o;if(typeof e=="object"){let{schemaId:a}=this.opts;if(o=e[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0, lt.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,s,r,n,true),this}addMetaSchema(e,r,s=this.opts.validateSchema){return this.addSchema(e,r,true,s),this}validateSchema(e,r){if(typeof e=="boolean")return true;let s;if(s=e.$schema,s!==void 0&&typeof s!="string")throw new Error("$schema must be a string");if(s=s||this.opts.defaultMeta||this.defaultMeta(),!s)return this.logger.warn("meta-schema not available"),this.errors=null,true;let n=this.validate(s,e);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(e){let r;for(;typeof(r=io.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:s}=this.opts,n=new ut.SchemaEnv({schema:{},schemaId:s});if(r=ut.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r;}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case "undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case "string":{let r=io.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case "object":{let r=e;this._cache.delete(r);let s=e[this.opts.schemaId];return s&&(s=(0, lt.normalizeId)(s),delete this.schemas[s],delete this.refs[s]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let s;if(typeof e=="string")s=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=s);else if(typeof e=="object"&&r===void 0){if(r=e,s=r.keyword,Array.isArray(s)&&!s.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Pu.call(this,s,r),!r)return (0, Yr.eachItem)(s,o=>Xr.call(this,o)),this;ku.call(this,r);let n={...r,type:(0, Ut.getJSONTypes)(r.type),schemaType:(0, Ut.getJSONTypes)(r.schemaType)};return (0, Yr.eachItem)(s,n.type.length===0?o=>Xr.call(this,o,n):o=>n.type.forEach(a=>Xr.call(this,o,n,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let s of r.rules){let n=s.rules.findIndex(o=>o.keyword===e);n>=0&&s.rules.splice(n,1);}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:s="data"}={}){return !e||e.length===0?"No errors":e.map(n=>`${s}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(e,r){let s=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let o=n.split("/").slice(1),a=e;for(let i of o)a=a[i];for(let i in s){let c=s[i];if(typeof c!="object")continue;let{$data:l}=c.definition,u=a[i];l&&u&&(a[i]=lo(u));}}return e}_removeAllSchemas(e,r){for(let s in e){let n=e[s];(!r||r.test(s))&&(typeof n=="string"?delete e[s]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[s]));}}_addSchema(e,r,s,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:i}=this.opts;if(typeof e=="object")a=e[i];else {if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;s=(0, lt.normalizeId)(a||s);let l=lt.getSchemaRefs.call(this,e,s);return c=new ut.SchemaEnv({schema:e,schemaId:i,meta:r,baseId:s,localRefs:l}),this._cache.set(c.schema,c),o&&!s.startsWith("#")&&(s&&this._checkUnique(s),this.refs[s]=c),n&&this.validateSchema(e,true),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):ut.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{ut.compileSchema.call(this,e);}finally{this.opts=r;}}};dt.ValidationError=uu.default;dt.MissingRefError=co.default;V.default=dt;function ao(t,e,r,s="error"){for(let n in t){let o=n;o in e&&this.logger[s](`${r}: option ${n}. ${t[o]}`);}}function io(t){return t=(0, lt.normalizeId)(t),this.schemas[t]||this.refs[t]}function gu(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e);}function $u(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e);}}function vu(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r);}}function wu(){let t={...this.opts};for(let e of hu)delete t[e];return t}var bu={log(){},warn(){},error(){}};function Eu(t){if(t===false)return bu;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Su=/^[a-z_$][a-z0-9_$:-]*$/i;function Pu(t,e){let{RULES:r}=this;if((0, Yr.eachItem)(t,s=>{if(r.keywords[s])throw new Error(`Keyword ${s} is already defined`);if(!Su.test(s))throw new Error(`Keyword ${s} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Xr(t,e,r){var s;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=n?o.post:o.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[t]=true,!e)return;let i={keyword:t,definition:{...e,type:(0, Ut.getJSONTypes)(e.type),schemaType:(0, Ut.getJSONTypes)(e.schemaType)}};e.before?Nu.call(this,a,i,e.before):a.rules.push(i),o.all[t]=i,(s=e.implements)===null||s===void 0||s.forEach(c=>this.addKeyword(c));}function Nu(t,e,r){let s=t.rules.findIndex(n=>n.keyword===r);s>=0?t.rules.splice(s,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`));}function ku(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=lo(e)),t.validateSchema=this.compile(e,true));}var qu={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function lo(t){return {anyOf:[t,qu]}}});var ho=chunkGNFE24S7_cjs.a(Zr=>{Object.defineProperty(Zr,"__esModule",{value:true});var ju={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zr.default=ju;});var _o=chunkGNFE24S7_cjs.a(qe=>{Object.defineProperty(qe,"__esModule",{value:true});qe.callRef=qe.getValidate=void 0;var Ou=it(),po=B(),W=S(),Ue=de(),mo=Mt(),Kt=j(),Iu={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:s}=t,{baseId:n,schemaEnv:o,validateName:a,opts:i,self:c}=s,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=mo.resolveRef.call(c,l,n,r);if(u===void 0)throw new Ou.default(s.opts.uriResolver,n,r);if(u instanceof mo.SchemaEnv)return y(u);return m(u);function d(){if(o===l)return Ft(t,a,o,o.$async);let h=e.scopeValue("root",{ref:l});return Ft(t,(0, W._)`${h}.validate`,l,l.$async)}function y(h){let f=yo(t,h);Ft(t,f,h,h.$async);}function m(h){let f=e.scopeValue("schema",i.code.source===true?{ref:h,code:(0, W.stringify)(h)}:{ref:h}),p=e.name("valid"),_=t.subschema({schema:h,dataTypes:[],schemaPath:W.nil,topSchemaRef:f,errSchemaPath:r},p);t.mergeEvaluated(_),t.ok(p);}}};function yo(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0, W._)`${r.scopeValue("wrapper",{ref:e})}.validate`}qe.getValidate=yo;function Ft(t,e,r,s){let{gen:n,it:o}=t,{allErrors:a,schemaEnv:i,opts:c}=o,l=c.passContext?Ue.default.this:W.nil;s?u():d();function u(){if(!i.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0, W._)`await ${(0, po.callValidateCode)(t,e,l)}`),m(e),a||n.assign(h,true);},f=>{n.if((0, W._)`!(${f} instanceof ${o.ValidationError})`,()=>n.throw(f)),y(f),a||n.assign(h,false);}),t.ok(h);}function d(){t.result((0, po.callValidateCode)(t,e,l),()=>m(e),()=>y(e));}function y(h){let f=(0, W._)`${h}.errors`;n.assign(Ue.default.vErrors,(0, W._)`${Ue.default.vErrors} === null ? ${f} : ${Ue.default.vErrors}.concat(${f})`),n.assign(Ue.default.errors,(0, W._)`${Ue.default.vErrors}.length`);}function m(h){var f;if(!o.opts.unevaluated)return;let p=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(o.props!==true)if(p&&!p.dynamicProps)p.props!==void 0&&(o.props=Kt.mergeEvaluated.props(n,p.props,o.props));else {let _=n.var("props",(0, W._)`${h}.evaluated.props`);o.props=Kt.mergeEvaluated.props(n,_,o.props,W.Name);}if(o.items!==true)if(p&&!p.dynamicItems)p.items!==void 0&&(o.items=Kt.mergeEvaluated.items(n,p.items,o.items));else {let _=n.var("items",(0, W._)`${h}.evaluated.items`);o.items=Kt.mergeEvaluated.items(n,_,o.items,W.Name);}}}qe.callRef=Ft;qe.default=Iu;});var go=chunkGNFE24S7_cjs.a(es=>{Object.defineProperty(es,"__esModule",{value:true});var Ru=ho(),Tu=_o(),Cu=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Ru.default,Tu.default];es.default=Cu;});var $o=chunkGNFE24S7_cjs.a(ts=>{Object.defineProperty(ts,"__esModule",{value:true});var xt=S(),ve=xt.operators,Lt={maximum:{okStr:"<=",ok:ve.LTE,fail:ve.GT},minimum:{okStr:">=",ok:ve.GTE,fail:ve.LT},exclusiveMaximum:{okStr:"<",ok:ve.LT,fail:ve.GTE},exclusiveMinimum:{okStr:">",ok:ve.GT,fail:ve.LTE}},Mu={message:({keyword:t,schemaCode:e})=>(0, xt.str)`must be ${Lt[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0, xt._)`{comparison: ${Lt[t].okStr}, limit: ${e}}`},Au={keyword:Object.keys(Lt),type:"number",schemaType:"number",$data:true,error:Mu,code(t){let{keyword:e,data:r,schemaCode:s}=t;t.fail$data((0, xt._)`${r} ${Lt[e].fail} ${s} || isNaN(${r})`);}};ts.default=Au;});var vo=chunkGNFE24S7_cjs.a(rs=>{Object.defineProperty(rs,"__esModule",{value:true});var ft=S(),Du={message:({schemaCode:t})=>(0, ft.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0, ft._)`{multipleOf: ${t}}`},Vu={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:Du,code(t){let{gen:e,data:r,schemaCode:s,it:n}=t,o=n.opts.multipleOfPrecision,a=e.let("res"),i=o?(0, ft._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0, ft._)`${a} !== parseInt(${a})`;t.fail$data((0, ft._)`(${s} === 0 || (${a} = ${r}/${s}, ${i}))`);}};rs.default=Vu;});var bo=chunkGNFE24S7_cjs.a(ss=>{Object.defineProperty(ss,"__esModule",{value:true});function wo(t){let e=t.length,r=0,s=0,n;for(;s<e;)r++,n=t.charCodeAt(s++),n>=55296&&n<=56319&&s<e&&(n=t.charCodeAt(s),(n&64512)===56320&&s++);return r}ss.default=wo;wo.code='require("ajv/dist/runtime/ucs2length").default';});var Eo=chunkGNFE24S7_cjs.a(ns=>{Object.defineProperty(ns,"__esModule",{value:true});var je=S(),zu=j(),Uu=bo(),Ku={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return (0, je.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0, je._)`{limit: ${t}}`},Fu={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:Ku,code(t){let{keyword:e,data:r,schemaCode:s,it:n}=t,o=e==="maxLength"?je.operators.GT:je.operators.LT,a=n.opts.unicode===false?(0, je._)`${r}.length`:(0, je._)`${(0, zu.useFunc)(t.gen,Uu.default)}(${r})`;t.fail$data((0, je._)`${a} ${o} ${s}`);}};ns.default=Fu;});var So=chunkGNFE24S7_cjs.a(os=>{Object.defineProperty(os,"__esModule",{value:true});var xu=B(),Lu=j(),Ke=S(),Hu={message:({schemaCode:t})=>(0, Ke.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0, Ke._)`{pattern: ${t}}`},Gu={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:Hu,code(t){let{gen:e,data:r,$data:s,schema:n,schemaCode:o,it:a}=t,i=a.opts.unicodeRegExp?"u":"";if(s){let{regExp:c}=a.opts.code,l=c.code==="new RegExp"?(0, Ke._)`new RegExp`:(0, Lu.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0, Ke._)`${l}(${o}, ${i}).test(${r})`),()=>e.assign(u,false)),t.fail$data((0, Ke._)`!${u}`);}else {let c=(0, xu.usePattern)(t,n);t.fail$data((0, Ke._)`!${c}.test(${r})`);}}};os.default=Gu;});var Po=chunkGNFE24S7_cjs.a(as=>{Object.defineProperty(as,"__esModule",{value:true});var ht=S(),Ju={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return (0, ht.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0, ht._)`{limit: ${t}}`},Wu={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:Ju,code(t){let{keyword:e,data:r,schemaCode:s}=t,n=e==="maxProperties"?ht.operators.GT:ht.operators.LT;t.fail$data((0, ht._)`Object.keys(${r}).length ${n} ${s}`);}};as.default=Wu;});var No=chunkGNFE24S7_cjs.a(is=>{Object.defineProperty(is,"__esModule",{value:true});var pt=B(),mt=S(),Qu=j(),Bu={message:({params:{missingProperty:t}})=>(0, mt.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0, mt._)`{missingProperty: ${t}}`},Xu={keyword:"required",type:"object",schemaType:"array",$data:true,error:Bu,code(t){let{gen:e,schema:r,schemaCode:s,data:n,$data:o,it:a}=t,{opts:i}=a;if(!o&&r.length===0)return;let c=r.length>=i.loopRequired;if(a.allErrors?l():u(),i.strictRequired){let m=t.parentSchema.properties,{definedProperties:h}=t.it;for(let f of r)if(m?.[f]===void 0&&!h.has(f)){let p=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${f}" is not defined at "${p}" (strictRequired)`;(0, Qu.checkStrictMode)(a,_,a.opts.strictRequired);}}function l(){if(c||o)t.block$data(mt.nil,d);else for(let m of r)(0, pt.checkReportMissingProp)(t,m);}function u(){let m=e.let("missing");if(c||o){let h=e.let("valid",true);t.block$data(h,()=>y(m,h)),t.ok(h);}else e.if((0, pt.checkMissingProp)(t,r,m)),(0, pt.reportMissingProp)(t,m),e.else();}function d(){e.forOf("prop",s,m=>{t.setParams({missingProperty:m}),e.if((0, pt.noPropertyInData)(e,n,m,i.ownProperties),()=>t.error());});}function y(m,h){t.setParams({missingProperty:m}),e.forOf(m,s,()=>{e.assign(h,(0, pt.propertyInData)(e,n,m,i.ownProperties)),e.if((0, mt.not)(h),()=>{t.error(),e.break();});},mt.nil);}}};is.default=Xu;});var ko=chunkGNFE24S7_cjs.a(cs=>{Object.defineProperty(cs,"__esModule",{value:true});var yt=S(),Yu={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return (0, yt.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0, yt._)`{limit: ${t}}`},Zu={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:Yu,code(t){let{keyword:e,data:r,schemaCode:s}=t,n=e==="maxItems"?yt.operators.GT:yt.operators.LT;t.fail$data((0, yt._)`${r}.length ${n} ${s}`);}};cs.default=Zu;});var Ht=chunkGNFE24S7_cjs.a(us=>{Object.defineProperty(us,"__esModule",{value:true});var qo=Tr();qo.code='require("ajv/dist/runtime/equal").default';us.default=qo;});var jo=chunkGNFE24S7_cjs.a(ds=>{Object.defineProperty(ds,"__esModule",{value:true});var ls=rt(),z=S(),el=j(),tl=Ht(),rl={message:({params:{i:t,j:e}})=>(0, z.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0, z._)`{i: ${t}, j: ${e}}`},sl={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:rl,code(t){let{gen:e,data:r,$data:s,schema:n,parentSchema:o,schemaCode:a,it:i}=t;if(!s&&!n)return;let c=e.let("valid"),l=o.items?(0, ls.getSchemaTypes)(o.items):[];t.block$data(c,u,(0, z._)`${a} === false`),t.ok(c);function u(){let h=e.let("i",(0, z._)`${r}.length`),f=e.let("j");t.setParams({i:h,j:f}),e.assign(c,true),e.if((0, z._)`${h} > 1`,()=>(d()?y:m)(h,f));}function d(){return l.length>0&&!l.some(h=>h==="object"||h==="array")}function y(h,f){let p=e.name("item"),_=(0, ls.checkDataTypes)(l,p,i.opts.strictNumbers,ls.DataType.Wrong),q=e.const("indices",(0, z._)`{}`);e.for((0, z._)`;${h}--;`,()=>{e.let(p,(0, z._)`${r}[${h}]`),e.if(_,(0, z._)`continue`),l.length>1&&e.if((0, z._)`typeof ${p} == "string"`,(0, z._)`${p} += "_"`),e.if((0, z._)`typeof ${q}[${p}] == "number"`,()=>{e.assign(f,(0, z._)`${q}[${p}]`),t.error(),e.assign(c,false).break();}).code((0, z._)`${q}[${p}] = ${h}`);});}function m(h,f){let p=(0, el.useFunc)(e,tl.default),_=e.name("outer");e.label(_).for((0, z._)`;${h}--;`,()=>e.for((0, z._)`${f} = ${h}; ${f}--;`,()=>e.if((0, z._)`${p}(${r}[${h}], ${r}[${f}])`,()=>{t.error(),e.assign(c,false).break(_);})));}}};ds.default=sl;});var Oo=chunkGNFE24S7_cjs.a(hs=>{Object.defineProperty(hs,"__esModule",{value:true});var fs=S(),nl=j(),ol=Ht(),al={message:"must be equal to constant",params:({schemaCode:t})=>(0, fs._)`{allowedValue: ${t}}`},il={keyword:"const",$data:true,error:al,code(t){let{gen:e,data:r,$data:s,schemaCode:n,schema:o}=t;s||o&&typeof o=="object"?t.fail$data((0, fs._)`!${(0, nl.useFunc)(e,ol.default)}(${r}, ${n})`):t.fail((0, fs._)`${o} !== ${r}`);}};hs.default=il;});var Io=chunkGNFE24S7_cjs.a(ps=>{Object.defineProperty(ps,"__esModule",{value:true});var _t=S(),cl=j(),ul=Ht(),ll={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0, _t._)`{allowedValues: ${t}}`},dl={keyword:"enum",schemaType:"array",$data:true,error:ll,code(t){let{gen:e,data:r,$data:s,schema:n,schemaCode:o,it:a}=t;if(!s&&n.length===0)throw new Error("enum must have non-empty array");let i=n.length>=a.opts.loopEnum,c,l=()=>c??(c=(0, cl.useFunc)(e,ul.default)),u;if(i||s)u=e.let("valid"),t.block$data(u,d);else {if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",o);u=(0, _t.or)(...n.map((h,f)=>y(m,f)));}t.pass(u);function d(){e.assign(u,false),e.forOf("v",o,m=>e.if((0, _t._)`${l()}(${r}, ${m})`,()=>e.assign(u,true).break()));}function y(m,h){let f=n[h];return typeof f=="object"&&f!==null?(0, _t._)`${l()}(${r}, ${m}[${h}])`:(0, _t._)`${r} === ${f}`}}};ps.default=dl;});var Ro=chunkGNFE24S7_cjs.a(ms=>{Object.defineProperty(ms,"__esModule",{value:true});var fl=$o(),hl=vo(),pl=Eo(),ml=So(),yl=Po(),_l=No(),gl=ko(),$l=jo(),vl=Oo(),wl=Io(),bl=[fl.default,hl.default,pl.default,ml.default,yl.default,_l.default,gl.default,$l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},vl.default,wl.default];ms.default=bl;});var _s=chunkGNFE24S7_cjs.a(gt=>{Object.defineProperty(gt,"__esModule",{value:true});gt.validateAdditionalItems=void 0;var Oe=S(),ys=j(),El={message:({params:{len:t}})=>(0, Oe.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0, Oe._)`{limit: ${t}}`},Sl={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:El,code(t){let{parentSchema:e,it:r}=t,{items:s}=e;if(!Array.isArray(s)){(0, ys.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}To(t,s);}};function To(t,e){let{gen:r,schema:s,data:n,keyword:o,it:a}=t;a.items=true;let i=r.const("len",(0, Oe._)`${n}.length`);if(s===false)t.setParams({len:e.length}),t.pass((0, Oe._)`${i} <= ${e.length}`);else if(typeof s=="object"&&!(0, ys.alwaysValidSchema)(a,s)){let l=r.var("valid",(0, Oe._)`${i} <= ${e.length}`);r.if((0, Oe.not)(l),()=>c(l)),t.ok(l);}function c(l){r.forRange("i",e.length,i,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:ys.Type.Num},l),a.allErrors||r.if((0, Oe.not)(l),()=>r.break());});}}gt.validateAdditionalItems=To;gt.default=Sl;});var gs=chunkGNFE24S7_cjs.a($t=>{Object.defineProperty($t,"__esModule",{value:true});$t.validateTuple=void 0;var Co=S(),Gt=j(),Pl=B(),Nl={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Mo(t,"additionalItems",e);r.items=true,!(0, Gt.alwaysValidSchema)(r,e)&&t.ok((0, Pl.validateArray)(t));}};function Mo(t,e,r=t.schema){let{gen:s,parentSchema:n,data:o,keyword:a,it:i}=t;u(n),i.opts.unevaluated&&r.length&&i.items!==true&&(i.items=Gt.mergeEvaluated.items(s,r.length,i.items));let c=s.name("valid"),l=s.const("len",(0, Co._)`${o}.length`);r.forEach((d,y)=>{(0, Gt.alwaysValidSchema)(i,d)||(s.if((0, Co._)`${l} > ${y}`,()=>t.subschema({keyword:a,schemaProp:y,dataProp:y},c)),t.ok(c));});function u(d){let{opts:y,errSchemaPath:m}=i,h=r.length,f=h===d.minItems&&(h===d.maxItems||d[e]===false);if(y.strictTuples&&!f){let p=`"${a}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0, Gt.checkStrictMode)(i,p,y.strictTuples);}}}$t.validateTuple=Mo;$t.default=Nl;});var Ao=chunkGNFE24S7_cjs.a($s=>{Object.defineProperty($s,"__esModule",{value:true});var kl=gs(),ql={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0, kl.validateTuple)(t,"items")};$s.default=ql;});var Vo=chunkGNFE24S7_cjs.a(vs=>{Object.defineProperty(vs,"__esModule",{value:true});var Do=S(),jl=j(),Ol=B(),Il=_s(),Rl={message:({params:{len:t}})=>(0, Do.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0, Do._)`{limit: ${t}}`},Tl={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Rl,code(t){let{schema:e,parentSchema:r,it:s}=t,{prefixItems:n}=r;s.items=true,!(0, jl.alwaysValidSchema)(s,e)&&(n?(0, Il.validateAdditionalItems)(t,n):t.ok((0, Ol.validateArray)(t)));}};vs.default=Tl;});var zo=chunkGNFE24S7_cjs.a(ws=>{Object.defineProperty(ws,"__esModule",{value:true});var Y=S(),Jt=j(),Cl={message:({params:{min:t,max:e}})=>e===void 0?(0, Y.str)`must contain at least ${t} valid item(s)`:(0, Y.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0, Y._)`{minContains: ${t}}`:(0, Y._)`{minContains: ${t}, maxContains: ${e}}`},Ml={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:Cl,code(t){let{gen:e,schema:r,parentSchema:s,data:n,it:o}=t,a,i,{minContains:c,maxContains:l}=s;o.opts.next?(a=c===void 0?1:c,i=l):a=1;let u=e.const("len",(0, Y._)`${n}.length`);if(t.setParams({min:a,max:i}),i===void 0&&a===0){(0, Jt.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&a>i){(0, Jt.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0, Jt.alwaysValidSchema)(o,r)){let f=(0, Y._)`${u} >= ${a}`;i!==void 0&&(f=(0, Y._)`${f} && ${u} <= ${i}`),t.pass(f);return}o.items=true;let d=e.name("valid");i===void 0&&a===1?m(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,true),i!==void 0&&e.if((0, Y._)`${n}.length > 0`,y)):(e.let(d,false),y()),t.result(d,()=>t.reset());function y(){let f=e.name("_valid"),p=e.let("count",0);m(f,()=>e.if(f,()=>h(p)));}function m(f,p){e.forRange("i",0,u,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:Jt.Type.Num,compositeRule:true},f),p();});}function h(f){e.code((0, Y._)`${f}++`),i===void 0?e.if((0, Y._)`${f} >= ${a}`,()=>e.assign(d,true).break()):(e.if((0, Y._)`${f} > ${i}`,()=>e.assign(d,false).break()),a===1?e.assign(d,true):e.if((0, Y._)`${f} >= ${a}`,()=>e.assign(d,true)));}}};ws.default=Ml;});var Fo=chunkGNFE24S7_cjs.a(ie=>{Object.defineProperty(ie,"__esModule",{value:true});ie.validateSchemaDeps=ie.validatePropertyDeps=ie.error=void 0;var bs=S(),Al=j(),vt=B();ie.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let s=e===1?"property":"properties";return (0, bs.str)`must have ${s} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:s}})=>(0, bs._)`{property: ${t},
|
|
6
|
+
missingProperty: ${s},
|
|
7
|
+
depsCount: ${e},
|
|
8
|
+
deps: ${r}}`};var Dl={keyword:"dependencies",type:"object",schemaType:"object",error:ie.error,code(t){let[e,r]=Vl(t);Uo(t,e),Ko(t,r);}};function Vl({schema:t}){let e={},r={};for(let s in t){if(s==="__proto__")continue;let n=Array.isArray(t[s])?e:r;n[s]=t[s];}return [e,r]}function Uo(t,e=t.schema){let{gen:r,data:s,it:n}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let a in e){let i=e[a];if(i.length===0)continue;let c=(0, vt.propertyInData)(r,s,a,n.opts.ownProperties);t.setParams({property:a,depsCount:i.length,deps:i.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of i)(0, vt.checkReportMissingProp)(t,l);}):(r.if((0, bs._)`${c} && (${(0, vt.checkMissingProp)(t,i,o)})`),(0, vt.reportMissingProp)(t,o),r.else());}}ie.validatePropertyDeps=Uo;function Ko(t,e=t.schema){let{gen:r,data:s,keyword:n,it:o}=t,a=r.name("valid");for(let i in e)(0, Al.alwaysValidSchema)(o,e[i])||(r.if((0, vt.propertyInData)(r,s,i,o.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:i},a);t.mergeValidEvaluated(c,a);},()=>r.var(a,true)),t.ok(a));}ie.validateSchemaDeps=Ko;ie.default=Dl;});var Lo=chunkGNFE24S7_cjs.a(Es=>{Object.defineProperty(Es,"__esModule",{value:true});var xo=S(),zl=j(),Ul={message:"property name must be valid",params:({params:t})=>(0, xo._)`{propertyName: ${t.propertyName}}`},Kl={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Ul,code(t){let{gen:e,schema:r,data:s,it:n}=t;if((0, zl.alwaysValidSchema)(n,r))return;let o=e.name("valid");e.forIn("key",s,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:true},o),e.if((0, xo.not)(o),()=>{t.error(true),n.allErrors||e.break();});}),t.ok(o);}};Es.default=Kl;});var Ps=chunkGNFE24S7_cjs.a(Ss=>{Object.defineProperty(Ss,"__esModule",{value:true});var Wt=B(),re=S(),Fl=de(),Qt=j(),xl={message:"must NOT have additional properties",params:({params:t})=>(0, re._)`{additionalProperty: ${t.additionalProperty}}`},Ll={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:xl,code(t){let{gen:e,schema:r,parentSchema:s,data:n,errsCount:o,it:a}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:i,opts:c}=a;if(a.props=true,c.removeAdditional!=="all"&&(0, Qt.alwaysValidSchema)(a,r))return;let l=(0, Wt.allSchemaProperties)(s.properties),u=(0, Wt.allSchemaProperties)(s.patternProperties);d(),t.ok((0, re._)`${o} === ${Fl.default.errors}`);function d(){e.forIn("key",n,p=>{!l.length&&!u.length?h(p):e.if(y(p),()=>h(p));});}function y(p){let _;if(l.length>8){let q=(0, Qt.schemaRefOrVal)(a,s.properties,"properties");_=(0, Wt.isOwnProperty)(e,q,p);}else l.length?_=(0, re.or)(...l.map(q=>(0, re._)`${p} === ${q}`)):_=re.nil;return u.length&&(_=(0, re.or)(_,...u.map(q=>(0, re._)`${(0, Wt.usePattern)(t,q)}.test(${p})`))),(0, re.not)(_)}function m(p){e.code((0, re._)`delete ${n}[${p}]`);}function h(p){if(c.removeAdditional==="all"||c.removeAdditional&&r===false){m(p);return}if(r===false){t.setParams({additionalProperty:p}),t.error(),i||e.break();return}if(typeof r=="object"&&!(0, Qt.alwaysValidSchema)(a,r)){let _=e.name("valid");c.removeAdditional==="failing"?(f(p,_,false),e.if((0, re.not)(_),()=>{t.reset(),m(p);})):(f(p,_),i||e.if((0, re.not)(_),()=>e.break()));}}function f(p,_,q){let N={keyword:"additionalProperties",dataProp:p,dataPropType:Qt.Type.Str};q===false&&Object.assign(N,{compositeRule:true,createErrors:false,allErrors:false}),t.subschema(N,_);}}};Ss.default=Ll;});var Jo=chunkGNFE24S7_cjs.a(ks=>{Object.defineProperty(ks,"__esModule",{value:true});var Hl=at(),Ho=B(),Ns=j(),Go=Ps(),Gl={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:s,data:n,it:o}=t;o.opts.removeAdditional==="all"&&s.additionalProperties===void 0&&Go.default.code(new Hl.KeywordCxt(o,Go.default,"additionalProperties"));let a=(0, Ho.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==true&&(o.props=Ns.mergeEvaluated.props(e,(0, Ns.toHash)(a),o.props));let i=a.filter(d=>!(0, Ns.alwaysValidSchema)(o,r[d]));if(i.length===0)return;let c=e.name("valid");for(let d of i)l(d)?u(d):(e.if((0, Ho.propertyInData)(e,n,d,o.opts.ownProperties)),u(d),o.allErrors||e.else().var(c,true),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c);}}};ks.default=Gl;});var Xo=chunkGNFE24S7_cjs.a(qs=>{Object.defineProperty(qs,"__esModule",{value:true});var Wo=B(),Bt=S(),Qo=j(),Bo=j(),Jl={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:s,parentSchema:n,it:o}=t,{opts:a}=o,i=(0, Wo.allSchemaProperties)(r),c=i.filter(f=>(0, Qo.alwaysValidSchema)(o,r[f]));if(i.length===0||c.length===i.length&&(!o.opts.unevaluated||o.props===true))return;let l=a.strictSchema&&!a.allowMatchingProperties&&n.properties,u=e.name("valid");o.props!==true&&!(o.props instanceof Bt.Name)&&(o.props=(0, Bo.evaluatedPropsToName)(e,o.props));let{props:d}=o;y();function y(){for(let f of i)l&&m(f),o.allErrors?h(f):(e.var(u,true),h(f),e.if(u));}function m(f){for(let p in l)new RegExp(f).test(p)&&(0, Qo.checkStrictMode)(o,`property ${p} matches pattern ${f} (use allowMatchingProperties)`);}function h(f){e.forIn("key",s,p=>{e.if((0, Bt._)`${(0, Wo.usePattern)(t,f)}.test(${p})`,()=>{let _=c.includes(f);_||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:p,dataPropType:Bo.Type.Str},u),o.opts.unevaluated&&d!==true?e.assign((0, Bt._)`${d}[${p}]`,true):!_&&!o.allErrors&&e.if((0, Bt.not)(u),()=>e.break());});});}}};qs.default=Jl;});var Yo=chunkGNFE24S7_cjs.a(js=>{Object.defineProperty(js,"__esModule",{value:true});var Wl=j(),Ql={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(t){let{gen:e,schema:r,it:s}=t;if((0, Wl.alwaysValidSchema)(s,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},n),t.failResult(n,()=>t.reset(),()=>t.error());},error:{message:"must NOT be valid"}};js.default=Ql;});var Zo=chunkGNFE24S7_cjs.a(Os=>{Object.defineProperty(Os,"__esModule",{value:true});var Bl=B(),Xl={keyword:"anyOf",schemaType:"array",trackErrors:true,code:Bl.validateUnion,error:{message:"must match a schema in anyOf"}};Os.default=Xl;});var ea=chunkGNFE24S7_cjs.a(Is=>{Object.defineProperty(Is,"__esModule",{value:true});var Xt=S(),Yl=j(),Zl={message:"must match exactly one schema in oneOf",params:({params:t})=>(0, Xt._)`{passingSchemas: ${t.passing}}`},ed={keyword:"oneOf",schemaType:"array",trackErrors:true,error:Zl,code(t){let{gen:e,schema:r,parentSchema:s,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&s.discriminator)return;let o=r,a=e.let("valid",false),i=e.let("passing",null),c=e.name("_valid");t.setParams({passing:i}),e.block(l),t.result(a,()=>t.reset(),()=>t.error(true));function l(){o.forEach((u,d)=>{let y;(0, Yl.alwaysValidSchema)(n,u)?e.var(c,true):y=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:true},c),d>0&&e.if((0, Xt._)`${c} && ${a}`).assign(a,false).assign(i,(0, Xt._)`[${i}, ${d}]`).else(),e.if(c,()=>{e.assign(a,true),e.assign(i,d),y&&t.mergeEvaluated(y,Xt.Name);});});}}};Is.default=ed;});var ta=chunkGNFE24S7_cjs.a(Rs=>{Object.defineProperty(Rs,"__esModule",{value:true});var td=j(),rd={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((o,a)=>{if((0, td.alwaysValidSchema)(s,o))return;let i=t.subschema({keyword:"allOf",schemaProp:a},n);t.ok(n),t.mergeEvaluated(i);});}};Rs.default=rd;});var na=chunkGNFE24S7_cjs.a(Ts=>{Object.defineProperty(Ts,"__esModule",{value:true});var Yt=S(),sa=j(),sd={message:({params:t})=>(0, Yt.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0, Yt._)`{failingKeyword: ${t.ifClause}}`},nd={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:sd,code(t){let{gen:e,parentSchema:r,it:s}=t;r.then===void 0&&r.else===void 0&&(0, sa.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let n=ra(s,"then"),o=ra(s,"else");if(!n&&!o)return;let a=e.let("valid",true),i=e.name("_valid");if(c(),t.reset(),n&&o){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(i,l("then",u),l("else",u));}else n?e.if(i,l("then")):e.if((0, Yt.not)(i),l("else"));t.pass(a,()=>t.error(true));function c(){let u=t.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},i);t.mergeEvaluated(u);}function l(u,d){return ()=>{let y=t.subschema({keyword:u},i);e.assign(a,i),t.mergeValidEvaluated(y,a),d?e.assign(d,(0, Yt._)`${u}`):t.setParams({ifClause:u});}}}};function ra(t,e){let r=t.schema[e];return r!==void 0&&!(0, sa.alwaysValidSchema)(t,r)}Ts.default=nd;});var oa=chunkGNFE24S7_cjs.a(Cs=>{Object.defineProperty(Cs,"__esModule",{value:true});var od=j(),ad={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0, od.checkStrictMode)(r,`"${t}" without "if" is ignored`);}};Cs.default=ad;});var aa=chunkGNFE24S7_cjs.a(Ms=>{Object.defineProperty(Ms,"__esModule",{value:true});var id=_s(),cd=Ao(),ud=gs(),ld=Vo(),dd=zo(),fd=Fo(),hd=Lo(),pd=Ps(),md=Jo(),yd=Xo(),_d=Yo(),gd=Zo(),$d=ea(),vd=ta(),wd=na(),bd=oa();function Ed(t=false){let e=[_d.default,gd.default,$d.default,vd.default,wd.default,bd.default,hd.default,pd.default,fd.default,md.default,yd.default];return t?e.push(cd.default,ld.default):e.push(id.default,ud.default),e.push(dd.default),e}Ms.default=Ed;});var ia=chunkGNFE24S7_cjs.a(As=>{Object.defineProperty(As,"__esModule",{value:true});var D=S(),Sd={message:({schemaCode:t})=>(0, D.str)`must match format "${t}"`,params:({schemaCode:t})=>(0, D._)`{format: ${t}}`},Pd={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:Sd,code(t,e){let{gen:r,data:s,$data:n,schema:o,schemaCode:a,it:i}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=i;if(!c.validateFormats)return;n?y():m();function y(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),f=r.const("fDef",(0, D._)`${h}[${a}]`),p=r.let("fType"),_=r.let("format");r.if((0, D._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(p,(0, D._)`${f}.type || "string"`).assign(_,(0, D._)`${f}.validate`),()=>r.assign(p,(0, D._)`"string"`).assign(_,f)),t.fail$data((0, D.or)(q(),N()));function q(){return c.strictSchema===false?D.nil:(0, D._)`${a} && !${_}`}function N(){let C=u.$async?(0, D._)`(${f}.async ? await ${_}(${s}) : ${_}(${s}))`:(0, D._)`${_}(${s})`,w=(0, D._)`(typeof ${_} == "function" ? ${C} : ${_}.test(${s}))`;return (0, D._)`${_} && ${_} !== true && ${p} === ${e} && !${w}`}}function m(){let h=d.formats[o];if(!h){q();return}if(h===true)return;let[f,p,_]=N(h);f===e&&t.pass(C());function q(){if(c.strictSchema===false){d.logger.warn(w());return}throw new Error(w());function w(){return `unknown format "${o}" ignored in schema at path "${l}"`}}function N(w){let se=w instanceof RegExp?(0, D.regexpCode)(w):c.code.formats?(0, D._)`${c.code.formats}${(0, D.getProperty)(o)}`:void 0,ce=r.scopeValue("formats",{key:o,ref:w,code:se});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0, D._)`${ce}.validate`]:["string",w,ce]}function C(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return (0, D._)`await ${_}(${s})`}return typeof p=="function"?(0, D._)`${_}(${s})`:(0, D._)`${_}.test(${s})`}}}};As.default=Pd;});var ca=chunkGNFE24S7_cjs.a(Ds=>{Object.defineProperty(Ds,"__esModule",{value:true});var Nd=ia(),kd=[Nd.default];Ds.default=kd;});var ua=chunkGNFE24S7_cjs.a(Fe=>{Object.defineProperty(Fe,"__esModule",{value:true});Fe.contentVocabulary=Fe.metadataVocabulary=void 0;Fe.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Fe.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var da=chunkGNFE24S7_cjs.a(Vs=>{Object.defineProperty(Vs,"__esModule",{value:true});var qd=go(),jd=Ro(),Od=aa(),Id=ca(),la=ua(),Rd=[qd.default,jd.default,(0, Od.default)(),Id.default,la.metadataVocabulary,la.contentVocabulary];Vs.default=Rd;});var ha=chunkGNFE24S7_cjs.a(Zt=>{Object.defineProperty(Zt,"__esModule",{value:true});Zt.DiscrError=void 0;var fa;(function(t){t.Tag="tag",t.Mapping="mapping";})(fa||(Zt.DiscrError=fa={}));});var ma=chunkGNFE24S7_cjs.a(Us=>{Object.defineProperty(Us,"__esModule",{value:true});var xe=S(),zs=ha(),pa=Mt(),Td=it(),Cd=j(),Md={message:({params:{discrError:t,tagName:e}})=>t===zs.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0, xe._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Ad={keyword:"discriminator",type:"object",schemaType:"object",error:Md,code(t){let{gen:e,data:r,schema:s,parentSchema:n,it:o}=t,{oneOf:a}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=s.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(s.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",false),l=e.const("tag",(0, xe._)`${r}${(0, xe.getProperty)(i)}`);e.if((0, xe._)`typeof ${l} == "string"`,()=>u(),()=>t.error(false,{discrError:zs.DiscrError.Tag,tag:l,tagName:i})),t.ok(c);function u(){let m=y();e.if(false);for(let h in m)e.elseIf((0, xe._)`${l} === ${h}`),e.assign(c,d(m[h]));e.else(),t.error(false,{discrError:zs.DiscrError.Mapping,tag:l,tagName:i}),e.endIf();}function d(m){let h=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:m},h);return t.mergeEvaluated(f,xe.Name),h}function y(){var m;let h={},f=_(n),p=true;for(let C=0;C<a.length;C++){let w=a[C];if(w?.$ref&&!(0, Cd.schemaHasRulesButRef)(w,o.self.RULES)){let ce=w.$ref;if(w=pa.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ce),w instanceof pa.SchemaEnv&&(w=w.schema),w===void 0)throw new Td.default(o.opts.uriResolver,o.baseId,ce)}let se=(m=w?.properties)===null||m===void 0?void 0:m[i];if(typeof se!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);p=p&&(f||_(w)),q(se,C);}if(!p)throw new Error(`discriminator: "${i}" must be required`);return h;function _({required:C}){return Array.isArray(C)&&C.includes(i)}function q(C,w){if(C.const)N(C.const,w);else if(C.enum)for(let se of C.enum)N(se,w);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function N(C,w){if(typeof C!="string"||C in h)throw new Error(`discriminator: "${i}" values must be unique strings`);h[C]=w;}}}};Us.default=Ad;});var ya=chunkGNFE24S7_cjs.a((oh,Dd)=>{Dd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{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:true,default:[]}},type:["object","boolean"],properties:{$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:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},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:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},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:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},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:"#"}},default:true};});var Hd=chunkGNFE24S7_cjs.a((A,Ks)=>{Object.defineProperty(A,"__esModule",{value:true});A.MissingRefError=A.ValidationError=A.CodeGen=A.Name=A.nil=A.stringify=A.str=A._=A.KeywordCxt=A.Ajv=void 0;var Vd=fo(),zd=da(),Ud=ma(),_a=ya(),Kd=["/properties"],er="http://json-schema.org/draft-07/schema",Le=class extends Vd.default{_addVocabularies(){super._addVocabularies(),zd.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Ud.default);}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(_a,Kd):_a;this.addMetaSchema(e,er,false),this.refs["http://json-schema.org/schema"]=er;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(er)?er:void 0)}};A.Ajv=Le;Ks.exports=A=Le;Ks.exports.Ajv=Le;Object.defineProperty(A,"__esModule",{value:true});A.default=Le;var Fd=at();Object.defineProperty(A,"KeywordCxt",{enumerable:true,get:function(){return Fd.KeywordCxt}});var He=S();Object.defineProperty(A,"_",{enumerable:true,get:function(){return He._}});Object.defineProperty(A,"str",{enumerable:true,get:function(){return He.str}});Object.defineProperty(A,"stringify",{enumerable:true,get:function(){return He.stringify}});Object.defineProperty(A,"nil",{enumerable:true,get:function(){return He.nil}});Object.defineProperty(A,"Name",{enumerable:true,get:function(){return He.Name}});Object.defineProperty(A,"CodeGen",{enumerable:true,get:function(){return He.CodeGen}});var xd=Tt();Object.defineProperty(A,"ValidationError",{enumerable:true,get:function(){return xd.default}});var Ld=it();Object.defineProperty(A,"MissingRefError",{enumerable:true,get:function(){return Ld.default}});});
|
|
9
|
+
exports.a=S;exports.b=j;exports.c=de;exports.d=at;exports.e=Tt;exports.f=it;exports.g=Mt;exports.h=fo;exports.i=_o;exports.j=go;exports.k=Ro;exports.l=Fo;exports.m=aa;exports.n=ca;exports.o=ua;exports.p=ma;exports.q=Hd;//# sourceMappingURL=chunk-UJ7ZTV4J.cjs.map
|
|
10
|
+
//# sourceMappingURL=chunk-UJ7ZTV4J.cjs.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var a="b64:";function s(e){let n=new TextEncoder().encode(e),r=globalThis.Buffer,t;if(r)t=r.from(n).toString("base64");else if(typeof btoa=="function"){let o="";for(let i of n)o+=String.fromCharCode(i);t=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function g(e){let n=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(n,"base64").toString("utf8");if(typeof atob=="function"){let t=atob(n),o=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)o[i]=t.charCodeAt(i);return new TextDecoder().decode(o)}throw new Error("No base64 decoder available in this runtime")}function l(e){return `${a}${s(JSON.stringify(e))}`}function u(e){if(!e.startsWith(a))throw new Error(`Invalid ref format (expected ${a}<base64url(json)>): ${e}`);let n;try{n=JSON.parse(g(e.slice(a.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=n;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function f(e,n,r){let t=e.tryAcquire();if(!t)return false;try{await n();}finally{t();}return r?.(),true}
|
|
2
|
+
exports.a=l;exports.b=u;exports.c=f;//# sourceMappingURL=chunk-UVE65IPR.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-UVE65IPR.cjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-JMDHDY6M.js';function w(o,i){if(o?.status==="success")return Object.prototype.hasOwnProperty.call(o,"data")?o.data:void 0;throw o?.status==="fail"||o?.status==="error"?new Error(o.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function z(o,i){if(o?.status==="success"&&Object.prototype.hasOwnProperty.call(o,"data"))return o.data;throw o?.status==="success"?new Error(`${i} returned success without data`):o?.status==="fail"||o?.status==="error"?new Error(o.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function t(o){return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}function b(o){return Array.isArray(o)?o:[]}function N(o,i){if(typeof i!="string"||i.length===0)return;let u=o,m=i;m.startsWith("fetched_sources.")&&(u=t(o).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(u==null||typeof u!="object")return;u=u[k];}return u}function $(o,i){let u=t(o.view),m=b(u.elements);return {layout:u.layout,features:u.features,elements:m.map((k,x)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!N(i,v.visible):true,U=typeof I.bind=="string"?I.bind:void 0,M=typeof I.maxRows=="number"?I.maxRows:void 0,P=U?N(i,U):void 0,q={id:typeof v.id=="string"&&v.id?v.id:`element-${x}`,kind:v.kind,label:v.label,visible:B};return P!==void 0&&(q.resolved=Array.isArray(P)&&typeof M=="number"?P.slice(0,M):P),q})}}function K(o,i){let u=typeof o.id=="string"&&o.id?o.id:"card",m=b(o.provides),k=m.length>0?m:[{bindTo:u,ref:"card_data"}],x={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",U=typeof I.ref=="string"?I.ref:"";if(!B||!U)continue;let M=N(i,U);M!==void 0&&(x[B]=M);}return x}function ie(o){if(typeof o!="string"||!o.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(o.trim());if(!i)return null;let u=Number.parseInt(i[2],10);return !Number.isInteger(u)||u<0?null:u}function ce(o){return {"card-content":o}}function O(o){let{meta:i,...u}=o;return u}function ue(o,i){return Object.prototype.hasOwnProperty.call(o,i)}function W(o){return t(o.meta).__visible_controlplane_only===true}function L(o,i){let u=w(o.get({params:{id:i}}),"cardStore.get"),m=Array.isArray(u?.cards)?u.cards:[];if(m.length===0)throw new Error(`Card "${i}" not found`);return m[0]}function me(o){let{board:i,nonCore:u,cardStore:m,chatStore:k,uploadCardFile:x,buildFileDownloadUrl:v,readFetchedSourceJsonByRef:I}=o;function B(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),s=atob(n);return Uint8Array.from(s,a=>a.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function U(){let r=t(await J(u.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}function M(){let r=t(w(i.status({}),"status")),e=t(r.summary),n=b(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let a=t(s);return {"card-id":typeof a.name=="string"?a.name:null,status:a.status??null,error:a.error??null,requires:b(a.requires),requires_satisfied:b(a.requires_satisfied),requires_missing:b(a.requires_missing),provides_declared:b(a.provides_declared),provides_runtime:b(a.provides_runtime)}})}}function P(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(w(i.status({}),"status")),a=b(n.cards).map(t).find(p=>p.name===e);if(!a)throw new Error(`card "${e}" not found in board status`);let d=t(L(m,e));if(W(d))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let f=O(d),c=b(a.requires_satisfied).filter(p=>typeof p=="string"&&!!p),g=b(a.provides_runtime).filter(p=>typeof p=="string"&&!!p),R=Object.fromEntries(c.map(p=>[p,w(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)])),h=Object.fromEntries(g.map(p=>[p,w(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)])),C=t(w(i.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),l=w(i.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=b(d.source_defs).map(t),y={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(y[p.outputFile]=p.bindTo);let S={};for(let[p,j]of Object.entries(l)){let T=y[p]??p;if(!I||typeof j!="string"){S[T]=null;continue}try{S[T]=I({cardId:e,ref:j});}catch{S[T]=null;}}let A={card_data:t(d.card_data),requires:R,fetched_sources:S,computed_values:C};return {cardId:e,card_status_in_board:a,card_definition_and_static_data:f,refs_for_fetched_source_files:l,runtime_data:{requires:R,provides:h,computed_values:C,rendered_view:$(d,A)}}}function q(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,a=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",d=s?void 0:r.lastUserTurns??(n?void 0:1),f=r.tail,c={...d===void 0?{}:{tailTurns:d},...n?{turnId:n}:{},...s?{allTurns:true}:{},...a?{tailTurnsBeforeId:a}:{}},g=Object.keys(c).length>0?{params:{cardId:e},body:c}:{params:{cardId:e}},R=w(k.readAll(g),"chatStore.readAll"),h=t(L(m,e)),C=b(t(h.card_data).files).map((y,S)=>({idx:S,stored_name:t(y).stored_name})).filter(y=>typeof y.stored_name=="string"&&y.stored_name.length>0),_=(Array.isArray(R.records)?R.records:[]).map(y=>{let A=t(y.payload),p={...y},j=typeof y?.role=="string"?y.role:typeof A.role=="string"?String(A.role):"",T=typeof y?.text=="string"?y.text:typeof A.text=="string"?String(A.text):"";if(j==="system"){let D=ie(T);if(D!==null&&C.some(E=>E.idx===D)){let E=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${D}`;p.retrieval_hint=E,Object.keys(A).length>0&&typeof y.role!="string"&&(p.payload={...A,retrieval_hint:E});}}return p});return {cardId:e,messages:typeof f=="number"&&f>=0?_.slice(-f):_}}function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(L(m,e)),a=b(t(s.card_data).files).map(t);if(n>=a.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let d=a[n],f=typeof d.stored_name=="string"?d.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:f}),...typeof d.name=="string"?{name:d.name}:{},...typeof d.stored_name=="string"?{stored_name:d.stored_name}:{},...typeof d.mime_type=="string"?{mime_type:d.mime_type}:{},...typeof d.size=="number"?{size:d.size}:{},...typeof d.uploaded_at=="string"?{uploaded_at:d.uploaded_at}:{}}}async function F(r){return await u.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=u.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(z(e,"evalCardCompute")),s=t(r.candidateCardContent),a={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:b(n.errors).map(d=>{let f=t(d);return {bindTo:typeof f.bindTo=="string"?f.bindTo:"",error:typeof f.error=="string"?f.error:""}}),provides_outputs:K(s,a),rendered_view:$(s,a)}}}async function Q(r){return await u.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(L(m,e)),s=b(n.source_defs).filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)),a$1={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let d=s[r.sourceIdx],f=a.enrichSourcesSync([d],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(f)&&f.length>0&&(a$1=t(f[0]._projections));}return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":a$1}})}async function Z(r){let e=t(await J(u.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),a=b(e.source_probes),d=b(e.projection_errors),f=t(e.fetched_sources),c=b(e.compute_errors),g=t(e.computed_values),R={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:f,computed_values:g},h=[];for(let C of b(s.issues))typeof C=="string"&&C&&h.push(C);for(let C of a){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",y=typeof l.error=="string"?l.error:"";y&&h.push(`${_}: ${y}`);}for(let C of d){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",y=typeof l.key=="string"?l.key:"projection",S=typeof l.error=="string"?l.error:"projection failed";h.push(`${_}.${y}: ${S}`);}for(let C of c){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"compute",y=typeof l.error=="string"?l.error:"compute failed";h.push(`${_}: ${y}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:h,provides_outputs:K(n,R),rendered_view:$(n,R)}}}function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=w(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(W))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(a=>O(a))}function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",a=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&a){let c=w(k.readAll({params:{cardId:e},body:{turnId:a}}),"chatStore.readAll(existing turn messages)"),g=Array.isArray(c.records)?c.records.find(R=>R.role==="assistant"&&String(R.turn||"")===a):void 0;if(g)return {status:"success",data:{cardId:e,id:String(g.id),role:n,turn:a,files:Array.isArray(g.files)?g.files:[]}}}let d=b(r.files).map(c=>{let g=t(c),R=String(g.file_name??g.fileName??g.name??"").trim(),h=String(g.content_type??g.contentType??"application/octet-stream");if(!R)throw new Error("file entry requires file_name");return x({cardId:e,fileName:R,contentType:h,bytes:B(g)}).file});d.forEach((c,g)=>{let R=n==="assistant"?`AI generated: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`:`file uploaded: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`;w(k.append({params:{cardId:e},body:{role:"system",text:R,files:[],turn:a}}),"chatStore.append(system attachment message)");});let f=w(k.append({params:{cardId:e},body:{role:n,text:s,files:d,turn:a}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:a,files:d}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=O(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let a=await F({candidateCardContent:s}),d=t(a),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:a};let c=null;try{c=L(m,e);}catch{c=null;}let g=c&&ue(t(c),"meta")?{...s,meta:t(c).meta}:s,R=m.set({body:g});w(R,"cardStore.set");let h;try{h=i.upsertCard({params:{cardId:e,restart:!0}}),w(h,"upsertCard");}catch(l){try{c&&m.set({body:c});}catch{}throw l}let C=null;try{C=i.cardRefreshedNotify({params:{cardId:e}}),w(C,"cardRefreshedNotify");}catch{C=null;}return {status:"success",data:{validation:a,card_saved:null,board_result:h,refresh_notify:C}}}function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=i.removeCard({params:{id:e}});w(n,"removeCard");let s=m.del({params:{id:e}});return w(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}function oe(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=w(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function ae(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=O(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let a=await F({candidateCardContent:s}),d=t(a),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:a};let c=null;try{c=L(m,e);}catch{c=null;}let g=c?t(t(c).meta):{},R={...s,meta:{...g,__visible_controlplane_only:true}},h=m.set({body:R});w(h,"cardStore.set");let C;try{C=i.upsertCard({params:{cardId:e,restart:!0}}),w(C,"upsertCard");}catch(_){try{c&&m.set({body:c});}catch{}throw _}let l=null;try{l=i.cardRefreshedNotify({params:{cardId:e}}),w(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:a,card_saved:null,board_result:C,refresh_notify:l}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=z(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function de(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return w(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:U,inspectBoardRuntimeStatus:M,inspectCardDefinitionAndRuntime:P,inspectChatMessagesOnCards:q,inspectFileContents:H,preflightValidateCandidateCardDefinition:F,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:oe,adminUpsertCard:ae,getChatProcessing:se,setChatProcessing:de}}async function J(o,i){return w(await o,i)}export{me as a};//# sourceMappingURL=chunk-VCCTAUIG.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-VCCTAUIG.js.map
|