@novu/framework
Version:
The Code-First Notifications Workflow SDK.
5 lines • 220 kB
JavaScript
"use strict";var Mo=Object.create;var Kt=Object.defineProperty;var Co=Object.getOwnPropertyDescriptor;var Lo=Object.getOwnPropertyNames;var Do=Object.getPrototypeOf,$o=Object.prototype.hasOwnProperty;var Uo=(f,i)=>{for(var s in i)Kt(f,s,{get:i[s],enumerable:!0})},Sr=(f,i,s,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let S of Lo(i))!$o.call(f,S)&&S!==s&&Kt(f,S,{get:()=>i[S],enumerable:!(l=Co(i,S))||l.enumerable});return f};var tt=(f,i,s)=>(s=f!=null?Mo(Do(f)):{},Sr(i||!f||!f.__esModule?Kt(s,"default",{value:f,enumerable:!0}):s,f)),Fo=f=>Sr(Kt({},"__esModule",{value:!0}),f);var $a={};Uo($a,{Client:()=>bt,CronExpression:()=>ai,NovuRequestHandler:()=>St,frameworkName:()=>Os,providerSchemas:()=>Ln,serve:()=>Da,workflow:()=>Ts});module.exports=Fo($a);var Je=require("h3");var It=(l=>(l.TRIGGER="trigger",l.EXECUTE="execute",l.PREVIEW="preview",l))(It||{}),Ht=(l=>(l.DISCOVER="discover",l.HEALTH_CHECK="health-check",l.CODE="code",l))(Ht||{});var ai=($=>($.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",$))(ai||{});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 zt=(l=>(l.POST="POST",l.GET="GET",l.OPTIONS="OPTIONS",l))(zt||{});var jo=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},nt=class extends Error{},Xt=class extends nt{constructor(){super(...arguments);this.statusCode=404}},$e=class extends nt{constructor(){super(...arguments);this.statusCode=400}},ot=class extends nt{constructor(){super(...arguments);this.statusCode=401}},at=class extends nt{constructor(i,{cause:s}={}){var l;jo(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})}},Qt=class extends nt{constructor(){super(...arguments);this.statusCode=409}};var yt=class extends at{constructor(s){super("Unknown BridgeError",{cause:s});this.statusCode=500;this.code="BridgeError"}};var Zt=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}}},xt=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}},en=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}},tn=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}},nn=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}},rn=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}},sn=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}},on=class extends $e{constructor(s,l,S,Y){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=Y}},an=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 li=f=>Object.values(f).map(i=>`\`${i}\``).join(", "),ln=f=>f.replaceAll(/(\w)(\w*)/g,(i,s,l)=>s.toUpperCase()+l.toLowerCase()).replaceAll(/[\s-]+/g,"");var cn=class extends nt{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${li(zt)}`}},kt=class extends $e{constructor(s,l){super(`Invalid query string: \`action\`=\`${s}\`. Please use one of ${li(l)}`);this.code="InvalidActionError"}},pn=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 un=class extends Error{constructor(i,s,l){super(),this.data={message:l},this.statusCode=i,this.code=s}};var Mt=class extends Qt{constructor(i,s){super(`${ln(i)} with id: \`${s}\` already exists. Please use a different id.`)}},lt=class extends Xt{constructor(i,s){super(`${ln(i)} with id: \`${s}\` does not exist. Please provide a valid id.`)}},gt=class extends at{constructor(s,l,S,Y){super(`Failed to ${S} ${ln(s)} with id: \`${l}\``,{cause:Y});this.statusCode=502}};var dn=class extends lt{constructor(s){super("provider",s);this.code="ProviderNotFoundError"}},fn=class extends gt{constructor(s,l,S){super("provider",s,l,S);this.code="ProviderExecutionFailedError"}};var hn=class extends ot{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"}},mn=class extends ot{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},yn=class extends ot{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},gn=class extends ot{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},wn=class extends ot{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}};var bn=class extends lt{constructor(s){super("step",s);this.code="StepNotFoundError"}},Sn=class extends Mt{constructor(s){super("step",s);this.code="StepAlreadyExistsError"}},Ct=class extends gt{constructor(s,l,S){super("step",s,l,S);this.code="StepExecutionFailedError"}};var Lt=class extends lt{constructor(s){super("workflow",s);this.code="WorkflowNotFoundError"}};var ct=f=>Object.values(We).includes(f==null?void 0:f.code),Or=f=>!ct(f)&&typeof f.statusCode=="number"&&f.statusCode>=400&&f.statusCode<500;var Ar=async(f,i)=>{let s=new TextEncoder,l=s.encode(f),S=s.encode(i),Y=await crypto.subtle.importKey("raw",l,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),L=await crypto.subtle.sign("HMAC",Y,S);return Array.from(new Uint8Array(L)).map(X=>X.toString(16).padStart(2,"0")).join("")};var Vo=require("cross-fetch");var Er=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 vr(f){return!!f&&typeof f=="object"&&"error"in f&&"message"in f&&"statusCode"in f}var Tn=(f,i)=>{if(!f)throw new pn;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)}),Y=await S.json();if(S.ok)return Y;throw vr(Y)?new un(Y.statusCode,Y.error,Y.message):new yt(Y)},delete:async s=>(await fetch(`${i}/v1${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${f}`}})).json()}};var xr=require("liquidjs");function ci(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]=ci(s[l]||{},S):(Array.isArray(S),s[l]=S)}return s}function On(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 _r(f,i=2,s,l=", "){if(!Array.isArray(f)||f.length===0)return"";let S=s?f.map(X=>typeof X!="object"||!X?"":On(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 Y=S.slice(0,i),L=S.length-i;return`${Y.join(l)} and ${L} ${L===1?"other":"others"}`}var qo=require("liquidjs"),Bo=require("zod"),Rr=tt(require("pluralize"),1);var Jo="",Go=2,Ko="other",Ho=", ",zo=" and ",Xo=", and ";function Pr(f,i=Jo,s=Go,l=Ko,S=Ho,Y=zo,L=Xo){if(!Array.isArray(f)||f.length===0)return"";let X=i?f.map(Se=>typeof Se!="object"||!Se?"":On(Se,i)):f,re=X.length;if(re===1)return X[0];if(re===2)return`${X[0]}${Y}${X[1]}`;if(s>=re){let Se=X.slice(0,re-1),ke=X[re-1];return`${Se.join(S)}${L}${ke}`}let Ae=X.slice(0,s),Ne=re-s,Ce=s===1?Y:L;return`${Ae.join(S)}${Ce}${Ne} ${(0,Rr.default)(l,Ne)}`}var Ir=tt(require("pluralize"),1);function Nr(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,Ir.default)(i,l)}`}function Qo(f){return Array.isArray(f)||typeof f=="object"&&f!==null?kr(f):typeof f=="string"&&f.includes(`
`)?f.replace(/\n/g,"\\n"):f==null?"":String(f)}var kr=(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 Mr(f){let i=new xr.Liquid({outputEscape:Qo,...f});return i.registerFilter("json",(s,l)=>kr(s,l)),i.registerFilter("digest",_r),i.registerFilter("toSentence",Pr),i.registerFilter("pluralize",Nr),i}var pt=tt(require("chalk"),1),we={info:f=>pt.default.blue(f),warning:f=>pt.default.yellow(f),error:f=>pt.default.red(f),success:f=>pt.default.green(f),underline:f=>pt.default.underline(f),bold:f=>pt.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 An(f){return f||process.env.NOVU_API_URL||"https://api.novu.co"}function En(f){return f||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY||""}var pi=tt(require("sanitize-html"),1),Zo={allowedTags:pi.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Cr=f=>{if(!f)return f;let i=/^<!DOCTYPE .*?>/,s=f.match(i),l=(0,pi.default)(f,Zo);return s?s[0]+l:l},vn=f=>Object.keys(f).reduce((i,s)=>{let l=f[s];return typeof l=="string"?i[s]=Cr(l):Array.isArray(l)?i[s]=l.map(S=>typeof S=="string"?Cr(S):typeof S=="object"?vn(S):S):typeof l=="object"&&l!==null?i[s]=vn(l):i[s]=l,i},{});var Dr=tt(require("ajv"),1),$r=tt(require("ajv-formats"),1);var Lr=f=>typeof structuredClone=="function"?structuredClone(f):JSON.parse(JSON.stringify(f));var _n=class extends at{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 Rn=async(f,i)=>{let s=new Set;if((await Promise.allSettled(f.map(S=>S.import))).forEach((S,Y)=>{let L=f[Y];S.status==="fulfilled"&&L.exports.every(re=>S.value[re]!==void 0)||s.add(L.name)}),s.size>0)throw new _n(i,Array.from(s))};var Pn=class{constructor(){this.requiredImports=[];this.ajv=new Dr.default({useDefaults:!0,removeAdditional:"failing"}),(0,$r.default)(this.ajv),this.compiledSchemas=new Map}async canHandle(i){let s=i.type==="object"||!!i.anyOf||!!i.allOf||!!i.oneOf;return s&&await Rn(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=Lr(i);return l(S)?{success:!0,data:S}:{success:!1,errors:l.errors.map(L=>({path:L.instancePath,message:L.message}))}}async transformToJsonSchema(i){return i}};var In=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 Rn(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 Nn=new In,xn=new Pn,kn=async(f,i)=>{if(await Nn.canHandle(f))return Nn.validate(i,f);if(await xn.canHandle(f))return xn.validate(i,f);throw new Error("Invalid schema")},xe=async f=>{if(await Nn.canHandle(f))return Nn.transformToJsonSchema(f);if(await xn.canHandle(f))return xn.transformToJsonSchema(f);throw new Error("Invalid schema")};var Mn=(()=>{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},Y=(e,t)=>function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports},L=(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={};L(Ae,{JSONSchemaFaker:()=>wr,default:()=>br,setDependencies:()=>Mi});function Ne(e,t){return typeof e=="string"?typeof t!="undefined"?Et.register(e,t):Et.get(e):Et.registerMany(e)}function Ce(e,t){return e=typeof e=="undefined"?ze.MIN_INTEGER:e,t=typeof t=="undefined"?ze.MAX_INTEGER:t,Math.floor(te("random")()*(t-e+1))+e}function Se(e){return Yt.default.prototype.max=te("defaultRandExpMax"),Yt.default.prototype.randInt=(n,c)=>n+Math.floor(te("random")()*(1+(c-n))),new Yt.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 rt(e,t){return te("random")()*(t-e)+e}function Ge(e,t,n,c,p=!1){return n=typeof n=="undefined"?ze.MIN_NUMBER:n,c=typeof c=="undefined"?ze.MAX_NUMBER:c,e=typeof e=="undefined"?n:e,t=typeof t=="undefined"?c:t,t<e&&(t+=e),p?rt(e,t):Ce(e,t)}function Ut(e){switch(e){case"seconds":return Ge(0,60)*60;case"minutes":return Ge(15,50)*612;case"hours":return Ge(12,72)*36123;case"days":return Ge(7,30)*86412345;case"weeks":return Ge(4,52)*604812345;case"months":return Ge(2,13)*2592012345;case"years":return Ge(1,20)*31104012345;default:break}}function Un(e){if(e)return Ut(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(rt(t.getTime(),n.getTime()))}function fi(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 Ft(e){return typeof e=="string"&&Vi.test(e)}function Ke(e){return["number","boolean"].includes(typeof e)}function He(e,...t){return t.filter(n=>typeof e[n]!="undefined").length>0}function hi(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 As(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 Es(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=Ft(p)?parseFloat(p):p;break;case"integer":p=Ft(p)?parseInt(p,10):p;break;case"boolean":p=!!p;break;case"string":{if(Ke(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(As(p)).toISOString().replace(/([0-9])0+Z$/,"$1Z");break;case"full-date":case"date":p=new Date(hi(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 ft(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]=ft(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]=ft({},t[n]):e[n]=ft(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 vs(e){let t=JSON.stringify(e),n=JSON.stringify(e,null,2);return t.length>400?`${n.substr(0,400)}...`:n}function mi(){return Z.pick([!1,!0,null,-1,NaN,Math.PI,1/0,void 0,[],{},Math.random(),Math.random().toString(36).substr(2)])}function _s(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function Rs(e,t){let n=ft({},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(ze.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=mi();while(e.enum.indexOf(c)!==-1);n.enum=[c]}return e.required&&n.properties&&e.required.forEach(c=>{delete n.properties[c]}),n}function Fn(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 Ps(e,t){return!t.every(n=>Fn(e,n))}function Is(e,t){return t.reduce((c,p)=>c+(Fn(e,p)?1:0),0)===1}function Ns(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function xs(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?ft({},e[c]):e[c],n),{})}function yi(e,t){return Array.isArray(e)?e.map(n=>yi(n,t)):(typeof e=="string"&&(e=e.replace(/#\{([\w.-]+)\}/g,(n,c)=>t[c])),e)}function jn(e){return Object.prototype.toString.call(e)==="[object Object]"&&!Object.keys(e).length}function gi(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 Yn(e,t,n=!1){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(c=>Yn(c,t,!0)).filter(c=>typeof c!="undefined");if(Object.keys(e).forEach(c=>{if(jn(e[c]))gi(c,t)&&delete e[c];else{let p=t;t&&t.properties&&t.properties[c]&&(p=t.properties[c]);let h=Yn(e[c],p);jn(h)||(e[c]=h)}typeof e[c]=="undefined"&&delete e[c]}),!(!Object.keys(e).length&&n))return e}function ks(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 Ms(e,t){if(typeof e=="undefined")return mt.list();if(typeof e=="string")if(typeof t=="function")mt.register(e,t);else if(t===null||t===!1)mt.unregister(e);else return mt.get(e);else mt.registerMany(e)}function Cs(e,t,n){return Object.keys(e).filter(c=>{let p=Gi.indexOf(t)>-1;return n.indexOf(c)>-1&&!p}).length>0}function Ls(e,t){let n=Object.keys(vt);for(let c=0;c<n.length;c+=1){let p=n[c],h=t[t.length-1];if(Cs(e,h,vt[p]))return p}}function Ds(){return te("random")()>.5}function $s(){return null}function Us(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 Fs(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 Wt(`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?Us(t.concat(["items"]),p,e,B,n,c):p}function js(e){let t=typeof e.minimum=="undefined"||e.minimum===-Number.MAX_VALUE?ze.MIN_INTEGER:e.minimum,n=typeof e.maximum=="undefined"||e.maximum===Number.MAX_VALUE?ze.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 Ys(e){return Math.floor(ni({...e}))}function Ws(e){return Z.shuffle(ir).slice(0,e)}function Vs(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((j,m)=>(O.indexOf(m)===-1&&j.push(m),j),[]),B=O.concat(v),W=D&&e.additionalProperties===!0?qt: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(j=>{h[j]&&(p[j]=h[j])}),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"),F=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,F),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(j=>R.indexOf(j)!==-1),M=ae!==null||O.length===F?F:Z.number(0,F),_=O.concat(Z.shuffle(I).slice(0,M)).slice(0,F),N=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(j=>{let m=e.dependencies[j];if(_.indexOf(j)!==-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:j,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(j=>{if(h[j]&&["{}","true"].includes(JSON.stringify(h[j].not)))return;for(let x=0;x<ne.length;x+=1)if(ne[x]instanceof RegExp&&ne[x].test(j)||typeof ne[x]=="string"&&ne[x]===j||typeof ne[x]=="function"&&ne[x](h[j],j)){V.push(j);return}W===!1&&O.indexOf(j)!==-1&&(p[j]=h[j]),h[j]&&(p[j]=h[j]);let m;if(U.forEach(x=>{j.match(new RegExp(x))&&(m=!0,p[j]?de.merge(p[j],d[x]):p[Z.randexp(j)]=d[x])}),!m){let x=d[j]||W;x&&W!==!1?p[d[j]?Z.randexp(j):j]=h[j]||x:J.push(j)}});let ee=Object.keys(p).length+(ye?0:V.length),Oe=j=>Z.randexp(`_?[_a-f\\d]{1,3}${j?"\\$?":""}`);function Ee(j){let m;do{if(!j.length)break;m=j.shift()}while(p[m]);return m}let _e=w;if(D&&!O.length&&(_e=Math.max(ae===null||W?Z.number(ye?1:0,F):0,w)),!I.length&&!b&&D&&Q===!0&&ye){let j=Z.number(0,F);for(let m=0;m<j;m+=1)p[Vt(1)+Oe(j[m])]=W||qt}for(;ye&&!(!(U.length||D)||ee>=_e);){if(D)if(he&&T.length-ee>_e){let j=0,m;do{if(j+=1,j>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 j=Z.pick(U),m=Z.randexp(j);p[m]||(p[m]=d[j],ee+=1)}else{let j=Ee(O)||Vt(1)+Oe();p[j]||(p[j]=W||qt,ee+=1)}for(let j=0;ee<w&&j<U.length;j+=1){let m=U[j],x=Z.randexp(m);p[x]||(p[x]=d[m],ee+=1)}}if(O.length===0&&(!D||ae===!1)){let j=Z.number(w,F);for(;ee<j;){let m=Ee(T);m&&(p[m]=h[m]),ee+=1}}let Pe=p;if(te("sortProperties")!==null){let j=Object.keys(h);Pe=Object.keys(p).sort((x,G)=>te("sortProperties")?x.localeCompare(G):j.indexOf(x)-j.indexOf(G)).reduce((x,G)=>(x[G]=p[G],x),{})}let Me=c(Pe,t.concat(["properties"]),n,e);return k.forEach(j=>{for(let m of j.values)if(de.hasValue(m.properties[j.prop],Me.value[j.prop])){Object.keys(m.properties).forEach(x=>{x!==j.prop&&de.merge(Me.value,c(m.properties,t.concat(["properties"]),n,e).value)});break}}),Me}function wi(){let e=Z.number(1,5);return Vt(e).join(" ")}function qs(e=0,t=140){let n=Math.max(0,e),c=Z.number(n,t),p=wi();for(;p.length<n;)p+=wi();return p.length>c&&(p=p.substr(0,c)),p}function Bs(){return[0,0,0,0].map(()=>Z.number(0,255)).join(".")}function Js(){return Z.date().toISOString()}function Gs(){return Bt().slice(0,10)}function Ks(){return Bt().slice(11)}function Hs(e){return Z.randexp(je[e]).replace(cr,(t,n)=>Z.randexp(je[n]))}function zs(e,t){let n=ti(e.format);if(typeof n=="function")return n(e);switch(e.format){case"date-time":case"datetime":return Bt();case"date":return or();case"time":return ar();case"ipv4":return sr();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 pr(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 Xs(e){return de.typecast("string",e,n=>e.format?zs(e,()=>ii(n.minLength,n.maxLength)):e.pattern?Z.randexp(e.pattern):ii(n.minLength,n.maxLength))}function Qs({$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 ht(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={...Qs(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}=ht(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}=ht(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=Ki(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(_t[h])try{let T=_t[h](e,t,n,ht);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 Wt(T.stack,t):T}else{if(te("failOnInvalidTypes"))throw new Wt(`unknown primitive ${de.short(h)}`,t.concat(["type"]));{let T=te("defaultInvalidTypeProduct");return typeof T=="string"&&_t[T]?{value:_t[T](e,t,n,ht),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}=ht(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 Zs(e){return Array.isArray(e)?Z.pick(e):e}function eo(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 Wn(e,t,n,c){if(!e||typeof e!="object")return e;if(n||(n={}),t||(t=e),Array.isArray(e))return e.map(p=>Wn(p,t,n,c));if(e.jsonPath){let{JSONPath:p}=zn(),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?eo(n[d],h.reverse):Zs(n[d])}return Object.keys(e).forEach(p=>{e[p]=Wn(e[p],t,n,p)}),e}function to(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}=mr({refs:e,schema:t,container:n,synchronous:c,refDepthMin:p,refDepthMax:h}),O=fr(de.clone(t),[],d);return te("resolveJsonPath")?{value:Wn(O.value),context:O.context}:O}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function no(e){return e.value}function io(e,t){return t.reduce((n,c)=>c in n?n[c]:{},e)}function Vn(e,t,n,c=n){let{title:p,description:h,comment:d}=io(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 yr?c.items.forEach(D=>{Vn(e,[...t,"items",D.key.value],D.key,D.value)}):c instanceof gr&&c.items.forEach((D,T)=>{Vn(e,[...t,"items",T],D)})}function ro({value:e,context:t}){let n=Rt.createNode(e);Vn(t,[],n);let c=new Rt.Document;return c.contents=n,c.toString()}function bi(){Qe.define("autoIncrement",function(t,n){if(!this.offset){let c=n.minimum||1,p=c+ze.MAX_NUMBER,h=t.initialOffset||n.initialOffset;this.offset=h||Z.number(c,p)}return t?this.offset++:n}),Qe.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 Si(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 Ti,qn,Oi,Bn,Ai,Ei,Fe,vi,Jn,$,Gn,_i,Ri,Pi,Ii,Ni,At,jt,Kn,xi,ki,Hn,zn,Mi,Ci,Xn,ue,Qn,Li,Di,Et,te,Zn,ei,$i,Ui,Fi,ji,Yi,Wi,ze,Yt,Z,Vi,de,qi,Bi,mt,ti,Ji,Wt,vt,Gi,Ki,Hi,zi,Xi,Qi,Zi,er,tr,ni,nr,ir,Vt,qt,rr,ii,sr,Bt,or,ar,ri,Jt,lr,je,cr,pr,ur,dr,_t,fr,hr,mr,si,oi,Le,so,oo,ao,lo,co,po,uo,fo,ho,mo,yo,go,yr,gr,Rt,Qe,Te,wr,br,wo=S({"src/shared.js"(){Ti=Object.create,qn=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertyNames,Ai=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty,Fe=(e,t)=>function(){return t||(0,e[Bn(e)[0]])((t={exports:{}}).exports,t),t.exports},vi=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Bn(t))!Ei.call(e,p)&&p!==n&&qn(e,p,{get:()=>t[p],enumerable:!(c=Oi(t,p))||c.enumerable});return e},Jn=(e,t,n)=>(n=e!=null?Ti(Ai(e)):{},vi(t||!e||!e.__esModule?qn(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}}}),Gn=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})}}),_i=Fe({"node_modules/ret/lib/util.js"(e){var t=$(),n=Gn(),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)}}}),Ri=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:"$"})}}),Pi=Fe({"node_modules/ret/lib/index.js"(e,t){var n=_i(),c=$(),p=Gn(),h=Ri();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 F=[];v.options.push(F),B=F;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}}),Ii=Fe({"node_modules/drange/lib/index.js"(e,t){"use strict";var n=class wt{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 wt(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 wt(this.low,h.low-1),new wt(h.high+1,this.high)]:h.low<=this.low?[new wt(h.high+1,this.high)]:[new wt(this.low,h.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},c=class Dt{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 Dt?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 Dt?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 Dt?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 Dt(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}}),Ni=Fe({"node_modules/randexp/lib/randexp.js"(e,t){var n=Pi(),c=Ii(),p=n.types;t.exports=class $t{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:$t.prototype.max!=null?$t.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 $t(d,O),d._randexp=D):(D=d._randexp,D._setDefaults(d)),D.gen()}static sugar(){RegExp.prototype.gen=function(){return $t.randexp(this)}}}}}),At=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(F){let w=[0],b=F.indexOf(`
`);for(;b!==-1;)b+=1,w.push(b),b=F.indexOf(`
`,b);return w}function d(F){let w,b;return typeof F=="string"?(w=h(F),b=F):(Array.isArray(F)&