UNPKG

@novu/framework

Version:

The Code-First Notifications Workflow SDK.

6 lines 220 kB
"use strict";var Io=Object.create;var Gt=Object.defineProperty;var No=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,Mo=Object.prototype.hasOwnProperty;var Co=(g,r)=>{for(var s in r)Gt(g,s,{get:r[s],enumerable:!0})},br=(g,r,s,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let S of xo(r))!Mo.call(g,S)&&S!==s&&Gt(g,S,{get:()=>r[S],enumerable:!(c=No(r,S))||c.enumerable});return g};var at=(g,r,s)=>(s=g!=null?Io(ko(g)):{},br(r||!g||!g.__esModule?Gt(s,"default",{value:g,enumerable:!0}):s,g)),Lo=g=>br(Gt({},"__esModule",{value:!0}),g);var Ea={};Co(Ea,{Client:()=>wt,CronExpression:()=>si,NovuRequestHandler:()=>bt,frameworkName:()=>ws,serve:()=>va,workflow:()=>gs});module.exports=Lo(Ea);var jr=require("liquidjs");function Do(g,r){let s=r.split(".").reduce((c,S)=>{if(c&&typeof c=="object")return c[S]},g);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 c=JSON.stringify(s);return c==="{}"?"":c}return""}function Sr(g,r=2,s,c=", "){if(!Array.isArray(g)||g.length===0)return"";let S=s?g.map(Q=>typeof Q!="object"||!Q?"":Do(Q,s)):g;if(S.length===1)return S[0];if(S.length===2)return`${S[0]} and ${S[1]}`;if(S.length===3&&r>=3)return`${S[0]}, ${c}${S[1]} and ${S[2]}`;let U=S.slice(0,r),L=S.length-r;return`${U.join(c)} and ${L} ${L===1?"other":"others"}`}var Pt=(c=>(c.TRIGGER="trigger",c.EXECUTE="execute",c.PREVIEW="preview",c))(Pt||{}),Ht=(c=>(c.DISCOVER="discover",c.HEALTH_CHECK="health-check",c.CODE="code",c))(Ht||{});var si=($=>($.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",$))(si||{});var Ve=(pe=>(pe.BRIDGE_ERROR="BridgeError",pe.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",pe.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",pe.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",pe.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",pe.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",pe.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",pe.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",pe.INVALID_ACTION_ERROR="InvalidActionError",pe.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",pe.MISSING_DEPENDENCY_ERROR="MissingDependencyError",pe.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",pe.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",pe.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",pe.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",pe.SIGNATURE_INVALID_ERROR="SignatureInvalidError",pe.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",pe.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",pe.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",pe.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",pe.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",pe.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",pe.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",pe.STEP_NOT_FOUND_ERROR="StepNotFoundError",pe.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",pe.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",pe.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",pe))(Ve||{});var Kt=(c=>(c.POST="POST",c.GET="GET",c.OPTIONS="OPTIONS",c))(Kt||{});var zt=(U=>(U.EMAIL="email",U.SMS="sms",U.PUSH="push",U.CHAT="chat",U.IN_APP="in_app",U))(zt||{});var $o=g=>{var s,c;if(typeof g!="object"||g===null)return!1;let r=Object.getPrototypeOf(g);return(c=(s=r==null?void 0:r.constructor)==null?void 0:s.name.endsWith("Error"))!=null?c:!1},tt=class extends Error{},Xt=class extends tt{constructor(){super(...arguments);this.statusCode=404}},Fe=class extends tt{constructor(){super(...arguments);this.statusCode=400}},rt=class extends tt{constructor(){super(...arguments);this.statusCode=401}},st=class extends tt{constructor(r,{cause:s}={}){var c;$o(s)?(super(`${r}: ${s.message}`),this.data={stack:(c=s.stack)!=null?c:r}):(super(`${r}${s?`: ${JSON.stringify(s,null,2)}`:""}`),this.data={stack:r})}},Qt=class extends tt{constructor(){super(...arguments);this.statusCode=409}};var mt=class extends st{constructor(s){super("Unknown BridgeError",{cause:s});this.statusCode=500;this.code="BridgeError"}};var Zt=class extends Fe{constructor(s,c){super(`Workflow with id: \`${s}\` has a corrupt state. Step with id: \`${c}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:s,stepId:c}}},Nt=class extends Fe{constructor(s,c){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=c}},en=class extends Fe{constructor(s,c){super(`Workflow with id: \`${s}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=c}},tn=class extends Fe{constructor(s,c,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${c}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=S}},nn=class extends Fe{constructor(s,c,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${c}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=S}},rn=class extends Fe{constructor(s,c,S){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${c}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=S}},sn=class extends Fe{constructor(s,c,S){super(`Workflow with id: \`${s}\` has invalid controls syntax in step with id: \`${c}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=S}},on=class extends Fe{constructor(s,c,S,U){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${c}\` and provider with id: \`${S}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=U}},an=class extends Fe{constructor(s,c){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=c}};var oi=g=>Object.values(g).map(r=>`\`${r}\``).join(", "),ln=g=>g.replaceAll(/(\w)(\w*)/g,(r,s,c)=>s.toUpperCase()+c.toLowerCase()).replaceAll(/[\s-]+/g,""),ai=(g,r=0)=>Array.isArray(g)||typeof g=="object"&&g!==null?JSON.stringify(g,null,r).replace(/"/g,"'").replace(/\n/g,"\\n"):String(g);var cn=class extends tt{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${oi(Kt)}`}},xt=class extends Fe{constructor(s,c){super(`Invalid query string: \`action\`=\`${s}\`. Please use one of ${oi(c)}`);this.code="InvalidActionError"}},pn=class extends Fe{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(r,s,c){super(),this.data={message:c},this.statusCode=r,this.code=s}};var kt=class extends Qt{constructor(r,s){super(`${ln(r)} with id: \`${s}\` already exists. Please use a different id.`)}},ot=class extends Xt{constructor(r,s){super(`${ln(r)} with id: \`${s}\` does not exist. Please provide a valid id.`)}},yt=class extends st{constructor(s,c,S,U){super(`Failed to ${S} ${ln(s)} with id: \`${c}\``,{cause:U});this.statusCode=502}};var dn=class extends ot{constructor(s){super("provider",s);this.code="ProviderNotFoundError"}},fn=class extends yt{constructor(s,c,S){super("provider",s,c,S);this.code="ProviderExecutionFailedError"}};var hn=class extends rt{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 rt{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},yn=class extends rt{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},gn=class extends rt{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 rt{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}};var bn=class extends ot{constructor(s){super("step",s);this.code="StepNotFoundError"}},Sn=class extends kt{constructor(s){super("step",s);this.code="StepAlreadyExistsError"}},Mt=class extends yt{constructor(s,c,S){super("step",s,c,S);this.code="StepExecutionFailedError"}};var Ct=class extends ot{constructor(s){super("workflow",s);this.code="WorkflowNotFoundError"}};var lt=g=>Object.values(Ve).includes(g==null?void 0:g.code),Or=g=>!lt(g)&&typeof g.statusCode=="number"&&g.statusCode>=400&&g.statusCode<500;var Ar=async(g,r)=>{let s=new TextEncoder,c=s.encode(g),S=s.encode(r),U=await crypto.subtle.importKey("raw",c,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),L=await crypto.subtle.sign("HMAC",U,S);return Array.from(new Uint8Array(L)).map(Q=>Q.toString(16).padStart(2,"0")).join("")};var vr=require("cross-fetch"),Er=()=>typeof Response!="undefined"?Response:vr.Response,Rr=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 r=await(await fetch("http://localhost:2022/.well-known/novu")).json();return`${r.tunnelOrigin}${r.route}`}}catch(g){console.error(g)}return""};function _r(g){return!!g&&typeof g=="object"&&"error"in g&&"message"in g&&"statusCode"in g}var Tn=(g,r)=>{if(!g)throw new pn;return{post:async(s,c)=>{let S=await fetch(`${r}/v1${s}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${g}`},body:JSON.stringify(c)}),U=await S.json();if(S.ok)return U;throw _r(U)?new un(U.statusCode,U.error,U.message):new mt(U)},delete:async s=>(await fetch(`${r}/v1${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${g}`}})).json()}};var ct=at(require("chalk"),1),Se={info:g=>ct.default.blue(g),warning:g=>ct.default.yellow(g),error:g=>ct.default.red(g),success:g=>ct.default.green(g),underline:g=>ct.default.underline(g),bold:g=>ct.default.bold(g)},Ne={SUCCESS:Se.success("\u2714"),ERROR:Se.error("\u2717"),WARNING:Se.warning("\u26A0"),INFO:Se.info("\u2139"),ARROW:Se.bold("\u2192"),MOCK:Se.info("\u25CB"),HYDRATED:Se.bold(Se.info("\u2192")),STEP:Se.info("\u03C3"),ACTION:Se.info("\u03B1"),DURATION:Se.info("\u0394"),PROVIDER:Se.info("\u2699"),OUTPUT:Se.info("\u21E2"),INPUT:Se.info("\u21E0"),WORKFLOW:Se.info("\u03C9"),STATE:Se.info("\u03C3"),EXECUTE:Se.info("\u03B5"),PREVIEW:Se.info("\u03C1")};function On(g){return g||process.env.NOVU_API_URL||"https://api.novu.co"}function An(g){return g||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY||""}var li=at(require("sanitize-html"),1),jo={allowedTags:li.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Pr=g=>{if(!g)return g;let r=/^<!DOCTYPE .*?>/,s=g.match(r),c=(0,li.default)(g,jo);return s?s[0]+c:c},vn=g=>Object.keys(g).reduce((r,s)=>{let c=g[s];return typeof c=="string"?r[s]=Pr(c):Array.isArray(c)?r[s]=c.map(S=>typeof S=="string"?Pr(S):typeof S=="object"?vn(S):S):typeof c=="object"&&c!==null?r[s]=vn(c):r[s]=c,r},{});var Nr=at(require("ajv"),1),xr=at(require("ajv-formats"),1);var Ir=g=>typeof structuredClone=="function"?structuredClone(g):JSON.parse(JSON.stringify(g));var En=class extends st{constructor(s,c){let S=c.length===1?"it":"them";super(`Tried to use a ${s} in @novu/framework without ${c.join(", ")} installed. Please install ${S} by running \`npm install ${c.join(" ")}\`.`);this.statusCode=500;this.code="MissingDependencyError"}};var Rn=async(g,r)=>{let s=new Set;if((await Promise.allSettled(g.map(S=>S.import))).forEach((S,U)=>{let L=g[U];S.status==="fulfilled"&&L.exports.every(ie=>S.value[ie]!==void 0)||s.add(L.name)}),s.size>0)throw new En(r,Array.from(s))};var _n=class{constructor(){this.requiredImports=[];this.ajv=new Nr.default({useDefaults:!0,removeAdditional:"failing"}),(0,xr.default)(this.ajv),this.compiledSchemas=new Map}async canHandle(r){let s=r.type==="object"||!!r.anyOf||!!r.allOf||!!r.oneOf;return s&&await Rn(this.requiredImports,"JSON schema"),s}async validate(r,s){let c=this.compiledSchemas.get(s);c||(c=this.ajv.compile(s),this.compiledSchemas.set(s,c));let S=Ir(r);return c(S)?{success:!0,data:S}:{success:!1,errors:c.errors.map(L=>({path:L.instancePath,message:L.message}))}}async transformToJsonSchema(r){return r}};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(r){let s=r.safeParseAsync!==void 0;return s&&await Rn(this.requiredImports,"Zod schema"),s}async validate(r,s){let c=await s.safeParseAsync(r);return c.success?{success:!0,data:c.data}:{success:!1,errors:c.error.errors.map(S=>({path:`/${S.path.join("/")}`,message:S.message}))}}async transformToJsonSchema(r){let{zodToJsonSchema:s}=await import("zod-to-json-schema");return s(r)}};var In=new Pn,Nn=new _n,xn=async(g,r)=>{if(await In.canHandle(g))return In.validate(r,g);if(await Nn.canHandle(g))return Nn.validate(r,g);throw new Error("Invalid schema")},Ce=async g=>{if(await In.canHandle(g))return In.transformToJsonSchema(g);if(await Nn.canHandle(g))return Nn.transformToJsonSchema(g);throw new Error("Invalid schema")};var kn=(()=>{var g=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,S=(e,t)=>function(){return e&&(t=(0,e[s(e)[0]])(e=0)),t},U=(e,t)=>function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports},L=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},Q=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of s(t))!c.call(e,p)&&p!==n&&g(e,p,{get:()=>t[p],enumerable:!(l=r(t,p))||l.enumerable});return e},ie=e=>Q(g({},"__esModule",{value:!0}),e),Te={};L(Te,{JSONSchemaFaker:()=>gr,default:()=>wr,setDependencies:()=>ki});function ae(e,t){return typeof e=="string"?typeof t!="undefined"?At.register(e,t):At.get(e):At.registerMany(e)}function Ae(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 ge(e){return jt.default.prototype.max=te("defaultRandExpMax"),jt.default.prototype.randInt=(n,l)=>n+Math.floor(te("random")()*(1+(l-n))),new jt.default(e).gen()}function xe(e){return e[Math.floor(te("random")()*e.length)]}function Ie(e){let t,n,l=e.length,p=e.slice();for(;l>0;)n=Math.floor(te("random")()*l),l-=1,t=p[l],p[l]=p[n],p[n]=t;return p}function Le(e,t){return te("random")()*(t-e)+e}function Ge(e,t,n,l,p=!1){return n=typeof n=="undefined"?ze.MIN_NUMBER:n,l=typeof l=="undefined"?ze.MAX_NUMBER:l,e=typeof e=="undefined"?n:e,t=typeof t=="undefined"?l:t,t<e&&(t+=e),p?Le(e,t):Ae(e,t)}function $t(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 Dn(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 l=new Date().getTime();return typeof t=="number"&&(t=new Date(l+t)),typeof n=="number"&&(n=new Date(l+n)),new Date(Le(t.getTime(),n.getTime()))}function di(e,t,n){if(t=decodeURIComponent(t),n&&n[t])return pe(n[t]);let l=t.replace("#/","/").split("/"),p=e.$ref&&n&&n[e.$ref]||e;for(!p&&!l[0]&&(l[0]=e.$ref.split("#/")[0]),n&&t.includes("#/")&&n[l[0]]&&(p=n[l.shift()]),l[0]||l.shift();p&&l.length>0;){let f=l.shift();if(!p[f])throw new Error(`Prop not found: ${f} (${t})`);p=p[f]}return p}function Ut(e){return typeof e=="string"&&Wi.test(e)}function He(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,l]=e.split("T")[0].split("-");return n=`0${Math.max(1,Math.min(12,n))}`.slice(-2),l=`0${Math.max(1,Math.min(31,l))}`.slice(-2),`${t}-${n}-${l}`}function bs(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,n]=e.split("T"),[l,p,f]=t.split("-"),[d,O,D]=n.substr(0,8).split(":");return p=`0${Math.max(1,Math.min(12,p))}`.slice(-2),f=`0${Math.max(1,Math.min(31,f))}`.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),`${l}-${p}-${f}T${d}:${O}:${D}.000Z`}function Ss(e,t,n){let l={};switch(e||t.type){case"integer":case"number":if(typeof t.minimum!="undefined"&&(l.minimum=t.minimum),typeof t.maximum!="undefined"&&(l.maximum=t.maximum),t.enum){let f=Math.max(l.minimum||0,0),d=Math.min(l.maximum||1/0,1/0);t.exclusiveMinimum&&f===t.minimum&&(f+=t.multipleOf||1),t.exclusiveMaximum&&d===t.maximum&&(d-=t.multipleOf||1),(f||d!==1/0)&&(t.enum=t.enum.filter(O=>O>=f&&O<=d))}break;case"string":{l.minLength=te("minLength")||0,l.maxLength=te("maxLength")||Number.MAX_SAFE_INTEGER,typeof t.minLength!="undefined"&&(l.minLength=Math.max(l.minLength,t.minLength)),typeof t.maxLength!="undefined"&&(l.maxLength=Math.min(l.maxLength,t.maxLength));break}default:break}let p=n(l);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(He(p))return p;p=String(p);let f=Math.max(l.minLength||0,0),d=Math.min(l.maxLength||1/0,1/0),O,D=0;for(;p.length<f;)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(bs(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((l,p)=>{e.type==="array"&&t.type==="array"?e[n][p]=dt(e[n][p]||{},l,!0):Array.isArray(e[n])&&e[n].indexOf(l)===-1&&e[n].push(l)})):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 pe(e,t=new Map){if(!e||typeof e!="object")return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let l=[];return t.set(e,l),l.push(...e.map(p=>pe(p,t))),l}let n={};return t.set(e,n),Object.keys(e).reduce((l,p)=>(l[p]=pe(e[p],t),l),n)}function Ts(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 Os(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function As(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(ze.SCALAR_TYPES.filter(l=>(Array.isArray(e.type)?e.type:[e.type]).every(f=>l==="number"||l==="integer"?f!=="number"&&f!=="integer":l!==f)));else if(e.enum){let l;do l=hi();while(e.enum.indexOf(l)!==-1);n.enum=[l]}return e.required&&n.properties&&e.required.forEach(l=>{delete n.properties[l]}),n}function $n(e,t){let n=t.minimum!==void 0,l=t.maximum!==void 0;return(n||l)&&(!n||e>=t.minimum)&&(!l||e<=t.maximum)}function vs(e,t){return!t.every(n=>$n(e,n))}function Es(e,t){return t.reduce((l,p)=>l+($n(e,p)?1:0),0)===1}function Rs(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function _s(e,t){return Object.keys(e).filter(n=>!t.includes(n)).reduce((n,l)=>(Array.isArray(e[l])?n[l]=e[l].slice():n[l]=e[l]instanceof Object?dt({},e[l]):e[l],n),{})}function mi(e,t){return Array.isArray(e)?e.map(n=>mi(n,t)):(typeof e=="string"&&(e=e.replace(/#\{([\w.-]+)\}/g,(n,l)=>t[l])),e)}function Un(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"),l=Array.isArray(t.required)&&t.required.includes(e)||n,p=typeof t.thunk=="function"||t.additionalProperties&&typeof t.additionalProperties.thunk=="function";return!l&&!p}function Fn(e,t,n=!1){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(l=>Fn(l,t,!0)).filter(l=>typeof l!="undefined");if(Object.keys(e).forEach(l=>{if(Un(e[l]))yi(l,t)&&delete e[l];else{let p=t;t&&t.properties&&t.properties[l]&&(p=t.properties[l]);let f=Fn(e[l],p);Un(f)||(e[l]=f)}typeof e[l]=="undefined"&&delete e[l]}),!(!Object.keys(e).length&&n))return e}function Ps(e){return(t,n,l,p)=>{let f=t,d=[];typeof t=="object"&&(f=Object.keys(t)[0],Array.isArray(t[f])?d=t[f]:d.push(t[f]));let O=f.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=>fe.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 '${l}: ${f}', given: ${t}`)}),t}}function Is(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 Ns(e,t,n){return Object.keys(e).filter(l=>{let p=Ji.indexOf(t)>-1;return n.indexOf(l)>-1&&!p}).length>0}function xs(e,t){let n=Object.keys(vt);for(let l=0;l<n.length;l+=1){let p=n[l],f=t[t.length-1];if(Ns(e,f,vt[p]))return p}}function ks(){return te("random")()>.5}function Ms(){return null}function Cs(e,t,n,l,p,f){let d=[],O=[];function D(F){let E=JSON.stringify(F.value);return O.indexOf(E)===-1?(O.push(E),d.push(F),!0):!1}t.forEach(D);let T=100;for(;d.length!==t.length&&(D(f(n.items||l,e,p))||(T-=1),!!T););return d}function Ls(e,t,n,l){let p=[];if(!(e.items||e.additionalItems)){if(fe.hasProperties(e,"minItems","maxItems","uniqueItems")&&(e.minItems!==0||e.maxItems!==0))throw new Yt(`missing items for ${fe.short(e)}`,t);return p}if(Array.isArray(e.items))return e.items.map((W,le)=>{let X=t.concat(["items",le]);return l(W,X,n)});let f=e.minItems,d=e.maxItems,O=te("minItems"),D=te("maxItems");O&&(f=typeof f=="undefined"?O:Math.min(O,f)),D&&(d=typeof d=="undefined"?D:Math.min(D,d),d&&d>D&&(d=D),f&&f>D&&(f=d));let T=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),F=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,E=Z.number(f,d,1,5);T!==null&&(E=Math.max(F?Math.round((d||E)*T):Math.abs(Z.number(f,d)*T),f||0));let B=typeof e.additionalItems=="object"?e.additionalItems:{};for(let W=p.length;W<E;W+=1){let le=t.concat(["items",W]),X=l(e.items||B,le,n);p.push(X)}if(e.contains&&E>0){let W=Z.number(0,E-1);p[W]=l(e.contains,t.concat(["items",W]),n)}return e.uniqueItems?Cs(t.concat(["items"]),p,e,B,n,l):p}function Ds(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,l=e.multipleOf,p=l&&String(l).match(/e-(\d)|\.(\d+)$/);if(p){let f=(Math.random()*Z.number(0,10)+1)*l,d=p[1]||p[2].length,O=parseFloat(f.toFixed(d)),D=Z.number(t,n-1);return String(O).includes(".")?D+O:(D+O).toExponential()}if(l&&(n=Math.floor(n/l)*l,t=Math.ceil(t/l)*l),e.exclusiveMinimum&&t===e.minimum&&(t+=l||1),e.exclusiveMaximum&&n===e.maximum&&(n-=l||1),t>n)return NaN;if(l){let f=Z.number(Math.floor(t/l),Math.floor(n/l))*l;for(;f<t;)f+=l;return f}return Z.number(t,n,void 0,void 0,e.type!=="integer")}function $s(e){return Math.floor(ei({...e}))}function Us(e){return Z.shuffle(nr).slice(0,e)}function Fs(e,t,n,l){let p={},f=e.properties||{},d=e.patternProperties||{},O=typeof e.required=="boolean"?[]:(e.required||[]).slice(),D=e.additionalProperties!==!1,T=Object.keys(f),F=Object.keys(d),E=T.concat(F).reduce((Y,h)=>(O.indexOf(h)===-1&&Y.push(h),Y),[]),B=O.concat(E),W=D&&e.additionalProperties===!0?Vt:e.additionalProperties;if(!D&&T.length===0&&F.length===0&&fe.hasProperties(e,"minProperties","maxProperties","dependencies","required"))return null;if(te("requiredOnly")===!0)return O.forEach(Y=>{f[Y]&&(p[Y]=f[Y])}),l(p,t.concat(["properties"]),n,e);let le=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),X=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,ne=te("ignoreProperties")||[],me=te("reuseProperties"),we=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(we?1:0,j),w)),le!==null&&(X===!0?b=Math.round(w-O.length+le*(B.length-w)):b=Z.number(w-O.length,le*(B.length-w)));let _=Z.shuffle(E).slice(0,b),I=E.filter(Y=>_.indexOf(Y)!==-1),M=le!==null||O.length===j?j:Z.number(0,j),R=O.concat(Z.shuffle(I).slice(0,M)).slice(0,j),N=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(Y=>{let h=e.dependencies[Y];if(R.indexOf(Y)!==-1)if(Array.isArray(h))h.forEach(x=>{R.indexOf(x)===-1&&R.push(x)});else if(Array.isArray(h.oneOf||h.anyOf)){let x=h.oneOf||h.anyOf;k.push({prop:Y,values:x})}else N.push(h)}),N.length))return delete e.dependencies,l({allOf:N.concat(e)},t.concat(["properties"]),n,e);let V=[],J=[];R.forEach(Y=>{if(f[Y]&&["{}","true"].includes(JSON.stringify(f[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](f[Y],Y)){V.push(Y);return}W===!1&&O.indexOf(Y)!==-1&&(p[Y]=f[Y]),f[Y]&&(p[Y]=f[Y]);let h;if(F.forEach(x=>{Y.match(new RegExp(x))&&(h=!0,p[Y]?fe.merge(p[Y],d[x]):p[Z.randexp(Y)]=d[x])}),!h){let x=d[Y]||W;x&&W!==!1?p[d[Y]?Z.randexp(Y):Y]=f[Y]||x:J.push(Y)}});let ee=Object.keys(p).length+(we?0:V.length),Ee=Y=>Z.randexp(`_?[_a-f\\d]{1,3}${Y?"\\$?":""}`);function Re(Y){let h;do{if(!Y.length)break;h=Y.shift()}while(p[h]);return h}let Pe=w;if(D&&!O.length&&(Pe=Math.max(le===null||W?Z.number(we?1:0,j):0,w)),!I.length&&!b&&D&&X===!0&&we){let Y=Z.number(0,j);for(let h=0;h<Y;h+=1)p[Wt(1)+Ee(Y[h])]=W||Vt}for(;we&&!(!(F.length||D)||ee>=Pe);){if(D)if(me&&T.length-ee>Pe){let Y=0,h;do{if(Y+=1,Y>1e3)break;h=Re(O)||Z.pick(T)}while(typeof p[h]!="undefined");typeof p[h]=="undefined"&&(p[h]=f[h],ee+=1)}else if(F.length&&!W){let Y=Z.pick(F),h=Z.randexp(Y);p[h]||(p[h]=d[Y],ee+=1)}else{let Y=Re(O)||Wt(1)+Ee();p[Y]||(p[Y]=W||Vt,ee+=1)}for(let Y=0;ee<w&&Y<F.length;Y+=1){let h=F[Y],x=Z.randexp(h);p[x]||(p[x]=d[h],ee+=1)}}if(O.length===0&&(!D||le===!1)){let Y=Z.number(w,j);for(;ee<Y;){let h=Re(T);h&&(p[h]=f[h]),ee+=1}}let ke=p;if(te("sortProperties")!==null){let Y=Object.keys(f);ke=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 De=l(ke,t.concat(["properties"]),n,e);return k.forEach(Y=>{for(let h of Y.values)if(fe.hasValue(h.properties[Y.prop],De.value[Y.prop])){Object.keys(h.properties).forEach(x=>{x!==Y.prop&&fe.merge(De.value,l(h.properties,t.concat(["properties"]),n,e).value)});break}}),De}function gi(){let e=Z.number(1,5);return Wt(e).join(" ")}function js(e=0,t=140){let n=Math.max(0,e),l=Z.number(n,t),p=gi();for(;p.length<n;)p+=gi();return p.length>l&&(p=p.substr(0,l)),p}function Ys(){return[0,0,0,0].map(()=>Z.number(0,255)).join(".")}function Ws(){return Z.date().toISOString()}function Vs(){return qt().slice(0,10)}function qs(){return qt().slice(11)}function Bs(e){return Z.randexp(Ye[e]).replace(lr,(t,n)=>Z.randexp(Ye[n]))}function Js(e,t){let n=Zn(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 ${fe.short(e.format)}`);return t()}throw new Error(`unsupported format '${e.format}'`)}}function Gs(e){return fe.typecast("string",e,n=>e.format?Js(e,()=>ti(n.minLength,n.maxLength)):e.pattern?Z.randexp(e.pattern):ti(n.minLength,n.maxLength))}function Hs({$comment:e,title:t,description:n}){return Object.entries({comment:e,title:t,description:n}).filter(([,l])=>l).reduce((l,[p,f])=>(l[p]=f,l),{})}function ft(e,t,n,l){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(l)}'`);let p={...Hs(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:fe.typecast(null,e,()=>Z.pick(T)),context:p}}if(te("useExamplesValue")&&typeof e.example!="undefined")return{value:fe.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:fe.template(e.template,l),context:p};if("const"in e)return{value:e.const,context:p}}if(e.not&&typeof e.not=="object"&&(e=fe.notValue(e.not,fe.omitProps(e,["not"])),e.type&&e.type==="object")){let{value:T,context:F}=ft(e,t.concat(["not"]),n,l);return{value:fe.clean(T,e,!1),context:{...p,items:F}}}if(typeof e.thunk=="function"){let{value:T,context:F}=ft(e.thunk(l),t,n);return{value:T,context:{...p,items:F}}}if(e.jsonPath)return{value:e,context:p};let f=e.type;if(Array.isArray(f)?f=Z.pick(f):typeof f=="undefined"&&(f=Gi(e,t)||f,f&&(e.type=f)),typeof e.generate=="function"){let T=fe.typecast(null,e,()=>e.generate(l,t)),F=T===null?"null":typeof T;if(F===f||F==="number"&&f==="integer"||Array.isArray(T)&&f==="array")return{value:T,context:p}}if(typeof e.pattern=="string")return{value:fe.typecast("string",e,()=>Z.randexp(e.pattern)),context:p};if(Array.isArray(e.enum))return{value:fe.typecast(null,e,()=>Z.pick(e.enum)),context:p};if(typeof f=="string")if(Et[f])try{let T=Et[f](e,t,n,ft);return f==="array"?{value:T.map(({value:F})=>F),context:{...p,items:T.map(Array.isArray(e.items)?({context:F})=>F:({context:F})=>({...F,schemaPath:F.schemaPath.slice(0,-1)}))}}:f==="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 ${fe.short(f)}`,t.concat(["type"]));{let T=te("defaultInvalidTypeProduct");return typeof T=="string"&&Et[T]?{value:Et[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:F,context:E}=ft(e[T],t.concat([T]),n,d);d[T]=fe.clean(F,e[T],!1),O[T]=E,d[T]===null&&te("omitNulls")&&(delete d[T],delete O[T])}else d[T]=e[T]}),{value:d,context:O}}function Ks(e){return Array.isArray(e)?Z.pick(e):e}function zs(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 jn(e,t,n,l){if(!e||typeof e!="object")return e;if(n||(n={}),t||(t=e),Array.isArray(e))return e.map(p=>jn(p,t,n,l));if(e.jsonPath){let{JSONPath:p}=Hn(),f=typeof e.jsonPath!="object"?{path:e.jsonPath}:e.jsonPath;f.group=e.group||f.group||l,f.cycle=e.cycle||f.cycle||!1,f.reverse=e.reverse||f.reverse||!1,f.count=e.count||f.count||1;let d=`${f.group}__${f.path}`;return n[d]||(f.count>1?n[d]=p(f.path,t).slice(0,f.count):n[d]=p(f.path,t)),f.cycle||f.reverse?zs(n[d],f.reverse):Ks(n[d])}return Object.keys(e).forEach(p=>{e[p]=jn(e[p],t,n,p)}),e}function Xs(e,t,n,l){if(Object.prototype.toString.call(t)!=="[object Object]")throw new Error(`Invalid input, expecting object but given ${typeof t}`);let p=te("refDepthMin")||0,f=te("refDepthMax")||3;try{let{resolveSchema:d}=hr({refs:e,schema:t,container:n,synchronous:l,refDepthMin:p,refDepthMax:f}),O=dr(fe.clone(t),[],d);return te("resolveJsonPath")?{value:jn(O.value),context:O.context}:O}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function Qs(e){return e.value}function Zs(e,t){return t.reduce((n,l)=>l in n?n[l]:{},e)}function Yn(e,t,n,l=n){let{title:p,description:f,comment:d}=Zs(e,t),O=[];te("renderTitle")&&p&&O.push(` ${p}`,""),te("renderDescription")&&f&&O.push(` ${f}`),te("renderComment")&&d&&O.push(` ${d}`),n.commentBefore=O.join(` `),l instanceof mr?l.items.forEach(D=>{Yn(e,[...t,"items",D.key.value],D.key,D.value)}):l instanceof yr&&l.items.forEach((D,T)=>{Yn(e,[...t,"items",T],D)})}function eo({value:e,context:t}){let n=Rt.createNode(e);Yn(t,[],n);let l=new Rt.Document;return l.contents=n,l.toString()}function wi(){Qe.define("autoIncrement",function(t,n){if(!this.offset){let l=n.minimum||1,p=l+ze.MAX_NUMBER,f=t.initialOffset||n.initialOffset;this.offset=f||Z.number(l,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 ${fe.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 l(p){if(!p||typeof p!="object")return;if(Array.isArray(p))return p.forEach(l);let f=p.$id||p.id;typeof f=="string"&&!n[f]&&(n[f]=p),Object.keys(p).forEach(d=>{l(p[d])})}return l(e),l(t),n}var Si,Wn,Ti,Vn,Oi,Ai,je,vi,qn,$,Bn,Ei,Ri,_i,Pi,Ii,Ot,Ft,Jn,Ni,xi,Gn,Hn,ki,Mi,Kn,de,zn,Ci,Li,At,te,Xn,Qn,Di,$i,Ui,Fi,ji,Yi,ze,jt,Z,Wi,fe,Vi,qi,ht,Zn,Bi,Yt,vt,Ji,Gi,Hi,Ki,zi,Xi,Qi,Zi,er,ei,tr,nr,Wt,Vt,ir,ti,rr,qt,sr,or,ni,Bt,ar,Ye,lr,cr,pr,ur,Et,dr,fr,hr,ii,ri,$e,to,no,io,ro,so,oo,ao,lo,co,po,uo,fo,mr,yr,Rt,Qe,ve,gr,wr,ho=S({"src/shared.js"(){Si=Object.create,Wn=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyNames,Oi=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty,je=(e,t)=>function(){return t||(0,e[Vn(e)[0]])((t={exports:{}}).exports,t),t.exports},vi=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Vn(t))!Ai.call(e,p)&&p!==n&&Wn(e,p,{get:()=>t[p],enumerable:!(l=Ti(t,p))||l.enumerable});return e},qn=(e,t,n)=>(n=e!=null?Si(Oi(e)):{},vi(t||!e||!e.__esModule?Wn(n,"default",{value:e,enumerable:!0}):n,e)),$=je({"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}}}),Bn=je({"node_modules/ret/lib/sets.js"(e){var t=$(),n=()=>[{type:t.RANGE,from:48,to:57}],l=()=>[{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}],f=()=>[{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:l(),not:!1}),e.notWords=()=>({type:t.SET,set:l(),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:f(),not:!0})}}),Ei=je({"node_modules/ret/lib/util.js"(e){var t=$(),n=Bn(),l="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",p={0:0,t:9,n:10,v:11,f:12,r:13};e.strToChars=function(f){var d=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return f=f.replace(d,function(O,D,T,F,E,B,W,le){if(T)return O;var X=D?8:F?parseInt(F,16):E?parseInt(E,16):B?parseInt(B,8):W?l.indexOf(W):p[le],ne=String.fromCharCode(X);return/[[\]{}^$.|?*+()]/.test(ne)&&(ne="\\"+ne),ne}),f},e.tokenizeClass=(f,d)=>{for(var O=[],D=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,T,F;(T=D.exec(f))!=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(F=T[12])O.push({type:t.CHAR,value:F.charCodeAt(0)});else return[O,D.lastIndex];e.error(d,"Unterminated character class")},e.error=(f,d)=>{throw new SyntaxError("Invalid regular expression: /"+f+"/: "+d)}}}),Ri=je({"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:"$"})}}),_i=je({"node_modules/ret/lib/index.js"(e,t){var n=Ei(),l=$(),p=Bn(),f=Ri();t.exports=d=>{var O=0,D,T,F={type:l.ROOT,stack:[]},E=F,B=F.stack,W=[],le=I=>{n.error(d,`Nothing to repeat at column ${I-1}`)},X=n.strToChars(d);for(D=X.length;O<D;)switch(T=X[O++],T){case"\\":switch(T=X[O++],T){case"b":B.push(f.wordBoundary());break;case"B":B.push(f.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:l.REFERENCE,value:parseInt(T,10)}):B.push({type:l.CHAR,value:T.charCodeAt(0)})}break;case"^":B.push(f.begin());break;case"$":B.push(f.end());break;case"[":var ne;X[O]==="^"?(ne=!0,O++):ne=!1;var me=n.tokenizeClass(X.slice(O),d);O+=me[1],B.push({type:l.SET,set:me[0],not:ne});break;case".":B.push(p.anyChar());break;case"(":var we={type:l.GROUP,stack:[],remember:!0};T=X[O],T==="?"&&(T=X[O+1],O+=2,T==="="?we.followedBy=!0:T==="!"?we.notFollowedBy=!0:T!==":"&&n.error(d,`Invalid group, character '${T}' after '?' at column ${O-1}`),we.remember=!1),B.push(we),W.push(E),E=we,B=we.stack;break;case")":W.length===0&&n.error(d,`Unmatched ) at column ${O-1}`),E=W.pop(),B=E.options?E.options[E.options.length-1]:E.stack;break;case"|":E.options||(E.options=[E.stack],delete E.stack);var j=[];E.options.push(j),B=j;break;case"{":var w=/^(\d+)(,(\d+)?)?\}/.exec(X.slice(O)),b,_;w!==null?(B.length===0&&le(O),b=parseInt(w[1],10),_=w[2]?w[3]?parseInt(w[3],10):1/0:b,O+=w[0].length,B.push({type:l.REPETITION,min:b,max:_,value:B.pop()})):B.push({type:l.CHAR,value:123});break;case"?":B.length===0&&le(O),B.push({type:l.REPETITION,min:0,max:1,value:B.pop()});break;case"+":B.length===0&&le(O),B.push({type:l.REPETITION,min:1,max:1/0,value:B.pop()});break;case"*":B.length===0&&le(O),B.push({type:l.REPETITION,min:0,max:1/0,value:B.pop()});break;default:B.push({type:l.CHAR,value:T.charCodeAt(0)})}return W.length!==0&&n.error(d,"Unterminated group"),F},t.exports.types=l}}),Pi=je({"node_modules/drange/lib/index.js"(e,t){"use strict";var n=class gt{constructor(f,d){this.low=f,this.high=d,this.length=1+d-f}overlaps(f){return!(this.high<f.low||this.low>f.high)}touches(f){return!(this.high+1<f.low||this.low-1>f.high)}add(f){return new gt(Math.min(this.low,f.low),Math.max(this.high,f.high))}subtract(f){return f.low<=this.low&&f.high>=this.high?[]:f.low>this.low&&f.high<this.high?[new gt(this.low,f.low-1),new gt(f.high+1,this.high)]:f.low<=this.low?[new gt(f.high+1,this.high)]:[new gt(this.low,f.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},l=class Lt{constructor(f,d){this.ranges=[],this.length=0,f!=null&&this.add(f,d)}_update_length(){this.length=this.ranges.reduce((f,d)=>f+d.length,0)}add(f,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.touches(this.ranges[T]);)T++;for(var F=this.ranges.slice(0,T);T<this.ranges.length&&D.touches(this.ranges[T]);)D=D.add(this.ranges[T]),T++;F.push(D),this.ranges=F.concat(this.ranges.slice(T)),this._update_length()};return f instanceof Lt?f.ranges.forEach(O):(d==null&&(d=f),O(new n(f,d))),this}subtract(f,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.overlaps(this.ranges[T]);)T++;for(var F=this.ranges.slice(0,T);T<this.ranges.length&&D.overlaps(this.ranges[T]);)F=F.concat(this.ranges[T].subtract(D)),T++;this.ranges=F.concat(this.ranges.slice(T)),this._update_length()};return f instanceof Lt?f.ranges.forEach(O):(d==null&&(d=f),O(new n(f,d))),this}intersect(f,d){var O=[],D=T=>{for(var F=0;F<this.ranges.length&&!T.overlaps(this.ranges[F]);)F++;for(;F<this.ranges.length&&T.overlaps(this.ranges[F]);){var E=Math.max(this.ranges[F].low,T.low),B=Math.min(this.ranges[F].high,T.high);O.push(new n(E,B)),F++}};return f instanceof Lt?f.ranges.forEach(D):(d==null&&(d=f),D(new n(f,d))),this.ranges=O,this._update_length(),this}index(f){for(var d=0;d<this.ranges.length&&this.ranges[d].length<=f;)f-=this.ranges[d].length,d++;return this.ranges[d].low+f}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new Lt(this)}numbers(){return this.ranges.reduce((f,d)=>{for(var O=d.low;O<=d.high;)f.push(O),O++;return f},[])}subranges(){return this.ranges.map(f=>({low:f.low,high:f.high,length:1+f.high-f.low}))}};t.exports=l}}),Ii=je({"node_modules/randexp/lib/randexp.js"(e,t){var n=_i(),l=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,F,E,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="",E=0,B=D.length;E<B;E++)T+=this._gen(D[E],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(F=this.randInt(d.min,d.max===1/0?d.min+this.max:d.max),T="",E=0;E<F;E++)T+=this._gen(d.value,O);return T;case p.REFERENCE:return O[d.value-1]||"";case p.CHAR:var le=this.ignoreCase&&this._randBool()?this._toOtherCase(d.value):d.value;return String.fromCharCode(le)}}_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 l?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 l(d.value);if(d.type===n.types.RANGE)return new l(d.from,d.to);{let O=new l;for(let D=0;D<d.set.length;D++){let T=this._expand(d.set[D]);if(O.add(T),this.ignoreCase)for(let F=0;F<T.length;F++){let E=T.index(F),B=this._toOtherCase(E);E!==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 l(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=je({"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"},l="tag:yaml.org,2002:",p={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function f(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"?(w=f(j),b=j):(Array.isArray(j)&&(j=j[0]),j&&j.context&&(j.lineStarts||(j.lineStarts=f(j.context.src)),w=j.lineStarts,b=j.context.src)),{lineStarts:w,src:b}}function O(j,w){if(typeof j!="number"||j<0)return null;let{lineStarts:b,src:_}=d(w);if(!b||!_||j>_.length)return null;for(let M=0;M<b.length;++M){let R=b[M];if(j<R)return{line:M,col:j-b[M-1]+1};if(j===R)return{line:M+1,col:1}}let I=b.length;return{line:I,col:j-b[I-1]+1}}function D(j,w){let{lineStarts:b,src:_}=d(w);if(!b||!(j>=1)||j>b.length)return null;let I=b[j-1],M=b[j];for(;M&&M>I&&_[M-1]===` `;)--M;return _.slice(I,M)}function T({start:j,end:w},b,_=80){let I=D(j.line,b);if(!I)return null;let{col:M}=j;if(I.length>_)if(M<=_-10)I=I.substr(0,_-1)+"\u2026";else{let J=Math.round(_/2);I.length>M+J&&(I=I.substr(0,M+J-1)+"\u2026"),M-=I.length-_,I="\u2026"+I.substr(1-_)}let R=1,N="";w&&(w.line===j.line&&M+(w.col-j.col)<=_+1?R=w.col-j.col:(R=Math.min(I.length+1,_)-M,N="\u2026"));let k=M>1?" ".repeat(M-1):"",V="^".repeat(R);return`${I} ${k}${V}${N}`}var F=class kr{static copy(w){return new kr(w.start,w.end)}constructor(w,b){this.start=w,this.end=b||w}isEmpty(){return typeof this.start!="number"||!this.end||this.end<=this.start}setOrigRange(w,b){let{start:_,end:I}=this;if(w.length===0||I<=w[0])return this.origStart=_,this.origEnd