@finda-co/novu-framework
Version:
The Code-First Notifications Workflow SDK.
11 lines • 219 kB
JavaScript
"use strict";var Po=Object.create;var Gt=Object.defineProperty;var Io=Object.getOwnPropertyDescriptor;var No=Object.getOwnPropertyNames;var xo=Object.getPrototypeOf,ko=Object.prototype.hasOwnProperty;var Mo=(w,r)=>{for(var o in r)Gt(w,o,{get:r[o],enumerable:!0})},br=(w,r,o,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let E of No(r))!ko.call(w,E)&&E!==o&&Gt(w,E,{get:()=>r[E],enumerable:!(u=Io(r,E))||u.enumerable});return w};var at=(w,r,o)=>(o=w!=null?Po(xo(w)):{},br(r||!w||!w.__esModule?Gt(o,"default",{value:w,enumerable:!0}):o,w)),Co=w=>br(Gt({},"__esModule",{value:!0}),w);var Aa={};Mo(Aa,{Client:()=>wt,CronExpression:()=>si,NovuRequestHandler:()=>bt,frameworkName:()=>gs,serve:()=>Oa,workflow:()=>ys});module.exports=Co(Aa);var Fr=require("liquidjs");var Pt=(u=>(u.TRIGGER="trigger",u.EXECUTE="execute",u.PREVIEW="preview",u))(Pt||{}),Ht=(u=>(u.DISCOVER="discover",u.HEALTH_CHECK="health-check",u.CODE="code",u))(Ht||{});var si=(U=>(U.EVERY_SECOND="* * * * * *",U.EVERY_5_SECONDS="*/5 * * * * *",U.EVERY_10_SECONDS="*/10 * * * * *",U.EVERY_30_SECONDS="*/30 * * * * *",U.EVERY_MINUTE="*/1 * * * *",U.EVERY_5_MINUTES="0 */5 * * * *",U.EVERY_10_MINUTES="0 */10 * * * *",U.EVERY_30_MINUTES="0 */30 * * * *",U.EVERY_HOUR="0 0-23/1 * * *",U.EVERY_2_HOURS="0 0-23/2 * * *",U.EVERY_3_HOURS="0 0-23/3 * * *",U.EVERY_4_HOURS="0 0-23/4 * * *",U.EVERY_5_HOURS="0 0-23/5 * * *",U.EVERY_6_HOURS="0 0-23/6 * * *",U.EVERY_7_HOURS="0 0-23/7 * * *",U.EVERY_8_HOURS="0 0-23/8 * * *",U.EVERY_9_HOURS="0 0-23/9 * * *",U.EVERY_10_HOURS="0 0-23/10 * * *",U.EVERY_11_HOURS="0 0-23/11 * * *",U.EVERY_12_HOURS="0 0-23/12 * * *",U.EVERY_DAY_AT_1AM="0 01 * * *",U.EVERY_DAY_AT_2AM="0 02 * * *",U.EVERY_DAY_AT_3AM="0 03 * * *",U.EVERY_DAY_AT_4AM="0 04 * * *",U.EVERY_DAY_AT_5AM="0 05 * * *",U.EVERY_DAY_AT_6AM="0 06 * * *",U.EVERY_DAY_AT_7AM="0 07 * * *",U.EVERY_DAY_AT_8AM="0 08 * * *",U.EVERY_DAY_AT_9AM="0 09 * * *",U.EVERY_DAY_AT_10AM="0 10 * * *",U.EVERY_DAY_AT_11AM="0 11 * * *",U.EVERY_DAY_AT_NOON="0 12 * * *",U.EVERY_DAY_AT_1PM="0 13 * * *",U.EVERY_DAY_AT_2PM="0 14 * * *",U.EVERY_DAY_AT_3PM="0 15 * * *",U.EVERY_DAY_AT_4PM="0 16 * * *",U.EVERY_DAY_AT_5PM="0 17 * * *",U.EVERY_DAY_AT_6PM="0 18 * * *",U.EVERY_DAY_AT_7PM="0 19 * * *",U.EVERY_DAY_AT_8PM="0 20 * * *",U.EVERY_DAY_AT_9PM="0 21 * * *",U.EVERY_DAY_AT_10PM="0 22 * * *",U.EVERY_DAY_AT_11PM="0 23 * * *",U.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",U.EVERY_WEEK="0 0 * * 0",U.EVERY_WEEKDAY="0 0 * * 1-5",U.EVERY_WEEKEND="0 0 * * 6,0",U.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",U.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",U.EVERY_2ND_HOUR="0 */2 * * *",U.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",U.EVERY_2ND_MONTH="0 0 1 */2 *",U.EVERY_QUARTER="0 0 1 */3 *",U.EVERY_6_MONTHS="0 0 1 */6 *",U.EVERY_YEAR="0 0 1 0 *",U.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",U.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",U.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",U.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",U.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",U.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",U.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",U.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",U.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",U.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",U.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",U.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",U.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",U.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",U.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",U.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",U.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",U.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",U.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",U.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",U.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",U.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",U.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",U.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",U.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",U))(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=(u=>(u.POST="POST",u.GET="GET",u.OPTIONS="OPTIONS",u))(Kt||{});var zt=(Y=>(Y.EMAIL="email",Y.SMS="sms",Y.PUSH="push",Y.CHAT="chat",Y.IN_APP="in_app",Y))(zt||{});var Lo=w=>{var o,u;if(typeof w!="object"||w===null)return!1;let r=Object.getPrototypeOf(w);return(u=(o=r==null?void 0:r.constructor)==null?void 0:o.name.endsWith("Error"))!=null?u:!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:o}={}){var u;Lo(o)?(super(`${r}: ${o.message}`),this.data={stack:(u=o.stack)!=null?u:r}):(super(`${r}${o?`: ${JSON.stringify(o,null,2)}`:""}`),this.data={stack:r})}},Qt=class extends tt{constructor(){super(...arguments);this.statusCode=409}};var mt=class extends st{constructor(o){super("Unknown BridgeError",{cause:o});this.statusCode=500;this.code="BridgeError"}};var Zt=class extends Fe{constructor(o,u){super(`Workflow with id: \`${o}\` has a corrupt state. Step with id: \`${u}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:o,stepId:u}}},Nt=class extends Fe{constructor(o,u){super(`Workflow with id: \`${o}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=u}},en=class extends Fe{constructor(o,u){super(`Workflow with id: \`${o}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=u}},tn=class extends Fe{constructor(o,u,E){super(`Workflow with id: \`${o}\` has an invalid state. Step with id: \`${u}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=E}},nn=class extends Fe{constructor(o,u,E){super(`Workflow with id: \`${o}\` has an invalid state. Step with id: \`${u}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=E}},rn=class extends Fe{constructor(o,u,E){super(`Workflow with id: \`${o}\` has an invalid state. Step with id: \`${u}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=E}},sn=class extends Fe{constructor(o,u,E){super(`Workflow with id: \`${o}\` has invalid controls syntax in step with id: \`${u}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=E}},on=class extends Fe{constructor(o,u,E,Y){super(`Workflow with id: \`${o}\` has an invalid state. Step with id: \`${u}\` and provider with id: \`${E}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=Y}},an=class extends Fe{constructor(o,u){super(`Workflow with id: \`${o}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=u}};var oi=w=>Object.values(w).map(r=>`\`${r}\``).join(", "),ln=w=>w.replaceAll(/(\w)(\w*)/g,(r,o,u)=>o.toUpperCase()+u.toLowerCase()).replaceAll(/[\s-]+/g,""),ai=(w,r=0)=>Array.isArray(w)||typeof w=="object"&&w!==null?JSON.stringify(w,null,r).replace(/"/g,"'").replace(/\n/g,"\\n"):String(w);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(o,u){super(`Invalid query string: \`action\`=\`${o}\`. Please use one of ${oi(u)}`);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,o,u){super(),this.data={message:u},this.statusCode=r,this.code=o}};var kt=class extends Qt{constructor(r,o){super(`${ln(r)} with id: \`${o}\` already exists. Please use a different id.`)}},ot=class extends Xt{constructor(r,o){super(`${ln(r)} with id: \`${o}\` does not exist. Please provide a valid id.`)}},yt=class extends st{constructor(o,u,E,Y){super(`Failed to ${E} ${ln(o)} with id: \`${u}\``,{cause:Y});this.statusCode=502}};var dn=class extends ot{constructor(o){super("provider",o);this.code="ProviderNotFoundError"}},fn=class extends yt{constructor(o,u,E){super("provider",o,u,E);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(o){super("step",o);this.code="StepNotFoundError"}},Sn=class extends kt{constructor(o){super("step",o);this.code="StepAlreadyExistsError"}},Mt=class extends yt{constructor(o,u,E){super("step",o,u,E);this.code="StepExecutionFailedError"}};var Ct=class extends ot{constructor(o){super("workflow",o);this.code="WorkflowNotFoundError"}};var lt=w=>Object.values(Ve).includes(w==null?void 0:w.code),Tr=w=>!lt(w)&&typeof w.statusCode=="number"&&w.statusCode>=400&&w.statusCode<500;var Or=async(w,r)=>{let o=new TextEncoder,u=o.encode(w),E=o.encode(r),Y=await crypto.subtle.importKey("raw",u,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),L=await crypto.subtle.sign("HMAC",Y,E);return Array.from(new Uint8Array(L)).map(Z=>Z.toString(16).padStart(2,"0")).join("")};var Ar=require("cross-fetch"),Er=()=>typeof Response!="undefined"?Response:Ar.Response,vr=async()=>{if(process.env.NOVU_BRIDGE_ORIGIN)return`${process.env.NOVU_BRIDGE_ORIGIN}/api/novu`;if(process.env.NEXT_PUBLIC_VERCEL_ENV==="preview"&&process.env.NEXT_PUBLIC_VERCEL_URL)return`https://${process.env.NEXT_PUBLIC_VERCEL_URL}/api/novu`;try{if(process.env.NODE_ENV==="development"){let r=await(await fetch("http://localhost:2022/.well-known/novu")).json();return`${r.tunnelOrigin}${r.route}`}}catch(w){console.error(w)}return""};function Rr(w){return!!w&&typeof w=="object"&&"error"in w&&"message"in w&&"statusCode"in w}var Tn=(w,r,o)=>{let{headers:u,...E}=o||{};if(!w)throw new pn;return{post:async(Y,L)=>{let Z=await fetch(`${r}/v1${Y}`,{...E,method:"POST",headers:{...u,"Content-Type":"application/json",Authorization:`ApiKey ${w}`},body:JSON.stringify(L)}),Q=await Z.json();if(Z.ok)return Q;throw Rr(Q)?new un(Q.statusCode,Q.error,Q.message):new mt(Q)},delete:async Y=>(await fetch(`${r}/v1${Y}`,{...E,method:"DELETE",headers:{...u,"Content-Type":"application/json",Authorization:`ApiKey ${w}`}})).json()}};var ct=at(require("chalk"),1),Se={info:w=>ct.default.blue(w),warning:w=>ct.default.yellow(w),error:w=>ct.default.red(w),success:w=>ct.default.green(w),underline:w=>ct.default.underline(w),bold:w=>ct.default.bold(w)},Ie={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(w){return w||process.env.NOVU_API_URL||"https://api.novu.co"}function An(w){return w||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY||""}var li=at(require("sanitize-html"),1),$o={allowedTags:li.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},_r=w=>{if(!w)return w;let r=/^<!DOCTYPE .*?>/,o=w.match(r),u=(0,li.default)(w,$o);return o?o[0]+u:u},En=w=>Object.keys(w).reduce((r,o)=>{let u=w[o];return typeof u=="string"?r[o]=_r(u):Array.isArray(u)?r[o]=u.map(E=>typeof E=="string"?_r(E):typeof E=="object"?En(E):E):typeof u=="object"&&u!==null?r[o]=En(u):r[o]=u,r},{});var Ir=at(require("ajv"),1),Nr=at(require("ajv-formats"),1);var Pr=w=>typeof structuredClone=="function"?structuredClone(w):JSON.parse(JSON.stringify(w));var vn=class extends st{constructor(o,u){let E=u.length===1?"it":"them";super(`Tried to use a ${o} in @novu/framework without ${u.join(", ")} installed. Please install ${E} by running \`npm install ${u.join(" ")}\`.`);this.statusCode=500;this.code="MissingDependencyError"}};var Rn=async(w,r)=>{let o=new Set;if((await Promise.allSettled(w.map(E=>E.import))).forEach((E,Y)=>{let L=w[Y];E.status==="fulfilled"&&L.exports.every(Q=>E.value[Q]!==void 0)||o.add(L.name)}),o.size>0)throw new vn(r,Array.from(o))};var _n=class{constructor(){this.requiredImports=[];this.ajv=new Ir.default({useDefaults:!0,removeAdditional:"failing"}),(0,Nr.default)(this.ajv),this.compiledSchemas=new Map}async canHandle(r){let o=r.type==="object"||!!r.anyOf||!!r.allOf||!!r.oneOf;return o&&await Rn(this.requiredImports,"JSON schema"),o}async validate(r,o){let u=this.compiledSchemas.get(o);u||(u=this.ajv.compile(o),this.compiledSchemas.set(o,u));let E=Pr(r);return u(E)?{success:!0,data:E}:{success:!1,errors:u.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 o=r.safeParseAsync!==void 0;return o&&await Rn(this.requiredImports,"Zod schema"),o}async validate(r,o){let u=await o.safeParseAsync(r);return u.success?{success:!0,data:u.data}:{success:!1,errors:u.error.errors.map(E=>({path:`/${E.path.join("/")}`,message:E.message}))}}async transformToJsonSchema(r){let{zodToJsonSchema:o}=await import("zod-to-json-schema");return o(r)}};var In=new Pn,Nn=new _n,xn=async(w,r)=>{if(await In.canHandle(w))return In.validate(r,w);if(await Nn.canHandle(w))return Nn.validate(r,w);throw new Error("Invalid schema")},Ce=async w=>{if(await In.canHandle(w))return In.transformToJsonSchema(w);if(await Nn.canHandle(w))return Nn.transformToJsonSchema(w);throw new Error("Invalid schema")};var kn=(()=>{var w=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,E=(e,t)=>function(){return e&&(t=(0,e[o(e)[0]])(e=0)),t},Y=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},L=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},Z=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of o(t))!u.call(e,c)&&c!==n&&w(e,c,{get:()=>t[c],enumerable:!(l=r(t,c))||l.enumerable});return e},Q=e=>Z(w({},"__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(ne("random")()*(t-e+1))+e}function ge(e){return jt.default.prototype.max=ne("defaultRandExpMax"),jt.default.prototype.randInt=(n,l)=>n+Math.floor(ne("random")()*(1+(l-n))),new jt.default(e).gen()}function Ne(e){return e[Math.floor(ne("random")()*e.length)]}function xe(e){let t,n,l=e.length,c=e.slice();for(;l>0;)n=Math.floor(ne("random")()*l),l-=1,t=c[l],c[l]=c[n],c[n]=t;return c}function De(e,t){return ne("random")()*(t-e)+e}function Ge(e,t,n,l,c=!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),c?De(e,t):Ae(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 Dn(e){if(e)return Ut(e);let t=ne("minDateTime"),n=ne("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(De(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("/"),c=e.$ref&&n&&n[e.$ref]||e;for(!c&&!l[0]&&(l[0]=e.$ref.split("#/")[0]),n&&t.includes("#/")&&n[l[0]]&&(c=n[l.shift()]),l[0]||l.shift();c&&l.length>0;){let f=l.shift();if(!c[f])throw new Error(`Prop not found: ${f} (${t})`);c=c[f]}return c}function $t(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 ws(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,n]=e.split("T"),[l,c,f]=t.split("-"),[d,T,D]=n.substr(0,8).split(":");return c=`0${Math.max(1,Math.min(12,c))}`.slice(-2),f=`0${Math.max(1,Math.min(31,f))}`.slice(-2),d=`0${Math.max(1,Math.min(23,d))}`.slice(-2),T=`0${Math.max(1,Math.min(59,T))}`.slice(-2),D=`0${Math.max(1,Math.min(59,D))}`.slice(-2),`${l}-${c}-${f}T${d}:${T}:${D}.000Z`}function bs(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(T=>T>=f&&T<=d))}break;case"string":{l.minLength=ne("minLength")||0,l.maxLength=ne("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 c=n(l);if(c==null)return null;switch(e||t.type){case"number":c=$t(c)?parseFloat(c):c;break;case"integer":c=$t(c)?parseInt(c,10):c;break;case"boolean":c=!!c;break;case"string":{if(He(c))return c;c=String(c);let f=Math.max(l.minLength||0,0),d=Math.min(l.maxLength||1/0,1/0),T,D=0;for(;c.length<f;)if(T=c,t.pattern?c+=ee.randexp(t.pattern):c+=`${ee.pick([" ","/","_","-","+","=","@","^"])}${c}`,c===T){if(D+=1,D===3)break}else D=0;switch(c.length>d&&(c=c.substr(0,d)),t.format){case"date-time":case"datetime":c=new Date(ws(c)).toISOString().replace(/([0-9])0+Z$/,"$1Z");break;case"full-date":case"date":c=new Date(fi(c)).toISOString().substr(0,10);break;case"time":c=new Date(`1969-01-01 ${c}`).toISOString().substr(11);break;default:break}break}default:break}return c}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,c)=>{e.type==="array"&&t.type==="array"?e[n][c]=dt(e[n][c]||{},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(c=>pe(c,t))),l}let n={};return t.set(e,n),Object.keys(e).reduce((l,c)=>(l[c]=pe(e[c],t),l),n)}function Ss(e){let t=JSON.stringify(e),n=JSON.stringify(e,null,2);return t.length>400?`${n.substr(0,400)}...`:n}function hi(){return ee.pick([!1,!0,null,-1,NaN,Math.PI,1/0,void 0,[],{},Math.random(),Math.random().toString(36).substr(2)])}function Ts(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function Os(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=ee.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 Un(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 As(e,t){return!t.every(n=>Un(e,n))}function Es(e,t){return t.reduce((l,c)=>l+(Un(e,c)?1:0),0)===1}function vs(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function Rs(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 $n(e){return Object.prototype.toString.call(e)==="[object Object]"&&!Object.keys(e).length}function yi(e,t){t=t.items||t;let n=ne("alwaysFakeOptionals"),l=Array.isArray(t.required)&&t.required.includes(e)||n,c=typeof t.thunk=="function"||t.additionalProperties&&typeof t.additionalProperties.thunk=="function";return!l&&!c}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($n(e[l]))yi(l,t)&&delete e[l];else{let c=t;t&&t.properties&&t.properties[l]&&(c=t.properties[l]);let f=Fn(e[l],c);$n(f)||(e[l]=f)}typeof e[l]=="undefined"&&delete e[l]}),!(!Object.keys(e).length&&n))return e}function _s(e){return(t,n,l,c)=>{let f=t,d=[];typeof t=="object"&&(f=Object.keys(t)[0],Array.isArray(t[f])?d=t[f]:d.push(t[f]));let T=f.split("."),D=e();for(;T.length>1;)D=D[T.shift()];return t=typeof D=="object"?D[T[0]]:D,typeof t=="function"&&(t=t.apply(D,d.map(S=>fe.template(S,c)))),Object.prototype.toString.call(t)==="[object Object]"&&Object.keys(t).forEach(S=>{if(typeof t[S]=="function")throw new Error(`Cannot resolve value for '${l}: ${f}', given: ${t}`)}),t}}function Ps(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 Is(e,t,n){return Object.keys(e).filter(l=>{let c=Ji.indexOf(t)>-1;return n.indexOf(l)>-1&&!c}).length>0}function Ns(e,t){let n=Object.keys(Et);for(let l=0;l<n.length;l+=1){let c=n[l],f=t[t.length-1];if(Is(e,f,Et[c]))return c}}function xs(){return ne("random")()>.5}function ks(){return null}function Ms(e,t,n,l,c,f){let d=[],T=[];function D($){let v=JSON.stringify($.value);return T.indexOf(v)===-1?(T.push(v),d.push($),!0):!1}t.forEach(D);let S=100;for(;d.length!==t.length&&(D(f(n.items||l,e,c))||(S-=1),!!S););return d}function Cs(e,t,n,l){let c=[];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 c}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,T=ne("minItems"),D=ne("maxItems");T&&(f=typeof f=="undefined"?T:Math.min(T,f)),D&&(d=typeof d=="undefined"?D:Math.min(D,d),d&&d>D&&(d=D),f&&f>D&&(f=d));let S=ne("alwaysFakeOptionals")===!0?1:ne("optionalsProbability"),$=ne("alwaysFakeOptionals")||ne("fixedProbabilities")||!1,v=ee.number(f,d,1,5);S!==null&&(v=Math.max($?Math.round((d||v)*S):Math.abs(ee.number(f,d)*S),f||0));let B=typeof e.additionalItems=="object"?e.additionalItems:{};for(let W=c.length;W<v;W+=1){let le=t.concat(["items",W]),X=l(e.items||B,le,n);c.push(X)}if(e.contains&&v>0){let W=ee.number(0,v-1);c[W]=l(e.contains,t.concat(["items",W]),n)}return e.uniqueItems?Ms(t.concat(["items"]),c,e,B,n,l):c}function Ls(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,c=l&&String(l).match(/e-(\d)|\.(\d+)$/);if(c){let f=(Math.random()*ee.number(0,10)+1)*l,d=c[1]||c[2].length,T=parseFloat(f.toFixed(d)),D=ee.number(t,n-1);return String(T).includes(".")?D+T:(D+T).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=ee.number(Math.floor(t/l),Math.floor(n/l))*l;for(;f<t;)f+=l;return f}return ee.number(t,n,void 0,void 0,e.type!=="integer")}function Ds(e){return Math.floor(ei({...e}))}function Us(e){return ee.shuffle(nr).slice(0,e)}function $s(e,t,n,l){let c={},f=e.properties||{},d=e.patternProperties||{},T=typeof e.required=="boolean"?[]:(e.required||[]).slice(),D=e.additionalProperties!==!1,S=Object.keys(f),$=Object.keys(d),v=S.concat($).reduce((j,h)=>(T.indexOf(h)===-1&&j.push(h),j),[]),B=T.concat(v),W=D&&e.additionalProperties===!0?Vt:e.additionalProperties;if(!D&&S.length===0&&$.length===0&&fe.hasProperties(e,"minProperties","maxProperties","dependencies","required"))return null;if(ne("requiredOnly")===!0)return T.forEach(j=>{f[j]&&(c[j]=f[j])}),l(c,t.concat(["properties"]),n,e);let le=ne("alwaysFakeOptionals")===!0?1:ne("optionalsProbability"),X=ne("alwaysFakeOptionals")||ne("fixedProbabilities")||!1,ie=ne("ignoreProperties")||[],me=ne("reuseProperties"),we=ne("fillProperties"),F=e.maxProperties||B.length+(D?ee.number(1,5):0),g=Math.max(e.minProperties||0,T.length),b=Math.max(0,B.length-g);B.length===1&&!T.length&&(g=Math.max(ee.number(we?1:0,F),g)),le!==null&&(X===!0?b=Math.round(g-T.length+le*(B.length-g)):b=ee.number(g-T.length,le*(B.length-g)));let _=ee.shuffle(v).slice(0,b),I=v.filter(j=>_.indexOf(j)!==-1),M=le!==null||T.length===F?F:ee.number(0,F),R=T.concat(ee.shuffle(I).slice(0,M)).slice(0,F),N=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(j=>{let h=e.dependencies[j];if(R.indexOf(j)!==-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:j,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(j=>{if(f[j]&&["{}","true"].includes(JSON.stringify(f[j].not)))return;for(let x=0;x<ie.length;x+=1)if(ie[x]instanceof RegExp&&ie[x].test(j)||typeof ie[x]=="string"&&ie[x]===j||typeof ie[x]=="function"&&ie[x](f[j],j)){V.push(j);return}W===!1&&T.indexOf(j)!==-1&&(c[j]=f[j]),f[j]&&(c[j]=f[j]);let h;if($.forEach(x=>{j.match(new RegExp(x))&&(h=!0,c[j]?fe.merge(c[j],d[x]):c[ee.randexp(j)]=d[x])}),!h){let x=d[j]||W;x&&W!==!1?c[d[j]?ee.randexp(j):j]=f[j]||x:J.push(j)}});let te=Object.keys(c).length+(we?0:V.length),ve=j=>ee.randexp(`_?[_a-f\\d]{1,3}${j?"\\$?":""}`);function Re(j){let h;do{if(!j.length)break;h=j.shift()}while(c[h]);return h}let Pe=g;if(D&&!T.length&&(Pe=Math.max(le===null||W?ee.number(we?1:0,F):0,g)),!I.length&&!b&&D&&X===!0&&we){let j=ee.number(0,F);for(let h=0;h<j;h+=1)c[Wt(1)+ve(j[h])]=W||Vt}for(;we&&!(!($.length||D)||te>=Pe);){if(D)if(me&&S.length-te>Pe){let j=0,h;do{if(j+=1,j>1e3)break;h=Re(T)||ee.pick(S)}while(typeof c[h]!="undefined");typeof c[h]=="undefined"&&(c[h]=f[h],te+=1)}else if($.length&&!W){let j=ee.pick($),h=ee.randexp(j);c[h]||(c[h]=d[j],te+=1)}else{let j=Re(T)||Wt(1)+ve();c[j]||(c[j]=W||Vt,te+=1)}for(let j=0;te<g&&j<$.length;j+=1){let h=$[j],x=ee.randexp(h);c[x]||(c[x]=d[h],te+=1)}}if(T.length===0&&(!D||le===!1)){let j=ee.number(g,F);for(;te<j;){let h=Re(S);h&&(c[h]=f[h]),te+=1}}let ke=c;if(ne("sortProperties")!==null){let j=Object.keys(f);ke=Object.keys(c).sort((x,G)=>ne("sortProperties")?x.localeCompare(G):j.indexOf(x)-j.indexOf(G)).reduce((x,G)=>(x[G]=c[G],x),{})}let Le=l(ke,t.concat(["properties"]),n,e);return k.forEach(j=>{for(let h of j.values)if(fe.hasValue(h.properties[j.prop],Le.value[j.prop])){Object.keys(h.properties).forEach(x=>{x!==j.prop&&fe.merge(Le.value,l(h.properties,t.concat(["properties"]),n,e).value)});break}}),Le}function gi(){let e=ee.number(1,5);return Wt(e).join(" ")}function Fs(e=0,t=140){let n=Math.max(0,e),l=ee.number(n,t),c=gi();for(;c.length<n;)c+=gi();return c.length>l&&(c=c.substr(0,l)),c}function js(){return[0,0,0,0].map(()=>ee.number(0,255)).join(".")}function Ys(){return ee.date().toISOString()}function Ws(){return qt().slice(0,10)}function Vs(){return qt().slice(11)}function qs(e){return ee.randexp(Ye[e]).replace(lr,(t,n)=>ee.randexp(Ye[n]))}function Bs(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(ne("failOnInvalidFormat"))throw new Error(`unknown registry key ${fe.short(e.format)}`);return t()}throw new Error(`unsupported format '${e.format}'`)}}function Js(e){return fe.typecast("string",e,n=>e.format?Bs(e,()=>ti(n.minLength,n.maxLength)):e.pattern?ee.randexp(e.pattern):ti(n.minLength,n.maxLength))}function Gs({$comment:e,title:t,description:n}){return Object.entries({comment:e,title:t,description:n}).filter(([,l])=>l).reduce((l,[c,f])=>(l[c]=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 c={...Gs(e),schemaPath:t};if(t[t.length-1]!=="properties"){if(ne("useExamplesValue")&&Array.isArray(e.examples)){let S=e.examples.concat("default"in e?[e.default]:[]);return{value:fe.typecast(null,e,()=>ee.pick(S)),context:c}}if(ne("useExamplesValue")&&typeof e.example!="undefined")return{value:fe.typecast(null,e,()=>e.example),context:c};if(ne("useDefaultValue")&&"default"in e&&(e.default!==""||!ne("replaceEmptyByRandomValue")))return{value:e.default,context:c};if("template"in e)return{value:fe.template(e.template,l),context:c};if("const"in e)return{value:e.const,context:c}}if(e.not&&typeof e.not=="object"&&(e=fe.notValue(e.not,fe.omitProps(e,["not"])),e.type&&e.type==="object")){let{value:S,context:$}=ft(e,t.concat(["not"]),n,l);return{value:fe.clean(S,e,!1),context:{...c,items:$}}}if(typeof e.thunk=="function"){let{value:S,context:$}=ft(e.thunk(l),t,n);return{value:S,context:{...c,items:$}}}if(e.jsonPath)return{value:e,context:c};let f=e.type;if(Array.isArray(f)?f=ee.pick(f):typeof f=="undefined"&&(f=Gi(e,t)||f,f&&(e.type=f)),typeof e.generate=="function"){let S=fe.typecast(null,e,()=>e.generate(l,t)),$=S===null?"null":typeof S;if($===f||$==="number"&&f==="integer"||Array.isArray(S)&&f==="array")return{value:S,context:c}}if(typeof e.pattern=="string")return{value:fe.typecast("string",e,()=>ee.randexp(e.pattern)),context:c};if(Array.isArray(e.enum))return{value:fe.typecast(null,e,()=>ee.pick(e.enum)),context:c};if(typeof f=="string")if(vt[f])try{let S=vt[f](e,t,n,ft);return f==="array"?{value:S.map(({value:$})=>$),context:{...c,items:S.map(Array.isArray(e.items)?({context:$})=>$:({context:$})=>({...$,schemaPath:$.schemaPath.slice(0,-1)}))}}:f==="object"?S!==null?{value:S.value,context:{...c,items:S.context}}:{value:{},context:c}:{value:S,context:c}}catch(S){throw typeof S.path=="undefined"?new Yt(S.stack,t):S}else{if(ne("failOnInvalidTypes"))throw new Yt(`unknown primitive ${fe.short(f)}`,t.concat(["type"]));{let S=ne("defaultInvalidTypeProduct");return typeof S=="string"&&vt[S]?{value:vt[S](e,t,n,ft),context:c}:{value:S,context:c}}}let d={},T={...c};Array.isArray(e)&&(d=[]);let D=ne("pruneProperties")||[];return Object.keys(e).forEach(S=>{if(!D.includes(S)&&e[S]!==null)if(typeof e[S]=="object"&&S!=="definitions"){let{value:$,context:v}=ft(e[S],t.concat([S]),n,d);d[S]=fe.clean($,e[S],!1),T[S]=v,d[S]===null&&ne("omitNulls")&&(delete d[S],delete T[S])}else d[S]=e[S]}),{value:d,context:T}}function Hs(e){return Array.isArray(e)?ee.pick(e):e}function Ks(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(c=>jn(c,t,n,l));if(e.jsonPath){let{JSONPath:c}=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]=c(f.path,t).slice(0,f.count):n[d]=c(f.path,t)),f.cycle||f.reverse?Ks(n[d],f.reverse):Hs(n[d])}return Object.keys(e).forEach(c=>{e[c]=jn(e[c],t,n,c)}),e}function zs(e,t,n,l){if(Object.prototype.toString.call(t)!=="[object Object]")throw new Error(`Invalid input, expecting object but given ${typeof t}`);let c=ne("refDepthMin")||0,f=ne("refDepthMax")||3;try{let{resolveSchema:d}=hr({refs:e,schema:t,container:n,synchronous:l,refDepthMin:c,refDepthMax:f}),T=dr(fe.clone(t),[],d);return ne("resolveJsonPath")?{value:jn(T.value),context:T.context}:T}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function Xs(e){return e.value}function Qs(e,t){return t.reduce((n,l)=>l in n?n[l]:{},e)}function Yn(e,t,n,l=n){let{title:c,description:f,comment:d}=Qs(e,t),T=[];ne("renderTitle")&&c&&T.push(` ${c}`,""),ne("renderDescription")&&f&&T.push(` ${f}`),ne("renderComment")&&d&&T.push(` ${d}`),n.commentBefore=T.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,S)=>{Yn(e,[...t,"items",S],D)})}function Zs({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,c=l+ze.MAX_NUMBER,f=t.initialOffset||n.initialOffset;this.offset=f||ee.number(l,c)}return t?this.offset++:n}),Qe.define("sequentialDate",function(t,n){if(this.now||(this.now=ee.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()+ee.date(t))}return n})}function bi(e,t){let n={};Array.isArray(e)?e.forEach(c=>{n[c.$id||c.id]=c}):n=e||{};function l(c){if(!c||typeof c!="object")return;if(Array.isArray(c))return c.forEach(l);let f=c.$id||c.id;typeof f=="string"&&!n[f]&&(n[f]=c),Object.keys(c).forEach(d=>{l(c[d])})}return l(e),l(t),n}var Si,Wn,Ti,Vn,Oi,Ai,je,Ei,qn,U,Bn,vi,Ri,_i,Pi,Ii,Ot,Ft,Jn,Ni,xi,Gn,Hn,ki,Mi,Kn,de,zn,Ci,Li,At,ne,Xn,Qn,Di,Ui,$i,Fi,ji,Yi,ze,jt,ee,Wi,fe,Vi,qi,ht,Zn,Bi,Yt,Et,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,vt,dr,fr,hr,ii,ri,Ue,eo,to,no,io,ro,so,oo,ao,lo,co,po,uo,mr,yr,Rt,Qe,Ee,gr,wr,fo=E({"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},Ei=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Vn(t))!Ai.call(e,c)&&c!==n&&Wn(e,c,{get:()=>t[c],enumerable:!(l=Ti(t,c))||l.enumerable});return e},qn=(e,t,n)=>(n=e!=null?Si(Oi(e)):{},Ei(t||!e||!e.__esModule?Wn(n,"default",{value:e,enumerable:!0}):n,e)),U=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=U(),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()),c=()=>[{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:c(),not:!1}),e.notWhitespace=()=>({type:t.SET,set:c(),not:!0}),e.anyChar=()=>({type:t.SET,set:f(),not:!0})}}),vi=je({"node_modules/ret/lib/util.js"(e){var t=U(),n=Bn(),l="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",c={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(T,D,S,$,v,B,W,le){if(S)return T;var X=D?8:$?parseInt($,16):v?parseInt(v,16):B?parseInt(B,8):W?l.indexOf(W):c[le],ie=String.fromCharCode(X);return/[[\]{}^$.|?*+()]/.test(ie)&&(ie="\\"+ie),ie}),f},e.tokenizeClass=(f,d)=>{for(var T=[],D=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,S,$;(S=D.exec(f))!=null;)if(S[1])T.push(n.words());else if(S[2])T.push(n.ints());else if(S[3])T.push(n.whitespace());else if(S[4])T.push(n.notWords());else if(S[5])T.push(n.notInts());else if(S[6])T.push(n.notWhitespace());else if(S[7])T.push({type:t.RANGE,from:(S[8]||S[9]).charCodeAt(0),to:S[10].charCodeAt(0)});else if($=S[12])T.push({type:t.CHAR,value:$.charCodeAt(0)});else return[T,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=U();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=vi(),l=U(),c=Bn(),f=Ri();t.exports=d=>{var T=0,D,S,$={type:l.ROOT,stack:[]},v=$,B=$.stack,W=[],le=I=>{n.error(d,`Nothing to repeat at column ${I-1}`)},X=n.strToChars(d);for(D=X.length;T<D;)switch(S=X[T++],S){case"\\":switch(S=X[T++],S){case"b":B.push(f.wordBoundary());break;case"B":B.push(f.nonWordBoundary());break;case"w":B.push(c.words());break;case"W":B.push(c.notWords());break;case"d":B.push(c.ints());break;case"D":B.push(c.notInts());break;case"s":B.push(c.whitespace());break;case"S":B.push(c.notWhitespace());break;default:/\d/.test(S)?B.push({type:l.REFERENCE,value:parseInt(S,10)}):B.push({type:l.CHAR,value:S.charCodeAt(0)})}break;case"^":B.push(f.begin());break;case"$":B.push(f.end());break;case"[":var ie;X[T]==="^"?(ie=!0,T++):ie=!1;var me=n.tokenizeClass(X.slice(T),d);T+=me[1],B.push({type:l.SET,set:me[0],not:ie});break;case".":B.push(c.anyChar());break;case"(":var we={type:l.GROUP,stack:[],remember:!0};S=X[T],S==="?"&&(S=X[T+1],T+=2,S==="="?we.followedBy=!0:S==="!"?we.notFollowedBy=!0:S!==":"&&n.error(d,`Invalid group, character '${S}' after '?' at column ${T-1}`),we.remember=!1),B.push(we),W.push(v),v=we,B=we.stack;break;case")":W.length===0&&n.error(d,`Unmatched ) at column ${T-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 g=/^(\d+)(,(\d+)?)?\}/.exec(X.slice(T)),b,_;g!==null?(B.length===0&&le(T),b=parseInt(g[1],10),_=g[2]?g[3]?parseInt(g[3],10):1/0:b,T+=g[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(T),B.push({type:l.REPETITION,min:0,max:1,value:B.pop()});break;case"+":B.length===0&&le(T),B.push({type:l.REPETITION,min:1,max:1/0,value:B.pop()});break;case"*":B.length===0&&le(T),B.push({type:l.REPETITION,min:0,max:1/0,value:B.pop()});break;default:B.push({type:l.CHAR,value:S.charCodeAt(0)})}return W.length!==0&&n.error(d,"Unterminated group"),$},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 T=D=>{for(var S=0;S<this.ranges.length&&!D.touches(this.ranges[S]);)S++;for(var $=this.ranges.slice(0,S);S<this.ranges.length&&D.touches(this.ranges[S]);)D=D.add(this.ranges[S]),S++;$.push(D),this.ranges=$.concat(this.ranges.slice(S)),this._update_length()};return f instanceof Lt?f.ranges.forEach(T):(d==null&&(d=f),T(new n(f,d))),this}subtract(f,d){var T=D=>{for(var S=0;S<this.ranges.length&&!D.overlaps(this.ranges[S]);)S++;for(var $=this.ranges.slice(0,S);S<this.ranges.length&&D.overlaps(this.ranges[S]);)$=$.concat(this.ranges[S].subtract(D)),S++;this.ranges=$.concat(this.ranges.slice(S)),this._update_length()};return f instanceof Lt?f.ranges.forEach(T):(d==null&&(d=f),T(new n(f,d))),this}intersect(f,d){var T=[],D=S=>{for(var $=0;$<this.ranges.length&&!S.overlaps(this.ranges[$]);)$++;for(;$<this.ranges.length&&S.overlaps(this.ranges[$]);){var v=Math.max(this.ranges[$].low,S.low),B=Math.min(this.ranges[$].high,S.high);T.push(new n(v,B)),$++}};return f instanceof Lt?f.ranges.forEach(D):(d==null&&(d=f),D(new n(f,d))),this.ranges=T,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 T=d.low;T<=d.high;)f.push(T),T++;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(),c=n.types;t.exports=class Dt{constructor(d,T){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=T&&T.indexOf("i")!==-1,this.multiline=T&&T.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,T){var D,S,$,v,B;switch(d.type){case c.ROOT:case c.GROUP:if(d.followedBy||d.notFollowedBy)return"";for(d.remember&&d.groupNumber===void 0&&(d.groupNumber=T.push(null)-1),D=d.options?this._randSelect(d.options):d.stack,S="",v=0,B=D.length;v<B;v++)S+=this._gen(D[v],T);return d.remember&&(T[d.groupNumber]=S),S;case c.POSITION:return"";case c.SET:var W=this._expand(d);return W.length?String.fromCharCode(this._randSelect(W)):"";case c.REPETITION:for($=this.randInt(d.min,d.max===1/0?d.min+this.max:d.max),S="",v=0;v<$;v++)S+=this._gen(d.value,T);return S;case c.REFERENCE:return T[d.value-1]||"";case c.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 T=new l;for(let D=0;D<d.set.length;D++){let S=this._expand(d.set[D]);if(T.add(S),this.ignoreCase)for(let $=0;$<S.length;$++){let v=S.index($),B=this._toOtherCase(v);v!==B&&T.add(B)}}return d.not?this.defaultRange.clone().subtract(T):this.defaultRange.clone().intersect(T)}}randInt(d,T){return d+Math.floor(Math.random()*(1+T-d))}get defaultRange(){return this._range=this._range||new l(32,126)}set defaultRange(d){this._range=d}static randexp(d,T){var D;return typeof d=="string"&&(d=new RegExp(d,T)),d._randexp===void 0?(D=new Dt(d,T),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:",c={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function f(F){let g=[0],b=F.indexOf(`
`);for(;b!==-1;)b+=1,g.push(b),b=F.indexOf(`
`,b);return g}function d(F){let g,b;return typeof F=="string"?(g=f(F),b=F):(Array.isArray(F)&&(F=F[0]),F&&F.context&&(F.lineStarts||(F.lineStarts=f(F.context.src)),g=F.lineStarts,b=F.context.src)),{lineStarts:g,src:b}}function T(F,g){if(typeof F!="number"||F<0)return null;let{lineStarts:b,src:_}=d(g);if(!b||!_||F>_.length)return null;for(let M=0;M<b.length;++M){let R=b[M];if(F<R)return{line:M,col:F-b[M-1]+1};if(F===R)return{line:M+1,col:1}}let I=b.length;return{line:I,col:F-b[I-1]+1}}function D(F,g){let{lineStarts:b,src:_}=d(g);if(!b||!(F>=1)||F>b.length)return null;let I=b[F-1],M=b[F];for(;M&&M>I&&_[M-1]===`
`;)--M;return _.slice(I,M)}function S({start:F,end:g},b,_=80){let I=D(F.line,b);if(!I)return null;let{col:M}=F;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="";g&&(g.line===F.line&&M+(g.col-F.col)<=_+1?R=g.col-F.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 $=class xr{static copy(g){return new xr(g.start,g.end)}constructor(g,b){this.start=g,this.end=b||g}isEmpty(){return typeof this.start!="number"||!this.end||this.end<=this.start}setOrigRange(g,b){let{start:_,end:I}=this;if(g.length===0||I<=g[0])return this.origStart=_,this.origEnd=I,b;let M=b;for(;M<g.length&&!(g[M]>_);)++M;this.origStart=_+M;let R=M;for(;M<g.length&&!(g[M]>=I);)++M;return this.origEnd=I+M,R}},v=class nt{static addStringTerminator(g,b,_){if(_[_.length-1]===`
`)return _;let I=nt.endOfWhiteSpace(g,b);return I>=g.length||g[I]===`
`?_+`
`:_}static atDocumentBoundary(g,b,_){let I=g[b];if(!I)return!0;let M=g[b-1];if(M&&M!==`
`)return!1;if(_){if(I!==_)return!1}else if(I!==t.DIRECTIVES_END&&I!==t.DOCUMENT_END)return!1;let R=g[b+1],N=g[b+2];if(R!==I||N!==I)return!1;let k=g[b+3];return!k||k===`
`||k==="