UNPKG

@novu/framework

Version:

The Code-First Notifications Workflow SDK.

5 lines 220 kB
"use strict";var Co=Object.create;var Gt=Object.defineProperty;var Lo=Object.getOwnPropertyDescriptor;var Do=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty;var Fo=(f,i)=>{for(var s in i)Gt(f,s,{get:i[s],enumerable:!0})},br=(f,i,s,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let S of Do(i))!Uo.call(f,S)&&S!==s&&Gt(f,S,{get:()=>i[S],enumerable:!(l=Lo(i,S))||l.enumerable});return f};var et=(f,i,s)=>(s=f!=null?Co($o(f)):{},br(i||!f||!f.__esModule?Gt(s,"default",{value:f,enumerable:!0}):s,f)),jo=f=>br(Gt({},"__esModule",{value:!0}),f);var $a={};Fo($a,{Client:()=>wt,CronExpression:()=>oi,NovuRequestHandler:()=>bt,frameworkName:()=>As,providerSchemas:()=>Cn,serve:()=>Da,workflow:()=>Os});module.exports=jo($a);var Pt=(l=>(l.TRIGGER="trigger",l.EXECUTE="execute",l.PREVIEW="preview",l))(Pt||{}),Kt=(l=>(l.DISCOVER="discover",l.HEALTH_CHECK="health-check",l.CODE="code",l))(Kt||{});var oi=($=>($.EVERY_SECOND="* * * * * *",$.EVERY_5_SECONDS="*/5 * * * * *",$.EVERY_10_SECONDS="*/10 * * * * *",$.EVERY_30_SECONDS="*/30 * * * * *",$.EVERY_MINUTE="*/1 * * * *",$.EVERY_5_MINUTES="0 */5 * * * *",$.EVERY_10_MINUTES="0 */10 * * * *",$.EVERY_30_MINUTES="0 */30 * * * *",$.EVERY_HOUR="0 0-23/1 * * *",$.EVERY_2_HOURS="0 0-23/2 * * *",$.EVERY_3_HOURS="0 0-23/3 * * *",$.EVERY_4_HOURS="0 0-23/4 * * *",$.EVERY_5_HOURS="0 0-23/5 * * *",$.EVERY_6_HOURS="0 0-23/6 * * *",$.EVERY_7_HOURS="0 0-23/7 * * *",$.EVERY_8_HOURS="0 0-23/8 * * *",$.EVERY_9_HOURS="0 0-23/9 * * *",$.EVERY_10_HOURS="0 0-23/10 * * *",$.EVERY_11_HOURS="0 0-23/11 * * *",$.EVERY_12_HOURS="0 0-23/12 * * *",$.EVERY_DAY_AT_1AM="0 01 * * *",$.EVERY_DAY_AT_2AM="0 02 * * *",$.EVERY_DAY_AT_3AM="0 03 * * *",$.EVERY_DAY_AT_4AM="0 04 * * *",$.EVERY_DAY_AT_5AM="0 05 * * *",$.EVERY_DAY_AT_6AM="0 06 * * *",$.EVERY_DAY_AT_7AM="0 07 * * *",$.EVERY_DAY_AT_8AM="0 08 * * *",$.EVERY_DAY_AT_9AM="0 09 * * *",$.EVERY_DAY_AT_10AM="0 10 * * *",$.EVERY_DAY_AT_11AM="0 11 * * *",$.EVERY_DAY_AT_NOON="0 12 * * *",$.EVERY_DAY_AT_1PM="0 13 * * *",$.EVERY_DAY_AT_2PM="0 14 * * *",$.EVERY_DAY_AT_3PM="0 15 * * *",$.EVERY_DAY_AT_4PM="0 16 * * *",$.EVERY_DAY_AT_5PM="0 17 * * *",$.EVERY_DAY_AT_6PM="0 18 * * *",$.EVERY_DAY_AT_7PM="0 19 * * *",$.EVERY_DAY_AT_8PM="0 20 * * *",$.EVERY_DAY_AT_9PM="0 21 * * *",$.EVERY_DAY_AT_10PM="0 22 * * *",$.EVERY_DAY_AT_11PM="0 23 * * *",$.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",$.EVERY_WEEK="0 0 * * 0",$.EVERY_WEEKDAY="0 0 * * 1-5",$.EVERY_WEEKEND="0 0 * * 6,0",$.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",$.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",$.EVERY_2ND_HOUR="0 */2 * * *",$.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",$.EVERY_2ND_MONTH="0 0 1 */2 *",$.EVERY_QUARTER="0 0 1 */3 *",$.EVERY_6_MONTHS="0 0 1 */6 *",$.EVERY_YEAR="0 0 1 0 *",$.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",$.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",$.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",$.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",$.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",$.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",$.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",$.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",$.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",$.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",$.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",$.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",$.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",$.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",$.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",$.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",$.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",$.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",$.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",$.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",$.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",$.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",$.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",$.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",$.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",$.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",$.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",$.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",$))(oi||{});var We=(ce=>(ce.BRIDGE_ERROR="BridgeError",ce.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",ce.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",ce.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",ce.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",ce.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",ce.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",ce.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",ce.INVALID_ACTION_ERROR="InvalidActionError",ce.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",ce.MISSING_DEPENDENCY_ERROR="MissingDependencyError",ce.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",ce.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",ce.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",ce.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",ce.SIGNATURE_INVALID_ERROR="SignatureInvalidError",ce.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",ce.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",ce.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",ce.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",ce.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",ce.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",ce.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",ce.STEP_NOT_FOUND_ERROR="StepNotFoundError",ce.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",ce.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",ce.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",ce))(We||{});var Ht=(l=>(l.POST="POST",l.GET="GET",l.OPTIONS="OPTIONS",l))(Ht||{});var Yo=f=>{var s,l;if(typeof f!="object"||f===null)return!1;let i=Object.getPrototypeOf(f);return(l=(s=i==null?void 0:i.constructor)==null?void 0:s.name.endsWith("Error"))!=null?l:!1},tt=class extends Error{},zt=class extends tt{constructor(){super(...arguments);this.statusCode=404}},$e=class extends tt{constructor(){super(...arguments);this.statusCode=400}},st=class extends tt{constructor(){super(...arguments);this.statusCode=401}},ot=class extends tt{constructor(i,{cause:s}={}){var l;Yo(s)?(super(`${i}: ${s.message}`),this.data={stack:(l=s.stack)!=null?l:i}):(super(`${i}${s?`: ${JSON.stringify(s,null,2)}`:""}`),this.data={stack:i})}},Xt=class extends tt{constructor(){super(...arguments);this.statusCode=409}};var mt=class extends ot{constructor(s){super("Unknown BridgeError",{cause:s});this.statusCode=500;this.code="BridgeError"}};var Qt=class extends $e{constructor(s,l){super(`Workflow with id: \`${s}\` has a corrupt state. Step with id: \`${l}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:s,stepId:l}}},Nt=class extends $e{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=l}},Zt=class extends $e{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=l}},en=class extends $e{constructor(s,l,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=S}},tn=class extends $e{constructor(s,l,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=S}},nn=class extends $e{constructor(s,l,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=S}},rn=class extends $e{constructor(s,l,S){super(`Workflow with id: \`${s}\` has invalid controls syntax in step with id: \`${l}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=S}},sn=class extends $e{constructor(s,l,S,F){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` and provider with id: \`${S}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=F}},on=class extends $e{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=l}};var ai=f=>Object.values(f).map(i=>`\`${i}\``).join(", "),an=f=>f.replaceAll(/(\w)(\w*)/g,(i,s,l)=>s.toUpperCase()+l.toLowerCase()).replaceAll(/[\s-]+/g,"");var ln=class extends tt{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${ai(Ht)}`}},xt=class extends $e{constructor(s,l){super(`Invalid query string: \`action\`=\`${s}\`. Please use one of ${ai(l)}`);this.code="InvalidActionError"}},cn=class extends $e{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var pn=class extends Error{constructor(i,s,l){super(),this.data={message:l},this.statusCode=i,this.code=s}};var kt=class extends Xt{constructor(i,s){super(`${an(i)} with id: \`${s}\` already exists. Please use a different id.`)}},at=class extends zt{constructor(i,s){super(`${an(i)} with id: \`${s}\` does not exist. Please provide a valid id.`)}},yt=class extends ot{constructor(s,l,S,F){super(`Failed to ${S} ${an(s)} with id: \`${l}\``,{cause:F});this.statusCode=502}};var un=class extends at{constructor(s){super("provider",s);this.code="ProviderNotFoundError"}},dn=class extends yt{constructor(s,l,S){super("provider",s,l,S);this.code="ProviderExecutionFailedError"}};var fn=class extends st{constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");this.code="SignatureMismatchError"}},hn=class extends st{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},mn=class extends st{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},yn=class extends st{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},gn=class extends st{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}};var wn=class extends at{constructor(s){super("step",s);this.code="StepNotFoundError"}},bn=class extends kt{constructor(s){super("step",s);this.code="StepAlreadyExistsError"}},Mt=class extends yt{constructor(s,l,S){super("step",s,l,S);this.code="StepExecutionFailedError"}};var Ct=class extends at{constructor(s){super("workflow",s);this.code="WorkflowNotFoundError"}};var lt=f=>Object.values(We).includes(f==null?void 0:f.code),Tr=f=>!lt(f)&&typeof f.statusCode=="number"&&f.statusCode>=400&&f.statusCode<500;var Or=async(f,i)=>{let s=new TextEncoder,l=s.encode(f),S=s.encode(i),F=await crypto.subtle.importKey("raw",l,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),M=await crypto.subtle.sign("HMAC",F,S);return Array.from(new Uint8Array(M)).map(X=>X.toString(16).padStart(2,"0")).join("")};var Ar=require("cross-fetch"),Er=()=>typeof Response!="undefined"?Response:Ar.Response,vr=async()=>{if(process.env.NOVU_BRIDGE_ORIGIN)return`${process.env.NOVU_BRIDGE_ORIGIN}/api/novu`;if(process.env.NEXT_PUBLIC_VERCEL_ENV==="preview"&&process.env.NEXT_PUBLIC_VERCEL_URL)return`https://${process.env.NEXT_PUBLIC_VERCEL_URL}/api/novu`;try{if(process.env.NODE_ENV==="development"){let i=await(await fetch("http://localhost:2022/.well-known/novu")).json();return`${i.tunnelOrigin}${i.route}`}}catch(f){console.error(f)}return""};function _r(f){return!!f&&typeof f=="object"&&"error"in f&&"message"in f&&"statusCode"in f}var Sn=(f,i)=>{if(!f)throw new cn;return{post:async(s,l)=>{let S=await fetch(`${i}/v1${s}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${f}`},body:JSON.stringify(l)}),F=await S.json();if(S.ok)return F;throw _r(F)?new pn(F.statusCode,F.error,F.message):new mt(F)},delete:async s=>(await fetch(`${i}/v1${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${f}`}})).json()}};var kr=require("liquidjs");function li(f,i){let s={...f};for(let l of Object.keys(i)){let S=i[l];S&&typeof S=="object"&&!Array.isArray(S)?s[l]=li(s[l]||{},S):(Array.isArray(S),s[l]=S)}return s}function Tn(f,i){let s=i.split(".").reduce((l,S)=>{if(l&&typeof l=="object")return l[S]},f);if(s==null)return"";if(typeof s=="string")return s;if(typeof s=="number"||typeof s=="boolean")return String(s);if(typeof s=="object"){let l=JSON.stringify(s);return l==="{}"?"":l}return""}function Rr(f,i=2,s,l=", "){if(!Array.isArray(f)||f.length===0)return"";let S=s?f.map(X=>typeof X!="object"||!X?"":Tn(X,s)):f;if(S.length===1)return S[0];if(S.length===2)return`${S[0]} and ${S[1]}`;if(S.length===3&&i>=3)return`${S[0]}, ${l}${S[1]} and ${S[2]}`;let F=S.slice(0,i),M=S.length-i;return`${F.join(l)} and ${M} ${M===1?"other":"others"}`}var qo=require("liquidjs"),Bo=require("zod"),Pr=et(require("pluralize"),1);var Jo="",Go=2,Ko="other",Ho=", ",zo=" and ",Xo=", and ";function Ir(f,i=Jo,s=Go,l=Ko,S=Ho,F=zo,M=Xo){if(!Array.isArray(f)||f.length===0)return"";let X=i?f.map(Se=>typeof Se!="object"||!Se?"":Tn(Se,i)):f,re=X.length;if(re===1)return X[0];if(re===2)return`${X[0]}${F}${X[1]}`;if(s>=re){let Se=X.slice(0,re-1),ke=X[re-1];return`${Se.join(S)}${M}${ke}`}let Ae=X.slice(0,s),Ne=re-s,Ce=s===1?F:M;return`${Ae.join(S)}${Ce}${Ne} ${(0,Pr.default)(l,Ne)}`}var Nr=et(require("pluralize"),1);function xr(f,i="",s=""){if(f==null)return"";let l=0;return Array.isArray(f)?l=f.length:typeof f=="object"?l=Object.keys(f).length:typeof f=="string"?l=+f:typeof f=="number"?l=f:l=Number(f),Number.isNaN(l)&&(l=0),l<=0?"":s?`${l} ${l===1?i:s}`:`${l} ${(0,Nr.default)(i,l)}`}function Qo(f){return Array.isArray(f)||typeof f=="object"&&f!==null?Mr(f):typeof f=="string"&&f.includes(` `)?f.replace(/\n/g,"\\n"):f==null?"":String(f)}var Mr=(f,i=0)=>Array.isArray(f)||typeof f=="object"&&f!==null?JSON.stringify(f,null,i).replace(/"/g,"'").replace(/\n/g,"\\n"):f==null?"":String(f);function Cr(f){let i=new kr.Liquid({outputEscape:Qo,...f});return i.registerFilter("json",(s,l)=>Mr(s,l)),i.registerFilter("digest",Rr),i.registerFilter("toSentence",Ir),i.registerFilter("pluralize",xr),i}var ct=et(require("chalk"),1),we={info:f=>ct.default.blue(f),warning:f=>ct.default.yellow(f),error:f=>ct.default.red(f),success:f=>ct.default.green(f),underline:f=>ct.default.underline(f),bold:f=>ct.default.bold(f)},Re={SUCCESS:we.success("\u2714"),ERROR:we.error("\u2717"),WARNING:we.warning("\u26A0"),INFO:we.info("\u2139"),ARROW:we.bold("\u2192"),MOCK:we.info("\u25CB"),HYDRATED:we.bold(we.info("\u2192")),STEP:we.info("\u03C3"),ACTION:we.info("\u03B1"),DURATION:we.info("\u0394"),PROVIDER:we.info("\u2699"),OUTPUT:we.info("\u21E2"),INPUT:we.info("\u21E0"),WORKFLOW:we.info("\u03C9"),STATE:we.info("\u03C3"),EXECUTE:we.info("\u03B5"),PREVIEW:we.info("\u03C1")};function On(f){return f||process.env.NOVU_API_URL||"https://api.novu.co"}function An(f){return f||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY||""}var ci=et(require("sanitize-html"),1),Zo={allowedTags:ci.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Lr=f=>{if(!f)return f;let i=/^<!DOCTYPE .*?>/,s=f.match(i),l=(0,ci.default)(f,Zo);return s?s[0]+l:l},En=f=>Object.keys(f).reduce((i,s)=>{let l=f[s];return typeof l=="string"?i[s]=Lr(l):Array.isArray(l)?i[s]=l.map(S=>typeof S=="string"?Lr(S):typeof S=="object"?En(S):S):typeof l=="object"&&l!==null?i[s]=En(l):i[s]=l,i},{});var $r=et(require("ajv"),1),Ur=et(require("ajv-formats"),1);var Dr=f=>typeof structuredClone=="function"?structuredClone(f):JSON.parse(JSON.stringify(f));var vn=class extends ot{constructor(s,l){let S=l.length===1?"it":"them";super(`Tried to use a ${s} in @novu/framework without ${l.join(", ")} installed. Please install ${S} by running \`npm install ${l.join(" ")}\`.`);this.statusCode=500;this.code="MissingDependencyError"}};var _n=async(f,i)=>{let s=new Set;if((await Promise.allSettled(f.map(S=>S.import))).forEach((S,F)=>{let M=f[F];S.status==="fulfilled"&&M.exports.every(re=>S.value[re]!==void 0)||s.add(M.name)}),s.size>0)throw new vn(i,Array.from(s))};var Rn=class{constructor(){this.requiredImports=[];this.ajv=new $r.default({useDefaults:!0,removeAdditional:"failing"}),(0,Ur.default)(this.ajv),this.compiledSchemas=new Map}async canHandle(i){let s=i.type==="object"||!!i.anyOf||!!i.allOf||!!i.oneOf;return s&&await _n(this.requiredImports,"JSON schema"),s}async validate(i,s){let l=this.compiledSchemas.get(s);l||(l=this.ajv.compile(s),this.compiledSchemas.set(s,l));let S=Dr(i);return l(S)?{success:!0,data:S}:{success:!1,errors:l.errors.map(M=>({path:M.instancePath,message:M.message}))}}async transformToJsonSchema(i){return i}};var Pn=class{constructor(){this.requiredImports=[{name:"zod",import:import("zod"),exports:["ZodType"]},{name:"zod-to-json-schema",import:import("zod-to-json-schema"),exports:["zodToJsonSchema"]}]}async canHandle(i){let s=i.safeParseAsync!==void 0;return s&&await _n(this.requiredImports,"Zod schema"),s}async validate(i,s){let l=await s.safeParseAsync(i);return l.success?{success:!0,data:l.data}:{success:!1,errors:l.error.errors.map(S=>({path:`/${S.path.join("/")}`,message:S.message}))}}async transformToJsonSchema(i){let{zodToJsonSchema:s}=await import("zod-to-json-schema");return s(i)}};var In=new Pn,Nn=new Rn,xn=async(f,i)=>{if(await In.canHandle(f))return In.validate(i,f);if(await Nn.canHandle(f))return Nn.validate(i,f);throw new Error("Invalid schema")},xe=async f=>{if(await In.canHandle(f))return In.transformToJsonSchema(f);if(await Nn.canHandle(f))return Nn.transformToJsonSchema(f);throw new Error("Invalid schema")};var kn=(()=>{var f=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,S=(e,t)=>function(){return e&&(t=(0,e[s(e)[0]])(e=0)),t},F=(e,t)=>function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports},M=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},X=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of s(t))!l.call(e,p)&&p!==n&&f(e,p,{get:()=>t[p],enumerable:!(c=i(t,p))||c.enumerable});return e},re=e=>X(f({},"__esModule",{value:!0}),e),Ae={};M(Ae,{JSONSchemaFaker:()=>gr,default:()=>wr,setDependencies:()=>ki});function Ne(e,t){return typeof e=="string"?typeof t!="undefined"?At.register(e,t):At.get(e):At.registerMany(e)}function Ce(e,t){return e=typeof e=="undefined"?He.MIN_INTEGER:e,t=typeof t=="undefined"?He.MAX_INTEGER:t,Math.floor(te("random")()*(t-e+1))+e}function Se(e){return jt.default.prototype.max=te("defaultRandExpMax"),jt.default.prototype.randInt=(n,c)=>n+Math.floor(te("random")()*(1+(c-n))),new jt.default(e).gen()}function ke(e){return e[Math.floor(te("random")()*e.length)]}function Ue(e){let t,n,c=e.length,p=e.slice();for(;c>0;)n=Math.floor(te("random")()*c),c-=1,t=p[c],p[c]=p[n],p[n]=t;return p}function it(e,t){return te("random")()*(t-e)+e}function Je(e,t,n,c,p=!1){return n=typeof n=="undefined"?He.MIN_NUMBER:n,c=typeof c=="undefined"?He.MAX_NUMBER:c,e=typeof e=="undefined"?n:e,t=typeof t=="undefined"?c:t,t<e&&(t+=e),p?it(e,t):Ce(e,t)}function $t(e){switch(e){case"seconds":return Je(0,60)*60;case"minutes":return Je(15,50)*612;case"hours":return Je(12,72)*36123;case"days":return Je(7,30)*86412345;case"weeks":return Je(4,52)*604812345;case"months":return Je(2,13)*2592012345;case"years":return Je(1,20)*31104012345;default:break}}function $n(e){if(e)return $t(e);let t=te("minDateTime"),n=te("maxDateTime");typeof t=="string"&&(t=new Date(t)),typeof n=="string"&&(n=new Date(n));let c=new Date().getTime();return typeof t=="number"&&(t=new Date(c+t)),typeof n=="number"&&(n=new Date(c+n)),new Date(it(t.getTime(),n.getTime()))}function di(e,t,n){if(t=decodeURIComponent(t),n&&n[t])return ce(n[t]);let c=t.replace("#/","/").split("/"),p=e.$ref&&n&&n[e.$ref]||e;for(!p&&!c[0]&&(c[0]=e.$ref.split("#/")[0]),n&&t.includes("#/")&&n[c[0]]&&(p=n[c.shift()]),c[0]||c.shift();p&&c.length>0;){let h=c.shift();if(!p[h])throw new Error(`Prop not found: ${h} (${t})`);p=p[h]}return p}function Ut(e){return typeof e=="string"&&Wi.test(e)}function Ge(e){return["number","boolean"].includes(typeof e)}function Ke(e,...t){return t.filter(n=>typeof e[n]!="undefined").length>0}function fi(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,n,c]=e.split("T")[0].split("-");return n=`0${Math.max(1,Math.min(12,n))}`.slice(-2),c=`0${Math.max(1,Math.min(31,c))}`.slice(-2),`${t}-${n}-${c}`}function Es(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,n]=e.split("T"),[c,p,h]=t.split("-"),[d,O,D]=n.substr(0,8).split(":");return p=`0${Math.max(1,Math.min(12,p))}`.slice(-2),h=`0${Math.max(1,Math.min(31,h))}`.slice(-2),d=`0${Math.max(1,Math.min(23,d))}`.slice(-2),O=`0${Math.max(1,Math.min(59,O))}`.slice(-2),D=`0${Math.max(1,Math.min(59,D))}`.slice(-2),`${c}-${p}-${h}T${d}:${O}:${D}.000Z`}function vs(e,t,n){let c={};switch(e||t.type){case"integer":case"number":if(typeof t.minimum!="undefined"&&(c.minimum=t.minimum),typeof t.maximum!="undefined"&&(c.maximum=t.maximum),t.enum){let h=Math.max(c.minimum||0,0),d=Math.min(c.maximum||1/0,1/0);t.exclusiveMinimum&&h===t.minimum&&(h+=t.multipleOf||1),t.exclusiveMaximum&&d===t.maximum&&(d-=t.multipleOf||1),(h||d!==1/0)&&(t.enum=t.enum.filter(O=>O>=h&&O<=d))}break;case"string":{c.minLength=te("minLength")||0,c.maxLength=te("maxLength")||Number.MAX_SAFE_INTEGER,typeof t.minLength!="undefined"&&(c.minLength=Math.max(c.minLength,t.minLength)),typeof t.maxLength!="undefined"&&(c.maxLength=Math.min(c.maxLength,t.maxLength));break}default:break}let p=n(c);if(p==null)return null;switch(e||t.type){case"number":p=Ut(p)?parseFloat(p):p;break;case"integer":p=Ut(p)?parseInt(p,10):p;break;case"boolean":p=!!p;break;case"string":{if(Ge(p))return p;p=String(p);let h=Math.max(c.minLength||0,0),d=Math.min(c.maxLength||1/0,1/0),O,D=0;for(;p.length<h;)if(O=p,t.pattern?p+=Z.randexp(t.pattern):p+=`${Z.pick([" ","/","_","-","+","=","@","^"])}${p}`,p===O){if(D+=1,D===3)break}else D=0;switch(p.length>d&&(p=p.substr(0,d)),t.format){case"date-time":case"datetime":p=new Date(Es(p)).toISOString().replace(/([0-9])0+Z$/,"$1Z");break;case"full-date":case"date":p=new Date(fi(p)).toISOString().substr(0,10);break;case"time":p=new Date(`1969-01-01 ${p}`).toISOString().substr(11);break;default:break}break}default:break}return p}function dt(e,t){return Object.keys(t).forEach(n=>{typeof t[n]!="object"||t[n]===null?e[n]=t[n]:Array.isArray(t[n])?(e[n]=e[n]||[],t[n].forEach((c,p)=>{e.type==="array"&&t.type==="array"?e[n][p]=dt(e[n][p]||{},c,!0):Array.isArray(e[n])&&e[n].indexOf(c)===-1&&e[n].push(c)})):typeof e[n]!="object"||e[n]===null||Array.isArray(e[n])?e[n]=dt({},t[n]):e[n]=dt(e[n],t[n])}),e}function ce(e,t=new Map){if(!e||typeof e!="object")return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let c=[];return t.set(e,c),c.push(...e.map(p=>ce(p,t))),c}let n={};return t.set(e,n),Object.keys(e).reduce((c,p)=>(c[p]=ce(e[p],t),c),n)}function _s(e){let t=JSON.stringify(e),n=JSON.stringify(e,null,2);return t.length>400?`${n.substr(0,400)}...`:n}function hi(){return Z.pick([!1,!0,null,-1,NaN,Math.PI,1/0,void 0,[],{},Math.random(),Math.random().toString(36).substr(2)])}function Rs(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function Ps(e,t){let n=dt({},t);if(typeof e.minimum!="undefined"&&(n.maximum=e.minimum,n.exclusiveMaximum=!0),typeof e.maximum!="undefined"&&(n.minimum=e.maximum>n.maximum?0:e.maximum,n.exclusiveMinimum=!0),typeof e.minLength!="undefined"&&(n.maxLength=e.minLength),typeof e.maxLength!="undefined"&&(n.minLength=e.maxLength>n.maxLength?0:e.maxLength),e.type)n.type=Z.pick(He.SCALAR_TYPES.filter(c=>(Array.isArray(e.type)?e.type:[e.type]).every(h=>c==="number"||c==="integer"?h!=="number"&&h!=="integer":c!==h)));else if(e.enum){let c;do c=hi();while(e.enum.indexOf(c)!==-1);n.enum=[c]}return e.required&&n.properties&&e.required.forEach(c=>{delete n.properties[c]}),n}function Un(e,t){let n=t.minimum!==void 0,c=t.maximum!==void 0;return(n||c)&&(!n||e>=t.minimum)&&(!c||e<=t.maximum)}function Is(e,t){return!t.every(n=>Un(e,n))}function Ns(e,t){return t.reduce((c,p)=>c+(Un(e,p)?1:0),0)===1}function xs(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function ks(e,t){return Object.keys(e).filter(n=>!t.includes(n)).reduce((n,c)=>(Array.isArray(e[c])?n[c]=e[c].slice():n[c]=e[c]instanceof Object?dt({},e[c]):e[c],n),{})}function mi(e,t){return Array.isArray(e)?e.map(n=>mi(n,t)):(typeof e=="string"&&(e=e.replace(/#\{([\w.-]+)\}/g,(n,c)=>t[c])),e)}function Fn(e){return Object.prototype.toString.call(e)==="[object Object]"&&!Object.keys(e).length}function yi(e,t){t=t.items||t;let n=te("alwaysFakeOptionals"),c=Array.isArray(t.required)&&t.required.includes(e)||n,p=typeof t.thunk=="function"||t.additionalProperties&&typeof t.additionalProperties.thunk=="function";return!c&&!p}function jn(e,t,n=!1){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(c=>jn(c,t,!0)).filter(c=>typeof c!="undefined");if(Object.keys(e).forEach(c=>{if(Fn(e[c]))yi(c,t)&&delete e[c];else{let p=t;t&&t.properties&&t.properties[c]&&(p=t.properties[c]);let h=jn(e[c],p);Fn(h)||(e[c]=h)}typeof e[c]=="undefined"&&delete e[c]}),!(!Object.keys(e).length&&n))return e}function Ms(e){return(t,n,c,p)=>{let h=t,d=[];typeof t=="object"&&(h=Object.keys(t)[0],Array.isArray(t[h])?d=t[h]:d.push(t[h]));let O=h.split("."),D=e();for(;O.length>1;)D=D[O.shift()];return t=typeof D=="object"?D[O[0]]:D,typeof t=="function"&&(t=t.apply(D,d.map(T=>de.template(T,p)))),Object.prototype.toString.call(t)==="[object Object]"&&Object.keys(t).forEach(T=>{if(typeof t[T]=="function")throw new Error(`Cannot resolve value for '${c}: ${h}', given: ${t}`)}),t}}function Cs(e,t){if(typeof e=="undefined")return ht.list();if(typeof e=="string")if(typeof t=="function")ht.register(e,t);else if(t===null||t===!1)ht.unregister(e);else return ht.get(e);else ht.registerMany(e)}function Ls(e,t,n){return Object.keys(e).filter(c=>{let p=Ji.indexOf(t)>-1;return n.indexOf(c)>-1&&!p}).length>0}function Ds(e,t){let n=Object.keys(Et);for(let c=0;c<n.length;c+=1){let p=n[c],h=t[t.length-1];if(Ls(e,h,Et[p]))return p}}function $s(){return te("random")()>.5}function Us(){return null}function Fs(e,t,n,c,p,h){let d=[],O=[];function D(U){let v=JSON.stringify(U.value);return O.indexOf(v)===-1?(O.push(v),d.push(U),!0):!1}t.forEach(D);let T=100;for(;d.length!==t.length&&(D(h(n.items||c,e,p))||(T-=1),!!T););return d}function js(e,t,n,c){let p=[];if(!(e.items||e.additionalItems)){if(de.hasProperties(e,"minItems","maxItems","uniqueItems")&&(e.minItems!==0||e.maxItems!==0))throw new Yt(`missing items for ${de.short(e)}`,t);return p}if(Array.isArray(e.items))return e.items.map((W,ae)=>{let Q=t.concat(["items",ae]);return c(W,Q,n)});let h=e.minItems,d=e.maxItems,O=te("minItems"),D=te("maxItems");O&&(h=typeof h=="undefined"?O:Math.min(O,h)),D&&(d=typeof d=="undefined"?D:Math.min(D,d),d&&d>D&&(d=D),h&&h>D&&(h=d));let T=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),U=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,v=Z.number(h,d,1,5);T!==null&&(v=Math.max(U?Math.round((d||v)*T):Math.abs(Z.number(h,d)*T),h||0));let B=typeof e.additionalItems=="object"?e.additionalItems:{};for(let W=p.length;W<v;W+=1){let ae=t.concat(["items",W]),Q=c(e.items||B,ae,n);p.push(Q)}if(e.contains&&v>0){let W=Z.number(0,v-1);p[W]=c(e.contains,t.concat(["items",W]),n)}return e.uniqueItems?Fs(t.concat(["items"]),p,e,B,n,c):p}function Ys(e){let t=typeof e.minimum=="undefined"||e.minimum===-Number.MAX_VALUE?He.MIN_INTEGER:e.minimum,n=typeof e.maximum=="undefined"||e.maximum===Number.MAX_VALUE?He.MAX_INTEGER:e.maximum,c=e.multipleOf,p=c&&String(c).match(/e-(\d)|\.(\d+)$/);if(p){let h=(Math.random()*Z.number(0,10)+1)*c,d=p[1]||p[2].length,O=parseFloat(h.toFixed(d)),D=Z.number(t,n-1);return String(O).includes(".")?D+O:(D+O).toExponential()}if(c&&(n=Math.floor(n/c)*c,t=Math.ceil(t/c)*c),e.exclusiveMinimum&&t===e.minimum&&(t+=c||1),e.exclusiveMaximum&&n===e.maximum&&(n-=c||1),t>n)return NaN;if(c){let h=Z.number(Math.floor(t/c),Math.floor(n/c))*c;for(;h<t;)h+=c;return h}return Z.number(t,n,void 0,void 0,e.type!=="integer")}function Ws(e){return Math.floor(ti({...e}))}function Vs(e){return Z.shuffle(nr).slice(0,e)}function qs(e,t,n,c){let p={},h=e.properties||{},d=e.patternProperties||{},O=typeof e.required=="boolean"?[]:(e.required||[]).slice(),D=e.additionalProperties!==!1,T=Object.keys(h),U=Object.keys(d),v=T.concat(U).reduce((Y,m)=>(O.indexOf(m)===-1&&Y.push(m),Y),[]),B=O.concat(v),W=D&&e.additionalProperties===!0?Vt:e.additionalProperties;if(!D&&T.length===0&&U.length===0&&de.hasProperties(e,"minProperties","maxProperties","dependencies","required"))return null;if(te("requiredOnly")===!0)return O.forEach(Y=>{h[Y]&&(p[Y]=h[Y])}),c(p,t.concat(["properties"]),n,e);let ae=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),Q=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,ne=te("ignoreProperties")||[],he=te("reuseProperties"),ye=te("fillProperties"),j=e.maxProperties||B.length+(D?Z.number(1,5):0),w=Math.max(e.minProperties||0,O.length),b=Math.max(0,B.length-w);B.length===1&&!O.length&&(w=Math.max(Z.number(ye?1:0,j),w)),ae!==null&&(Q===!0?b=Math.round(w-O.length+ae*(B.length-w)):b=Z.number(w-O.length,ae*(B.length-w)));let R=Z.shuffle(v).slice(0,b),I=v.filter(Y=>R.indexOf(Y)!==-1),C=ae!==null||O.length===j?j:Z.number(0,j),_=O.concat(Z.shuffle(I).slice(0,C)).slice(0,j),N=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(Y=>{let m=e.dependencies[Y];if(_.indexOf(Y)!==-1)if(Array.isArray(m))m.forEach(x=>{_.indexOf(x)===-1&&_.push(x)});else if(Array.isArray(m.oneOf||m.anyOf)){let x=m.oneOf||m.anyOf;k.push({prop:Y,values:x})}else N.push(m)}),N.length))return delete e.dependencies,c({allOf:N.concat(e)},t.concat(["properties"]),n,e);let V=[],J=[];_.forEach(Y=>{if(h[Y]&&["{}","true"].includes(JSON.stringify(h[Y].not)))return;for(let x=0;x<ne.length;x+=1)if(ne[x]instanceof RegExp&&ne[x].test(Y)||typeof ne[x]=="string"&&ne[x]===Y||typeof ne[x]=="function"&&ne[x](h[Y],Y)){V.push(Y);return}W===!1&&O.indexOf(Y)!==-1&&(p[Y]=h[Y]),h[Y]&&(p[Y]=h[Y]);let m;if(U.forEach(x=>{Y.match(new RegExp(x))&&(m=!0,p[Y]?de.merge(p[Y],d[x]):p[Z.randexp(Y)]=d[x])}),!m){let x=d[Y]||W;x&&W!==!1?p[d[Y]?Z.randexp(Y):Y]=h[Y]||x:J.push(Y)}});let ee=Object.keys(p).length+(ye?0:V.length),Oe=Y=>Z.randexp(`_?[_a-f\\d]{1,3}${Y?"\\$?":""}`);function Ee(Y){let m;do{if(!Y.length)break;m=Y.shift()}while(p[m]);return m}let _e=w;if(D&&!O.length&&(_e=Math.max(ae===null||W?Z.number(ye?1:0,j):0,w)),!I.length&&!b&&D&&Q===!0&&ye){let Y=Z.number(0,j);for(let m=0;m<Y;m+=1)p[Wt(1)+Oe(Y[m])]=W||Vt}for(;ye&&!(!(U.length||D)||ee>=_e);){if(D)if(he&&T.length-ee>_e){let Y=0,m;do{if(Y+=1,Y>1e3)break;m=Ee(O)||Z.pick(T)}while(typeof p[m]!="undefined");typeof p[m]=="undefined"&&(p[m]=h[m],ee+=1)}else if(U.length&&!W){let Y=Z.pick(U),m=Z.randexp(Y);p[m]||(p[m]=d[Y],ee+=1)}else{let Y=Ee(O)||Wt(1)+Oe();p[Y]||(p[Y]=W||Vt,ee+=1)}for(let Y=0;ee<w&&Y<U.length;Y+=1){let m=U[Y],x=Z.randexp(m);p[x]||(p[x]=d[m],ee+=1)}}if(O.length===0&&(!D||ae===!1)){let Y=Z.number(w,j);for(;ee<Y;){let m=Ee(T);m&&(p[m]=h[m]),ee+=1}}let Pe=p;if(te("sortProperties")!==null){let Y=Object.keys(h);Pe=Object.keys(p).sort((x,G)=>te("sortProperties")?x.localeCompare(G):Y.indexOf(x)-Y.indexOf(G)).reduce((x,G)=>(x[G]=p[G],x),{})}let Me=c(Pe,t.concat(["properties"]),n,e);return k.forEach(Y=>{for(let m of Y.values)if(de.hasValue(m.properties[Y.prop],Me.value[Y.prop])){Object.keys(m.properties).forEach(x=>{x!==Y.prop&&de.merge(Me.value,c(m.properties,t.concat(["properties"]),n,e).value)});break}}),Me}function gi(){let e=Z.number(1,5);return Wt(e).join(" ")}function Bs(e=0,t=140){let n=Math.max(0,e),c=Z.number(n,t),p=gi();for(;p.length<n;)p+=gi();return p.length>c&&(p=p.substr(0,c)),p}function Js(){return[0,0,0,0].map(()=>Z.number(0,255)).join(".")}function Gs(){return Z.date().toISOString()}function Ks(){return qt().slice(0,10)}function Hs(){return qt().slice(11)}function zs(e){return Z.randexp(je[e]).replace(lr,(t,n)=>Z.randexp(je[n]))}function Xs(e,t){let n=ei(e.format);if(typeof n=="function")return n(e);switch(e.format){case"date-time":case"datetime":return qt();case"date":return sr();case"time":return or();case"ipv4":return rr();case"regex":return".+?";case"email":case"hostname":case"ipv6":case"uri":case"uri-reference":case"iri":case"iri-reference":case"idn-email":case"idn-hostname":case"json-pointer":case"slug":case"uri-template":case"uuid":case"duration":return cr(e.format);default:if(typeof n=="undefined"){if(te("failOnInvalidFormat"))throw new Error(`unknown registry key ${de.short(e.format)}`);return t()}throw new Error(`unsupported format '${e.format}'`)}}function Qs(e){return de.typecast("string",e,n=>e.format?Xs(e,()=>ni(n.minLength,n.maxLength)):e.pattern?Z.randexp(e.pattern):ni(n.minLength,n.maxLength))}function Zs({$comment:e,title:t,description:n}){return Object.entries({comment:e,title:t,description:n}).filter(([,c])=>c).reduce((c,[p,h])=>(c[p]=h,c),{})}function ft(e,t,n,c){if(e=n(e,null,t),e&&(e.oneOf||e.anyOf||e.allOf)&&(e=n(e,null,t)),!e)throw new Error(`Cannot traverse at '${t.join(".")}', given '${JSON.stringify(c)}'`);let p={...Zs(e),schemaPath:t};if(t[t.length-1]!=="properties"){if(te("useExamplesValue")&&Array.isArray(e.examples)){let T=e.examples.concat("default"in e?[e.default]:[]);return{value:de.typecast(null,e,()=>Z.pick(T)),context:p}}if(te("useExamplesValue")&&typeof e.example!="undefined")return{value:de.typecast(null,e,()=>e.example),context:p};if(te("useDefaultValue")&&"default"in e&&(e.default!==""||!te("replaceEmptyByRandomValue")))return{value:e.default,context:p};if("template"in e)return{value:de.template(e.template,c),context:p};if("const"in e)return{value:e.const,context:p}}if(e.not&&typeof e.not=="object"&&(e=de.notValue(e.not,de.omitProps(e,["not"])),e.type&&e.type==="object")){let{value:T,context:U}=ft(e,t.concat(["not"]),n,c);return{value:de.clean(T,e,!1),context:{...p,items:U}}}if(typeof e.thunk=="function"){let{value:T,context:U}=ft(e.thunk(c),t,n);return{value:T,context:{...p,items:U}}}if(e.jsonPath)return{value:e,context:p};let h=e.type;if(Array.isArray(h)?h=Z.pick(h):typeof h=="undefined"&&(h=Gi(e,t)||h,h&&(e.type=h)),typeof e.generate=="function"){let T=de.typecast(null,e,()=>e.generate(c,t)),U=T===null?"null":typeof T;if(U===h||U==="number"&&h==="integer"||Array.isArray(T)&&h==="array")return{value:T,context:p}}if(typeof e.pattern=="string")return{value:de.typecast("string",e,()=>Z.randexp(e.pattern)),context:p};if(Array.isArray(e.enum))return{value:de.typecast(null,e,()=>Z.pick(e.enum)),context:p};if(typeof h=="string")if(vt[h])try{let T=vt[h](e,t,n,ft);return h==="array"?{value:T.map(({value:U})=>U),context:{...p,items:T.map(Array.isArray(e.items)?({context:U})=>U:({context:U})=>({...U,schemaPath:U.schemaPath.slice(0,-1)}))}}:h==="object"?T!==null?{value:T.value,context:{...p,items:T.context}}:{value:{},context:p}:{value:T,context:p}}catch(T){throw typeof T.path=="undefined"?new Yt(T.stack,t):T}else{if(te("failOnInvalidTypes"))throw new Yt(`unknown primitive ${de.short(h)}`,t.concat(["type"]));{let T=te("defaultInvalidTypeProduct");return typeof T=="string"&&vt[T]?{value:vt[T](e,t,n,ft),context:p}:{value:T,context:p}}}let d={},O={...p};Array.isArray(e)&&(d=[]);let D=te("pruneProperties")||[];return Object.keys(e).forEach(T=>{if(!D.includes(T)&&e[T]!==null)if(typeof e[T]=="object"&&T!=="definitions"){let{value:U,context:v}=ft(e[T],t.concat([T]),n,d);d[T]=de.clean(U,e[T],!1),O[T]=v,d[T]===null&&te("omitNulls")&&(delete d[T],delete O[T])}else d[T]=e[T]}),{value:d,context:O}}function eo(e){return Array.isArray(e)?Z.pick(e):e}function to(e,t){if(!Array.isArray(e))return e;let n=t?e.pop():e.shift();return t?e.unshift(n):e.push(n),n}function Yn(e,t,n,c){if(!e||typeof e!="object")return e;if(n||(n={}),t||(t=e),Array.isArray(e))return e.map(p=>Yn(p,t,n,c));if(e.jsonPath){let{JSONPath:p}=Hn(),h=typeof e.jsonPath!="object"?{path:e.jsonPath}:e.jsonPath;h.group=e.group||h.group||c,h.cycle=e.cycle||h.cycle||!1,h.reverse=e.reverse||h.reverse||!1,h.count=e.count||h.count||1;let d=`${h.group}__${h.path}`;return n[d]||(h.count>1?n[d]=p(h.path,t).slice(0,h.count):n[d]=p(h.path,t)),h.cycle||h.reverse?to(n[d],h.reverse):eo(n[d])}return Object.keys(e).forEach(p=>{e[p]=Yn(e[p],t,n,p)}),e}function no(e,t,n,c){if(Object.prototype.toString.call(t)!=="[object Object]")throw new Error(`Invalid input, expecting object but given ${typeof t}`);let p=te("refDepthMin")||0,h=te("refDepthMax")||3;try{let{resolveSchema:d}=hr({refs:e,schema:t,container:n,synchronous:c,refDepthMin:p,refDepthMax:h}),O=dr(de.clone(t),[],d);return te("resolveJsonPath")?{value:Yn(O.value),context:O.context}:O}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function io(e){return e.value}function ro(e,t){return t.reduce((n,c)=>c in n?n[c]:{},e)}function Wn(e,t,n,c=n){let{title:p,description:h,comment:d}=ro(e,t),O=[];te("renderTitle")&&p&&O.push(` ${p}`,""),te("renderDescription")&&h&&O.push(` ${h}`),te("renderComment")&&d&&O.push(` ${d}`),n.commentBefore=O.join(` `),c instanceof mr?c.items.forEach(D=>{Wn(e,[...t,"items",D.key.value],D.key,D.value)}):c instanceof yr&&c.items.forEach((D,T)=>{Wn(e,[...t,"items",T],D)})}function so({value:e,context:t}){let n=_t.createNode(e);Wn(t,[],n);let c=new _t.Document;return c.contents=n,c.toString()}function wi(){Xe.define("autoIncrement",function(t,n){if(!this.offset){let c=n.minimum||1,p=c+He.MAX_NUMBER,h=t.initialOffset||n.initialOffset;this.offset=h||Z.number(c,p)}return t?this.offset++:n}),Xe.define("sequentialDate",function(t,n){if(this.now||(this.now=Z.date()),t){if(n=this.now.toISOString(),t=t===!0?"days":t,["seconds","minutes","hours","days","weeks","months","years"].indexOf(t)===-1)throw new Error(`Unsupported increment by ${de.short(t)}`);this.now.setTime(this.now.getTime()+Z.date(t))}return n})}function bi(e,t){let n={};Array.isArray(e)?e.forEach(p=>{n[p.$id||p.id]=p}):n=e||{};function c(p){if(!p||typeof p!="object")return;if(Array.isArray(p))return p.forEach(c);let h=p.$id||p.id;typeof h=="string"&&!n[h]&&(n[h]=p),Object.keys(p).forEach(d=>{c(p[d])})}return c(e),c(t),n}var Si,Vn,Ti,qn,Oi,Ai,Fe,Ei,Bn,$,Jn,vi,_i,Ri,Pi,Ii,Ot,Ft,Gn,Ni,xi,Kn,Hn,ki,Mi,zn,ue,Xn,Ci,Li,At,te,Qn,Zn,Di,$i,Ui,Fi,ji,Yi,He,jt,Z,Wi,de,Vi,qi,ht,ei,Bi,Yt,Et,Ji,Gi,Ki,Hi,zi,Xi,Qi,Zi,er,ti,tr,nr,Wt,Vt,ir,ni,rr,qt,sr,or,ii,Bt,ar,je,lr,cr,pr,ur,vt,dr,fr,hr,ri,si,Le,oo,ao,lo,co,po,uo,fo,ho,mo,yo,go,wo,mr,yr,_t,Xe,Te,gr,wr,bo=S({"src/shared.js"(){Si=Object.create,Vn=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,qn=Object.getOwnPropertyNames,Oi=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty,Fe=(e,t)=>function(){return t||(0,e[qn(e)[0]])((t={exports:{}}).exports,t),t.exports},Ei=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of qn(t))!Ai.call(e,p)&&p!==n&&Vn(e,p,{get:()=>t[p],enumerable:!(c=Ti(t,p))||c.enumerable});return e},Bn=(e,t,n)=>(n=e!=null?Si(Oi(e)):{},Ei(t||!e||!e.__esModule?Vn(n,"default",{value:e,enumerable:!0}):n,e)),$=Fe({"node_modules/ret/lib/types.js"(e,t){t.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}}}),Jn=Fe({"node_modules/ret/lib/sets.js"(e){var t=$(),n=()=>[{type:t.RANGE,from:48,to:57}],c=()=>[{type:t.CHAR,value:95},{type:t.RANGE,from:97,to:122},{type:t.RANGE,from:65,to:90}].concat(n()),p=()=>[{type:t.CHAR,value:9},{type:t.CHAR,value:10},{type:t.CHAR,value:11},{type:t.CHAR,value:12},{type:t.CHAR,value:13},{type:t.CHAR,value:32},{type:t.CHAR,value:160},{type:t.CHAR,value:5760},{type:t.RANGE,from:8192,to:8202},{type:t.CHAR,value:8232},{type:t.CHAR,value:8233},{type:t.CHAR,value:8239},{type:t.CHAR,value:8287},{type:t.CHAR,value:12288},{type:t.CHAR,value:65279}],h=()=>[{type:t.CHAR,value:10},{type:t.CHAR,value:13},{type:t.CHAR,value:8232},{type:t.CHAR,value:8233}];e.words=()=>({type:t.SET,set:c(),not:!1}),e.notWords=()=>({type:t.SET,set:c(),not:!0}),e.ints=()=>({type:t.SET,set:n(),not:!1}),e.notInts=()=>({type:t.SET,set:n(),not:!0}),e.whitespace=()=>({type:t.SET,set:p(),not:!1}),e.notWhitespace=()=>({type:t.SET,set:p(),not:!0}),e.anyChar=()=>({type:t.SET,set:h(),not:!0})}}),vi=Fe({"node_modules/ret/lib/util.js"(e){var t=$(),n=Jn(),c="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",p={0:0,t:9,n:10,v:11,f:12,r:13};e.strToChars=function(h){var d=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return h=h.replace(d,function(O,D,T,U,v,B,W,ae){if(T)return O;var Q=D?8:U?parseInt(U,16):v?parseInt(v,16):B?parseInt(B,8):W?c.indexOf(W):p[ae],ne=String.fromCharCode(Q);return/[[\]{}^$.|?*+()]/.test(ne)&&(ne="\\"+ne),ne}),h},e.tokenizeClass=(h,d)=>{for(var O=[],D=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,T,U;(T=D.exec(h))!=null;)if(T[1])O.push(n.words());else if(T[2])O.push(n.ints());else if(T[3])O.push(n.whitespace());else if(T[4])O.push(n.notWords());else if(T[5])O.push(n.notInts());else if(T[6])O.push(n.notWhitespace());else if(T[7])O.push({type:t.RANGE,from:(T[8]||T[9]).charCodeAt(0),to:T[10].charCodeAt(0)});else if(U=T[12])O.push({type:t.CHAR,value:U.charCodeAt(0)});else return[O,D.lastIndex];e.error(d,"Unterminated character class")},e.error=(h,d)=>{throw new SyntaxError("Invalid regular expression: /"+h+"/: "+d)}}}),_i=Fe({"node_modules/ret/lib/positions.js"(e){var t=$();e.wordBoundary=()=>({type:t.POSITION,value:"b"}),e.nonWordBoundary=()=>({type:t.POSITION,value:"B"}),e.begin=()=>({type:t.POSITION,value:"^"}),e.end=()=>({type:t.POSITION,value:"$"})}}),Ri=Fe({"node_modules/ret/lib/index.js"(e,t){var n=vi(),c=$(),p=Jn(),h=_i();t.exports=d=>{var O=0,D,T,U={type:c.ROOT,stack:[]},v=U,B=U.stack,W=[],ae=I=>{n.error(d,`Nothing to repeat at column ${I-1}`)},Q=n.strToChars(d);for(D=Q.length;O<D;)switch(T=Q[O++],T){case"\\":switch(T=Q[O++],T){case"b":B.push(h.wordBoundary());break;case"B":B.push(h.nonWordBoundary());break;case"w":B.push(p.words());break;case"W":B.push(p.notWords());break;case"d":B.push(p.ints());break;case"D":B.push(p.notInts());break;case"s":B.push(p.whitespace());break;case"S":B.push(p.notWhitespace());break;default:/\d/.test(T)?B.push({type:c.REFERENCE,value:parseInt(T,10)}):B.push({type:c.CHAR,value:T.charCodeAt(0)})}break;case"^":B.push(h.begin());break;case"$":B.push(h.end());break;case"[":var ne;Q[O]==="^"?(ne=!0,O++):ne=!1;var he=n.tokenizeClass(Q.slice(O),d);O+=he[1],B.push({type:c.SET,set:he[0],not:ne});break;case".":B.push(p.anyChar());break;case"(":var ye={type:c.GROUP,stack:[],remember:!0};T=Q[O],T==="?"&&(T=Q[O+1],O+=2,T==="="?ye.followedBy=!0:T==="!"?ye.notFollowedBy=!0:T!==":"&&n.error(d,`Invalid group, character '${T}' after '?' at column ${O-1}`),ye.remember=!1),B.push(ye),W.push(v),v=ye,B=ye.stack;break;case")":W.length===0&&n.error(d,`Unmatched ) at column ${O-1}`),v=W.pop(),B=v.options?v.options[v.options.length-1]:v.stack;break;case"|":v.options||(v.options=[v.stack],delete v.stack);var j=[];v.options.push(j),B=j;break;case"{":var w=/^(\d+)(,(\d+)?)?\}/.exec(Q.slice(O)),b,R;w!==null?(B.length===0&&ae(O),b=parseInt(w[1],10),R=w[2]?w[3]?parseInt(w[3],10):1/0:b,O+=w[0].length,B.push({type:c.REPETITION,min:b,max:R,value:B.pop()})):B.push({type:c.CHAR,value:123});break;case"?":B.length===0&&ae(O),B.push({type:c.REPETITION,min:0,max:1,value:B.pop()});break;case"+":B.length===0&&ae(O),B.push({type:c.REPETITION,min:1,max:1/0,value:B.pop()});break;case"*":B.length===0&&ae(O),B.push({type:c.REPETITION,min:0,max:1/0,value:B.pop()});break;default:B.push({type:c.CHAR,value:T.charCodeAt(0)})}return W.length!==0&&n.error(d,"Unterminated group"),U},t.exports.types=c}}),Pi=Fe({"node_modules/drange/lib/index.js"(e,t){"use strict";var n=class gt{constructor(h,d){this.low=h,this.high=d,this.length=1+d-h}overlaps(h){return!(this.high<h.low||this.low>h.high)}touches(h){return!(this.high+1<h.low||this.low-1>h.high)}add(h){return new gt(Math.min(this.low,h.low),Math.max(this.high,h.high))}subtract(h){return h.low<=this.low&&h.high>=this.high?[]:h.low>this.low&&h.high<this.high?[new gt(this.low,h.low-1),new gt(h.high+1,this.high)]:h.low<=this.low?[new gt(h.high+1,this.high)]:[new gt(this.low,h.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},c=class Lt{constructor(h,d){this.ranges=[],this.length=0,h!=null&&this.add(h,d)}_update_length(){this.length=this.ranges.reduce((h,d)=>h+d.length,0)}add(h,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.touches(this.ranges[T]);)T++;for(var U=this.ranges.slice(0,T);T<this.ranges.length&&D.touches(this.ranges[T]);)D=D.add(this.ranges[T]),T++;U.push(D),this.ranges=U.concat(this.ranges.slice(T)),this._update_length()};return h instanceof Lt?h.ranges.forEach(O):(d==null&&(d=h),O(new n(h,d))),this}subtract(h,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.overlaps(this.ranges[T]);)T++;for(var U=this.ranges.slice(0,T);T<this.ranges.length&&D.overlaps(this.ranges[T]);)U=U.concat(this.ranges[T].subtract(D)),T++;this.ranges=U.concat(this.ranges.slice(T)),this._update_length()};return h instanceof Lt?h.ranges.forEach(O):(d==null&&(d=h),O(new n(h,d))),this}intersect(h,d){var O=[],D=T=>{for(var U=0;U<this.ranges.length&&!T.overlaps(this.ranges[U]);)U++;for(;U<this.ranges.length&&T.overlaps(this.ranges[U]);){var v=Math.max(this.ranges[U].low,T.low),B=Math.min(this.ranges[U].high,T.high);O.push(new n(v,B)),U++}};return h instanceof Lt?h.ranges.forEach(D):(d==null&&(d=h),D(new n(h,d))),this.ranges=O,this._update_length(),this}index(h){for(var d=0;d<this.ranges.length&&this.ranges[d].length<=h;)h-=this.ranges[d].length,d++;return this.ranges[d].low+h}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new Lt(this)}numbers(){return this.ranges.reduce((h,d)=>{for(var O=d.low;O<=d.high;)h.push(O),O++;return h},[])}subranges(){return this.ranges.map(h=>({low:h.low,high:h.high,length:1+h.high-h.low}))}};t.exports=c}}),Ii=Fe({"node_modules/randexp/lib/randexp.js"(e,t){var n=Ri(),c=Pi(),p=n.types;t.exports=class Dt{constructor(d,O){if(this._setDefaults(d),d instanceof RegExp)this.ignoreCase=d.ignoreCase,this.multiline=d.multiline,d=d.source;else if(typeof d=="string")this.ignoreCase=O&&O.indexOf("i")!==-1,this.multiline=O&&O.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=n(d)}_setDefaults(d){this.max=d.max!=null?d.max:Dt.prototype.max!=null?Dt.prototype.max:100,this.defaultRange=d.defaultRange?d.defaultRange:this.defaultRange.clone(),d.randInt&&(this.randInt=d.randInt)}gen(){return this._gen(this.tokens,[])}_gen(d,O){var D,T,U,v,B;switch(d.type){case p.ROOT:case p.GROUP:if(d.followedBy||d.notFollowedBy)return"";for(d.remember&&d.groupNumber===void 0&&(d.groupNumber=O.push(null)-1),D=d.options?this._randSelect(d.options):d.stack,T="",v=0,B=D.length;v<B;v++)T+=this._gen(D[v],O);return d.remember&&(O[d.groupNumber]=T),T;case p.POSITION:return"";case p.SET:var W=this._expand(d);return W.length?String.fromCharCode(this._randSelect(W)):"";case p.REPETITION:for(U=this.randInt(d.min,d.max===1/0?d.min+this.max:d.max),T="",v=0;v<U;v++)T+=this._gen(d.value,O);return T;case p.REFERENCE:return O[d.value-1]||"";case p.CHAR:var ae=this.ignoreCase&&this._randBool()?this._toOtherCase(d.value):d.value;return String.fromCharCode(ae)}}_toOtherCase(d){return d+(97<=d&&d<=122?-32:65<=d&&d<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(d){return d instanceof c?d.index(this.randInt(0,d.length-1)):d[this.randInt(0,d.length-1)]}_expand(d){if(d.type===n.types.CHAR)return new c(d.value);if(d.type===n.types.RANGE)return new c(d.from,d.to);{let O=new c;for(let D=0;D<d.set.length;D++){let T=this._expand(d.set[D]);if(O.add(T),this.ignoreCase)for(let U=0;U<T.length;U++){let v=T.index(U),B=this._toOtherCase(v);v!==B&&O.add(B)}}return d.not?this.defaultRange.clone().subtract(O):this.defaultRange.clone().intersect(O)}}randInt(d,O){return d+Math.floor(Math.random()*(1+O-d))}get defaultRange(){return this._range=this._range||new c(32,126)}set defaultRange(d){this._range=d}static randexp(d,O){var D;return typeof d=="string"&&(d=new RegExp(d,O)),d._randexp===void 0?(D=new Dt(d,O),d._randexp=D):(D=d._randexp,D._setDefaults(d)),D.gen()}static sugar(){RegExp.prototype.gen=function(){return Dt.randexp(this)}}}}}),Ot=Fe({"node_modules/yaml/dist/PlainValue-ec8e588e.js"(e){"use strict";var t={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},n={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},c="tag:yaml.org,2002:",p={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function h(j){let w=[0],b=j.indexOf(` `);for(;b!==-1;)b+=1,w.push(b),b=j.indexOf(` `,b);return w}function d(j){let w,b;return typeof j=="string"